diff mbox series

[03/14] drm/i915: Disable runtime-pm using lowlevel functions if !HAS_RC6

Message ID 20180812223642.24865-3-chris@chris-wilson.co.uk (mailing list archive)
State New, archived
Headers show
Series [01/14] drm/i915: Cleanup gt powerstate from gem | expand

Commit Message

Chris Wilson Aug. 12, 2018, 10:36 p.m. UTC
If we cannot setup rc6, we cannot let the GPU suspend itself as it
cannot save its state (to a powercontext). As such, we must disable
runtime-pm, but we should do so using the low-level pm-runtime function
which leaves our own debugging functions intact (and continue to detect
errors in our runtime-pm handling should we ever be able to enable rc6).

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 drivers/gpu/drm/i915/intel_pm.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Comments

Mika Kuoppala Aug. 14, 2018, 12:06 p.m. UTC | #1
Chris Wilson <chris@chris-wilson.co.uk> writes:

> If we cannot setup rc6, we cannot let the GPU suspend itself as it
> cannot save its state (to a powercontext). As such, we must disable
> runtime-pm, but we should do so using the low-level pm-runtime function
> which leaves our own debugging functions intact (and continue to detect
> errors in our runtime-pm handling should we ever be able to enable rc6).
>
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> ---
>  drivers/gpu/drm/i915/intel_pm.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
> index 9a01560c5bd1..d99e5fabe93c 100644
> --- a/drivers/gpu/drm/i915/intel_pm.c
> +++ b/drivers/gpu/drm/i915/intel_pm.c
> @@ -26,6 +26,7 @@
>   */
>  
>  #include <linux/cpufreq.h>
> +#include <linux/pm_runtime.h>
>  #include <drm/drm_plane_helper.h>
>  #include "i915_drv.h"
>  #include "intel_drv.h"
> @@ -8181,7 +8182,7 @@ void intel_init_gt_powersave(struct drm_i915_private *dev_priv)
>  	 */
>  	if (!sanitize_rc6(dev_priv)) {
>  		DRM_INFO("RC6 disabled, disabling runtime PM support\n");
> -		intel_runtime_pm_get(dev_priv);
> +		pm_runtime_get(&dev_priv->drm.pdev->dev);

Should this be pm_runtime_get_sync()?

-Mika

>  	}
>  
>  	mutex_lock(&dev_priv->pcu_lock);
> @@ -8233,7 +8234,7 @@ void intel_cleanup_gt_powersave(struct drm_i915_private *dev_priv)
>  		valleyview_cleanup_gt_powersave(dev_priv);
>  
>  	if (!HAS_RC6(dev_priv))
> -		intel_runtime_pm_put(dev_priv);
> +		pm_runtime_put(&dev_priv->drm.pdev->dev);
>  }
>  
>  /**
> -- 
> 2.18.0
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Chris Wilson Aug. 14, 2018, 12:15 p.m. UTC | #2
Quoting Mika Kuoppala (2018-08-14 13:06:45)
> Chris Wilson <chris@chris-wilson.co.uk> writes:
> 
> > If we cannot setup rc6, we cannot let the GPU suspend itself as it
> > cannot save its state (to a powercontext). As such, we must disable
> > runtime-pm, but we should do so using the low-level pm-runtime function
> > which leaves our own debugging functions intact (and continue to detect
> > errors in our runtime-pm handling should we ever be able to enable rc6).
> >
> > Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> > ---
> >  drivers/gpu/drm/i915/intel_pm.c | 5 +++--
> >  1 file changed, 3 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
> > index 9a01560c5bd1..d99e5fabe93c 100644
> > --- a/drivers/gpu/drm/i915/intel_pm.c
> > +++ b/drivers/gpu/drm/i915/intel_pm.c
> > @@ -26,6 +26,7 @@
> >   */
> >  
> >  #include <linux/cpufreq.h>
> > +#include <linux/pm_runtime.h>
> >  #include <drm/drm_plane_helper.h>
> >  #include "i915_drv.h"
> >  #include "intel_drv.h"
> > @@ -8181,7 +8182,7 @@ void intel_init_gt_powersave(struct drm_i915_private *dev_priv)
> >        */
> >       if (!sanitize_rc6(dev_priv)) {
> >               DRM_INFO("RC6 disabled, disabling runtime PM support\n");
> > -             intel_runtime_pm_get(dev_priv);
> > +             pm_runtime_get(&dev_priv->drm.pdev->dev);
> 
> Should this be pm_runtime_get_sync()?

It can be. It's already active at this point so there's no difference in
practice.
-Chris
Mika Kuoppala Aug. 14, 2018, 12:47 p.m. UTC | #3
Chris Wilson <chris@chris-wilson.co.uk> writes:

> If we cannot setup rc6, we cannot let the GPU suspend itself as it
> cannot save its state (to a powercontext). As such, we must disable
> runtime-pm, but we should do so using the low-level pm-runtime function
> which leaves our own debugging functions intact (and continue to detect
> errors in our runtime-pm handling should we ever be able to enable rc6).
>
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

Reviewed-by: Mika Kuoppala <mika.kuoppala@linux.intel.com>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
index 9a01560c5bd1..d99e5fabe93c 100644
--- a/drivers/gpu/drm/i915/intel_pm.c
+++ b/drivers/gpu/drm/i915/intel_pm.c
@@ -26,6 +26,7 @@ 
  */
 
 #include <linux/cpufreq.h>
+#include <linux/pm_runtime.h>
 #include <drm/drm_plane_helper.h>
 #include "i915_drv.h"
 #include "intel_drv.h"
@@ -8181,7 +8182,7 @@  void intel_init_gt_powersave(struct drm_i915_private *dev_priv)
 	 */
 	if (!sanitize_rc6(dev_priv)) {
 		DRM_INFO("RC6 disabled, disabling runtime PM support\n");
-		intel_runtime_pm_get(dev_priv);
+		pm_runtime_get(&dev_priv->drm.pdev->dev);
 	}
 
 	mutex_lock(&dev_priv->pcu_lock);
@@ -8233,7 +8234,7 @@  void intel_cleanup_gt_powersave(struct drm_i915_private *dev_priv)
 		valleyview_cleanup_gt_powersave(dev_priv);
 
 	if (!HAS_RC6(dev_priv))
-		intel_runtime_pm_put(dev_priv);
+		pm_runtime_put(&dev_priv->drm.pdev->dev);
 }
 
 /**