intel-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drm/i915: Configure GPU PM in ->suspend() if not configured
@ 2018-03-19 10:15 Rushikesh S Kadam
  2018-03-19 10:33 ` Chris Wilson
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Rushikesh S Kadam @ 2018-03-19 10:15 UTC (permalink / raw)
  To: rodrigo.vivi, joonas.lahtinen, jani.nikula
  Cc: jianxun.zhang, rushikesh.s.kadam, intel-gfx

The patch implements workaround for a scenario, where the GPU Power
Management, if not configured prior to platform suspend entry, will block
SoC S0ix entry in suspend-to-idle.

Typically the GPU Power Management configuration is restored after a
platform suspend cycle, in the drm ioclts callbacks (such as ioclt
I915_GEM_EXECBUFFER2_WR).

There exists a corner case - if the next platform suspend cycle is
initiated quickly, before the ioctl callbacks are triggered, the GPU
Power Management is not setup at the time of suspend entry.

In such as scenario, the GPU does not enter low power state (RC6), which in
turn prevents the SoC from entering low power package state (PC2 or
deeper). This blocks SoC S0ix entry in suspend-to-idle.

The patch detects such a condition and works around by configuring GPU
Power Management in i915 driver's ->suspend().

Signed-off-by: Rushikesh S Kadam <rushikesh.s.kadam@intel.com>
---
 drivers/gpu/drm/i915/i915_drv.c | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index f03555e..9f3cc4c 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -2076,6 +2076,7 @@ static int i915_pm_suspend(struct device *kdev)
 {
 	struct pci_dev *pdev = to_pci_dev(kdev);
 	struct drm_device *dev = pci_get_drvdata(pdev);
+	struct drm_i915_private *dev_priv = to_i915(dev);
 
 	if (!dev) {
 		dev_err(kdev, "DRM not initialized, aborting suspend.\n");
@@ -2085,6 +2086,31 @@ static int i915_pm_suspend(struct device *kdev)
 	if (dev->switch_power_state == DRM_SWITCH_POWER_OFF)
 		return 0;
 
+	/*
+	 * Implement workaround for a scenario, where the GPU Power
+	 * Management, if not configured prior to platform suspend
+	 * entry, will block SoC S0ix entry in suspend-to-idle.
+	 *
+	 * Typically the GPU Power Management configuration is
+	 * restored in drm runtime / ioclts callbacks (such as
+	 * I915_GEM_EXECBUFFER2_WR) after the platform has resumed
+	 * from a suspend cycle.
+	 *
+	 * There exists a corner case - if the next platform suspend
+	 * cycle is initiated quickly, before the runtime callbacks
+	 * are triggered, the GPU Power Management is not configured
+	 * at time of suspend entry. This blocks SoC S0ix entry in
+	 * suspend-to-idle
+	 *
+	 * Detect such a condition, and workaround by configuring the
+	 * GPU Power Management here.
+	 */
+	if (INTEL_GEN(dev_priv) >= 9 &&
+	    (!(I915_READ(GEN6_RC_CONTROL) & GEN6_RC_CTL_HW_ENABLE))) {
+		DRM_INFO("Detected GPU PM is not configured! Configure now.\n");
+		intel_enable_gt_powersave(dev_priv);
+	}
+
 	return i915_drm_suspend(dev);
 }
 
-- 
1.9.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-03-19 11:47 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-03-19 10:15 [PATCH] drm/i915: Configure GPU PM in ->suspend() if not configured Rushikesh S Kadam
2018-03-19 10:33 ` Chris Wilson
2018-03-19 10:41 ` ✓ Fi.CI.BAT: success for " Patchwork
2018-03-19 11:47 ` ✗ Fi.CI.IGT: warning " Patchwork

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).