Skip to contentSkip to conversation

drm/xe: Add fake workaround to maintain backward compatible in MI_BATCH_BUFFER_START

PATCH Superseded José Roberto de Souza 2 participants 2 messages Jan 29, 2023 – Jan 30, 2023

Subsystems (2)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/xe: Add fake workaround to maintain backward compatible in MI_BATCH_BUFFER_START

i915 has the same fake workaround to return MI_BATCH_BUFFER_START nested batch buffer behavior in DG2 and newer platforms to the same behavior as older platforms.

So here cleaning up TGL_NESTED_BB_EN in MI_MODE to disable third level chained batch buffer level.

Bspec: 45974, 45718

---
 drivers/gpu/drm/xe/xe_rtp_types.h |  2 ++
 drivers/gpu/drm/xe/xe_wa.c        | 11 +++++++++++
 2 files changed, 13 insertions(+)
drivers/gpu/drm/xe/xe_rtp_types.h +2 -0
index 14e5d4dbb4c15..72f3e2e83014f 100644
@@ -52,6 +52,8 @@ enum {
 	XE_RTP_MATCH_FUNC,
 };
 
+#define IP_VERSION_FOREVER 9900
+
 /** struct xe_rtp_rule - match rule for processing entry */
 struct xe_rtp_rule {
 	u8 match_type;
drivers/gpu/drm/xe/xe_wa.c +11 -0
index 3325de3edf691..3616b2284d186 100644
@@ -285,6 +285,17 @@ static const struct xe_rtp_entry lrc_was[] = {
 		     DG1_HZ_READ_SUPPRESSION_OPTIMIZATION_DISABLE,
 		     XE_RTP_FLAG(MASKED_REG))
 	},
+	{ XE_RTP_NAME("FakeWaDisableNestedBBMode"),
+	  /*
+	   * This is a "fake" workaround defined by software to ensure we
+	   * maintain reliable, backward-compatible behavior for userspace with
+	   * regards to how nested MI_BATCH_BUFFER_START commands are handled.
+	   */
+	  XE_RTP_RULES(GRAPHICS_VERSION_RANGE(1255, IP_VERSION_FOREVER)),
+	  XE_RTP_CLR(RING_MI_MODE(0),
+		     TGL_NESTED_BB_EN,
+		     XE_RTP_FLAG(MASKED_REG, ENGINE_BASE))
+	},
 	{}
 };
 
Signature · 1 line
2.39.1
#1 lore raw
Quoted 20 lines · Jose Souza

i915 has the same fake workaround to return MI_BATCH_BUFFER_START nested batch buffer behavior in DG2 and newer platforms to the same behavior as older platforms.

So here cleaning up TGL_NESTED_BB_EN in MI_MODE to disable third level chained batch buffer level.

Bspec: 45974, 45718

---
drivers/gpu/drm/xe/xe_rtp_types.h | 2 ++
drivers/gpu/drm/xe/xe_wa.c | 11 +++++++++++

2 files changed, 13 insertions(+)
drivers/gpu/drm/xe/xe_rtp_types.h +0 -0
index 14e5d4dbb4c15..72f3e2e83014f 100644

drivers/gpu/drm/xe/xe_rtp_types.h enum { · line 55

Quoted 4 lines
drivers/gpu/drm/xe/xe_rtp_types.h +1 -0
@@ -52,6 +52,8 @@ enum {
 	XE_RTP_MATCH_FUNC,
 };
 
+#define IP_VERSION_FOREVER 9900

there is already a define for this in this header.

Quoted 13 lines
drivers/gpu/drm/xe/xe_rtp_types.h +1 -0
+
 /** struct xe_rtp_rule - match rule for processing entry */
 struct xe_rtp_rule {
 	u8 match_type;
drivers/gpu/drm/xe/xe_wa.c +1 -0
index 3325de3edf691..3616b2284d186 100644
@@ -285,6 +285,17 @@ static const struct xe_rtp_entry lrc_was[] = {
 		     DG1_HZ_READ_SUPPRESSION_OPTIMIZATION_DISABLE,
 		     XE_RTP_FLAG(MASKED_REG))
 	},
+	{ XE_RTP_NAME("FakeWaDisableNestedBBMode"),

drivers/gpu/drm/xe/xe_wa.c static const struct xe_rtp_entry lrc_was[] = { · line 298

Quoted 10 lines
drivers/gpu/drm/xe/xe_wa.c +10 -0
+	  /*
+	   * This is a "fake" workaround defined by software to ensure we
+	   * maintain reliable, backward-compatible behavior for userspace with
+	   * regards to how nested MI_BATCH_BUFFER_START commands are handled.
+	   */
+	  XE_RTP_RULES(GRAPHICS_VERSION_RANGE(1255, IP_VERSION_FOREVER)),
+	  XE_RTP_CLR(RING_MI_MODE(0),
+		     TGL_NESTED_BB_EN,
+		     XE_RTP_FLAG(MASKED_REG, ENGINE_BASE))
+	},

this conflicts with the changesto allow multiple actions in a single entry, but should be easy to fix.

I think we can leave this wa here, but until now we tried not to mix WAs with normal programming of the driver. Maybe just add a different table like lrc_additional_programming[]?

Lucas De Marchi