diff mbox

[10/26] drm/i915: add more clock gating for VLV, allow force wake at init

Message ID 1362175722-9281-10-git-send-email-jbarnes@virtuousgeek.org (mailing list archive)
State New, archived
Headers show

Commit Message

Jesse Barnes March 1, 2013, 10:08 p.m. UTC
From: Ben Widawsky <ben@bwidawsk.net>

Disable all Gunit clock gating and make set the "allow force wake" bit.

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
---
 drivers/gpu/drm/i915/i915_gem.c |    4 ++++
 drivers/gpu/drm/i915/i915_reg.h |    1 +
 drivers/gpu/drm/i915/intel_pm.c |   10 +++++++++-
 3 files changed, 14 insertions(+), 1 deletion(-)

Comments

Jani Nikula March 8, 2013, 1:39 p.m. UTC | #1
On Sat, 02 Mar 2013, Jesse Barnes <jbarnes@virtuousgeek.org> wrote:
> From: Ben Widawsky <ben@bwidawsk.net>
>
> Disable all Gunit clock gating and make set the "allow force wake" bit.
>
> Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
> ---
>  drivers/gpu/drm/i915/i915_gem.c |    4 ++++
>  drivers/gpu/drm/i915/i915_reg.h |    1 +
>  drivers/gpu/drm/i915/intel_pm.c |   10 +++++++++-
>  3 files changed, 14 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
> index 8413ffc..dd67698 100644
> --- a/drivers/gpu/drm/i915/i915_gem.c
> +++ b/drivers/gpu/drm/i915/i915_gem.c
> @@ -4010,7 +4010,11 @@ int i915_gem_init(struct drm_device *dev)
>  	int ret;
>  
>  	mutex_lock(&dev->struct_mutex);
> +
> +	/* VLVA0 (potential hack), BIOS isn't actually waking us */
> +	I915_WRITE(VLV_GTLC_WAKE_CTRL, 1);

Wrap that in if IS_VALLEYVIEW(dev)? Separate this from the other hunk
into a separate patch?

Jani.

>  	i915_gem_init_global_gtt(dev);
> +
>  	ret = i915_gem_init_hw(dev);
>  	mutex_unlock(&dev->struct_mutex);
>  	if (ret) {
> diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
> index 539301d..6c037b2 100644
> --- a/drivers/gpu/drm/i915/i915_reg.h
> +++ b/drivers/gpu/drm/i915/i915_reg.h
> @@ -4273,6 +4273,7 @@
>  #define  FORCEWAKE_ACK_VLV			0x1300b4
>  #define  FORCEWAKE_ACK_HSW			0x130044
>  #define  FORCEWAKE_ACK				0x130090
> +#define  VLV_GTLC_WAKE_CTRL			0x130090
>  #define  FORCEWAKE_MT				0xa188 /* multi-threaded */
>  #define   FORCEWAKE_KERNEL			0x1
>  #define   FORCEWAKE_USER			0x2
> diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
> index 59ea12a..f29a1a2 100644
> --- a/drivers/gpu/drm/i915/intel_pm.c
> +++ b/drivers/gpu/drm/i915/intel_pm.c
> @@ -3987,7 +3987,15 @@ static void valleyview_init_clock_gating(struct drm_device *dev)
>  	 * Disable clock gating on th GCFG unit to prevent a delay
>  	 * in the reporting of vblank events.
>  	 */
> -	I915_WRITE(VLV_GUNIT_CLOCK_GATE, GCFG_DIS);
> +	/* VLVA0 HACK */
> +	I915_WRITE(VLV_GUNIT_CLOCK_GATE, 0xffffffff);
> +	I915_WRITE(0x9400, 0xffffffff);
> +	I915_WRITE(0x9404, 0xffffffff);
> +	I915_WRITE(0x9408, 0xffffffff);
> +	I915_WRITE(0x940c, 0xffffffff);
> +	I915_WRITE(0x9410, 0xffffffff);
> +	I915_WRITE(0x9414, 0xffffffff);
> +	I915_WRITE(0x9418, 0xffffffff);
>  }
>  
>  static void g4x_init_clock_gating(struct drm_device *dev)
> -- 
> 1.7.9.5
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Jesse Barnes March 8, 2013, 4:52 p.m. UTC | #2
On Fri, 08 Mar 2013 15:39:55 +0200
Jani Nikula <jani.nikula@linux.intel.com> wrote:

