Skip to contentSkip to conversation

drm/i915: Remove duplicate cache workaround

PATCH Applied Ben Widawsky 2 participants 11 messages Oct 4, 2012 – Oct 16, 2012

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/4 drm/i915: Remove duplicate cache workaround

This is already achieved in init_clock gating, and is probably the result of a bad merge from Daniel. I'm too tired to bet on him making a mistake though.

---
 drivers/gpu/drm/i915/intel_ringbuffer.c | 8 --------
 1 file changed, 8 deletions(-)
drivers/gpu/drm/i915/intel_ringbuffer.c +0 -8
index 984a0c5..625a348 100644
@@ -521,14 +521,6 @@ static int init_render_ring(struct intel_ring_buffer *ring)
 	}
 
 	if (IS_GEN6(dev)) {
-		/* From the Sandybridge PRM, volume 1 part 3, page 24:
-		 * "If this bit is set, STCunit will have LRA as replacement
-		 *  policy. [...] This bit must be reset.  LRA replacement
-		 *  policy is not supported."
-		 */
-		I915_WRITE(CACHE_MODE_0,
-			   _MASKED_BIT_DISABLE(CM0_STC_EVICT_DISABLE_LRA_SNB));
-
 		/* This is not explicitly set for GEN6, so read the register.
 		 * see intel_ring_mi_set_context() for why we care.
 		 * TODO: consider explicitly setting the bit for GEN5
Signature · 1 line
1.7.12.2
#1 lore raw

PATCH 2/4 drm/i915: Disable render depth cache pipeline flush

Required through gen6.

---
 drivers/gpu/drm/i915/i915_reg.h | 1 +
 drivers/gpu/drm/i915/intel_pm.c | 2 ++
 2 files changed, 3 insertions(+)
drivers/gpu/drm/i915/i915_reg.h +1 -0
index d17bef7..37e62e0 100644
@@ -662,6 +662,7 @@
 #define   MI_ARB_DISPLAY_PRIORITY_B_A		(1 << 0)	/* display B > display A */
 
 #define CACHE_MODE_0	0x02120 /* 915+ only */
+#define   CM0_RC_PIPELINE_FLUSH_DISABLE	(1<<8)
 #define   CM0_IZ_OPT_DISABLE      (1<<6)
 #define   CM0_ZR_OPT_DISABLE      (1<<5)
 #define	  CM0_STC_EVICT_DISABLE_LRA_SNB	(1<<5)
drivers/gpu/drm/i915/intel_pm.c +2 -0
index a3e4f8b..f1800ca 100644
@@ -3385,6 +3385,8 @@ static void gen6_init_clock_gating(struct drm_device *dev)
 
 	I915_WRITE(CACHE_MODE_0,
 		   _MASKED_BIT_DISABLE(CM0_STC_EVICT_DISABLE_LRA_SNB));
+	I915_WRITE(CACHE_MODE_0,
+		   _MASKED_BIT_ENABLE(CM0_RC_PIPELINE_FLUSH_DISABLE));
 
 	I915_WRITE(GEN6_UCGCTL1,
 		   I915_READ(GEN6_UCGCTL1) |
Signature · 1 line
1.7.12.2
#2 lore raw

PATCH 3/4 drm/i915: ILK also needs that last fix

In reply to Ben Widawsky

That fix was the disable render deptch cache pipeline flush

---
 drivers/gpu/drm/i915/intel_pm.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/gpu/drm/i915/intel_pm.c +2 -0
index f1800ca..8aafa45 100644
@@ -3338,6 +3338,8 @@ static void ironlake_init_clock_gating(struct drm_device *dev)
 	I915_WRITE(WM2_LP_ILK, 0);
 	I915_WRITE(WM1_LP_ILK, 0);
 
+	I915_WRITE(CACHE_MODE_0,
+		   _MASKED_BIT_ENABLE(CM0_RC_PIPELINE_FLUSH_DISABLE));
 	/*
 	 * Based on the document from hardware guys the following bits
 	 * should be set unconditionally in order to enable FBC.
Signature · 1 line
1.7.12.2
#3 lore raw

Re: [PATCH 3/4] drm/i915: ILK also needs that last fix

Quoted 3 lines · Ben Widawsky

That fix was the disable render deptch cache pipeline flush

I've stumbled over the same one, but my docs here suggest i965g/gm45 need it, too:

http://cgit.freedesktop.org/~danvet/drm/commit/?h=ilk-wa-pile&id=37c4c82b8cdbcf5adccad97f0b45747ba37ed659

Have you checked whether we don't need this on ivb/vlv/hsw, too?

Also, for w/a patches based on the vpg w/a database, please include the vpg w/a name tag both in the commit message and in a code comment somewhere.
-Daniel

Quoted 24 lines
---
 drivers/gpu/drm/i915/intel_pm.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/gpu/drm/i915/intel_pm.c +2 -0
index f1800ca..8aafa45 100644
@@ -3338,6 +3338,8 @@ static void ironlake_init_clock_gating(struct drm_device *dev)
 	I915_WRITE(WM2_LP_ILK, 0);
 	I915_WRITE(WM1_LP_ILK, 0);
 
+	I915_WRITE(CACHE_MODE_0,
+		   _MASKED_BIT_ENABLE(CM0_RC_PIPELINE_FLUSH_DISABLE));
 	/*
 	 * Based on the document from hardware guys the following bits
 	 * should be set unconditionally in order to enable FBC.
Signature · 6 lines
1.7.12.2

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
#4 lore raw

Re: [PATCH 3/4] drm/i915: ILK also needs that last fix

Quoted 11 lines · On Mon, 15 Oct 2012 20:59:22 +0200 Daniel Vetter <[email protected]> wrote:
Quoted 3 lines · Ben Widawsky

That fix was the disable render deptch cache pipeline flush

I've stumbled over the same one, but my docs here suggest i965g/gm45 need it, too:

http://cgit.freedesktop.org/~danvet/drm/commit/?h=ilk-wa-pile&id=37c4c82b8cdbcf5adccad97f0b45747ba37ed659

Have you checked whether we don't need this on ivb/vlv/hsw, too?

I did check whether the windows driver does it for those platforms, and the answer is no. So the answer to your question is maybe because who knows what exists in some other doc somewhere in the metaverse. I think this is a good enough start though since it seems SNB was definitely a bit buggier than IVB.

Quoted 4 lines

Also, for w/a patches based on the vpg w/a database, please include the vpg w/a name tag both in the commit message and in a code comment somewhere.

Good idea. If you're okay with longer commit message subjects, I'd even suggest putting it there to make it even a bit easier to search for.

Quoted 27 lines

-Daniel

Quoted 25 lines
---
 drivers/gpu/drm/i915/intel_pm.c | 2 ++
 1 file changed, 2 insertions(+)
(quoted diff) +0 -0

b/drivers/gpu/drm/i915/intel_pm.c index f1800ca..8aafa45 100644

drivers/gpu/drm/i915/intel_pm.c +2 -0
@@ -3338,6 +3338,8 @@ static void ironlake_init_clock_gating(struct
 drm_device *dev) I915_WRITE(WM2_LP_ILK, 0);
 	I915_WRITE(WM1_LP_ILK, 0);
 
+	I915_WRITE(CACHE_MODE_0,
+

_MASKED_BIT_ENABLE(CM0_RC_PIPELINE_FLUSH_DISABLE)); /*
* Based on the document from hardware guys the following
bits
* should be set unconditionally in order to enable FBC.

Signature · 6 lines
1.7.12.2

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

Re: [PATCH 3/4] drm/i915: ILK also needs that last fix

Quoted 13 lines · Ben Widawsky
Quoted 10 lines · On Mon, 15 Oct 2012 20:59:22 +0200 Daniel Vetter <[email protected]> wrote:
Quoted 3 lines · Ben Widawsky

That fix was the disable render deptch cache pipeline flush

I've stumbled over the same one, but my docs here suggest i965g/gm45 need it, too:

http://cgit.freedesktop.org/~danvet/drm/commit/?h=ilk-wa-pile&id=37c4c82b8cdbcf5adccad97f0b45747ba37ed659

Quoted 7 lines
Quoted 1 line

Have you checked whether we don't need this on ivb/vlv/hsw, too?

I did check whether the windows driver does it for those platforms, and the answer is no. So the answer to your question is maybe because who knows what exists in some other doc somewhere in the metaverse. I think this is a good enough start though since it seems SNB was definitely a bit buggier than IVB.

Yeah, I've noticed while checking w/as that they're not consistently named on older platforms. E.g. the above definitely exists on eaglelake, too, but named slightly different. So the w/a db doesn't pick up all uses. Hoooray!

Quoted 6 lines
Quoted 3 lines

Also, for w/a patches based on the vpg w/a database, please include the vpg w/a name tag both in the commit message and in a code comment somewhere.

Good idea. If you're okay with longer commit message subjects, I'd even suggest putting it there to make it even a bit easier to search for.

Yeah, I'm fine with putting it into the commit head, I've put it there myself. If the w/a only affects one platform we could try to squeeze the platform name into the headline, too. But having to read the commit message for that doesn't really hurt, either.
-Daniel

Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
#6 lore raw

PATCH 4/4 drm/i915: Fix GT_MODE default value

In reply to Ben Widawsky

I can't even find how I figured this might be needed anymore. But sure enough, the value I'm reading back on platforms doesn't match what the docs recommends.

It seemed to fix Chris' GT1 in limited testing as well.

---
 drivers/gpu/drm/i915/i915_reg.h | 3 +++
 drivers/gpu/drm/i915/intel_pm.c | 5 +++++
 2 files changed, 8 insertions(+)
drivers/gpu/drm/i915/i915_reg.h +3 -0
index 37e62e0..4c1f461 100644
@@ -531,6 +531,9 @@
 # define VS_TIMER_DISPATCH				(1 << 6)
 # define MI_FLUSH_ENABLE				(1 << 12)
 
+#define GEN6_GT_MODE	0x20d0
+#define   GEN6_GT_MODE_HI	(1 << 9)
+
 #define GFX_MODE	0x02520
 #define GFX_MODE_GEN7	0x0229c
 #define RING_MODE_GEN7(ring)	((ring)->mmio_base+0x29c)
drivers/gpu/drm/i915/intel_pm.c +5 -0
index 8aafa45..e0574f9 100644
@@ -3446,6 +3446,11 @@ static void gen6_init_clock_gating(struct drm_device *dev)
 			   DISPPLANE_TRICKLE_FEED_DISABLE);
 		intel_flush_display_plane(dev_priv, pipe);
 	}
+
+	/* The default value should be 0x200 according to docs, but the two
+	 * platforms I checked have a 0 for this. (Maybe BIOS overrides?) */
+	I915_WRITE(GEN6_GT_MODE, _MASKED_BIT_DISABLE(0xffff));
+	I915_WRITE(GEN6_GT_MODE, _MASKED_BIT_ENABLE(GEN6_GT_MODE_HI));
 }
 
 static void gen7_setup_fixed_func_scheduler(struct drm_i915_private *dev_priv)
Signature · 1 line
1.7.12.2
#7 lore raw

Re: [PATCH 4/4] drm/i915: Fix GT_MODE default value

Quoted 7 lines · Ben Widawsky

I can't even find how I figured this might be needed anymore. But sure enough, the value I'm reading back on platforms doesn't match what the docs recommends.

It seemed to fix Chris' GT1 in limited testing as well.

Merged to -fixes, with the missing sob line forged. -Daniel

Quoted 42 lines
---
 drivers/gpu/drm/i915/i915_reg.h | 3 +++
 drivers/gpu/drm/i915/intel_pm.c | 5 +++++
 2 files changed, 8 insertions(+)
drivers/gpu/drm/i915/i915_reg.h +3 -0
index 37e62e0..4c1f461 100644
@@ -531,6 +531,9 @@
 # define VS_TIMER_DISPATCH				(1 << 6)
 # define MI_FLUSH_ENABLE				(1 << 12)
 
+#define GEN6_GT_MODE	0x20d0
+#define   GEN6_GT_MODE_HI	(1 << 9)
+
 #define GFX_MODE	0x02520
 #define GFX_MODE_GEN7	0x0229c
 #define RING_MODE_GEN7(ring)	((ring)->mmio_base+0x29c)
drivers/gpu/drm/i915/intel_pm.c +5 -0
index 8aafa45..e0574f9 100644
@@ -3446,6 +3446,11 @@ static void gen6_init_clock_gating(struct drm_device *dev)
 			   DISPPLANE_TRICKLE_FEED_DISABLE);
 		intel_flush_display_plane(dev_priv, pipe);
 	}
+
+	/* The default value should be 0x200 according to docs, but the two
+	 * platforms I checked have a 0 for this. (Maybe BIOS overrides?) */
+	I915_WRITE(GEN6_GT_MODE, _MASKED_BIT_DISABLE(0xffff));
+	I915_WRITE(GEN6_GT_MODE, _MASKED_BIT_ENABLE(GEN6_GT_MODE_HI));
 }
 
 static void gen7_setup_fixed_func_scheduler(struct drm_i915_private *dev_priv)
Signature · 6 lines
1.7.12.2

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
#8 lore raw
In reply to Ben Widawsky
Quoted 6 lines · Ben Widawsky

This is already achieved in init_clock gating, and is probably the result of a bad merge from Daniel. I'm too tired to bet on him making a mistake though.

Citing from the commit message that added this 2nd copy that you've just removed:

"This cannot be done in gen6_init_clock_gating with most of the other workaround bits; the render ring needs to exist. Otherwise, the register write gets dropped on the floor (one printk will show it changed, but a second printk immediately following shows the value reverts to the old one)."

Congrats, you've removed the wrong copy ;-)

Now I suspect not all of the w/a patches currently floating have seen level of testing, and I'd wager a few suffer from the same. So I think we need checks in i-g-t. Eric has started this with the intel_reg_checker tool, but we lack an aweful lot of recent workarounds. Also, we need to integrate a call to this tool in the testsuite, once at least at the beginning somewhere (to check boot-up state) but also in ZZ_hangman (in case the reset botched things up). We really should add a suspend/resume testcase in there, too ...

