[PATCH 01/10] drm/i915/icl: Fix context slice count configuration

Tvrtko Ursulin tursulin at ursulin.net
Wed Aug 29 13:53:41 UTC 2018


From: Tvrtko Ursulin <tvrtko.ursulin at intel.com>

Bitfield width for configuring the active slice count has grown in Gen11
so we need to program the GEN8_R_PWR_CLK_STATE accordingly.

Current code was always requesting eight times the number of slices (due
writting to a bitfield starting three bits higher than it should). These
requests were luckily a) capped by the hardware to the available number of
slices, and b) we haven't yet exported the code to ask for reduced slice
configurations.

Due both of the above there was no impact from this incorrect programming
but we should still fix it.

v2:....

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
Bspec: 12247
Reported-by: tony.ye at intel.com
Suggested-by: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
Cc: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
Cc: tony.ye at intel.com
---
 drivers/gpu/drm/i915/i915_reg.h  |  2 ++
 drivers/gpu/drm/i915/intel_lrc.c | 31 ++++++++++++++++++++++---------
 2 files changed, 24 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
index f2321785cbd6..09bc8e730ee1 100644
--- a/drivers/gpu/drm/i915/i915_reg.h
+++ b/drivers/gpu/drm/i915/i915_reg.h
@@ -344,6 +344,8 @@ static inline bool i915_mmio_reg_valid(i915_reg_t reg)
 #define   GEN8_RPCS_S_CNT_ENABLE	(1 << 18)
 #define   GEN8_RPCS_S_CNT_SHIFT		15
 #define   GEN8_RPCS_S_CNT_MASK		(0x7 << GEN8_RPCS_S_CNT_SHIFT)
+#define   GEN11_RPCS_S_CNT_SHIFT	12
+#define   GEN11_RPCS_S_CNT_MASK		(0x3f << GEN11_RPCS_S_CNT_SHIFT)
 #define   GEN8_RPCS_SS_CNT_ENABLE	(1 << 11)
 #define   GEN8_RPCS_SS_CNT_SHIFT	8
 #define   GEN8_RPCS_SS_CNT_MASK		(0x7 << GEN8_RPCS_SS_CNT_SHIFT)
diff --git a/drivers/gpu/drm/i915/intel_lrc.c b/drivers/gpu/drm/i915/intel_lrc.c
index f8ceb9c99dd6..13d5745ae59f 100644
--- a/drivers/gpu/drm/i915/intel_lrc.c
+++ b/drivers/gpu/drm/i915/intel_lrc.c
@@ -2481,6 +2481,7 @@ static u32
 make_rpcs(struct drm_i915_private *dev_priv)
 {
 	u32 rpcs = 0;
+	bool en_subslice_pg = INTEL_INFO(dev_priv)->sseu.has_subslice_pg;
 
 	/*
 	 * No explicit RPCS request is needed to ensure full
@@ -2496,17 +2497,29 @@ make_rpcs(struct drm_i915_private *dev_priv)
 	 * enablement.
 	*/
 	if (INTEL_INFO(dev_priv)->sseu.has_slice_pg) {
-		rpcs |= GEN8_RPCS_S_CNT_ENABLE;
-		rpcs |= hweight8(INTEL_INFO(dev_priv)->sseu.slice_mask) <<
-			GEN8_RPCS_S_CNT_SHIFT;
-		rpcs |= GEN8_RPCS_ENABLE;
+		rpcs = hweight8(INTEL_INFO(dev_priv)->sseu.slice_mask);
+
+		if (IS_GEN11(dev_priv) /*FIXME LP */ && rpcs == 1)
+			en_subslice_pg = false;
+
+		if (INTEL_GEN(dev_priv) >= 11) {
+			rpcs <<= GEN11_RPCS_S_CNT_SHIFT;
+			rpcs &= GEN11_RPCS_S_CNT_MASK;
+		} else {
+			rpcs <<= GEN8_RPCS_S_CNT_SHIFT;
+			rpcs &= GEN8_RPCS_S_CNT_MASK;
+		}
+
+		rpcs |= GEN8_RPCS_ENABLE | GEN8_RPCS_S_CNT_ENABLE;
 	}
 
-	if (INTEL_INFO(dev_priv)->sseu.has_subslice_pg) {
-		rpcs |= GEN8_RPCS_SS_CNT_ENABLE;
-		rpcs |= hweight8(INTEL_INFO(dev_priv)->sseu.subslice_mask[0]) <<
-			GEN8_RPCS_SS_CNT_SHIFT;
-		rpcs |= GEN8_RPCS_ENABLE;
+	if (en_subslice_pg) {
+		u32 val = hweight8(INTEL_INFO(dev_priv)->sseu.subslice_mask[0]);
+
+		val <<= GEN8_RPCS_SS_CNT_SHIFT;
+		val &= GEN8_RPCS_SS_CNT_MASK;
+
+		rpcs |= GEN8_RPCS_ENABLE | GEN8_RPCS_SS_CNT_ENABLE | val;
 	}
 
 	if (INTEL_INFO(dev_priv)->sseu.has_eu_pg) {
-- 
2.17.1



More information about the Intel-gfx-trybot mailing list