Skip to contentSkip to conversation

drm/i915/cnl: Introduce initial Cannonlake Workarounds.

PATCH In review Rodrigo Vivi 4 participants 8 messages Aug 15, 2017 – Aug 18, 2017

Subsystems (2)
lore
Share & tools
lore

Rodrigo Vivi

author maintainer
#0 lore raw

PATCH 1/4 drm/i915/cnl: Introduce initial Cannonlake Workarounds.

Let's inherit workarounds from previous platforms that according to wa_database and BSpec are still valid for Cannonlake.

v2: Add missed workarounds.
v3: Rebase
v4: Remove bad chunk that was added to rc6 disable. (Ander)
Also remove A0 W/a that are not needed anymore.
v5: Rebase on top of CFL.
v6: Remove empty gen9_init_perctx_bb and gen9_init_indirectctx_bb
since they don't carry any gen10 related W/a. (by Oscar). Also Remove A0 exclusive workaround.
v7: Remove more A0 exclusive workarounds. As pointed out by Oscar
many workarounds were changed to be A0 only so let's remove them.

Cc Oscar Mateo <[email protected]>
Cc Mika Kuoppala <[email protected]>
---
 drivers/gpu/drm/i915/i915_gem_gtt.c    |  4 ++--
 drivers/gpu/drm/i915/i915_reg.h        |  6 ++++++
 drivers/gpu/drm/i915/intel_engine_cs.c | 19 +++++++++++++++++++
 drivers/gpu/drm/i915/intel_lrc.c       |  2 ++
 drivers/gpu/drm/i915/intel_pm.c        | 21 ++++++++++++++++++++-
 5 files changed, 49 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/i915_gem_gtt.c +2 -2
index ef1881e256f4..7910784d2c88 100644
@@ -1885,12 +1885,12 @@ static void gtt_write_workarounds(struct drm_i915_private *dev_priv)
 	 * called on driver load and after a GPU reset, so you can place
 	 * workarounds here even if they get overwritten by GPU reset.
 	 */
-	/* WaIncreaseDefaultTLBEntries:chv,bdw,skl,bxt,kbl,glk,cfl */
+	/* WaIncreaseDefaultTLBEntries:chv,bdw,skl,bxt,kbl,glk,cfl,cnl */
 	if (IS_BROADWELL(dev_priv))
 		I915_WRITE(GEN8_L3_LRA_1_GPGPU, GEN8_L3_LRA_1_GPGPU_DEFAULT_VALUE_BDW);
 	else if (IS_CHERRYVIEW(dev_priv))
 		I915_WRITE(GEN8_L3_LRA_1_GPGPU, GEN8_L3_LRA_1_GPGPU_DEFAULT_VALUE_CHV);
-	else if (IS_GEN9_BC(dev_priv))
+	else if (IS_GEN9_BC(dev_priv) || IS_GEN10(dev_priv))
 		I915_WRITE(GEN8_L3_LRA_1_GPGPU, GEN9_L3_LRA_1_GPGPU_DEFAULT_VALUE_SKL);
 	else if (IS_GEN9_LP(dev_priv))
 		I915_WRITE(GEN8_L3_LRA_1_GPGPU, GEN9_L3_LRA_1_GPGPU_DEFAULT_VALUE_BXT);
drivers/gpu/drm/i915/i915_reg.h +6 -0
index b2d785969d17..11d5cb690c9c 100644
@@ -3806,6 +3806,12 @@ enum {
 #define   PWM1_GATING_DIS		(1 << 13)
 
 /*
+ * GEN10 clock gating regs
+ */
+#define SLICE_UNIT_LEVEL_CLKGATE	_MMIO(0x94d4)
+#define  SARBUNIT_CLKGATE_DIS		(1 << 5)
+
+/*
  * Display engine regs
  */
 
drivers/gpu/drm/i915/intel_engine_cs.c +19 -0
index 9ab596941372..58a235316f92 100644
@@ -1065,6 +1065,23 @@ static int bxt_init_workarounds(struct intel_engine_cs *engine)
 	return 0;
 }
 
