Skip to contentSkip to conversation

Refactor HW workaround code

RFC PATCH Superseded Oscar Mateo 5 participants 22 messages Oct 9, 2017 – Oct 10, 2017

Subsystems (2)

v1 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#0 lore raw

cover Refactor HW workaround code

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 (11):
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: Move workarounds from init_clock_gating drm/i915: Rename saved workarounds to make it explicit that they are
context WAs
drm/i915: Save all MMIO WAs and apply them at a later time drm/i915: Save all Whitelist WAs and apply them at a later time drm/i915: Print all workaround types correctly in debugfs drm/i915: Move WA BB stuff to the workarounds file as well drm/i915: Document the i915_workarounds file
drm/i915: Remove Gen9 WAs with no effect

 drivers/gpu/drm/i915/Makefile           |    1 +
 drivers/gpu/drm/i915/i915_debugfs.c     |   52 +-
 drivers/gpu/drm/i915/i915_drv.c         |    5 +
 drivers/gpu/drm/i915/i915_drv.h         |   20 +-
 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/i915_workarounds.c | 1307 +++++++++++++++++++++++++++++++
 drivers/gpu/drm/i915/i915_workarounds.h |   40 +
 drivers/gpu/drm/i915/intel_engine_cs.c  |  679 ----------------
 drivers/gpu/drm/i915/intel_lrc.c        |  266 +------
 drivers/gpu/drm/i915/intel_pm.c         |  188 +----
 drivers/gpu/drm/i915/intel_ringbuffer.c |    5 +-
 drivers/gpu/drm/i915/intel_ringbuffer.h |    3 -
 14 files changed, 1429 insertions(+), 1149 deletions(-)
 create mode 100644 drivers/gpu/drm/i915/i915_workarounds.c
 create mode 100644 drivers/gpu/drm/i915/i915_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

RFC PATCH 1/11 drm/i915: No need for RING_MAX_NONPRIV_SLOTS space

Now that we write RING_FORCE_TO_NONPRIV registers directly to hardware, there is no need to save space for them in the list of context workarounds.

Cc Chris Wilson <[email protected]>
Cc Mika Kuoppala <[email protected]>
---
 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 799a90a..47a357c 100644
@@ -1954,13 +1954,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
Reviewed-by on v1 1/11
#2 lore raw

Re: [RFC PATCH 01/11] drm/i915: No need for RING_MAX_NONPRIV_SLOTS space

Quoted 5 lines · Oscar Mateo

Now that we write RING_FORCE_TO_NONPRIV registers directly to hardware, there is no need to save space for them in the list of context workarounds.

Quoted 1 line
Cc Chris Wilson <[email protected]>
Cc Mika Kuoppala <[email protected]>

Is it worth mention the commit that changed this? E.g.:

Now that we write RING_FORCE_TO_NONPRIV registers directly to hardware [commit 32ced39c1b12 ("drm/i915: Transform whitelisting WAs into a simple reg write")]...

Anyway,

Quoted 26 lines
---
  drivers/gpu/drm/i915/i915_drv.h | 8 +-------
  1 file changed, 1 insertion(+), 7 deletions(-)
drivers/gpu/drm/i915/i915_drv.h +1 -8
index 799a90a..47a357c 100644
@@ -1954,13 +1954,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];
--

1.9.1

Quoted 5 lines

_______________________________________________
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

Reviewed-by on v1 1/11
#3 lore raw

Re: [RFC PATCH 01/11] drm/i915: No need for RING_MAX_NONPRIV_SLOTS space

In reply to Oscar Mateo
Quoted 6 lines · Oscar Mateo

Now that we write RING_FORCE_TO_NONPRIV registers directly to hardware, there is no need to save space for them in the list of context workarounds.

Cc Chris Wilson <[email protected]>
Cc Mika Kuoppala <[email protected]>
Quoted 25 lines
---
 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 799a90a..47a357c 100644
@@ -1954,13 +1954,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 · 1 line
1.9.1

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

#4 lore raw

RFC PATCH 2/11 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.

Cc Chris Wilson <[email protected]>
Cc Mika Kuoppala <[email protected]>
---
 drivers/gpu/drm/i915/Makefile           |   1 +
 drivers/gpu/drm/i915/i915_workarounds.c | 705 ++++++++++++++++++++++++++++++++
 drivers/gpu/drm/i915/i915_workarounds.h |  31 ++
 drivers/gpu/drm/i915/intel_engine_cs.c  | 679 ------------------------------
 drivers/gpu/drm/i915/intel_lrc.c        |   1 +
 drivers/gpu/drm/i915/intel_ringbuffer.c |   1 +
 drivers/gpu/drm/i915/intel_ringbuffer.h |   3 -
 7 files changed, 739 insertions(+), 682 deletions(-)
 create mode 100644 drivers/gpu/drm/i915/i915_workarounds.c
 create mode 100644 drivers/gpu/drm/i915/i915_workarounds.h
drivers/gpu/drm/i915/Makefile +1 -0
index 66d23b6..2f0afca 100644
@@ -19,6 +19,7 @@ i915-y := i915_drv.o \
 	  i915_syncmap.o \
 	  i915_sw_fence.o \
 	  i915_sysfs.o \
+	  i915_workarounds.o \
 	  intel_csr.o \
 	  intel_device_info.o \
 	  intel_pm.o \
drivers/gpu/drm/i915/i915_workarounds.c new file +705 -0

