summaryrefslogtreecommitdiffstats
path: root/drivers/gpu
diff options
context:
space:
mode:
authorMaarten Lankhorst <maarten.lankhorst@linux.intel.com>2023-01-31 23:36:39 +0100
committerRodrigo Vivi <rodrigo.vivi@intel.com>2023-12-19 18:27:48 -0500
commit77775e24e684c761d44ba2f804581c0c42e0ad38 (patch)
treef99e45d1a1db81252bc395ed454221216115bff6 /drivers/gpu
parent50a48cca608102a53a0961bd95aefb53a8ced3ab (diff)
downloadlinux-stable-77775e24e684c761d44ba2f804581c0c42e0ad38.tar.gz
linux-stable-77775e24e684c761d44ba2f804581c0c42e0ad38.tar.bz2
linux-stable-77775e24e684c761d44ba2f804581c0c42e0ad38.zip
drm/xe: Add debugfs for dumping GGTT mappings
Adding a debugfs dump of GGTT was useful for some debugging I did, and easy to add. Might be useful for others too. Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Reviewed-by: Matthew Auld <matthew.auld@intel.com> Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Diffstat (limited to 'drivers/gpu')
-rw-r--r--drivers/gpu/drm/xe/xe_ggtt.c13
-rw-r--r--drivers/gpu/drm/xe/xe_ggtt.h4
-rw-r--r--drivers/gpu/drm/xe/xe_gt_debugfs.c10
3 files changed, 27 insertions, 0 deletions
diff --git a/drivers/gpu/drm/xe/xe_ggtt.c b/drivers/gpu/drm/xe/xe_ggtt.c
index 20450ed8400b..907a603572b2 100644
--- a/drivers/gpu/drm/xe/xe_ggtt.c
+++ b/drivers/gpu/drm/xe/xe_ggtt.c
@@ -345,3 +345,16 @@ void xe_ggtt_remove_bo(struct xe_ggtt *ggtt, struct xe_bo *bo)
xe_ggtt_remove_node(ggtt, &bo->ggtt_node);
}
+
+int xe_ggtt_dump(struct xe_ggtt *ggtt, struct drm_printer *p)
+{
+ int err;
+
+ err = mutex_lock_interruptible(&ggtt->lock);
+ if (err)
+ return err;
+
+ drm_mm_print(&ggtt->mm, p);
+ mutex_unlock(&ggtt->lock);
+ return err;
+}
diff --git a/drivers/gpu/drm/xe/xe_ggtt.h b/drivers/gpu/drm/xe/xe_ggtt.h
index ab9cfdab5cca..3469aa2b1a02 100644
--- a/drivers/gpu/drm/xe/xe_ggtt.h
+++ b/drivers/gpu/drm/xe/xe_ggtt.h
@@ -8,6 +8,8 @@
#include "xe_ggtt_types.h"
+struct drm_printer;
+
u64 xe_ggtt_pte_encode(struct xe_bo *bo, u64 bo_offset);
void xe_ggtt_set_pte(struct xe_ggtt *ggtt, u64 addr, u64 pte);
void xe_ggtt_invalidate(struct xe_gt *gt);
@@ -26,4 +28,6 @@ int xe_ggtt_insert_bo(struct xe_ggtt *ggtt, struct xe_bo *bo);
int xe_ggtt_insert_bo_at(struct xe_ggtt *ggtt, struct xe_bo *bo, u64 ofs);
void xe_ggtt_remove_bo(struct xe_ggtt *ggtt, struct xe_bo *bo);
+int xe_ggtt_dump(struct xe_ggtt *ggtt, struct drm_printer *p);
+
#endif
diff --git a/drivers/gpu/drm/xe/xe_gt_debugfs.c b/drivers/gpu/drm/xe/xe_gt_debugfs.c
index daae42d3ab3b..c320e58810ce 100644
--- a/drivers/gpu/drm/xe/xe_gt_debugfs.c
+++ b/drivers/gpu/drm/xe/xe_gt_debugfs.c
@@ -8,6 +8,7 @@
#include "xe_device.h"
#include "xe_force_wake.h"
+#include "xe_ggtt.h"
#include "xe_gt.h"
#include "xe_gt_debugfs.h"
#include "xe_gt_mcr.h"
@@ -88,12 +89,21 @@ static int steering(struct seq_file *m, void *data)
return 0;
}
+static int ggtt(struct seq_file *m, void *data)
+{
+ struct xe_gt *gt = node_to_gt(m->private);
+ struct drm_printer p = drm_seq_file_printer(m);
+
+ return xe_ggtt_dump(gt->mem.ggtt, &p);
+}
+
static const struct drm_info_list debugfs_list[] = {
{"hw_engines", hw_engines, 0},
{"force_reset", force_reset, 0},
{"sa_info", sa_info, 0},
{"topology", topology, 0},
{"steering", steering, 0},
+ {"ggtt", ggtt, 0},
};
void xe_gt_debugfs_register(struct xe_gt *gt)