> On Sat, 02 Mar 2013, Jesse Barnes <jbarnes@virtuousgeek.org> wrote:
> > From: Ben Widawsky <ben@bwidawsk.net>
> >
> > Disable all Gunit clock gating and make set the "allow force wake" bit.
> >
> > Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
> > ---
> >  drivers/gpu/drm/i915/i915_gem.c |    4 ++++
> >  drivers/gpu/drm/i915/i915_reg.h |    1 +
> >  drivers/gpu/drm/i915/intel_pm.c |   10 +++++++++-
> >  3 files changed, 14 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
> > index 8413ffc..dd67698 100644
> > --- a/drivers/gpu/drm/i915/i915_gem.c
> > +++ b/drivers/gpu/drm/i915/i915_gem.c
> > @@ -4010,7 +4010,11 @@ int i915_gem_init(struct drm_device *dev)
> >  	int ret;
> >  
> >  	mutex_lock(&dev->struct_mutex);
> > +
> > +	/* VLVA0 (potential hack), BIOS isn't actually waking us */
> > +	I915_WRITE(VLV_GTLC_WAKE_CTRL, 1);
> 
> Wrap that in if IS_VALLEYVIEW(dev)? Separate this from the other hunk
> into a separate patch?

Ah this one did sneak in, I'll factor it out and put it under an IS_VLV
check.

Thanks,
Ville Syrjälä March 8, 2013, 5:06 p.m. UTC | #3
On Fri, Mar 08, 2013 at 08:52:53AM -0800, Jesse Barnes wrote:
> On Fri, 08 Mar 2013 15:39:55 +0200
> Jani Nikula <jani.nikula@linux.intel.com> wrote:
> 
> > On Sat, 02 Mar 2013, Jesse Barnes <jbarnes@virtuousgeek.org> wrote:
> > > From: Ben Widawsky <ben@bwidawsk.net>
> > >
> > > Disable all Gunit clock gating and make set the "allow force wake" bit.
> > >
> > > Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
> > > ---
> > >  drivers/gpu/drm/i915/i915_gem.c |    4 ++++
> > >  drivers/gpu/drm/i915/i915_reg.h |    1 +
> > >  drivers/gpu/drm/i915/intel_pm.c |   10 +++++++++-
> > >  3 files changed, 14 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
> > > index 8413ffc..dd67698 100644
> > > --- a/drivers/gpu/drm/i915/i915_gem.c
> > > +++ b/drivers/gpu/drm/i915/i915_gem.c
> > > @@ -4010,7 +4010,11 @@ int i915_gem_init(struct drm_device *dev)
> > >  	int ret;
> > >  
> > >  	mutex_lock(&dev->struct_mutex);
> > > +
> > > +	/* VLVA0 (potential hack), BIOS isn't actually waking us */
> > > +	I915_WRITE(VLV_GTLC_WAKE_CTRL, 1);
> > 
> > Wrap that in if IS_VALLEYVIEW(dev)? Separate this from the other hunk
> > into a separate patch?
> 
> Ah this one did sneak in, I'll factor it out and put it under an IS_VLV
> check.

Maybe I asked this already but if so I'll ask again. IIRC this thing has
an ack bit in another register. Should we poll it afterwards or are we
sure there's a long enough delay between this and when we need forcewake?
Jesse Barnes March 8, 2013, 5:08 p.m. UTC | #4
On Fri, 8 Mar 2013 19:06:00 +0200
Ville Syrjälä <ville.syrjala@linux.intel.com> wrote:

> On Fri, Mar 08, 2013 at 08:52:53AM -0800, Jesse Barnes wrote:
> > On Fri, 08 Mar 2013 15:39:55 +0200
> > Jani Nikula <jani.nikula@linux.intel.com> wrote:
> > 
> > > On Sat, 02 Mar 2013, Jesse Barnes <jbarnes@virtuousgeek.org> wrote:
> > > > From: Ben Widawsky <ben@bwidawsk.net>
> > > >
> > > > Disable all Gunit clock gating and make set the "allow force wake" bit.
> > > >
> > > > Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
> > > > ---
> > > >  drivers/gpu/drm/i915/i915_gem.c |    4 ++++
> > > >  drivers/gpu/drm/i915/i915_reg.h |    1 +
> > > >  drivers/gpu/drm/i915/intel_pm.c |   10 +++++++++-
> > > >  3 files changed, 14 insertions(+), 1 deletion(-)
> > > >
> > > > diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
> > > > index 8413ffc..dd67698 100644
> > > > --- a/drivers/gpu/drm/i915/i915_gem.c
> > > > +++ b/drivers/gpu/drm/i915/i915_gem.c
> > > > @@ -4010,7 +4010,11 @@ int i915_gem_init(struct drm_device *dev)
> > > >  	int ret;
> > > >  
> > > >  	mutex_lock(&dev->struct_mutex);
> > > > +
> > > > +	/* VLVA0 (potential hack), BIOS isn't actually waking us */
> > > > +	I915_WRITE(VLV_GTLC_WAKE_CTRL, 1);
> > > 
> > > Wrap that in if IS_VALLEYVIEW(dev)? Separate this from the other hunk
> > > into a separate patch?
> > 
> > Ah this one did sneak in, I'll factor it out and put it under an IS_VLV
> > check.
> 
> Maybe I asked this already but if so I'll ask again. IIRC this thing has
> an ack bit in another register. Should we poll it afterwards or are we
> sure there's a long enough delay between this and when we need forcewake?

I'll check, but I thought this one was just to allow the forcewake
dance later on (with the set and poll).
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 8413ffc..dd67698 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -4010,7 +4010,11 @@  int i915_gem_init(struct drm_device *dev)
 	int ret;
 
 	mutex_lock(&dev->struct_mutex);
+
+	/* VLVA0 (potential hack), BIOS isn't actually waking us */
+	I915_WRITE(VLV_GTLC_WAKE_CTRL, 1);
 	i915_gem_init_global_gtt(dev);
+
 	ret = i915_gem_init_hw(dev);
 	mutex_unlock(&dev->struct_mutex);
 	if (ret) {
diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
index 539301d..6c037b2 100644
--- a/drivers/gpu/drm/i915/i915_reg.h
+++ b/drivers/gpu/drm/i915/i915_reg.h
@@ -4273,6 +4273,7 @@ 
 #define  FORCEWAKE_ACK_VLV			0x1300b4
 #define  FORCEWAKE_ACK_HSW			0x130044
 #define  FORCEWAKE_ACK				0x130090
+#define  VLV_GTLC_WAKE_CTRL			0x130090
 #define  FORCEWAKE_MT				0xa188 /* multi-threaded */
 #define   FORCEWAKE_KERNEL			0x1
 #define   FORCEWAKE_USER			0x2
diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
index 59ea12a..f29a1a2 100644
--- a/drivers/gpu/drm/i915/intel_pm.c
+++ b/drivers/gpu/drm/i915/intel_pm.c
@@ -3987,7 +3987,15 @@  static void valleyview_init_clock_gating(struct drm_device *dev)
 	 * Disable clock gating on th GCFG unit to prevent a delay
 	 * in the reporting of vblank events.
 	 */
-	I915_WRITE(VLV_GUNIT_CLOCK_GATE, GCFG_DIS);
+	/* VLVA0 HACK */
+	I915_WRITE(VLV_GUNIT_CLOCK_GATE, 0xffffffff);
+	I915_WRITE(0x9400, 0xffffffff);
+	I915_WRITE(0x9404, 0xffffffff);
+	I915_WRITE(0x9408, 0xffffffff);
+	I915_WRITE(0x940c, 0xffffffff);
+	I915_WRITE(0x9410, 0xffffffff);
+	I915_WRITE(0x9414, 0xffffffff);
+	I915_WRITE(0x9418, 0xffffffff);
 }
 
 static void g4x_init_clock_gating(struct drm_device *dev)