Skip to contentSkip to conversation

Refactor HW workaround code

PATCH Superseded Oscar Mateo 5 participants 47 messages Oct 13, 2017 – Oct 30, 2017

Subsystems (2)

v3 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#0 lore raw

v3 cover Refactor HW workaround code

Main difference with v2 is the split into GT and Display workarounds (suggested by Ville). Because that makes review even more important (which WA goes where?) I have split the movement of WAs from init_clock_gating into separate patches (one per GEN).

Currently, deciding how/where to apply new workarounds is challenging. Often, workarounds end up applied incorrectly and get lost under certain circumstances (e.g. a context switch or a GPU reset). This is a proposal to attempt to eliminate some of this pain, by clarifying the current classification of workarounds (context saved/restored, global registers, whitelisting, BB), putting them together on the same file, and improving the existing validation infrastructure (debugfs/i-g-t).

Oscar Mateo (22):
drm/i915: Use a mask when applying WaProgramL3SqcReg1Default drm/i915: No need for RING_MAX_NONPRIV_SLOTS space drm/i915: Move a bunch of workaround-related code to its own file drm/i915: Split out functions for different kinds of workarounds drm/i915: Rename saved workarounds to make it explicit that they are
context WAs
drm/i915: Save all GT WAs and apply them at a later time drm/i915: Save all Whitelist WAs and apply them at a later time drm/i915: Create a new category of display WAs
drm/i915: Print all workaround types correctly in debugfs drm/i915: Move WA BB stuff to the workarounds file as well drm/i915/cnl: Move GT and Display workarounds from init_clock_gating drm/i915/gen9: Move GT and Display workarounds from init_clock_gating drm/i915/gen9: Remove Gen9 WAs with no effect drm/i915/cfl: Move GT and Display workarounds from init_clock_gating drm/i915/glk: Move GT and Display workarounds from init_clock_gating drm/i915/kbl: Move GT and Display workarounds from init_clock_gating drm/i915/bxt: Move GT and Display workarounds from init_clock_gating drm/i915/skl: Move GT and Display workarounds from init_clock_gating drm/i915/chv: Move GT and Display workarounds from init_clock_gating drm/i915/bdw: Move GT and Display workarounds from init_clock_gating drm/i915: Move WaProgramL3SqcReg1Default to the workarounds file drm/i915: Document the i915_workarounds file

 drivers/gpu/drm/i915/Makefile            |    3 +-
 drivers/gpu/drm/i915/i915_debugfs.c      |   57 +-
 drivers/gpu/drm/i915/i915_drv.c          |    5 +
 drivers/gpu/drm/i915/i915_drv.h          |   23 +-
 drivers/gpu/drm/i915/i915_gem.c          |    3 +
 drivers/gpu/drm/i915/i915_gem_context.c  |    5 +
 drivers/gpu/drm/i915/i915_reg.h          |    4 +-
 drivers/gpu/drm/i915/intel_engine_cs.c   |  679 -------------
 drivers/gpu/drm/i915/intel_lrc.c         |  266 +----
 drivers/gpu/drm/i915/intel_pm.c          |  309 +-----
 drivers/gpu/drm/i915/intel_ringbuffer.c  |    5 +-
 drivers/gpu/drm/i915/intel_ringbuffer.h  |    3 -
 drivers/gpu/drm/i915/intel_workarounds.c | 1603 ++++++++++++++++++++++++++++++
 drivers/gpu/drm/i915/intel_workarounds.h |   41 +
 14 files changed, 1737 insertions(+), 1269 deletions(-)
 create mode 100644 drivers/gpu/drm/i915/intel_workarounds.c
 create mode 100644 drivers/gpu/drm/i915/intel_workarounds.h
Signature · 6 lines
1.9.1

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

PATCH v3 1/22 drm/i915: Use a mask when applying WaProgramL3SqcReg1Default

