Skip to contentSkip to conversation

drm/i915/mtl: Add MC6 Wa_14017210380 for SAMedia

PATCH Superseded Badal Nilawar 4 participants 8 messages Oct 28, 2022 – Nov 1, 2022

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/i915/mtl: Add MC6 Wa_14017210380 for SAMedia

This workaround is added for Media Tile of MTL A step. It is to help pcode workaround which handles the hardware bug seen on CXL splitter during package C2/C3 transitins due to MC6 entry/exit. As a part of workaround pcode expect kmd to send mailbox message "media busy" when components of Media tile is in use and "media not busy" when not in use. As per workaround description gucrc need to be disabled so enabled host based RC for Media tile.

HSD: 14017210380

Cc Rodrigo Vivi <[email protected]>
Cc Radhakrishna Sripada <[email protected]>
Cc Vinay Belgaumkar <[email protected]>
Cc Chris Wilson <[email protected]>
---
 drivers/gpu/drm/i915/gt/intel_gt_pm.c     | 33 +++++++++++++++++++++++
 drivers/gpu/drm/i915/gt/uc/intel_guc_rc.c | 13 ++++++++-
 drivers/gpu/drm/i915/i915_drv.h           |  4 +++
 drivers/gpu/drm/i915/i915_reg.h           |  9 +++++++
 4 files changed, 58 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/gt/intel_gt_pm.c +33 -0
index f553e2173bda..398dbeb298ca 100644
@@ -19,10 +19,37 @@
 #include "intel_rc6.h"
 #include "intel_rps.h"
 #include "intel_wakeref.h"
+#include "intel_pcode.h"
 #include "pxp/intel_pxp_pm.h"
 
 #define I915_GT_SUSPEND_IDLE_TIMEOUT (HZ / 2)
 
+/*
+ * Wa_14017210380: mtl
+ */
+
+static bool mtl_needs_media_mc6_wa(struct intel_gt *gt)
+{
+	return (IS_MTL_GRAPHICS_STEP(gt->i915, P, STEP_A0, STEP_B0) &&
+		gt->type == GT_MEDIA);
+}
+
+static void mtl_mc6_wa_media_busy(struct intel_gt *gt)
+{
+	if (mtl_needs_media_mc6_wa(gt))
+		snb_pcode_write_p(gt->uncore, PCODE_MBOX_GT_STATE,
+				  PCODE_MBOX_GT_STATE_MEDIA_BUSY,
+				  PCODE_MBOX_GT_STATE_DOMAIN_MEDIA, 0);
+}
+
+static void mtl_mc6_wa_media_not_busy(struct intel_gt *gt)
+{
+	if (mtl_needs_media_mc6_wa(gt))
+		snb_pcode_write_p(gt->uncore, PCODE_MBOX_GT_STATE,
+				  PCODE_MBOX_GT_STATE_MEDIA_NOT_BUSY,
+				  PCODE_MBOX_GT_STATE_DOMAIN_MEDIA, 0);
+}
+
 static void user_forcewake(struct intel_gt *gt, bool suspend)
 {
 	int count = atomic_read(&gt->user_wakeref);
@@ -70,6 +97,9 @@ static int __gt_unpark(struct intel_wakeref *wf)
 
 	GT_TRACE(gt, "\n");
 
+	/* Wa_14017210380: mtl */
+	mtl_mc6_wa_media_busy(gt);
+
 	/*
 	 * It seems that the DMC likes to transition between the DC states a lot
 	 * when there are no connected displays (no active power domains) during
@@ -119,6 +149,9 @@ static int __gt_park(struct intel_wakeref *wf)
 	GEM_BUG_ON(!wakeref);
 	intel_display_power_put_async(i915, POWER_DOMAIN_GT_IRQ, wakeref);
 
+	/* Wa_14017210380: mtl */
+	mtl_mc6_wa_media_not_busy(gt);
+
 	return 0;
 }
 
drivers/gpu/drm/i915/gt/uc/intel_guc_rc.c +12 -1
index 8f8dd05835c5..cc6356ff84a5 100644
@@ -11,9 +11,20 @@
 
 static bool __guc_rc_supported(struct intel_guc *guc)
 {
+	struct intel_gt *gt = guc_to_gt(guc);
+
+	/*
+	 * Wa_14017210380: mtl
+	 * Do not enable gucrc to avoid additional interrupts which
+	 * may disrupt pcode wa.
+	 */
+	if (IS_MTL_GRAPHICS_STEP(gt->i915, P, STEP_A0, STEP_B0) &&
+	    gt->type == GT_MEDIA)
+		return false;
+
 	/* GuC RC is unavailable for pre-Gen12 */
 	return guc->submission_supported &&
-		GRAPHICS_VER(guc_to_gt(guc)->i915) >= 12;
+		GRAPHICS_VER(gt->i915) >= 12;
 }
 
 static bool __guc_rc_selected(struct intel_guc *guc)
drivers/gpu/drm/i915/i915_drv.h +4 -0
index 05b3300cc4ed..659b92382ff2 100644
@@ -740,6 +740,10 @@ IS_SUBPLATFORM(const struct drm_i915_private *i915,
 #define IS_XEHPSDV_GRAPHICS_STEP(__i915, since, until) \
 	(IS_XEHPSDV(__i915) && IS_GRAPHICS_STEP(__i915, since, until))
 
+#define IS_MTL_GRAPHICS_STEP(__i915, variant, since, until) \
+	(IS_SUBPLATFORM(__i915, INTEL_METEORLAKE, INTEL_SUBPLATFORM_##variant) && \
+	 IS_GRAPHICS_STEP(__i915, since, until))
+
 /*
  * DG2 hardware steppings are a bit unusual.  The hardware design was forked to
  * create three variants (G10, G11, and G12) which each have distinct
drivers/gpu/drm/i915/i915_reg.h +9 -0
index 1c0da50c0dc7..abe62cea083d 100644
@@ -6678,6 +6678,15 @@
 /*   XEHP_PCODE_FREQUENCY_CONFIG param2 */
 #define     PCODE_MBOX_DOMAIN_NONE		0x0
 #define     PCODE_MBOX_DOMAIN_MEDIAFF		0x3
+
+/* Wa_14017210380: mtl */
+#define   PCODE_MBOX_GT_STATE			0x50
+/* sub-commands (param1) */
+#define     PCODE_MBOX_GT_STATE_MEDIA_BUSY	0x1
+#define     PCODE_MBOX_GT_STATE_MEDIA_NOT_BUSY	0x2
+/* param2 */
+#define     PCODE_MBOX_GT_STATE_DOMAIN_MEDIA	0x1
+
 #define GEN6_PCODE_DATA				_MMIO(0x138128)
 #define   GEN6_PCODE_FREQ_IA_RATIO_SHIFT	8
 #define   GEN6_PCODE_FREQ_RING_RATIO_SHIFT	16
Signature · 1 line
2.25.1
#1 lore raw

[Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for drm/i915/mtl: Add MC6 Wa_14017210380 for SAMedia

== Series Details ==

== Series Details ==

Series: drm/i915/mtl: Add MC6 Wa_14017210380 for SAMedia
URL : https://patchwork.freedesktop.org/series/110268/
State : warning

== Summary ==

Error: dim checkpatch failed
33ed282c8b12 drm/i915/mtl: Add MC6 Wa_14017210380 for SAMedia
-:118: CHECK:MACRO_ARG_REUSE: Macro argument reuse '__i915' - possible side-effects? #118: FILE: drivers/gpu/drm/i915/i915_drv.h:743:
+#define IS_MTL_GRAPHICS_STEP(__i915, variant, since, until) \
+ (IS_SUBPLATFORM(__i915, INTEL_METEORLAKE, INTEL_SUBPLATFORM_##variant) && \
+ IS_GRAPHICS_STEP(__i915, since, until))

total: 0 errors, 0 warnings, 1 checks, 101 lines checked

#3 lore raw

[Intel-gfx] ✗ Fi.CI.BAT: failure for drm/i915/mtl: Add MC6 Wa_14017210380 for SAMedia

In reply to Badal Nilawar
== Series Details ==

== Series Details ==

Series: drm/i915/mtl: Add MC6 Wa_14017210380 for SAMedia
URL : https://patchwork.freedesktop.org/series/110268/
State : failure

== Summary ==

CI Bug Log - changes from CI_DRM_12317 -> Patchwork_110268v1
====================================================

Summary
-------

**FAILURE**

Serious unknown changes coming with Patchwork_110268v1 absolutely need to be verified manually.

If you think the reported changes have nothing to do with the changes introduced in Patchwork_110268v1, please notify your bug team to allow them to document this new failure mode, which will reduce false positives in CI.

External URL: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_110268v1/index.html

Participating hosts (40 -> 40)
------------------------------

Additional (2): fi-kbl-soraka fi-pnv-d510
Missing (2): fi-ctg-p8600 fi-cfl-8700k

Possible new issues
-------------------

Here are the unknown changes that may have been introduced in Patchwork_110268v1:

### IGT changes ###

#### Possible regressions ####

* igt@i915_selftest@live@late_gt_pm:
- fi-kbl-soraka: NOTRUN -> [INCOMPLETE][1]
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_110268v1/fi-kbl-soraka/igt@i915_selftest@live@late_gt_pm.html

Known issues
------------

Here are the changes found in Patchwork_110268v1 that come from known issues:

### CI changes ###

#### Possible fixes ####

* boot:
- fi-ilk-650: [FAIL][2] ([i915#7350]) -> [PASS][3]
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12317/fi-ilk-650/boot.html
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_110268v1/fi-ilk-650/boot.html

### IGT changes ###

#### Issues hit ####

* igt@gem_exec_gttfill@basic:
- fi-kbl-soraka: NOTRUN -> [SKIP][4] ([fdo#109271]) +9 similar issues
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_110268v1/fi-kbl-soraka/igt@[email protected]

* igt@gem_huc_copy@huc-copy:
- fi-kbl-soraka: NOTRUN -> [SKIP][5] ([fdo#109271] / [i915#2190])
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_110268v1/fi-kbl-soraka/igt@[email protected]

* igt@gem_lmem_swapping@basic:
- fi-kbl-soraka: NOTRUN -> [SKIP][6] ([fdo#109271] / [i915#4613]) +3 similar issues
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_110268v1/fi-kbl-soraka/igt@[email protected]

* igt@gem_render_tiled_blits@basic:
- fi-apl-guc: [PASS][7] -> [INCOMPLETE][8] ([i915#7056])
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12317/fi-apl-guc/igt@[email protected]
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_110268v1/fi-apl-guc/igt@[email protected]

* igt@i915_pm_rpm@basic-pci-d3-state:
- fi-ilk-650: NOTRUN -> [SKIP][9] ([fdo#109271]) +19 similar issues
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_110268v1/fi-ilk-650/igt@[email protected]

* igt@i915_selftest@live@gt_pm:
- fi-kbl-soraka: NOTRUN -> [DMESG-FAIL][10] ([i915#1886])
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_110268v1/fi-kbl-soraka/igt@i915_selftest@live@gt_pm.html

* igt@i915_selftest@live@hangcheck:
- fi-hsw-4770: [PASS][11] -> [INCOMPLETE][12] ([i915#4785])
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12317/fi-hsw-4770/igt@i915_selftest@[email protected]
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_110268v1/fi-hsw-4770/igt@i915_selftest@[email protected]
- fi-rkl-guc: [PASS][13] -> [INCOMPLETE][14] ([i915#4983])
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12317/fi-rkl-guc/igt@i915_selftest@[email protected]
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_110268v1/fi-rkl-guc/igt@i915_selftest@[email protected]

* igt@kms_busy@basic@modeset:
- fi-icl-u2: [PASS][15] -> [DMESG-WARN][16] ([i915#4890])
[15]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12317/fi-icl-u2/igt@kms_busy@[email protected]
[16]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_110268v1/fi-icl-u2/igt@kms_busy@[email protected]

* igt@kms_chamelium@dp-hpd-fast:
- fi-ilk-650: NOTRUN -> [SKIP][17] ([fdo#109271] / [fdo#111827]) +8 similar issues
[17]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_110268v1/fi-ilk-650/igt@[email protected]

* igt@kms_chamelium@hdmi-hpd-fast:
- fi-kbl-soraka: NOTRUN -> [SKIP][18] ([fdo#109271] / [fdo#111827]) +7 similar issues
[18]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_110268v1/fi-kbl-soraka/igt@[email protected]

* igt@kms_cursor_legacy@basic-busy-flip-before-cursor@atomic-transitions:
- fi-bsw-kefka: [PASS][19] -> [FAIL][20] ([i915#6298])
[19]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12317/fi-bsw-kefka/igt@kms_cursor_legacy@[email protected]
[20]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_110268v1/fi-bsw-kefka/igt@kms_cursor_legacy@[email protected]

* igt@kms_psr@primary_page_flip:
- fi-pnv-d510: NOTRUN -> [SKIP][21] ([fdo#109271]) +43 similar issues
[21]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_110268v1/fi-pnv-d510/igt@kms_psr@primary_page_flip.html

* igt@runner@aborted:
- fi-hsw-4770: NOTRUN -> [FAIL][22] ([fdo#109271] / [i915#4312] / [i915#5594])
[22]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_110268v1/fi-hsw-4770/igt@[email protected]

#### Possible fixes ####

* igt@gem_exec_suspend@basic-s3@smem:
- {bat-rplp-1}: [DMESG-WARN][23] ([i915#2867]) -> [PASS][24]
[23]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12317/bat-rplp-1/igt@gem_exec_suspend@[email protected]
[24]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_110268v1/bat-rplp-1/igt@gem_exec_suspend@[email protected]
- {bat-rpls-1}: [DMESG-WARN][25] ([i915#6687]) -> [PASS][26]
[25]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12317/bat-rpls-1/igt@gem_exec_suspend@[email protected]
[26]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_110268v1/bat-rpls-1/igt@gem_exec_suspend@[email protected]

* igt@i915_selftest@live@migrate:
- {bat-dg2-11}: [DMESG-WARN][27] -> [PASS][28]
[27]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12317/bat-dg2-11/igt@i915_selftest@[email protected]
[28]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_110268v1/bat-dg2-11/igt@i915_selftest@[email protected]

{name}: This element is suppressed. This means it is ignored when computing
the status of the difference (SUCCESS, WARNING, or FAILURE).

[fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
[fdo#111827]: https://bugs.freedesktop.org/show_bug.cgi?id=111827
[i915#1845]: https://gitlab.freedesktop.org/drm/intel/issues/1845
[i915#1886]: https://gitlab.freedesktop.org/drm/intel/issues/1886
[i915#2190]: https://gitlab.freedesktop.org/drm/intel/issues/2190
[i915#2867]: https://gitlab.freedesktop.org/drm/intel/issues/2867
[i915#4312]: https://gitlab.freedesktop.org/drm/intel/issues/4312
[i915#4613]: https://gitlab.freedesktop.org/drm/intel/issues/4613
[i915#4785]: https://gitlab.freedesktop.org/drm/intel/issues/4785
[i915#4890]: https://gitlab.freedesktop.org/drm/intel/issues/4890
[i915#4983]: https://gitlab.freedesktop.org/drm/intel/issues/4983
[i915#5134]: https://gitlab.freedesktop.org/drm/intel/issues/5134
[i915#5594]: https://gitlab.freedesktop.org/drm/intel/issues/5594
[i915#6298]: https://gitlab.freedesktop.org/drm/intel/issues/6298
[i915#6687]: https://gitlab.freedesktop.org/drm/intel/issues/6687
[i915#7056]: https://gitlab.freedesktop.org/drm/intel/issues/7056
[i915#7350]: https://gitlab.freedesktop.org/drm/intel/issues/7350

Build changes
-------------

* Linux: CI_DRM_12317 -> Patchwork_110268v1

CI-20190529: 20190529
CI_DRM_12317: 0f9cbc285f7d3d1860f7f903663933f33ff9ae25 @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_7029: c32cb1e614017f14274d335ac571383799e6c786 @ https://gitlab.freedesktop.org/drm/igt-gpu-tools.git
Patchwork_110268v1: 0f9cbc285f7d3d1860f7f903663933f33ff9ae25 @ git://anongit.freedesktop.org/gfx-ci/linux

### Linux commits

3a8499ed42b7 drm/i915/mtl: Add MC6 Wa_14017210380 for SAMedia

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_110268v1/index.html

maintainer
#4 lore raw
In reply to Badal Nilawar
Quoted 30 lines · Badal Nilawar

This workaround is added for Media Tile of MTL A step. It is to help pcode workaround which handles the hardware bug seen on CXL splitter during package C2/C3 transitins due to MC6 entry/exit. As a part of workaround pcode expect kmd to send mailbox message "media busy" when components of Media tile is in use and "media not busy" when not in use. As per workaround description gucrc need to be disabled so enabled host based RC for Media tile.

HSD: 14017210380

Cc Rodrigo Vivi <[email protected]>
Cc Radhakrishna Sripada <[email protected]>
Cc Vinay Belgaumkar <[email protected]>
Cc Chris Wilson <[email protected]>
---
 drivers/gpu/drm/i915/gt/intel_gt_pm.c     | 33 +++++++++++++++++++++++
 drivers/gpu/drm/i915/gt/uc/intel_guc_rc.c | 13 ++++++++-
 drivers/gpu/drm/i915/i915_drv.h           |  4 +++
 drivers/gpu/drm/i915/i915_reg.h           |  9 +++++++
 4 files changed, 58 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/gt/intel_gt_pm.c +0 -0
index f553e2173bda..398dbeb298ca 100644
@@ -19,10 +19,37 @@
 #include "intel_rc6.h"
 #include "intel_rps.h"
 #include "intel_wakeref.h"

drivers/gpu/drm/i915/gt/intel_gt_pm.c line 31

Quoted 10 lines
drivers/gpu/drm/i915/gt/intel_gt_pm.c +6 -0
+#include "intel_pcode.h"
 #include "pxp/intel_pxp_pm.h"
 
 #define I915_GT_SUSPEND_IDLE_TIMEOUT (HZ / 2)
 
+/*
+ * Wa_14017210380: mtl
+ */
+
+static bool mtl_needs_media_mc6_wa(struct intel_gt *gt)

+Ashutosh since we recently discussed about the term "MC6".

in that discussion we have concluded to not introduce a new term since it is not used in any kind of spec and might only bring more doubts then answers, although "Render" in the media gt makes no sense as well.

In the end, most of the code is common and is called as rc6. so we should maybe s/mc6/media_rc6 here?

The rest of the patch looks good to me. But we need to check the IGT failure on a pm related test that failed... just to be sure.

Quoted 108 lines
drivers/gpu/drm/i915/gt/intel_gt_pm.c +27 -0
+{
+	return (IS_MTL_GRAPHICS_STEP(gt->i915, P, STEP_A0, STEP_B0) &&
+		gt->type == GT_MEDIA);
+}
+
+static void mtl_mc6_wa_media_busy(struct intel_gt *gt)
+{
+	if (mtl_needs_media_mc6_wa(gt))
+		snb_pcode_write_p(gt->uncore, PCODE_MBOX_GT_STATE,
+				  PCODE_MBOX_GT_STATE_MEDIA_BUSY,
+				  PCODE_MBOX_GT_STATE_DOMAIN_MEDIA, 0);
+}
+
+static void mtl_mc6_wa_media_not_busy(struct intel_gt *gt)
+{
+	if (mtl_needs_media_mc6_wa(gt))
+		snb_pcode_write_p(gt->uncore, PCODE_MBOX_GT_STATE,
+				  PCODE_MBOX_GT_STATE_MEDIA_NOT_BUSY,
+				  PCODE_MBOX_GT_STATE_DOMAIN_MEDIA, 0);
+}
+
 static void user_forcewake(struct intel_gt *gt, bool suspend)
 {
 	int count = atomic_read(&gt->user_wakeref);
@@ -70,6 +97,9 @@ static int __gt_unpark(struct intel_wakeref *wf)
 
 	GT_TRACE(gt, "\n");
 
+	/* Wa_14017210380: mtl */
+	mtl_mc6_wa_media_busy(gt);
+
 	/*
 	 * It seems that the DMC likes to transition between the DC states a lot
 	 * when there are no connected displays (no active power domains) during
@@ -119,6 +149,9 @@ static int __gt_park(struct intel_wakeref *wf)
 	GEM_BUG_ON(!wakeref);
 	intel_display_power_put_async(i915, POWER_DOMAIN_GT_IRQ, wakeref);
 
+	/* Wa_14017210380: mtl */
+	mtl_mc6_wa_media_not_busy(gt);
+
 	return 0;
 }
 
drivers/gpu/drm/i915/gt/uc/intel_guc_rc.c +12 -1
index 8f8dd05835c5..cc6356ff84a5 100644
@@ -11,9 +11,20 @@
 
 static bool __guc_rc_supported(struct intel_guc *guc)
 {
+	struct intel_gt *gt = guc_to_gt(guc);
+
+	/*
+	 * Wa_14017210380: mtl
+	 * Do not enable gucrc to avoid additional interrupts which
+	 * may disrupt pcode wa.
+	 */
+	if (IS_MTL_GRAPHICS_STEP(gt->i915, P, STEP_A0, STEP_B0) &&
+	    gt->type == GT_MEDIA)
+		return false;
+
 	/* GuC RC is unavailable for pre-Gen12 */
 	return guc->submission_supported &&
-		GRAPHICS_VER(guc_to_gt(guc)->i915) >= 12;
+		GRAPHICS_VER(gt->i915) >= 12;
 }
 
 static bool __guc_rc_selected(struct intel_guc *guc)
drivers/gpu/drm/i915/i915_drv.h +4 -0
index 05b3300cc4ed..659b92382ff2 100644
@@ -740,6 +740,10 @@ IS_SUBPLATFORM(const struct drm_i915_private *i915,
 #define IS_XEHPSDV_GRAPHICS_STEP(__i915, since, until) \
 	(IS_XEHPSDV(__i915) && IS_GRAPHICS_STEP(__i915, since, until))
 
+#define IS_MTL_GRAPHICS_STEP(__i915, variant, since, until) \
+	(IS_SUBPLATFORM(__i915, INTEL_METEORLAKE, INTEL_SUBPLATFORM_##variant) && \
+	 IS_GRAPHICS_STEP(__i915, since, until))
+
 /*
  * DG2 hardware steppings are a bit unusual.  The hardware design was forked to
  * create three variants (G10, G11, and G12) which each have distinct
drivers/gpu/drm/i915/i915_reg.h +9 -0
index 1c0da50c0dc7..abe62cea083d 100644
@@ -6678,6 +6678,15 @@
 /*   XEHP_PCODE_FREQUENCY_CONFIG param2 */
 #define     PCODE_MBOX_DOMAIN_NONE		0x0
 #define     PCODE_MBOX_DOMAIN_MEDIAFF		0x3
+
+/* Wa_14017210380: mtl */
+#define   PCODE_MBOX_GT_STATE			0x50
+/* sub-commands (param1) */
+#define     PCODE_MBOX_GT_STATE_MEDIA_BUSY	0x1
+#define     PCODE_MBOX_GT_STATE_MEDIA_NOT_BUSY	0x2
+/* param2 */
+#define     PCODE_MBOX_GT_STATE_DOMAIN_MEDIA	0x1
+
 #define GEN6_PCODE_DATA				_MMIO(0x138128)
 #define   GEN6_PCODE_FREQ_IA_RATIO_SHIFT	8
 #define   GEN6_PCODE_FREQ_RING_RATIO_SHIFT	16
Signature · 1 line
2.25.1
#5 lore raw

Hi Rodrigo,

Quoted 44 lines · Rodrigo Vivi
Quoted 30 lines · Badal Nilawar

This workaround is added for Media Tile of MTL A step. It is to help pcode workaround which handles the hardware bug seen on CXL splitter during package C2/C3 transitins due to MC6 entry/exit. As a part of workaround pcode expect kmd to send mailbox message "media busy" when components of Media tile is in use and "media not busy" when not in use. As per workaround description gucrc need to be disabled so enabled host based RC for Media tile.

HSD: 14017210380

Cc Rodrigo Vivi <[email protected]>
Cc Radhakrishna Sripada <[email protected]>
Cc Vinay Belgaumkar <[email protected]>
Cc Chris Wilson <[email protected]>
---
  drivers/gpu/drm/i915/gt/intel_gt_pm.c     | 33 +++++++++++++++++++++++
  drivers/gpu/drm/i915/gt/uc/intel_guc_rc.c | 13 ++++++++-
  drivers/gpu/drm/i915/i915_drv.h           |  4 +++
  drivers/gpu/drm/i915/i915_reg.h           |  9 +++++++
  4 files changed, 58 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/gt/intel_gt_pm.c +0 -0
index f553e2173bda..398dbeb298ca 100644
@@ -19,10 +19,37 @@
  #include "intel_rc6.h"
  #include "intel_rps.h"
  #include "intel_wakeref.h"

drivers/gpu/drm/i915/gt/intel_gt_pm.c line 31

Quoted 10 lines
drivers/gpu/drm/i915/gt/intel_gt_pm.c +6 -0
+#include "intel_pcode.h"
  #include "pxp/intel_pxp_pm.h"
 
  #define I915_GT_SUSPEND_IDLE_TIMEOUT (HZ / 2)
 
+/*
+ * Wa_14017210380: mtl
+ */
+
+static bool mtl_needs_media_mc6_wa(struct intel_gt *gt)

+Ashutosh since we recently discussed about the term "MC6".

Quoted 7 lines

in that discussion we have concluded to not introduce a new term since it is not used in any kind of spec and might only bring more doubts then answers, although "Render" in the media gt makes no sense as well.

In the end, most of the code is common and is called as rc6. so we should maybe s/mc6/media_rc6 here?

Sure I will make above change and resend the patch.

Quoted 3 lines

The rest of the patch looks good to me. But we need to check the IGT failure on a pm related test that failed... just to be sure.

Failures reported in IGT so far are not related to this change.

Regards,
Badal

Quoted 109 lines
Quoted 109 lines
drivers/gpu/drm/i915/gt/intel_gt_pm.c +27 -0
+{
+	return (IS_MTL_GRAPHICS_STEP(gt->i915, P, STEP_A0, STEP_B0) &&
+		gt->type == GT_MEDIA);
+}
+
+static void mtl_mc6_wa_media_busy(struct intel_gt *gt)
+{
+	if (mtl_needs_media_mc6_wa(gt))
+		snb_pcode_write_p(gt->uncore, PCODE_MBOX_GT_STATE,
+				  PCODE_MBOX_GT_STATE_MEDIA_BUSY,
+				  PCODE_MBOX_GT_STATE_DOMAIN_MEDIA, 0);
+}
+
+static void mtl_mc6_wa_media_not_busy(struct intel_gt *gt)
+{
+	if (mtl_needs_media_mc6_wa(gt))
+		snb_pcode_write_p(gt->uncore, PCODE_MBOX_GT_STATE,
+				  PCODE_MBOX_GT_STATE_MEDIA_NOT_BUSY,
+				  PCODE_MBOX_GT_STATE_DOMAIN_MEDIA, 0);
+}
+
  static void user_forcewake(struct intel_gt *gt, bool suspend)
  {
  	int count = atomic_read(&gt->user_wakeref);
@@ -70,6 +97,9 @@ static int __gt_unpark(struct intel_wakeref *wf)
 
  	GT_TRACE(gt, "\n");
 
+	/* Wa_14017210380: mtl */
+	mtl_mc6_wa_media_busy(gt);
+
  	/*
  	 * It seems that the DMC likes to transition between the DC states a lot
  	 * when there are no connected displays (no active power domains) during
@@ -119,6 +149,9 @@ static int __gt_park(struct intel_wakeref *wf)
  	GEM_BUG_ON(!wakeref);
  	intel_display_power_put_async(i915, POWER_DOMAIN_GT_IRQ, wakeref);
 
+	/* Wa_14017210380: mtl */
+	mtl_mc6_wa_media_not_busy(gt);
+
  	return 0;
  }
 
drivers/gpu/drm/i915/gt/uc/intel_guc_rc.c +12 -1
index 8f8dd05835c5..cc6356ff84a5 100644
@@ -11,9 +11,20 @@
 
  static bool __guc_rc_supported(struct intel_guc *guc)
  {
+	struct intel_gt *gt = guc_to_gt(guc);
+
+	/*
+	 * Wa_14017210380: mtl
+	 * Do not enable gucrc to avoid additional interrupts which
+	 * may disrupt pcode wa.
+	 */
+	if (IS_MTL_GRAPHICS_STEP(gt->i915, P, STEP_A0, STEP_B0) &&
+	    gt->type == GT_MEDIA)
+		return false;
+
  	/* GuC RC is unavailable for pre-Gen12 */
  	return guc->submission_supported &&
-		GRAPHICS_VER(guc_to_gt(guc)->i915) >= 12;
+		GRAPHICS_VER(gt->i915) >= 12;
  }
 
  static bool __guc_rc_selected(struct intel_guc *guc)
drivers/gpu/drm/i915/i915_drv.h +4 -0
index 05b3300cc4ed..659b92382ff2 100644
@@ -740,6 +740,10 @@ IS_SUBPLATFORM(const struct drm_i915_private *i915,
  #define IS_XEHPSDV_GRAPHICS_STEP(__i915, since, until) \
  	(IS_XEHPSDV(__i915) && IS_GRAPHICS_STEP(__i915, since, until))
 
+#define IS_MTL_GRAPHICS_STEP(__i915, variant, since, until) \
+	(IS_SUBPLATFORM(__i915, INTEL_METEORLAKE, INTEL_SUBPLATFORM_##variant) && \
+	 IS_GRAPHICS_STEP(__i915, since, until))
+
  /*
   * DG2 hardware steppings are a bit unusual.  The hardware design was forked to
   * create three variants (G10, G11, and G12) which each have distinct
drivers/gpu/drm/i915/i915_reg.h +9 -0
index 1c0da50c0dc7..abe62cea083d 100644
@@ -6678,6 +6678,15 @@
  /*   XEHP_PCODE_FREQUENCY_CONFIG param2 */
  #define     PCODE_MBOX_DOMAIN_NONE		0x0
  #define     PCODE_MBOX_DOMAIN_MEDIAFF		0x3
+
+/* Wa_14017210380: mtl */
+#define   PCODE_MBOX_GT_STATE			0x50
+/* sub-commands (param1) */
+#define     PCODE_MBOX_GT_STATE_MEDIA_BUSY	0x1
+#define     PCODE_MBOX_GT_STATE_MEDIA_NOT_BUSY	0x2
+/* param2 */
+#define     PCODE_MBOX_GT_STATE_DOMAIN_MEDIA	0x1
+
  #define GEN6_PCODE_DATA				_MMIO(0x138128)
  #define   GEN6_PCODE_FREQ_IA_RATIO_SHIFT	8
  #define   GEN6_PCODE_FREQ_RING_RATIO_SHIFT	16
Signature · 1 line
2.25.1
#6 lore raw
In reply to Badal Nilawar
Quoted 28 lines · Badal Nilawar

This workaround is added for Media Tile of MTL A step. It is to help pcode workaround which handles the hardware bug seen on CXL splitter during package C2/C3 transitins due to MC6 entry/exit. As a part of workaround pcode expect kmd to send mailbox message "media busy" when components of Media tile is in use and "media not busy" when not in use. As per workaround description gucrc need to be disabled so enabled host based RC for Media tile.

HSD: 14017210380

Cc Rodrigo Vivi <[email protected]>
Cc Radhakrishna Sripada <[email protected]>
Cc Vinay Belgaumkar <[email protected]>
Cc Chris Wilson <[email protected]>
---
 drivers/gpu/drm/i915/gt/intel_gt_pm.c     | 33 +++++++++++++++++++++++
 drivers/gpu/drm/i915/gt/uc/intel_guc_rc.c | 13 ++++++++-
 drivers/gpu/drm/i915/i915_drv.h           |  4 +++
 drivers/gpu/drm/i915/i915_reg.h           |  9 +++++++
 4 files changed, 58 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/gt/intel_gt_pm.c +0 -0
index f553e2173bda..398dbeb298ca 100644
@@ -19,10 +19,37 @@
 #include "intel_rc6.h"

drivers/gpu/drm/i915/gt/intel_gt_pm.c line 29

Quoted 10 lines
drivers/gpu/drm/i915/gt/intel_gt_pm.c +4 -0
 #include "intel_rps.h"
 #include "intel_wakeref.h"
+#include "intel_pcode.h"
 #include "pxp/intel_pxp_pm.h"
 
 #define I915_GT_SUSPEND_IDLE_TIMEOUT (HZ / 2)
 
+/*
+ * Wa_14017210380: mtl
+ */

This doesn't appear to be a valid workaround number; workaround numbers are always supposed to be the "lineage" numbers from the workaround database. Wa_14017073508 seems to be related; is that the one you're implementing?

drivers/gpu/drm/i915/gt/intel_gt_pm.c line 31

Quoted 2 lines
drivers/gpu/drm/i915/gt/intel_gt_pm.c +2 -0
+
+static bool mtl_needs_media_mc6_wa(struct intel_gt *gt)

Drive-by comment: names like this aren't great since even though there's only one "media MC6" workaround today, that may not be true in the future.

Matt

Quoted 108 lines
drivers/gpu/drm/i915/gt/intel_gt_pm.c +27 -0
+{
+	return (IS_MTL_GRAPHICS_STEP(gt->i915, P, STEP_A0, STEP_B0) &&
+		gt->type == GT_MEDIA);
+}
+
+static void mtl_mc6_wa_media_busy(struct intel_gt *gt)
+{
+	if (mtl_needs_media_mc6_wa(gt))
+		snb_pcode_write_p(gt->uncore, PCODE_MBOX_GT_STATE,
+				  PCODE_MBOX_GT_STATE_MEDIA_BUSY,
+				  PCODE_MBOX_GT_STATE_DOMAIN_MEDIA, 0);
+}
+
+static void mtl_mc6_wa_media_not_busy(struct intel_gt *gt)
+{
+	if (mtl_needs_media_mc6_wa(gt))
+		snb_pcode_write_p(gt->uncore, PCODE_MBOX_GT_STATE,
+				  PCODE_MBOX_GT_STATE_MEDIA_NOT_BUSY,
+				  PCODE_MBOX_GT_STATE_DOMAIN_MEDIA, 0);
+}
+
 static void user_forcewake(struct intel_gt *gt, bool suspend)
 {
 	int count = atomic_read(&gt->user_wakeref);
@@ -70,6 +97,9 @@ static int __gt_unpark(struct intel_wakeref *wf)
 
 	GT_TRACE(gt, "\n");
 
+	/* Wa_14017210380: mtl */
+	mtl_mc6_wa_media_busy(gt);
+
 	/*
 	 * It seems that the DMC likes to transition between the DC states a lot
 	 * when there are no connected displays (no active power domains) during
@@ -119,6 +149,9 @@ static int __gt_park(struct intel_wakeref *wf)
 	GEM_BUG_ON(!wakeref);
 	intel_display_power_put_async(i915, POWER_DOMAIN_GT_IRQ, wakeref);
 
+	/* Wa_14017210380: mtl */
+	mtl_mc6_wa_media_not_busy(gt);
+
 	return 0;
 }
 
drivers/gpu/drm/i915/gt/uc/intel_guc_rc.c +12 -1
index 8f8dd05835c5..cc6356ff84a5 100644
@@ -11,9 +11,20 @@
 
 static bool __guc_rc_supported(struct intel_guc *guc)
 {
+	struct intel_gt *gt = guc_to_gt(guc);
+
+	/*
+	 * Wa_14017210380: mtl
+	 * Do not enable gucrc to avoid additional interrupts which
+	 * may disrupt pcode wa.
+	 */
+	if (IS_MTL_GRAPHICS_STEP(gt->i915, P, STEP_A0, STEP_B0) &&
+	    gt->type == GT_MEDIA)
+		return false;
+
 	/* GuC RC is unavailable for pre-Gen12 */
 	return guc->submission_supported &&
-		GRAPHICS_VER(guc_to_gt(guc)->i915) >= 12;
+		GRAPHICS_VER(gt->i915) >= 12;
 }
 
 static bool __guc_rc_selected(struct intel_guc *guc)
drivers/gpu/drm/i915/i915_drv.h +4 -0
index 05b3300cc4ed..659b92382ff2 100644
@@ -740,6 +740,10 @@ IS_SUBPLATFORM(const struct drm_i915_private *i915,
 #define IS_XEHPSDV_GRAPHICS_STEP(__i915, since, until) \
 	(IS_XEHPSDV(__i915) && IS_GRAPHICS_STEP(__i915, since, until))
 
+#define IS_MTL_GRAPHICS_STEP(__i915, variant, since, until) \
+	(IS_SUBPLATFORM(__i915, INTEL_METEORLAKE, INTEL_SUBPLATFORM_##variant) && \
+	 IS_GRAPHICS_STEP(__i915, since, until))
+
 /*
  * DG2 hardware steppings are a bit unusual.  The hardware design was forked to
  * create three variants (G10, G11, and G12) which each have distinct
drivers/gpu/drm/i915/i915_reg.h +9 -0
index 1c0da50c0dc7..abe62cea083d 100644
@@ -6678,6 +6678,15 @@
 /*   XEHP_PCODE_FREQUENCY_CONFIG param2 */
 #define     PCODE_MBOX_DOMAIN_NONE		0x0
 #define     PCODE_MBOX_DOMAIN_MEDIAFF		0x3
+
+/* Wa_14017210380: mtl */
+#define   PCODE_MBOX_GT_STATE			0x50
+/* sub-commands (param1) */
+#define     PCODE_MBOX_GT_STATE_MEDIA_BUSY	0x1
+#define     PCODE_MBOX_GT_STATE_MEDIA_NOT_BUSY	0x2
+/* param2 */
+#define     PCODE_MBOX_GT_STATE_DOMAIN_MEDIA	0x1
+
 #define GEN6_PCODE_DATA				_MMIO(0x138128)
 #define   GEN6_PCODE_FREQ_IA_RATIO_SHIFT	8
 #define   GEN6_PCODE_FREQ_RING_RATIO_SHIFT	16
Signature · 1 line
2.25.1
Signature · 4 lines
Matt Roper
Graphics Software Engineer
VTT-OSGC Platform Enablement
Intel Corporation
#7 lore raw

Hi Matt,

Quoted 36 lines · Matt Roper
Quoted 35 lines · Badal Nilawar

This workaround is added for Media Tile of MTL A step. It is to help pcode workaround which handles the hardware bug seen on CXL splitter during package C2/C3 transitins due to MC6 entry/exit. As a part of workaround pcode expect kmd to send mailbox message "media busy" when components of Media tile is in use and "media not busy" when not in use. As per workaround description gucrc need to be disabled so enabled host based RC for Media tile.

HSD: 14017210380

Cc Rodrigo Vivi <[email protected]>
Cc Radhakrishna Sripada <[email protected]>
Cc Vinay Belgaumkar <[email protected]>
Cc Chris Wilson <[email protected]>
---
  drivers/gpu/drm/i915/gt/intel_gt_pm.c     | 33 +++++++++++++++++++++++
  drivers/gpu/drm/i915/gt/uc/intel_guc_rc.c | 13 ++++++++-
  drivers/gpu/drm/i915/i915_drv.h           |  4 +++
  drivers/gpu/drm/i915/i915_reg.h           |  9 +++++++
  4 files changed, 58 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/gt/intel_gt_pm.c +1 -0
index f553e2173bda..398dbeb298ca 100644
@@ -19,10 +19,37 @@
  #include "intel_rc6.h"
  #include "intel_rps.h"
  #include "intel_wakeref.h"
+#include "intel_pcode.h"
  #include "pxp/intel_pxp_pm.h"
 
  #define I915_GT_SUSPEND_IDLE_TIMEOUT (HZ / 2)
 
Quoted 8 lines

drivers/gpu/drm/i915/gt/intel_gt_pm.c line 29

Quoted 3 lines
drivers/gpu/drm/i915/gt/intel_gt_pm.c +3 -0
+/*
+ * Wa_14017210380: mtl
+ */

This doesn't appear to be a valid workaround number; workaround numbers are always supposed to be the "lineage" numbers from the workaround database. Wa_14017073508 seems to be related; is that the one you're implementing?

Thanks for pointing out I will correct the workaround number in next revision.

Quoted 7 lines

drivers/gpu/drm/i915/gt/intel_gt_pm.c line 31

Quoted 3 lines
drivers/gpu/drm/i915/gt/intel_gt_pm.c +2 -0
+
+static bool mtl_needs_media_mc6_wa(struct intel_gt *gt)

Drive-by comment: names like this aren't great since even though there's only one "media MC6" workaround today, that may not be true in the future.

I think its better to drop this function and replace its calls below with (IS_MTL_GRAPHICS_STEP(gt->i915, P, STEP_A0, STEP_B0) && gt->type == GT_MEDIA)

Regards,
Badal

Quoted 113 lines

Matt

Quoted 108 lines
drivers/gpu/drm/i915/gt/intel_gt_pm.c +27 -0
+{
+	return (IS_MTL_GRAPHICS_STEP(gt->i915, P, STEP_A0, STEP_B0) &&
+		gt->type == GT_MEDIA);
+}
+
+static void mtl_mc6_wa_media_busy(struct intel_gt *gt)
+{
+	if (mtl_needs_media_mc6_wa(gt))
+		snb_pcode_write_p(gt->uncore, PCODE_MBOX_GT_STATE,
+				  PCODE_MBOX_GT_STATE_MEDIA_BUSY,
+				  PCODE_MBOX_GT_STATE_DOMAIN_MEDIA, 0);
+}
+
+static void mtl_mc6_wa_media_not_busy(struct intel_gt *gt)
+{
+	if (mtl_needs_media_mc6_wa(gt))
+		snb_pcode_write_p(gt->uncore, PCODE_MBOX_GT_STATE,
+				  PCODE_MBOX_GT_STATE_MEDIA_NOT_BUSY,
+				  PCODE_MBOX_GT_STATE_DOMAIN_MEDIA, 0);
+}
+
  static void user_forcewake(struct intel_gt *gt, bool suspend)
  {
  	int count = atomic_read(&gt->user_wakeref);
@@ -70,6 +97,9 @@ static int __gt_unpark(struct intel_wakeref *wf)
 
  	GT_TRACE(gt, "\n");
 
+	/* Wa_14017210380: mtl */
+	mtl_mc6_wa_media_busy(gt);
+
  	/*
  	 * It seems that the DMC likes to transition between the DC states a lot
  	 * when there are no connected displays (no active power domains) during
@@ -119,6 +149,9 @@ static int __gt_park(struct intel_wakeref *wf)
  	GEM_BUG_ON(!wakeref);
  	intel_display_power_put_async(i915, POWER_DOMAIN_GT_IRQ, wakeref);
 
+	/* Wa_14017210380: mtl */
+	mtl_mc6_wa_media_not_busy(gt);
+
  	return 0;
  }
 
drivers/gpu/drm/i915/gt/uc/intel_guc_rc.c +12 -1
index 8f8dd05835c5..cc6356ff84a5 100644
@@ -11,9 +11,20 @@
 
  static bool __guc_rc_supported(struct intel_guc *guc)
  {
+	struct intel_gt *gt = guc_to_gt(guc);
+
+	/*
+	 * Wa_14017210380: mtl
+	 * Do not enable gucrc to avoid additional interrupts which
+	 * may disrupt pcode wa.
+	 */
+	if (IS_MTL_GRAPHICS_STEP(gt->i915, P, STEP_A0, STEP_B0) &&
+	    gt->type == GT_MEDIA)
+		return false;
+
  	/* GuC RC is unavailable for pre-Gen12 */
  	return guc->submission_supported &&
-		GRAPHICS_VER(guc_to_gt(guc)->i915) >= 12;
+		GRAPHICS_VER(gt->i915) >= 12;
  }
 
  static bool __guc_rc_selected(struct intel_guc *guc)
drivers/gpu/drm/i915/i915_drv.h +4 -0
index 05b3300cc4ed..659b92382ff2 100644
@@ -740,6 +740,10 @@ IS_SUBPLATFORM(const struct drm_i915_private *i915,
  #define IS_XEHPSDV_GRAPHICS_STEP(__i915, since, until) \
  	(IS_XEHPSDV(__i915) && IS_GRAPHICS_STEP(__i915, since, until))
 
+#define IS_MTL_GRAPHICS_STEP(__i915, variant, since, until) \
+	(IS_SUBPLATFORM(__i915, INTEL_METEORLAKE, INTEL_SUBPLATFORM_##variant) && \
+	 IS_GRAPHICS_STEP(__i915, since, until))
+
  /*
   * DG2 hardware steppings are a bit unusual.  The hardware design was forked to
   * create three variants (G10, G11, and G12) which each have distinct
drivers/gpu/drm/i915/i915_reg.h +9 -0
index 1c0da50c0dc7..abe62cea083d 100644
@@ -6678,6 +6678,15 @@
  /*   XEHP_PCODE_FREQUENCY_CONFIG param2 */
  #define     PCODE_MBOX_DOMAIN_NONE		0x0
  #define     PCODE_MBOX_DOMAIN_MEDIAFF		0x3
+
+/* Wa_14017210380: mtl */
+#define   PCODE_MBOX_GT_STATE			0x50
+/* sub-commands (param1) */
+#define     PCODE_MBOX_GT_STATE_MEDIA_BUSY	0x1
+#define     PCODE_MBOX_GT_STATE_MEDIA_NOT_BUSY	0x2
+/* param2 */
+#define     PCODE_MBOX_GT_STATE_DOMAIN_MEDIA	0x1
+
  #define GEN6_PCODE_DATA				_MMIO(0x138128)
  #define   GEN6_PCODE_FREQ_IA_RATIO_SHIFT	8
  #define   GEN6_PCODE_FREQ_RING_RATIO_SHIFT	16
Signature · 1 line
2.25.1