summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/xe/xe_bo.c
diff options
context:
space:
mode:
authorFrancois Dugast <francois.dugast@intel.com>2023-05-04 23:29:43 +0300
committerRodrigo Vivi <rodrigo.vivi@intel.com>2023-12-20 02:33:13 +0300
commit116d32515214910d8a34538dbd09ef26a878d5ae (patch)
tree42980ed72050baff8796fabb9857e906bb770a22 /drivers/gpu/drm/xe/xe_bo.c
parentbb95a4f9f5c2e9b0a43590958ba1430519592909 (diff)
downloadlinux-116d32515214910d8a34538dbd09ef26a878d5ae.tar.xz
drm/xe: Fix splat during error dump
Allow xe_bo_addr without lock to print debug information, such as from xe_analyze_vm. Signed-off-by: Francois Dugast <francois.dugast@intel.com> Reviewed-by: Matthew Brost <matthew.brost@intel.com> Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Diffstat (limited to 'drivers/gpu/drm/xe/xe_bo.c')
-rw-r--r--drivers/gpu/drm/xe/xe_bo.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/drivers/gpu/drm/xe/xe_bo.c b/drivers/gpu/drm/xe/xe_bo.c
index 9a565203deac..4693372ec82e 100644
--- a/drivers/gpu/drm/xe/xe_bo.c
+++ b/drivers/gpu/drm/xe/xe_bo.c
@@ -1545,15 +1545,18 @@ bool xe_bo_is_xe_bo(struct ttm_buffer_object *bo)
return false;
}
-dma_addr_t xe_bo_addr(struct xe_bo *bo, u64 offset,
+/*
+ * Resolve a BO address. There is no assert to check if the proper lock is held
+ * so it should only be used in cases where it is not fatal to get the wrong
+ * address, such as printing debug information, but not in cases where memory is
+ * written based on this result.
+ */
+dma_addr_t __xe_bo_addr(struct xe_bo *bo, u64 offset,
size_t page_size, bool *is_vram)
{
struct xe_res_cursor cur;
u64 page;
- if (!READ_ONCE(bo->ttm.pin_count))
- xe_bo_assert_held(bo);
-
XE_BUG_ON(page_size > PAGE_SIZE);
page = offset >> PAGE_SHIFT;
offset &= (PAGE_SIZE - 1);
@@ -1575,6 +1578,14 @@ dma_addr_t xe_bo_addr(struct xe_bo *bo, u64 offset,
}
}
+dma_addr_t xe_bo_addr(struct xe_bo *bo, u64 offset,
+ size_t page_size, bool *is_vram)
+{
+ if (!READ_ONCE(bo->ttm.pin_count))
+ xe_bo_assert_held(bo);
+ return __xe_bo_addr(bo, offset, page_size, is_vram);
+}
+
int xe_bo_vmap(struct xe_bo *bo)
{
void *virtual;