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 5 participants 14 messages Jan 30, 2023 – Feb 6, 2023

Subsystems (2)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 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.

v2:
- replace IP_VERSION_FOREVER by XE_RTP_END_VERSION_UNDEFINED
- move fake workaround to lrc_additional_programming table

Bspec: 45974, 45718

---
 drivers/gpu/drm/xe/xe_gt.c |  1 +
 drivers/gpu/drm/xe/xe_wa.c | 28 ++++++++++++++++++++++++++++
 drivers/gpu/drm/xe/xe_wa.h |  1 +
 3 files changed, 30 insertions(+)
drivers/gpu/drm/xe/xe_gt.c +1 -0
index 84a73eeccd297..5d07e1e7bd506 100644
@@ -311,6 +311,7 @@ int xe_gt_record_default_lrcs(struct xe_gt *gt)
 
 		xe_reg_sr_init(&hwe->reg_lrc, "LRC", xe);
 		xe_wa_process_lrc(hwe);
+		xe_wa_process_lrc_additional_programming(hwe);
 
 		default_lrc = drmm_kzalloc(&xe->drm,
 					   xe_lrc_size(xe, hwe->class),
drivers/gpu/drm/xe/xe_wa.c +28 -0
index 3325de3edf691..744b7d0982683 100644
@@ -288,6 +288,21 @@ static const struct xe_rtp_entry lrc_was[] = {
 	{}
 };
 
+static const struct xe_rtp_entry lrc_additional_programming[] = {
+	{ 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, XE_RTP_END_VERSION_UNDEFINED)),
+	  XE_RTP_CLR(RING_MI_MODE(0),
+		     TGL_NESTED_BB_EN,
+		     XE_RTP_FLAG(MASKED_REG, ENGINE_BASE))
+	},
+	{}
+};
+
 static const struct xe_rtp_entry register_whitelist[] = {
 	{ XE_RTP_NAME("WaAllowPMDepthAndInvocationCountAccessFromUMD, 1408556865"),
 	  XE_RTP_RULES(GRAPHICS_VERSION_RANGE(1200, 1210), ENGINE_CLASS(RENDER)),
@@ -362,6 +377,19 @@ void xe_wa_process_lrc(struct xe_hw_engine *hwe)
 	xe_rtp_process(lrc_was, &hwe->reg_lrc, hwe->gt, hwe);
 }
 
+/**
+ * xe_wa_process_lrc_additional_programming - process additional LRC programming
+ * table
+ * @hwe: engine instance to process workarounds for
+ *
+ * Process additional context programming table for this platform, saving in
+ * @hwe all the registers changes that need to be applied on context restore.
+ */
+void xe_wa_process_lrc_additional_programming(struct xe_hw_engine *hwe)
+{
+	xe_rtp_process(lrc_additional_programming, &hwe->reg_lrc, hwe->gt, hwe);
+}
+
 /**
  * xe_reg_whitelist_process_engine - process table of registers to whitelist
  * @hwe: engine instance to process whitelist for
drivers/gpu/drm/xe/xe_wa.h +1 -0
index 1a0659690a320..872f3e4ddc73c 100644
@@ -12,6 +12,7 @@ struct xe_hw_engine;
 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_process_lrc_additional_programming(struct xe_hw_engine *hwe);
 
 void xe_reg_whitelist_process_engine(struct xe_hw_engine *hwe);
 void xe_reg_whitelist_apply(struct xe_hw_engine *hwe);
Signature · 1 line
2.39.1
#1 lore raw
Quoted 26 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.

v2:
- replace IP_VERSION_FOREVER by XE_RTP_END_VERSION_UNDEFINED
- move fake workaround to lrc_additional_programming table

Bspec: 45974, 45718

---

drivers/gpu/drm/xe/xe_gt.c |  1 +
drivers/gpu/drm/xe/xe_wa.c | 28 ++++++++++++++++++++++++++++
drivers/gpu/drm/xe/xe_wa.h |  1 +
3 files changed, 30 insertions(+)
drivers/gpu/drm/xe/xe_gt.c +0 -0
index 84a73eeccd297..5d07e1e7bd506 100644

drivers/gpu/drm/xe/xe_gt.c int xe_gt_record_default_lrcs(struct xe_gt *gt) · line 314

Quoted 4 lines
drivers/gpu/drm/xe/xe_gt.c +1 -0
@@ -311,6 +311,7 @@ int xe_gt_record_default_lrcs(struct xe_gt *gt)
 
 		xe_reg_sr_init(&hwe->reg_lrc, "LRC", xe);
 		xe_wa_process_lrc(hwe);
+		xe_wa_process_lrc_additional_programming(hwe);

it's in a separate struct just to avoid mixing stuff, but it should be handled by xe_wa_process_lrc().

Quoted 34 lines
drivers/gpu/drm/xe/xe_gt.c +0 -0
 		default_lrc = drmm_kzalloc(&xe->drm,
 					   xe_lrc_size(xe, hwe->class),
drivers/gpu/drm/xe/xe_wa.c +16 -0
index 3325de3edf691..744b7d0982683 100644
@@ -288,6 +288,21 @@ static const struct xe_rtp_entry lrc_was[] = {
 	{}
 };
 
+static const struct xe_rtp_entry lrc_additional_programming[] = {
+	{ 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, XE_RTP_END_VERSION_UNDEFINED)),
+	  XE_RTP_CLR(RING_MI_MODE(0),
+		     TGL_NESTED_BB_EN,
+		     XE_RTP_FLAG(MASKED_REG, ENGINE_BASE))
+	},
+	{}
+};
+
 static const struct xe_rtp_entry register_whitelist[] = {
 	{ XE_RTP_NAME("WaAllowPMDepthAndInvocationCountAccessFromUMD, 1408556865"),
 	  XE_RTP_RULES(GRAPHICS_VERSION_RANGE(1200, 1210), ENGINE_CLASS(RENDER)),
@@ -362,6 +377,19 @@ void xe_wa_process_lrc(struct xe_hw_engine *hwe)
 	xe_rtp_process(lrc_was, &hwe->reg_lrc, hwe->gt, hwe);
 }
 
+/**

drivers/gpu/drm/xe/xe_wa.c void xe_wa_process_lrc(struct xe_hw_engine *hwe) · line 390

Quoted 10 lines
drivers/gpu/drm/xe/xe_wa.c +10 -0
+ * xe_wa_process_lrc_additional_programming - process additional LRC programming
+ * table
+ * @hwe: engine instance to process workarounds for
+ *
+ * Process additional context programming table for this platform, saving in
+ * @hwe all the registers changes that need to be applied on context restore.
+ */
+void xe_wa_process_lrc_additional_programming(struct xe_hw_engine *hwe)
+{
+	xe_rtp_process(lrc_additional_programming, &hwe->reg_lrc, hwe->gt, hwe);

move this to xe_wa_process_lrc()

Quoted 10 lines
drivers/gpu/drm/xe/xe_wa.c +2 -0
+}
+
 /**
 * xe_reg_whitelist_process_engine - process table of registers to whitelist
 * @hwe: engine instance to process whitelist for
drivers/gpu/drm/xe/xe_wa.h +0 -0
index 1a0659690a320..872f3e4ddc73c 100644

drivers/gpu/drm/xe/xe_wa.h struct xe_hw_engine; · line 15

Quoted 4 lines
drivers/gpu/drm/xe/xe_wa.h +1 -0
@@ -12,6 +12,7 @@ struct xe_hw_engine;
 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_process_lrc_additional_programming(struct xe_hw_engine *hwe);

and drop this

Lucas De Marchi

Quoted 6 lines
drivers/gpu/drm/xe/xe_wa.h +0 -0
 void xe_reg_whitelist_process_engine(struct xe_hw_engine *hwe);
 void xe_reg_whitelist_apply(struct xe_hw_engine *hwe);
Signature · 1 line
2.39.1
#2 lore raw
In reply to José Roberto de Souza
Quoted 6 lines · José Roberto de 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.

I was kind of assuming we'd just drop this setting for the Xe driver. I believe hardware will be removing the option to turn off nested batchbuffers in an upcoming platform, so userspace is going to have to adapt to the new behavior soon anyway; doing it while moving to a new KMD seems like the easiest time to make that happen since the UMDs are already updating their programming models.

Matt

Quoted 88 lines

v2:
- replace IP_VERSION_FOREVER by XE_RTP_END_VERSION_UNDEFINED
- move fake workaround to lrc_additional_programming table

Bspec: 45974, 45718

---
 drivers/gpu/drm/xe/xe_gt.c |  1 +
 drivers/gpu/drm/xe/xe_wa.c | 28 ++++++++++++++++++++++++++++
 drivers/gpu/drm/xe/xe_wa.h |  1 +
 3 files changed, 30 insertions(+)
drivers/gpu/drm/xe/xe_gt.c +1 -0
index 84a73eeccd297..5d07e1e7bd506 100644
@@ -311,6 +311,7 @@ int xe_gt_record_default_lrcs(struct xe_gt *gt)
 
 		xe_reg_sr_init(&hwe->reg_lrc, "LRC", xe);
 		xe_wa_process_lrc(hwe);
+		xe_wa_process_lrc_additional_programming(hwe);
 
 		default_lrc = drmm_kzalloc(&xe->drm,
 					   xe_lrc_size(xe, hwe->class),
drivers/gpu/drm/xe/xe_wa.c +28 -0
index 3325de3edf691..744b7d0982683 100644
@@ -288,6 +288,21 @@ static const struct xe_rtp_entry lrc_was[] = {
 	{}
 };
 
+static const struct xe_rtp_entry lrc_additional_programming[] = {
+	{ 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, XE_RTP_END_VERSION_UNDEFINED)),
+	  XE_RTP_CLR(RING_MI_MODE(0),
+		     TGL_NESTED_BB_EN,
+		     XE_RTP_FLAG(MASKED_REG, ENGINE_BASE))
+	},
+	{}
+};
+
 static const struct xe_rtp_entry register_whitelist[] = {
 	{ XE_RTP_NAME("WaAllowPMDepthAndInvocationCountAccessFromUMD, 1408556865"),
 	  XE_RTP_RULES(GRAPHICS_VERSION_RANGE(1200, 1210), ENGINE_CLASS(RENDER)),
@@ -362,6 +377,19 @@ void xe_wa_process_lrc(struct xe_hw_engine *hwe)
 	xe_rtp_process(lrc_was, &hwe->reg_lrc, hwe->gt, hwe);
 }
 
+/**
+ * xe_wa_process_lrc_additional_programming - process additional LRC programming
+ * table
+ * @hwe: engine instance to process workarounds for
+ *
+ * Process additional context programming table for this platform, saving in
+ * @hwe all the registers changes that need to be applied on context restore.
+ */
+void xe_wa_process_lrc_additional_programming(struct xe_hw_engine *hwe)
+{
+	xe_rtp_process(lrc_additional_programming, &hwe->reg_lrc, hwe->gt, hwe);
+}
+
 /**
  * xe_reg_whitelist_process_engine - process table of registers to whitelist
  * @hwe: engine instance to process whitelist for
drivers/gpu/drm/xe/xe_wa.h +1 -0
index 1a0659690a320..872f3e4ddc73c 100644
@@ -12,6 +12,7 @@ struct xe_hw_engine;
 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_process_lrc_additional_programming(struct xe_hw_engine *hwe);
 
 void xe_reg_whitelist_process_engine(struct xe_hw_engine *hwe);
 void xe_reg_whitelist_apply(struct xe_hw_engine *hwe);
Signature · 1 line
2.39.1
Signature · 4 lines
Matt Roper
Graphics Software Engineer
Linux GPU Platform Enablement
Intel Corporation
#3 lore raw
Quoted 8 lines · Matt Roper
Quoted 6 lines · José Roberto de 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.

Quoted 6 lines

I was kind of assuming we'd just drop this setting for the Xe driver. I believe hardware will be removing the option to turn off nested batchbuffers in an upcoming platform, so userspace is going to have to adapt to the new behavior soon anyway; doing it while moving to a new KMD seems like the easiest time to make that happen since the UMDs are already updating their programming models.

This would bring even more changes to track when debugging issues in Xe KMD port. Better do this after Xe KMD is stabilized and with better CI coverage in UMDs and KMDs.

Quoted 93 lines

Matt

Quoted 88 lines

v2:
- replace IP_VERSION_FOREVER by XE_RTP_END_VERSION_UNDEFINED
- move fake workaround to lrc_additional_programming table

Bspec: 45974, 45718

---
 drivers/gpu/drm/xe/xe_gt.c |  1 +
 drivers/gpu/drm/xe/xe_wa.c | 28 ++++++++++++++++++++++++++++
 drivers/gpu/drm/xe/xe_wa.h |  1 +
 3 files changed, 30 insertions(+)
drivers/gpu/drm/xe/xe_gt.c +1 -0
index 84a73eeccd297..5d07e1e7bd506 100644
@@ -311,6 +311,7 @@ int xe_gt_record_default_lrcs(struct xe_gt *gt)
 
 		xe_reg_sr_init(&hwe->reg_lrc, "LRC", xe);
 		xe_wa_process_lrc(hwe);
+		xe_wa_process_lrc_additional_programming(hwe);
 
 		default_lrc = drmm_kzalloc(&xe->drm,
 					   xe_lrc_size(xe, hwe->class),
drivers/gpu/drm/xe/xe_wa.c +28 -0
index 3325de3edf691..744b7d0982683 100644
@@ -288,6 +288,21 @@ static const struct xe_rtp_entry lrc_was[] = {
 	{}
 };
 
+static const struct xe_rtp_entry lrc_additional_programming[] = {
+	{ 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, XE_RTP_END_VERSION_UNDEFINED)),
+	  XE_RTP_CLR(RING_MI_MODE(0),
+		     TGL_NESTED_BB_EN,
+		     XE_RTP_FLAG(MASKED_REG, ENGINE_BASE))
+	},
+	{}
+};
+
 static const struct xe_rtp_entry register_whitelist[] = {
 	{ XE_RTP_NAME("WaAllowPMDepthAndInvocationCountAccessFromUMD, 1408556865"),
 	  XE_RTP_RULES(GRAPHICS_VERSION_RANGE(1200, 1210), ENGINE_CLASS(RENDER)),
@@ -362,6 +377,19 @@ void xe_wa_process_lrc(struct xe_hw_engine *hwe)
 	xe_rtp_process(lrc_was, &hwe->reg_lrc, hwe->gt, hwe);
 }
 
+/**
+ * xe_wa_process_lrc_additional_programming - process additional LRC programming
+ * table
+ * @hwe: engine instance to process workarounds for
+ *
+ * Process additional context programming table for this platform, saving in
+ * @hwe all the registers changes that need to be applied on context restore.
+ */
+void xe_wa_process_lrc_additional_programming(struct xe_hw_engine *hwe)
+{
+	xe_rtp_process(lrc_additional_programming, &hwe->reg_lrc, hwe->gt, hwe);
+}
+
 /**
  * xe_reg_whitelist_process_engine - process table of registers to whitelist
  * @hwe: engine instance to process whitelist for
drivers/gpu/drm/xe/xe_wa.h +1 -0
index 1a0659690a320..872f3e4ddc73c 100644
@@ -12,6 +12,7 @@ struct xe_hw_engine;
 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_process_lrc_additional_programming(struct xe_hw_engine *hwe);
 
 void xe_reg_whitelist_process_engine(struct xe_hw_engine *hwe);
 void xe_reg_whitelist_apply(struct xe_hw_engine *hwe);
Signature · 1 line
2.39.1
#4 lore raw
Quoted 16 lines · Jose Souza
Quoted 8 lines · Matt Roper
Quoted 6 lines · José Roberto de 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.

Quoted 6 lines

I was kind of assuming we'd just drop this setting for the Xe driver. I believe hardware will be removing the option to turn off nested batchbuffers in an upcoming platform, so userspace is going to have to adapt to the new behavior soon anyway; doing it while moving to a new KMD seems like the easiest time to make that happen since the UMDs are already updating their programming models.

Quoted 2 lines

This would bring even more changes to track when debugging issues in Xe KMD port. Better do this after Xe KMD is stabilized and with better CI coverage in UMDs and KMDs.

but if we start supporting these platforms with nested bb disabled, we can't change it later. At least not for the older platforms that had it that way.

Lucas De Marchi

Quoted 95 lines
Quoted 94 lines

Matt

Quoted 88 lines

v2:
- replace IP_VERSION_FOREVER by XE_RTP_END_VERSION_UNDEFINED
- move fake workaround to lrc_additional_programming table

Bspec: 45974, 45718

---
 drivers/gpu/drm/xe/xe_gt.c |  1 +
 drivers/gpu/drm/xe/xe_wa.c | 28 ++++++++++++++++++++++++++++
 drivers/gpu/drm/xe/xe_wa.h |  1 +
 3 files changed, 30 insertions(+)
drivers/gpu/drm/xe/xe_gt.c +1 -0
index 84a73eeccd297..5d07e1e7bd506 100644
@@ -311,6 +311,7 @@ int xe_gt_record_default_lrcs(struct xe_gt *gt)
 
 		xe_reg_sr_init(&hwe->reg_lrc, "LRC", xe);
 		xe_wa_process_lrc(hwe);
+		xe_wa_process_lrc_additional_programming(hwe);
 
 		default_lrc = drmm_kzalloc(&xe->drm,
 					   xe_lrc_size(xe, hwe->class),
drivers/gpu/drm/xe/xe_wa.c +28 -0
index 3325de3edf691..744b7d0982683 100644
@@ -288,6 +288,21 @@ static const struct xe_rtp_entry lrc_was[] = {
 	{}
 };
 
+static const struct xe_rtp_entry lrc_additional_programming[] = {
+	{ 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, XE_RTP_END_VERSION_UNDEFINED)),
+	  XE_RTP_CLR(RING_MI_MODE(0),
+		     TGL_NESTED_BB_EN,
+		     XE_RTP_FLAG(MASKED_REG, ENGINE_BASE))
+	},
+	{}
+};
+
 static const struct xe_rtp_entry register_whitelist[] = {
 	{ XE_RTP_NAME("WaAllowPMDepthAndInvocationCountAccessFromUMD, 1408556865"),
 	  XE_RTP_RULES(GRAPHICS_VERSION_RANGE(1200, 1210), ENGINE_CLASS(RENDER)),
@@ -362,6 +377,19 @@ void xe_wa_process_lrc(struct xe_hw_engine *hwe)
 	xe_rtp_process(lrc_was, &hwe->reg_lrc, hwe->gt, hwe);
 }
 
+/**
+ * xe_wa_process_lrc_additional_programming - process additional LRC programming
+ * table
+ * @hwe: engine instance to process workarounds for
+ *
+ * Process additional context programming table for this platform, saving in
+ * @hwe all the registers changes that need to be applied on context restore.
+ */
+void xe_wa_process_lrc_additional_programming(struct xe_hw_engine *hwe)
+{
+	xe_rtp_process(lrc_additional_programming, &hwe->reg_lrc, hwe->gt, hwe);
+}
+
 /**
  * xe_reg_whitelist_process_engine - process table of registers to whitelist
  * @hwe: engine instance to process whitelist for
drivers/gpu/drm/xe/xe_wa.h +1 -1
index 1a0659690a320..872f3e4ddc73c 100644
@@ -12,6 +12,7 @@ struct xe_hw_engine;
 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_process_lrc_additional_programming(struct xe_hw_engine *hwe);
 
 void xe_reg_whitelist_process_engine(struct xe_hw_engine *hwe);
 void xe_reg_whitelist_apply(struct xe_hw_engine *hwe);
--

2.39.1

#5 lore raw
Quoted 17 lines · Lucas De Marchi
Quoted 16 lines · Jose Souza
Quoted 14 lines · Matt Roper
Quoted 6 lines · José Roberto de 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.

I was kind of assuming we'd just drop this setting for the Xe driver. I believe hardware will be removing the option to turn off nested batchbuffers in an upcoming platform, so userspace is going to have to adapt to the new behavior soon anyway; doing it while moving to a new KMD seems like the easiest time to make that happen since the UMDs are already updating their programming models.

Quoted 6 lines
Quoted 2 lines

This would bring even more changes to track when debugging issues in Xe KMD port. Better do this after Xe KMD is stabilized and with better CI coverage in UMDs and KMDs.

but if we start supporting these platforms with nested bb disabled, we can't change it later. At least not for the older platforms that had it that way.

Xe KMD will not support by default TGL, DG2... anyways. Why have different hardware behavior between KMDs then?

Quoted 98 lines

Lucas De Marchi

Quoted 95 lines
Quoted 94 lines

Matt

Quoted 88 lines

v2:
- replace IP_VERSION_FOREVER by XE_RTP_END_VERSION_UNDEFINED
- move fake workaround to lrc_additional_programming table

Bspec: 45974, 45718

---
 drivers/gpu/drm/xe/xe_gt.c |  1 +
 drivers/gpu/drm/xe/xe_wa.c | 28 ++++++++++++++++++++++++++++
 drivers/gpu/drm/xe/xe_wa.h |  1 +
 3 files changed, 30 insertions(+)
drivers/gpu/drm/xe/xe_gt.c +1 -0
index 84a73eeccd297..5d07e1e7bd506 100644
@@ -311,6 +311,7 @@ int xe_gt_record_default_lrcs(struct xe_gt *gt)
 
 		xe_reg_sr_init(&hwe->reg_lrc, "LRC", xe);
 		xe_wa_process_lrc(hwe);
+		xe_wa_process_lrc_additional_programming(hwe);
 
 		default_lrc = drmm_kzalloc(&xe->drm,
 					   xe_lrc_size(xe, hwe->class),
drivers/gpu/drm/xe/xe_wa.c +28 -0
index 3325de3edf691..744b7d0982683 100644
@@ -288,6 +288,21 @@ static const struct xe_rtp_entry lrc_was[] = {
 	{}
 };
 
+static const struct xe_rtp_entry lrc_additional_programming[] = {
+	{ 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, XE_RTP_END_VERSION_UNDEFINED)),
+	  XE_RTP_CLR(RING_MI_MODE(0),
+		     TGL_NESTED_BB_EN,
+		     XE_RTP_FLAG(MASKED_REG, ENGINE_BASE))
+	},
+	{}
+};
+
 static const struct xe_rtp_entry register_whitelist[] = {
 	{ XE_RTP_NAME("WaAllowPMDepthAndInvocationCountAccessFromUMD, 1408556865"),
 	  XE_RTP_RULES(GRAPHICS_VERSION_RANGE(1200, 1210), ENGINE_CLASS(RENDER)),
@@ -362,6 +377,19 @@ void xe_wa_process_lrc(struct xe_hw_engine *hwe)
 	xe_rtp_process(lrc_was, &hwe->reg_lrc, hwe->gt, hwe);
 }
 
+/**
+ * xe_wa_process_lrc_additional_programming - process additional LRC programming
+ * table
+ * @hwe: engine instance to process workarounds for
+ *
+ * Process additional context programming table for this platform, saving in
+ * @hwe all the registers changes that need to be applied on context restore.
+ */
+void xe_wa_process_lrc_additional_programming(struct xe_hw_engine *hwe)
+{
+	xe_rtp_process(lrc_additional_programming, &hwe->reg_lrc, hwe->gt, hwe);
+}
+
 /**
  * xe_reg_whitelist_process_engine - process table of registers to whitelist
  * @hwe: engine instance to process whitelist for
drivers/gpu/drm/xe/xe_wa.h +1 -1
index 1a0659690a320..872f3e4ddc73c 100644
@@ -12,6 +12,7 @@ struct xe_hw_engine;
 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_process_lrc_additional_programming(struct xe_hw_engine *hwe);
 
 void xe_reg_whitelist_process_engine(struct xe_hw_engine *hwe);
 void xe_reg_whitelist_apply(struct xe_hw_engine *hwe);
--

2.39.1

maintainer
#6 lore raw
Quoted 21 lines · Jose
Quoted 20 lines · Lucas De Marchi
Quoted 18 lines · Jose Souza
Quoted 8 lines · Matt Roper
Quoted 6 lines · José Roberto de 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.

Quoted 6 lines

I was kind of assuming we'd just drop this setting for the Xe driver. I believe hardware will be removing the option to turn off nested batchbuffers in an upcoming platform, so userspace is going to have to adapt to the new behavior soon anyway; doing it while moving to a new KMD seems like the easiest time to make that happen since the UMDs are already updating their programming models.

This would bring even more changes to track when debugging issues in Xe KMD port. Better do this after Xe KMD is stabilized and with better CI coverage in UMDs and KMDs.

Quoted 6 lines
Quoted 3 lines

but if we start supporting these platforms with nested bb disabled, we can't change it later. At least not for the older platforms that had it that way.

Xe KMD will not support by default TGL, DG2... anyways. Why have different hardware behavior between KMDs then?

For the older platforms we will always be behind the force_probe. So we will be able to change the uapi behavior later.

However, I tend to agree with Matt and Lucas that it would be better if we align with the future, instead of trying to align with i915 first.

But I'd like to hear from Jose, how much of a trouble this is for the user space? What are the advantages of aligning with i915's current behavior first and then move later?

If you noticed all other uapi, there's not a much of alignment with i915 anyway. Why should we align on this?

Thanks,
Rodrigo.

Quoted 100 lines
Quoted 99 lines

Lucas De Marchi

Quoted 95 lines
Quoted 94 lines

Matt

Quoted 88 lines

v2:
- replace IP_VERSION_FOREVER by XE_RTP_END_VERSION_UNDEFINED
- move fake workaround to lrc_additional_programming table

Bspec: 45974, 45718

---
 drivers/gpu/drm/xe/xe_gt.c |  1 +
 drivers/gpu/drm/xe/xe_wa.c | 28 ++++++++++++++++++++++++++++
 drivers/gpu/drm/xe/xe_wa.h |  1 +
 3 files changed, 30 insertions(+)
drivers/gpu/drm/xe/xe_gt.c +1 -0
index 84a73eeccd297..5d07e1e7bd506 100644
@@ -311,6 +311,7 @@ int xe_gt_record_default_lrcs(struct xe_gt *gt)
 
 		xe_reg_sr_init(&hwe->reg_lrc, "LRC", xe);
 		xe_wa_process_lrc(hwe);
+		xe_wa_process_lrc_additional_programming(hwe);
 
 		default_lrc = drmm_kzalloc(&xe->drm,
 					   xe_lrc_size(xe, hwe->class),
drivers/gpu/drm/xe/xe_wa.c +28 -0
index 3325de3edf691..744b7d0982683 100644
@@ -288,6 +288,21 @@ static const struct xe_rtp_entry lrc_was[] = {
 	{}
 };
 
+static const struct xe_rtp_entry lrc_additional_programming[] = {
+	{ 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, XE_RTP_END_VERSION_UNDEFINED)),
+	  XE_RTP_CLR(RING_MI_MODE(0),
+		     TGL_NESTED_BB_EN,
+		     XE_RTP_FLAG(MASKED_REG, ENGINE_BASE))
+	},
+	{}
+};
+
 static const struct xe_rtp_entry register_whitelist[] = {
 	{ XE_RTP_NAME("WaAllowPMDepthAndInvocationCountAccessFromUMD, 1408556865"),
 	  XE_RTP_RULES(GRAPHICS_VERSION_RANGE(1200, 1210), ENGINE_CLASS(RENDER)),
@@ -362,6 +377,19 @@ void xe_wa_process_lrc(struct xe_hw_engine *hwe)
 	xe_rtp_process(lrc_was, &hwe->reg_lrc, hwe->gt, hwe);
 }
 
+/**
+ * xe_wa_process_lrc_additional_programming - process additional LRC programming
+ * table
+ * @hwe: engine instance to process workarounds for
+ *
+ * Process additional context programming table for this platform, saving in
+ * @hwe all the registers changes that need to be applied on context restore.
+ */
+void xe_wa_process_lrc_additional_programming(struct xe_hw_engine *hwe)
+{
+	xe_rtp_process(lrc_additional_programming, &hwe->reg_lrc, hwe->gt, hwe);
+}
+
 /**
  * xe_reg_whitelist_process_engine - process table of registers to whitelist
  * @hwe: engine instance to process whitelist for
drivers/gpu/drm/xe/xe_wa.h +1 -1
index 1a0659690a320..872f3e4ddc73c 100644
@@ -12,6 +12,7 @@ struct xe_hw_engine;
 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_process_lrc_additional_programming(struct xe_hw_engine *hwe);
 
 void xe_reg_whitelist_process_engine(struct xe_hw_engine *hwe);
 void xe_reg_whitelist_apply(struct xe_hw_engine *hwe);
--

2.39.1

#7 lore raw
Quoted 36 lines · Rodrigo Vivi
Quoted 21 lines · Jose
Quoted 20 lines · Lucas De Marchi
Quoted 18 lines · Jose Souza
Quoted 8 lines · Matt Roper
Quoted 6 lines · José Roberto de 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.

Quoted 6 lines

I was kind of assuming we'd just drop this setting for the Xe driver. I believe hardware will be removing the option to turn off nested batchbuffers in an upcoming platform, so userspace is going to have to adapt to the new behavior soon anyway; doing it while moving to a new KMD seems like the easiest time to make that happen since the UMDs are already updating their programming models.

This would bring even more changes to track when debugging issues in Xe KMD port. Better do this after Xe KMD is stabilized and with better CI coverage in UMDs and KMDs.

Quoted 6 lines
Quoted 3 lines

but if we start supporting these platforms with nested bb disabled, we can't change it later. At least not for the older platforms that had it that way.

Xe KMD will not support by default TGL, DG2... anyways. Why have different hardware behavior between KMDs then?

For the older platforms we will always be behind the force_probe. So we will be able to change the uapi behavior later.

However, I tend to agree with Matt and Lucas that it would be better if we align with the future, instead of trying to align with i915 first.

Quoted 6 lines

But I'd like to hear from Jose, how much of a trouble this is for the user space? What are the advantages of aligning with i915's current behavior first and then move later?

If you noticed all other uapi, there's not a much of alignment with i915 anyway. Why should we align on this?

i915 x Xe changes don't affect the files and functions that fill the batch buffers in Mesa. Changing the behavior of MI_BATCH_BUFFER_START would be the first change that actually goes to batch buffers. Minimal batch buffer changes means less surface to debug in issues that only happens with Xe KMD.

That is why I would like to postpone this behavior change to when Xe KMD and UMDs support to it are more stable.

Quoted 104 lines

Thanks,
Rodrigo.

Quoted 100 lines
Quoted 99 lines

Lucas De Marchi

Quoted 95 lines
Quoted 94 lines

Matt

Quoted 88 lines

v2:
- replace IP_VERSION_FOREVER by XE_RTP_END_VERSION_UNDEFINED
- move fake workaround to lrc_additional_programming table

Bspec: 45974, 45718

---
 drivers/gpu/drm/xe/xe_gt.c |  1 +
 drivers/gpu/drm/xe/xe_wa.c | 28 ++++++++++++++++++++++++++++
 drivers/gpu/drm/xe/xe_wa.h |  1 +
 3 files changed, 30 insertions(+)
drivers/gpu/drm/xe/xe_gt.c +1 -0
index 84a73eeccd297..5d07e1e7bd506 100644
@@ -311,6 +311,7 @@ int xe_gt_record_default_lrcs(struct xe_gt *gt)
 
 		xe_reg_sr_init(&hwe->reg_lrc, "LRC", xe);
 		xe_wa_process_lrc(hwe);
+		xe_wa_process_lrc_additional_programming(hwe);
 
 		default_lrc = drmm_kzalloc(&xe->drm,
 					   xe_lrc_size(xe, hwe->class),
drivers/gpu/drm/xe/xe_wa.c +28 -0
index 3325de3edf691..744b7d0982683 100644
@@ -288,6 +288,21 @@ static const struct xe_rtp_entry lrc_was[] = {
 	{}
 };
 
+static const struct xe_rtp_entry lrc_additional_programming[] = {
+	{ 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, XE_RTP_END_VERSION_UNDEFINED)),
+	  XE_RTP_CLR(RING_MI_MODE(0),
+		     TGL_NESTED_BB_EN,
+		     XE_RTP_FLAG(MASKED_REG, ENGINE_BASE))
+	},
+	{}
+};
+
 static const struct xe_rtp_entry register_whitelist[] = {
 	{ XE_RTP_NAME("WaAllowPMDepthAndInvocationCountAccessFromUMD, 1408556865"),
 	  XE_RTP_RULES(GRAPHICS_VERSION_RANGE(1200, 1210), ENGINE_CLASS(RENDER)),
@@ -362,6 +377,19 @@ void xe_wa_process_lrc(struct xe_hw_engine *hwe)
 	xe_rtp_process(lrc_was, &hwe->reg_lrc, hwe->gt, hwe);
 }
 
+/**
+ * xe_wa_process_lrc_additional_programming - process additional LRC programming
+ * table
+ * @hwe: engine instance to process workarounds for
+ *
+ * Process additional context programming table for this platform, saving in
+ * @hwe all the registers changes that need to be applied on context restore.
+ */
+void xe_wa_process_lrc_additional_programming(struct xe_hw_engine *hwe)
+{
+	xe_rtp_process(lrc_additional_programming, &hwe->reg_lrc, hwe->gt, hwe);
+}
+
 /**
  * xe_reg_whitelist_process_engine - process table of registers to whitelist
  * @hwe: engine instance to process whitelist for
drivers/gpu/drm/xe/xe_wa.h +1 -1
index 1a0659690a320..872f3e4ddc73c 100644
@@ -12,6 +12,7 @@ struct xe_hw_engine;
 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_process_lrc_additional_programming(struct xe_hw_engine *hwe);
 
 void xe_reg_whitelist_process_engine(struct xe_hw_engine *hwe);
 void xe_reg_whitelist_apply(struct xe_hw_engine *hwe);
--

2.39.1

#8 lore raw
Quoted 41 lines · Jose
Quoted 40 lines · Rodrigo Vivi
Quoted 21 lines · Jose
Quoted 20 lines · Lucas De Marchi
Quoted 18 lines · Jose Souza
Quoted 8 lines · Matt Roper
Quoted 6 lines · José Roberto de 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.

Quoted 6 lines

I was kind of assuming we'd just drop this setting for the Xe driver. I believe hardware will be removing the option to turn off nested batchbuffers in an upcoming platform, so userspace is going to have to adapt to the new behavior soon anyway; doing it while moving to a new KMD seems like the easiest time to make that happen since the UMDs are already updating their programming models.

This would bring even more changes to track when debugging issues in Xe KMD port. Better do this after Xe KMD is stabilized and with better CI coverage in UMDs and KMDs.

Quoted 6 lines
Quoted 3 lines

but if we start supporting these platforms with nested bb disabled, we can't change it later. At least not for the older platforms that had it that way.

Xe KMD will not support by default TGL, DG2... anyways. Why have different hardware behavior between KMDs then?

For the older platforms we will always be behind the force_probe. So we will be able to change the uapi behavior later.

However, I tend to agree with Matt and Lucas that it would be better if we align with the future, instead of trying to align with i915 first.

But I'd like to hear from Jose, how much of a trouble this is for the user space? What are the advantages of aligning with i915's current behavior first and then move later?

Quoted 8 lines
Quoted 2 lines

If you noticed all other uapi, there's not a much of alignment with i915 anyway. Why should we align on this?

i915 x Xe changes don't affect the files and functions that fill the batch buffers in Mesa. Changing the behavior of MI_BATCH_BUFFER_START would be the first change that actually goes to batch buffers. Minimal batch buffer changes means less surface to debug in issues that only happens with Xe KMD.

That is why I would like to postpone this behavior change to when Xe KMD and UMDs support to it are more stable.

The other thing to consider here is that the Xe driver will presumably be adding SRIOV support soon. If our behavior differs from the Windows driver, then I believe userspace Windows software running in a VF under a Linux PF could potentially see unexpected behavior.

Matt

Quoted 106 lines
Quoted 105 lines

Thanks,
Rodrigo.

Quoted 100 lines
Quoted 99 lines

Lucas De Marchi

Quoted 95 lines
Quoted 94 lines

Matt

Quoted 88 lines

v2:
- replace IP_VERSION_FOREVER by XE_RTP_END_VERSION_UNDEFINED
- move fake workaround to lrc_additional_programming table

Bspec: 45974, 45718

---
 drivers/gpu/drm/xe/xe_gt.c |  1 +
 drivers/gpu/drm/xe/xe_wa.c | 28 ++++++++++++++++++++++++++++
 drivers/gpu/drm/xe/xe_wa.h |  1 +
 3 files changed, 30 insertions(+)
drivers/gpu/drm/xe/xe_gt.c +1 -0
index 84a73eeccd297..5d07e1e7bd506 100644
@@ -311,6 +311,7 @@ int xe_gt_record_default_lrcs(struct xe_gt *gt)
 
 		xe_reg_sr_init(&hwe->reg_lrc, "LRC", xe);
 		xe_wa_process_lrc(hwe);
+		xe_wa_process_lrc_additional_programming(hwe);
 
 		default_lrc = drmm_kzalloc(&xe->drm,
 					   xe_lrc_size(xe, hwe->class),
drivers/gpu/drm/xe/xe_wa.c +28 -0
index 3325de3edf691..744b7d0982683 100644
@@ -288,6 +288,21 @@ static const struct xe_rtp_entry lrc_was[] = {
 	{}
 };
 
+static const struct xe_rtp_entry lrc_additional_programming[] = {
+	{ 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, XE_RTP_END_VERSION_UNDEFINED)),
+	  XE_RTP_CLR(RING_MI_MODE(0),
+		     TGL_NESTED_BB_EN,
+		     XE_RTP_FLAG(MASKED_REG, ENGINE_BASE))
+	},
+	{}
+};
+
 static const struct xe_rtp_entry register_whitelist[] = {
 	{ XE_RTP_NAME("WaAllowPMDepthAndInvocationCountAccessFromUMD, 1408556865"),
 	  XE_RTP_RULES(GRAPHICS_VERSION_RANGE(1200, 1210), ENGINE_CLASS(RENDER)),
@@ -362,6 +377,19 @@ void xe_wa_process_lrc(struct xe_hw_engine *hwe)
 	xe_rtp_process(lrc_was, &hwe->reg_lrc, hwe->gt, hwe);
 }
 
+/**
+ * xe_wa_process_lrc_additional_programming - process additional LRC programming
+ * table
+ * @hwe: engine instance to process workarounds for
+ *
+ * Process additional context programming table for this platform, saving in
+ * @hwe all the registers changes that need to be applied on context restore.
+ */
+void xe_wa_process_lrc_additional_programming(struct xe_hw_engine *hwe)
+{
+	xe_rtp_process(lrc_additional_programming, &hwe->reg_lrc, hwe->gt, hwe);
+}
+
 /**
  * xe_reg_whitelist_process_engine - process table of registers to whitelist
  * @hwe: engine instance to process whitelist for
drivers/gpu/drm/xe/xe_wa.h +1 -1
index 1a0659690a320..872f3e4ddc73c 100644
@@ -12,6 +12,7 @@ struct xe_hw_engine;
 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_process_lrc_additional_programming(struct xe_hw_engine *hwe);
 
 void xe_reg_whitelist_process_engine(struct xe_hw_engine *hwe);
 void xe_reg_whitelist_apply(struct xe_hw_engine *hwe);
--

2.39.1

Signature · 4 lines
Matt Roper
Graphics Software Engineer
Linux GPU Platform Enablement
Intel Corporation
maintainer
#9 lore raw
Quoted 49 lines · Matt Roper
Quoted 48 lines · Jose
Quoted 36 lines · Rodrigo Vivi
Quoted 21 lines · Jose
Quoted 20 lines · Lucas De Marchi
Quoted 18 lines · Jose Souza
Quoted 8 lines · Matt Roper
Quoted 6 lines · José Roberto de 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.

Quoted 6 lines

I was kind of assuming we'd just drop this setting for the Xe driver. I believe hardware will be removing the option to turn off nested batchbuffers in an upcoming platform, so userspace is going to have to adapt to the new behavior soon anyway; doing it while moving to a new KMD seems like the easiest time to make that happen since the UMDs are already updating their programming models.

This would bring even more changes to track when debugging issues in Xe KMD port. Better do this after Xe KMD is stabilized and with better CI coverage in UMDs and KMDs.

Quoted 6 lines
Quoted 3 lines

but if we start supporting these platforms with nested bb disabled, we can't change it later. At least not for the older platforms that had it that way.

Xe KMD will not support by default TGL, DG2... anyways. Why have different hardware behavior between KMDs then?

For the older platforms we will always be behind the force_probe. So we will be able to change the uapi behavior later.

However, I tend to agree with Matt and Lucas that it would be better if we align with the future, instead of trying to align with i915 first.

Quoted 6 lines

But I'd like to hear from Jose, how much of a trouble this is for the user space? What are the advantages of aligning with i915's current behavior first and then move later?

If you noticed all other uapi, there's not a much of alignment with i915 anyway. Why should we align on this?

i915 x Xe changes don't affect the files and functions that fill the batch buffers in Mesa. Changing the behavior of MI_BATCH_BUFFER_START would be the first change that actually goes to batch buffers. Minimal batch buffer changes means less surface to debug in issues that only happens with Xe KMD.

Quoted 6 lines
Quoted 1 line

That is why I would like to postpone this behavior change to when Xe KMD and UMDs support to it are more stable.

The other thing to consider here is that the Xe driver will presumably be adding SRIOV support soon. If our behavior differs from the Windows driver, then I believe userspace Windows software running in a VF under a Linux PF could potentially see unexpected behavior.

hmm good point. Although we are protected by the force_probe and still not integrated to the tree yet it looks to me that the right thing to do is to align with the final api as soon as we can.

Quoted 116 lines

Matt

Quoted 106 lines
Quoted 105 lines

Thanks,
Rodrigo.

Quoted 100 lines
Quoted 99 lines

Lucas De Marchi

Quoted 95 lines
Quoted 94 lines

Matt

Quoted 88 lines

v2:
- replace IP_VERSION_FOREVER by XE_RTP_END_VERSION_UNDEFINED
- move fake workaround to lrc_additional_programming table

Bspec: 45974, 45718

---
 drivers/gpu/drm/xe/xe_gt.c |  1 +
 drivers/gpu/drm/xe/xe_wa.c | 28 ++++++++++++++++++++++++++++
 drivers/gpu/drm/xe/xe_wa.h |  1 +
 3 files changed, 30 insertions(+)
drivers/gpu/drm/xe/xe_gt.c +1 -0
index 84a73eeccd297..5d07e1e7bd506 100644
@@ -311,6 +311,7 @@ int xe_gt_record_default_lrcs(struct xe_gt *gt)
 
 		xe_reg_sr_init(&hwe->reg_lrc, "LRC", xe);
 		xe_wa_process_lrc(hwe);
+		xe_wa_process_lrc_additional_programming(hwe);
 
 		default_lrc = drmm_kzalloc(&xe->drm,
 					   xe_lrc_size(xe, hwe->class),
drivers/gpu/drm/xe/xe_wa.c +28 -0
index 3325de3edf691..744b7d0982683 100644
@@ -288,6 +288,21 @@ static const struct xe_rtp_entry lrc_was[] = {
 	{}
 };
 
+static const struct xe_rtp_entry lrc_additional_programming[] = {
+	{ 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, XE_RTP_END_VERSION_UNDEFINED)),
+	  XE_RTP_CLR(RING_MI_MODE(0),
+		     TGL_NESTED_BB_EN,
+		     XE_RTP_FLAG(MASKED_REG, ENGINE_BASE))
+	},
+	{}
+};
+
 static const struct xe_rtp_entry register_whitelist[] = {
 	{ XE_RTP_NAME("WaAllowPMDepthAndInvocationCountAccessFromUMD, 1408556865"),
 	  XE_RTP_RULES(GRAPHICS_VERSION_RANGE(1200, 1210), ENGINE_CLASS(RENDER)),
@@ -362,6 +377,19 @@ void xe_wa_process_lrc(struct xe_hw_engine *hwe)
 	xe_rtp_process(lrc_was, &hwe->reg_lrc, hwe->gt, hwe);
 }
 
+/**
+ * xe_wa_process_lrc_additional_programming - process additional LRC programming
+ * table
+ * @hwe: engine instance to process workarounds for
+ *
+ * Process additional context programming table for this platform, saving in
+ * @hwe all the registers changes that need to be applied on context restore.
+ */
+void xe_wa_process_lrc_additional_programming(struct xe_hw_engine *hwe)
+{
+	xe_rtp_process(lrc_additional_programming, &hwe->reg_lrc, hwe->gt, hwe);
+}
+
 /**
  * xe_reg_whitelist_process_engine - process table of registers to whitelist
  * @hwe: engine instance to process whitelist for
drivers/gpu/drm/xe/xe_wa.h +1 -1
index 1a0659690a320..872f3e4ddc73c 100644
@@ -12,6 +12,7 @@ struct xe_hw_engine;
 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_process_lrc_additional_programming(struct xe_hw_engine *hwe);
 
 void xe_reg_whitelist_process_engine(struct xe_hw_engine *hwe);
 void xe_reg_whitelist_apply(struct xe_hw_engine *hwe);
--

2.39.1

Signature · 4 lines
Matt Roper
Graphics Software Engineer
Linux GPU Platform Enablement
Intel Corporation
#10 lore raw
In reply to José Roberto de Souza
Quoted 38 lines · José Roberto de 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.

v2:
- replace IP_VERSION_FOREVER by XE_RTP_END_VERSION_UNDEFINED
- move fake workaround to lrc_additional_programming table

Bspec: 45974, 45718

---
 drivers/gpu/drm/xe/xe_gt.c |  1 +
 drivers/gpu/drm/xe/xe_wa.c | 28 ++++++++++++++++++++++++++++
 drivers/gpu/drm/xe/xe_wa.h |  1 +
 3 files changed, 30 insertions(+)
drivers/gpu/drm/xe/xe_gt.c +1 -0
index 84a73eeccd297..5d07e1e7bd506 100644
@@ -311,6 +311,7 @@ int xe_gt_record_default_lrcs(struct xe_gt *gt)
 
 		xe_reg_sr_init(&hwe->reg_lrc, "LRC", xe);
 		xe_wa_process_lrc(hwe);
+		xe_wa_process_lrc_additional_programming(hwe);
 
 		default_lrc = drmm_kzalloc(&xe->drm,
 					   xe_lrc_size(xe, hwe->class),
drivers/gpu/drm/xe/xe_wa.c +0 -0
index 3325de3edf691..744b7d0982683 100644

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

Quoted 5 lines
drivers/gpu/drm/xe/xe_wa.c +2 -0
@@ -288,6 +288,21 @@ static const struct xe_rtp_entry lrc_was[] = {
 	{}
 };
 
+static const struct xe_rtp_entry lrc_additional_programming[] = {
+	{ XE_RTP_NAME("FakeWaDisableNestedBBMode"),

Please add newline after {, and indent with tabs not spaces.

Quoted 48 lines
drivers/gpu/drm/xe/xe_wa.c +26 -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, XE_RTP_END_VERSION_UNDEFINED)),
+	  XE_RTP_CLR(RING_MI_MODE(0),
+		     TGL_NESTED_BB_EN,
+		     XE_RTP_FLAG(MASKED_REG, ENGINE_BASE))
+	},
+	{}
+};
+
 static const struct xe_rtp_entry register_whitelist[] = {
 	{ XE_RTP_NAME("WaAllowPMDepthAndInvocationCountAccessFromUMD, 1408556865"),
 	  XE_RTP_RULES(GRAPHICS_VERSION_RANGE(1200, 1210), ENGINE_CLASS(RENDER)),
@@ -362,6 +377,19 @@ void xe_wa_process_lrc(struct xe_hw_engine *hwe)
 	xe_rtp_process(lrc_was, &hwe->reg_lrc, hwe->gt, hwe);
 }
 
+/**
+ * xe_wa_process_lrc_additional_programming - process additional LRC programming
+ * table
+ * @hwe: engine instance to process workarounds for
+ *
+ * Process additional context programming table for this platform, saving in
+ * @hwe all the registers changes that need to be applied on context restore.
+ */
+void xe_wa_process_lrc_additional_programming(struct xe_hw_engine *hwe)
+{
+	xe_rtp_process(lrc_additional_programming, &hwe->reg_lrc, hwe->gt, hwe);
+}
+
 /**
  * xe_reg_whitelist_process_engine - process table of registers to whitelist
  * @hwe: engine instance to process whitelist for
drivers/gpu/drm/xe/xe_wa.h +1 -0
index 1a0659690a320..872f3e4ddc73c 100644
@@ -12,6 +12,7 @@ struct xe_hw_engine;
 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_process_lrc_additional_programming(struct xe_hw_engine *hwe);
 
 void xe_reg_whitelist_process_engine(struct xe_hw_engine *hwe);
 void xe_reg_whitelist_apply(struct xe_hw_engine *hwe);
Signature · 1 line
Jani Nikula, Intel Open Source Graphics Center
#11 lore raw
Quoted 42 lines · Jani Nikula
Quoted 41 lines · José Roberto de 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.

v2:
- replace IP_VERSION_FOREVER by XE_RTP_END_VERSION_UNDEFINED
- move fake workaround to lrc_additional_programming table

Bspec: 45974, 45718

---
 drivers/gpu/drm/xe/xe_gt.c |  1 +
 drivers/gpu/drm/xe/xe_wa.c | 28 ++++++++++++++++++++++++++++
 drivers/gpu/drm/xe/xe_wa.h |  1 +
 3 files changed, 30 insertions(+)
drivers/gpu/drm/xe/xe_gt.c +1 -0
index 84a73eeccd297..5d07e1e7bd506 100644
@@ -311,6 +311,7 @@ int xe_gt_record_default_lrcs(struct xe_gt *gt)
 
 		xe_reg_sr_init(&hwe->reg_lrc, "LRC", xe);
 		xe_wa_process_lrc(hwe);
+		xe_wa_process_lrc_additional_programming(hwe);
 
 		default_lrc = drmm_kzalloc(&xe->drm,
 					   xe_lrc_size(xe, hwe->class),
drivers/gpu/drm/xe/xe_wa.c +0 -0
index 3325de3edf691..744b7d0982683 100644
@@ -288,6 +288,21 @@ static const struct xe_rtp_entry lrc_was[] = {
 	{}
 };
 
Quoted 4 lines

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

Quoted 2 lines
drivers/gpu/drm/xe/xe_wa.c +2 -0
+static const struct xe_rtp_entry lrc_additional_programming[] = {
+	{ XE_RTP_NAME("FakeWaDisableNestedBBMode"),

Please add newline after {, and indent with tabs not spaces.

All the xe_rtp_entry arrays have this style pattern, just following what is already in the file.

Quoted 50 lines
Quoted 49 lines
drivers/gpu/drm/xe/xe_wa.c +26 -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, XE_RTP_END_VERSION_UNDEFINED)),
+	  XE_RTP_CLR(RING_MI_MODE(0),
+		     TGL_NESTED_BB_EN,
+		     XE_RTP_FLAG(MASKED_REG, ENGINE_BASE))
+	},
+	{}
+};
+
 static const struct xe_rtp_entry register_whitelist[] = {
 	{ XE_RTP_NAME("WaAllowPMDepthAndInvocationCountAccessFromUMD, 1408556865"),
 	  XE_RTP_RULES(GRAPHICS_VERSION_RANGE(1200, 1210), ENGINE_CLASS(RENDER)),
@@ -362,6 +377,19 @@ void xe_wa_process_lrc(struct xe_hw_engine *hwe)
 	xe_rtp_process(lrc_was, &hwe->reg_lrc, hwe->gt, hwe);
 }
 
+/**
+ * xe_wa_process_lrc_additional_programming - process additional LRC programming
+ * table
+ * @hwe: engine instance to process workarounds for
+ *
+ * Process additional context programming table for this platform, saving in
+ * @hwe all the registers changes that need to be applied on context restore.
+ */
+void xe_wa_process_lrc_additional_programming(struct xe_hw_engine *hwe)
+{
+	xe_rtp_process(lrc_additional_programming, &hwe->reg_lrc, hwe->gt, hwe);
+}
+
 /**
  * xe_reg_whitelist_process_engine - process table of registers to whitelist
  * @hwe: engine instance to process whitelist for
drivers/gpu/drm/xe/xe_wa.h +1 -0
index 1a0659690a320..872f3e4ddc73c 100644
@@ -12,6 +12,7 @@ struct xe_hw_engine;
 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_process_lrc_additional_programming(struct xe_hw_engine *hwe);
 
 void xe_reg_whitelist_process_engine(struct xe_hw_engine *hwe);
 void xe_reg_whitelist_apply(struct xe_hw_engine *hwe);
#12 lore raw
Quoted 9 lines · Jose
Quoted 5 lines · Jani Nikula

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

Quoted 2 lines · José Roberto de Souza
drivers/gpu/drm/xe/xe_wa.c +2 -0
+static const struct xe_rtp_entry lrc_additional_programming[] = {
+	{ XE_RTP_NAME("FakeWaDisableNestedBBMode"),

Please add newline after {, and indent with tabs not spaces.

All the xe_rtp_entry arrays have this style pattern, just following what is already in the file.

Yuck. :p

Signature · 1 line
Jani Nikula, Intel Open Source Graphics Center
#13 lore raw
Quoted 8 lines · Jani Nikula
Quoted 7 lines · Jose
Quoted 5 lines · Jani Nikula

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

Quoted 2 lines · José Roberto de Souza
drivers/gpu/drm/xe/xe_wa.c +2 -0
+static const struct xe_rtp_entry lrc_additional_programming[] = {
+	{ XE_RTP_NAME("FakeWaDisableNestedBBMode"),

Please add newline after {, and indent with tabs not spaces.

Quoted 4 lines
Quoted 2 lines

All the xe_rtp_entry arrays have this style pattern, just following what is already in the file.

Yuck. :p

and I'm the guilty one. It is a table and when adding a lot of entries the ", {" alone in the line for each entry consumes a lot of vertical waste space, so I decided to merge them. I considered merging the "}" too which would balance it, but looked nice to have at least a separator between each entry.

As we add more entries we may decide another format for the table. For this series I think the pending decision is more on the UABI side:
do we want to support this for older platforms knowing that future ones will have this setting changed?

+Rodrigo, +Matt

Lucas De Marchi

Quoted 4 lines
Signature · 2 lines
-- 
Jani Nikula, Intel Open Source Graphics Center