Skip to content

Commit ab8363d

Browse files
Chen Lialexdeucher
authored andcommitted
radeon: use memcpy_to/fromio for UVD fw upload
I met a gpu addr bug recently and the kernel log tells me the pc is memcpy/memset and link register is radeon_uvd_resume. As we know, in some architectures, optimized memcpy/memset may not work well on device memory. Trival memcpy_toio/memset_io can fix this problem. BTW, amdgpu has already done it in: commit ba0b227 ("drm/amdgpu: use memcpy_to/fromio for UVD fw upload"), that's why it has no this issue on the same gpu and platform. Signed-off-by: Chen Li <[email protected]> Reviewed-by: Christian König <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
1 parent 924f41e commit ab8363d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/gpu/drm/radeon/radeon_uvd.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -286,15 +286,15 @@ int radeon_uvd_resume(struct radeon_device *rdev)
286286
if (rdev->uvd.vcpu_bo == NULL)
287287
return -EINVAL;
288288

289-
memcpy(rdev->uvd.cpu_addr, rdev->uvd_fw->data, rdev->uvd_fw->size);
289+
memcpy_toio((void __iomem *)rdev->uvd.cpu_addr, rdev->uvd_fw->data, rdev->uvd_fw->size);
290290

291291
size = radeon_bo_size(rdev->uvd.vcpu_bo);
292292
size -= rdev->uvd_fw->size;
293293

294294
ptr = rdev->uvd.cpu_addr;
295295
ptr += rdev->uvd_fw->size;
296296

297-
memset(ptr, 0, size);
297+
memset_io((void __iomem *)ptr, 0, size);
298298

299299
return 0;
300300
}

0 commit comments

Comments
 (0)