diff mbox

[03/10] drm/i915: refactor RPM disabling due to RC6 being disabled

Message ID 1450203038-5150-4-git-send-email-imre.deak@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Imre Deak Dec. 15, 2015, 6:10 p.m. UTC
We can make the RPM dependency on RC6 explciit in the code by taking an
actual RPM reference, instead of avoiding to drop the initial one. This
will also enable us to remove the HAS_RUNTIME_PM special casing from
more places in the next patch.

Signed-off-by: Imre Deak <imre.deak@intel.com>
---
 drivers/gpu/drm/i915/intel_pm.c         | 15 +++++++++++++++
 drivers/gpu/drm/i915/intel_runtime_pm.c |  9 ---------
 2 files changed, 15 insertions(+), 9 deletions(-)

Comments

Joonas Lahtinen Dec. 16, 2015, 10:54 a.m. UTC | #1
On ti, 2015-12-15 at 20:10 +0200, Imre Deak wrote:
> We can make the RPM dependency on RC6 explciit in the code by taking
> an
> actual RPM reference, instead of avoiding to drop the initial one.
> This
> will also enable us to remove the HAS_RUNTIME_PM special casing from
> more places in the next patch.
> 
> Signed-off-by: Imre Deak <imre.deak@intel.com>

Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>

Comment below.

> ---
>  drivers/gpu/drm/i915/intel_pm.c         | 15 +++++++++++++++
>  drivers/gpu/drm/i915/intel_runtime_pm.c |  9 ---------
>  2 files changed, 15 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_pm.c
> b/drivers/gpu/drm/i915/intel_pm.c
> index 99f2642..f93c4b9 100644
> --- a/drivers/gpu/drm/i915/intel_pm.c
> 
> +++ b/drivers/gpu/drm/i915/intel_pm.c
> 

<SNIP>

> @@ -6025,10 +6035,15 @@ void intel_init_gt_powersave(struct
> drm_device *dev)
>  
>  void intel_cleanup_gt_powersave(struct drm_device *dev)
>  {
> +	struct drm_i915_private *dev_priv = dev->dev_private;
> +
>  	if (IS_CHERRYVIEW(dev))
>  		return;
>  	else if (IS_VALLEYVIEW(dev))
>  		valleyview_cleanup_gt_powersave(dev);
> +
> +	if (!i915.enable_rc6)
> +		intel_runtime_pm_put(dev_priv);

Although intel_enable_rc6 is used in other places, I think this is fine
due to the variable being initialized in the counter function.

Regards, Joonas

>  }
>
Joonas Lahtinen Dec. 16, 2015, 11:01 a.m. UTC | #2
On ke, 2015-12-16 at 12:54 +0200, Joonas Lahtinen wrote:
> On ti, 2015-12-15 at 20:10 +0200, Imre Deak wrote:
> > We can make the RPM dependency on RC6 explciit in the code by


Typo, s/explciit/explicit/

> > taking
> > an
> > actual RPM reference, instead of avoiding to drop the initial one.
> > This
> > will also enable us to remove the HAS_RUNTIME_PM special casing
> > from
> > more places in the next patch.
> > 
> > Signed-off-by: Imre Deak <imre.deak@intel.com>
> 
> Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> 
> Comment below.
> 
> > ---
> >  drivers/gpu/drm/i915/intel_pm.c         | 15 +++++++++++++++
> >  drivers/gpu/drm/i915/intel_runtime_pm.c |  9 ---------
> >  2 files changed, 15 insertions(+), 9 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/i915/intel_pm.c
> > b/drivers/gpu/drm/i915/intel_pm.c
> > index 99f2642..f93c4b9 100644
> > --- a/drivers/gpu/drm/i915/intel_pm.c
> > 
> > +++ b/drivers/gpu/drm/i915/intel_pm.c
> > 
> 
> <SNIP>
> 
> > @@ -6025,10 +6035,15 @@ void intel_init_gt_powersave(struct
> > drm_device *dev)
> >  
> >  void intel_cleanup_gt_powersave(struct drm_device *dev)
> >  {
> > +	struct drm_i915_private *dev_priv = dev->dev_private;
> > +
> >  	if (IS_CHERRYVIEW(dev))
> >  		return;
> >  	else if (IS_VALLEYVIEW(dev))
> >  		valleyview_cleanup_gt_powersave(dev);
> > +
> > +	if (!i915.enable_rc6)
> > +		intel_runtime_pm_put(dev_priv);
> 
> Although intel_enable_rc6 is used in other places, I think this is
> fine
> due to the variable being initialized in the counter function.
> 
> Regards, Joonas
> 
> >  }
> >
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
index 99f2642..f93c4b9 100644
--- a/drivers/gpu/drm/i915/intel_pm.c
+++ b/drivers/gpu/drm/i915/intel_pm.c
@@ -6015,7 +6015,17 @@  static void intel_init_emon(struct drm_device *dev)
 
 void intel_init_gt_powersave(struct drm_device *dev)
 {
+	struct drm_i915_private *dev_priv = dev->dev_private;
+
 	i915.enable_rc6 = sanitize_rc6_option(dev, i915.enable_rc6);
+	/*
+	 * RPM depends on RC6 to save restore the GT HW context, so make RC6 a
+	 * requirement.
+	 */
+	if (!i915.enable_rc6) {
+		DRM_INFO("RC6 disabled, disabling runtime PM support\n");
+		intel_runtime_pm_get(dev_priv);
+	}
 
 	if (IS_CHERRYVIEW(dev))
 		cherryview_init_gt_powersave(dev);
@@ -6025,10 +6035,15 @@  void intel_init_gt_powersave(struct drm_device *dev)
 
 void intel_cleanup_gt_powersave(struct drm_device *dev)
 {
+	struct drm_i915_private *dev_priv = dev->dev_private;
+
 	if (IS_CHERRYVIEW(dev))
 		return;
 	else if (IS_VALLEYVIEW(dev))
 		valleyview_cleanup_gt_powersave(dev);
+
+	if (!i915.enable_rc6)
+		intel_runtime_pm_put(dev_priv);
 }
 
 static void gen6_suspend_rps(struct drm_device *dev)
diff --git a/drivers/gpu/drm/i915/intel_runtime_pm.c b/drivers/gpu/drm/i915/intel_runtime_pm.c
index f4ff5f5..342baa9 100644
--- a/drivers/gpu/drm/i915/intel_runtime_pm.c
+++ b/drivers/gpu/drm/i915/intel_runtime_pm.c
@@ -2311,15 +2311,6 @@  void intel_runtime_pm_enable(struct drm_i915_private *dev_priv)
 	if (!HAS_RUNTIME_PM(dev))
 		return;
 
-	/*
-	 * RPM depends on RC6 to save restore the GT HW context, so make RC6 a
-	 * requirement.
-	 */
-	if (!intel_enable_rc6(dev)) {
-		DRM_INFO("RC6 disabled, disabling runtime PM support\n");
-		return;
-	}
-
 	pm_runtime_set_autosuspend_delay(device, 10000); /* 10s */
 	pm_runtime_mark_last_busy(device);
 	pm_runtime_use_autosuspend(device);