Skip to contentSkip to conversation

drm/i915: call lpt_init_clock_gating on BDW too

PATCH In review Paulo Zanoni 3 participants 10 messages Aug 21, 2014 – Aug 26, 2014

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

PATCH 1/3 drm/i915: call lpt_init_clock_gating on BDW too

From: Paulo Zanoni <[email protected]>

Because BDW has WPT, which is equivalent to LPT. This is just like the CPT/PPT case.

---
 drivers/gpu/drm/i915/intel_pm.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/gpu/drm/i915/intel_pm.c +2 -0
index c8f744c..b3e948f 100644
@@ -5595,6 +5595,8 @@ static void gen8_init_clock_gating(struct drm_device *dev)
 	/* Wa4x4STCOptimizationDisable:bdw */
 	I915_WRITE(CACHE_MODE_1,
 		   _MASKED_BIT_ENABLE(GEN8_4x4_STC_OPTIMIZATION_DISABLE));
+
+	lpt_init_clock_gating(dev);
 }
 
 static void haswell_init_clock_gating(struct drm_device *dev)
Signature · 1 line
2.0.1
#1 lore raw

PATCH 2/3 drm/i915: rename gen8_init_clock_gating to broadwell_init_clock_gating

From: Paulo Zanoni <[email protected]>

Because CHV uses cherryview_init_clock_gating instead of gen8_init_clock_gating.

---
 drivers/gpu/drm/i915/intel_pm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

I really wish we were using the three-letter-acronyms instead of the full names on the functions. If I send another patch renaming everything, will anybody complain?

drivers/gpu/drm/i915/intel_pm.c +2 -2
index b3e948f..35495fc 100644
@@ -5502,7 +5502,7 @@ static void lpt_suspend_hw(struct drm_device *dev)
 	}
 }
 
-static void gen8_init_clock_gating(struct drm_device *dev)
+static void broadwell_init_clock_gating(struct drm_device *dev)
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;
 	enum pipe pipe;
@@ -7251,7 +7251,7 @@ void intel_init_pm(struct drm_device *dev)
 		else if (IS_HASWELL(dev))
 			dev_priv->display.init_clock_gating = haswell_init_clock_gating;
 		else if (INTEL_INFO(dev)->gen == 8)
-			dev_priv->display.init_clock_gating = gen8_init_clock_gating;
+			dev_priv->display.init_clock_gating = broadwell_init_clock_gating;
 	} else if (IS_CHERRYVIEW(dev)) {
 		dev_priv->display.update_wm = cherryview_update_wm;
 		dev_priv->display.update_sprite_wm = valleyview_update_sprite_wm;
Signature · 1 line
2.0.1
Reviewed-by on v1 2/3
#2 lore raw

Re: [PATCH 2/3] drm/i915: rename gen8_init_clock_gating to broadwell_init_clock_gating

Quoted 6 lines · Paulo Zanoni

From: Paulo Zanoni <[email protected]>

Because CHV uses cherryview_init_clock_gating instead of gen8_init_clock_gating.

Signature · 1 line
Damien
Quoted 37 lines
---
 drivers/gpu/drm/i915/intel_pm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

I really wish we were using the three-letter-acronyms instead of the full names on the functions. If I send another patch renaming everything, will anybody complain?

drivers/gpu/drm/i915/intel_pm.c +2 -2
index b3e948f..35495fc 100644
@@ -5502,7 +5502,7 @@ static void lpt_suspend_hw(struct drm_device *dev)
 	}
 }
 
-static void gen8_init_clock_gating(struct drm_device *dev)
+static void broadwell_init_clock_gating(struct drm_device *dev)
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;
 	enum pipe pipe;
@@ -7251,7 +7251,7 @@ void intel_init_pm(struct drm_device *dev)
 		else if (IS_HASWELL(dev))
 			dev_priv->display.init_clock_gating = haswell_init_clock_gating;
 		else if (INTEL_INFO(dev)->gen == 8)
