drm/amdgpu: fix waiting for BO moves with CPU based PD/PT updates
authorChristian König <christian.koenig@amd.com>
Wed, 30 Jan 2019 13:12:51 +0000 (14:12 +0100)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 6 Feb 2019 02:16:22 +0000 (21:16 -0500)
Otherwise we open up the possibility to use uninitialized memory.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c

index a404ac17e5ae06fff21503152b9f2460a26301e3..93b936f7de4bd891f094f6085714d27b1211900d 100644 (file)
@@ -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(&params, start, last + 1,