drm/i915: unconditionally use mt forcewake on hsw/ivb
diff mbox

Message ID 1350564275-27885-1-git-send-email-daniel.vetter@ffwll.ch
State New, archived
Headers show

Commit Message

Daniel Vetter Oct. 18, 2012, 12:44 p.m. UTC
Single-threaded forcewake was only used on some early pre-production
ivybridge machines, all the latest ones should use mt forcewake. And
we already assume this in other places of the code (e.g. DERRMR
support in the ddx, or the latest intel_gt_reset patch to reset any
lingering forcewake references left behind by the bios), so don't
bother here, too.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
---
 drivers/gpu/drm/i915/intel_pm.c |   31 ++++---------------------------
 1 file changed, 4 insertions(+), 27 deletions(-)

Comments

Mika Kuoppala Oct. 19, 2012, 7:29 a.m. UTC | #1
On Thu, 18 Oct 2012 14:44:35 +0200, Daniel Vetter <daniel.vetter@ffwll.ch> wrote:
> Single-threaded forcewake was only used on some early pre-production
> ivybridge machines, all the latest ones should use mt forcewake. And
> we already assume this in other places of the code (e.g. DERRMR
> support in the ddx, or the latest intel_gt_reset patch to reset any
> lingering forcewake references left behind by the bios), so don't
> bother here, too.
> 
> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> ---

Reviewed-by: Mika Kuoppala <mika.kuoppala@intel.com>
---------------------------------------------------------------------
Intel Finland Oy
Registered Address: PL 281, 00181 Helsinki 
Business Identity Code: 0357606 - 4 
Domiciled in Helsinki 

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
Jesse Barnes Oct. 19, 2012, 4:39 p.m. UTC | #2
On Thu, 18 Oct 2012 14:44:35 +0200
Daniel Vetter <daniel.vetter@ffwll.ch> wrote:

> Single-threaded forcewake was only used on some early pre-production
> ivybridge machines, all the latest ones should use mt forcewake. And
> we already assume this in other places of the code (e.g. DERRMR
> support in the ddx, or the latest intel_gt_reset patch to reset any
> lingering forcewake references left behind by the bios), so don't
> bother here, too.
> 
> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> ---
>  drivers/gpu/drm/i915/intel_pm.c |   31 ++++---------------------------
>  1 file changed, 4 insertions(+), 27 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
> index 2b3cddf..568c98d 100644
> --- a/drivers/gpu/drm/i915/intel_pm.c
> +++ b/drivers/gpu/drm/i915/intel_pm.c
> @@ -4146,35 +4146,12 @@ void intel_gt_init(struct drm_device *dev)
>  	if (IS_VALLEYVIEW(dev)) {
>  		dev_priv->gt.force_wake_get = vlv_force_wake_get;
>  		dev_priv->gt.force_wake_put = vlv_force_wake_put;
> -	} else if (INTEL_INFO(dev)->gen >= 6) {
> +	} else if (IS_IVYBRIDGE(dev) || IS_HASWELL(dev)) {
> +		dev_priv->gt.force_wake_get = __gen6_gt_force_wake_mt_get;
> +		dev_priv->gt.force_wake_put = __gen6_gt_force_wake_mt_put;
> +	} else if (IS_GEN6(dev)) {
>  		dev_priv->gt.force_wake_get = __gen6_gt_force_wake_get;
>  		dev_priv->gt.force_wake_put = __gen6_gt_force_wake_put;
> -
> -		/* IVB configs may use multi-threaded forcewake */
> -		if (IS_IVYBRIDGE(dev) || IS_HASWELL(dev)) {
> -			u32 ecobus;
> -
> -			/* A small trick here - if the bios hasn't configured
> -			 * MT forcewake, and if the device is in RC6, then
> -			 * force_wake_mt_get will not wake the device and the
> -			 * ECOBUS read will return zero. Which will be
> -			 * (correctly) interpreted by the test below as MT
> -			 * forcewake being disabled.
> -			 */
> -			mutex_lock(&dev->struct_mutex);
> -			__gen6_gt_force_wake_mt_get(dev_priv);
> -			ecobus = I915_READ_NOTRACE(ECOBUS);
> -			__gen6_gt_force_wake_mt_put(dev_priv);
> -			mutex_unlock(&dev->struct_mutex);
> -
> -			if (ecobus & FORCEWAKE_MT_ENABLE) {
> -				DRM_DEBUG_KMS("Using MT version of forcewake\n");
> -				dev_priv->gt.force_wake_get =
> -					__gen6_gt_force_wake_mt_get;
> -				dev_priv->gt.force_wake_put =
> -					__gen6_gt_force_wake_mt_put;
> -			}
> -		}
>  	}
>  }
>  

Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org>