-			dev_priv->display.init_clock_gating = gen8_init_clock_gating;
+			dev_priv->display.init_clock_gating = broadwell_init_clock_gating;
 	} else if (IS_CHERRYVIEW(dev)) {
 		dev_priv->display.update_wm = cherryview_update_wm;
 		dev_priv->display.update_sprite_wm = valleyview_update_sprite_wm;
Signature · 6 lines
2.0.1

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

PATCH 3/3 drm/i915: send PCI_D3hot adapter opregion message on BDW RPM suspend

In reply to Paulo Zanoni

From: Paulo Zanoni <[email protected]>

On BDW we're seeing a problem that after we runtime resume, the outputs connected to DDI C are not detected: they don't appear in the SDEISR register and GMBUS transactions don't work. They stop working at the moment we call intel_opregion_notify_adapter() during runtime suspend, but they don't go back to work when we call the same function during runtime resume. They only work after we do a modeset and call intel_opregion_notify_encoder(), but this point is already too late.

While debugging, I tried to pass PCI_D3hot which is the value that matches the spec, and it seems to have solved the problem. I couldn't find any explanation of why this solves the problem, but there's also no documented explanation - besides our code and git log - of why Haswell should use PCI_D1, so keep this for now in order to keep BDW runtime PM working.

Also add a comment to point the fact that there's no spec documenting all the weirdness involved here.

Cc: [email protected]
Testcase: igt/pm_rpm/drm-resources-equal
Testcase: igt/pm_rpm/i2c

---
 drivers/gpu/drm/i915/i915_drv.c | 28 ++++++++++++++++++++++------
 1 file changed, 22 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/i915_drv.c +22 -6
index 2dcc0d8..6f0c95f 100644
@@ -1455,13 +1455,29 @@ static int intel_runtime_suspend(struct device *device)
 	dev_priv->pm.suspended = true;
 
 	/*
-	 * current versions of firmware which depend on this opregion
-	 * notification have repurposed the D1 definition to mean
-	 * "runtime suspended" vs. what you would normally expect (D3)
-	 * to distinguish it from notifications that might be sent
-	 * via the suspend path.
+	 * FIXME: We really should find a document that references the arguments
+	 * used below!
 	 */
-	intel_opregion_notify_adapter(dev, PCI_D1);
+	if (IS_HASWELL(dev)) {
+		/*
+		 * current versions of firmware which depend on this opregion
+		 * notification have repurposed the D1 definition to mean
+		 * "runtime suspended" vs. what you would normally expect (D3)
+		 * to distinguish it from notifications that might be sent via
+		 * the suspend path.
+		 */
+		intel_opregion_notify_adapter(dev, PCI_D1);
+	} else {
+		/*
+		 * On Broadwell, if we use PCI_D1 the PCH DDI ports will stop
+		 * being detected, and the call we do at intel_runtime_resume()
+		 * won't be able to restore them. Since PCI_D3hot matches the
+		 * actual specification and appears to be working, use it. Let's
+		 * assume the other non-Haswell platforms will stay the same as
+		 * Broadwell.
+		 */
+		intel_opregion_notify_adapter(dev, PCI_D3hot);
+	}
 
 	DRM_DEBUG_KMS("Device suspended\n");
 	return 0;
Signature · 1 line
2.0.1
Reviewed-by on v1 3/3
#4 lore raw

Re: [PATCH 3/3] drm/i915: send PCI_D3hot adapter opregion message on BDW RPM suspend

Quoted 17 lines · Paulo Zanoni

From: Paulo Zanoni <[email protected]>

On BDW we're seeing a problem that after we runtime resume, the outputs connected to DDI C are not detected: they don't appear in the SDEISR register and GMBUS transactions don't work. They stop working at the moment we call intel_opregion_notify_adapter() during runtime suspend, but they don't go back to work when we call the same function during runtime resume. They only work after we do a modeset and call intel_opregion_notify_encoder(), but this point is already too late.

While debugging, I tried to pass PCI_D3hot which is the value that matches the spec, and it seems to have solved the problem. I couldn't find any explanation of why this solves the problem, but there's also no documented explanation - besides our code and git log - of why Haswell should use PCI_D1, so keep this for now in order to keep BDW runtime PM working.

Quoted 7 lines

Also add a comment to point the fact that there's no spec documenting all the weirdness involved here.

Cc: [email protected]
Testcase: igt/pm_rpm/drm-resources-equal
Testcase: igt/pm_rpm/i2c

There's still investigation to understand what the firmware is doing behind our backs, but the change looks likely to be correct and fixes the problem at hand so:

Signature · 1 line
Damien
Quoted 51 lines
---
 drivers/gpu/drm/i915/i915_drv.c | 28 ++++++++++++++++++++++------
 1 file changed, 22 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/i915_drv.c +22 -6
index 2dcc0d8..6f0c95f 100644
@@ -1455,13 +1455,29 @@ static int intel_runtime_suspend(struct device *device)
 	dev_priv->pm.suspended = true;
 
 	/*
-	 * current versions of firmware which depend on this opregion
-	 * notification have repurposed the D1 definition to mean
-	 * "runtime suspended" vs. what you would normally expect (D3)
-	 * to distinguish it from notifications that might be sent
-	 * via the suspend path.
+	 * FIXME: We really should find a document that references the arguments
+	 * used below!
 	 */
-	intel_opregion_notify_adapter(dev, PCI_D1);
+	if (IS_HASWELL(dev)) {
+		/*
+		 * current versions of firmware which depend on this opregion
+		 * notification have repurposed the D1 definition to mean
+		 * "runtime suspended" vs. what you would normally expect (D3)
+		 * to distinguish it from notifications that might be sent via
+		 * the suspend path.
+		 */
+		intel_opregion_notify_adapter(dev, PCI_D1);
+	} else {
+		/*
+		 * On Broadwell, if we use PCI_D1 the PCH DDI ports will stop
+		 * being detected, and the call we do at intel_runtime_resume()
+		 * won't be able to restore them. Since PCI_D3hot matches the
+		 * actual specification and appears to be working, use it. Let's
+		 * assume the other non-Haswell platforms will stay the same as
+		 * Broadwell.
+		 */
+		intel_opregion_notify_adapter(dev, PCI_D3hot);
+	}
 
 	DRM_DEBUG_KMS("Device suspended\n");
 	return 0;
Signature · 6 lines
2.0.1

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

Re: [PATCH 3/3] drm/i915: send PCI_D3hot adapter opregion message on BDW RPM suspend

Quoted 26 lines · Damien Lespiau
Quoted 17 lines · Paulo Zanoni

From: Paulo Zanoni <[email protected]>

On BDW we're seeing a problem that after we runtime resume, the outputs connected to DDI C are not detected: they don't appear in the SDEISR register and GMBUS transactions don't work. They stop working at the moment we call intel_opregion_notify_adapter() during runtime suspend, but they don't go back to work when we call the same function during runtime resume. They only work after we do a modeset and call intel_opregion_notify_encoder(), but this point is already too late.

While debugging, I tried to pass PCI_D3hot which is the value that matches the spec, and it seems to have solved the problem. I couldn't find any explanation of why this solves the problem, but there's also no documented explanation - besides our code and git log - of why Haswell should use PCI_D1, so keep this for now in order to keep BDW runtime PM working.

Quoted 7 lines

Also add a comment to point the fact that there's no spec documenting all the weirdness involved here.

Cc: [email protected]
Testcase: igt/pm_rpm/drm-resources-equal
Testcase: igt/pm_rpm/i2c

Quoted 49 lines

There's still investigation to understand what the firmware is doing behind our backs, but the change looks likely to be correct and fixes the problem at hand so:

Signature · 1 line
Damien
Quoted 30 lines
---
 drivers/gpu/drm/i915/i915_drv.c | 28 ++++++++++++++++++++++------
 1 file changed, 22 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/i915_drv.c +11 -6
index 2dcc0d8..6f0c95f 100644
@@ -1455,13 +1455,29 @@ static int intel_runtime_suspend(struct device *device)
 	dev_priv->pm.suspended = true;
 
 	/*
-	 * current versions of firmware which depend on this opregion
-	 * notification have repurposed the D1 definition to mean
-	 * "runtime suspended" vs. what you would normally expect (D3)
-	 * to distinguish it from notifications that might be sent
-	 * via the suspend path.
+	 * FIXME: We really should find a document that references the arguments
+	 * used below!
 	 */
-	intel_opregion_notify_adapter(dev, PCI_D1);
+	if (IS_HASWELL(dev)) {
+		/*
+		 * current versions of firmware which depend on this opregion
+		 * notification have repurposed the D1 definition to mean
+		 * "runtime suspended" vs. what you would normally expect (D3)
+		 * to distinguish it from notifications that might be sent via
+		 * the suspend path.
+		 */
+		intel_opregion_notify_adapter(dev, PCI_D1);

drivers/gpu/drm/i915/i915_drv.c static int intel_runtime_suspend(struct device *device) · line 1479

Quoted 10 lines
drivers/gpu/drm/i915/i915_drv.c +10 -0
+	} else {
+		/*
+		 * On Broadwell, if we use PCI_D1 the PCH DDI ports will stop
+		 * being detected, and the call we do at intel_runtime_resume()
+		 * won't be able to restore them. Since PCI_D3hot matches the
+		 * actual specification and appears to be working, use it. Let's
+		 * assume the other non-Haswell platforms will stay the same as
+		 * Broadwell.
+		 */
+		intel_opregion_notify_adapter(dev, PCI_D3hot);

I guess we could start to open betting pools whether this will grow until we have all the pci states or not ;-)

Anyway, all 3 patches merged to dinq, thanks.
-Daniel

Quoted 15 lines
Quoted 11 lines
drivers/gpu/drm/i915/i915_drv.c +1 -0
+	}
 
 	DRM_DEBUG_KMS("Device suspended\n");
 	return 0;
