diff mbox

[2/2] drm/i915: Document the multi-threaded FORCEWAKE bits

Message ID 1350472195-8051-2-git-send-email-chris@chris-wilson.co.uk (mailing list archive)
State New, archived
Headers show

Commit Message

Chris Wilson Oct. 17, 2012, 11:09 a.m. UTC
No functional change, but reserves 0x2 for use by userspace.

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

Comments

Jesse Barnes Oct. 17, 2012, 4:27 p.m. UTC | #1
On Wed, 17 Oct 2012 12:09:55 +0100
Chris Wilson <chris@chris-wilson.co.uk> wrote:

> No functional change, but reserves 0x2 for use by userspace.
> 
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> ---
>  drivers/gpu/drm/i915/i915_reg.h |    2 ++
>  drivers/gpu/drm/i915/intel_pm.c |   10 +++++-----
>  2 files changed, 7 insertions(+), 5 deletions(-)

Each of the bits in this reg correspond to a specific agent that may
need to wake the GT.  Unfortunately I don't have docs about which bits
are used by which agents.  IIRC the BIOS uses one as does the AMT
engine if present.

I'll try to find out who owns each and maybe we can reserve our own for
userspace.

Thanks,
Jesse Barnes Oct. 17, 2012, 5:05 p.m. UTC | #2
On Wed, 17 Oct 2012 09:27:24 -0700
Jesse Barnes <jbarnes@virtuousgeek.org> wrote:

> On Wed, 17 Oct 2012 12:09:55 +0100
> Chris Wilson <chris@chris-wilson.co.uk> wrote:
> 
> > No functional change, but reserves 0x2 for use by userspace.
> > 
> > Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> > ---
> >  drivers/gpu/drm/i915/i915_reg.h |    2 ++
> >  drivers/gpu/drm/i915/intel_pm.c |   10 +++++-----
> >  2 files changed, 7 insertions(+), 5 deletions(-)
> 
> Each of the bits in this reg correspond to a specific agent that may
> need to wake the GT.  Unfortunately I don't have docs about which bits
> are used by which agents.  IIRC the BIOS uses one as does the AMT
> engine if present.
> 
> I'll try to find out who owns each and maybe we can reserve our own for
> userspace.

Ok we're in the clear here.  I was afraid there might be other system
components that would do sneaky things behind our back.  But once the
driver loads, we own the GT, so we can make these bits whatever we want.
Daniel Vetter Oct. 17, 2012, 7:10 p.m. UTC | #3
On Wed, Oct 17, 2012 at 10:05:15AM -0700, Jesse Barnes wrote:
> On Wed, 17 Oct 2012 09:27:24 -0700
> Jesse Barnes <jbarnes@virtuousgeek.org> wrote:
> 
> > On Wed, 17 Oct 2012 12:09:55 +0100
> > Chris Wilson <chris@chris-wilson.co.uk> wrote:
> > 
> > > No functional change, but reserves 0x2 for use by userspace.
> > > 
> > > Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> > > ---
> > >  drivers/gpu/drm/i915/i915_reg.h |    2 ++
> > >  drivers/gpu/drm/i915/intel_pm.c |   10 +++++-----
> > >  2 files changed, 7 insertions(+), 5 deletions(-)
> > 
> > Each of the bits in this reg correspond to a specific agent that may
> > need to wake the GT.  Unfortunately I don't have docs about which bits
> > are used by which agents.  IIRC the BIOS uses one as does the AMT
> > engine if present.
> > 
> > I'll try to find out who owns each and maybe we can reserve our own for
> > userspace.
> 
> Ok we're in the clear here.  I was afraid there might be other system
> components that would do sneaky things behind our back.  But once the
> driver loads, we own the GT, so we can make these bits whatever we want.

I guess that counts for an ack - patch merged to dinq.

Thanks, Daniel
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
index 8120bf2..d482c12 100644
--- a/drivers/gpu/drm/i915/i915_reg.h
+++ b/drivers/gpu/drm/i915/i915_reg.h
@@ -4115,6 +4115,8 @@ 
 #define  FORCEWAKE_ACK_HSW			0x130044
 #define  FORCEWAKE_ACK				0x130090
 #define  FORCEWAKE_MT				0xa188 /* multi-threaded */
