[Intel-xe] [PATCH v2 2/2] drm/xe: Add always_invalidate_ggtt module parameter

Matthew Brost matthew.brost at intel.com
Wed Apr 5 02:40:36 UTC 2023


Adding so if we suspect missing GGTT invalidation are causing user hangs
we can flip a module parameter to determine if that is the issue.

Signed-off-by: Matthew Brost <matthew.brost at intel.com>
---
 drivers/gpu/drm/xe/xe_ggtt.c   | 8 ++++++--
 drivers/gpu/drm/xe/xe_module.c | 4 ++++
 drivers/gpu/drm/xe/xe_module.h | 1 +
 3 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/xe/xe_ggtt.c b/drivers/gpu/drm/xe/xe_ggtt.c
index 55d0c2554f7b..7620fdd234c7 100644
--- a/drivers/gpu/drm/xe/xe_ggtt.c
+++ b/drivers/gpu/drm/xe/xe_ggtt.c
@@ -18,6 +18,7 @@
 #include "xe_gt_tlb_invalidation.h"
 #include "xe_map.h"
 #include "xe_mmio.h"
+#include "xe_module.h"
 #include "xe_wopcm.h"
 
 /* FIXME: Common file, preferably auto-gen */
@@ -281,9 +282,12 @@ void xe_ggtt_map_bo(struct xe_ggtt *ggtt, struct xe_bo *bo)
 
 	/*
 	 * XXX: Unsure why without invalidation on every map during driver load
-	 * we can fail the driver load.
+	 * we can fail the driver load. Have a module parameter to always
+	 * invalidate the GGTT if we suspect this is an issue with user
+	 * submission.
 	 */
-	if (ggtt->invalidate || !gt->uc.guc.submission_state.enabled) {
+	if (always_invalidate_ggtt || ggtt->invalidate ||
+	    !gt->uc.guc.submission_state.enabled) {
 		xe_ggtt_invalidate(gt);
 		ggtt->invalidate = false;
 	}
diff --git a/drivers/gpu/drm/xe/xe_module.c b/drivers/gpu/drm/xe/xe_module.c
index 6860586ce7f8..30f241153e05 100644
--- a/drivers/gpu/drm/xe/xe_module.c
+++ b/drivers/gpu/drm/xe/xe_module.c
@@ -22,6 +22,10 @@ bool enable_display = true;
 module_param_named(enable_display, enable_display, bool, 0444);
 MODULE_PARM_DESC(enable_display, "Enable display");
 
+bool always_invalidate_ggtt = false;
+module_param_named(always_invalidate_ggtt, always_invalidate_ggtt, bool, 0444);
+MODULE_PARM_DESC(always_invalidate_ggtt, "Always invalidate GGTT on map");
+
 u32 xe_force_vram_bar_size;
 module_param_named(vram_bar_size, xe_force_vram_bar_size, uint, 0600);
 MODULE_PARM_DESC(vram_bar_size, "Set the vram bar size(in MiB)");
diff --git a/drivers/gpu/drm/xe/xe_module.h b/drivers/gpu/drm/xe/xe_module.h
index 86916c176382..f9e111f33c9f 100644
--- a/drivers/gpu/drm/xe/xe_module.h
+++ b/drivers/gpu/drm/xe/xe_module.h
@@ -8,6 +8,7 @@
 /* Module modprobe variables */
 extern bool enable_guc;
 extern bool enable_display;
+extern bool always_invalidate_ggtt;
 extern u32 xe_force_vram_bar_size;
 extern int xe_guc_log_level;
 extern char *xe_param_force_probe;
-- 
2.34.1



More information about the Intel-xe mailing list