705 lines not on this page · raw message

drivers/gpu/drm/i915/i915_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
drivers/gpu/drm/i915/intel_engine_cs.c +0 -679

685 lines not on this page · raw message

drivers/gpu/drm/i915/intel_lrc.c +1 -0
index 721432d..07978fd 100644
@@ -137,6 +137,7 @@
 #include <drm/i915_drm.h>
 #include "i915_drv.h"
 #include "intel_mocs.h"
+#include "i915_workarounds.h"
 
 #define RING_EXECLIST_QFULL		(1 << 0x2)
 #define RING_EXECLIST1_VALID		(1 << 0x3)
drivers/gpu/drm/i915/intel_ringbuffer.c +1 -0
index 05c08b0..bb11aac 100644
@@ -33,6 +33,7 @@
 #include <drm/i915_drm.h>
 #include "i915_trace.h"
 #include "intel_drv.h"
+#include "i915_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 0fedda1..63ff7e0 100644
@@ -723,9 +723,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);
 
Signature · 6 lines
1.9.1

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

Re: [RFC PATCH 02/11] drm/i915: Move a bunch of workaround-related code to its own file

Quoting Oscar Mateo (2017-10-09 21:58:17)

Quoted 5 lines

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.

Quoted 7 lines
Cc Chris Wilson <[email protected]>
Cc Mika Kuoppala <[email protected]>
---
 drivers/gpu/drm/i915/Makefile           |   1 +
 drivers/gpu/drm/i915/i915_workarounds.c | 705 ++++++++++++++++++++++++++++++++
 drivers/gpu/drm/i915/i915_workarounds.h |  31 ++

If we look at the filenames with rose-tinted glasses:

intel_* -> interaction with hw
i915_* -> interaction with user

(Let's not start on the mixup entailed when we use the i915 prefix to mean to talking to gen2/gen3. Hopefully most gen2 mixups are history.)

i915_workarounds would imply w/a for the drm/i915 uABI, but we want intel_workarounds to imply w/a for hw.

Now some are indeed workarounds to keep uABI constant (or otherwise correct)... The line can be murky ;)
-Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#6 lore raw

Re: [RFC PATCH 02/11] drm/i915: Move a bunch of workaround-related code to its own file

Quoted 21 lines · Chris Wilson

Quoting Oscar Mateo (2017-10-09 21:58:17)

Quoted 5 lines

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.

Quoted 7 lines
Cc Chris Wilson <[email protected]>
Cc Mika Kuoppala <[email protected]>
---
  drivers/gpu/drm/i915/Makefile           |   1 +
  drivers/gpu/drm/i915/i915_workarounds.c | 705 ++++++++++++++++++++++++++++++++
  drivers/gpu/drm/i915/i915_workarounds.h |  31 ++

If we look at the filenames with rose-tinted glasses:

intel_* -> interaction with hw
i915_* -> interaction with user

(Let's not start on the mixup entailed when we use the i915 prefix to mean to talking to gen2/gen3. Hopefully most gen2 mixups are history.)

Quoted 6 lines

i915_workarounds would imply w/a for the drm/i915 uABI, but we want intel_workarounds to imply w/a for hw.

Now some are indeed workarounds to keep uABI constant (or otherwise correct)... The line can be murky ;)
-Chris

I remembered file prefixes had a meaning, but I tried to recall it from memory and came up with the exact opposite (and I looked at i915_guc_submission.c as proof that I was recalling it correctly :P).

I'll rename the files, no problem.

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

#7 lore raw

RFC PATCH 3/11 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.

Cc Chris Wilson <[email protected]>
Cc Mika Kuoppala <[email protected]>
---
 drivers/gpu/drm/i915/i915_gem.c         |   3 +
 drivers/gpu/drm/i915/i915_gem_context.c |   5 +
 drivers/gpu/drm/i915/i915_workarounds.c | 649 +++++++++++++++++++-------------
 drivers/gpu/drm/i915/i915_workarounds.h |   8 +-
 drivers/gpu/drm/i915/intel_lrc.c        |  10 +-
 drivers/gpu/drm/i915/intel_ringbuffer.c |   4 +-
 6 files changed, 413 insertions(+), 266 deletions(-)
drivers/gpu/drm/i915/i915_gem.c +3 -0
index 82a1003..c26d8f2 100644
@@ -32,6 +32,7 @@
 #include "i915_gem_clflush.h"
 #include "i915_vgpu.h"
 #include "i915_trace.h"
+#include "i915_workarounds.h"
 #include "intel_drv.h"
 #include "intel_frontbuffer.h"
 #include "intel_mocs.h"
@@ -4762,6 +4763,8 @@ int i915_gem_init_hw(struct drm_i915_private *dev_priv)
 		}
 	}
 