+#define   FORCEWAKE_KERNEL			0x1
+#define   FORCEWAKE_USER			0x2
 #define  FORCEWAKE_MT_ACK			0x130040
 #define  ECOBUS					0xa180
 #define    FORCEWAKE_MT_ENABLE			(1<<5)
diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
index 4e5fc33..9853f35 100644
--- a/drivers/gpu/drm/i915/intel_pm.c
+++ b/drivers/gpu/drm/i915/intel_pm.c
@@ -4011,7 +4011,7 @@  static void __gen6_gt_force_wake_get(struct drm_i915_private *dev_priv)
 			    FORCEWAKE_ACK_TIMEOUT_MS))
 		DRM_ERROR("Timed out waiting for forcewake old ack to clear.\n");
 
-	I915_WRITE_NOTRACE(FORCEWAKE, 1);
+	I915_WRITE_NOTRACE(FORCEWAKE, FORCEWAKE_KERNEL);
 	POSTING_READ(ECOBUS); /* something from same cacheline, but !FORCEWAKE */
 
 	if (wait_for_atomic((I915_READ_NOTRACE(forcewake_ack) & 1),
@@ -4034,7 +4034,7 @@  static void __gen6_gt_force_wake_mt_get(struct drm_i915_private *dev_priv)
 			    FORCEWAKE_ACK_TIMEOUT_MS))
 		DRM_ERROR("Timed out waiting for forcewake old ack to clear.\n");
 
-	I915_WRITE_NOTRACE(FORCEWAKE_MT, _MASKED_BIT_ENABLE(1));
+	I915_WRITE_NOTRACE(FORCEWAKE_MT, _MASKED_BIT_ENABLE(FORCEWAKE_KERNEL));
 	POSTING_READ(ECOBUS); /* something from same cacheline, but !FORCEWAKE */
 
 	if (wait_for_atomic((I915_READ_NOTRACE(forcewake_ack) & 1),
@@ -4078,7 +4078,7 @@  static void __gen6_gt_force_wake_put(struct drm_i915_private *dev_priv)
 
 static void __gen6_gt_force_wake_mt_put(struct drm_i915_private *dev_priv)
 {
-	I915_WRITE_NOTRACE(FORCEWAKE_MT, _MASKED_BIT_DISABLE(1));
+	I915_WRITE_NOTRACE(FORCEWAKE_MT, _MASKED_BIT_DISABLE(FORCEWAKE_KERNEL));
 	/* gen6_gt_check_fifodbg doubles as the POSTING_READ */
 	gen6_gt_check_fifodbg(dev_priv);
 }
@@ -4122,7 +4122,7 @@  static void vlv_force_wake_get(struct drm_i915_private *dev_priv)
 			    FORCEWAKE_ACK_TIMEOUT_MS))
 		DRM_ERROR("Timed out waiting for forcewake old ack to clear.\n");
 
-	I915_WRITE_NOTRACE(FORCEWAKE_VLV, _MASKED_BIT_ENABLE(1));
+	I915_WRITE_NOTRACE(FORCEWAKE_VLV, _MASKED_BIT_ENABLE(FORCEWAKE_KERNEL));
 
 	if (wait_for_atomic((I915_READ_NOTRACE(FORCEWAKE_ACK_VLV) & 1),
 			    FORCEWAKE_ACK_TIMEOUT_MS))
@@ -4133,7 +4133,7 @@  static void vlv_force_wake_get(struct drm_i915_private *dev_priv)
 
 static void vlv_force_wake_put(struct drm_i915_private *dev_priv)
 {
-	I915_WRITE_NOTRACE(FORCEWAKE_VLV, _MASKED_BIT_DISABLE(1));
+	I915_WRITE_NOTRACE(FORCEWAKE_VLV, _MASKED_BIT_DISABLE(FORCEWAKE_KERNEL));
 	/* The below doubles as a POSTING_READ */
 	gen6_gt_check_fifodbg(dev_priv);
 }