From: Christian König Date: Wed, 30 Jan 2019 13:12:51 +0000 (+0100) Subject: drm/amdgpu: fix waiting for BO moves with CPU based PD/PT updates X-Git-Url: http://git.cdn.openwrt.org/?a=commitdiff_plain;h=90d647222a8f004bf1430ecea3099ebcc54bfc21;p=openwrt%2Fstaging%2Fblogic.git drm/amdgpu: fix waiting for BO moves with CPU based PD/PT updates Otherwise we open up the possibility to use uninitialized memory. Signed-off-by: Christian König Reviewed-by: Felix Kuehling Signed-off-by: Alex Deucher --- diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c index a404ac17e5ae..93b936f7de4b 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c @@ -1781,13 +1781,18 @@ static int amdgpu_vm_bo_update_mapping(struct amdgpu_device *adev, if (pages_addr) params.src = ~0; - /* Wait for PT BOs to be free. PTs share the same resv. object + /* Wait for PT BOs to be idle. PTs share the same resv. object * as the root PD BO */ r = amdgpu_vm_wait_pd(adev, vm, owner); if (unlikely(r)) return r; + /* Wait for any BO move to be completed */ + r = dma_fence_wait(exclusive, true); + if (unlikely(r)) + return r; + params.func = amdgpu_vm_cpu_set_ptes; params.pages_addr = pages_addr; return amdgpu_vm_update_ptes(¶ms, start, last + 1,