+	i915_mmio_workarounds_apply(dev_priv);
+
 	i915_gem_init_swizzling(dev_priv);
 
 	/*
drivers/gpu/drm/i915/i915_gem_context.c +5 -0
index 5bf96a2..b544847 100644
@@ -90,6 +90,7 @@
 #include <drm/i915_drm.h>
 #include "i915_drv.h"
 #include "i915_trace.h"
+#include "i915_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 = i915_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/i915_workarounds.c +390 -259

819 lines not on this page · raw message

drivers/gpu/drm/i915/i915_workarounds.h +6 -2
index 27099fc..3944432 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 i915_ctx_workarounds_init(struct drm_i915_private *dev_priv);
+int i915_ctx_workarounds_emit(struct drm_i915_gem_request *req);
+
+void i915_mmio_workarounds_apply(struct drm_i915_private *dev_priv);
+
+int i915_whitelist_workarounds_apply(struct intel_engine_cs *engine);
 
 #endif
drivers/gpu/drm/i915/intel_lrc.c +7 -3
index 07978fd..4816dd6 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 = i915_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 = i915_ctx_workarounds_emit(req);
 	if (ret)
 		return ret;
 
drivers/gpu/drm/i915/intel_ringbuffer.c +2 -2
index bb11aac..7413443 100644
@@ -638,7 +638,7 @@ static int intel_rcs_ctx_init(struct drm_i915_gem_request *req)
 {
 	int ret;
 
-	ret = intel_ring_workarounds_emit(req);
+	ret = i915_ctx_workarounds_emit(req);
 	if (ret != 0)
 		return ret;
 
@@ -697,7 +697,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)
Signature · 6 lines
1.9.1

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

RFC PATCH 4/11 drm/i915: Move workarounds from init_clock_gating

In reply to Oscar Mateo

I'm not sure why some WAs have historically been applied in init_clock_gating and some others in the engine setup (GT vs. display? context vs. global registers?) but it does not look like the best place to apply workarounds:
the name is confusing, it's a display function (even though some GT WAs also go here) and it isn't necessarily called on a GPU reset. This patch moves these WAs to their rightful place inside i915_workarounds.c.

TODO1: It's straightforward to move things from Gen9 onwards, but in order to move Gen8 and older, I'd need some guidance on what constitutes clock gating and what is simply a WA.

TODO2: Do we want to keep display WAs separated from GT ones? In that case, I would propose another category inside i915_workarounds.c (but I would need help deciding what goes where).

Cc Rodrigo Vivi <[email protected]>
Cc Chris Wilson <[email protected]>
Cc Mika Kuoppala <[email protected]>
---
 drivers/gpu/drm/i915/i915_workarounds.c | 146 ++++++++++++++++++++++++-
 drivers/gpu/drm/i915/intel_pm.c         | 188 +-------------------------------
 2 files changed, 151 insertions(+), 183 deletions(-)
drivers/gpu/drm/i915/i915_workarounds.c +145 -1
index f272b49..9ae89e4 100644
@@ -509,6 +509,14 @@ int i915_ctx_workarounds_emit(struct drm_i915_gem_request *req)
 	return 0;
 }
 
+static void bdw_mmio_workarounds_apply(struct drm_i915_private *dev_priv)
+{
+}
+
+static void chv_mmio_workarounds_apply(struct drm_i915_private *dev_priv)
+{
+}
+
 static void gen9_mmio_workarounds_apply(struct drm_i915_private *dev_priv)
 {
 	if (HAS_LLC(dev_priv)) {
@@ -521,8 +529,40 @@ static void gen9_mmio_workarounds_apply(struct drm_i915_private *dev_priv)
 			   I915_READ(MMCD_MISC_CTRL) |
 			   MMCD_PCLA |
 			   MMCD_HOTSPOT_EN);
+
+		/*
+		 * 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);
+
 	/* WaContextSwitchWithConcurrentTLBInvalidate:skl,bxt,kbl,glk,cfl */
 	I915_WRITE(GEN9_CSFE_CHICKEN1_RCS,
 		   _MASKED_BIT_ENABLE(GEN9_PREEMPT_GPGPU_SYNC_SWITCH_DISABLE));
