drm/xe/bo: Remove the lock_no_vm()/unlock_no_vm() interface
authorThomas Hellström <thomas.hellstrom@linux.intel.com>
Fri, 8 Sep 2023 09:17:13 +0000 (11:17 +0200)
committerRodrigo Vivi <rodrigo.vivi@intel.com>
Thu, 21 Dec 2023 16:41:07 +0000 (11:41 -0500)
Apart from asserts, it's essentially the same as
xe_bo_lock()/xe_bo_unlock(), and the usage intentions of this interface
was unclear. Remove it.

v2:
- Update the xe_display subsystem as well.

Signed-off-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
Reviewed-by: Matthew Brost <matthew.brost@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230908091716.36984-4-thomas.hellstrom@linux.intel.com
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
drivers/gpu/drm/xe/tests/xe_bo.c
drivers/gpu/drm/xe/tests/xe_dma_buf.c
drivers/gpu/drm/xe/tests/xe_migrate.c
drivers/gpu/drm/xe/xe_bo.h
drivers/gpu/drm/xe/xe_dma_buf.c
drivers/gpu/drm/xe/xe_lrc.c

index ad6dd6fae853b20b9a92fe22d320ceeb9125d8b8..2c04357377abcf4fbd7a14ef52da2cb1dfee0c94 100644 (file)
@@ -143,7 +143,7 @@ static void ccs_test_run_gt(struct xe_device *xe, struct xe_gt *gt,
        ret = ccs_test_migrate(gt, bo, true, 0ULL, 0ULL, test);
 
 out_unlock:
-       xe_bo_unlock_no_vm(bo);
+       xe_bo_unlock(bo);
        xe_bo_put(bo);
 }
 
index 810a035bf72005bd620b01bc4625f63736d8c61d..1c4d8751be696bf9f30f36ae770a75e6ad7805b6 100644 (file)
@@ -147,14 +147,14 @@ static void xe_test_dmabuf_import_same_driver(struct xe_device *xe)
                        int err;
 
                        /* Is everything where we expect it to be? */
-                       xe_bo_lock_no_vm(import_bo, NULL);
+                       xe_bo_lock(import_bo, false);
                        err = xe_bo_validate(import_bo, NULL, false);
                        if (err && err != -EINTR && err != -ERESTARTSYS)
                                KUNIT_FAIL(test,
                                           "xe_bo_validate() failed with err=%d\n", err);
 
                        check_residency(test, bo, import_bo, dmabuf);
-                       xe_bo_unlock_no_vm(import_bo);
+                       xe_bo_unlock(import_bo);
                }
                drm_gem_object_put(import);
        } else if (PTR_ERR(import) != -EOPNOTSUPP) {
index 8bb081086ca2e558a13961a97c2c75062bf4fe9b..f58cd1da1a341f4e3f624841dd32bb7229889ddb 100644 (file)
@@ -183,7 +183,7 @@ static void test_copy(struct xe_migrate *m, struct xe_bo *bo,
 
        xe_bo_vunmap(sysmem);
 out_unlock:
-       xe_bo_unlock_no_vm(sysmem);
+       xe_bo_unlock(sysmem);
        xe_bo_put(sysmem);
 }
 
index c06dafcc93ec1ca023f24e4e2e3b1ec28fb285f9..d22b2ae7db7296328b834ebb7080fffaaf4e810c 100644 (file)
@@ -173,25 +173,6 @@ static inline void xe_bo_unlock_vm_held(struct xe_bo *bo)
        }
 }
 
-static inline void xe_bo_lock_no_vm(struct xe_bo *bo,
-                                   struct ww_acquire_ctx *ctx)
-{
-       if (bo) {
-               XE_WARN_ON(bo->vm || (bo->ttm.type != ttm_bo_type_sg &&
-                                     bo->ttm.base.resv != &bo->ttm.base._resv));
-               dma_resv_lock(bo->ttm.base.resv, ctx);
-       }
-}
-
-static inline void xe_bo_unlock_no_vm(struct xe_bo *bo)
-{
-       if (bo) {
-               XE_WARN_ON(bo->vm || (bo->ttm.type != ttm_bo_type_sg &&
-                                     bo->ttm.base.resv != &bo->ttm.base._resv));
-               dma_resv_unlock(bo->ttm.base.resv);
-       }
-}
-
 int xe_bo_pin_external(struct xe_bo *bo);
 int xe_bo_pin(struct xe_bo *bo);
 void xe_bo_unpin_external(struct xe_bo *bo);
@@ -206,9 +187,9 @@ static inline bool xe_bo_is_pinned(struct xe_bo *bo)
 static inline void xe_bo_unpin_map_no_vm(struct xe_bo *bo)
 {
        if (likely(bo)) {
-               xe_bo_lock_no_vm(bo, NULL);
+               xe_bo_lock(bo, false);
                xe_bo_unpin(bo);
-               xe_bo_unlock_no_vm(bo);
+               xe_bo_unlock(bo);
 
                xe_bo_put(bo);
        }
index b9bf4b4dd8a5e5d4827a4c6c7fb9f9d4e840fb11..8ce1b582402a68418a1cfaa112c96768968e9ae8 100644 (file)
@@ -150,9 +150,10 @@ static int xe_dma_buf_begin_cpu_access(struct dma_buf *dma_buf,
        if (!reads)
                return 0;
 
-       xe_bo_lock_no_vm(bo, NULL);
+       /* Can we do interruptible lock here? */
+       xe_bo_lock(bo, false);
        (void)xe_bo_migrate(bo, XE_PL_TT);
-       xe_bo_unlock_no_vm(bo);
+       xe_bo_unlock(bo);
 
        return 0;
 }
index 434fbb364b4bf257cbedfa38ca0d5aff903ecef5..6f899b6a4877401472d255367c8ddfac08e05721 100644 (file)
@@ -790,15 +790,9 @@ err_lrc_finish:
 void xe_lrc_finish(struct xe_lrc *lrc)
 {
        xe_hw_fence_ctx_finish(&lrc->fence_ctx);
-       if (lrc->bo->vm)
-               xe_vm_lock(lrc->bo->vm, false);
-       else
-               xe_bo_lock_no_vm(lrc->bo, NULL);
+       xe_bo_lock(lrc->bo, false);
        xe_bo_unpin(lrc->bo);
-       if (lrc->bo->vm)
-               xe_vm_unlock(lrc->bo->vm);
-       else
-               xe_bo_unlock_no_vm(lrc->bo);
+       xe_bo_unlock(lrc->bo);
        xe_bo_put(lrc->bo);
 }