summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/xe/xe_bo.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/drm/xe/xe_bo.c')
-rw-r--r--drivers/gpu/drm/xe/xe_bo.c43
1 files changed, 26 insertions, 17 deletions
diff --git a/drivers/gpu/drm/xe/xe_bo.c b/drivers/gpu/drm/xe/xe_bo.c
index 3cfd3f37c81e..ee8e3c940cf4 100644
--- a/drivers/gpu/drm/xe/xe_bo.c
+++ b/drivers/gpu/drm/xe/xe_bo.c
@@ -1082,13 +1082,11 @@ static void xe_gem_object_close(struct drm_gem_object *obj,
struct xe_bo *bo = gem_to_xe_bo(obj);
if (bo->vm && !xe_vm_in_fault_mode(bo->vm)) {
- struct ww_acquire_ctx ww;
-
XE_WARN_ON(!xe_bo_is_user(bo));
- xe_bo_lock(bo, &ww, 0, false);
+ xe_bo_lock(bo, false);
ttm_bo_set_bulk_move(&bo->ttm, NULL);
- xe_bo_unlock(bo, &ww);
+ xe_bo_unlock(bo);
}
}
@@ -1873,26 +1871,37 @@ int xe_gem_mmap_offset_ioctl(struct drm_device *dev, void *data,
return 0;
}
-int xe_bo_lock(struct xe_bo *bo, struct ww_acquire_ctx *ww,
- int num_resv, bool intr)
+/**
+ * xe_bo_lock() - Lock the buffer object's dma_resv object
+ * @bo: The struct xe_bo whose lock is to be taken
+ * @intr: Whether to perform any wait interruptible
+ *
+ * Locks the buffer object's dma_resv object. If the buffer object is
+ * pointing to a shared dma_resv object, that shared lock is locked.
+ *
+ * Return: 0 on success, -EINTR if @intr is true and the wait for a
+ * contended lock was interrupted. If @intr is set to false, the
+ * function always returns 0.
+ */
+int xe_bo_lock(struct xe_bo *bo, bool intr)
{
- struct ttm_validate_buffer tv_bo;
- LIST_HEAD(objs);
- LIST_HEAD(dups);
+ if (intr)
+ return dma_resv_lock_interruptible(bo->ttm.base.resv, NULL);
- XE_WARN_ON(!ww);
+ dma_resv_lock(bo->ttm.base.resv, NULL);
- tv_bo.num_shared = num_resv;
- tv_bo.bo = &bo->ttm;
- list_add_tail(&tv_bo.head, &objs);
-
- return ttm_eu_reserve_buffers(ww, &objs, intr, &dups);
+ return 0;
}
-void xe_bo_unlock(struct xe_bo *bo, struct ww_acquire_ctx *ww)
+/**
+ * xe_bo_unlock() - Unlock the buffer object's dma_resv object
+ * @bo: The struct xe_bo whose lock is to be released.
+ *
+ * Unlock a buffer object lock that was locked by xe_bo_lock().
+ */
+void xe_bo_unlock(struct xe_bo *bo)
{
dma_resv_unlock(bo->ttm.base.resv);
- ww_acquire_fini(ww);
}
/**