Otherwise we are blasting other bits in GEN8_L3SQCREG1 that might be important (although we probably aren't at the moment because 0 seems to be the default for all the other bits).

Fixes 050fc46 ("drm/i915:bxt: implement WaProgramL3SqcReg1DefaultForPerf")
Fixes 450174f ("drm/i915/chv: Tune L3 SQC credits based on actual latencies")
Cc Chris Wilson <[email protected]>
Cc Mika Kuoppala <[email protected]>
Cc Ville Syrjälä <[email protected]>
Cc Imre Deak <[email protected]>
Cc Michel Thierry <[email protected]>
---
 drivers/gpu/drm/i915/i915_reg.h        | 1 +
 drivers/gpu/drm/i915/intel_engine_cs.c | 9 ++++++---
 drivers/gpu/drm/i915/intel_pm.c        | 9 ++++++---
 3 files changed, 13 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/i915_reg.h +1 -0
index d2d0a83..5858f5f 100644
@@ -7041,6 +7041,7 @@ enum {
  */
 #define  L3_GENERAL_PRIO_CREDITS(x)		(((x) >> 1) << 19)
 #define  L3_HIGH_PRIO_CREDITS(x)		(((x) >> 1) << 14)
+#define  L3_PRIO_CREDITS_MASK			(0x1f << 19) | (0x1f << 14)
 
 #define GEN7_L3CNTLREG1				_MMIO(0xB01C)
 #define  GEN7_WA_FOR_GEN7_L3_CONTROL			0x3C47FF8C
drivers/gpu/drm/i915/intel_engine_cs.c +6 -3
index a59b2a3..40e439c 100644
@@ -1252,9 +1252,12 @@ static int bxt_init_workarounds(struct intel_engine_cs *engine)
 	}
 
 	/* WaProgramL3SqcReg1DefaultForPerf:bxt */
-	if (IS_BXT_REVID(dev_priv, BXT_REVID_B0, REVID_FOREVER))
-		I915_WRITE(GEN8_L3SQCREG1, L3_GENERAL_PRIO_CREDITS(62) |
-					   L3_HIGH_PRIO_CREDITS(2));
+	if (IS_BXT_REVID(dev_priv, BXT_REVID_B0, REVID_FOREVER)) {
+		u32 val = I915_READ(GEN8_L3SQCREG1);
+		val &= ~L3_PRIO_CREDITS_MASK;
+		val |= L3_GENERAL_PRIO_CREDITS(62) | L3_HIGH_PRIO_CREDITS(2);
+		I915_WRITE(GEN8_L3SQCREG1, val);
+	}
 
 	/* WaToEnableHwFixForPushConstHWBug:bxt */
 	if (IS_BXT_REVID(dev_priv, BXT_REVID_C0, REVID_FOREVER))
drivers/gpu/drm/i915/intel_pm.c +6 -3
index 2fcff97..6c2c8d8 100644
@@ -8476,15 +8476,18 @@ static void gen8_set_l3sqc_credits(struct drm_i915_private *dev_priv,
 				   int general_prio_credits,
 				   int high_prio_credits)
 {
+	u32 val;
 	u32 misccpctl;
 
 	/* WaTempDisableDOPClkGating:bdw */
 	misccpctl = I915_READ(GEN7_MISCCPCTL);
 	I915_WRITE(GEN7_MISCCPCTL, misccpctl & ~GEN7_DOP_CLOCK_GATE_ENABLE);
 
-	I915_WRITE(GEN8_L3SQCREG1,
-		   L3_GENERAL_PRIO_CREDITS(general_prio_credits) |
-		   L3_HIGH_PRIO_CREDITS(high_prio_credits));
+	val = I915_READ(GEN8_L3SQCREG1);
+	val &= ~L3_PRIO_CREDITS_MASK;
+	val |= L3_GENERAL_PRIO_CREDITS(general_prio_credits);
+	val |= L3_HIGH_PRIO_CREDITS(high_prio_credits);
+	I915_WRITE(GEN8_L3SQCREG1, val);
 
 	/*
 	 * Wait at least 100 clocks before re-enabling clock gating.
Signature · 6 lines
1.9.1

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

Re: [PATCH v3 01/22] drm/i915: Use a mask when applying WaProgramL3SqcReg1Default

Quoting Oscar Mateo (2017-10-13 21:53:55)

Quoted 4 lines

Otherwise we are blasting other bits in GEN8_L3SQCREG1 that might be important (although we probably aren't at the moment because 0 seems to be the default for all the other bits).

Quoted 8 lines
Fixes 050fc46 ("drm/i915:bxt: implement WaProgramL3SqcReg1DefaultForPerf")
Fixes 450174f ("drm/i915/chv: Tune L3 SQC credits based on actual latencies")
Cc Chris Wilson <[email protected]>
Cc Mika Kuoppala <[email protected]>
Cc Ville Syrjälä <[email protected]>
Cc Imre Deak <[email protected]>
Cc Michel Thierry <[email protected]>

If this gets lost in the series, please send separately to bring attention to the bugfix. Hopefully r-b's will be prompt...

Quoted 67 lines
---
 drivers/gpu/drm/i915/i915_reg.h        | 1 +
 drivers/gpu/drm/i915/intel_engine_cs.c | 9 ++++++---
 drivers/gpu/drm/i915/intel_pm.c        | 9 ++++++---
 3 files changed, 13 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/i915_reg.h +1 -0
index d2d0a83..5858f5f 100644
@@ -7041,6 +7041,7 @@ enum {
  */
 #define  L3_GENERAL_PRIO_CREDITS(x)            (((x) >> 1) << 19)
 #define  L3_HIGH_PRIO_CREDITS(x)               (((x) >> 1) << 14)
+#define  L3_PRIO_CREDITS_MASK                  (0x1f << 19) | (0x1f << 14)
 
 #define GEN7_L3CNTLREG1                                _MMIO(0xB01C)
 #define  GEN7_WA_FOR_GEN7_L3_CONTROL                   0x3C47FF8C
drivers/gpu/drm/i915/intel_engine_cs.c +6 -3
index a59b2a3..40e439c 100644
@@ -1252,9 +1252,12 @@ static int bxt_init_workarounds(struct intel_engine_cs *engine)
        }
 
        /* WaProgramL3SqcReg1DefaultForPerf:bxt */
-       if (IS_BXT_REVID(dev_priv, BXT_REVID_B0, REVID_FOREVER))
-               I915_WRITE(GEN8_L3SQCREG1, L3_GENERAL_PRIO_CREDITS(62) |
-                                          L3_HIGH_PRIO_CREDITS(2));
+       if (IS_BXT_REVID(dev_priv, BXT_REVID_B0, REVID_FOREVER)) {
+               u32 val = I915_READ(GEN8_L3SQCREG1);
+               val &= ~L3_PRIO_CREDITS_MASK;
+               val |= L3_GENERAL_PRIO_CREDITS(62) | L3_HIGH_PRIO_CREDITS(2);
+               I915_WRITE(GEN8_L3SQCREG1, val);
+       }
 
        /* WaToEnableHwFixForPushConstHWBug:bxt */
        if (IS_BXT_REVID(dev_priv, BXT_REVID_C0, REVID_FOREVER))
drivers/gpu/drm/i915/intel_pm.c +6 -3
index 2fcff97..6c2c8d8 100644
@@ -8476,15 +8476,18 @@ static void gen8_set_l3sqc_credits(struct drm_i915_private *dev_priv,
                                   int general_prio_credits,
                                   int high_prio_credits)
 {
+       u32 val;
        u32 misccpctl;
 
        /* WaTempDisableDOPClkGating:bdw */
        misccpctl = I915_READ(GEN7_MISCCPCTL);
        I915_WRITE(GEN7_MISCCPCTL, misccpctl & ~GEN7_DOP_CLOCK_GATE_ENABLE);
 
-       I915_WRITE(GEN8_L3SQCREG1,
-                  L3_GENERAL_PRIO_CREDITS(general_prio_credits) |
-                  L3_HIGH_PRIO_CREDITS(high_prio_credits));
+       val = I915_READ(GEN8_L3SQCREG1);
+       val &= ~L3_PRIO_CREDITS_MASK;
+       val |= L3_GENERAL_PRIO_CREDITS(general_prio_credits);
+       val |= L3_HIGH_PRIO_CREDITS(high_prio_credits);
+       I915_WRITE(GEN8_L3SQCREG1, val);
 
        /*
         * Wait at least 100 clocks before re-enabling clock gating.
Signature · 1 line
1.9.1

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

Reviewed-by
#3 lore raw

Re: [PATCH v3 01/22] drm/i915: Use a mask when applying WaProgramL3SqcReg1Default

Quoted 14 lines · Chris Wilson

Quoting Oscar Mateo (2017-10-13 21:53:55)

Quoted 4 lines

Otherwise we are blasting other bits in GEN8_L3SQCREG1 that might be important (although we probably aren't at the moment because 0 seems to be the default for all the other bits).

Quoted 8 lines
Fixes 050fc46 ("drm/i915:bxt: implement WaProgramL3SqcReg1DefaultForPerf")
Fixes 450174f ("drm/i915/chv: Tune L3 SQC credits based on actual latencies")
Cc Chris Wilson <[email protected]>
Cc Mika Kuoppala <[email protected]>
Cc Ville Syrjälä <[email protected]>
Cc Imre Deak <[email protected]>
Cc Michel Thierry <[email protected]>
Quoted 3 lines

If this gets lost in the series, please send separately to bring attention to the bugfix. Hopefully r-b's will be prompt...

This is what happens when someone copies workarounds from another driver verbatim :S

Luckily all the other fields should be 0's.

Quoted 6 lines
Quoted 6 lines
---
  drivers/gpu/drm/i915/i915_reg.h        | 1 +
  drivers/gpu/drm/i915/intel_engine_cs.c | 9 ++++++---
  drivers/gpu/drm/i915/intel_pm.c        | 9 ++++++---
  3 files changed, 13 insertions(+), 6 deletions(-)
Quoted 9 lines

drivers/gpu/drm/i915/i915_reg.h enum { · line 7044

Quoted 9 lines
drivers/gpu/drm/i915/i915_reg.h +1 -0
index d2d0a83..5858f5f 100644
@@ -7041,6 +7041,7 @@ enum {
   */
  #define  L3_GENERAL_PRIO_CREDITS(x)            (((x) >> 1) << 19)
  #define  L3_HIGH_PRIO_CREDITS(x)               (((x) >> 1) << 14)
+#define  L3_PRIO_CREDITS_MASK                  (0x1f << 19) | (0x1f << 14)

checkpatch.pl is asking to enclose this macro^^^ in parentheses,

+#define L3_PRIO_CREDITS_MASK ((0x1f << 19) | (0x1f << 14))

With that,

Quoted 47 lines
Quoted 47 lines
drivers/gpu/drm/i915/i915_reg.h +0 -0
  #define GEN7_L3CNTLREG1                                _MMIO(0xB01C)
  #define  GEN7_WA_FOR_GEN7_L3_CONTROL                   0x3C47FF8C
drivers/gpu/drm/i915/intel_engine_cs.c +6 -3
index a59b2a3..40e439c 100644
@@ -1252,9 +1252,12 @@ static int bxt_init_workarounds(struct intel_engine_cs *engine)
         }
 
         /* WaProgramL3SqcReg1DefaultForPerf:bxt */
-       if (IS_BXT_REVID(dev_priv, BXT_REVID_B0, REVID_FOREVER))
-               I915_WRITE(GEN8_L3SQCREG1, L3_GENERAL_PRIO_CREDITS(62) |
-                                          L3_HIGH_PRIO_CREDITS(2));
+       if (IS_BXT_REVID(dev_priv, BXT_REVID_B0, REVID_FOREVER)) {
+               u32 val = I915_READ(GEN8_L3SQCREG1);
+               val &= ~L3_PRIO_CREDITS_MASK;
+               val |= L3_GENERAL_PRIO_CREDITS(62) | L3_HIGH_PRIO_CREDITS(2);
+               I915_WRITE(GEN8_L3SQCREG1, val);
+       }
 
         /* WaToEnableHwFixForPushConstHWBug:bxt */
         if (IS_BXT_REVID(dev_priv, BXT_REVID_C0, REVID_FOREVER))
drivers/gpu/drm/i915/intel_pm.c +6 -3
index 2fcff97..6c2c8d8 100644
@@ -8476,15 +8476,18 @@ static void gen8_set_l3sqc_credits(struct drm_i915_private *dev_priv,
                                    int general_prio_credits,
                                    int high_prio_credits)
  {
+       u32 val;
         u32 misccpctl;
 
         /* WaTempDisableDOPClkGating:bdw */
         misccpctl = I915_READ(GEN7_MISCCPCTL);
         I915_WRITE(GEN7_MISCCPCTL, misccpctl & ~GEN7_DOP_CLOCK_GATE_ENABLE);
 
-       I915_WRITE(GEN8_L3SQCREG1,
-                  L3_GENERAL_PRIO_CREDITS(general_prio_credits) |
-                  L3_HIGH_PRIO_CREDITS(high_prio_credits));
+       val = I915_READ(GEN8_L3SQCREG1);
+       val &= ~L3_PRIO_CREDITS_MASK;
+       val |= L3_GENERAL_PRIO_CREDITS(general_prio_credits);
+       val |= L3_HIGH_PRIO_CREDITS(high_prio_credits);
+       I915_WRITE(GEN8_L3SQCREG1, val);
 
Quoted 10 lines
Quoted 5 lines
drivers/gpu/drm/i915/intel_pm.c +0 -1
         /*
          * Wait at least 100 clocks before re-enabling clock gating.
--

1.9.1

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

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

#4 lore raw

PATCH v3 2/22 drm/i915: No need for RING_MAX_NONPRIV_SLOTS space

In reply to Oscar Mateo

Now that we write RING_FORCE_TO_NONPRIV registers directly to hardware, [commit 32ced39 ("drm/i915: Transform whitelisting WAs into a simple reg write")] there is no need to save space for them in the list of context workarounds.

v2: Refer to previous commit in commit message (Michel)

---
 drivers/gpu/drm/i915/i915_drv.h | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)
drivers/gpu/drm/i915/i915_drv.h +1 -7
index 6bbc4b8..a5f3999 100644
@@ -1960,13 +1960,7 @@ struct i915_wa_reg {
 	u32 mask;
 };
 
-/*
- * RING_MAX_NONPRIV_SLOTS is per-engine but at this point we are only
- * allowing it for RCS as we don't foresee any requirement of having
- * a whitelist for other engines. When it is really required for
- * other engines then the limit need to be increased.
- */
-#define I915_MAX_WA_REGS (16 + RING_MAX_NONPRIV_SLOTS)
+#define I915_MAX_WA_REGS 16
 
 struct i915_workarounds {
 	struct i915_wa_reg reg[I915_MAX_WA_REGS];
Signature · 6 lines
1.9.1

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

PATCH v3 3/22 drm/i915: Move a bunch of workaround-related code to its own file

In reply to Oscar Mateo

This has grown to be a sizable amount of code, so move it to its own file before we try to refactor anything. For the moment, we are leaving behind the WA BB code and the WAs that get applied (incorrectly) in init_clock_gating, but we will deal with it later.

v2: Use intel_ prefix for code that deals with the hardware (Chris)
v3: Rebased

Cc Chris Wilson <[email protected]>
Cc Mika Kuoppala <[email protected]>
---
 drivers/gpu/drm/i915/Makefile            |   3 +-
 drivers/gpu/drm/i915/intel_engine_cs.c   | 682 -----------------------------
 drivers/gpu/drm/i915/intel_lrc.c         |   1 +
 drivers/gpu/drm/i915/intel_ringbuffer.c  |   1 +
 drivers/gpu/drm/i915/intel_ringbuffer.h  |   3 -
 drivers/gpu/drm/i915/intel_workarounds.c | 708 +++++++++++++++++++++++++++++++
 drivers/gpu/drm/i915/intel_workarounds.h |  31 ++
 7 files changed, 743 insertions(+), 686 deletions(-)
 create mode 100644 drivers/gpu/drm/i915/intel_workarounds.c
 create mode 100644 drivers/gpu/drm/i915/intel_workarounds.h
drivers/gpu/drm/i915/Makefile +2 -1
index 66d23b6..3162a14 100644
@@ -22,7 +22,8 @@ i915-y := i915_drv.o \
 	  intel_csr.o \
 	  intel_device_info.o \
 	  intel_pm.o \
-	  intel_runtime_pm.o
+	  intel_runtime_pm.o \
+	  intel_workarounds.o
 
 i915-$(CONFIG_COMPAT)   += i915_ioc32.o
 i915-$(CONFIG_DEBUG_FS) += i915_debugfs.o intel_pipe_crc.o
drivers/gpu/drm/i915/intel_engine_cs.c +0 -682

688 lines not on this page · raw message

drivers/gpu/drm/i915/intel_lrc.c +1 -0
index fbfcf88..495ade6 100644
@@ -137,6 +137,7 @@
 #include <drm/i915_drm.h>
 #include "i915_drv.h"
 #include "intel_mocs.h"
+#include "intel_workarounds.h"
 
 #define RING_EXECLIST_QFULL		(1 << 0x2)
 #define RING_EXECLIST1_VALID		(1 << 0x3)
drivers/gpu/drm/i915/intel_ringbuffer.c +1 -0
index 4285f09..7e5d7d3 100644
@@ -33,6 +33,7 @@
 #include <drm/i915_drm.h>
 #include "i915_trace.h"
 #include "intel_drv.h"
+#include "intel_workarounds.h"
 
 /* Rough estimate of the typical request size, performing a flush,
  * set-context and then emitting the batch.
drivers/gpu/drm/i915/intel_ringbuffer.h +0 -3
index 17186f0..bad1c19 100644
@@ -725,9 +725,6 @@ static inline u32 intel_engine_last_submit(struct intel_engine_cs *engine)
 	return READ_ONCE(engine->timeline->seqno);
 }
 
-int init_workarounds_ring(struct intel_engine_cs *engine);
-int intel_ring_workarounds_emit(struct drm_i915_gem_request *req);
-
 void intel_engine_get_instdone(struct intel_engine_cs *engine,
 			       struct intel_instdone *instdone);
 
drivers/gpu/drm/i915/intel_workarounds.c new file +708 -0

708 lines not on this page · raw message

drivers/gpu/drm/i915/intel_workarounds.h new file +31 -0
new file mode 100644
index 0000000..27099fc
@@ -0,0 +1,31 @@
+/*
+ * Copyright © 2017 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ *
+ */
+
+#ifndef _I915_WORKAROUNDS_H_
+#define _I915_WORKAROUNDS_H_
+
+int init_workarounds_ring(struct intel_engine_cs *engine);
+int intel_ring_workarounds_emit(struct drm_i915_gem_request *req);
+
+#endif
Signature · 6 lines
1.9.1

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

PATCH v3 4/22 drm/i915: Split out functions for different kinds of workarounds

In reply to Oscar Mateo

There are different kind of workarounds (those that modify registers that live in the context image, those that modify global registers, those that whitelist registers, etc...) and they have different requirements in terms of where they are applied and how. Also, by splitting them apart, it should be easier to decide where a new workaround should go.

v2:
- Add multiple MISSING_CASE
- Rebased

v3:
- Rename mmio_workarounds to gt_workarounds (Chris, Mika)
- Create empty placeholders for BDW and CHV GT WAs
- Rebased

Cc Chris Wilson <[email protected]>
Cc Mika Kuoppala <[email protected]>
Cc Ville Syrjälä <[email protected]>
---
 drivers/gpu/drm/i915/i915_gem.c          |   3 +
 drivers/gpu/drm/i915/i915_gem_context.c  |   5 +
 drivers/gpu/drm/i915/intel_lrc.c         |  10 +-
 drivers/gpu/drm/i915/intel_ringbuffer.c  |   4 +-
 drivers/gpu/drm/i915/intel_workarounds.c | 714 +++++++++++++++++++------------
 drivers/gpu/drm/i915/intel_workarounds.h |   8 +-
 6 files changed, 458 insertions(+), 286 deletions(-)
drivers/gpu/drm/i915/i915_gem.c +3 -0
index f76890b..112a218 100644
@@ -35,6 +35,7 @@
 #include "intel_drv.h"
 #include "intel_frontbuffer.h"
 #include "intel_mocs.h"
+#include "intel_workarounds.h"
 #include "i915_gemfs.h"
 #include <linux/dma-fence-array.h>
 #include <linux/kthread.h>
@@ -4804,6 +4805,8 @@ int i915_gem_init_hw(struct drm_i915_private *dev_priv)
 		}
 	}
 
+	intel_gt_workarounds_apply(dev_priv);
+
 	i915_gem_init_swizzling(dev_priv);
 
 	/*
drivers/gpu/drm/i915/i915_gem_context.c +5 -0
index 5bf96a2..cf104cf 100644
@@ -90,6 +90,7 @@
 #include <drm/i915_drm.h>
 #include "i915_drv.h"
 #include "i915_trace.h"
+#include "intel_workarounds.h"
 
 #define ALL_L3_SLICES(dev) (1 << NUM_L3_SLICES(dev)) - 1
 
@@ -454,6 +455,10 @@ int i915_gem_contexts_init(struct drm_i915_private *dev_priv)
 
 	GEM_BUG_ON(dev_priv->kernel_context);
 
+	err = intel_ctx_workarounds_init(dev_priv);
+	if (err)
+		goto err;
+
 	INIT_LIST_HEAD(&dev_priv->contexts.list);
 	INIT_WORK(&dev_priv->contexts.free_work, contexts_free_worker);
 	init_llist_head(&dev_priv->contexts.free_list);
drivers/gpu/drm/i915/intel_lrc.c +7 -3
index 495ade6..e632a29 100644
@@ -1488,7 +1488,7 @@ static int gen8_init_render_ring(struct intel_engine_cs *engine)
 
 	I915_WRITE(INSTPM, _MASKED_BIT_ENABLE(INSTPM_FORCE_ORDERING));
 
-	return init_workarounds_ring(engine);
+	return 0;
 }
 
 static int gen9_init_render_ring(struct intel_engine_cs *engine)
@@ -1499,7 +1499,11 @@ static int gen9_init_render_ring(struct intel_engine_cs *engine)
 	if (ret)
 		return ret;
 
-	return init_workarounds_ring(engine);
+	ret = intel_whitelist_workarounds_apply(engine);
+	if (ret)
+		return ret;
+
+	return 0;
 }
 
 static void reset_common_ring(struct intel_engine_cs *engine,
@@ -1827,7 +1831,7 @@ static int gen8_init_rcs_context(struct drm_i915_gem_request *req)
 {
 	int ret;
 
-	ret = intel_ring_workarounds_emit(req);
+	ret = intel_ctx_workarounds_emit(req);
 	if (ret)
 		return ret;
 
drivers/gpu/drm/i915/intel_ringbuffer.c +2 -2
index 7e5d7d3..c3f8961 100644
@@ -647,7 +647,7 @@ static int intel_rcs_ctx_init(struct drm_i915_gem_request *req)
 {
 	int ret;
 
-	ret = intel_ring_workarounds_emit(req);
+	ret = intel_ctx_workarounds_emit(req);
 	if (ret != 0)
 		return ret;
 
@@ -706,7 +706,7 @@ static int init_render_ring(struct intel_engine_cs *engine)
 	if (INTEL_INFO(dev_priv)->gen >= 6)
 		I915_WRITE_IMR(engine, ~engine->irq_keep_mask);
 
-	return init_workarounds_ring(engine);
+	return 0;
 }
 
 static void render_ring_cleanup(struct intel_engine_cs *engine)
drivers/gpu/drm/i915/intel_workarounds.c +435 -279

867 lines not on this page · raw message

drivers/gpu/drm/i915/intel_workarounds.h +6 -2
index 27099fc..bba51bb 100644
@@ -25,7 +25,11 @@
 #ifndef _I915_WORKAROUNDS_H_
 #define _I915_WORKAROUNDS_H_
 
-int init_workarounds_ring(struct intel_engine_cs *engine);
-int intel_ring_workarounds_emit(struct drm_i915_gem_request *req);
+int intel_ctx_workarounds_init(struct drm_i915_private *dev_priv);
+int intel_ctx_workarounds_emit(struct drm_i915_gem_request *req);
+
+void intel_gt_workarounds_apply(struct drm_i915_private *dev_priv);
+
+int intel_whitelist_workarounds_apply(struct intel_engine_cs *engine);
 
 #endif
Signature · 6 lines
1.9.1

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

PATCH v3 5/22 drm/i915: Rename saved workarounds to make it explicit that they are context WAs

In reply to Oscar Mateo

Some WAs touch registers that get saved/restored together with the logical context. Make this very explicit by renaming a few things in the code.

v2:
- Improved naming
- Rebased

v3: Also rename I915_MAX_CTX_WA_REGS

Cc Chris Wilson <[email protected]>
Cc Mika Kuoppala <[email protected]>
---
 drivers/gpu/drm/i915/i915_debugfs.c      |  10 +-
 drivers/gpu/drm/i915/i915_drv.h          |   7 +-
 drivers/gpu/drm/i915/intel_workarounds.c | 232 +++++++++++++++----------------
 3 files changed, 125 insertions(+), 124 deletions(-)
drivers/gpu/drm/i915/i915_debugfs.c +5 -5
index 0bb6e01..1eb6e58 100644
@@ -3415,18 +3415,18 @@ static int i915_wa_registers(struct seq_file *m, void *unused)
 
 	intel_runtime_pm_get(dev_priv);
 
-	seq_printf(m, "Workarounds applied: %d\n", workarounds->count);
+	seq_printf(m, "Context workarounds applied: %d\n", workarounds->ctx_wa_count);
 	for_each_engine(engine, dev_priv, id)
 		seq_printf(m, "HW whitelist count for %s: %d\n",
 			   engine->name, workarounds->hw_whitelist_count[id]);
-	for (i = 0; i < workarounds->count; ++i) {
+	for (i = 0; i < workarounds->ctx_wa_count; ++i) {
 		i915_reg_t addr;
 		u32 mask, value, read;
 		bool ok;
 
-		addr = workarounds->reg[i].addr;
-		mask = workarounds->reg[i].mask;
-		value = workarounds->reg[i].value;
+		addr = workarounds->ctx_wa_reg[i].addr;
+		mask = workarounds->ctx_wa_reg[i].mask;
+		value = workarounds->ctx_wa_reg[i].value;
 		read = I915_READ(addr);
 		ok = (value & mask) == (read & mask);
 		seq_printf(m, "0x%X: 0x%08X, mask: 0x%08X, read: 0x%08x, status: %s\n",
drivers/gpu/drm/i915/i915_drv.h +4 -3
index a5f3999..c718ffd 100644
@@ -1960,11 +1960,12 @@ struct i915_wa_reg {
 	u32 mask;
 };
 
-#define I915_MAX_WA_REGS 16
+#define I915_MAX_CTX_WA_REGS 16
 
 struct i915_workarounds {
-	struct i915_wa_reg reg[I915_MAX_WA_REGS];
-	u32 count;
+	struct i915_wa_reg ctx_wa_reg[I915_MAX_CTX_WA_REGS];
+	u32 ctx_wa_count;
+
 	u32 hw_whitelist_count[I915_NUM_ENGINES];
 };
 
drivers/gpu/drm/i915/intel_workarounds.c +116 -116

454 lines not on this page · raw message

Signature · 6 lines
1.9.1

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

PATCH v3 6/22 drm/i915: Save all GT WAs and apply them at a later time

In reply to Oscar Mateo

By doing this, we can dump these workarounds in debugfs for validation (which, at the moment, we are only able to do for the contexts WAs).

v2:
- Wrong macro used for MMIO set bit masked
- Improved naming
- Rebased

v3:
- GT instead of MMIO (Chris, Mika)
- Leave L3_PRIO_CREDITS_MASK for a separate patch
- Rebased

Cc Chris Wilson <[email protected]>
Cc Mika Kuoppala <[email protected]>
Cc Ville Syrjälä <[email protected]>
---
 drivers/gpu/drm/i915/i915_drv.c          |   5 +
 drivers/gpu/drm/i915/i915_drv.h          |   4 +
 drivers/gpu/drm/i915/intel_workarounds.c | 247 ++++++++++++++++++++-----------
 drivers/gpu/drm/i915/intel_workarounds.h |   1 +
 4 files changed, 170 insertions(+), 87 deletions(-)
drivers/gpu/drm/i915/i915_drv.c +5 -0
index f1e6517..27993eb 100644
@@ -49,6 +49,7 @@
 #include "i915_drv.h"
 #include "i915_trace.h"
 #include "i915_vgpu.h"
+#include "intel_workarounds.h"
 #include "intel_drv.h"
 #include "intel_uc.h"
 
@@ -886,6 +887,10 @@ static int i915_driver_init_early(struct drm_i915_private *dev_priv,
 	BUG_ON(device_info->gen > sizeof(device_info->gen_mask) * BITS_PER_BYTE);
 	device_info->gen_mask = BIT(device_info->gen - 1);
 
+	ret = intel_gt_workarounds_init(dev_priv);
+	if (ret < 0)
+		return ret;
+
 	spin_lock_init(&dev_priv->irq_lock);
 	spin_lock_init(&dev_priv->gpu_error.lock);
 	mutex_init(&dev_priv->backlight_lock);
drivers/gpu/drm/i915/i915_drv.h +4 -0
index c718ffd..6e57d7f 100644
@@ -1961,11 +1961,15 @@ struct i915_wa_reg {
 };
 
 #define I915_MAX_CTX_WA_REGS 16
+#define I915_MAX_MMIO_WA_REGS 32
 
 struct i915_workarounds {
 	struct i915_wa_reg ctx_wa_reg[I915_MAX_CTX_WA_REGS];
 	u32 ctx_wa_count;
 
+	struct i915_wa_reg gt_wa_reg[I915_MAX_MMIO_WA_REGS];
+	u32 gt_wa_count;
+
 	u32 hw_whitelist_count[I915_NUM_ENGINES];
 };
 
drivers/gpu/drm/i915/intel_workarounds.c +160 -87

355 lines not on this page · raw message

drivers/gpu/drm/i915/intel_workarounds.h +1 -0
index bba51bb..a935181 100644
@@ -28,6 +28,7 @@
 int intel_ctx_workarounds_init(struct drm_i915_private *dev_priv);
 int intel_ctx_workarounds_emit(struct drm_i915_gem_request *req);
 
+int intel_gt_workarounds_init(struct drm_i915_private *dev_priv);
 void intel_gt_workarounds_apply(struct drm_i915_private *dev_priv);
 
 int intel_whitelist_workarounds_apply(struct intel_engine_cs *engine);
Signature · 6 lines
1.9.1

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

Re: [PATCH v3 06/22] drm/i915: Save all GT WAs and apply them at a later time

Quoting Oscar Mateo (2017-10-13 21:54:00)

Quoted 13 lines

By doing this, we can dump these workarounds in debugfs for validation (which, at the moment, we are only able to do for the contexts WAs).

v2:
- Wrong macro used for MMIO set bit masked
- Improved naming
- Rebased

v3:
- GT instead of MMIO (Chris, Mika)
- Leave L3_PRIO_CREDITS_MASK for a separate patch
- Rebased

Quoted 4 lines
Cc Chris Wilson <[email protected]>
Cc Mika Kuoppala <[email protected]>
Cc Ville Syrjälä <[email protected]>

(Easy ones first!)
-Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#10 lore raw

PATCH v3 7/22 drm/i915: Save all Whitelist WAs and apply them at a later time

In reply to Oscar Mateo

Same as we have been doing for other types, this allow us to dump the whole list of workarounds to debugs, for validation purposes.

v2:
- Improved naming
- Rebased

Cc Chris Wilson <[email protected]>
Cc Mika Kuoppala <[email protected]>
---
 drivers/gpu/drm/i915/i915_debugfs.c      |   2 +-
 drivers/gpu/drm/i915/i915_drv.h          |   3 +-
 drivers/gpu/drm/i915/intel_lrc.c         |   8 ++-
 drivers/gpu/drm/i915/intel_workarounds.c | 113 ++++++++++++++++---------------
 drivers/gpu/drm/i915/intel_workarounds.h |   3 +-
 5 files changed, 67 insertions(+), 62 deletions(-)
drivers/gpu/drm/i915/i915_debugfs.c +1 -1
index 1eb6e58..f108f53 100644
@@ -3418,7 +3418,7 @@ static int i915_wa_registers(struct seq_file *m, void *unused)
 	seq_printf(m, "Context workarounds applied: %d\n", workarounds->ctx_wa_count);
 	for_each_engine(engine, dev_priv, id)
 		seq_printf(m, "HW whitelist count for %s: %d\n",
-			   engine->name, workarounds->hw_whitelist_count[id]);
+			   engine->name, workarounds->whitelist_wa_count[id]);
 	for (i = 0; i < workarounds->ctx_wa_count; ++i) {
 		i915_reg_t addr;
 		u32 mask, value, read;
drivers/gpu/drm/i915/i915_drv.h +2 -1
index 6e57d7f..b8ce7c1 100644
@@ -1970,7 +1970,8 @@ struct i915_workarounds {
 	struct i915_wa_reg gt_wa_reg[I915_MAX_MMIO_WA_REGS];
 	u32 gt_wa_count;
 
-	u32 hw_whitelist_count[I915_NUM_ENGINES];
+	struct i915_wa_reg whitelist_wa_reg[I915_NUM_ENGINES][RING_MAX_NONPRIV_SLOTS];
+	u32 whitelist_wa_count[I915_NUM_ENGINES];
 };
 
 struct i915_virtual_gpu {
drivers/gpu/drm/i915/intel_lrc.c +5 -3
index e632a29..f3d4602 100644
@@ -1499,9 +1499,7 @@ static int gen9_init_render_ring(struct intel_engine_cs *engine)
 	if (ret)
 		return ret;
 
-	ret = intel_whitelist_workarounds_apply(engine);
-	if (ret)
-		return ret;
+	intel_whitelist_workarounds_apply(engine);
 
 	return 0;
 }
@@ -1988,6 +1986,10 @@ int logical_render_ring_init(struct intel_engine_cs *engine)
 	if (ret)
 		return ret;
 
+	ret = intel_whitelist_workarounds_init(engine);
+	if (ret)
+		return ret;
+
 	ret = intel_init_workaround_bb(engine);
 	if (ret) {
 		/*
drivers/gpu/drm/i915/intel_workarounds.c +57 -56

213 lines not on this page · raw message

drivers/gpu/drm/i915/intel_workarounds.h +2 -1
index a935181..fc3b12d 100644
@@ -31,6 +31,7 @@
 int intel_gt_workarounds_init(struct drm_i915_private *dev_priv);
 void intel_gt_workarounds_apply(struct drm_i915_private *dev_priv);
 
-int intel_whitelist_workarounds_apply(struct intel_engine_cs *engine);
+int intel_whitelist_workarounds_init(struct intel_engine_cs *engine);
+void intel_whitelist_workarounds_apply(struct intel_engine_cs *engine);
 
 #endif
Signature · 6 lines
1.9.1

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

Re: [PATCH v3 07/22] drm/i915: Save all Whitelist WAs and apply them at a later time

Quoting Oscar Mateo (2017-10-13 21:54:01)

Quoted 10 lines

Same as we have been doing for other types, this allow us to dump the whole list of workarounds to debugs, for validation purposes.

v2:
- Improved naming
- Rebased

Cc Chris Wilson <[email protected]>
Cc Mika Kuoppala <[email protected]>

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

#12 lore raw

PATCH v3 8/22 drm/i915: Create a new category of display WAs

In reply to Oscar Mateo

Display workarounds do not need to be re-applied on a GPU reset (this is, in Ville's words: "at the very least wasted effort [...] and could even be actively harmful in case we end up clobbering something the current display configuration depends on"). Therefore, they have to be applied in a different place that GT ones so they deserve their own category.

Actually populating this is left for future patches: we have to start moving WAs from init_clock_gating into either GT or Display functions, and this requires a good deal of careful code reviewing.

Cc Chris Wilson <[email protected]>
Cc Mika Kuoppala <[email protected]>
Cc Rodrigo Vivi <[email protected]>
---
 drivers/gpu/drm/i915/i915_drv.c          |   2 +-
 drivers/gpu/drm/i915/i915_drv.h          |   3 +
 drivers/gpu/drm/i915/intel_pm.c          |   2 +
 drivers/gpu/drm/i915/intel_workarounds.c | 154 +++++++++++++++++++++++++++++--
 drivers/gpu/drm/i915/intel_workarounds.h |   3 +-
 5 files changed, 155 insertions(+), 9 deletions(-)
drivers/gpu/drm/i915/i915_drv.c +1 -1
index 27993eb..6e9a0da 100644
@@ -887,7 +887,7 @@ static int i915_driver_init_early(struct drm_i915_private *dev_priv,
 	BUG_ON(device_info->gen > sizeof(device_info->gen_mask) * BITS_PER_BYTE);
 	device_info->gen_mask = BIT(device_info->gen - 1);
 
-	ret = intel_gt_workarounds_init(dev_priv);
+	ret = intel_mmio_workarounds_init(dev_priv);
 	if (ret < 0)
 		return ret;
 
drivers/gpu/drm/i915/i915_drv.h +3 -0
index b8ce7c1..1810e26 100644
@@ -1970,6 +1970,9 @@ struct i915_workarounds {
 	struct i915_wa_reg gt_wa_reg[I915_MAX_MMIO_WA_REGS];
 	u32 gt_wa_count;
 
+	struct i915_wa_reg display_wa_reg[I915_MAX_MMIO_WA_REGS];
+	u32 display_wa_count;
+
 	struct i915_wa_reg whitelist_wa_reg[I915_NUM_ENGINES][RING_MAX_NONPRIV_SLOTS];
 	u32 whitelist_wa_count[I915_NUM_ENGINES];
 };
drivers/gpu/drm/i915/intel_pm.c +2 -0
index 6c2c8d8..e4b3904 100644
@@ -29,6 +29,7 @@
 #include <drm/drm_plane_helper.h>
 #include "i915_drv.h"
 #include "intel_drv.h"
+#include "intel_workarounds.h"
 #include "../../../platform/x86/intel_ips.h"
 #include <linux/module.h>
 #include <drm/drm_atomic_helper.h>
@@ -9003,6 +9004,7 @@ static void i830_init_clock_gating(struct drm_i915_private *dev_priv)
 void intel_init_clock_gating(struct drm_i915_private *dev_priv)
 {
 	dev_priv->display.init_clock_gating(dev_priv);
+	intel_display_workarounds_apply(dev_priv);
 }
 
 void intel_suspend_hw(struct drm_i915_private *dev_priv)
drivers/gpu/drm/i915/intel_workarounds.c +147 -7

175 lines not on this page · raw message

drivers/gpu/drm/i915/intel_workarounds.h +2 -1
index fc3b12d..44d3941 100644
@@ -28,8 +28,9 @@
 int intel_ctx_workarounds_init(struct drm_i915_private *dev_priv);
 int intel_ctx_workarounds_emit(struct drm_i915_gem_request *req);
 
-int intel_gt_workarounds_init(struct drm_i915_private *dev_priv);
+int intel_mmio_workarounds_init(struct drm_i915_private *dev_priv);
 void intel_gt_workarounds_apply(struct drm_i915_private *dev_priv);
+void intel_display_workarounds_apply(struct drm_i915_private *dev_priv);
 
 int intel_whitelist_workarounds_init(struct intel_engine_cs *engine);
 void intel_whitelist_workarounds_apply(struct intel_engine_cs *engine);
Signature · 6 lines
1.9.1

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

Re: [PATCH v3 08/22] drm/i915: Create a new category of display WAs

Quoting Oscar Mateo (2017-10-13 21:54:02)

Quoted 30 lines

Display workarounds do not need to be re-applied on a GPU reset (this is, in Ville's words: "at the very least wasted effort [...] and could even be actively harmful in case we end up clobbering something the current display configuration depends on"). Therefore, they have to be applied in a different place that GT ones so they deserve their own category.

Actually populating this is left for future patches: we have to start moving WAs from init_clock_gating into either GT or Display functions, and this requires a good deal of careful code reviewing.

Cc Chris Wilson <[email protected]>
Cc Mika Kuoppala <[email protected]>
Cc Rodrigo Vivi <[email protected]>
---
 drivers/gpu/drm/i915/i915_drv.c          |   2 +-
 drivers/gpu/drm/i915/i915_drv.h          |   3 +
 drivers/gpu/drm/i915/intel_pm.c          |   2 +
 drivers/gpu/drm/i915/intel_workarounds.c | 154 +++++++++++++++++++++++++++++--
 drivers/gpu/drm/i915/intel_workarounds.h |   3 +-
 5 files changed, 155 insertions(+), 9 deletions(-)
drivers/gpu/drm/i915/i915_drv.c +0 -0
index 27993eb..6e9a0da 100644

drivers/gpu/drm/i915/i915_drv.c static int i915_driver_init_early(struct drm_i915_private *dev_priv, · line 890

Quoted 5 lines
drivers/gpu/drm/i915/i915_drv.c +1 -1
@@ -887,7 +887,7 @@ static int i915_driver_init_early(struct drm_i915_private *dev_priv,
        BUG_ON(device_info->gen > sizeof(device_info->gen_mask) * BITS_PER_BYTE);
        device_info->gen_mask = BIT(device_info->gen - 1);
 
-       ret = intel_gt_workarounds_init(dev_priv);
+       ret = intel_mmio_workarounds_init(dev_priv);

Momentary panic over. I'm going to suggest those that we carry the init_early nomenclature over. It's very important that we stress that we are *only* building the lists at this time and not touching the hw.

With that change backported to intel_gt_workarounds_init_early()

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

#14 lore raw

PATCH v3 9/22 drm/i915: Print all workaround types correctly in debugfs

In reply to Oscar Mateo

Let's try to make sure that all WAs are applied correctly and survive resumes, resets, etc... (with some help from a companion i-g-t patch).

v2:
- Rebased
- Print display WAs as well (Ville)

Cc Chris Wilson <[email protected]>
Cc Mika Kuoppala <[email protected]>
Cc Ville Syrjälä <[email protected]>
---
 drivers/gpu/drm/i915/i915_debugfs.c | 53 +++++++++++++++++++++++++++----------
 1 file changed, 39 insertions(+), 14 deletions(-)
drivers/gpu/drm/i915/i915_debugfs.c +39 -14
index f108f53..11fb9c3 100644
@@ -3399,6 +3399,20 @@ static int i915_shared_dplls_info(struct seq_file *m, void *unused)
 	return 0;
 }
 
+static void check_wa_register(struct seq_file *m, struct i915_wa_reg *wa_reg)
+{
+	struct drm_i915_private *dev_priv = node_to_i915(m->private);
+	u32 read;
+	bool ok;
+
+	read = I915_READ(wa_reg->addr);
+	ok = (wa_reg->value & wa_reg->mask) == (read & wa_reg->mask);
+	seq_printf(m, "0x%X: 0x%08x, mask: 0x%08x, read: 0x%08x, status: %s\n",
+		   i915_mmio_reg_offset(wa_reg->addr),
+		   wa_reg->value, wa_reg->mask, read,
+		   ok ? "OK" : "FAIL");
+}
+
 static int i915_wa_registers(struct seq_file *m, void *unused)
 {
 	int i;
@@ -3408,6 +3422,7 @@ static int i915_wa_registers(struct seq_file *m, void *unused)
 	struct drm_device *dev = &dev_priv->drm;
 	struct i915_workarounds *workarounds = &dev_priv->workarounds;
 	enum intel_engine_id id;
+	u32 whitelist_wa_count = 0;
 
 	ret = mutex_lock_interruptible(&dev->struct_mutex);
 	if (ret)
@@ -3416,22 +3431,32 @@ static int i915_wa_registers(struct seq_file *m, void *unused)
 	intel_runtime_pm_get(dev_priv);
 
 	seq_printf(m, "Context workarounds applied: %d\n", workarounds->ctx_wa_count);
-	for_each_engine(engine, dev_priv, id)
-		seq_printf(m, "HW whitelist count for %s: %d\n",
-			   engine->name, workarounds->whitelist_wa_count[id]);
 	for (i = 0; i < workarounds->ctx_wa_count; ++i) {
-		i915_reg_t addr;
-		u32 mask, value, read;
-		bool ok;
-
-		addr = workarounds->ctx_wa_reg[i].addr;
-		mask = workarounds->ctx_wa_reg[i].mask;
-		value = workarounds->ctx_wa_reg[i].value;
-		read = I915_READ(addr);
-		ok = (value & mask) == (read & mask);
-		seq_printf(m, "0x%X: 0x%08X, mask: 0x%08X, read: 0x%08x, status: %s\n",
-			   i915_mmio_reg_offset(addr), value, mask, read, ok ? "OK" : "FAIL");
+		struct i915_wa_reg *wa_reg = &workarounds->ctx_wa_reg[i];
+
+		seq_printf(m, "0x%X: 0x%08x, mask: 0x%08x\n",
+			   i915_mmio_reg_offset(wa_reg->addr),
+			   wa_reg->value, wa_reg->mask);
 	}
+	seq_putc(m, '\n');
+
+	seq_printf(m, "GT workarounds applied: %d\n", workarounds->gt_wa_count);
+	for (i = 0; i < workarounds->gt_wa_count; ++i)
+		check_wa_register(m, &workarounds->gt_wa_reg[i]);
+	seq_putc(m, '\n');
+
+	seq_printf(m, "Display workarounds applied: %d\n", workarounds->display_wa_count);
+	for (i = 0; i < workarounds->display_wa_count; ++i)
+		check_wa_register(m, &workarounds->display_wa_reg[i]);
+	seq_putc(m, '\n');
+
+	for_each_engine(engine, dev_priv, id)
+		whitelist_wa_count += workarounds->whitelist_wa_count[id];
+	seq_printf(m, "Whitelist workarounds applied: %d\n", whitelist_wa_count);
+	for_each_engine(engine, dev_priv, id)
+		for (i = 0; i < workarounds->whitelist_wa_count[id]; ++i)
+			check_wa_register(m, &workarounds->whitelist_wa_reg[id][i]);
+	seq_putc(m, '\n');
 
 	intel_runtime_pm_put(dev_priv);
 	mutex_unlock(&dev->struct_mutex);
Signature · 6 lines
1.9.1

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

Re: [PATCH v3 09/22] drm/i915: Print all workaround types correctly in debugfs

Quoting Oscar Mateo (2017-10-13 21:54:03)

Quoted 50 lines

Let's try to make sure that all WAs are applied correctly and survive resumes, resets, etc... (with some help from a companion i-g-t patch).

v2:
- Rebased
- Print display WAs as well (Ville)

Cc Chris Wilson <[email protected]>
Cc Mika Kuoppala <[email protected]>
Cc Ville Syrjälä <[email protected]>
---
 drivers/gpu/drm/i915/i915_debugfs.c | 53 +++++++++++++++++++++++++++----------
 1 file changed, 39 insertions(+), 14 deletions(-)
drivers/gpu/drm/i915/i915_debugfs.c +15 -0
index f108f53..11fb9c3 100644
@@ -3399,6 +3399,20 @@ static int i915_shared_dplls_info(struct seq_file *m, void *unused)
        return 0;
 }
 
+static void check_wa_register(struct seq_file *m, struct i915_wa_reg *wa_reg)
+{
+       struct drm_i915_private *dev_priv = node_to_i915(m->private);
+       u32 read;
+       bool ok;
+
+       read = I915_READ(wa_reg->addr);
+       ok = (wa_reg->value & wa_reg->mask) == (read & wa_reg->mask);
+       seq_printf(m, "0x%X: 0x%08x, mask: 0x%08x, read: 0x%08x, status: %s\n",
+                  i915_mmio_reg_offset(wa_reg->addr),
+                  wa_reg->value, wa_reg->mask, read,
+                  ok ? "OK" : "FAIL");
+}
+
 static int i915_wa_registers(struct seq_file *m, void *unused)
 {
        int i;
@@ -3408,6 +3422,7 @@ static int i915_wa_registers(struct seq_file *m, void *unused)
        struct drm_device *dev = &dev_priv->drm;
        struct i915_workarounds *workarounds = &dev_priv->workarounds;
        enum intel_engine_id id;
+       u32 whitelist_wa_count = 0;
 
        ret = mutex_lock_interruptible(&dev->struct_mutex);
        if (ret)

drivers/gpu/drm/i915/i915_debugfs.c static int i915_wa_registers(struct seq_file *m, void *unused) · line 3431

Quoted 1 line
drivers/gpu/drm/i915/i915_debugfs.c +0 -0
@@ -3416,22 +3431,32 @@ static int i915_wa_registers(struct seq_file *m, void *unused)
        intel_runtime_pm_get(dev_priv);

Grab the forcewake once for everyone. One benefit is that we know then all reads are consistently from the same powercontext epoch (where that matters).
-Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#16 lore raw

PATCH v3 10/22 drm/i915: Move WA BB stuff to the workarounds file as well

In reply to Oscar Mateo

Since we are trying to put all WA stuff together, do not forget about the BB WAs.

Cc Chris Wilson <[email protected]>
Cc Mika Kuoppala <[email protected]>
---
 drivers/gpu/drm/i915/intel_lrc.c         | 253 +-----------------------------
 drivers/gpu/drm/i915/intel_workarounds.c | 254 +++++++++++++++++++++++++++++++
 drivers/gpu/drm/i915/intel_workarounds.h |   3 +
 3 files changed, 259 insertions(+), 251 deletions(-)
drivers/gpu/drm/i915/intel_lrc.c +2 -251
index f3d4602..0ba8f1b 100644
@@ -1166,255 +1166,6 @@ static int execlists_request_alloc(struct drm_i915_gem_request *request)
 	return 0;
 }
 
-/*
- * In this WA we need to set GEN8_L3SQCREG4[21:21] and reset it after
- * PIPE_CONTROL instruction. This is required for the flush to happen correctly
- * but there is a slight complication as this is applied in WA batch where the
- * values are only initialized once so we cannot take register value at the
- * beginning and reuse it further; hence we save its value to memory, upload a
- * constant value with bit21 set and then we restore it back with the saved value.
- * To simplify the WA, a constant value is formed by using the default value
- * of this register. This shouldn't be a problem because we are only modifying
- * it for a short period and this batch in non-premptible. We can ofcourse
- * use additional instructions that read the actual value of the register
- * at that time and set our bit of interest but it makes the WA complicated.
- *
- * This WA is also required for Gen9 so extracting as a function avoids
- * code duplication.
- */
-static u32 *
-gen8_emit_flush_coherentl3_wa(struct intel_engine_cs *engine, u32 *batch)
-{
-	*batch++ = MI_STORE_REGISTER_MEM_GEN8 | MI_SRM_LRM_GLOBAL_GTT;
-	*batch++ = i915_mmio_reg_offset(GEN8_L3SQCREG4);
-	*batch++ = i915_ggtt_offset(engine->scratch) + 256;
-	*batch++ = 0;
-
-	*batch++ = MI_LOAD_REGISTER_IMM(1);
-	*batch++ = i915_mmio_reg_offset(GEN8_L3SQCREG4);
-	*batch++ = 0x40400000 | GEN8_LQSC_FLUSH_COHERENT_LINES;
-
-	batch = gen8_emit_pipe_control(batch,
-				       PIPE_CONTROL_CS_STALL |
-				       PIPE_CONTROL_DC_FLUSH_ENABLE,
-				       0);
-
-	*batch++ = MI_LOAD_REGISTER_MEM_GEN8 | MI_SRM_LRM_GLOBAL_GTT;
-	*batch++ = i915_mmio_reg_offset(GEN8_L3SQCREG4);
-	*batch++ = i915_ggtt_offset(engine->scratch) + 256;
-	*batch++ = 0;
-
-	return batch;
-}
-
-/*
- * Typically we only have one indirect_ctx and per_ctx batch buffer which are
- * initialized at the beginning and shared across all contexts but this field
- * helps us to have multiple batches at different offsets and select them based
- * on a criteria. At the moment this batch always start at the beginning of the page
- * and at this point we don't have multiple wa_ctx batch buffers.
- *
- * The number of WA applied are not known at the beginning; we use this field
- * to return the no of DWORDS written.
- *
- * It is to be noted that this batch does not contain MI_BATCH_BUFFER_END
- * so it adds NOOPs as padding to make it cacheline aligned.
- * MI_BATCH_BUFFER_END will be added to perctx batch and both of them together
- * makes a complete batch buffer.
- */
-static u32 *gen8_init_indirectctx_bb(struct intel_engine_cs *engine, u32 *batch)
-{
-	/* WaDisableCtxRestoreArbitration:bdw,chv */
-	*batch++ = MI_ARB_ON_OFF | MI_ARB_DISABLE;
-
-	/* WaFlushCoherentL3CacheLinesAtContextSwitch:bdw */
-	if (IS_BROADWELL(engine->i915))
-		batch = gen8_emit_flush_coherentl3_wa(engine, batch);
-
-	/* WaClearSlmSpaceAtContextSwitch:bdw,chv */
-	/* Actual scratch location is at 128 bytes offset */
-	batch = gen8_emit_pipe_control(batch,
-				       PIPE_CONTROL_FLUSH_L3 |
-				       PIPE_CONTROL_GLOBAL_GTT_IVB |
-				       PIPE_CONTROL_CS_STALL |
-				       PIPE_CONTROL_QW_WRITE,
-				       i915_ggtt_offset(engine->scratch) +
-				       2 * CACHELINE_BYTES);
-
-	*batch++ = MI_ARB_ON_OFF | MI_ARB_ENABLE;
-
-	/* Pad to end of cacheline */
-	while ((unsigned long)batch % CACHELINE_BYTES)
-		*batch++ = MI_NOOP;
-
-	/*
-	 * MI_BATCH_BUFFER_END is not required in Indirect ctx BB because
-	 * execution depends on the length specified in terms of cache lines
-	 * in the register CTX_RCS_INDIRECT_CTX
-	 */
-
-	return batch;
-}
-
-static u32 *gen9_init_indirectctx_bb(struct intel_engine_cs *engine, u32 *batch)
-{
-	*batch++ = MI_ARB_ON_OFF | MI_ARB_DISABLE;
-
-	/* WaFlushCoherentL3CacheLinesAtContextSwitch:skl,bxt,glk */
-	batch = gen8_emit_flush_coherentl3_wa(engine, batch);
-
-	/* WaDisableGatherAtSetShaderCommonSlice:skl,bxt,kbl,glk */
-	*batch++ = MI_LOAD_REGISTER_IMM(1);
-	*batch++ = i915_mmio_reg_offset(COMMON_SLICE_CHICKEN2);
-	*batch++ = _MASKED_BIT_DISABLE(
-			GEN9_DISABLE_GATHER_AT_SET_SHADER_COMMON_SLICE);
-	*batch++ = MI_NOOP;
-
-	/* WaClearSlmSpaceAtContextSwitch:kbl */
-	/* Actual scratch location is at 128 bytes offset */
-	if (IS_KBL_REVID(engine->i915, 0, KBL_REVID_A0)) {
-		batch = gen8_emit_pipe_control(batch,
-					       PIPE_CONTROL_FLUSH_L3 |
-					       PIPE_CONTROL_GLOBAL_GTT_IVB |
-					       PIPE_CONTROL_CS_STALL |
-					       PIPE_CONTROL_QW_WRITE,
-					       i915_ggtt_offset(engine->scratch)
-					       + 2 * CACHELINE_BYTES);
-	}
-
-	/* WaMediaPoolStateCmdInWABB:bxt,glk */
-	if (HAS_POOLED_EU(engine->i915)) {
-		/*
-		 * EU pool configuration is setup along with golden context
-		 * during context initialization. This value depends on
-		 * device type (2x6 or 3x6) and needs to be updated based
-		 * on which subslice is disabled especially for 2x6
-		 * devices, however it is safe to load default
-		 * configuration of 3x6 device instead of masking off
-		 * corresponding bits because HW ignores bits of a disabled
-		 * subslice and drops down to appropriate config. Please
-		 * see render_state_setup() in i915_gem_render_state.c for
-		 * possible configurations, to avoid duplication they are
-		 * not shown here again.
-		 */
-		*batch++ = GEN9_MEDIA_POOL_STATE;
-		*batch++ = GEN9_MEDIA_POOL_ENABLE;
-		*batch++ = 0x00777000;
-		*batch++ = 0;
-		*batch++ = 0;
-		*batch++ = 0;
-	}
-
-	*batch++ = MI_ARB_ON_OFF | MI_ARB_ENABLE;
-
-	/* Pad to end of cacheline */
-	while ((unsigned long)batch % CACHELINE_BYTES)
-		*batch++ = MI_NOOP;
-
-	return batch;
-}
-
-#define CTX_WA_BB_OBJ_SIZE (PAGE_SIZE)
-
-static int lrc_setup_wa_ctx(struct intel_engine_cs *engine)
-{
-	struct drm_i915_gem_object *obj;
-	struct i915_vma *vma;
-	int err;
-
-	obj = i915_gem_object_create(engine->i915, CTX_WA_BB_OBJ_SIZE);
-	if (IS_ERR(obj))
-		return PTR_ERR(obj);
-
-	vma = i915_vma_instance(obj, &engine->i915->ggtt.base, NULL);
-	if (IS_ERR(vma)) {
-		err = PTR_ERR(vma);
-		goto err;
-	}
-
-	err = i915_vma_pin(vma, 0, PAGE_SIZE, PIN_GLOBAL | PIN_HIGH);
-	if (err)
-		goto err;
-
-	engine->wa_ctx.vma = vma;
-	return 0;
-
-err:
-	i915_gem_object_put(obj);
-	return err;
-}
-
-static void lrc_destroy_wa_ctx(struct intel_engine_cs *engine)
-{
-	i915_vma_unpin_and_release(&engine->wa_ctx.vma);
-}
-
-typedef u32 *(*wa_bb_func_t)(struct intel_engine_cs *engine, u32 *batch);
-
-static int intel_init_workaround_bb(struct intel_engine_cs *engine)
-{
-	struct i915_ctx_workarounds *wa_ctx = &engine->wa_ctx;
-	struct i915_wa_ctx_bb *wa_bb[2] = { &wa_ctx->indirect_ctx,
-					    &wa_ctx->per_ctx };
-	wa_bb_func_t wa_bb_fn[2];
-	struct page *page;
-	void *batch, *batch_ptr;
-	unsigned int i;
-	int ret;
-
-	if (WARN_ON(engine->id != RCS || !engine->scratch))
-		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] = NULL;
-		break;
-	case 8:
-		wa_bb_fn[0] = gen8_init_indirectctx_bb;
-		wa_bb_fn[1] = NULL;
-		break;
-	default:
-		MISSING_CASE(INTEL_GEN(engine->i915));
-		return 0;
-	}
-
-	ret = lrc_setup_wa_ctx(engine);
-	if (ret) {
-		DRM_DEBUG_DRIVER("Failed to setup context WA page: %d\n", ret);
-		return ret;
-	}
-
-	page = i915_gem_object_get_dirty_page(wa_ctx->vma->obj, 0);
-	batch = batch_ptr = kmap_atomic(page);
-
-	/*
-	 * Emit the two workaround batch buffers, recording the offset from the
-	 * start of the workaround batch buffer object for each and their
-	 * respective sizes.
-	 */
-	for (i = 0; i < ARRAY_SIZE(wa_bb_fn); i++) {
-		wa_bb[i]->offset = batch_ptr - batch;
-		if (WARN_ON(!IS_ALIGNED(wa_bb[i]->offset, CACHELINE_BYTES))) {
-			ret = -EINVAL;
-			break;
-		}
-		if (wa_bb_fn[i])
-			batch_ptr = wa_bb_fn[i](engine, batch_ptr);
-		wa_bb[i]->size = batch_ptr - (batch + wa_bb[i]->offset);
-	}
-
-	BUG_ON(batch_ptr - batch > CTX_WA_BB_OBJ_SIZE);
-
-	kunmap_atomic(batch);
-	if (ret)
-		lrc_destroy_wa_ctx(engine);
-
-	return ret;
-}
-
 static u8 gtiir[] = {
 	[RCS] = 0,
 	[BCS] = 0,
@@ -1870,7 +1621,7 @@ void intel_logical_ring_cleanup(struct intel_engine_cs *engine)
 
 	intel_engine_cleanup_common(engine);
 
-	lrc_destroy_wa_ctx(engine);
+	intel_bb_workarounds_fini(engine);
 	engine->i915 = NULL;
 	dev_priv->engine[engine->id] = NULL;
 	kfree(engine);
@@ -1990,7 +1741,7 @@ int logical_render_ring_init(struct intel_engine_cs *engine)
 	if (ret)
 		return ret;
 
-	ret = intel_init_workaround_bb(engine);
+	ret = intel_bb_workarounds_init(engine);
 	if (ret) {
 		/*
 		 * We continue even if we fail to initialize WA batch
drivers/gpu/drm/i915/intel_workarounds.c +254 -0

257 lines not on this page · raw message

drivers/gpu/drm/i915/intel_workarounds.h +3 -0
index 44d3941..2d7ea51 100644
@@ -35,4 +35,7 @@
 int intel_whitelist_workarounds_init(struct intel_engine_cs *engine);
 void intel_whitelist_workarounds_apply(struct intel_engine_cs *engine);
 
+int intel_bb_workarounds_init(struct intel_engine_cs *engine);
+void intel_bb_workarounds_fini(struct intel_engine_cs *engine);
+
 #endif
Signature · 6 lines
1.9.1

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

Re: [PATCH v3 10/22] drm/i915: Move WA BB stuff to the workarounds file as well

Quoting Oscar Mateo (2017-10-13 21:54:04)

Quoted 11 lines

Since we are trying to put all WA stuff together, do not forget about the BB WAs.

Cc Chris Wilson <[email protected]>
Cc Mika Kuoppala <[email protected]>

---

drivers/gpu/drm/i915/intel_workarounds.h +0 -0
index 44d3941..2d7ea51 100644

drivers/gpu/drm/i915/intel_workarounds.h line 39

Quoted 5 lines
drivers/gpu/drm/i915/intel_workarounds.h +2 -0
@@ -35,4 +35,7 @@
 int intel_whitelist_workarounds_init(struct intel_engine_cs *engine);
 void intel_whitelist_workarounds_apply(struct intel_engine_cs *engine);
 
+int intel_bb_workarounds_init(struct intel_engine_cs *engine);
+void intel_bb_workarounds_fini(struct intel_engine_cs *engine);

I looked at this and thought, intel_engine_init_bb_workarounds. Because they are engine specific and stored on the engine.

I'm not fussed, and I think the motion from lrc.c worth it. Especially if it means we get a consistent means of logging all the w/a we apply and can quickly search for ones we missed.

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

#18 lore raw

PATCH v3 11/22 drm/i915/cnl: Move GT and Display workarounds from init_clock_gating

In reply to Oscar Mateo

To their rightful place inside intel_workarounds.c

Cc Rodrigo Vivi <[email protected]>
Cc Chris Wilson <[email protected]>
Cc Mika Kuoppala <[email protected]>
Cc Ville Syrjälä <[email protected]>
---
 drivers/gpu/drm/i915/intel_pm.c          | 32 +-------------------------------
 drivers/gpu/drm/i915/intel_workarounds.c | 26 +++++++++++++++++++++++++-
 2 files changed, 26 insertions(+), 32 deletions(-)
drivers/gpu/drm/i915/intel_pm.c +1 -31
index e4b3904..3f92bed1 100644
@@ -8509,36 +8509,6 @@ static void cnp_init_clock_gating(struct drm_i915_private *dev_priv)
 		   CNP_PWM_CGE_GATING_DISABLE);
 }
 
-static void cnl_init_clock_gating(struct drm_i915_private *dev_priv)
-{
-	u32 val;
-	cnp_init_clock_gating(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);
-
-	/* 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);
-
-	/* Display WA #1133: WaFbcSkipSegments:cnl */
-	val = I915_READ(ILK_DPFC_CHICKEN);
-	val &= ~GLK_SKIP_SEG_COUNT_MASK;
-	val |= GLK_SKIP_SEG_EN | GLK_SKIP_SEG_COUNT(1);
-	I915_WRITE(ILK_DPFC_CHICKEN, val);
-}
-
 static void cfl_init_clock_gating(struct drm_i915_private *dev_priv)
 {
 	cnp_init_clock_gating(dev_priv);
@@ -9030,7 +9000,7 @@ 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_CANNONLAKE(dev_priv))
-		dev_priv->display.init_clock_gating = cnl_init_clock_gating;
+		dev_priv->display.init_clock_gating = nop_init_clock_gating;
 	else if (IS_COFFEELAKE(dev_priv))
 		dev_priv->display.init_clock_gating = cfl_init_clock_gating;
 	else if (IS_SKYLAKE(dev_priv))
drivers/gpu/drm/i915/intel_workarounds.c +25 -1
index aea9391..222f45c 100644
@@ -724,6 +724,10 @@ static int cfl_gt_workarounds_init(struct drm_i915_private *dev_priv)
 
 static int cnl_gt_workarounds_init(struct drm_i915_private *dev_priv)
 {
+	/* This is not an Wa. Enable for better image quality */
+	GT_WA_SET_BIT_MASKED(_3D_CHICKEN3,
+			     _3D_CHICKEN3_AA_LINE_QUALITY_FIX_ENABLE);
+
 	/* WaDisableI2mCycleOnWRPort:cnl (pre-prod) */
 	if (IS_CNL_REVID(dev_priv, CNL_REVID_B0, CNL_REVID_B0))
 		GT_WA_SET_BIT(GAMT_CHKN_BIT_REG,
@@ -856,6 +860,27 @@ static int cfl_display_workarounds_init(struct drm_i915_private *dev_priv)
 
 static int cnl_display_workarounds_init(struct drm_i915_private *dev_priv)
 {
+	if (HAS_PCH_CNP(dev_priv)) {
+		/* Wa #1181 */
+		DISPLAY_WA_SET_BIT(SOUTH_DSPCLK_GATE_D,
+				   CNP_PWM_CGE_GATING_DISABLE);
+	}
+
+	/* WaEnableChickenDCPR:cnl */
+	DISPLAY_WA_SET_BIT(GEN8_CHICKEN_DCPR_1, MASK_WAKEMEM);
+
+	/* WaFbcWakeMemOn:cnl */
+	DISPLAY_WA_SET_BIT(DISP_ARB_CTL, DISP_FBC_MEMORY_WAKE);
+
+	/* WaSarbUnitClockGatingDisable:cnl (pre-prod) */
+	if (IS_CNL_REVID(dev_priv, CNL_REVID_A0, CNL_REVID_B0))
+		DISPLAY_WA_SET_BIT(SLICE_UNIT_LEVEL_CLKGATE,
+				   SARBUNIT_CLKGATE_DIS);
+
+	/* Display WA #1133: WaFbcSkipSegments:cnl */
+	DISPLAY_WA_SET_FIELD(ILK_DPFC_CHICKEN, GLK_SKIP_SEG_COUNT_MASK,
+			     GLK_SKIP_SEG_EN | GLK_SKIP_SEG_COUNT(1));
+
 	return 0;
 }
 
@@ -863,7 +888,6 @@ static int display_workarounds_init(struct drm_i915_private *dev_priv)
 {
 	int err;
 
-	DISPLAY_WA_SET_BIT(_MMIO(0), 0); /* shut up gcc temporarily */
 	dev_priv->workarounds.display_wa_count = 0;
 
 	if (INTEL_GEN(dev_priv) < 8)
Signature · 6 lines
1.9.1

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

Re: [PATCH v3 11/22] drm/i915/cnl: Move GT and Display workarounds from init_clock_gating

Quoting Oscar Mateo (2017-10-13 21:54:05)

drivers/gpu/drm/i915/intel_workarounds.c static int cfl_gt_workarounds_init(struct drm_i915_private *dev_priv) · line 729

Quoted 13 lines

To their rightful place inside intel_workarounds.c

Cc Rodrigo Vivi <[email protected]>
Cc Chris Wilson <[email protected]>
Cc Mika Kuoppala <[email protected]>
Cc Ville Syrjälä <[email protected]>

---
static int cnl_gt_workarounds_init(struct drm_i915_private *dev_priv) {

drivers/gpu/drm/i915/intel_workarounds.c +3 -0
+       /* This is not an Wa. Enable for better image quality */
+       GT_WA_SET_BIT_MASKED(_3D_CHICKEN3,
+                            _3D_CHICKEN3_AA_LINE_QUALITY_FIX_ENABLE);

3D_CHICKEN and not part of the context? I presume you checked!

Quoted 21 lines
drivers/gpu/drm/i915/intel_workarounds.c +14 -0
+
        /* WaDisableI2mCycleOnWRPort:cnl (pre-prod) */
        if (IS_CNL_REVID(dev_priv, CNL_REVID_B0, CNL_REVID_B0))
                GT_WA_SET_BIT(GAMT_CHKN_BIT_REG,
@@ -856,6 +860,27 @@ static int cfl_display_workarounds_init(struct drm_i915_private *dev_priv)
 
 static int cnl_display_workarounds_init(struct drm_i915_private *dev_priv)
 {
+       if (HAS_PCH_CNP(dev_priv)) {
+               /* Wa #1181 */
+               DISPLAY_WA_SET_BIT(SOUTH_DSPCLK_GATE_D,
+                                  CNP_PWM_CGE_GATING_DISABLE);
+       }
+
+       /* WaEnableChickenDCPR:cnl */
+       DISPLAY_WA_SET_BIT(GEN8_CHICKEN_DCPR_1, MASK_WAKEMEM);
+
+       /* WaFbcWakeMemOn:cnl */
+       DISPLAY_WA_SET_BIT(DISP_ARB_CTL, DISP_FBC_MEMORY_WAKE);
+
+       /* WaSarbUnitClockGatingDisable:cnl (pre-prod) */

drivers/gpu/drm/i915/intel_workarounds.c static int cfl_display_workarounds_init(struct drm_i915_private *dev_priv) · line 885

Quoted 10 lines
drivers/gpu/drm/i915/intel_workarounds.c +8 -0
+       if (IS_CNL_REVID(dev_priv, CNL_REVID_A0, CNL_REVID_B0))
+               DISPLAY_WA_SET_BIT(SLICE_UNIT_LEVEL_CLKGATE,
+                                  SARBUNIT_CLKGATE_DIS);
+
+       /* Display WA #1133: WaFbcSkipSegments:cnl */
+       DISPLAY_WA_SET_FIELD(ILK_DPFC_CHICKEN, GLK_SKIP_SEG_COUNT_MASK,
+                            GLK_SKIP_SEG_EN | GLK_SKIP_SEG_COUNT(1));
+
        return 0;
 }

They all match up, so

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

#20 lore raw

Re: [PATCH v3 11/22] drm/i915/cnl: Move GT and Display workarounds from init_clock_gating

Quoted 14 lines · Chris Wilson

Quoting Oscar Mateo (2017-10-13 21:54:05)

drivers/gpu/drm/i915/intel_workarounds.c static int cfl_gt_workarounds_init(struct drm_i915_private *dev_priv) · line 729

Quoted 13 lines

To their rightful place inside intel_workarounds.c

Cc Rodrigo Vivi <[email protected]>
Cc Chris Wilson <[email protected]>
Cc Mika Kuoppala <[email protected]>
Cc Ville Syrjälä <[email protected]>

---
static int cnl_gt_workarounds_init(struct drm_i915_private *dev_priv) {

drivers/gpu/drm/i915/intel_workarounds.c +3 -0
+       /* This is not an Wa. Enable for better image quality */
+       GT_WA_SET_BIT_MASKED(_3D_CHICKEN3,
+                            _3D_CHICKEN3_AA_LINE_QUALITY_FIX_ENABLE);
Quoted 2 lines

3D_CHICKEN and not part of the context? I presume you checked!

I did, back when Rodrigo used it in Cannonlake. It seems to be an example of masked register that does not live in the context... :S

Quoted 32 lines
Quoted 21 lines
drivers/gpu/drm/i915/intel_workarounds.c +14 -0
+
         /* WaDisableI2mCycleOnWRPort:cnl (pre-prod) */
         if (IS_CNL_REVID(dev_priv, CNL_REVID_B0, CNL_REVID_B0))
                 GT_WA_SET_BIT(GAMT_CHKN_BIT_REG,
@@ -856,6 +860,27 @@ static int cfl_display_workarounds_init(struct drm_i915_private *dev_priv)
 
  static int cnl_display_workarounds_init(struct drm_i915_private *dev_priv)
  {
+       if (HAS_PCH_CNP(dev_priv)) {
+               /* Wa #1181 */
+               DISPLAY_WA_SET_BIT(SOUTH_DSPCLK_GATE_D,
+                                  CNP_PWM_CGE_GATING_DISABLE);
+       }
+
+       /* WaEnableChickenDCPR:cnl */
+       DISPLAY_WA_SET_BIT(GEN8_CHICKEN_DCPR_1, MASK_WAKEMEM);
+
+       /* WaFbcWakeMemOn:cnl */
+       DISPLAY_WA_SET_BIT(DISP_ARB_CTL, DISP_FBC_MEMORY_WAKE);
+
+       /* WaSarbUnitClockGatingDisable:cnl (pre-prod) */

drivers/gpu/drm/i915/intel_workarounds.c static int cfl_display_workarounds_init(struct drm_i915_private *dev_priv) · line 885

Quoted 10 lines
drivers/gpu/drm/i915/intel_workarounds.c +8 -0
+       if (IS_CNL_REVID(dev_priv, CNL_REVID_A0, CNL_REVID_B0))
+               DISPLAY_WA_SET_BIT(SLICE_UNIT_LEVEL_CLKGATE,
+                                  SARBUNIT_CLKGATE_DIS);
+
+       /* Display WA #1133: WaFbcSkipSegments:cnl */
+       DISPLAY_WA_SET_FIELD(ILK_DPFC_CHICKEN, GLK_SKIP_SEG_COUNT_MASK,
+                            GLK_SKIP_SEG_EN | GLK_SKIP_SEG_COUNT(1));
+
         return 0;
  }

They all match up, so

Quoted 2 lines

-Chris

Thanks for the reviewes!

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

#21 lore raw

Re: [PATCH v3 11/22] drm/i915/cnl: Move GT and Display workarounds from init_clock_gating

In reply to Oscar Mateo
Quoted 78 lines · Oscar Mateo

To their rightful place inside intel_workarounds.c

Cc Rodrigo Vivi <[email protected]>
Cc Chris Wilson <[email protected]>
Cc Mika Kuoppala <[email protected]>
Cc Ville Syrjälä <[email protected]>
---
 drivers/gpu/drm/i915/intel_pm.c          | 32 +-------------------------------
 drivers/gpu/drm/i915/intel_workarounds.c | 26 +++++++++++++++++++++++++-
 2 files changed, 26 insertions(+), 32 deletions(-)
drivers/gpu/drm/i915/intel_pm.c +1 -31
index e4b3904..3f92bed1 100644
@@ -8509,36 +8509,6 @@ static void cnp_init_clock_gating(struct drm_i915_private *dev_priv)
 		   CNP_PWM_CGE_GATING_DISABLE);
 }
 
-static void cnl_init_clock_gating(struct drm_i915_private *dev_priv)
-{
-	u32 val;
-	cnp_init_clock_gating(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);
-
-	/* 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);
-
-	/* Display WA #1133: WaFbcSkipSegments:cnl */
-	val = I915_READ(ILK_DPFC_CHICKEN);
-	val &= ~GLK_SKIP_SEG_COUNT_MASK;
-	val |= GLK_SKIP_SEG_EN | GLK_SKIP_SEG_COUNT(1);
-	I915_WRITE(ILK_DPFC_CHICKEN, val);
-}
-
 static void cfl_init_clock_gating(struct drm_i915_private *dev_priv)
 {
 	cnp_init_clock_gating(dev_priv);
@@ -9030,7 +9000,7 @@ 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_CANNONLAKE(dev_priv))
-		dev_priv->display.init_clock_gating = cnl_init_clock_gating;
+		dev_priv->display.init_clock_gating = nop_init_clock_gating;
 	else if (IS_COFFEELAKE(dev_priv))
 		dev_priv->display.init_clock_gating = cfl_init_clock_gating;
 	else if (IS_SKYLAKE(dev_priv))
drivers/gpu/drm/i915/intel_workarounds.c +4 -0
index aea9391..222f45c 100644
@@ -724,6 +724,10 @@ static int cfl_gt_workarounds_init(struct drm_i915_private *dev_priv)
 
 static int cnl_gt_workarounds_init(struct drm_i915_private *dev_priv)
 {
+	/* This is not an Wa. Enable for better image quality */
+	GT_WA_SET_BIT_MASKED(_3D_CHICKEN3,
+			     _3D_CHICKEN3_AA_LINE_QUALITY_FIX_ENABLE);
+
 	/* WaDisableI2mCycleOnWRPort:cnl (pre-prod) */
 	if (IS_CNL_REVID(dev_priv, CNL_REVID_B0, CNL_REVID_B0))
 		GT_WA_SET_BIT(GAMT_CHKN_BIT_REG,

drivers/gpu/drm/i915/intel_workarounds.c static int cfl_display_workarounds_init(struct drm_i915_private *dev_priv) · line 867

Quoted 8 lines
drivers/gpu/drm/i915/intel_workarounds.c +5 -0
@@ -856,6 +860,27 @@ static int cfl_display_workarounds_init(struct drm_i915_private *dev_priv)
 
 static int cnl_display_workarounds_init(struct drm_i915_private *dev_priv)
 {
+	if (HAS_PCH_CNP(dev_priv)) {
+		/* Wa #1181 */
+		DISPLAY_WA_SET_BIT(SOUTH_DSPCLK_GATE_D,
+				   CNP_PWM_CGE_GATING_DISABLE);
+	}

Where did this come from?

drivers/gpu/drm/i915/intel_workarounds.c static int cfl_display_workarounds_init(struct drm_i915_private *dev_priv) · line 878

Quoted 11 lines
drivers/gpu/drm/i915/intel_workarounds.c +11 -0
+
+	/* WaEnableChickenDCPR:cnl */
+	DISPLAY_WA_SET_BIT(GEN8_CHICKEN_DCPR_1, MASK_WAKEMEM);
+
+	/* WaFbcWakeMemOn:cnl */
+	DISPLAY_WA_SET_BIT(DISP_ARB_CTL, DISP_FBC_MEMORY_WAKE);
+
+	/* WaSarbUnitClockGatingDisable:cnl (pre-prod) */
+	if (IS_CNL_REVID(dev_priv, CNL_REVID_A0, CNL_REVID_B0))
+		DISPLAY_WA_SET_BIT(SLICE_UNIT_LEVEL_CLKGATE,
+				   SARBUNIT_CLKGATE_DIS);

That doesn't look like display to me.

Quoted 18 lines
drivers/gpu/drm/i915/intel_workarounds.c +5 -1
+
+	/* Display WA #1133: WaFbcSkipSegments:cnl */
+	DISPLAY_WA_SET_FIELD(ILK_DPFC_CHICKEN, GLK_SKIP_SEG_COUNT_MASK,
+			     GLK_SKIP_SEG_EN | GLK_SKIP_SEG_COUNT(1));
+
 	return 0;
 }
 
@@ -863,7 +888,6 @@ static int display_workarounds_init(struct drm_i915_private *dev_priv)
 {
 	int err;
 
-	DISPLAY_WA_SET_BIT(_MMIO(0), 0); /* shut up gcc temporarily */
 	dev_priv->workarounds.display_wa_count = 0;
 
 	if (INTEL_GEN(dev_priv) < 8)
Signature · 1 line
1.9.1
Signature · 6 lines
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#22 lore raw

Re: [PATCH v3 11/22] drm/i915/cnl: Move GT and Display workarounds from init_clock_gating

Quoted 80 lines · Ville Syrjälä
Quoted 79 lines · Oscar Mateo

To their rightful place inside intel_workarounds.c

Cc Rodrigo Vivi <[email protected]>
Cc Chris Wilson <[email protected]>
Cc Mika Kuoppala <[email protected]>
Cc Ville Syrjälä <[email protected]>
---
  drivers/gpu/drm/i915/intel_pm.c          | 32 +-------------------------------
  drivers/gpu/drm/i915/intel_workarounds.c | 26 +++++++++++++++++++++++++-
  2 files changed, 26 insertions(+), 32 deletions(-)
drivers/gpu/drm/i915/intel_pm.c +1 -31
index e4b3904..3f92bed1 100644
@@ -8509,36 +8509,6 @@ static void cnp_init_clock_gating(struct drm_i915_private *dev_priv)
  		   CNP_PWM_CGE_GATING_DISABLE);
  }
 
-static void cnl_init_clock_gating(struct drm_i915_private *dev_priv)
-{
-	u32 val;
-	cnp_init_clock_gating(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);
-
-	/* 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);
-
-	/* Display WA #1133: WaFbcSkipSegments:cnl */
-	val = I915_READ(ILK_DPFC_CHICKEN);
-	val &= ~GLK_SKIP_SEG_COUNT_MASK;
-	val |= GLK_SKIP_SEG_EN | GLK_SKIP_SEG_COUNT(1);
-	I915_WRITE(ILK_DPFC_CHICKEN, val);
-}
-
  static void cfl_init_clock_gating(struct drm_i915_private *dev_priv)
  {
  	cnp_init_clock_gating(dev_priv);
@@ -9030,7 +9000,7 @@ 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_CANNONLAKE(dev_priv))
-		dev_priv->display.init_clock_gating = cnl_init_clock_gating;
+		dev_priv->display.init_clock_gating = nop_init_clock_gating;
  	else if (IS_COFFEELAKE(dev_priv))
  		dev_priv->display.init_clock_gating = cfl_init_clock_gating;
  	else if (IS_SKYLAKE(dev_priv))
drivers/gpu/drm/i915/intel_workarounds.c +4 -0
index aea9391..222f45c 100644
@@ -724,6 +724,10 @@ static int cfl_gt_workarounds_init(struct drm_i915_private *dev_priv)
 
  static int cnl_gt_workarounds_init(struct drm_i915_private *dev_priv)
  {
+	/* This is not an Wa. Enable for better image quality */
+	GT_WA_SET_BIT_MASKED(_3D_CHICKEN3,
+			     _3D_CHICKEN3_AA_LINE_QUALITY_FIX_ENABLE);
+
  	/* WaDisableI2mCycleOnWRPort:cnl (pre-prod) */
  	if (IS_CNL_REVID(dev_priv, CNL_REVID_B0, CNL_REVID_B0))
  		GT_WA_SET_BIT(GAMT_CHKN_BIT_REG,
@@ -856,6 +860,27 @@ static int cfl_display_workarounds_init(struct drm_i915_private *dev_priv)
 
Quoted 8 lines

drivers/gpu/drm/i915/intel_workarounds.c static int cfl_display_workarounds_init(struct drm_i915_private *dev_priv) · line 867

Quoted 7 lines
drivers/gpu/drm/i915/intel_workarounds.c +5 -0
  static int cnl_display_workarounds_init(struct drm_i915_private *dev_priv)
  {
+	if (HAS_PCH_CNP(dev_priv)) {
+		/* Wa #1181 */
+		DISPLAY_WA_SET_BIT(SOUTH_DSPCLK_GATE_D,
+				   CNP_PWM_CGE_GATING_DISABLE);
+	}

Where did this come from?

From the call to cnp_init_clock_gating. I can carry the whole function over, if you prefer it that way?

Quoted 4 lines
Quoted 4 lines
drivers/gpu/drm/i915/intel_workarounds.c +4 -0
+
+	/* WaEnableChickenDCPR:cnl */
+	DISPLAY_WA_SET_BIT(GEN8_CHICKEN_DCPR_1, MASK_WAKEMEM);
+
Quoted 8 lines

drivers/gpu/drm/i915/intel_workarounds.c static int cfl_display_workarounds_init(struct drm_i915_private *dev_priv) · line 878

Quoted 7 lines
drivers/gpu/drm/i915/intel_workarounds.c +7 -0
+	/* WaFbcWakeMemOn:cnl */
+	DISPLAY_WA_SET_BIT(DISP_ARB_CTL, DISP_FBC_MEMORY_WAKE);
+
+	/* WaSarbUnitClockGatingDisable:cnl (pre-prod) */
+	if (IS_CNL_REVID(dev_priv, CNL_REVID_A0, CNL_REVID_B0))
+		DISPLAY_WA_SET_BIT(SLICE_UNIT_LEVEL_CLKGATE,
+				   SARBUNIT_CLKGATE_DIS);

That doesn't look like display to me.

you are right. I'll reclassify it (plus some others I have found that were incorrectly classified as display). Thanks!

Quoted 12 lines
Quoted 12 lines
drivers/gpu/drm/i915/intel_workarounds.c +5 -0
+
+	/* Display WA #1133: WaFbcSkipSegments:cnl */
+	DISPLAY_WA_SET_FIELD(ILK_DPFC_CHICKEN, GLK_SKIP_SEG_COUNT_MASK,
+			     GLK_SKIP_SEG_EN | GLK_SKIP_SEG_COUNT(1));
+
  	return 0;
  }
 
@@ -863,7 +888,6 @@ static int display_workarounds_init(struct drm_i915_private *dev_priv)
  {
  	int err;
 
Quoted 6 lines
Quoted 6 lines
drivers/gpu/drm/i915/intel_workarounds.c +0 -1
-	DISPLAY_WA_SET_BIT(_MMIO(0), 0); /* shut up gcc temporarily */
  	dev_priv->workarounds.display_wa_count = 0;
 
  	if (INTEL_GEN(dev_priv) < 8)
Signature · 1 line
1.9.1

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

#23 lore raw

PATCH v3 12/22 drm/i915/gen9: Move GT and Display workarounds from init_clock_gating

In reply to Oscar Mateo

To their rightful place inside intel_workarounds.c

Cc Rodrigo Vivi <[email protected]>
Cc Chris Wilson <[email protected]>
Cc Mika Kuoppala <[email protected]>
Cc Ville Syrjälä <[email protected]>
---
 drivers/gpu/drm/i915/intel_pm.c          | 51 ------------------------------
 drivers/gpu/drm/i915/intel_workarounds.c | 54 ++++++++++++++++++++++++++++++++
 2 files changed, 54 insertions(+), 51 deletions(-)
drivers/gpu/drm/i915/intel_pm.c +0 -51
index 3f92bed1..ef74251 100644
@@ -57,53 +57,8 @@
 #define INTEL_RC6p_ENABLE			(1<<1)
 #define INTEL_RC6pp_ENABLE			(1<<2)
 
-static void gen9_init_clock_gating(struct drm_i915_private *dev_priv)
-{
-	if (HAS_LLC(dev_priv)) {
-		/*
-		 * WaCompressedResourceDisplayNewHashMode:skl,kbl
-		 * Display WA#0390: skl,kbl
-		 *
-		 * Must match Sampler, Pixel Back End, and Media. See
-		 * WaCompressedResourceSamplerPbeMediaNewHashMode.
-		 */
-		I915_WRITE(CHICKEN_PAR1_1,
-			   I915_READ(CHICKEN_PAR1_1) |
-			   SKL_DE_COMPRESSED_HASH_MODE);
-	}
-
-	/* See Bspec note for PSR2_CTL bit 31, Wa#828:skl,bxt,kbl,cfl */
-	I915_WRITE(CHICKEN_PAR1_1,
-		   I915_READ(CHICKEN_PAR1_1) | SKL_EDP_PSR_FIX_RDWRAP);
-
-	I915_WRITE(GEN8_CONFIG0,
-		   I915_READ(GEN8_CONFIG0) | GEN9_DEFAULT_FIXES);
-
-	/* WaEnableChickenDCPR:skl,bxt,kbl,glk,cfl */
-	I915_WRITE(GEN8_CHICKEN_DCPR_1,
-		   I915_READ(GEN8_CHICKEN_DCPR_1) | MASK_WAKEMEM);
-
-	/* WaFbcTurnOffFbcWatermark:skl,bxt,kbl,cfl */
-	/* WaFbcWakeMemOn:skl,bxt,kbl,glk,cfl */
-	I915_WRITE(DISP_ARB_CTL, I915_READ(DISP_ARB_CTL) |
-		   DISP_FBC_WM_DIS |
-		   DISP_FBC_MEMORY_WAKE);
-
-	/* WaFbcHighMemBwCorruptionAvoidance:skl,bxt,kbl,cfl */
-	I915_WRITE(ILK_DPFC_CHICKEN, I915_READ(ILK_DPFC_CHICKEN) |
-		   ILK_DPFC_DISABLE_DUMMY0);
-
-	if (IS_SKYLAKE(dev_priv)) {
-		/* WaDisableDopClockGating */
-		I915_WRITE(GEN7_MISCCPCTL, I915_READ(GEN7_MISCCPCTL)
-			   & ~GEN7_DOP_CLOCK_GATE_ENABLE);
-	}
-}
-
 static void bxt_init_clock_gating(struct drm_i915_private *dev_priv)
 {
-	gen9_init_clock_gating(dev_priv);
-
 	/* WaDisableSDEUnitClockGating:bxt */
 	I915_WRITE(GEN8_UCGCTL6, I915_READ(GEN8_UCGCTL6) |
 		   GEN8_SDEUNIT_CLOCK_GATE_DISABLE);
@@ -126,7 +81,6 @@ static void bxt_init_clock_gating(struct drm_i915_private *dev_priv)
 static void glk_init_clock_gating(struct drm_i915_private *dev_priv)
 {
 	u32 val;
-	gen9_init_clock_gating(dev_priv);
 
 	/*
 	 * WaDisablePWMClockGating:glk
@@ -8512,7 +8466,6 @@ static void cnp_init_clock_gating(struct drm_i915_private *dev_priv)
 static void cfl_init_clock_gating(struct drm_i915_private *dev_priv)
 {
 	cnp_init_clock_gating(dev_priv);
-	gen9_init_clock_gating(dev_priv);
 
 	/* WaFbcNukeOnHostModify:cfl */
 	I915_WRITE(ILK_DPFC_CHICKEN, I915_READ(ILK_DPFC_CHICKEN) |
@@ -8521,8 +8474,6 @@ static void cfl_init_clock_gating(struct drm_i915_private *dev_priv)
 
 static void kbl_init_clock_gating(struct drm_i915_private *dev_priv)
 {
-	gen9_init_clock_gating(dev_priv);
-
 	/* WaDisableSDEUnitClockGating:kbl */
 	if (IS_KBL_REVID(dev_priv, 0, KBL_REVID_B0))
 		I915_WRITE(GEN8_UCGCTL6, I915_READ(GEN8_UCGCTL6) |
@@ -8540,8 +8491,6 @@ static void kbl_init_clock_gating(struct drm_i915_private *dev_priv)
 
 static void skl_init_clock_gating(struct drm_i915_private *dev_priv)
 {
-	gen9_init_clock_gating(dev_priv);
-
 	/* WAC6entrylatency:skl */
 	I915_WRITE(FBC_LLC_READ_CTRL, I915_READ(FBC_LLC_READ_CTRL) |
 		   FBC_LLC_FULLY_OPEN);
drivers/gpu/drm/i915/intel_workarounds.c +54 -0

88 lines not on this page · raw message

Signature · 6 lines
1.9.1

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

Re: [PATCH v3 12/22] drm/i915/gen9: Move GT and Display workarounds from init_clock_gating

Quoting Oscar Mateo (2017-10-13 21:54:06)

Quoted 7 lines

To their rightful place inside intel_workarounds.c

Cc Rodrigo Vivi <[email protected]>
Cc Chris Wilson <[email protected]>
Cc Mika Kuoppala <[email protected]>
Cc Ville Syrjälä <[email protected]>

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

#25 lore raw

PATCH v3 13/22 drm/i915/gen9: Remove Gen9 WAs with no effect

In reply to Oscar Mateo

GEN8_CONFIG0 (0xD00) is a protected by a lock (bit 31) which is set by the BIOS, so there is no way we can enable the three chicken bits mandated by the WA (the BIOS should be doing it instead).

v2: Rebased

Cc Chris Wilson <[email protected]>
Cc Mika Kuoppala <[email protected]>
---
 drivers/gpu/drm/i915/i915_reg.h          | 3 ---
 drivers/gpu/drm/i915/intel_workarounds.c | 2 --
 2 files changed, 5 deletions(-)
drivers/gpu/drm/i915/i915_reg.h +0 -3
index 5858f5f..02c66f3 100644
@@ -355,9 +355,6 @@ static inline bool i915_mmio_reg_valid(i915_reg_t reg)
 #define   ECOCHK_PPGTT_WT_HSW		(0x2<<3)
 #define   ECOCHK_PPGTT_WB_HSW		(0x3<<3)
 
-#define GEN8_CONFIG0			_MMIO(0xD00)
-#define  GEN9_DEFAULT_FIXES		(1 << 3 | 1 << 2 | 1 << 1)
-
 #define GAC_ECO_BITS			_MMIO(0x14090)
 #define   ECOBITS_SNB_BIT		(1<<13)
 #define   ECOBITS_PPGTT_CACHE64B	(3<<8)
drivers/gpu/drm/i915/intel_workarounds.c +0 -2
index 5c9b312..682ac13 100644
@@ -573,8 +573,6 @@ static int chv_gt_workarounds_init(struct drm_i915_private *dev_priv)
 
 static int gen9_gt_workarounds_init(struct drm_i915_private *dev_priv)
 {
-	GT_WA_SET_BIT(GEN8_CONFIG0, GEN9_DEFAULT_FIXES);
-
 	if (HAS_LLC(dev_priv)) {
 		/* WaCompressedResourceSamplerPbeMediaNewHashMode:skl,kbl
 		 *
Signature · 6 lines
1.9.1

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

PATCH v3 14/22 drm/i915/cfl: Move GT and Display workarounds from init_clock_gating

In reply to Oscar Mateo

To their rightful place inside intel_workarounds.c

Cc Rodrigo Vivi <[email protected]>
Cc Chris Wilson <[email protected]>
Cc Mika Kuoppala <[email protected]>
Cc Ville Syrjälä <[email protected]>
---
 drivers/gpu/drm/i915/intel_pm.c          | 23 +----------------------
 drivers/gpu/drm/i915/intel_workarounds.c |  9 +++++++++
 2 files changed, 10 insertions(+), 22 deletions(-)
drivers/gpu/drm/i915/intel_pm.c +1 -22
index ef74251..f1f2023 100644
@@ -8453,25 +8453,6 @@ static void gen8_set_l3sqc_credits(struct drm_i915_private *dev_priv,
 	I915_WRITE(GEN7_MISCCPCTL, misccpctl);
 }
 
-static void cnp_init_clock_gating(struct drm_i915_private *dev_priv)
-{
-	if (!HAS_PCH_CNP(dev_priv))
-		return;
-
-	/* Wa #1181 */
-	I915_WRITE(SOUTH_DSPCLK_GATE_D, I915_READ(SOUTH_DSPCLK_GATE_D) |
-		   CNP_PWM_CGE_GATING_DISABLE);
-}
-
-static void cfl_init_clock_gating(struct drm_i915_private *dev_priv)
-{
-	cnp_init_clock_gating(dev_priv);
-
-	/* WaFbcNukeOnHostModify:cfl */
-	I915_WRITE(ILK_DPFC_CHICKEN, I915_READ(ILK_DPFC_CHICKEN) |
-		   ILK_DPFC_NUKE_ON_ANY_MODIFICATION);
-}
-
 static void kbl_init_clock_gating(struct drm_i915_private *dev_priv)
 {
 	/* WaDisableSDEUnitClockGating:kbl */
@@ -8948,10 +8929,8 @@ 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_CANNONLAKE(dev_priv))
+	if (IS_CANNONLAKE(dev_priv) || IS_COFFEELAKE(dev_priv))
 		dev_priv->display.init_clock_gating = nop_init_clock_gating;
-	else if (IS_COFFEELAKE(dev_priv))
-		dev_priv->display.init_clock_gating = cfl_init_clock_gating;
 	else if (IS_SKYLAKE(dev_priv))
 		dev_priv->display.init_clock_gating = skl_init_clock_gating;
 	else if (IS_KABYLAKE(dev_priv))
drivers/gpu/drm/i915/intel_workarounds.c +9 -0
index 682ac13..63086ef 100644
@@ -907,6 +907,15 @@ static int cfl_display_workarounds_init(struct drm_i915_private *dev_priv)
 	if (ret)
 		return ret;
 
+	if (HAS_PCH_CNP(dev_priv)) {
+		/* Wa #1181 */
+		DISPLAY_WA_SET_BIT(SOUTH_DSPCLK_GATE_D,
+				   CNP_PWM_CGE_GATING_DISABLE);
+	}
+
+	/* WaFbcNukeOnHostModify:cfl */
+	DISPLAY_WA_SET_BIT(ILK_DPFC_CHICKEN, ILK_DPFC_NUKE_ON_ANY_MODIFICATION);
+
 	return 0;
 }
 
Signature · 6 lines
1.9.1

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

Re: [PATCH v3 14/22] drm/i915/cfl: Move GT and Display workarounds from init_clock_gating

Quoting Oscar Mateo (2017-10-13 21:54:08)

Quoted 7 lines

To their rightful place inside intel_workarounds.c

Cc Rodrigo Vivi <[email protected]>
Cc Chris Wilson <[email protected]>
Cc Mika Kuoppala <[email protected]>
Cc Ville Syrjälä <[email protected]>

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

#28 lore raw

PATCH v3 15/22 drm/i915/glk: Move GT and Display workarounds from init_clock_gating

In reply to Oscar Mateo

To their rightful place inside intel_workarounds.c

Cc Rodrigo Vivi <[email protected]>
Cc Chris Wilson <[email protected]>
Cc Mika Kuoppala <[email protected]>
Cc Ville Syrjälä <[email protected]>
---
 drivers/gpu/drm/i915/intel_pm.c          | 33 ++------------------------------
 drivers/gpu/drm/i915/intel_workarounds.c | 17 ++++++++++++++++
 2 files changed, 19 insertions(+), 31 deletions(-)
drivers/gpu/drm/i915/intel_pm.c +2 -31
index f1f2023..edbadb9 100644
@@ -78,34 +78,6 @@ static void bxt_init_clock_gating(struct drm_i915_private *dev_priv)
 		   PWM1_GATING_DIS | PWM2_GATING_DIS);
 }
 
-static void glk_init_clock_gating(struct drm_i915_private *dev_priv)
-{
-	u32 val;
-
-	/*
-	 * WaDisablePWMClockGating:glk
-	 * Backlight PWM may stop in the asserted state, causing backlight
-	 * to stay fully on.
-	 */
-	I915_WRITE(GEN9_CLKGATE_DIS_0, I915_READ(GEN9_CLKGATE_DIS_0) |
-		   PWM1_GATING_DIS | PWM2_GATING_DIS);
-
-	/* WaDDIIOTimeout:glk */
-	if (IS_GLK_REVID(dev_priv, 0, GLK_REVID_A1)) {
-		u32 val = I915_READ(CHICKEN_MISC_2);
-		val &= ~(GLK_CL0_PWR_DOWN |
-			 GLK_CL1_PWR_DOWN |
-			 GLK_CL2_PWR_DOWN);
-		I915_WRITE(CHICKEN_MISC_2, val);
-	}
-
-	/* Display WA #1133: WaFbcSkipSegments:glk */
-	val = I915_READ(ILK_DPFC_CHICKEN);
-	val &= ~GLK_SKIP_SEG_COUNT_MASK;
-	val |= GLK_SKIP_SEG_EN | GLK_SKIP_SEG_COUNT(1);
-	I915_WRITE(ILK_DPFC_CHICKEN, val);
-}
-
 static void i915_pineview_get_mem_freq(struct drm_i915_private *dev_priv)
 {
 	u32 tmp;
@@ -8929,7 +8901,8 @@ 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_CANNONLAKE(dev_priv) || IS_COFFEELAKE(dev_priv))
+	if (IS_CANNONLAKE(dev_priv) || IS_COFFEELAKE(dev_priv) ||
+	    IS_GEMINILAKE(dev_priv))
 		dev_priv->display.init_clock_gating = nop_init_clock_gating;
 	else if (IS_SKYLAKE(dev_priv))
 		dev_priv->display.init_clock_gating = skl_init_clock_gating;
@@ -8937,8 +8910,6 @@ void intel_init_clock_gating_hooks(struct drm_i915_private *dev_priv)
 		dev_priv->display.init_clock_gating = kbl_init_clock_gating;
 	else if (IS_BROXTON(dev_priv))
 		dev_priv->display.init_clock_gating = bxt_init_clock_gating;
-	else if (IS_GEMINILAKE(dev_priv))
-		dev_priv->display.init_clock_gating = glk_init_clock_gating;
 	else if (IS_BROADWELL(dev_priv))
 		dev_priv->display.init_clock_gating = bdw_init_clock_gating;
 	else if (IS_CHERRYVIEW(dev_priv))
drivers/gpu/drm/i915/intel_workarounds.c +17 -0
index 63086ef..b309df3 100644
@@ -898,6 +898,23 @@ static int glk_display_workarounds_init(struct drm_i915_private *dev_priv)
 	if (ret)
 		return ret;
 
+	/*
+	 * WaDisablePWMClockGating:glk
+	 * Backlight PWM may stop in the asserted state, causing backlight
+	 * to stay fully on.
+	 */
+	DISPLAY_WA_SET_BIT(GEN9_CLKGATE_DIS_0, PWM1_GATING_DIS | PWM2_GATING_DIS);
+
+	/* WaDDIIOTimeout:glk */
+	if (IS_GLK_REVID(dev_priv, 0, GLK_REVID_A1))
+		DISPLAY_WA_CLR_BIT(CHICKEN_MISC_2, GLK_CL0_PWR_DOWN |
+						   GLK_CL1_PWR_DOWN |
+						   GLK_CL2_PWR_DOWN);
+
+	/* Display WA #1133: WaFbcSkipSegments:glk */
+	DISPLAY_WA_SET_FIELD(ILK_DPFC_CHICKEN, GLK_SKIP_SEG_COUNT_MASK,
+			     GLK_SKIP_SEG_EN | GLK_SKIP_SEG_COUNT(1));
+
 	return 0;
 }
 
Signature · 6 lines
1.9.1

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

Re: [PATCH v3 15/22] drm/i915/glk: Move GT and Display workarounds from init_clock_gating

Quoting Oscar Mateo (2017-10-13 21:54:09)

Quoted 23 lines

To their rightful place inside intel_workarounds.c

Cc Rodrigo Vivi <[email protected]>
Cc Chris Wilson <[email protected]>
Cc Mika Kuoppala <[email protected]>
Cc Ville Syrjälä <[email protected]>

---

drivers/gpu/drm/i915/intel_workarounds.c +7 -0
index 63086ef..b309df3 100644
@@ -898,6 +898,23 @@ static int glk_display_workarounds_init(struct drm_i915_private *dev_priv)
        if (ret)
                return ret;
 
+       /*
+        * WaDisablePWMClockGating:glk
+        * Backlight PWM may stop in the asserted state, causing backlight
+        * to stay fully on.
+        */
+       DISPLAY_WA_SET_BIT(GEN9_CLKGATE_DIS_0, PWM1_GATING_DIS | PWM2_GATING_DIS);
+

drivers/gpu/drm/i915/intel_workarounds.c static int glk_display_workarounds_init(struct drm_i915_private *dev_priv) · line 917

Quoted 10 lines
drivers/gpu/drm/i915/intel_workarounds.c +10 -0
+       /* WaDDIIOTimeout:glk */
+       if (IS_GLK_REVID(dev_priv, 0, GLK_REVID_A1))
+               DISPLAY_WA_CLR_BIT(CHICKEN_MISC_2, GLK_CL0_PWR_DOWN |
+                                                  GLK_CL1_PWR_DOWN |
+                                                  GLK_CL2_PWR_DOWN);
+
+       /* Display WA #1133: WaFbcSkipSegments:glk */
+       DISPLAY_WA_SET_FIELD(ILK_DPFC_CHICKEN, GLK_SKIP_SEG_COUNT_MASK,
+                            GLK_SKIP_SEG_EN | GLK_SKIP_SEG_COUNT(1));
+

Random thought in passing, we are converging on REG_FIELD...

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

#30 lore raw

PATCH v3 16/22 drm/i915/kbl: Move GT and Display workarounds from init_clock_gating

In reply to Oscar Mateo

To their rightful place inside intel_workarounds.c

Cc Rodrigo Vivi <[email protected]>
Cc Chris Wilson <[email protected]>
Cc Mika Kuoppala <[email protected]>
Cc Ville Syrjälä <[email protected]>
---
 drivers/gpu/drm/i915/intel_pm.c          | 21 +--------------------
 drivers/gpu/drm/i915/intel_workarounds.c | 11 +++++++++++
 2 files changed, 12 insertions(+), 20 deletions(-)
drivers/gpu/drm/i915/intel_pm.c +1 -20
index edbadb9..6b621e5 100644
@@ -8425,23 +8425,6 @@ static void gen8_set_l3sqc_credits(struct drm_i915_private *dev_priv,
 	I915_WRITE(GEN7_MISCCPCTL, misccpctl);
 }
 
-static void kbl_init_clock_gating(struct drm_i915_private *dev_priv)
-{
-	/* WaDisableSDEUnitClockGating:kbl */
-	if (IS_KBL_REVID(dev_priv, 0, KBL_REVID_B0))
-		I915_WRITE(GEN8_UCGCTL6, I915_READ(GEN8_UCGCTL6) |
-			   GEN8_SDEUNIT_CLOCK_GATE_DISABLE);
-
-	/* WaDisableGamClockGating:kbl */
-	if (IS_KBL_REVID(dev_priv, 0, KBL_REVID_B0))
-		I915_WRITE(GEN6_UCGCTL1, I915_READ(GEN6_UCGCTL1) |
-			   GEN6_GAMUNIT_CLOCK_GATE_DISABLE);
-
-	/* WaFbcNukeOnHostModify:kbl */
-	I915_WRITE(ILK_DPFC_CHICKEN, I915_READ(ILK_DPFC_CHICKEN) |
-		   ILK_DPFC_NUKE_ON_ANY_MODIFICATION);
-}
-
 static void skl_init_clock_gating(struct drm_i915_private *dev_priv)
 {
 	/* WAC6entrylatency:skl */
@@ -8902,12 +8885,10 @@ 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_CANNONLAKE(dev_priv) || IS_COFFEELAKE(dev_priv) ||
-	    IS_GEMINILAKE(dev_priv))
+	    IS_GEMINILAKE(dev_priv) || IS_KABYLAKE(dev_priv))
 		dev_priv->display.init_clock_gating = nop_init_clock_gating;
 	else if (IS_SKYLAKE(dev_priv))
 		dev_priv->display.init_clock_gating = skl_init_clock_gating;
-	else if (IS_KABYLAKE(dev_priv))
-		dev_priv->display.init_clock_gating = kbl_init_clock_gating;
 	else if (IS_BROXTON(dev_priv))
 		dev_priv->display.init_clock_gating = bxt_init_clock_gating;
 	else if (IS_BROADWELL(dev_priv))
drivers/gpu/drm/i915/intel_workarounds.c +11 -0
index b309df3..d2a968a 100644
@@ -889,6 +889,17 @@ static int kbl_display_workarounds_init(struct drm_i915_private *dev_priv)
 	if (ret)
 		return ret;
 
+	/* WaDisableSDEUnitClockGating:kbl */
+	if (IS_KBL_REVID(dev_priv, 0, KBL_REVID_B0))
+		DISPLAY_WA_SET_BIT(GEN8_UCGCTL6, GEN8_SDEUNIT_CLOCK_GATE_DISABLE);
+
+	/* WaDisableGamClockGating:kbl */
+	if (IS_KBL_REVID(dev_priv, 0, KBL_REVID_B0))
+		DISPLAY_WA_SET_BIT(GEN6_UCGCTL1, GEN6_GAMUNIT_CLOCK_GATE_DISABLE);
+
+	/* WaFbcNukeOnHostModify:kbl */
+	DISPLAY_WA_SET_BIT(ILK_DPFC_CHICKEN, ILK_DPFC_NUKE_ON_ANY_MODIFICATION);
+
 	return 0;
 }
 
Signature · 6 lines
1.9.1

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

Re: [PATCH v3 16/22] drm/i915/kbl: Move GT and Display workarounds from init_clock_gating

Quoting Oscar Mateo (2017-10-13 21:54:10)

Quoted 46 lines

To their rightful place inside intel_workarounds.c

Cc Rodrigo Vivi <[email protected]>
Cc Chris Wilson <[email protected]>
Cc Mika Kuoppala <[email protected]>
Cc Ville Syrjälä <[email protected]>
---
 drivers/gpu/drm/i915/intel_pm.c          | 21 +--------------------
 drivers/gpu/drm/i915/intel_workarounds.c | 11 +++++++++++
 2 files changed, 12 insertions(+), 20 deletions(-)
drivers/gpu/drm/i915/intel_pm.c +0 -16
index edbadb9..6b621e5 100644
@@ -8425,23 +8425,6 @@ static void gen8_set_l3sqc_credits(struct drm_i915_private *dev_priv,
        I915_WRITE(GEN7_MISCCPCTL, misccpctl);
 }
 
-static void kbl_init_clock_gating(struct drm_i915_private *dev_priv)
-{
-       /* WaDisableSDEUnitClockGating:kbl */
-       if (IS_KBL_REVID(dev_priv, 0, KBL_REVID_B0))
-               I915_WRITE(GEN8_UCGCTL6, I915_READ(GEN8_UCGCTL6) |
-                          GEN8_SDEUNIT_CLOCK_GATE_DISABLE);
-
-       /* WaDisableGamClockGating:kbl */
-       if (IS_KBL_REVID(dev_priv, 0, KBL_REVID_B0))
-               I915_WRITE(GEN6_UCGCTL1, I915_READ(GEN6_UCGCTL1) |
-                          GEN6_GAMUNIT_CLOCK_GATE_DISABLE);
-
-       /* WaFbcNukeOnHostModify:kbl */
-       I915_WRITE(ILK_DPFC_CHICKEN, I915_READ(ILK_DPFC_CHICKEN) |
-                  ILK_DPFC_NUKE_ON_ANY_MODIFICATION);
-}
drivers/gpu/drm/i915/intel_workarounds.c +2 -0
index b309df3..d2a968a 100644
@@ -889,6 +889,17 @@ static int kbl_display_workarounds_init(struct drm_i915_private *dev_priv)
        if (ret)
                return ret;
 
+       /* WaDisableSDEUnitClockGating:kbl */
+       if (IS_KBL_REVID(dev_priv, 0, KBL_REVID_B0))

drivers/gpu/drm/i915/intel_workarounds.c static int kbl_display_workarounds_init(struct drm_i915_private *dev_priv) · line 903

Quoted 10 lines
drivers/gpu/drm/i915/intel_workarounds.c +9 -0
+               DISPLAY_WA_SET_BIT(GEN8_UCGCTL6, GEN8_SDEUNIT_CLOCK_GATE_DISABLE);
+
+       /* WaDisableGamClockGating:kbl */
+       if (IS_KBL_REVID(dev_priv, 0, KBL_REVID_B0))
+               DISPLAY_WA_SET_BIT(GEN6_UCGCTL1, GEN6_GAMUNIT_CLOCK_GATE_DISABLE);
+
+       /* WaFbcNukeOnHostModify:kbl */
+       DISPLAY_WA_SET_BIT(ILK_DPFC_CHICKEN, ILK_DPFC_NUKE_ON_ANY_MODIFICATION);
+
        return 0;

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

#32 lore raw

PATCH v3 17/22 drm/i915/bxt: Move GT and Display workarounds from init_clock_gating

In reply to Oscar Mateo

To their rightful place inside intel_workarounds.c

Cc Rodrigo Vivi <[email protected]>
Cc Chris Wilson <[email protected]>
Cc Mika Kuoppala <[email protected]>
Cc Ville Syrjälä <[email protected]>
---
 drivers/gpu/drm/i915/intel_pm.c          | 26 ++------------------------
 drivers/gpu/drm/i915/intel_workarounds.c | 15 +++++++++++++++
 2 files changed, 17 insertions(+), 24 deletions(-)
drivers/gpu/drm/i915/intel_pm.c +2 -24
index 6b621e5..85e3424 100644
@@ -57,27 +57,6 @@
 #define INTEL_RC6p_ENABLE			(1<<1)
 #define INTEL_RC6pp_ENABLE			(1<<2)
 
-static void bxt_init_clock_gating(struct drm_i915_private *dev_priv)
-{
-	/* WaDisableSDEUnitClockGating:bxt */
-	I915_WRITE(GEN8_UCGCTL6, I915_READ(GEN8_UCGCTL6) |
-		   GEN8_SDEUNIT_CLOCK_GATE_DISABLE);
-
-	/*
-	 * FIXME:
-	 * GEN8_HDCUNIT_CLOCK_GATE_DISABLE_HDCREQ applies on 3x6 GT SKUs only.
-	 */
-	I915_WRITE(GEN8_UCGCTL6, I915_READ(GEN8_UCGCTL6) |
-		   GEN8_HDCUNIT_CLOCK_GATE_DISABLE_HDCREQ);
-
-	/*
-	 * Wa: Backlight PWM may stop in the asserted state, causing backlight
-	 * to stay fully on.
-	 */
-	I915_WRITE(GEN9_CLKGATE_DIS_0, I915_READ(GEN9_CLKGATE_DIS_0) |
-		   PWM1_GATING_DIS | PWM2_GATING_DIS);
-}
-
 static void i915_pineview_get_mem_freq(struct drm_i915_private *dev_priv)
 {
 	u32 tmp;
@@ -8885,12 +8864,11 @@ 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_CANNONLAKE(dev_priv) || IS_COFFEELAKE(dev_priv) ||
-	    IS_GEMINILAKE(dev_priv) || IS_KABYLAKE(dev_priv))
+	    IS_GEMINILAKE(dev_priv) || IS_KABYLAKE(dev_priv) ||
+	    IS_BROXTON(dev_priv))
 		dev_priv->display.init_clock_gating = nop_init_clock_gating;
 	else if (IS_SKYLAKE(dev_priv))
 		dev_priv->display.init_clock_gating = skl_init_clock_gating;
-	else if (IS_BROXTON(dev_priv))
-		dev_priv->display.init_clock_gating = bxt_init_clock_gating;
 	else if (IS_BROADWELL(dev_priv))
 		dev_priv->display.init_clock_gating = bdw_init_clock_gating;
 	else if (IS_CHERRYVIEW(dev_priv))
drivers/gpu/drm/i915/intel_workarounds.c +15 -0
index d2a968a..0ef2f46 100644
@@ -880,6 +880,21 @@ static int bxt_display_workarounds_init(struct drm_i915_private *dev_priv)
 	if (ret)
 		return ret;
 
+	/* WaDisableSDEUnitClockGating:bxt */
+	DISPLAY_WA_SET_BIT(GEN8_UCGCTL6, GEN8_SDEUNIT_CLOCK_GATE_DISABLE);
+
+	/*
+	 * FIXME:
+	 * GEN8_HDCUNIT_CLOCK_GATE_DISABLE_HDCREQ applies on 3x6 GT SKUs only.
+	 */
+	DISPLAY_WA_SET_BIT(GEN8_UCGCTL6, GEN8_HDCUNIT_CLOCK_GATE_DISABLE_HDCREQ);
+
+	/*
+	 * Wa: Backlight PWM may stop in the asserted state, causing backlight
+	 * to stay fully on.
+	 */
+	DISPLAY_WA_SET_BIT(GEN9_CLKGATE_DIS_0, PWM1_GATING_DIS | PWM2_GATING_DIS);
+
 	return 0;
 }
 
Signature · 6 lines
1.9.1

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

Re: [PATCH v3 17/22] drm/i915/bxt: Move GT and Display workarounds from init_clock_gating

Quoting Oscar Mateo (2017-10-13 21:54:11)

Quoted 55 lines

To their rightful place inside intel_workarounds.c

Cc Rodrigo Vivi <[email protected]>
Cc Chris Wilson <[email protected]>
Cc Mika Kuoppala <[email protected]>
Cc Ville Syrjälä <[email protected]>
---
 drivers/gpu/drm/i915/intel_pm.c          | 26 ++------------------------
 drivers/gpu/drm/i915/intel_workarounds.c | 15 +++++++++++++++
 2 files changed, 17 insertions(+), 24 deletions(-)
drivers/gpu/drm/i915/intel_pm.c +0 -20
index 6b621e5..85e3424 100644
@@ -57,27 +57,6 @@
 #define INTEL_RC6p_ENABLE                      (1<<1)
 #define INTEL_RC6pp_ENABLE                     (1<<2)
 
-static void bxt_init_clock_gating(struct drm_i915_private *dev_priv)
-{
-       /* WaDisableSDEUnitClockGating:bxt */
-       I915_WRITE(GEN8_UCGCTL6, I915_READ(GEN8_UCGCTL6) |
-                  GEN8_SDEUNIT_CLOCK_GATE_DISABLE);
-
-       /*
-        * FIXME:
-        * GEN8_HDCUNIT_CLOCK_GATE_DISABLE_HDCREQ applies on 3x6 GT SKUs only.
-        */
-       I915_WRITE(GEN8_UCGCTL6, I915_READ(GEN8_UCGCTL6) |
-                  GEN8_HDCUNIT_CLOCK_GATE_DISABLE_HDCREQ);
-
-       /*
-        * Wa: Backlight PWM may stop in the asserted state, causing backlight
-        * to stay fully on.
-        */
-       I915_WRITE(GEN9_CLKGATE_DIS_0, I915_READ(GEN9_CLKGATE_DIS_0) |
-                  PWM1_GATING_DIS | PWM2_GATING_DIS);
-}
drivers/gpu/drm/i915/intel_workarounds.c +7 -0
index d2a968a..0ef2f46 100644
@@ -880,6 +880,21 @@ static int bxt_display_workarounds_init(struct drm_i915_private *dev_priv)
        if (ret)
                return ret;
 
+       /* WaDisableSDEUnitClockGating:bxt */
+       DISPLAY_WA_SET_BIT(GEN8_UCGCTL6, GEN8_SDEUNIT_CLOCK_GATE_DISABLE);
+
+       /*
+        * FIXME:
+        * GEN8_HDCUNIT_CLOCK_GATE_DISABLE_HDCREQ applies on 3x6 GT SKUs only.
+        */

drivers/gpu/drm/i915/intel_workarounds.c static int bxt_display_workarounds_init(struct drm_i915_private *dev_priv) · line 899

Quoted 10 lines
drivers/gpu/drm/i915/intel_workarounds.c +8 -0
+       DISPLAY_WA_SET_BIT(GEN8_UCGCTL6, GEN8_HDCUNIT_CLOCK_GATE_DISABLE_HDCREQ);
+
+       /*
+        * Wa: Backlight PWM may stop in the asserted state, causing backlight
+        * to stay fully on.
+        */
+       DISPLAY_WA_SET_BIT(GEN9_CLKGATE_DIS_0, PWM1_GATING_DIS | PWM2_GATING_DIS);
+
        return 0;
 }

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

#34 lore raw

PATCH v3 18/22 drm/i915/skl: Move GT and Display workarounds from init_clock_gating

In reply to Oscar Mateo

To their rightful place inside intel_workarounds.c

Cc Rodrigo Vivi <[email protected]>
Cc Chris Wilson <[email protected]>
Cc Mika Kuoppala <[email protected]>
Cc Ville Syrjälä <[email protected]>
---
 drivers/gpu/drm/i915/intel_pm.c          | 15 +--------------
 drivers/gpu/drm/i915/intel_workarounds.c |  6 ++++++
 2 files changed, 7 insertions(+), 14 deletions(-)
drivers/gpu/drm/i915/intel_pm.c +1 -14
index 85e3424..e1b00c9 100644
@@ -8404,17 +8404,6 @@ static void gen8_set_l3sqc_credits(struct drm_i915_private *dev_priv,
 	I915_WRITE(GEN7_MISCCPCTL, misccpctl);
 }
 
-static void skl_init_clock_gating(struct drm_i915_private *dev_priv)
-{
-	/* WAC6entrylatency:skl */
-	I915_WRITE(FBC_LLC_READ_CTRL, I915_READ(FBC_LLC_READ_CTRL) |
-		   FBC_LLC_FULLY_OPEN);
-
-	/* WaFbcNukeOnHostModify:skl */
-	I915_WRITE(ILK_DPFC_CHICKEN, I915_READ(ILK_DPFC_CHICKEN) |
-		   ILK_DPFC_NUKE_ON_ANY_MODIFICATION);
-}
-
 static void bdw_init_clock_gating(struct drm_i915_private *dev_priv)
 {
 	/* The GTT cache must be disabled if the system is using 2M pages. */
@@ -8865,10 +8854,8 @@ void intel_init_clock_gating_hooks(struct drm_i915_private *dev_priv)
 {
 	if (IS_CANNONLAKE(dev_priv) || IS_COFFEELAKE(dev_priv) ||
 	    IS_GEMINILAKE(dev_priv) || IS_KABYLAKE(dev_priv) ||
-	    IS_BROXTON(dev_priv))
+	    IS_BROXTON(dev_priv) || IS_SKYLAKE(dev_priv))
 		dev_priv->display.init_clock_gating = nop_init_clock_gating;
-	else if (IS_SKYLAKE(dev_priv))
-		dev_priv->display.init_clock_gating = skl_init_clock_gating;
 	else if (IS_BROADWELL(dev_priv))
 		dev_priv->display.init_clock_gating = bdw_init_clock_gating;
 	else if (IS_CHERRYVIEW(dev_priv))
drivers/gpu/drm/i915/intel_workarounds.c +6 -0
index 0ef2f46..f48c10e 100644
@@ -871,6 +871,12 @@ static int skl_display_workarounds_init(struct drm_i915_private *dev_priv)
 	/* WaDisableDopClockGating */
 	DISPLAY_WA_CLR_BIT(GEN7_MISCCPCTL, GEN7_DOP_CLOCK_GATE_ENABLE);
 
+	/* WAC6entrylatency:skl */
+	DISPLAY_WA_SET_BIT(FBC_LLC_READ_CTRL, FBC_LLC_FULLY_OPEN);
+
+	/* WaFbcNukeOnHostModify:skl */
+	DISPLAY_WA_SET_BIT(ILK_DPFC_CHICKEN, ILK_DPFC_NUKE_ON_ANY_MODIFICATION);
+
 	return 0;
 }
 
Signature · 6 lines
1.9.1

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

Re: [PATCH v3 18/22] drm/i915/skl: Move GT and Display workarounds from init_clock_gating

Quoting Oscar Mateo (2017-10-13 21:54:12)

Quoted 36 lines

To their rightful place inside intel_workarounds.c

Cc Rodrigo Vivi <[email protected]>
Cc Chris Wilson <[email protected]>
Cc Mika Kuoppala <[email protected]>
Cc Ville Syrjälä <[email protected]>
---
 drivers/gpu/drm/i915/intel_pm.c          | 15 +--------------
 drivers/gpu/drm/i915/intel_workarounds.c |  6 ++++++
 2 files changed, 7 insertions(+), 14 deletions(-)
drivers/gpu/drm/i915/intel_pm.c +0 -10
index 85e3424..e1b00c9 100644
@@ -8404,17 +8404,6 @@ static void gen8_set_l3sqc_credits(struct drm_i915_private *dev_priv,
        I915_WRITE(GEN7_MISCCPCTL, misccpctl);
 }
 
-static void skl_init_clock_gating(struct drm_i915_private *dev_priv)
-{
-       /* WAC6entrylatency:skl */
-       I915_WRITE(FBC_LLC_READ_CTRL, I915_READ(FBC_LLC_READ_CTRL) |
-                  FBC_LLC_FULLY_OPEN);
-
-       /* WaFbcNukeOnHostModify:skl */
-       I915_WRITE(ILK_DPFC_CHICKEN, I915_READ(ILK_DPFC_CHICKEN) |
-                  ILK_DPFC_NUKE_ON_ANY_MODIFICATION);
-}
drivers/gpu/drm/i915/intel_workarounds.c +0 -0
index 0ef2f46..f48c10e 100644
@@ -871,6 +871,12 @@ static int skl_display_workarounds_init(struct drm_i915_private *dev_priv)
        /* WaDisableDopClockGating */

drivers/gpu/drm/i915/intel_workarounds.c static int skl_display_workarounds_init(struct drm_i915_private *dev_priv) · line 881

Quoted 10 lines
drivers/gpu/drm/i915/intel_workarounds.c +6 -0
        DISPLAY_WA_CLR_BIT(GEN7_MISCCPCTL, GEN7_DOP_CLOCK_GATE_ENABLE);
 
+       /* WAC6entrylatency:skl */
+       DISPLAY_WA_SET_BIT(FBC_LLC_READ_CTRL, FBC_LLC_FULLY_OPEN);
+
+       /* WaFbcNukeOnHostModify:skl */
+       DISPLAY_WA_SET_BIT(ILK_DPFC_CHICKEN, ILK_DPFC_NUKE_ON_ANY_MODIFICATION);
+
        return 0;
 }

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

#36 lore raw

PATCH v3 19/22 drm/i915/chv: Move GT and Display workarounds from init_clock_gating

In reply to Oscar Mateo

To their rightful place inside intel_workarounds.c

TODO: Notice that we are leaving WaProgramL3SqcReg1Default (and the associated WaTempDisableDOPClkGating) behind because it requires extra careful reviewing. We'll deal with it in a separate patch.

Cc Rodrigo Vivi <[email protected]>
Cc Chris Wilson <[email protected]>
Cc Mika Kuoppala <[email protected]>
Cc Ville Syrjälä <[email protected]>
---
 drivers/gpu/drm/i915/intel_pm.c          | 24 ------------------------
 drivers/gpu/drm/i915/intel_workarounds.c | 21 +++++++++++++++++++++
 2 files changed, 21 insertions(+), 24 deletions(-)
drivers/gpu/drm/i915/intel_pm.c +0 -24
index e1b00c9..438a129 100644
@@ -8694,36 +8694,12 @@ static void vlv_init_clock_gating(struct drm_i915_private *dev_priv)
 
 static void chv_init_clock_gating(struct drm_i915_private *dev_priv)
 {
-	/* WaVSRefCountFullforceMissDisable:chv */
-	/* WaDSRefCountFullforceMissDisable:chv */
-	I915_WRITE(GEN7_FF_THREAD_MODE,
-		   I915_READ(GEN7_FF_THREAD_MODE) &
-		   ~(GEN8_FF_DS_REF_CNT_FFME | GEN7_FF_VS_REF_CNT_FFME));
-
-	/* WaDisableSemaphoreAndSyncFlipWait:chv */
-	I915_WRITE(GEN6_RC_SLEEP_PSMI_CONTROL,
-		   _MASKED_BIT_ENABLE(GEN8_RC_SEMA_IDLE_MSG_DISABLE));
-
-	/* WaDisableCSUnitClockGating:chv */
-	I915_WRITE(GEN6_UCGCTL1, I915_READ(GEN6_UCGCTL1) |
-		   GEN6_CSUNIT_CLOCK_GATE_DISABLE);
-
-	/* WaDisableSDEUnitClockGating:chv */
-	I915_WRITE(GEN8_UCGCTL6, I915_READ(GEN8_UCGCTL6) |
-		   GEN8_SDEUNIT_CLOCK_GATE_DISABLE);
-
 	/*
 	 * WaProgramL3SqcReg1Default:chv
 	 * See gfxspecs/Related Documents/Performance Guide/
 	 * LSQC Setting Recommendations.
 	 */
 	gen8_set_l3sqc_credits(dev_priv, 38, 2);
-
-	/*
-	 * GTT cache may not work with big pages, so if those
-	 * are ever enabled GTT cache may need to be disabled.
-	 */
-	I915_WRITE(HSW_GTT_CACHE_EN, GTT_CACHE_EN_ALL);
 }
 
 static void g4x_init_clock_gating(struct drm_i915_private *dev_priv)
drivers/gpu/drm/i915/intel_workarounds.c +21 -0
index f48c10e..26e7e07 100644
@@ -568,6 +568,21 @@ static int bdw_gt_workarounds_init(struct drm_i915_private *dev_priv)
 
 static int chv_gt_workarounds_init(struct drm_i915_private *dev_priv)
 {
+	/* WaVSRefCountFullforceMissDisable:chv */
+	/* WaDSRefCountFullforceMissDisable:chv */
+	GT_WA_CLR_BIT(GEN7_FF_THREAD_MODE, GEN8_FF_DS_REF_CNT_FFME |
+					   GEN7_FF_VS_REF_CNT_FFME);
+
+	/* WaDisableSemaphoreAndSyncFlipWait:chv */
+	GT_WA_SET_BIT_MASKED(GEN6_RC_SLEEP_PSMI_CONTROL,
+			     GEN8_RC_SEMA_IDLE_MSG_DISABLE);
+
+	/*
+	 * GTT cache may not work with big pages, so if those
+	 * are ever enabled GTT cache may need to be disabled.
+	 */
+	GT_WA_SET_FIELD(HSW_GTT_CACHE_EN, 0xFFFFFFFF, GTT_CACHE_EN_ALL);
+
 	return 0;
 }
 
@@ -830,6 +845,12 @@ static int bdw_display_workarounds_init(struct drm_i915_private *dev_priv)
 
 static int chv_display_workarounds_init(struct drm_i915_private *dev_priv)
 {
+	/* WaDisableCSUnitClockGating:chv */
+	DISPLAY_WA_SET_BIT(GEN6_UCGCTL1, GEN6_CSUNIT_CLOCK_GATE_DISABLE);
+
+	/* WaDisableSDEUnitClockGating:chv */
+	DISPLAY_WA_SET_BIT(GEN8_UCGCTL6, GEN8_SDEUNIT_CLOCK_GATE_DISABLE);
+
 	return 0;
 }
 
Signature · 6 lines
1.9.1

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

Re: [PATCH v3 19/22] drm/i915/chv: Move GT and Display workarounds from init_clock_gating

Quoting Oscar Mateo (2017-10-13 21:54:13)

Quoted 63 lines

To their rightful place inside intel_workarounds.c

TODO: Notice that we are leaving WaProgramL3SqcReg1Default (and the associated WaTempDisableDOPClkGating) behind because it requires extra careful reviewing. We'll deal with it in a separate patch.

Cc Rodrigo Vivi <[email protected]>
Cc Chris Wilson <[email protected]>
Cc Mika Kuoppala <[email protected]>
Cc Ville Syrjälä <[email protected]>
---
 drivers/gpu/drm/i915/intel_pm.c          | 24 ------------------------
 drivers/gpu/drm/i915/intel_workarounds.c | 21 +++++++++++++++++++++
 2 files changed, 21 insertions(+), 24 deletions(-)
drivers/gpu/drm/i915/intel_pm.c +0 -24
index e1b00c9..438a129 100644
@@ -8694,36 +8694,12 @@ static void vlv_init_clock_gating(struct drm_i915_private *dev_priv)
 
 static void chv_init_clock_gating(struct drm_i915_private *dev_priv)
 {
-       /* WaVSRefCountFullforceMissDisable:chv */
-       /* WaDSRefCountFullforceMissDisable:chv */
-       I915_WRITE(GEN7_FF_THREAD_MODE,
-                  I915_READ(GEN7_FF_THREAD_MODE) &
-                  ~(GEN8_FF_DS_REF_CNT_FFME | GEN7_FF_VS_REF_CNT_FFME));
-
-       /* WaDisableSemaphoreAndSyncFlipWait:chv */
-       I915_WRITE(GEN6_RC_SLEEP_PSMI_CONTROL,
-                  _MASKED_BIT_ENABLE(GEN8_RC_SEMA_IDLE_MSG_DISABLE));
-
-       /* WaDisableCSUnitClockGating:chv */
-       I915_WRITE(GEN6_UCGCTL1, I915_READ(GEN6_UCGCTL1) |
-                  GEN6_CSUNIT_CLOCK_GATE_DISABLE);
-
-       /* WaDisableSDEUnitClockGating:chv */
-       I915_WRITE(GEN8_UCGCTL6, I915_READ(GEN8_UCGCTL6) |
-                  GEN8_SDEUNIT_CLOCK_GATE_DISABLE);
-
        /*
         * WaProgramL3SqcReg1Default:chv
         * See gfxspecs/Related Documents/Performance Guide/
         * LSQC Setting Recommendations.
         */
        gen8_set_l3sqc_credits(dev_priv, 38, 2);
-
-       /*
-        * GTT cache may not work with big pages, so if those
-        * are ever enabled GTT cache may need to be disabled.
-        */
-       I915_WRITE(HSW_GTT_CACHE_EN, GTT_CACHE_EN_ALL);
 }
 
 static void g4x_init_clock_gating(struct drm_i915_private *dev_priv)
drivers/gpu/drm/i915/intel_workarounds.c +0 -0
index f48c10e..26e7e07 100644
@@ -568,6 +568,21 @@ static int bdw_gt_workarounds_init(struct drm_i915_private *dev_priv)
 

drivers/gpu/drm/i915/intel_workarounds.c static int bdw_gt_workarounds_init(struct drm_i915_private *dev_priv) · line 578

Quoted 10 lines
drivers/gpu/drm/i915/intel_workarounds.c +8 -0
 static int chv_gt_workarounds_init(struct drm_i915_private *dev_priv)
 {
+       /* WaVSRefCountFullforceMissDisable:chv */
+       /* WaDSRefCountFullforceMissDisable:chv */
+       GT_WA_CLR_BIT(GEN7_FF_THREAD_MODE, GEN8_FF_DS_REF_CNT_FFME |
+                                          GEN7_FF_VS_REF_CNT_FFME);
+
+       /* WaDisableSemaphoreAndSyncFlipWait:chv */
+       GT_WA_SET_BIT_MASKED(GEN6_RC_SLEEP_PSMI_CONTROL,
+                            GEN8_RC_SEMA_IDLE_MSG_DISABLE);

Hmm, stares at w/a. So this just stops the device from sleeping when we wait on a semaphore. Ok, doesn't seem like an immediate concern for proposed semaphore usage.

drivers/gpu/drm/i915/intel_workarounds.c static int bdw_gt_workarounds_init(struct drm_i915_private *dev_priv) · line 584

Quoted 5 lines
drivers/gpu/drm/i915/intel_workarounds.c +5 -0
+       /*
+        * GTT cache may not work with big pages, so if those
+        * are ever enabled GTT cache may need to be disabled.
+        */
+       GT_WA_SET_FIELD(HSW_GTT_CACHE_EN, 0xFFFFFFFF, GTT_CACHE_EN_ALL);

Ok.

Quoted 6 lines
drivers/gpu/drm/i915/intel_workarounds.c +1 -0
+
        return 0;
 }
 
@@ -830,6 +845,12 @@ static int bdw_display_workarounds_init(struct drm_i915_private *dev_priv)
 

drivers/gpu/drm/i915/intel_workarounds.c static int bdw_display_workarounds_init(struct drm_i915_private *dev_priv) · line 855

Quoted 10 lines
drivers/gpu/drm/i915/intel_workarounds.c +6 -0
 static int chv_display_workarounds_init(struct drm_i915_private *dev_priv)
 {
+       /* WaDisableCSUnitClockGating:chv */
+       DISPLAY_WA_SET_BIT(GEN6_UCGCTL1, GEN6_CSUNIT_CLOCK_GATE_DISABLE);
+
+       /* WaDisableSDEUnitClockGating:chv */
+       DISPLAY_WA_SET_BIT(GEN8_UCGCTL6, GEN8_SDEUNIT_CLOCK_GATE_DISABLE);
+
        return 0;
 }

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

#38 lore raw

PATCH v3 20/22 drm/i915/bdw: Move GT and Display workarounds from init_clock_gating

In reply to Oscar Mateo

To their rightful place inside intel_workarounds.c

TODO: Notice that we are leaving WaProgramL3SqcReg1Default (and the associated WaTempDisableDOPClkGating) behind because it requires extra careful reviewing. We'll deal with it in a separate patch.

TODO2: Decide what to do with lpt_init_clock_gating (shouldn't WADPOClockGatingDisable be marked as "bdw"? shouldn't it be protected by HAS_PCH_LPT_LP? do we want to move the whole thing to the workarounds file or not?).

Cc Rodrigo Vivi <[email protected]>
Cc Chris Wilson <[email protected]>
Cc Mika Kuoppala <[email protected]>
Cc Ville Syrjälä <[email protected]>
Cc Paulo Zanoni <[email protected]>
---
 drivers/gpu/drm/i915/intel_pm.c          | 47 --------------------------------
 drivers/gpu/drm/i915/intel_workarounds.c | 43 +++++++++++++++++++++++++++++
 2 files changed, 43 insertions(+), 47 deletions(-)
drivers/gpu/drm/i915/intel_pm.c +0 -47
index 438a129..296fe83 100644
@@ -8406,59 +8406,12 @@ static void gen8_set_l3sqc_credits(struct drm_i915_private *dev_priv,
 
 static void bdw_init_clock_gating(struct drm_i915_private *dev_priv)
 {
-	/* The GTT cache must be disabled if the system is using 2M pages. */
-	bool can_use_gtt_cache = !HAS_PAGE_SIZES(dev_priv,
-						 I915_GTT_PAGE_SIZE_2M);
-	enum pipe pipe;
-
 	ilk_init_lp_watermarks(dev_priv);
 
-	/* WaSwitchSolVfFArbitrationPriority:bdw */
-	I915_WRITE(GAM_ECOCHK, I915_READ(GAM_ECOCHK) | HSW_ECOCHK_ARB_PRIO_SOL);
-
-	/* WaPsrDPAMaskVBlankInSRD:bdw */
-	I915_WRITE(CHICKEN_PAR1_1,
-		   I915_READ(CHICKEN_PAR1_1) | DPA_MASK_VBLANK_SRD);
-
-	/* WaPsrDPRSUnmaskVBlankInSRD:bdw */
-	for_each_pipe(dev_priv, pipe) {
-		I915_WRITE(CHICKEN_PIPESL_1(pipe),
-			   I915_READ(CHICKEN_PIPESL_1(pipe)) |
-			   BDW_DPRS_MASK_VBLANK_SRD);
-	}
-
-	/* WaVSRefCountFullforceMissDisable:bdw */
-	/* WaDSRefCountFullforceMissDisable:bdw */
-	I915_WRITE(GEN7_FF_THREAD_MODE,
-		   I915_READ(GEN7_FF_THREAD_MODE) &
-		   ~(GEN8_FF_DS_REF_CNT_FFME | GEN7_FF_VS_REF_CNT_FFME));
-
-	I915_WRITE(GEN6_RC_SLEEP_PSMI_CONTROL,
-		   _MASKED_BIT_ENABLE(GEN8_RC_SEMA_IDLE_MSG_DISABLE));
-
-	/* WaDisableSDEUnitClockGating:bdw */
-	I915_WRITE(GEN8_UCGCTL6, I915_READ(GEN8_UCGCTL6) |
-		   GEN8_SDEUNIT_CLOCK_GATE_DISABLE);
-
 	/* WaProgramL3SqcReg1Default:bdw */
 	gen8_set_l3sqc_credits(dev_priv, 30, 2);
 
-	/* WaGttCachingOffByDefault:bdw */
-	I915_WRITE(HSW_GTT_CACHE_EN, can_use_gtt_cache ? GTT_CACHE_EN_ALL : 0);
-
-	/* WaKVMNotificationOnConfigChange:bdw */
-	I915_WRITE(CHICKEN_PAR2_1, I915_READ(CHICKEN_PAR2_1)
-		   | KVM_CONFIG_CHANGE_NOTIFICATION_SELECT);
-
 	lpt_init_clock_gating(dev_priv);
-
-	/* WaDisableDopClockGating:bdw
-	 *
-	 * Also see the CHICKEN2 write in bdw_init_workarounds() to disable DOP
-	 * clock gating.
-	 */
-	I915_WRITE(GEN6_UCGCTL1,
-		   I915_READ(GEN6_UCGCTL1) | GEN6_EU_TCUNIT_CLOCK_GATE_DISABLE);
 }
 
 static void hsw_init_clock_gating(struct drm_i915_private *dev_priv)
drivers/gpu/drm/i915/intel_workarounds.c +43 -0

55 lines not on this page · raw message

Signature · 6 lines
1.9.1

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

Re: [PATCH v3 20/22] drm/i915/bdw: Move GT and Display workarounds from init_clock_gating

Quoting Oscar Mateo (2017-10-13 21:54:14)

drivers/gpu/drm/i915/intel_workarounds.c static int display_wa_add(struct drm_i915_private *dev_priv, · line 870

Quoted 13 lines
drivers/gpu/drm/i915/intel_workarounds.c +9 -0
@@ -840,6 +859,30 @@ static int display_wa_add(struct drm_i915_private *dev_priv,
 
 static int bdw_display_workarounds_init(struct drm_i915_private *dev_priv)
 {
+       enum pipe pipe;
+
+       /* WaPsrDPAMaskVBlankInSRD:bdw */
+       DISPLAY_WA_SET_BIT(CHICKEN_PAR1_1, DPA_MASK_VBLANK_SRD);
+
+       /* WaPsrDPRSUnmaskVBlankInSRD:bdw */
+       for_each_pipe(dev_priv, pipe) {
+               DISPLAY_WA_SET_BIT(CHICKEN_PIPESL_1(pipe),
+                                  BDW_DPRS_MASK_VBLANK_SRD);

Do we have pipes this early?

Eeek, I wonder if I missed any other questions like that... -Chris
_______________________________________________
Intel-gfx mailing list [email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#40 lore raw

Re: [PATCH v3 20/22] drm/i915/bdw: Move GT and Display workarounds from init_clock_gating

Quoted 16 lines · Chris Wilson

Quoting Oscar Mateo (2017-10-13 21:54:14)

drivers/gpu/drm/i915/intel_workarounds.c static int display_wa_add(struct drm_i915_private *dev_priv, · line 870

Quoted 13 lines
drivers/gpu/drm/i915/intel_workarounds.c +9 -0
@@ -840,6 +859,30 @@ static int display_wa_add(struct drm_i915_private *dev_priv,
 
  static int bdw_display_workarounds_init(struct drm_i915_private *dev_priv)
  {
+       enum pipe pipe;
+
+       /* WaPsrDPAMaskVBlankInSRD:bdw */
+       DISPLAY_WA_SET_BIT(CHICKEN_PAR1_1, DPA_MASK_VBLANK_SRD);
+
+       /* WaPsrDPRSUnmaskVBlankInSRD:bdw */
+       for_each_pipe(dev_priv, pipe) {
+               DISPLAY_WA_SET_BIT(CHICKEN_PIPESL_1(pipe),
+                                  BDW_DPRS_MASK_VBLANK_SRD);

Do we have pipes this early?

Quoted 2 lines

Eeek, I wonder if I missed any other questions like that... -Chris

We only need the total number of pipes here, but I can split the early_init for GT and Display WAs in two, if we think we'll need to create the list from different places...
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#41 lore raw

PATCH v3 21/22 drm/i915: Move WaProgramL3SqcReg1Default to the workarounds file

In reply to Oscar Mateo

This means moving WaTempDisableDOPClkGating as well.

Notice that BXT implements a similar WA to WaProgramL3SqcReg1Default but, according to the BSpec, it does not require WaTempDisableDOPClkGating.

Cc Rodrigo Vivi <[email protected]>
Cc Chris Wilson <[email protected]>
Cc Mika Kuoppala <[email protected]>
Cc Ville Syrjälä <[email protected]>
Cc Imre Deak <[email protected]>
---
 drivers/gpu/drm/i915/intel_pm.c          | 46 +++-----------------------------
 drivers/gpu/drm/i915/intel_workarounds.c | 44 ++++++++++++++++++++++++++++--
 2 files changed, 45 insertions(+), 45 deletions(-)
drivers/gpu/drm/i915/intel_pm.c +3 -43
index 296fe83..74cc2ffe 100644
@@ -8378,39 +8378,10 @@ static void lpt_suspend_hw(struct drm_i915_private *dev_priv)
 	}
 }
 
-static void gen8_set_l3sqc_credits(struct drm_i915_private *dev_priv,
-				   int general_prio_credits,
-				   int high_prio_credits)
-{
-	u32 val;
-	u32 misccpctl;
-
-	/* WaTempDisableDOPClkGating:bdw */
-	misccpctl = I915_READ(GEN7_MISCCPCTL);
-	I915_WRITE(GEN7_MISCCPCTL, misccpctl & ~GEN7_DOP_CLOCK_GATE_ENABLE);
-
-	val = I915_READ(GEN8_L3SQCREG1);
-	val &= ~L3_PRIO_CREDITS_MASK;
-	val |= L3_GENERAL_PRIO_CREDITS(general_prio_credits);
-	val |= L3_HIGH_PRIO_CREDITS(high_prio_credits);
-	I915_WRITE(GEN8_L3SQCREG1, val);
-
-	/*
-	 * Wait at least 100 clocks before re-enabling clock gating.
-	 * See the definition of L3SQCREG1 in BSpec.
-	 */
-	POSTING_READ(GEN8_L3SQCREG1);
-	udelay(1);
-	I915_WRITE(GEN7_MISCCPCTL, misccpctl);
-}
-
 static void bdw_init_clock_gating(struct drm_i915_private *dev_priv)
 {
 	ilk_init_lp_watermarks(dev_priv);
 
-	/* WaProgramL3SqcReg1Default:bdw */
-	gen8_set_l3sqc_credits(dev_priv, 30, 2);
-
 	lpt_init_clock_gating(dev_priv);
 }
 
@@ -8645,16 +8616,6 @@ static void vlv_init_clock_gating(struct drm_i915_private *dev_priv)
 	I915_WRITE(VLV_GUNIT_CLOCK_GATE, GCFG_DIS);
 }
 
-static void chv_init_clock_gating(struct drm_i915_private *dev_priv)
-{
-	/*
-	 * WaProgramL3SqcReg1Default:chv
-	 * See gfxspecs/Related Documents/Performance Guide/
-	 * LSQC Setting Recommendations.
-	 */
-	gen8_set_l3sqc_credits(dev_priv, 38, 2);
-}
-
 static void g4x_init_clock_gating(struct drm_i915_private *dev_priv)
 {
 	uint32_t dspclk_gate;
@@ -8782,13 +8743,12 @@ 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_CANNONLAKE(dev_priv) || IS_COFFEELAKE(dev_priv) ||
-	    IS_GEMINILAKE(dev_priv) || IS_KABYLAKE(dev_priv) ||
-	    IS_BROXTON(dev_priv) || IS_SKYLAKE(dev_priv))
+	    IS_GEMINILAKE(dev_priv) || IS_KABYLAKE(dev_priv)   ||
+	    IS_BROXTON(dev_priv)    || IS_SKYLAKE(dev_priv)    ||
+	    IS_CHERRYVIEW(dev_priv))
 		dev_priv->display.init_clock_gating = nop_init_clock_gating;
 	else if (IS_BROADWELL(dev_priv))
 		dev_priv->display.init_clock_gating = bdw_init_clock_gating;
-	else if (IS_CHERRYVIEW(dev_priv))
-		dev_priv->display.init_clock_gating = chv_init_clock_gating;
 	else if (IS_HASWELL(dev_priv))
 		dev_priv->display.init_clock_gating = hsw_init_clock_gating;
 	else if (IS_IVYBRIDGE(dev_priv))
drivers/gpu/drm/i915/intel_workarounds.c +42 -2

72 lines not on this page · raw message

Signature · 6 lines
1.9.1

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

Re: [PATCH v3 21/22] drm/i915: Move WaProgramL3SqcReg1Default to the workarounds file

Quoting Oscar Mateo (2017-10-13 21:54:15)

Quoted 11 lines
drivers/gpu/drm/i915/intel_workarounds.c +2 -0
index ca9d906..136f6fb 100644
@@ -517,11 +517,33 @@ static void mmio_workarounds_apply(struct drm_i915_private *dev_priv,
                                   struct i915_wa_reg *wa,
                                   u32 count)
 {
+       u32 misccpctl;
+       u32 value;
        int i;

drivers/gpu/drm/i915/intel_workarounds.c static void mmio_workarounds_apply(struct drm_i915_private *dev_priv, · line 531

Quoted 10 lines
drivers/gpu/drm/i915/intel_workarounds.c +7 -1
 
        for (i = 0; i < count; i++) {
-               u32 value = I915_READ(wa[i].addr);
+               /* WaTempDisableDOPClkGating */
+               if ((IS_BROADWELL(dev_priv) || IS_CHERRYVIEW(dev_priv)) &&
+                   i915_mmio_reg_equal(wa[i].addr, GEN8_L3SQCREG1)) {
+                       misccpctl = I915_READ(GEN7_MISCCPCTL);
+                       I915_WRITE(GEN7_MISCCPCTL,
+                                  misccpctl & ~GEN7_DOP_CLOCK_GATE_ENABLE);
+               }

Pre-, post- callbacks? Or a single multiplex?

Otherwise looks quite the hack that will be a nightmare to extend. -Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#43 lore raw

PATCH v3 22/22 drm/i915: Document the i915_workarounds file

In reply to Oscar Mateo

Does what it says on the tin (plus a few fixes in some old comments).

v2: Include display WAs as a separate category.

Cc Chris Wilson <[email protected]>
Cc Mika Kuoppala <[email protected]>
Cc Ville Syrjälä <[email protected]>
---
 drivers/gpu/drm/i915/intel_pm.c          |  4 +--
 drivers/gpu/drm/i915/intel_workarounds.c | 47 +++++++++++++++++++++++++++-----
 2 files changed, 41 insertions(+), 10 deletions(-)
drivers/gpu/drm/i915/intel_pm.c +1 -3
index 74cc2ffe..06b7bfa 100644
@@ -8736,9 +8736,7 @@ static void nop_init_clock_gating(struct drm_i915_private *dev_priv)
  * @dev_priv: device private
  *
  * Setup the hooks that configure which clocks of a given platform can be
- * gated and also apply various GT and display specific workarounds for these
- * platforms. Note that some GT specific workarounds are applied separately
- * when GPU contexts or batchbuffers start their execution.
+ * gated.
  */
 void intel_init_clock_gating_hooks(struct drm_i915_private *dev_priv)
 {
drivers/gpu/drm/i915/intel_workarounds.c +40 -7

73 lines not on this page · raw message

Signature · 6 lines
1.9.1

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

✗ Fi.CI.BAT: failure for Refactor HW workaround code (rev3)

In reply to Oscar Mateo
== Series Details ==

== Series Details ==

Series: Refactor HW workaround code (rev3)
URL : https://patchwork.freedesktop.org/series/31611/
State : failure

== Summary ==

  CHK     include/config/kernel.release
  CHK     include/generated/uapi/linux/version.h
  CHK     include/generated/utsrelease.h
  CHK     include/generated/bounds.h
  CHK     include/generated/timeconst.h
  CHK     include/generated/asm-offsets.h
  CALL    scripts/checksyscalls.sh
  CHK     scripts/mod/devicetable-offsets.h
  CHK     include/generated/compile.h
  CHK     kernel/config_data.h
  CC [M]  drivers/gpu/drm/i915/intel_workarounds.o
In file included from drivers/gpu/drm/i915/intel_workarounds.c:25:0:
drivers/gpu/drm/i915/intel_workarounds.c: In function ‘mmio_workarounds_apply’:
drivers/gpu/drm/i915/i915_drv.h:4202:30: error: ‘misccpctl’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
 #define I915_WRITE(reg, val) dev_priv->uncore.funcs.mmio_writel(dev_priv, (reg), (val), true)
                              ^~~~~~~~
drivers/gpu/drm/i915/intel_workarounds.c:552:6: note: ‘misccpctl’ was declared here
  u32 misccpctl;
      ^~~~~~~~~

cc1: all warnings being treated as errors
scripts/Makefile.build:313: recipe for target 'drivers/gpu/drm/i915/intel_workarounds.o' failed make[4]: *** [drivers/gpu/drm/i915/intel_workarounds.o] Error 1 scripts/Makefile.build:572: recipe for target 'drivers/gpu/drm/i915' failed make[3]: *** [drivers/gpu/drm/i915] Error 2
scripts/Makefile.build:572: recipe for target 'drivers/gpu/drm' failed
make[2]: *** [drivers/gpu/drm] Error 2
scripts/Makefile.build:572: recipe for target 'drivers/gpu' failed
make[1]: *** [drivers/gpu] Error 2
Makefile:1019: recipe for target 'drivers' failed
make: *** [drivers] Error 2

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

#45 lore raw
In reply to Oscar Mateo

Quoting Oscar Mateo (2017-10-13 21:53:54)

Quoted 5 lines

Main difference with v2 is the split into GT and Display workarounds (suggested by Ville). Because that makes review even more important (which WA goes where?) I have split the movement of WAs from init_clock_gating into separate patches (one per GEN).

Quoted 7 lines

Currently, deciding how/where to apply new workarounds is challenging. Often, workarounds end up applied incorrectly and get lost under certain circumstances (e.g. a context switch or a GPU reset). This is a proposal to attempt to eliminate some of this pain, by clarifying the current classification of workarounds (context saved/restored, global registers, whitelisting, BB), putting them together on the same file, and improving the existing validation infrastructure (debugfs/i-g-t).

Some more to add to the list! i915_gem_init_hw() has another random collection of GT registers.
-Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#46 lore raw
Quoted 13 lines · Chris Wilson

Quoting Oscar Mateo (2017-10-13 21:53:54)

Quoted 5 lines

Main difference with v2 is the split into GT and Display workarounds (suggested by Ville). Because that makes review even more important (which WA goes where?) I have split the movement of WAs from init_clock_gating into separate patches (one per GEN).

Quoted 7 lines

Currently, deciding how/where to apply new workarounds is challenging. Often, workarounds end up applied incorrectly and get lost under certain circumstances (e.g. a context switch or a GPU reset). This is a proposal to attempt to eliminate some of this pain, by clarifying the current classification of workarounds (context saved/restored, global registers, whitelisting, BB), putting them together on the same file, and improving the existing validation infrastructure (debugfs/i-g-t).

Quoted 3 lines

Some more to add to the list! i915_gem_init_hw() has another random collection of GT registers.
-Chris

Hmmmm... those are very old (IVB, HSW...) and I had started converting only BDW onwards (if only because, the older the platform gets, the more difficult it is to classify WAs).
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx