[PATCH v2] drm/xe/xe_lrc: Fix context descriptors

Jonathan Cavitt jonathan.cavitt at intel.com
Wed Nov 13 15:29:46 UTC 2024


The direct and indirect context descriptors in xe_lrc_snapshot have
various problems:

- context_desc uses an incomplete 32-bit offset into the GGTT at which
  the LRC resides.  This is not the same thing as the descriptor itself,
  which is reported by the function xe_lrc_descriptor.

- indirect_context_desc currently only reports the indirect ring state,
  as described at xe_lrc_indirect_ring_ggtt_addr.  The variable name
  does not accurately reflect its purpose and should be changed.

Fix these issues.

v2:
- Properly convert context_desc into a 64-bit address (Matt)

Signed-off-by: Jonathan Cavitt <jonathan.cavitt at intel.com>
CC: Matt Roper <matthew.d.roper at intel.com>
CC: John Harrison <john.c.harrison at intel.com>
---
 drivers/gpu/drm/xe/xe_lrc.c | 8 ++++----
 drivers/gpu/drm/xe/xe_lrc.h | 4 ++--
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/xe/xe_lrc.c b/drivers/gpu/drm/xe/xe_lrc.c
index 4b65da77c6e0..086fcdb6f288 100644
--- a/drivers/gpu/drm/xe/xe_lrc.c
+++ b/drivers/gpu/drm/xe/xe_lrc.c
@@ -1635,8 +1635,8 @@ struct xe_lrc_snapshot *xe_lrc_snapshot_capture(struct xe_lrc *lrc)
 	if (lrc->bo->vm)
 		xe_vm_get(lrc->bo->vm);
 
-	snapshot->context_desc = xe_lrc_ggtt_addr(lrc);
-	snapshot->indirect_context_desc = xe_lrc_indirect_ring_ggtt_addr(lrc);
+	snapshot->context_desc = xe_lrc_descriptor(lrc);
+	snapshot->indirect_ring_state = xe_lrc_indirect_ring_ggtt_addr(lrc);
 	snapshot->head = xe_lrc_ring_head(lrc);
 	snapshot->tail.internal = lrc->ring.tail;
 	snapshot->tail.memory = xe_lrc_ring_tail(lrc);
@@ -1692,9 +1692,9 @@ void xe_lrc_snapshot_print(struct xe_lrc_snapshot *snapshot, struct drm_printer
 	if (!snapshot)
 		return;
 
-	drm_printf(p, "\tHW Context Desc: 0x%08x\n", snapshot->context_desc);
+	drm_printf(p, "\tHW Context Desc: 0x%016x\n", snapshot->context_desc);
 	drm_printf(p, "\tHW Indirect Ring State: 0x%08x\n",
-		   snapshot->indirect_context_desc);
+		   snapshot->indirect_ring_state);
 	drm_printf(p, "\tLRC Head: (memory) %u\n", snapshot->head);
 	drm_printf(p, "\tLRC Tail: (internal) %u, (memory) %u\n",
 		   snapshot->tail.internal, snapshot->tail.memory);
diff --git a/drivers/gpu/drm/xe/xe_lrc.h b/drivers/gpu/drm/xe/xe_lrc.h
index 40d8f6906d3e..7da9614e5f74 100644
--- a/drivers/gpu/drm/xe/xe_lrc.h
+++ b/drivers/gpu/drm/xe/xe_lrc.h
@@ -24,8 +24,8 @@ struct xe_lrc_snapshot {
 	void *lrc_snapshot;
 	unsigned long lrc_size, lrc_offset;
 
-	u32 context_desc;
-	u32 indirect_context_desc;
+	u64 context_desc;
+	u32 indirect_ring_state;
 	u32 head;
 	struct {
 		u32 internal;
-- 
2.43.0



More information about the Intel-xe mailing list