Signature · 6 lines
2.0.1

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

_______________________________________________
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
Reviewed-by on v1 1/3
#6 lore raw
In reply to Paulo Zanoni
Quoted 6 lines · Paulo Zanoni

From: Paulo Zanoni <[email protected]>

Because BDW has WPT, which is equivalent to LPT. This is just like the CPT/PPT case.

Maybe we should mention that Satheesh suggested the change with a:

Signature · 1 line
Damien
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 c8f744c..b3e948f 100644
@@ -5595,6 +5595,8 @@ static void gen8_init_clock_gating(struct drm_device *dev)
 	/* Wa4x4STCOptimizationDisable:bdw */
 	I915_WRITE(CACHE_MODE_1,
 		   _MASKED_BIT_ENABLE(GEN8_4x4_STC_OPTIMIZATION_DISABLE));
+
+	lpt_init_clock_gating(dev);
 }
 
 static void haswell_init_clock_gating(struct drm_device *dev)
Signature · 6 lines
2.0.1

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#7 lore raw
In reply to Paulo Zanoni
Quoted 6 lines · Paulo Zanoni

From: Paulo Zanoni <[email protected]>

Because BDW has WPT, which is equivalent to LPT. This is just like the CPT/PPT case.

It'd be probably good to have drm/i915/bdw: in the subject to ease back porting for product groups, and add those patches to a list someone maintains (Rodrigo?)

Signature · 1 line
Damien
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 c8f744c..b3e948f 100644
@@ -5595,6 +5595,8 @@ static void gen8_init_clock_gating(struct drm_device *dev)
 	/* Wa4x4STCOptimizationDisable:bdw */
 	I915_WRITE(CACHE_MODE_1,
 		   _MASKED_BIT_ENABLE(GEN8_4x4_STC_OPTIMIZATION_DISABLE));
+
+	lpt_init_clock_gating(dev);
 }
 
 static void haswell_init_clock_gating(struct drm_device *dev)
Signature · 6 lines
2.0.1

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#8 lore raw
Quoted 11 lines · Damien Lespiau
Quoted 6 lines · Paulo Zanoni

From: Paulo Zanoni <[email protected]>

Because BDW has WPT, which is equivalent to LPT. This is just like the CPT/PPT case.

It'd be probably good to have drm/i915/bdw: in the subject to ease back porting for product groups, and add those patches to a list someone maintains (Rodrigo?)

Forgotten your r-b tag or intentionally left blank? -Daniel

Quoted 32 lines
Signature · 2 lines
-- 
Damien
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 c8f744c..b3e948f 100644
@@ -5595,6 +5595,8 @@ static void gen8_init_clock_gating(struct drm_device *dev)
 	/* Wa4x4STCOptimizationDisable:bdw */
 	I915_WRITE(CACHE_MODE_1,
 		   _MASKED_BIT_ENABLE(GEN8_4x4_STC_OPTIMIZATION_DISABLE));
+
+	lpt_init_clock_gating(dev);
 }
 
 static void haswell_init_clock_gating(struct drm_device *dev)
Signature · 6 lines
2.0.1

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

_______________________________________________
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
#9 lore raw
Quoted 7 lines · Daniel Vetter
Quoted 6 lines · Damien Lespiau
Quoted 5 lines · Paulo Zanoni

From: Paulo Zanoni <[email protected]>

Because BDW has WPT, which is equivalent to LPT. This is just like the CPT/PPT case.

Quoted 7 lines
Quoted 5 lines
Quoted 1 line

It'd be probably good to have drm/i915/bdw: in the subject to ease back porting for product groups, and add those patches to a list someone maintains (Rodrigo?)

Forgotten your r-b tag or intentionally left blank?

It's in [email protected]

Signature · 1 line
Damien