Pretty sure it was just early, pre-production IVB that didn't use MT,
so this should be safe.
Daniel Vetter Oct. 19, 2012, 5:33 p.m. UTC | #3
On Fri, Oct 19, 2012 at 09:39:59AM -0700, Jesse Barnes wrote:
> On Thu, 18 Oct 2012 14:44:35 +0200
> Daniel Vetter <daniel.vetter@ffwll.ch> wrote:
> 
> > Single-threaded forcewake was only used on some early pre-production
> > ivybridge machines, all the latest ones should use mt forcewake. And
> > we already assume this in other places of the code (e.g. DERRMR
> > support in the ddx, or the latest intel_gt_reset patch to reset any
> > lingering forcewake references left behind by the bios), so don't
> > bother here, too.
> > 
> > Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> > ---
> >  drivers/gpu/drm/i915/intel_pm.c |   31 ++++---------------------------
> >  1 file changed, 4 insertions(+), 27 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
> > index 2b3cddf..568c98d 100644
> > --- a/drivers/gpu/drm/i915/intel_pm.c
> > +++ b/drivers/gpu/drm/i915/intel_pm.c
> > @@ -4146,35 +4146,12 @@ void intel_gt_init(struct drm_device *dev)
> >  	if (IS_VALLEYVIEW(dev)) {
> >  		dev_priv->gt.force_wake_get = vlv_force_wake_get;
> >  		dev_priv->gt.force_wake_put = vlv_force_wake_put;
> > -	} else if (INTEL_INFO(dev)->gen >= 6) {
> > +	} else if (IS_IVYBRIDGE(dev) || IS_HASWELL(dev)) {
> > +		dev_priv->gt.force_wake_get = __gen6_gt_force_wake_mt_get;
> > +		dev_priv->gt.force_wake_put = __gen6_gt_force_wake_mt_put;
> > +	} else if (IS_GEN6(dev)) {
> >  		dev_priv->gt.force_wake_get = __gen6_gt_force_wake_get;
> >  		dev_priv->gt.force_wake_put = __gen6_gt_force_wake_put;
> > -
> > -		/* IVB configs may use multi-threaded forcewake */
> > -		if (IS_IVYBRIDGE(dev) || IS_HASWELL(dev)) {
> > -			u32 ecobus;
> > -
> > -			/* A small trick here - if the bios hasn't configured
> > -			 * MT forcewake, and if the device is in RC6, then
> > -			 * force_wake_mt_get will not wake the device and the
> > -			 * ECOBUS read will return zero. Which will be
> > -			 * (correctly) interpreted by the test below as MT
> > -			 * forcewake being disabled.
> > -			 */
> > -			mutex_lock(&dev->struct_mutex);
> > -			__gen6_gt_force_wake_mt_get(dev_priv);
> > -			ecobus = I915_READ_NOTRACE(ECOBUS);
> > -			__gen6_gt_force_wake_mt_put(dev_priv);
> > -			mutex_unlock(&dev->struct_mutex);
> > -
> > -			if (ecobus & FORCEWAKE_MT_ENABLE) {
> > -				DRM_DEBUG_KMS("Using MT version of forcewake\n");
> > -				dev_priv->gt.force_wake_get =
> > -					__gen6_gt_force_wake_mt_get;
> > -				dev_priv->gt.force_wake_put =
> > -					__gen6_gt_force_wake_mt_put;
> > -			}
> > -		}
> >  	}
> >  }
> >  
> 
> Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org>

Merged, thanks for checking. I've also merged the forcewak clear patch
from Chris, somehow forgotten to send the mail.
-Daniel

Patch
diff mbox

diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
index 2b3cddf..568c98d 100644
--- a/drivers/gpu/drm/i915/intel_pm.c
+++ b/drivers/gpu/drm/i915/intel_pm.c
@@ -4146,35 +4146,12 @@  void intel_gt_init(struct drm_device *dev)
 	if (IS_VALLEYVIEW(dev)) {
 		dev_priv->gt.force_wake_get = vlv_force_wake_get;
 		dev_priv->gt.force_wake_put = vlv_force_wake_put;
-	} else if (INTEL_INFO(dev)->gen >= 6) {
+	} else if (IS_IVYBRIDGE(dev) || IS_HASWELL(dev)) {
+		dev_priv->gt.force_wake_get = __gen6_gt_force_wake_mt_get;
+		dev_priv->gt.force_wake_put = __gen6_gt_force_wake_mt_put;
+	} else if (IS_GEN6(dev)) {
 		dev_priv->gt.force_wake_get = __gen6_gt_force_wake_get;
 		dev_priv->gt.force_wake_put = __gen6_gt_force_wake_put;
-
-		/* IVB configs may use multi-threaded forcewake */
-		if (IS_IVYBRIDGE(dev) || IS_HASWELL(dev)) {
-			u32 ecobus;
-
-			/* A small trick here - if the bios hasn't configured
-			 * MT forcewake, and if the device is in RC6, then
-			 * force_wake_mt_get will not wake the device and the
-			 * ECOBUS read will return zero. Which will be
-			 * (correctly) interpreted by the test below as MT
-			 * forcewake being disabled.
-			 */
-			mutex_lock(&dev->struct_mutex);
-			__gen6_gt_force_wake_mt_get(dev_priv);
-			ecobus = I915_READ_NOTRACE(ECOBUS);
-			__gen6_gt_force_wake_mt_put(dev_priv);
-			mutex_unlock(&dev->struct_mutex);
-
-			if (ecobus & FORCEWAKE_MT_ENABLE) {
-				DRM_DEBUG_KMS("Using MT version of forcewake\n");
-				dev_priv->gt.force_wake_get =
-					__gen6_gt_force_wake_mt_get;
-				dev_priv->gt.force_wake_put =
-					__gen6_gt_force_wake_mt_put;
-			}
-		}
 	}
 }