[Intel-xe] [RFC 1/2] drm/xe: Add debugfs to dump all known workarounds

Lucas De Marchi lucas.demarchi at intel.com
Wed Apr 12 08:20:53 UTC 2023


Dump the names of all known workarounds known by the driver (regardless
of the platform being executed). This helps to validate workarounds
missing implementation. Later this can be extended to mark the
workarounds that are active under this platform.

Signed-off-by: Lucas De Marchi <lucas.demarchi at intel.com>
---
 drivers/gpu/drm/xe/xe_debugfs.c | 12 ++++++++++++
 drivers/gpu/drm/xe/xe_wa.c      | 24 ++++++++++++++++++++++++
 drivers/gpu/drm/xe/xe_wa.h      |  4 ++++
 3 files changed, 40 insertions(+)

diff --git a/drivers/gpu/drm/xe/xe_debugfs.c b/drivers/gpu/drm/xe/xe_debugfs.c
index 7827a785b020..ad1b1ab49e1d 100644
--- a/drivers/gpu/drm/xe/xe_debugfs.c
+++ b/drivers/gpu/drm/xe/xe_debugfs.c
@@ -13,6 +13,7 @@
 #include "xe_device.h"
 #include "xe_gt_debugfs.h"
 #include "xe_step.h"
+#include "xe_wa.h"
 
 #ifdef CONFIG_DRM_XE_DEBUG
 #include "xe_bo_evict.h"
@@ -60,8 +61,19 @@ static int info(struct seq_file *m, void *data)
 	return 0;
 }
 
+static int workarounds(struct seq_file *m, void *data)
+{
+	struct xe_device *xe = node_to_xe(m->private);
+	struct drm_printer p = drm_seq_file_printer(m);
+
+	xe_wa_dump(xe, &p);
+
+	return 0;
+}
+
 static const struct drm_info_list debugfs_list[] = {
 	{"info", info, 0},
+	{"workarounds", workarounds, 0},
 };
 
 static int forcewake_open(struct inode *inode, struct file *file)
diff --git a/drivers/gpu/drm/xe/xe_wa.c b/drivers/gpu/drm/xe/xe_wa.c
index a7d681b7538d..100315c03014 100644
--- a/drivers/gpu/drm/xe/xe_wa.c
+++ b/drivers/gpu/drm/xe/xe_wa.c
@@ -656,3 +656,27 @@ void xe_wa_process_lrc(struct xe_hw_engine *hwe)
 {
 	xe_rtp_process(lrc_was, &hwe->reg_lrc, hwe->gt, hwe);
 }
+
+/**
+ * xe_wa_dump - dump all workarounds known by the driver
+ * @xe: xe device
+ * @p: DRM printer
+ */
+void xe_wa_dump(struct xe_device *xe, struct drm_printer *p)
+{
+	const struct xe_rtp_entry *entry;
+
+	drm_printf(p, "Workarounds\n");
+
+	drm_printf(p, "\tGT\n");
+	for (entry = gt_was; entry && entry->name; entry++)
+		drm_printf(p, "\t\t%s\n", entry->name);
+
+	drm_printf(p, "\tEngine\n");
+	for (entry = engine_was; entry && entry->name; entry++)
+		drm_printf(p, "\t\t%s\n", entry->name);
+
+	drm_printf(p, "\tLRC\n");
+	for (entry = lrc_was; entry && entry->name; entry++)
+		drm_printf(p, "\t\t%s\n", entry->name);
+}
diff --git a/drivers/gpu/drm/xe/xe_wa.h b/drivers/gpu/drm/xe/xe_wa.h
index cd2307d58795..97d104b7e566 100644
--- a/drivers/gpu/drm/xe/xe_wa.h
+++ b/drivers/gpu/drm/xe/xe_wa.h
@@ -6,6 +6,8 @@
 #ifndef _XE_WA_
 #define _XE_WA_
 
+struct drm_printer;
+struct xe_device;
 struct xe_gt;
 struct xe_hw_engine;
 
@@ -13,6 +15,8 @@ void xe_wa_process_gt(struct xe_gt *gt);
 void xe_wa_process_engine(struct xe_hw_engine *hwe);
 void xe_wa_process_lrc(struct xe_hw_engine *hwe);
 
+void xe_wa_dump(struct xe_device *xe, struct drm_printer *p);
+
 void xe_reg_whitelist_process_engine(struct xe_hw_engine *hwe);
 
 #endif
-- 
2.39.0



More information about the Intel-xe mailing list