drm/amdgpu: expand sdma copy_buffer interface with tmz parameter
[linux-2.6-microblaze.git] / drivers / gpu / drm / amd / amdgpu / amdgpu_vm_cpu.c
index 73fec7a..e385163 100644 (file)
@@ -44,26 +44,14 @@ static int amdgpu_vm_cpu_map_table(struct amdgpu_bo *table)
  * Returns:
  * Negativ errno, 0 for success.
  */
-static int amdgpu_vm_cpu_prepare(struct amdgpu_vm_update_params *p, void *owner,
-                                struct dma_fence *exclusive)
+static int amdgpu_vm_cpu_prepare(struct amdgpu_vm_update_params *p,
+                                struct dma_resv *resv,
+                                enum amdgpu_sync_mode sync_mode)
 {
-       int r;
-
-       /* Wait for any BO move to be completed */
-       if (exclusive) {
-               r = dma_fence_wait(exclusive, true);
-               if (unlikely(r))
-                       return r;
-       }
-
-       /* Don't wait for submissions during page fault */
-       if (p->direct)
+       if (!resv)
                return 0;
 
-       /* Wait for PT BOs to be idle. PTs share the same resv. object
-        * as the root PD BO
-        */
-       return amdgpu_bo_sync_wait(p->vm->root.base.bo, owner, true);
+       return amdgpu_bo_sync_wait_resv(p->adev, resv, sync_mode, p->vm, true);
 }
 
 /**
@@ -86,6 +74,13 @@ static int amdgpu_vm_cpu_update(struct amdgpu_vm_update_params *p,
 {
        unsigned int i;
        uint64_t value;
+       int r;
+
+       if (bo->tbo.moving) {
+               r = dma_fence_wait(bo->tbo.moving, true);
+               if (r)
+                       return r;
+       }
 
        pe += (unsigned long)amdgpu_bo_kptr(bo);