Cheers, Daniel

Quoted 26 lines
---
 drivers/gpu/drm/i915/intel_ringbuffer.c | 8 --------
 1 file changed, 8 deletions(-)
drivers/gpu/drm/i915/intel_ringbuffer.c +0 -8
index 984a0c5..625a348 100644
@@ -521,14 +521,6 @@ static int init_render_ring(struct intel_ring_buffer *ring)
 	}
 
 	if (IS_GEN6(dev)) {
-		/* From the Sandybridge PRM, volume 1 part 3, page 24:
-		 * "If this bit is set, STCunit will have LRA as replacement
-		 *  policy. [...] This bit must be reset.  LRA replacement
-		 *  policy is not supported."
-		 */
-		I915_WRITE(CACHE_MODE_0,
-			   _MASKED_BIT_DISABLE(CM0_STC_EVICT_DISABLE_LRA_SNB));
-
 		/* This is not explicitly set for GEN6, so read the register.
 		 * see intel_ring_mi_set_context() for why we care.
 		 * TODO: consider explicitly setting the bit for GEN5
Signature · 1 line
1.7.12.2
Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
#9 lore raw
Quoted 11 lines · On Thu, 4 Oct 2012 09:01:17 +0200 Daniel Vetter <[email protected]> wrote:
Quoted 6 lines · Ben Widawsky

This is already achieved in init_clock gating, and is probably the result of a bad merge from Daniel. I'm too tired to bet on him making a mistake though.

Citing from the commit message that added this 2nd copy that you've just removed:

Quoted 7 lines

"This cannot be done in gen6_init_clock_gating with most of the other workaround bits; the render ring needs to exist. Otherwise, the register write gets dropped on the floor (one printk will show it changed, but a second printk immediately following shows the value reverts to the old one)."

Congrats, you've removed the wrong copy ;-)

Would you be willing to verify this again? There is some interesting information in the bspec that leads me to believe you've jumped to the wrong conclusion regarding whether or not the render ring needs to exist (I think there are other preconditions that I can workaround a bit better).

Quoted 3 lines

Now I suspect not all of the w/a patches currently floating have seen level of testing, and I'd wager a few suffer from the same.

Just to clarify a bit here: I don't have an SNB here with me, so the patches themselves were only booted with an IVB. I didn't test the ILK patch at all because I don't have one to test with also. I did test patch 2, and 4 on Jesse's machine (1 is obviously not testable without the kernel actually running)

Quoted 8 lines

So I think we
need checks in i-g-t. Eric has started this with the intel_reg_checker tool, but we lack an aweful lot of recent workarounds. Also, we need to integrate a call to this tool in the testsuite, once at least at the beginning somewhere (to check boot-up state) but also in ZZ_hangman (in case the reset botched things up). We really should add a suspend/resume testcase in there, too ...

I'll leave this discussion to the mail thread started on patch 10.

Quoted 29 lines

Cheers, Daniel

Quoted 26 lines
---
 drivers/gpu/drm/i915/intel_ringbuffer.c | 8 --------
 1 file changed, 8 deletions(-)
drivers/gpu/drm/i915/intel_ringbuffer.c +0 -8
index 984a0c5..625a348 100644
@@ -521,14 +521,6 @@ static int init_render_ring(struct intel_ring_buffer *ring)
 	}
 
 	if (IS_GEN6(dev)) {
-		/* From the Sandybridge PRM, volume 1 part 3, page 24:
-		 * "If this bit is set, STCunit will have LRA as replacement
-		 *  policy. [...] This bit must be reset.  LRA replacement
-		 *  policy is not supported."
-		 */
-		I915_WRITE(CACHE_MODE_0,
-			   _MASKED_BIT_DISABLE(CM0_STC_EVICT_DISABLE_LRA_SNB));
-
 		/* This is not explicitly set for GEN6, so read the register.
 		 * see intel_ring_mi_set_context() for why we care.
 		 * TODO: consider explicitly setting the bit for GEN5
Signature · 1 line
1.7.12.2
Signature · 1 line
Ben Widawsky, Intel Open Source Technology Center
#10 lore raw
In reply to Daniel Vetter
Quoted 11 lines · On Thu, 4 Oct 2012 09:01:17 +0200 Daniel Vetter <[email protected]> wrote:
Quoted 6 lines · Ben Widawsky

This is already achieved in init_clock gating, and is probably the result of a bad merge from Daniel. I'm too tired to bet on him making a mistake though.

Citing from the commit message that added this 2nd copy that you've just removed:

Quoted 7 lines

"This cannot be done in gen6_init_clock_gating with most of the other workaround bits; the render ring needs to exist. Otherwise, the register write gets dropped on the floor (one printk will show it changed, but a second printk immediately following shows the value reverts to the old one)."

Congrats, you've removed the wrong copy ;-)

On further thought, I think we need to investigate the original issue here more anyway. I've been speaking with Ken, and neither of us really understand why the later write is required (it seems he authored the original patch). I think we all agree we'd like to jam these kind of workarounds into the clock gating functions (even though that is now a terrible name for it). Ken has tried this patch locally, and it works fine.

It seems Matt Turner has the original machine, so it'd be great if he can test this patch. Matt this is the t420s you got from Ken.

Quoted 39 lines

Now I suspect not all of the w/a patches currently floating have seen level of testing, and I'd wager a few suffer from the same. So I think we need checks in i-g-t. Eric has started this with the intel_reg_checker tool, but we lack an aweful lot of recent workarounds. Also, we need to integrate a call to this tool in the testsuite, once at least at the beginning somewhere (to check boot-up state) but also in ZZ_hangman (in case the reset botched things up). We really should add a suspend/resume testcase in there, too ...

Cheers, Daniel

Quoted 26 lines
---
 drivers/gpu/drm/i915/intel_ringbuffer.c | 8 --------
 1 file changed, 8 deletions(-)
drivers/gpu/drm/i915/intel_ringbuffer.c +0 -8
index 984a0c5..625a348 100644
@@ -521,14 +521,6 @@ static int init_render_ring(struct intel_ring_buffer *ring)
 	}
 
 	if (IS_GEN6(dev)) {
-		/* From the Sandybridge PRM, volume 1 part 3, page 24:
-		 * "If this bit is set, STCunit will have LRA as replacement
-		 *  policy. [...] This bit must be reset.  LRA replacement
-		 *  policy is not supported."
-		 */
-		I915_WRITE(CACHE_MODE_0,
-			   _MASKED_BIT_DISABLE(CM0_STC_EVICT_DISABLE_LRA_SNB));
-
 		/* This is not explicitly set for GEN6, so read the register.
 		 * see intel_ring_mi_set_context() for why we care.
 		 * TODO: consider explicitly setting the bit for GEN5
Signature · 1 line
1.7.12.2
Signature · 1 line
Ben Widawsky, Intel Open Source Technology Center