public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Imre Deak <imre.deak@intel.com>
To: intel-gfx@lists.freedesktop.org
Subject: [PATCH v2] drm/i915: fix suspend/resume for GENs w/o runtime PM support
Date: Tue, 26 Aug 2014 13:26:56 +0300	[thread overview]
Message-ID: <1409048816-9367-1-git-send-email-imre.deak@intel.com> (raw)
In-Reply-To: <1408357206-19511-1-git-send-email-imre.deak@intel.com>

Before sharing common parts between the system and runtime s/r
handlers we WARNed if the runtime s/r handlers were called on GENs that
didn't support RPM. But this WARN is not correct if the same handler is
called from the system s/r path, since that can happen on any platform.
This also broke system s/r on old platforms.

The issue was introduced in

commit 016970beb05da6285c2f3ed2bee1c676cb75972e
Author: Sagar Kamble <sagar.a.kamble@intel.com>
Date:   Wed Aug 13 23:07:06 2014 +0530

v2:
- remove the WARN and depend on the HAS_RUNTIME_PM check in
  rutime_suspend/resume instead (Daniel)

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=82751
Signed-off-by: Imre Deak <imre.deak@intel.com>
---
 drivers/gpu/drm/i915/i915_drv.c | 31 ++++++++++++++-----------------
 1 file changed, 14 insertions(+), 17 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index de1b664..b5fd1c5 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -1412,7 +1412,9 @@ static int intel_runtime_suspend(struct device *device)
 	if (WARN_ON_ONCE(!(dev_priv->rps.enabled && intel_enable_rc6(dev))))
 		return -ENODEV;
 
-	WARN_ON(!HAS_RUNTIME_PM(dev));
+	if (WARN_ON_ONCE(!HAS_RUNTIME_PM(dev)))
+		return -ENODEV;
+
 	assert_force_wake_inactive(dev_priv);
 
 	DRM_DEBUG_KMS("Suspending device\n");
@@ -1480,7 +1482,8 @@ static int intel_runtime_resume(struct device *device)
 	struct drm_i915_private *dev_priv = dev->dev_private;
 	int ret;
 
-	WARN_ON(!HAS_RUNTIME_PM(dev));
+	if (WARN_ON_ONCE(!HAS_RUNTIME_PM(dev)))
+		return -ENODEV;
 
 	DRM_DEBUG_KMS("Resuming device\n");
 
@@ -1515,16 +1518,12 @@ static int intel_suspend_complete(struct drm_i915_private *dev_priv)
 	struct drm_device *dev = dev_priv->dev;
 	int ret;
 
-	if (IS_GEN6(dev)) {
-		ret = 0;
-	} else if (IS_HASWELL(dev) || IS_BROADWELL(dev)) {
+	if (IS_HASWELL(dev) || IS_BROADWELL(dev))
 		ret = hsw_suspend_complete(dev_priv);
-	} else if (IS_VALLEYVIEW(dev)) {
+	else if (IS_VALLEYVIEW(dev))
 		ret = vlv_suspend_complete(dev_priv);
-	} else {
-		ret = -ENODEV;
-		WARN_ON(1);
-	}
+	else
+		ret = 0;
 
 	return ret;
 }
@@ -1540,16 +1539,14 @@ static int intel_resume_prepare(struct drm_i915_private *dev_priv,
 	struct drm_device *dev = dev_priv->dev;
 	int ret;
 
-	if (IS_GEN6(dev)) {
+	if (IS_GEN6(dev))
 		ret = snb_resume_prepare(dev_priv, rpm_resume);
-	} else if (IS_HASWELL(dev) || IS_BROADWELL(dev)) {
+	else if (IS_HASWELL(dev) || IS_BROADWELL(dev))
 		ret = hsw_resume_prepare(dev_priv, rpm_resume);
-	} else if (IS_VALLEYVIEW(dev)) {
+	else if (IS_VALLEYVIEW(dev))
 		ret = vlv_resume_prepare(dev_priv, rpm_resume);
-	} else {
-		WARN_ON(1);
-		ret = -ENODEV;
-	}
+	else
+		ret = 0;
 
 	return ret;
 }
-- 
1.8.4

  parent reply	other threads:[~2014-08-26 10:29 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-18 10:20 [PATCH] drm/i915: fix suspend/resume for GENs w/o runtime PM support Imre Deak
2014-08-19  2:52 ` Sagar Arun Kamble
2014-08-26  7:44 ` Daniel Vetter
2014-08-26  7:45   ` Daniel Vetter
2014-08-26  9:01     ` Imre Deak
2014-08-26 10:26 ` Imre Deak [this message]
2014-08-26 10:53   ` [PATCH v2] " Daniel Vetter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1409048816-9367-1-git-send-email-imre.deak@intel.com \
    --to=imre.deak@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox