In psp_copy_fw(), 1 Mo of memory is zeroed, the partially re-written.
Save a few cycles and use memcpy_and_pad() which avoids writing twice
some of the memory.

Signed-off-by: Christophe JAILLET <[email protected]>
---
Compile-tested only.
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
index 665a2632379d..9525a6bab33b 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
@@ -4586,8 +4586,7 @@ int psp_copy_fw(struct psp_context *psp, uint8_t 
*start_addr, uint32_t bin_size)
                return -EINVAL;
        }
 
-       memset(psp->fw_pri_buf, 0, PSP_1_MEG);
-       memcpy(psp->fw_pri_buf, start_addr, bin_size);
+       memcpy_and_pad(psp->fw_pri_buf, PSP_1_MEG, start_addr, bin_size, 0);
 
        drm_dev_exit(idx);
        return 0;
-- 
2.54.0

Reply via email to