Skip to contentSkip to conversation

Few SNB RC6 Init fixes

PATCH In review Rodrigo Vivi 2 participants 5 messages Apr 9, 2013 – Apr 10, 2013

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

cover Few SNB RC6 Init fixes

This series is an attempt to fix many hang bugs we have at SNB with RC6.
https://bugzilla.kernel.org/show_bug.cgi?id=43267

Reporter of this 43267 mentioned that one ugly patch of mine fixed his hangs. That patch was wrong and probably regressing some other stuff already fixed by Chris. At that patch there was also useless things like asking gpu to generate interrupts we don't process.

So my guess is that some or all of these 3 patches are fixing actual bugs. Manly the second and third one.

Rodrigo Vivi (3):
drm/i915: SNB RC6: Fix Turbo Disable.
drm/i915: RC6 Fix Write Min Frequency Table.
drm/i915: SNB RC6: Fix RP_CONTROL Init.

 drivers/gpu/drm/i915/i915_reg.h | 4 ++--
 drivers/gpu/drm/i915/intel_pm.c | 6 ++++--
 2 files changed, 6 insertions(+), 4 deletions(-)
Signature · 1 line
1.8.1.4
#1 lore raw

PATCH 1/3 drm/i915: SNB RC6: Fix Turbo Disable.

According to SNB GT PM Programming Guide Turbo, page 8, GEN6_RPNSWREQ (A008) bit [31] must be set as 0 meaning Turbo Disable.

---
 drivers/gpu/drm/i915/i915_reg.h | 2 +-
 drivers/gpu/drm/i915/intel_pm.c | 2 ++
 2 files changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_reg.h +1 -1
index 5e91fbb..fc4f542f 100644
@@ -4220,7 +4220,7 @@
 #define  GEN7_L3BANK2X_CLOCK_GATE_DISABLE	(1<<25)
 
 #define GEN6_RPNSWREQ				0xA008
-#define   GEN6_TURBO_DISABLE			(1<<31)
+#define   GEN6_TURBO_DISABLE			(0<<31)
 #define   GEN6_FREQUENCY(x)			((x)<<25)
 #define   HSW_FREQUENCY(x)			((x)<<24)
 #define   GEN6_OFFSET(x)			((x)<<19)
drivers/gpu/drm/i915/intel_pm.c +2 -0
index 27f94cd..e3ba13d 100644
@@ -2465,6 +2465,7 @@ void gen6_set_rps(struct drm_device *dev, u8 val)
 			   HSW_FREQUENCY(val));
 	else
 		I915_WRITE(GEN6_RPNSWREQ,
+			   GEN6_TURBO_DISABLE |
 			   GEN6_FREQUENCY(val) |
 			   GEN6_OFFSET(0) |
 			   GEN6_AGGRESSIVE_TURBO);
@@ -2612,6 +2613,7 @@ static void gen6_enable_rps(struct drm_device *dev)
 			   HSW_FREQUENCY(12));
 	} else {
 		I915_WRITE(GEN6_RPNSWREQ,
+			   GEN6_TURBO_DISABLE |
 			   GEN6_FREQUENCY(10) |
 			   GEN6_OFFSET(0) |
 			   GEN6_AGGRESSIVE_TURBO);
Signature · 1 line
1.8.1.4
#2 lore raw

PATCH 2/3 drm/i915: RC6 Fix Write Min Frequency Table.

In reply to Rodrigo Vivi

According to SNB GT PM Programming Guide page 9,
Write Min Frequency Table is 09h

---
 drivers/gpu/drm/i915/i915_reg.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_reg.h +1 -1
index fc4f542f..5dcc09e 100644
@@ -4305,7 +4305,7 @@
 #define GEN6_PCODE_MAILBOX			0x138124
 #define   GEN6_PCODE_READY			(1<<31)
 #define   GEN6_READ_OC_PARAMS			0xc
-#define   GEN6_PCODE_WRITE_MIN_FREQ_TABLE	0x8
+#define   GEN6_PCODE_WRITE_MIN_FREQ_TABLE	0x9
 #define   GEN6_PCODE_READ_MIN_FREQ_TABLE	0x9
 #define	  GEN6_PCODE_WRITE_RC6VIDS		0x4
 #define	  GEN6_PCODE_READ_RC6VIDS		0x5
Signature · 1 line
1.8.1.4
#3 lore raw

Re: [PATCH 2/3] drm/i915: RC6 Fix Write Min Frequency Table.

Quoted 2 lines · Rodrigo Vivi

According to SNB GT PM Programming Guide page 9,
Write Min Frequency Table is 09h

I think this is the winner of what workarounds the hang... (Since patch 3 is a no-op, patch 1 still reverts a change to the media turbo mode requested by VPG.)

The original code for this patch is correct, I have in the bspec:

0x8 WRITE_MIN_FREQ_TABLE
0x9 READ_MIN_FREQ_TABLE

So the effect of this patch is to undo the ring/uncore scaling with GPU frequency which will slow everything down and is less likely to provoke uncore death.
-Chris

Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
#4 lore raw

PATCH 3/3 drm/i915: SNB RC6: Fix RP_CONTROL Init.

In reply to Rodrigo Vivi

According to SNB GT PM Programming Guide page 8 RP_CONTROL (A024) must be set according this:
* bits [10:9] = 01 - Use Normal or Video Turbo frequency req.
* bits [2:0] = 010 - Down=Busy Min Average (EI)

---
 drivers/gpu/drm/i915/intel_pm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_pm.c +2 -2
index e3ba13d..d88e58c 100644
@@ -2634,11 +2634,11 @@ static void gen6_enable_rps(struct drm_device *dev)
 	I915_WRITE(GEN6_RP_IDLE_HYSTERSIS, 10);
 	I915_WRITE(GEN6_RP_CONTROL,
 		   GEN6_RP_MEDIA_TURBO |
-		   GEN6_RP_MEDIA_HW_NORMAL_MODE |
+		   GEN6_RP_MEDIA_HW_MODE |
 		   GEN6_RP_MEDIA_IS_GFX |
 		   GEN6_RP_ENABLE |
 		   GEN6_RP_UP_BUSY_AVG |
-		   (IS_HASWELL(dev) ? GEN7_RP_DOWN_IDLE_AVG : GEN6_RP_DOWN_IDLE_CONT));
+		   GEN7_RP_DOWN_IDLE_AVG);
 
 	ret = sandybridge_pcode_write(dev_priv, GEN6_PCODE_WRITE_MIN_FREQ_TABLE, 0);
 	if (!ret && (IS_GEN6(dev) || IS_IVYBRIDGE(dev))) {
Signature · 1 line
1.8.1.4