+static int cnl_init_workarounds(struct intel_engine_cs *engine)
+{
+	struct drm_i915_private *dev_priv = engine->i915;
+	int ret;
+
+	/* WaInPlaceDecompressionHang:cnl */
+	WA_SET_BIT(GEN9_GAMT_ECO_REG_RW_IA,
+		   GAMT_ECO_ENABLE_IN_PLACE_DECOMPRESS);
+
+	/* WaEnablePreemptionGranularityControlByUMD:cnl */
+	ret= wa_ring_whitelist_reg(engine, GEN8_CS_CHICKEN1);
+	if (ret)
+		return ret;
+
+	return 0;
+}
+
 static int kbl_init_workarounds(struct intel_engine_cs *engine)
 {
 	struct drm_i915_private *dev_priv = engine->i915;
@@ -1185,6 +1202,8 @@ int init_workarounds_ring(struct intel_engine_cs *engine)
 		err =  glk_init_workarounds(engine);
 	else if (IS_COFFEELAKE(dev_priv))
 		err = cfl_init_workarounds(engine);
+	else if (IS_CANNONLAKE(dev_priv))
+		err = cnl_init_workarounds(engine);
 	else
 		err = 0;
 	if (err)
drivers/gpu/drm/i915/intel_lrc.c +2 -0
index b0738d2b2a7f..7f8b2f5cd1aa 100644
@@ -1175,6 +1175,8 @@ static int intel_init_workaround_bb(struct intel_engine_cs *engine)
 		return -EINVAL;
 
 	switch (INTEL_GEN(engine->i915)) {
+	case 10:
+		return 0;
 	case 9:
 		wa_bb_fn[0] = gen9_init_indirectctx_bb;
 		wa_bb_fn[1] = gen9_init_perctx_bb;
drivers/gpu/drm/i915/intel_pm.c +20 -1
index 66495ad36973..5d2d248d4c9e 100644
@@ -8254,6 +8254,23 @@ static void gen8_set_l3sqc_credits(struct drm_i915_private *dev_priv,
 	I915_WRITE(GEN7_MISCCPCTL, misccpctl);
 }
 
+static void cannonlake_init_clock_gating(struct drm_i915_private *dev_priv)
+{
+	/* WaEnableChickenDCPR:cnl */
+	I915_WRITE(GEN8_CHICKEN_DCPR_1,
+		   I915_READ(GEN8_CHICKEN_DCPR_1) | MASK_WAKEMEM);
+
+	/* WaFbcWakeMemOn:cnl */
+	I915_WRITE(DISP_ARB_CTL, I915_READ(DISP_ARB_CTL) |
+		   DISP_FBC_MEMORY_WAKE);
+
+	/* WaSarbUnitClockGatingDisable:cnl (pre-prod) */
+	if (IS_CNL_REVID(dev_priv, CNL_REVID_A0, CNL_REVID_B0))
+		I915_WRITE(SLICE_UNIT_LEVEL_CLKGATE,
+			   I915_READ(SLICE_UNIT_LEVEL_CLKGATE) |
+			   SARBUNIT_CLKGATE_DIS);
+}
+
 static void kabylake_init_clock_gating(struct drm_i915_private *dev_priv)
 {
 	gen9_init_clock_gating(dev_priv);
@@ -8734,7 +8751,9 @@ static void nop_init_clock_gating(struct drm_i915_private *dev_priv)
  */
 void intel_init_clock_gating_hooks(struct drm_i915_private *dev_priv)
 {
-	if (IS_SKYLAKE(dev_priv))
+	if (IS_CANNONLAKE(dev_priv))
+		dev_priv->display.init_clock_gating = cannonlake_init_clock_gating;
+	else if (IS_SKYLAKE(dev_priv))
 		dev_priv->display.init_clock_gating = skylake_init_clock_gating;
 	else if (IS_KABYLAKE(dev_priv) || IS_COFFEELAKE(dev_priv))
 		dev_priv->display.init_clock_gating = kabylake_init_clock_gating;
Signature · 6 lines
2.13.2

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
author maintainer
#1 lore raw

PATCH 2/4 drm/i915/cnl: Add WaDisableReplayBufferBankArbitrationOptimization

WA to disable replay buffer destination buffer arbitration optimization.

Same Wa on previous platforms has a different name: WaToEnableHwFixForPushConstHWBug

---
 drivers/gpu/drm/i915/intel_engine_cs.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/gpu/drm/i915/intel_engine_cs.c +4 -0
index 58a235316f92..e66817d5d4ad 100644
@@ -1070,6 +1070,10 @@ static int cnl_init_workarounds(struct intel_engine_cs *engine)
 	struct drm_i915_private *dev_priv = engine->i915;
 	int ret;
 
+	/* WaDisableReplayBufferBankArbitrationOptimization:cnl */
+	WA_SET_BIT_MASKED(COMMON_SLICE_CHICKEN2,
+			  GEN8_SBE_DISABLE_REPLAY_BUF_OPTIMIZATION);
+
 	/* WaInPlaceDecompressionHang:cnl */
 	WA_SET_BIT(GEN9_GAMT_ECO_REG_RW_IA,
 		   GAMT_ECO_ENABLE_IN_PLACE_DECOMPRESS);
Signature · 6 lines
2.13.2

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
author maintainer
#2 lore raw

PATCH 3/4 drm/i915/cnl: WaDisableEnhancedSBEVertexCaching

In reply to Rodrigo Vivi

WA forTDS handle reallocation getting dropped by SDE, which may result in PS attribute corruption.

Disable enhanced SBE vertex caching in COMMON_SLICE_CHICKEN2 offset.

v2: Make it until B0 as spec tells. (by Mika).

---
 drivers/gpu/drm/i915/intel_engine_cs.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/gpu/drm/i915/intel_engine_cs.c +5 -0
index e66817d5d4ad..d23f18874309 100644
@@ -1074,6 +1074,11 @@ static int cnl_init_workarounds(struct intel_engine_cs *engine)
 	WA_SET_BIT_MASKED(COMMON_SLICE_CHICKEN2,
 			  GEN8_SBE_DISABLE_REPLAY_BUF_OPTIMIZATION);
 
+	/* WaDisableEnhancedSBEVertexCaching:cnl (pre-prod) */
+	if (IS_CNL_REVID(dev_priv, 0, CNL_REVID_B0))
+		WA_SET_BIT_MASKED(COMMON_SLICE_CHICKEN2,
+				  GEN8_CSC2_SBE_VUE_CACHE_CONSERVATIVE);
+
 	/* WaInPlaceDecompressionHang:cnl */
 	WA_SET_BIT(GEN9_GAMT_ECO_REG_RW_IA,
 		   GAMT_ECO_ENABLE_IN_PLACE_DECOMPRESS);
Signature · 6 lines
2.13.2

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
author maintainer
#3 lore raw

PATCH 4/4 drm/i915/cnl: Apply large line width optimization

In reply to Rodrigo Vivi

From: Ben Widawsky <[email protected]>

This bit enables hardware that will change the approximation used for distances calculations for AA wide lines so that they are rendered more accurately.

The default value for this bit leaves the legacy behavior. There is no good reason to not enable the new approximation except if comparing to previous GEN rendered images.

v2: Rebase
v3: Fix author.
Rebased by Rodrigo who also added a comment as suggested by Oscar. Since it is surrounded by Workarounds let's just add a comment to make clear it is not an Wa.

---
 drivers/gpu/drm/i915/i915_reg.h | 1 +
 drivers/gpu/drm/i915/intel_pm.c | 4 ++++
 2 files changed, 5 insertions(+)
drivers/gpu/drm/i915/i915_reg.h +1 -0
index 11d5cb690c9c..48b847ddc09a 100644
@@ -2490,6 +2490,7 @@ enum i915_power_well_id {
 # define _3D_CHICKEN2_WM_READ_PIPELINED			(1 << 14)
 #define _3D_CHICKEN3	_MMIO(0x2090)
 #define  _3D_CHICKEN_SF_DISABLE_OBJEND_CULL		(1 << 10)
+#define  _3D_CHICKEN3_AA_LINE_QUALITY_FIX_ENABLE	(1 << 5)
 #define  _3D_CHICKEN3_SF_DISABLE_FASTCLIP_CULL		(1 << 5)
 #define  _3D_CHICKEN_SDE_LIMIT_FIFO_POLY_DEPTH(x)	((x)<<1) /* gen8+ */
 #define  _3D_CHICKEN3_SF_DISABLE_PIPELINED_ATTR_FETCH	(1 << 1) /* gen6 */
drivers/gpu/drm/i915/intel_pm.c +4 -0
index 5d2d248d4c9e..30eb34979917 100644
@@ -8256,6 +8256,10 @@ static void gen8_set_l3sqc_credits(struct drm_i915_private *dev_priv,
 
 static void cannonlake_init_clock_gating(struct drm_i915_private *dev_priv)
 {
+	/* This is not an Wa. Enable for better image quality */
+	I915_WRITE(_3D_CHICKEN3,
+		   _MASKED_BIT_ENABLE(_3D_CHICKEN3_AA_LINE_QUALITY_FIX_ENABLE));
+
 	/* WaEnableChickenDCPR:cnl */
 	I915_WRITE(GEN8_CHICKEN_DCPR_1,
 		   I915_READ(GEN8_CHICKEN_DCPR_1) | MASK_WAKEMEM);
Signature · 6 lines
2.13.2

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Reviewed-by on v1 4/4
#4 lore raw

Re: [PATCH 4/4] drm/i915/cnl: Apply large line width optimization

Quoted 15 lines · Rodrigo Vivi

From: Ben Widawsky <[email protected]>

This bit enables hardware that will change the approximation used for distances calculations for AA wide lines so that they are rendered more accurately.

The default value for this bit leaves the legacy behavior. There is no good reason to not enable the new approximation except if comparing to previous GEN rendered images.

v2: Rebase
v3: Fix author.
Rebased by Rodrigo who also added a comment as suggested by Oscar. Since it is surrounded by Workarounds let's just add a comment to make clear it is not an Wa.

Quoted 4 lines

---

Quoted 21 lines
  drivers/gpu/drm/i915/i915_reg.h | 1 +
  drivers/gpu/drm/i915/intel_pm.c | 4 ++++
  2 files changed, 5 insertions(+)
drivers/gpu/drm/i915/i915_reg.h +1 -0
index 11d5cb690c9c..48b847ddc09a 100644
@@ -2490,6 +2490,7 @@ enum i915_power_well_id {
  # define _3D_CHICKEN2_WM_READ_PIPELINED			(1 << 14)
  #define _3D_CHICKEN3	_MMIO(0x2090)
  #define  _3D_CHICKEN_SF_DISABLE_OBJEND_CULL		(1 << 10)
+#define  _3D_CHICKEN3_AA_LINE_QUALITY_FIX_ENABLE	(1 << 5)
  #define  _3D_CHICKEN3_SF_DISABLE_FASTCLIP_CULL		(1 << 5)
  #define  _3D_CHICKEN_SDE_LIMIT_FIFO_POLY_DEPTH(x)	((x)<<1) /* gen8+ */
  #define  _3D_CHICKEN3_SF_DISABLE_PIPELINED_ATTR_FETCH	(1 << 1) /* gen6 */
drivers/gpu/drm/i915/intel_pm.c +0 -0
index 5d2d248d4c9e..30eb34979917 100644

drivers/gpu/drm/i915/intel_pm.c static void gen8_set_l3sqc_credits(struct drm_i915_private *dev_priv, · line 8265

Quoted 10 lines
drivers/gpu/drm/i915/intel_pm.c +4 -0
@@ -8256,6 +8256,10 @@ static void gen8_set_l3sqc_credits(struct drm_i915_private *dev_priv,
 
  static void cannonlake_init_clock_gating(struct drm_i915_private *dev_priv)
  {
+	/* This is not an Wa. Enable for better image quality */
+	I915_WRITE(_3D_CHICKEN3,
+		   _MASKED_BIT_ENABLE(_3D_CHICKEN3_AA_LINE_QUALITY_FIX_ENABLE));
+
  	/* WaEnableChickenDCPR:cnl */
  	I915_WRITE(GEN8_CHICKEN_DCPR_1,
  		   I915_READ(GEN8_CHICKEN_DCPR_1) | MASK_WAKEMEM);

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#5 lore raw

Re: [PATCH 4/4] drm/i915/cnl: Apply large line width optimization

patches merged to dinq
thanks for the reviews

Quoted 74 lines · Oscar Mateo
Quoted 19 lines · Rodrigo Vivi

From: Ben Widawsky <[email protected]>

This bit enables hardware that will change the approximation used for distances
calculations for AA wide lines so that they are rendered more accurately.

The default value for this bit leaves the legacy behavior. There is no good
reason to not enable the new approximation except if comparing to previous GEN
rendered images.

v2: Rebase
v3: Fix author.
Rebased by Rodrigo who also added a comment as suggested by Oscar. Since it is surrounded by Workarounds let's just add a comment to make clear it is not an Wa.

Quoted 4 lines

---

Quoted 35 lines
  drivers/gpu/drm/i915/i915_reg.h | 1 +
  drivers/gpu/drm/i915/intel_pm.c | 4 ++++
  2 files changed, 5 insertions(+)
drivers/gpu/drm/i915/i915_reg.h +1 -0
index 11d5cb690c9c..48b847ddc09a 100644
@@ -2490,6 +2490,7 @@ enum i915_power_well_id {
  # define _3D_CHICKEN2_WM_READ_PIPELINED                       (1 << 14)
  #define _3D_CHICKEN3  _MMIO(0x2090)
  #define  _3D_CHICKEN_SF_DISABLE_OBJEND_CULL           (1 << 10)
+#define  _3D_CHICKEN3_AA_LINE_QUALITY_FIX_ENABLE       (1 << 5)
  #define  _3D_CHICKEN3_SF_DISABLE_FASTCLIP_CULL                (1 << 5)
  #define  _3D_CHICKEN_SDE_LIMIT_FIFO_POLY_DEPTH(x)     ((x)<<1) /* gen8+
 */

#define _3D_CHICKEN3_SF_DISABLE_PIPELINED_ATTR_FETCH (1 << 1) /* gen6
*/

drivers/gpu/drm/i915/intel_pm.c +4 -0
index 5d2d248d4c9e..30eb34979917 100644
@@ -8256,6 +8256,10 @@ static void gen8_set_l3sqc_credits(struct
 drm_i915_private *dev_priv,
    static void cannonlake_init_clock_gating(struct drm_i915_private
 *dev_priv)
  {
+       /* This is not an Wa. Enable for better image quality */
+       I915_WRITE(_3D_CHICKEN3,
+
 _MASKED_BIT_ENABLE(_3D_CHICKEN3_AA_LINE_QUALITY_FIX_ENABLE));
+
        /* WaEnableChickenDCPR:cnl */
Quoted 2 lines
        I915_WRITE(GEN8_CHICKEN_DCPR_1,
                   I915_READ(GEN8_CHICKEN_DCPR_1) | MASK_WAKEMEM);

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Signature · 6 lines
Rodrigo Vivi
Blog: http://blog.vivi.eng.br
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#6 lore raw

✓ Fi.CI.BAT: success for series starting with [1/4] drm/i915/cnl: Introduce initial Cannonlake Workarounds.

In reply to Rodrigo Vivi
== Series Details ==

== Series Details ==

Series: series starting with [1/4] drm/i915/cnl: Introduce initial Cannonlake Workarounds.
URL : https://patchwork.freedesktop.org/series/28837/
State : success

== Summary ==

Series 28837v1 Series without cover letter
https://patchwork.freedesktop.org/api/1.0/series/28837/revisions/1/mbox/

Test gem_exec_flush:

        Subgroup basic-batch-kernel-default-uc:
                fail       -> PASS       (fi-snb-2600) fdo#100007
Test kms_flip:
        Subgroup basic-flip-vs-modeset:
                skip       -> PASS       (fi-skl-x1585l) fdo#101781
Test kms_pipe_crc_basic:
        Subgroup suspend-read-crc-pipe-b:
                dmesg-warn -> PASS       (fi-byt-n2820) fdo#101705

fdo#100007 https://bugs.freedesktop.org/show_bug.cgi?id=100007
fdo#101781 https://bugs.freedesktop.org/show_bug.cgi?id=101781
fdo#101705 https://bugs.freedesktop.org/show_bug.cgi?id=101705

fi-bdw-5557u     total:279  pass:268  dwarn:0   dfail:0   fail:0   skip:11  time:444s
fi-bdw-gvtdvm    total:279  pass:265  dwarn:0   dfail:0   fail:0   skip:14  time:435s
fi-blb-e6850     total:279  pass:224  dwarn:1   dfail:0   fail:0   skip:54  time:354s
fi-bsw-n3050     total:279  pass:243  dwarn:0   dfail:0   fail:0   skip:36  time:549s
fi-bxt-j4205     total:279  pass:260  dwarn:0   dfail:0   fail:0   skip:19  time:517s
fi-byt-j1900     total:279  pass:254  dwarn:1   dfail:0   fail:0   skip:24  time:523s
fi-byt-n2820     total:279  pass:251  dwarn:0   dfail:0   fail:0   skip:28  time:505s
fi-glk-2a        total:279  pass:260  dwarn:0   dfail:0   fail:0   skip:19  time:606s
fi-hsw-4770      total:279  pass:263  dwarn:0   dfail:0   fail:0   skip:16  time:444s
fi-hsw-4770r     total:279  pass:263  dwarn:0   dfail:0   fail:0   skip:16  time:416s
fi-ilk-650       total:279  pass:229  dwarn:0   dfail:0   fail:0   skip:50  time:414s
fi-ivb-3520m     total:279  pass:261  dwarn:0   dfail:0   fail:0   skip:18  time:504s
fi-ivb-3770      total:279  pass:261  dwarn:0   dfail:0   fail:0   skip:18  time:474s
fi-kbl-7500u     total:279  pass:261  dwarn:0   dfail:0   fail:0   skip:18  time:469s
fi-kbl-7560u     total:279  pass:269  dwarn:0   dfail:0   fail:0   skip:10  time:584s
fi-kbl-r         total:279  pass:261  dwarn:0   dfail:0   fail:0   skip:18  time:588s
fi-pnv-d510      total:279  pass:223  dwarn:1   dfail:0   fail:0   skip:55  time:524s
fi-skl-6260u     total:279  pass:269  dwarn:0   dfail:0   fail:0   skip:10  time:463s
fi-skl-6700k     total:279  pass:261  dwarn:0   dfail:0   fail:0   skip:18  time:472s
fi-skl-6770hq    total:279  pass:269  dwarn:0   dfail:0   fail:0   skip:10  time:479s
fi-skl-gvtdvm    total:279  pass:266  dwarn:0   dfail:0   fail:0   skip:13  time:435s
fi-skl-x1585l    total:279  pass:269  dwarn:0   dfail:0   fail:0   skip:10  time:498s
fi-snb-2520m     total:279  pass:251  dwarn:0   dfail:0   fail:0   skip:28  time:550s
fi-snb-2600      total:279  pass:250  dwarn:0   dfail:0   fail:0   skip:29  time:406s

134bab7e0e7c147edb39a904d310ff88e3408442 drm-tip: 2017y-08m-15d-15h-48m-26s UTC integration manifest 5108ea48f76f drm/i915/cnl: Apply large line width optimization
fb1836d49072 drm/i915/cnl: WaDisableEnhancedSBEVertexCaching
edfb565ac52c drm/i915/cnl: Add WaDisableReplayBufferBankArbitrationOptimization f81cf4daea66 drm/i915/cnl: Introduce initial Cannonlake Workarounds.

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_5408/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Reviewed-by on v1 1/4
#7 lore raw
In reply to Rodrigo Vivi
Quoted 16 lines · Rodrigo Vivi

Let's inherit workarounds from previous platforms that according to wa_database and BSpec are still valid for Cannonlake.

v2: Add missed workarounds.
v3: Rebase
v4: Remove bad chunk that was added to rc6 disable. (Ander)
Also remove A0 W/a that are not needed anymore.
v5: Rebase on top of CFL.
v6: Remove empty gen9_init_perctx_bb and gen9_init_indirectctx_bb
since they don't carry any gen10 related W/a. (by Oscar). Also Remove A0 exclusive workaround.
v7: Remove more A0 exclusive workarounds. As pointed out by Oscar
many workarounds were changed to be A0 only so let's remove them.

Quoted 4 lines
Cc Oscar Mateo <[email protected]>
Cc Mika Kuoppala <[email protected]>

---

Quoted 122 lines
  drivers/gpu/drm/i915/i915_gem_gtt.c    |  4 ++--
  drivers/gpu/drm/i915/i915_reg.h        |  6 ++++++
  drivers/gpu/drm/i915/intel_engine_cs.c | 19 +++++++++++++++++++
  drivers/gpu/drm/i915/intel_lrc.c       |  2 ++
  drivers/gpu/drm/i915/intel_pm.c        | 21 ++++++++++++++++++++-
  5 files changed, 49 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/i915_gem_gtt.c +2 -2
index ef1881e256f4..7910784d2c88 100644
@@ -1885,12 +1885,12 @@ static void gtt_write_workarounds(struct drm_i915_private *dev_priv)
  	 * called on driver load and after a GPU reset, so you can place
  	 * workarounds here even if they get overwritten by GPU reset.
  	 */
-	/* WaIncreaseDefaultTLBEntries:chv,bdw,skl,bxt,kbl,glk,cfl */
+	/* WaIncreaseDefaultTLBEntries:chv,bdw,skl,bxt,kbl,glk,cfl,cnl */
  	if (IS_BROADWELL(dev_priv))
  		I915_WRITE(GEN8_L3_LRA_1_GPGPU, GEN8_L3_LRA_1_GPGPU_DEFAULT_VALUE_BDW);
  	else if (IS_CHERRYVIEW(dev_priv))
  		I915_WRITE(GEN8_L3_LRA_1_GPGPU, GEN8_L3_LRA_1_GPGPU_DEFAULT_VALUE_CHV);
-	else if (IS_GEN9_BC(dev_priv))
+	else if (IS_GEN9_BC(dev_priv) || IS_GEN10(dev_priv))
  		I915_WRITE(GEN8_L3_LRA_1_GPGPU, GEN9_L3_LRA_1_GPGPU_DEFAULT_VALUE_SKL);
  	else if (IS_GEN9_LP(dev_priv))
  		I915_WRITE(GEN8_L3_LRA_1_GPGPU, GEN9_L3_LRA_1_GPGPU_DEFAULT_VALUE_BXT);
drivers/gpu/drm/i915/i915_reg.h +6 -0
index b2d785969d17..11d5cb690c9c 100644
@@ -3806,6 +3806,12 @@ enum {
  #define   PWM1_GATING_DIS		(1 << 13)
 
  /*
+ * GEN10 clock gating regs
+ */
+#define SLICE_UNIT_LEVEL_CLKGATE	_MMIO(0x94d4)
+#define  SARBUNIT_CLKGATE_DIS		(1 << 5)
+
+/*
   * Display engine regs
   */
 
drivers/gpu/drm/i915/intel_engine_cs.c +19 -0
index 9ab596941372..58a235316f92 100644
@@ -1065,6 +1065,23 @@ static int bxt_init_workarounds(struct intel_engine_cs *engine)
  	return 0;
  }
 
+static int cnl_init_workarounds(struct intel_engine_cs *engine)
+{
+	struct drm_i915_private *dev_priv = engine->i915;
+	int ret;
+
+	/* WaInPlaceDecompressionHang:cnl */
+	WA_SET_BIT(GEN9_GAMT_ECO_REG_RW_IA,
+		   GAMT_ECO_ENABLE_IN_PLACE_DECOMPRESS);
+
+	/* WaEnablePreemptionGranularityControlByUMD:cnl */
+	ret= wa_ring_whitelist_reg(engine, GEN8_CS_CHICKEN1);
+	if (ret)
+		return ret;
+
+	return 0;
+}
+
  static int kbl_init_workarounds(struct intel_engine_cs *engine)
  {
  	struct drm_i915_private *dev_priv = engine->i915;
@@ -1185,6 +1202,8 @@ int init_workarounds_ring(struct intel_engine_cs *engine)
  		err =  glk_init_workarounds(engine);
  	else if (IS_COFFEELAKE(dev_priv))
  		err = cfl_init_workarounds(engine);
+	else if (IS_CANNONLAKE(dev_priv))
+		err = cnl_init_workarounds(engine);
  	else
  		err = 0;
  	if (err)
drivers/gpu/drm/i915/intel_lrc.c +2 -0
index b0738d2b2a7f..7f8b2f5cd1aa 100644
@@ -1175,6 +1175,8 @@ static int intel_init_workaround_bb(struct intel_engine_cs *engine)
  		return -EINVAL;
 
  	switch (INTEL_GEN(engine->i915)) {
+	case 10:
+		return 0;
  	case 9:
  		wa_bb_fn[0] = gen9_init_indirectctx_bb;
  		wa_bb_fn[1] = gen9_init_perctx_bb;
drivers/gpu/drm/i915/intel_pm.c +17 -0
index 66495ad36973..5d2d248d4c9e 100644
@@ -8254,6 +8254,23 @@ static void gen8_set_l3sqc_credits(struct drm_i915_private *dev_priv,
  	I915_WRITE(GEN7_MISCCPCTL, misccpctl);
  }
 
+static void cannonlake_init_clock_gating(struct drm_i915_private *dev_priv)
+{
+	/* WaEnableChickenDCPR:cnl */
+	I915_WRITE(GEN8_CHICKEN_DCPR_1,
+		   I915_READ(GEN8_CHICKEN_DCPR_1) | MASK_WAKEMEM);
+
+	/* WaFbcWakeMemOn:cnl */
+	I915_WRITE(DISP_ARB_CTL, I915_READ(DISP_ARB_CTL) |
+		   DISP_FBC_MEMORY_WAKE);
+
+	/* WaSarbUnitClockGatingDisable:cnl (pre-prod) */
+	if (IS_CNL_REVID(dev_priv, CNL_REVID_A0, CNL_REVID_B0))
+		I915_WRITE(SLICE_UNIT_LEVEL_CLKGATE,
+			   I915_READ(SLICE_UNIT_LEVEL_CLKGATE) |
+			   SARBUNIT_CLKGATE_DIS);
+}
+
  static void kabylake_init_clock_gating(struct drm_i915_private *dev_priv)
  {
  	gen9_init_clock_gating(dev_priv);

drivers/gpu/drm/i915/intel_pm.c static void nop_init_clock_gating(struct drm_i915_private *dev_priv) · line 8759

Quoted 10 lines
drivers/gpu/drm/i915/intel_pm.c +3 -1
@@ -8734,7 +8751,9 @@ static void nop_init_clock_gating(struct drm_i915_private *dev_priv)
   */
  void intel_init_clock_gating_hooks(struct drm_i915_private *dev_priv)
  {
-	if (IS_SKYLAKE(dev_priv))
+	if (IS_CANNONLAKE(dev_priv))
+		dev_priv->display.init_clock_gating = cannonlake_init_clock_gating;
+	else if (IS_SKYLAKE(dev_priv))
  		dev_priv->display.init_clock_gating = skylake_init_clock_gating;
  	else if (IS_KABYLAKE(dev_priv) || IS_COFFEELAKE(dev_priv))
  		dev_priv->display.init_clock_gating = kabylake_init_clock_gating;

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx