The VCPU BO doesn't only contain the VCE firmware but also other
ranges that the VCE uses for its stack and data. Let's initialize
this to zero to avoid having garbage in the VCPU BO.

Fixes: d38ceaf99ed0 ("drm/amdgpu: add core driver (v4)")
Signed-off-by: Timur Kristóf <[email protected]>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c
index b9060bcd4806..eaa06dbef5c4 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c
@@ -310,6 +310,7 @@ int amdgpu_vce_resume(struct amdgpu_device *adev)
        offset = le32_to_cpu(hdr->ucode_array_offset_bytes);
 
        if (drm_dev_enter(adev_to_drm(adev), &idx)) {
+               memset32(cpu_addr, 0, amdgpu_bo_size(adev->vce.vcpu_bo) / 4);
                memcpy_toio(cpu_addr, adev->vce.fw->data + offset,
                            adev->vce.fw->size - offset);
                drm_dev_exit(idx);
-- 
2.51.0

Reply via email to