@@ -553,6 +593,18 @@ static void skl_mmio_workarounds_apply(struct drm_i915_private *dev_priv)
 {
 	gen9_mmio_workarounds_apply(dev_priv);
 
+	/* WaDisableDopClockGating */
+	I915_WRITE(GEN7_MISCCPCTL, I915_READ(GEN7_MISCCPCTL)
+		   & ~GEN7_DOP_CLOCK_GATE_ENABLE);
+
+	/* 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);
+
 	/* WaEnableGapsTsvCreditFix:skl */
 	I915_WRITE(GEN8_GARBCNTL, (I915_READ(GEN8_GARBCNTL) |
 				   GEN9_GAPS_TSV_CREDIT_DISABLE));
@@ -572,6 +624,24 @@ static void bxt_mmio_workarounds_apply(struct drm_i915_private *dev_priv)
 {
 	gen9_mmio_workarounds_apply(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);
+
 	/* WaStoreMultiplePTEenable:bxt */
 	/* This is a requirement according to Hardware specification */
 	if (IS_BXT_REVID(dev_priv, 0, BXT_REVID_A1))
@@ -605,6 +675,20 @@ static void kbl_mmio_workarounds_apply(struct drm_i915_private *dev_priv)
 {
 	gen9_mmio_workarounds_apply(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);
+
 	/* WaEnableGapsTsvCreditFix:kbl */
 	I915_WRITE(GEN8_GARBCNTL, (I915_READ(GEN8_GARBCNTL) |
 				   GEN9_GAPS_TSV_CREDIT_DISABLE));
@@ -627,13 +711,43 @@ static void kbl_mmio_workarounds_apply(struct drm_i915_private *dev_priv)
 
 static void glk_mmio_workarounds_apply(struct drm_i915_private *dev_priv)
 {
+	u32 val;
+
 	gen9_mmio_workarounds_apply(dev_priv);
+
+	/*
+	 * 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 cfl_mmio_workarounds_apply(struct drm_i915_private *dev_priv)
 {
 	gen9_mmio_workarounds_apply(dev_priv);
 
+	/* WaFbcNukeOnHostModify:cfl */
+	I915_WRITE(ILK_DPFC_CHICKEN,
+		   I915_READ(ILK_DPFC_CHICKEN) |
+			     ILK_DPFC_NUKE_ON_ANY_MODIFICATION);
+
 	/* WaEnableGapsTsvCreditFix:cfl */
 	I915_WRITE(GEN8_GARBCNTL, (I915_READ(GEN8_GARBCNTL) |
 				   GEN9_GAPS_TSV_CREDIT_DISABLE));
@@ -650,6 +764,32 @@ static void cfl_mmio_workarounds_apply(struct drm_i915_private *dev_priv)
 
 static void cnl_mmio_workarounds_apply(struct drm_i915_private *dev_priv)
 {
+	u32 val;
+
+	/* 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);
+
 	/* WaDisableI2mCycleOnWRPort:cnl (pre-prod) */
 	if (IS_CNL_REVID(dev_priv, CNL_REVID_B0, CNL_REVID_B0))
 		I915_WRITE(GAMT_CHKN_BIT_REG,
@@ -668,7 +808,11 @@ static void cnl_mmio_workarounds_apply(struct drm_i915_private *dev_priv)
 
 void i915_mmio_workarounds_apply(struct drm_i915_private *dev_priv)
 {
-	if (IS_SKYLAKE(dev_priv))
+	if (IS_BROADWELL(dev_priv))
+		bdw_mmio_workarounds_apply(dev_priv);
+	else if (IS_CHERRYVIEW(dev_priv))
+		chv_mmio_workarounds_apply(dev_priv);
+	else if (IS_SKYLAKE(dev_priv))
 		skl_mmio_workarounds_apply(dev_priv);
 	else if (IS_BROXTON(dev_priv))
 		bxt_mmio_workarounds_apply(dev_priv);
drivers/gpu/drm/i915/intel_pm.c +6 -182

209 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
#9 lore raw

RFC PATCH 5/11 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.

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         |   5 +-
 drivers/gpu/drm/i915/i915_workarounds.c | 142 ++++++++++++++++----------------
 3 files changed, 79 insertions(+), 78 deletions(-)
drivers/gpu/drm/i915/i915_debugfs.c +5 -5
index f7817c6..a204896 100644
@@ -3557,18 +3557,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 +3 -2
index 47a357c..0bbe128 100644
@@ -1957,8 +1957,9 @@ struct i915_wa_reg {
 #define I915_MAX_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_WA_REGS];
+	u32 ctx_wa_count;
+
 	u32 hw_whitelist_count[I915_NUM_ENGINES];
 };
 
drivers/gpu/drm/i915/i915_workarounds.c +71 -71

386 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
#10 lore raw

RFC PATCH 6/11 drm/i915: Save all MMIO 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).

Cc Chris Wilson <[email protected]>
Cc Mika Kuoppala <[email protected]>
---
 drivers/gpu/drm/i915/i915_drv.c         |   5 +
 drivers/gpu/drm/i915/i915_drv.h         |   8 +-
 drivers/gpu/drm/i915/i915_reg.h         |   1 +
 drivers/gpu/drm/i915/i915_workarounds.c | 335 ++++++++++++++++++--------------
 drivers/gpu/drm/i915/i915_workarounds.h |   1 +
 5 files changed, 202 insertions(+), 148 deletions(-)
drivers/gpu/drm/i915/i915_drv.c +5 -0
index 66fc156..7830073 100644
@@ -49,6 +49,7 @@
 #include "i915_drv.h"
 #include "i915_trace.h"
 #include "i915_vgpu.h"
+#include "i915_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 = i915_mmio_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 +6 -2
index 0bbe128..b042078 100644
@@ -1954,12 +1954,16 @@ struct i915_wa_reg {
 	u32 mask;
 };
 
-#define I915_MAX_WA_REGS 16
+#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_WA_REGS];
+	struct i915_wa_reg ctx_wa_reg[I915_MAX_CTX_WA_REGS];
 	u32 ctx_wa_count;
 
+	struct i915_wa_reg mmio_wa_reg[I915_MAX_MMIO_WA_REGS];
+	u32 mmio_wa_count;
+
 	u32 hw_whitelist_count[I915_NUM_ENGINES];
 };
 
drivers/gpu/drm/i915/i915_reg.h +1 -0
index 50e65c9..6b46393 100644
@@ -7042,6 +7042,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/i915_workarounds.c +189 -146

514 lines not on this page · raw message

drivers/gpu/drm/i915/i915_workarounds.h +1 -0
index 3944432..1ffe13a 100644
@@ -28,6 +28,7 @@
 int i915_ctx_workarounds_init(struct drm_i915_private *dev_priv);
 int i915_ctx_workarounds_emit(struct drm_i915_gem_request *req);
 
+int i915_mmio_workarounds_init(struct drm_i915_private *dev_priv);
 void i915_mmio_workarounds_apply(struct drm_i915_private *dev_priv);
 
 int i915_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
#11 lore raw

RFC PATCH 7/11 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.

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/i915_workarounds.c | 113 ++++++++++++++++----------------
 drivers/gpu/drm/i915/i915_workarounds.h |   3 +-
 drivers/gpu/drm/i915/intel_lrc.c        |   8 ++-
 5 files changed, 67 insertions(+), 62 deletions(-)
drivers/gpu/drm/i915/i915_debugfs.c +1 -1
index a204896..bfb0648 100644
@@ -3560,7 +3560,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 b042078..9359231 100644
@@ -1964,7 +1964,8 @@ struct i915_workarounds {
 	struct i915_wa_reg mmio_wa_reg[I915_MAX_MMIO_WA_REGS];
 	u32 mmio_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/i915_workarounds.c +57 -56

210 lines not on this page · raw message

drivers/gpu/drm/i915/i915_workarounds.h +2 -1
index 1ffe13a..805d246 100644
@@ -31,6 +31,7 @@
 int i915_mmio_workarounds_init(struct drm_i915_private *dev_priv);
 void i915_mmio_workarounds_apply(struct drm_i915_private *dev_priv);
 
-int i915_whitelist_workarounds_apply(struct intel_engine_cs *engine);
+int i915_whitelist_workarounds_init(struct intel_engine_cs *engine);
+void i915_whitelist_workarounds_apply(struct intel_engine_cs *engine);
 
 #endif
drivers/gpu/drm/i915/intel_lrc.c +5 -3
index 4816dd6..0fe0f3e 100644
@@ -1499,9 +1499,7 @@ static int gen9_init_render_ring(struct intel_engine_cs *engine)
 	if (ret)
 		return ret;
 
-	ret = i915_whitelist_workarounds_apply(engine);
-	if (ret)
-		return ret;
+	i915_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 = i915_whitelist_workarounds_init(engine);
+	if (ret)
+		return ret;
+
 	ret = intel_init_workaround_bb(engine);
 	if (ret) {
 		/*
Signature · 6 lines
1.9.1

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

RFC PATCH 8/11 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).

Cc Chris Wilson <[email protected]>
Cc Mika Kuoppala <[email protected]>
---
 drivers/gpu/drm/i915/i915_debugfs.c | 48 ++++++++++++++++++++++++++-----------
 1 file changed, 34 insertions(+), 14 deletions(-)
drivers/gpu/drm/i915/i915_debugfs.c +34 -14
index bfb0648..453ca57 100644
@@ -3541,6 +3541,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;
@@ -3550,6 +3564,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)
@@ -3558,22 +3573,27 @@ 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, "MMIO workarounds applied: %d\n", workarounds->mmio_wa_count);
+	for (i = 0; i < workarounds->mmio_wa_count; ++i)
+		check_wa_register(m, &workarounds->mmio_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
#13 lore raw

RFC PATCH 9/11 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/i915_workarounds.c | 254 ++++++++++++++++++++++++++++++++
 drivers/gpu/drm/i915/i915_workarounds.h |   3 +
 drivers/gpu/drm/i915/intel_lrc.c        | 253 +------------------------------
 3 files changed, 259 insertions(+), 251 deletions(-)
drivers/gpu/drm/i915/i915_workarounds.c +254 -0
index 5f7eb7a..ff30525 100644
@@ -1022,3 +1022,257 @@ void i915_whitelist_workarounds_apply(struct intel_engine_cs *engine)
 			   w->whitelist_wa_reg[engine->id][i].value);
 	}
 }
+
+/*
+ * 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);
+
+int i915_bb_workarounds_init(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;
+}
+
+void i915_bb_workarounds_fini(struct intel_engine_cs *engine)
+{
+	lrc_destroy_wa_ctx(engine);
+}
drivers/gpu/drm/i915/i915_workarounds.h +3 -0
index 805d246..72cd4b7 100644
@@ -34,4 +34,7 @@
 int i915_whitelist_workarounds_init(struct intel_engine_cs *engine);
 void i915_whitelist_workarounds_apply(struct intel_engine_cs *engine);
 
+int i915_bb_workarounds_init(struct intel_engine_cs *engine);
+void i915_bb_workarounds_fini(struct intel_engine_cs *engine);
+
 #endif
drivers/gpu/drm/i915/intel_lrc.c +2 -251

271 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
#14 lore raw

RFC PATCH 10/11 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).

Cc Chris Wilson <[email protected]>
Cc Mika Kuoppala <[email protected]>
---
 drivers/gpu/drm/i915/i915_workarounds.c | 45 ++++++++++++++++++++++++++++-----
 1 file changed, 38 insertions(+), 7 deletions(-)
drivers/gpu/drm/i915/i915_workarounds.c +38 -7
index ff30525..9a32601 100644
@@ -25,6 +25,36 @@
 #include "i915_drv.h"
 #include "i915_workarounds.h"
 
+/**
+ * DOC: Hardware workarounds
+ *
+ * This file is a central place to implement most* of the required workarounds
+ * required for HW to work as originally intended. They fall in four categories
+ * depending on how/when they are applied:
+ *
+ * - Workarounds that touch registers that are saved/restored to/from the HW
+ *   context image. The list is generated once and then emitted (via Load
+ *   Register Immediate commands) everytime a new context is created.
+ * - Workarounds that touch global MMIO registers. The list of these WAs is
+ *   generated once and then applied whenever these registers revert to default
+ *   values (on GPU reset, suspend/resume**, etc..).
+ * - Workarounds that whitelist a privileged register, so that UMDs can manage
+ *   them directly. This is just a special case of a MMMIO workaround (as we
+ *   write the list of these to/be-whitelisted registers to some special HW
+ *   registers).
+ * - Workaround batchbuffers, that get executed automatically by the hardware
+ *   on every HW context restore.
+ *
+ * * Please notice that there are other WAs that, due to their nature, cannot be
+ *   applied from a central place. Those are peppered around the rest of the
+ *   code, as needed).
+ *
+ * ** Technically, some registers are powercontext saved & restored, so they
+ *    survive a suspend/resume. In practice, writing them again is not too
+ *    costly and simplifies things. We can revisit this in the future.
+ *
+ */
+
 static int ctx_wa_add(struct drm_i915_private *dev_priv,
 		      i915_reg_t addr,
 		      const u32 mask, const u32 val)
@@ -190,9 +220,9 @@ static int gen9_ctx_workarounds_init(struct drm_i915_private *dev_priv)
 		CTXWA_SET_BIT_MSK(GEN7_COMMON_SLICE_CHICKEN1,
 				  GEN9_RHWO_OPTIMIZATION_DISABLE);
 		/*
-		 * WA also requires GEN9_SLICE_COMMON_ECO_CHICKEN0[14:14] to be set
-		 * but we do that in per ctx batchbuffer as there is an issue
-		 * with this register not getting restored on ctx restore
+		 * WA also requires GEN9_SLICE_COMMON_ECO_CHICKEN0[14:14] to be
+		 * set but we do that in per ctx batchbuffer as there is an
+		 * issue with this register not getting restored on ctx restore.
 		 */
 	}
 
@@ -1029,10 +1059,11 @@ void i915_whitelist_workarounds_apply(struct intel_engine_cs *engine)
  * 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.
+ * 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
+ * it for a short period and this batch in non-premptible. We can of course
  * 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.
  *
@@ -1068,8 +1099,8 @@ void i915_whitelist_workarounds_apply(struct intel_engine_cs *engine)
  * 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.
+ * 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.
Signature · 6 lines
1.9.1

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

RFC PATCH 11/11 drm/i915: 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).

Cc Chris Wilson <[email protected]>
Cc Mika Kuoppala <[email protected]>
---
 drivers/gpu/drm/i915/i915_reg.h         | 3 ---
 drivers/gpu/drm/i915/i915_workarounds.c | 2 --
 2 files changed, 5 deletions(-)
drivers/gpu/drm/i915/i915_reg.h +0 -3
index 6b46393..a78dea6 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/i915_workarounds.c +0 -2
index 9a32601..6f10e04 100644
@@ -608,8 +608,6 @@ static int gen9_mmio_workarounds_init(struct drm_i915_private *dev_priv)
 	/* See Bspec note for PSR2_CTL bit 31, Wa#828:skl,bxt,kbl,cfl */
 	MMIOWA_SET_BIT(CHICKEN_PAR1_1, SKL_EDP_PSR_FIX_RDWRAP);
 
-	MMIOWA_SET_BIT(GEN8_CONFIG0, GEN9_DEFAULT_FIXES);
-
 	/* WaEnableChickenDCPR:skl,bxt,kbl,glk,cfl */
 	MMIOWA_SET_BIT(GEN8_CHICKEN_DCPR_1, MASK_WAKEMEM);
 
Signature · 6 lines
1.9.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#16 lore raw
In reply to Oscar Mateo

Quoting Oscar Mateo (2017-10-09 21:58:15)

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).

One thing I've been dreaming of is if we can have an external file for importing the w/a (reg offset + corrected value) that we could source directly from spec. (Hoping for some xml translation to C or DT.)

We need something like this so that we can set all the nonpriv registers to the default value in the proto-context. Or at least lots of patience and careful proofreading.
-Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#17 lore raw
Quoted 11 lines · Chris Wilson

Quoting Oscar Mateo (2017-10-09 21:58:15)

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).

One thing I've been dreaming of is if we can have an external file for importing the w/a (reg offset + corrected value) that we could source directly from spec. (Hoping for some xml translation to C or DT.)

Hmmm... I'm afraid this is impossible at the moment, since many WAs in the BSpec are simply a link to the ticket where the workaround was devised (and there you have to parse the conversation to figure out what the WA should do).

Quoted 4 lines

We need something like this so that we can set all the nonpriv registers to the default value in the proto-context. Or at least lots of patience and careful proofreading.
-Chris

You mean applying the workarounds directly to the context image instead of the LRI commands we use now? That can be done (as you said, with *a lot* of patience and careful proofreading) but we would need to force the proto-context to be restored first (with CTX_CTRL_ENGINE_CTX_RESTORE_INHIBIT bit set), because the workarounds do not always give us the full default value for a register, only the fields that are wrong in the hardware.

-- Oscar

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

#18 lore raw
Quoted 15 lines · Oscar Mateo
Quoted 11 lines · Chris Wilson

Quoting Oscar Mateo (2017-10-09 21:58:15)

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).

One thing I've been dreaming of is if we can have an external file for importing the w/a (reg offset + corrected value) that we could source directly from spec. (Hoping for some xml translation to C or DT.)

Quoted 8 lines

Hmmm... I'm afraid this is impossible at the moment, since many WAs in the BSpec are simply a link to the ticket where the workaround was devised (and there you have to parse the conversation to figure out what the WA should do).

Quoted 4 lines

We need something like this so that we can set all the nonpriv registers to the default value in the proto-context. Or at least lots of patience and careful proofreading.
-Chris

You mean applying the workarounds directly to the context image instead of the LRI commands we use now? That can be done (as you said, with *a lot* of patience and careful proofreading) but we would need to force the proto-context to be restored first (with CTX_CTRL_ENGINE_CTX_RESTORE_INHIBIT bit set), because the workarounds do not always give us the full default value for a register, only the fields that are wrong in the hardware.

Hmmmm... I'm giving out conflicting information. Registers in the engine (those that live in the engine part of the context image) are not guaranteed to be initialized, so inhibit-restoring the context and then saving it is not enough. Yes, we would have to get the default values for them from the BSpec, either automatically or by hand, then apply the workarounds (either by modifying the default values or with the emission of LRIs we have now).

This is an insane amount of work (and sometimes the BSpec does not include all the information you need), that's why the recommendation in the BSpec is to force the engine to populate these registers for us (the infamous null state batchbuffer):

"[...] Engine context starts immediately following the logical ring context in memory. This state is very specific to an engine and differs from engine to engine. This part of the context consists of the state from all the units in the engine that needs to be save/restored across context switches. Engine restores the engine context following the logical ring context restore. It is tedious for software to populate the engine context as per the requirements, it is recommended to implicitly use engine to populate this portion of the context. Below method can be followed to achieve the same:

* When a context is submitted for the first time for execution, SW can inhibit engine from restoring engine context by setting the “Engine Context Restore Inhibit” bit in CTXT_SR_CTL register of the logical ring context. This will avoid software from populating the Engine Context. Software must program all the state required to initialize the engine in the ring buffer which would initialize the hardware state. On a subsequent context save engine will populate the engine context with appropriate values.

* Above method can be used to create a complete logical context with engine context populated by the hardware. This Logical context can be used as an Golden Context Image or template for subsequently created contexts.

Engine saves the engine context following the logical ring context on switching out a context."

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

#19 lore raw

Quoting Oscar Mateo (2017-10-10 19:24:18)

Quoted 4 lines

* Above method can be used to create a complete logical context with engine context populated by the hardware. This Logical context can be used as an Golden Context Image or template for subsequently created contexts.

It's the template part we want (sending down a pair of contexts to be executed in sequence is problematic).

The current fire are the nonpriv registers that are leaking across the proto-context, i.e. mesa does LRI that get inherited into a libva context. Adding those to the context image requires approx a hundred LRI, so a not impossible task to proofread (esp. as many are just setting register groups, e.g. the 32 CS_GPR registers, to 0).

But it is still a task that we need to maintain that list of nonpriv registers. (State outside of the nonpriv that doesn't have a defined default, cannot be either modified by userspace or assume to have any particular value.)
-Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#20 lore raw
Quoted 7 lines · Chris Wilson

Quoting Oscar Mateo (2017-10-10 19:24:18)

Quoted 4 lines

* Above method can be used to create a complete logical context with engine context populated by the hardware. This Logical context can be used as an Golden Context Image or template for subsequently created contexts.

It's the template part we want (sending down a pair of contexts to be executed in sequence is problematic).

Ahh, I see.

Notice that what the BSpec suggests is to send the null state BB only once (for the kernel default context image) and then copy (memcpy or DMA) that context image over all new contexts that get created. That takes care of the problem with nonpriv registers, because absolutely everything inside the context image get blasted with a clean copy everytime.

Quoted 8 lines

The current fire are the nonpriv registers that are leaking across the proto-context, i.e. mesa does LRI that get inherited into a libva context. Adding those to the context image requires approx a hundred LRI, so a not impossible task to proofread (esp. as many are just setting register groups, e.g. the 32 CS_GPR registers, to 0).

But it is still a task that we need to maintain that list of nonpriv registers.

or, alternatively, follow the BSpec's "template" approach, with or without null state BB

Quoted 4 lines

(State outside of the nonpriv that doesn't have a defined default, cannot be either modified by userspace or assume to have any particular value.)
-Chris

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

#21 lore raw

✗ Fi.CI.BAT: warning for Refactor HW workaround code

In reply to Oscar Mateo
== Series Details ==

== Series Details ==

Series: Refactor HW workaround code
URL : https://patchwork.freedesktop.org/series/31611/
State : warning

== Summary ==

Series 31611v1 Refactor HW workaround code
https://patchwork.freedesktop.org/api/1.0/series/31611/revisions/1/mbox/

Test chamelium:

        Subgroup dp-crc-fast:
                fail       -> PASS       (fi-kbl-7500u) fdo#102514
Test gem_exec_suspend:
        Subgroup basic-s3:
                pass       -> DMESG-WARN (fi-cfl-s) fdo#103026
Test gem_workarounds:
        Subgroup basic-read:
                pass       -> SKIP       (fi-bdw-5557u)
                pass       -> SKIP       (fi-bdw-gvtdvm)
                pass       -> SKIP       (fi-bsw-n3050)
                pass       -> SKIP       (fi-skl-6260u)
                pass       -> SKIP       (fi-skl-6700hq)
                pass       -> SKIP       (fi-skl-6700k)
                pass       -> SKIP       (fi-skl-6770hq)
                pass       -> SKIP       (fi-skl-gvtdvm)
                pass       -> SKIP       (fi-bxt-dsi)
                pass       -> SKIP       (fi-bxt-j4205)
                pass       -> SKIP       (fi-kbl-7500u)
                pass       -> SKIP       (fi-kbl-7560u)
                pass       -> SKIP       (fi-kbl-7567u)
                pass       -> SKIP       (fi-kbl-r)
                pass       -> SKIP       (fi-glk-1)
                pass       -> SKIP       (fi-cfl-s)
                pass       -> SKIP       (fi-cnl-y)
Test kms_pipe_crc_basic:
        Subgroup nonblocking-crc-pipe-c:
                pass       -> DMESG-WARN (fi-skl-6700k)
        Subgroup read-crc-pipe-b:
                pass       -> DMESG-WARN (fi-skl-6700k)

fdo#102514 https://bugs.freedesktop.org/show_bug.cgi?id=102514
fdo#103026 https://bugs.freedesktop.org/show_bug.cgi?id=103026

fi-bdw-5557u     total:289  pass:267  dwarn:0   dfail:0   fail:0   skip:22  time:457s
fi-bdw-gvtdvm    total:289  pass:264  dwarn:0   dfail:0   fail:0   skip:25  time:466s
fi-blb-e6850     total:289  pass:223  dwarn:1   dfail:0   fail:0   skip:65  time:392s
fi-bsw-n3050     total:289  pass:242  dwarn:0   dfail:0   fail:0   skip:47  time:577s
fi-bwr-2160      total:289  pass:183  dwarn:0   dfail:0   fail:0   skip:106 time:286s
fi-bxt-dsi       total:289  pass:258  dwarn:0   dfail:0   fail:0   skip:31  time:520s
fi-bxt-j4205     total:289  pass:259  dwarn:0   dfail:0   fail:0   skip:30  time:526s
fi-byt-j1900     total:289  pass:253  dwarn:1   dfail:0   fail:0   skip:35  time:533s
fi-byt-n2820     total:289  pass:249  dwarn:1   dfail:0   fail:0   skip:39  time:519s
fi-cfl-s         total:289  pass:255  dwarn:1   dfail:0   fail:0   skip:33  time:562s
fi-cnl-y         total:289  pass:261  dwarn:0   dfail:0   fail:0   skip:28  time:623s
fi-elk-e7500     total:289  pass:229  dwarn:0   dfail:0   fail:0   skip:60  time:431s
fi-glk-1         total:289  pass:260  dwarn:0   dfail:0   fail:0   skip:29  time:598s
fi-hsw-4770      total:289  pass:262  dwarn:0   dfail:0   fail:0   skip:27  time:436s
fi-hsw-4770r     total:289  pass:262  dwarn:0   dfail:0   fail:0   skip:27  time:415s
fi-ilk-650       total:289  pass:228  dwarn:0   dfail:0   fail:0   skip:61  time:460s
fi-ivb-3520m     total:289  pass:260  dwarn:0   dfail:0   fail:0   skip:29  time:498s
fi-ivb-3770      total:289  pass:260  dwarn:0   dfail:0   fail:0   skip:29  time:478s
fi-kbl-7500u     total:289  pass:263  dwarn:1   dfail:0   fail:0   skip:25  time:504s
fi-kbl-7560u     total:289  pass:269  dwarn:0   dfail:0   fail:0   skip:20  time:581s
fi-kbl-7567u     total:289  pass:264  dwarn:4   dfail:0   fail:0   skip:21  time:489s
fi-kbl-r         total:289  pass:261  dwarn:0   dfail:0   fail:0   skip:28  time:588s
fi-pnv-d510      total:289  pass:222  dwarn:1   dfail:0   fail:0   skip:66  time:654s
fi-skl-6260u     total:289  pass:268  dwarn:0   dfail:0   fail:0   skip:21  time:467s
fi-skl-6700hq    total:289  pass:262  dwarn:0   dfail:0   fail:0   skip:27  time:656s
fi-skl-6700k     total:289  pass:262  dwarn:2   dfail:0   fail:0   skip:25  time:525s
fi-skl-6770hq    total:289  pass:268  dwarn:0   dfail:0   fail:0   skip:21  time:511s
fi-skl-gvtdvm    total:289  pass:265  dwarn:0   dfail:0   fail:0   skip:24  time:475s
fi-snb-2520m     total:289  pass:250  dwarn:0   dfail:0   fail:0   skip:39  time:576s
fi-snb-2600      total:289  pass:249  dwarn:0   dfail:0   fail:0   skip:40  time:424s

85a1f1bd95a55d745bb4fff6ce5f1923502bd5c9 drm-tip: 2017y-10m-09d-20h-33m-26s UTC integration manifest 2e475c799415 drm/i915: Remove Gen9 WAs with no effect
2cca5d39b848 drm/i915: Document the i915_workarounds file
9c235c7f0ebf drm/i915: Move WA BB stuff to the workarounds file as well
40e1bbf47606 drm/i915: Print all workaround types correctly in debugfs
41afd19fc153 drm/i915: Save all Whitelist WAs and apply them at a later time 8aa20bc42c6f drm/i915: Save all MMIO WAs and apply them at a later time
249a71966e30 drm/i915: Rename saved workarounds to make it explicit that they are context WAs ce3a45c3bceb drm/i915: Move workarounds from init_clock_gating
fa6247968024 drm/i915: Split out functions for different kinds of workarounds 9aeb5d10480f drm/i915: Move a bunch of workaround-related code to its own file adce2ce40c80 drm/i915: No need for RING_MAX_NONPRIV_SLOTS space

== Logs ==

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