public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Daniel Vetter <daniel@ffwll.ch>
To: Imre Deak <imre.deak@intel.com>
Cc: intel-gfx@lists.freedesktop.org, Sagar Kamble <sagar.a.kamble@intel.com>
Subject: Re: [PATCH] drm/i915: fix suspend/resume for GENs w/o runtime PM support
Date: Tue, 26 Aug 2014 09:44:42 +0200	[thread overview]
Message-ID: <20140826074442.GA15520@phenom.ffwll.local> (raw)
In-Reply-To: <1408357206-19511-1-git-send-email-imre.deak@intel.com>

On Mon, Aug 18, 2014 at 01:20:06PM +0300, Imre Deak wrote:
> 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
> 
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=82751
> Signed-off-by: Imre Deak <imre.deak@intel.com>

Adding boolean arguments to control warnings always feels a bit too much
like just shutting up the warnings. Can't we instead wrap the relevant
calls into HAS_RUNTIME_PM checks? Imo that would also lead to clearer code
by making the intention clear - with this you essentially have to git
blame to figure out why we sometimes disable the warning.
-Daniel

> ---
>  drivers/gpu/drm/i915/i915_drv.c | 18 ++++++++++--------
>  1 file changed, 10 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
> index 117f5c1..f646f34 100644
> --- a/drivers/gpu/drm/i915/i915_drv.c
> +++ b/drivers/gpu/drm/i915/i915_drv.c
> @@ -499,7 +499,8 @@ bool i915_semaphore_is_enabled(struct drm_device *dev)
>  }
>  
>  
> -static int intel_suspend_complete(struct drm_i915_private *dev_priv);
> +static int intel_suspend_complete(struct drm_i915_private *dev_priv,
> +				  bool rpm_suspend);
>  static int intel_resume_prepare(struct drm_i915_private *dev_priv,
>  				bool rpm_resume);
>  
> @@ -909,7 +910,7 @@ static int i915_pm_suspend_late(struct device *dev)
>  	if (drm_dev->switch_power_state == DRM_SWITCH_POWER_OFF)
>  		return 0;
>  
> -	ret = intel_suspend_complete(dev_priv);
> +	ret = intel_suspend_complete(dev_priv, false);
>  
>  	if (ret)
>  		DRM_ERROR("Suspend complete failed: %d\n", ret);
> @@ -1410,7 +1411,7 @@ static int intel_runtime_suspend(struct device *device)
>  	cancel_work_sync(&dev_priv->rps.work);
>  	intel_runtime_pm_disable_interrupts(dev);
>  
> -	ret = intel_suspend_complete(dev_priv);
> +	ret = intel_suspend_complete(dev_priv, true);
>  	if (ret) {
>  		DRM_ERROR("Runtime suspend failed, disabling it (%d)\n", ret);
>  		intel_runtime_pm_restore_interrupts(dev);
> @@ -1471,10 +1472,11 @@ static int intel_runtime_resume(struct device *device)
>   * This function implements common functionality of runtime and system
>   * suspend sequence.
>   */
> -static int intel_suspend_complete(struct drm_i915_private *dev_priv)
> +static int intel_suspend_complete(struct drm_i915_private *dev_priv,
> +				  bool rpm_suspend)
>  {
>  	struct drm_device *dev = dev_priv->dev;
> -	int ret;
> +	int ret = 0;
>  
>  	if (IS_GEN6(dev)) {
>  		ret = 0;
> @@ -1482,7 +1484,7 @@ static int intel_suspend_complete(struct drm_i915_private *dev_priv)
>  		ret = hsw_suspend_complete(dev_priv);
>  	} else if (IS_VALLEYVIEW(dev)) {
>  		ret = vlv_suspend_complete(dev_priv);
> -	} else {
> +	} else if (rpm_suspend) {
>  		ret = -ENODEV;
>  		WARN_ON(1);
>  	}
> @@ -1499,7 +1501,7 @@ static int intel_resume_prepare(struct drm_i915_private *dev_priv,
>  				bool rpm_resume)
>  {
>  	struct drm_device *dev = dev_priv->dev;
> -	int ret;
> +	int ret = 0;
>  
>  	if (IS_GEN6(dev)) {
>  		ret = snb_resume_prepare(dev_priv, rpm_resume);
> @@ -1507,7 +1509,7 @@ static int intel_resume_prepare(struct drm_i915_private *dev_priv,
>  		ret = hsw_resume_prepare(dev_priv, rpm_resume);
>  	} else if (IS_VALLEYVIEW(dev)) {
>  		ret = vlv_resume_prepare(dev_priv, rpm_resume);
> -	} else {
> +	} else if (rpm_resume) {
>  		WARN_ON(1);
>  		ret = -ENODEV;
>  	}
> -- 
> 1.8.4
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch

  parent reply	other threads:[~2014-08-26  7:44 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 [this message]
2014-08-26  7:45   ` Daniel Vetter
2014-08-26  9:01     ` Imre Deak
2014-08-26 10:26 ` [PATCH v2] " Imre Deak
2014-08-26 10:53   ` 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=20140826074442.GA15520@phenom.ffwll.local \
    --to=daniel@ffwll.ch \
    --cc=imre.deak@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=sagar.a.kamble@intel.com \
    /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