Skip to contentSkip to conversation

drm/xe/mcr: Add L3BANK steering for DG2

PATCH Superseded Lucas De Marchi 3 participants 6 messages Mar 9, 2023 – Mar 13, 2023

Subsystems (2)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/2 drm/xe/mcr: Add L3BANK steering for DG2

Some register ranges with replication type L3BANK were missing from the driver table. The following warning was triggering when adding a workaround touching the register 0xb188:

	xe 0000:03:00.0: Did not find MCR register 0xb188 in any MCR steering table

Add the L3BANK ranges according to the spec.

v2:
- Fix typo in one of the ranges: s/0x008CFF/0x00BCFF/ (Matt Roper)
- Add termination rule in the init function for L3BANK (Matt Roper)

Bspec: 66534

---
 drivers/gpu/drm/xe/xe_gt_mcr.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
drivers/gpu/drm/xe/xe_gt_mcr.c +19 -0
index 10eff02cc7db..ab8fc649ba52 100644
@@ -47,6 +47,12 @@ static const struct xe_mmio_range xelp_l3bank_steering_table[] = {
 	{},
 };
 
+static const struct xe_mmio_range xehp_l3bank_steering_table[] = {
+	{ 0x008C80, 0x008CFF },
+	{ 0x00B100, 0x00B3FF },
+	{},
+};
+
 /*
  * Although the bspec lists more "MSLICE" ranges than shown here, some of those
  * are of a "GAM" subclass that has special rules and doesn't need to be
@@ -180,6 +186,18 @@ static void init_steering_l3bank(struct xe_gt *gt)
 		gt->steering[L3BANK].group_target = __ffs(mslice_mask);
 		gt->steering[L3BANK].instance_target =
 			bank_mask & BIT(0) ? 0 : 2;
+	} else if (gt_to_xe(gt)->info.platform == XE_DG2) {
+		u32 mslice_mask = REG_FIELD_GET(GEN12_MEML3_EN_MASK,
+						xe_mmio_read32(gt, GEN10_MIRROR_FUSE3.reg));
+		u32 bank = __ffs(mslice_mask) * 8;
+
+		/*
+		 * Like mslice registers, look for a valid mslice and steer to
+		 * the first L3BANK of that quad. Access to the Nth L3 bank is
+		 * split between the first bits of group and instance
+		 */
+		gt->steering[L3BANK].group_target = (bank >> 2) & 0x7;
+		gt->steering[L3BANK].instance_target = bank & 0x3;
 	} else {
 		u32 fuse = REG_FIELD_GET(GEN10_L3BANK_MASK,
 					 ~xe_mmio_read32(gt, GEN10_MIRROR_FUSE3.reg));
@@ -277,6 +295,7 @@ void xe_gt_mcr_init(struct xe_gt *gt)
 		gt->steering[INSTANCE0].ranges = xehpc_instance0_steering_table;
 		gt->steering[DSS].ranges = xehpc_dss_steering_table;
 	} else if (xe->info.platform == XE_DG2) {
+		gt->steering[L3BANK].ranges = xehp_l3bank_steering_table;
 		gt->steering[MSLICE].ranges = xehp_mslice_steering_table;
 		gt->steering[LNCF].ranges = xehp_lncf_steering_table;
 		gt->steering[DSS].ranges = xehp_dss_steering_table;
Signature · 1 line
2.39.0
#1 lore raw

PATCH v2 2/2 drm/xe/mcr: Document how to initialize group/instance

Add a sentence about the initialization so it's clear for newcomers how to tweak the init functions for new platforms.

---
 drivers/gpu/drm/xe/xe_gt_mcr.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/xe/xe_gt_mcr.c +4 -1
index ab8fc649ba52..b7cee438f6e3 100644
@@ -34,7 +34,10 @@
  * fused off or currently powered down due to power gating, the MMIO operation
  * is "terminated" by the hardware.  Terminated read operations will return a
  * value of zero and terminated unicast write operations will be silently
- * ignored.
+ * ignored. During device initialization, the goal of the various
+ * ``init_steering_*()`` functions is to apply the termination rules for each
+ * steering type and return a steering that selects an instance that is not
+ * fused off.
  */
 
 enum {
Signature · 1 line
2.39.0
Reviewed-by on v2 2/2
#2 lore raw

Re: [Intel-xe] [PATCH v2 2/2] drm/xe/mcr: Document how to initialize group/instance

Quoted 13 lines · Lucas De Marchi

Add a sentence about the initialization so it's clear for newcomers how to tweak the init functions for new platforms.

---
 drivers/gpu/drm/xe/xe_gt_mcr.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/xe/xe_gt_mcr.c +0 -0
index ab8fc649ba52..b7cee438f6e3 100644

drivers/gpu/drm/xe/xe_gt_mcr.c line 40

Quoted 8 lines
drivers/gpu/drm/xe/xe_gt_mcr.c +4 -1
@@ -34,7 +34,10 @@
  * fused off or currently powered down due to power gating, the MMIO operation
  * is "terminated" by the hardware.  Terminated read operations will return a
  * value of zero and terminated unicast write operations will be silently
- * ignored.
+ * ignored. During device initialization, the goal of the various
+ * ``init_steering_*()`` functions is to apply the termination rules for each
+ * steering type and return a steering that selects an instance that is not
+ * fused off.

Bikeshed: how about wording it as:

"During device initialization, the goal of the various ``init_steering_*()`` functions is to apply the platform-specific rules for each MCR register type to identify a steering target that will select a non-terminated instance."

Pretty much the same as what you had except that it clarifies these rules are platform-specific, that "types" are technically register types rather than steering types (steering behavior is just a detail of the register type), and that we're 'identifying' rather than 'returning' the target (since they're void functions).

Up to you whether you like that better or prefer the original form. Either way,

Quoted 6 lines
drivers/gpu/drm/xe/xe_gt_mcr.c +0 -0
  */
 
 enum {
Signature · 1 line
2.39.0
Signature · 4 lines
Matt Roper
Graphics Software Engineer
Linux GPU Platform Enablement
Intel Corporation
Reviewed-by on v2 1/2
#3 lore raw
In reply to Lucas De Marchi
Quoted 10 lines · Lucas De Marchi

Some register ranges with replication type L3BANK were missing from the driver table. The following warning was triggering when adding a workaround touching the register 0xb188:

	xe 0000:03:00.0: Did not find MCR register 0xb188 in any MCR steering table

Add the L3BANK ranges according to the spec.

v2:
- Fix typo in one of the ranges: s/0x008CFF/0x00BCFF/ (Matt Roper)

Nit: the correction made in v2 was actually the other way around (i.e., replace BCFF with 8CFF).

Aside from that,

Quoted 55 lines

- Add termination rule in the init function for L3BANK (Matt Roper)

Bspec: 66534

---
 drivers/gpu/drm/xe/xe_gt_mcr.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
drivers/gpu/drm/xe/xe_gt_mcr.c +19 -0
index 10eff02cc7db..ab8fc649ba52 100644
@@ -47,6 +47,12 @@ static const struct xe_mmio_range xelp_l3bank_steering_table[] = {
 	{},
 };
 
+static const struct xe_mmio_range xehp_l3bank_steering_table[] = {
+	{ 0x008C80, 0x008CFF },
+	{ 0x00B100, 0x00B3FF },
+	{},
+};
+
 /*
  * Although the bspec lists more "MSLICE" ranges than shown here, some of those
  * are of a "GAM" subclass that has special rules and doesn't need to be
@@ -180,6 +186,18 @@ static void init_steering_l3bank(struct xe_gt *gt)
 		gt->steering[L3BANK].group_target = __ffs(mslice_mask);
 		gt->steering[L3BANK].instance_target =
 			bank_mask & BIT(0) ? 0 : 2;
+	} else if (gt_to_xe(gt)->info.platform == XE_DG2) {
+		u32 mslice_mask = REG_FIELD_GET(GEN12_MEML3_EN_MASK,
+						xe_mmio_read32(gt, GEN10_MIRROR_FUSE3.reg));
+		u32 bank = __ffs(mslice_mask) * 8;
+
+		/*
+		 * Like mslice registers, look for a valid mslice and steer to
+		 * the first L3BANK of that quad. Access to the Nth L3 bank is
+		 * split between the first bits of group and instance
+		 */
+		gt->steering[L3BANK].group_target = (bank >> 2) & 0x7;
+		gt->steering[L3BANK].instance_target = bank & 0x3;
 	} else {
 		u32 fuse = REG_FIELD_GET(GEN10_L3BANK_MASK,
 					 ~xe_mmio_read32(gt, GEN10_MIRROR_FUSE3.reg));
@@ -277,6 +295,7 @@ void xe_gt_mcr_init(struct xe_gt *gt)
 		gt->steering[INSTANCE0].ranges = xehpc_instance0_steering_table;
 		gt->steering[DSS].ranges = xehpc_dss_steering_table;
 	} else if (xe->info.platform == XE_DG2) {
+		gt->steering[L3BANK].ranges = xehp_l3bank_steering_table;
 		gt->steering[MSLICE].ranges = xehp_mslice_steering_table;
 		gt->steering[LNCF].ranges = xehp_lncf_steering_table;
 		gt->steering[DSS].ranges = xehp_dss_steering_table;
Signature · 1 line
2.39.0
Signature · 4 lines
Matt Roper
Graphics Software Engineer
Linux GPU Platform Enablement
Intel Corporation
#4 lore raw
Quoted 7 lines · Matt Roper
Quoted 6 lines · Lucas De Marchi

Some register ranges with replication type L3BANK were missing from the driver table. The following warning was triggering when adding a workaround touching the register 0xb188:

	xe 0000:03:00.0: Did not find MCR register 0xb188 in any MCR steering table
Quoted 7 lines
Quoted 4 lines

Add the L3BANK ranges according to the spec.

v2:
- Fix typo in one of the ranges: s/0x008CFF/0x00BCFF/ (Matt Roper)

Nit: the correction made in v2 was actually the other way around (i.e., replace BCFF with 8CFF).

I think I have to change my glasses or change my programming font :(

Quoted 4 lines

Aside from that,

thanks, I will update the commit message while applying.

Lucas De Marchi

Quoted 62 lines
Quoted 56 lines

- Add termination rule in the init function for L3BANK (Matt Roper)

Bspec: 66534

---
 drivers/gpu/drm/xe/xe_gt_mcr.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
drivers/gpu/drm/xe/xe_gt_mcr.c +19 -1
index 10eff02cc7db..ab8fc649ba52 100644
@@ -47,6 +47,12 @@ static const struct xe_mmio_range xelp_l3bank_steering_table[] = {
 	{},
 };
 
+static const struct xe_mmio_range xehp_l3bank_steering_table[] = {
+	{ 0x008C80, 0x008CFF },
+	{ 0x00B100, 0x00B3FF },
+	{},
+};
+
 /*
  * Although the bspec lists more "MSLICE" ranges than shown here, some of those
  * are of a "GAM" subclass that has special rules and doesn't need to be
@@ -180,6 +186,18 @@ static void init_steering_l3bank(struct xe_gt *gt)
 		gt->steering[L3BANK].group_target = __ffs(mslice_mask);
 		gt->steering[L3BANK].instance_target =
 			bank_mask & BIT(0) ? 0 : 2;
+	} else if (gt_to_xe(gt)->info.platform == XE_DG2) {
+		u32 mslice_mask = REG_FIELD_GET(GEN12_MEML3_EN_MASK,
+						xe_mmio_read32(gt, GEN10_MIRROR_FUSE3.reg));
+		u32 bank = __ffs(mslice_mask) * 8;
+
+		/*
+		 * Like mslice registers, look for a valid mslice and steer to
+		 * the first L3BANK of that quad. Access to the Nth L3 bank is
+		 * split between the first bits of group and instance
+		 */
+		gt->steering[L3BANK].group_target = (bank >> 2) & 0x7;
+		gt->steering[L3BANK].instance_target = bank & 0x3;
 	} else {
 		u32 fuse = REG_FIELD_GET(GEN10_L3BANK_MASK,
 					 ~xe_mmio_read32(gt, GEN10_MIRROR_FUSE3.reg));
@@ -277,6 +295,7 @@ void xe_gt_mcr_init(struct xe_gt *gt)
 		gt->steering[INSTANCE0].ranges = xehpc_instance0_steering_table;
 		gt->steering[DSS].ranges = xehpc_dss_steering_table;
 	} else if (xe->info.platform == XE_DG2) {
+		gt->steering[L3BANK].ranges = xehp_l3bank_steering_table;
 		gt->steering[MSLICE].ranges = xehp_mslice_steering_table;
 		gt->steering[LNCF].ranges = xehp_lncf_steering_table;
 		gt->steering[DSS].ranges = xehp_dss_steering_table;
--

2.39.0

Signature · 4 lines
Matt Roper
Graphics Software Engineer
Linux GPU Platform Enablement
Intel Corporation
CI Reviewed-by Matt Roper on v2 1/2
#5 lore raw

[Intel-xe] ✗ CI.Patch_applied: failure for series starting with [v2,1/2] drm/xe/mcr: Add L3BANK steering for DG2

In reply to Lucas De Marchi
== Series Details ==

== Series Details ==

Series: series starting with [v2,1/2] drm/xe/mcr: Add L3BANK steering for DG2
URL : https://patchwork.freedesktop.org/series/114933/
State : failure

== Summary ==

=== Applying kernel patches on branch 'drm-xe-next' with base: === commit 91440895e3fe91928c6e8a682e87d2b8ca677d82

Author:     Lucas De Marchi <[email protected]>
AuthorDate: Wed Mar 1 01:31:12 2023 -0800
Commit:     Lucas De Marchi <[email protected]>
CommitDate: Fri Mar 10 13:52:30 2023 -0800

drm/xe/pvc: Remove A* steppings

The PVC pre-production A* steppings are not going to be supported in xe driver - the steppings are important for the WAs and since we are not adding the pre-productions ones, there is no need to add the stepping.

=== git am output follows ===
error: patch failed: drivers/gpu/drm/xe/xe_gt_mcr.c:180
error: drivers/gpu/drm/xe/xe_gt_mcr.c: patch does not apply
hint: Use 'git am --show-current-patch' to see the failed patch
Applying: drm/xe/mcr: Add L3BANK steering for DG2
Patch failed at 0001 drm/xe/mcr: Add L3BANK steering for DG2 When you have resolved this problem, run "git am --continue". If you prefer to skip this patch, run "git am --skip" instead. To restore the original branch and stop patching, run "git am --abort".