Merge drm/drm-fixes into drm-misc-fixes
[sfrench/cifs-2.6.git] / drivers / gpu / drm / amd / amdgpu / amdgpu_vm_sdma.c
index c7bf189d50deff7bfed19cfea745e66c1c418c13..69e105fa41f68461e58e91c1444fdd9246977449 100644 (file)
@@ -112,7 +112,8 @@ static int amdgpu_vm_sdma_commit(struct amdgpu_vm_update_params *p,
                swap(p->vm->last_unlocked, tmp);
                dma_fence_put(tmp);
        } else {
-               amdgpu_bo_fence(p->vm->root.bo, f, true);
+               dma_resv_add_fence(p->vm->root.bo->tbo.base.resv, f,
+                                  DMA_RESV_USAGE_BOOKKEEP);
        }
 
        if (fence && !p->immediate) {
@@ -218,12 +219,15 @@ static int amdgpu_vm_sdma_update(struct amdgpu_vm_update_params *p,
        int r;
 
        /* Wait for PD/PT moves to be completed */
-       dma_resv_for_each_fence(&cursor, bo->tbo.base.resv,
-                               DMA_RESV_USAGE_KERNEL, fence) {
+       dma_resv_iter_begin(&cursor, bo->tbo.base.resv, DMA_RESV_USAGE_KERNEL);
+       dma_resv_for_each_fence_unlocked(&cursor, fence) {
                r = amdgpu_sync_fence(&p->job->sync, fence);
-               if (r)
+               if (r) {
+                       dma_resv_iter_end(&cursor);
                        return r;
+               }
        }
+       dma_resv_iter_end(&cursor);
 
        do {
                ndw = p->num_dw_left;