Re: [Intel-gfx] [PATCH 15/26] drm/i915: add media well to VLV force wake routines

2013-03-06 Thread Ville Syrjälä
On Fri, Mar 01, 2013 at 02:08:31PM -0800, Jesse Barnes wrote:
 We could split this out into a separate routine at some point as an
 optimization.

BTW did anyone try to gang wakeup thing instead?

 
 Signed-off-by: Jesse Barnes jbar...@virtuousgeek.org
 ---
  drivers/gpu/drm/i915/i915_reg.h |2 ++
  drivers/gpu/drm/i915/intel_pm.c |   11 ---
  2 files changed, 10 insertions(+), 3 deletions(-)
 
 diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
 index 1c6e066..558c6d1 100644
 --- a/drivers/gpu/drm/i915/i915_reg.h
 +++ b/drivers/gpu/drm/i915/i915_reg.h
 @@ -4271,6 +4271,8 @@
  #define  FORCEWAKE   0xA18C
  #define  FORCEWAKE_VLV   0x1300b0
  #define  FORCEWAKE_ACK_VLV   0x1300b4
 +#define  FORCEWAKE_MEDIA_VLV 0x1300b8
 +#define  FORCEWAKE_ACK_MEDIA_VLV 0x1300bc
  #define  FORCEWAKE_ACK_HSW   0x130044
  #define  FORCEWAKE_ACK   0x130090
  #define  VLV_GTLC_WAKE_CTRL  0x130090
 diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
 index 3e976f4..e3947cb 100644
 --- a/drivers/gpu/drm/i915/intel_pm.c
 +++ b/drivers/gpu/drm/i915/intel_pm.c
 @@ -4423,10 +4423,15 @@ static void vlv_force_wake_get(struct 
 drm_i915_private *dev_priv)
   DRM_ERROR(Timed out waiting for forcewake old ack to 
 clear.\n);
  
   I915_WRITE_NOTRACE(FORCEWAKE_VLV, _MASKED_BIT_ENABLE(FORCEWAKE_KERNEL));
 + I915_WRITE_NOTRACE(FORCEWAKE_MEDIA_VLV, 
 _MASKED_BIT_ENABLE(FORCEWAKE_KERNEL));
  
   if (wait_for_atomic((I915_READ_NOTRACE(FORCEWAKE_ACK_VLV)  1),
   FORCEWAKE_ACK_TIMEOUT_MS))
 - DRM_ERROR(Timed out waiting for forcewake to ack request.\n);
 + DRM_ERROR(Timed out waiting for GT to ack forcewake 
 request.\n);
 +
 + if (wait_for_atomic((I915_READ_NOTRACE(FORCEWAKE_ACK_MEDIA_VLV)  1),
 + FORCEWAKE_ACK_TIMEOUT_MS))
 + DRM_ERROR(Timed out waiting for media to ack forcewake 
 request.\n);

Based on some of my recent patches the ' 1's should be
' FORCEWAKE_KERNEL'.

   __gen6_gt_wait_for_thread_c0(dev_priv);
  }
 @@ -4434,8 +4439,8 @@ 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(FORCEWAKE_KERNEL));
 - /* something from same cacheline, but !FORCEWAKE_VLV */
 - POSTING_READ(FORCEWAKE_ACK_VLV);
 + I915_WRITE_NOTRACE(FORCEWAKE_MEDIA_VLV, 
 _MASKED_BIT_DISABLE(FORCEWAKE_KERNEL));
 + /* The below doubles as a POSTING_READ */

Are we sure? ;)

   gen6_gt_check_fifodbg(dev_priv);
  }
  
 -- 
 1.7.9.5
 
 ___
 Intel-gfx mailing list
 Intel-gfx@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Ville Syrjälä
Intel OTC
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH 15/26] drm/i915: add media well to VLV force wake routines

2013-03-06 Thread Jesse Barnes
On Wed, 6 Mar 2013 20:28:07 +0200
Ville Syrjälä ville.syrj...@linux.intel.com wrote:

 On Fri, Mar 01, 2013 at 02:08:31PM -0800, Jesse Barnes wrote:
  We could split this out into a separate routine at some point as an
  optimization.
 
 BTW did anyone try to gang wakeup thing instead?

Not afaik.

 
  
  Signed-off-by: Jesse Barnes jbar...@virtuousgeek.org
  ---
   drivers/gpu/drm/i915/i915_reg.h |2 ++
   drivers/gpu/drm/i915/intel_pm.c |   11 ---
   2 files changed, 10 insertions(+), 3 deletions(-)
  
  diff --git a/drivers/gpu/drm/i915/i915_reg.h 
  b/drivers/gpu/drm/i915/i915_reg.h
  index 1c6e066..558c6d1 100644
  --- a/drivers/gpu/drm/i915/i915_reg.h
  +++ b/drivers/gpu/drm/i915/i915_reg.h
  @@ -4271,6 +4271,8 @@
   #define  FORCEWAKE 0xA18C
   #define  FORCEWAKE_VLV 0x1300b0
   #define  FORCEWAKE_ACK_VLV 0x1300b4
  +#define  FORCEWAKE_MEDIA_VLV   0x1300b8
  +#define  FORCEWAKE_ACK_MEDIA_VLV   0x1300bc
   #define  FORCEWAKE_ACK_HSW 0x130044
   #define  FORCEWAKE_ACK 0x130090
   #define  VLV_GTLC_WAKE_CTRL0x130090
  diff --git a/drivers/gpu/drm/i915/intel_pm.c 
  b/drivers/gpu/drm/i915/intel_pm.c
  index 3e976f4..e3947cb 100644
  --- a/drivers/gpu/drm/i915/intel_pm.c
  +++ b/drivers/gpu/drm/i915/intel_pm.c
  @@ -4423,10 +4423,15 @@ static void vlv_force_wake_get(struct 
  drm_i915_private *dev_priv)
  DRM_ERROR(Timed out waiting for forcewake old ack to 
  clear.\n);
   
  I915_WRITE_NOTRACE(FORCEWAKE_VLV, _MASKED_BIT_ENABLE(FORCEWAKE_KERNEL));
  +   I915_WRITE_NOTRACE(FORCEWAKE_MEDIA_VLV, 
  _MASKED_BIT_ENABLE(FORCEWAKE_KERNEL));
   
  if (wait_for_atomic((I915_READ_NOTRACE(FORCEWAKE_ACK_VLV)  1),
  FORCEWAKE_ACK_TIMEOUT_MS))
  -   DRM_ERROR(Timed out waiting for forcewake to ack request.\n);
  +   DRM_ERROR(Timed out waiting for GT to ack forcewake 
  request.\n);
  +
  +   if (wait_for_atomic((I915_READ_NOTRACE(FORCEWAKE_ACK_MEDIA_VLV)  1),
  +   FORCEWAKE_ACK_TIMEOUT_MS))
  +   DRM_ERROR(Timed out waiting for media to ack forcewake 
  request.\n);
 
 Based on some of my recent patches the ' 1's should be
 ' FORCEWAKE_KERNEL'.

And that was based on my misunderstanding of MT forcewake.  I thought
it was so the BIOS or AMT could do forcewake, but it's actually meant
for multiple kernel thread accesses.  Since we don't do that, simply
using the lowest bit all the time is fine.

  __gen6_gt_wait_for_thread_c0(dev_priv);
   }
  @@ -4434,8 +4439,8 @@ 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(FORCEWAKE_KERNEL));
  -   /* something from same cacheline, but !FORCEWAKE_VLV */
  -   POSTING_READ(FORCEWAKE_ACK_VLV);
  +   I915_WRITE_NOTRACE(FORCEWAKE_MEDIA_VLV, 
  _MASKED_BIT_DISABLE(FORCEWAKE_KERNEL));
  +   /* The below doubles as a POSTING_READ */
 
 Are we sure? ;)
 
  gen6_gt_check_fifodbg(dev_priv);

Well it does a read first thing so I think so.

-- 
Jesse Barnes, Intel Open Source Technology Center
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH 15/26] drm/i915: add media well to VLV force wake routines

2013-03-06 Thread Ville Syrjälä
On Wed, Mar 06, 2013 at 10:33:34AM -0800, Jesse Barnes wrote:
 On Wed, 6 Mar 2013 20:28:07 +0200
 Ville Syrjälä ville.syrj...@linux.intel.com wrote:
 
  On Fri, Mar 01, 2013 at 02:08:31PM -0800, Jesse Barnes wrote:
   We could split this out into a separate routine at some point as an
   optimization.
  
  BTW did anyone try to gang wakeup thing instead?
 
 Not afaik.
 
  
   
   Signed-off-by: Jesse Barnes jbar...@virtuousgeek.org
   ---
drivers/gpu/drm/i915/i915_reg.h |2 ++
drivers/gpu/drm/i915/intel_pm.c |   11 ---
2 files changed, 10 insertions(+), 3 deletions(-)
   
   diff --git a/drivers/gpu/drm/i915/i915_reg.h 
   b/drivers/gpu/drm/i915/i915_reg.h
   index 1c6e066..558c6d1 100644
   --- a/drivers/gpu/drm/i915/i915_reg.h
   +++ b/drivers/gpu/drm/i915/i915_reg.h
   @@ -4271,6 +4271,8 @@
#define  FORCEWAKE   0xA18C
#define  FORCEWAKE_VLV   0x1300b0
#define  FORCEWAKE_ACK_VLV   0x1300b4
   +#define  FORCEWAKE_MEDIA_VLV 0x1300b8
   +#define  FORCEWAKE_ACK_MEDIA_VLV 0x1300bc
#define  FORCEWAKE_ACK_HSW   0x130044
#define  FORCEWAKE_ACK   0x130090
#define  VLV_GTLC_WAKE_CTRL  0x130090
   diff --git a/drivers/gpu/drm/i915/intel_pm.c 
   b/drivers/gpu/drm/i915/intel_pm.c
   index 3e976f4..e3947cb 100644
   --- a/drivers/gpu/drm/i915/intel_pm.c
   +++ b/drivers/gpu/drm/i915/intel_pm.c
   @@ -4423,10 +4423,15 @@ static void vlv_force_wake_get(struct 
   drm_i915_private *dev_priv)
 DRM_ERROR(Timed out waiting for forcewake old ack to 
   clear.\n);

 I915_WRITE_NOTRACE(FORCEWAKE_VLV, _MASKED_BIT_ENABLE(FORCEWAKE_KERNEL));
   + I915_WRITE_NOTRACE(FORCEWAKE_MEDIA_VLV, 
   _MASKED_BIT_ENABLE(FORCEWAKE_KERNEL));

 if (wait_for_atomic((I915_READ_NOTRACE(FORCEWAKE_ACK_VLV)  1),
 FORCEWAKE_ACK_TIMEOUT_MS))
   - DRM_ERROR(Timed out waiting for forcewake to ack request.\n);
   + DRM_ERROR(Timed out waiting for GT to ack forcewake 
   request.\n);
   +
   + if (wait_for_atomic((I915_READ_NOTRACE(FORCEWAKE_ACK_MEDIA_VLV)  1),
   + FORCEWAKE_ACK_TIMEOUT_MS))
   + DRM_ERROR(Timed out waiting for media to ack forcewake 
   request.\n);
  
  Based on some of my recent patches the ' 1's should be
  ' FORCEWAKE_KERNEL'.
 
 And that was based on my misunderstanding of MT forcewake.  I thought
 it was so the BIOS or AMT could do forcewake, but it's actually meant
 for multiple kernel thread accesses.  Since we don't do that, simply
 using the lowest bit all the time is fine.

I just want to be consistent which names we give the bits to avoid
confusing people (mainly myself), that's all.

 __gen6_gt_wait_for_thread_c0(dev_priv);
}
   @@ -4434,8 +4439,8 @@ 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(FORCEWAKE_KERNEL));
   - /* something from same cacheline, but !FORCEWAKE_VLV */
   - POSTING_READ(FORCEWAKE_ACK_VLV);
   + I915_WRITE_NOTRACE(FORCEWAKE_MEDIA_VLV, 
   _MASKED_BIT_DISABLE(FORCEWAKE_KERNEL));
   + /* The below doubles as a POSTING_READ */
  
  Are we sure? ;)
  
 gen6_gt_check_fifodbg(dev_priv);
 
 Well it does a read first thing so I think so.

But does it read the right magic register? Referring to the magic ECOBUS
mess we had earlier. But if this code actually works, then I guess we
can be happy.

-- 
Ville Syrjälä
Intel OTC
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH 15/26] drm/i915: add media well to VLV force wake routines

2013-03-06 Thread Daniel Vetter
On Wed, Mar 06, 2013 at 10:33:34AM -0800, Jesse Barnes wrote:
 On Wed, 6 Mar 2013 20:28:07 +0200
 Ville Syrjälä ville.syrj...@linux.intel.com wrote:
 
  On Fri, Mar 01, 2013 at 02:08:31PM -0800, Jesse Barnes wrote:
   We could split this out into a separate routine at some point as an
   optimization.
  
  BTW did anyone try to gang wakeup thing instead?
 
 Not afaik.
 
  
   
   Signed-off-by: Jesse Barnes jbar...@virtuousgeek.org
   ---
drivers/gpu/drm/i915/i915_reg.h |2 ++
drivers/gpu/drm/i915/intel_pm.c |   11 ---
2 files changed, 10 insertions(+), 3 deletions(-)
   
   diff --git a/drivers/gpu/drm/i915/i915_reg.h 
   b/drivers/gpu/drm/i915/i915_reg.h
   index 1c6e066..558c6d1 100644
   --- a/drivers/gpu/drm/i915/i915_reg.h
   +++ b/drivers/gpu/drm/i915/i915_reg.h
   @@ -4271,6 +4271,8 @@
#define  FORCEWAKE   0xA18C
#define  FORCEWAKE_VLV   0x1300b0
#define  FORCEWAKE_ACK_VLV   0x1300b4
   +#define  FORCEWAKE_MEDIA_VLV 0x1300b8
   +#define  FORCEWAKE_ACK_MEDIA_VLV 0x1300bc
#define  FORCEWAKE_ACK_HSW   0x130044
#define  FORCEWAKE_ACK   0x130090
#define  VLV_GTLC_WAKE_CTRL  0x130090
   diff --git a/drivers/gpu/drm/i915/intel_pm.c 
   b/drivers/gpu/drm/i915/intel_pm.c
   index 3e976f4..e3947cb 100644
   --- a/drivers/gpu/drm/i915/intel_pm.c
   +++ b/drivers/gpu/drm/i915/intel_pm.c
   @@ -4423,10 +4423,15 @@ static void vlv_force_wake_get(struct 
   drm_i915_private *dev_priv)
 DRM_ERROR(Timed out waiting for forcewake old ack to 
   clear.\n);

 I915_WRITE_NOTRACE(FORCEWAKE_VLV, _MASKED_BIT_ENABLE(FORCEWAKE_KERNEL));
   + I915_WRITE_NOTRACE(FORCEWAKE_MEDIA_VLV, 
   _MASKED_BIT_ENABLE(FORCEWAKE_KERNEL));

 if (wait_for_atomic((I915_READ_NOTRACE(FORCEWAKE_ACK_VLV)  1),
 FORCEWAKE_ACK_TIMEOUT_MS))
   - DRM_ERROR(Timed out waiting for forcewake to ack request.\n);
   + DRM_ERROR(Timed out waiting for GT to ack forcewake 
   request.\n);
   +
   + if (wait_for_atomic((I915_READ_NOTRACE(FORCEWAKE_ACK_MEDIA_VLV)  1),
   + FORCEWAKE_ACK_TIMEOUT_MS))
   + DRM_ERROR(Timed out waiting for media to ack forcewake 
   request.\n);
  
  Based on some of my recent patches the ' 1's should be
  ' FORCEWAKE_KERNEL'.
 
 And that was based on my misunderstanding of MT forcewake.  I thought
 it was so the BIOS or AMT could do forcewake, but it's actually meant
 for multiple kernel thread accesses.  Since we don't do that, simply
 using the lowest bit all the time is fine.

You're a bit outdated, we now use that facility. It's the only way to pull
off the forcewake dance required to get scanline waits working on gen7. So
I guess the same applies for vlv ...
-Daniel

 
 __gen6_gt_wait_for_thread_c0(dev_priv);
}
   @@ -4434,8 +4439,8 @@ 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(FORCEWAKE_KERNEL));
   - /* something from same cacheline, but !FORCEWAKE_VLV */
   - POSTING_READ(FORCEWAKE_ACK_VLV);
   + I915_WRITE_NOTRACE(FORCEWAKE_MEDIA_VLV, 
   _MASKED_BIT_DISABLE(FORCEWAKE_KERNEL));
   + /* The below doubles as a POSTING_READ */
  
  Are we sure? ;)
  
 gen6_gt_check_fifodbg(dev_priv);
 
 Well it does a read first thing so I think so.
 
 -- 
 Jesse Barnes, Intel Open Source Technology Center
 ___
 Intel-gfx mailing list
 Intel-gfx@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH 15/26] drm/i915: add media well to VLV force wake routines

2013-03-06 Thread Jesse Barnes
On Wed, 6 Mar 2013 20:10:42 +0100
Daniel Vetter dan...@ffwll.ch wrote:

 On Wed, Mar 06, 2013 at 10:33:34AM -0800, Jesse Barnes wrote:
  On Wed, 6 Mar 2013 20:28:07 +0200
  Ville Syrjälä ville.syrj...@linux.intel.com wrote:
  
   On Fri, Mar 01, 2013 at 02:08:31PM -0800, Jesse Barnes wrote:
We could split this out into a separate routine at some point as an
optimization.
   
   BTW did anyone try to gang wakeup thing instead?
  
  Not afaik.
  
   

Signed-off-by: Jesse Barnes jbar...@virtuousgeek.org
---
 drivers/gpu/drm/i915/i915_reg.h |2 ++
 drivers/gpu/drm/i915/intel_pm.c |   11 ---
 2 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_reg.h 
b/drivers/gpu/drm/i915/i915_reg.h
index 1c6e066..558c6d1 100644
--- a/drivers/gpu/drm/i915/i915_reg.h
+++ b/drivers/gpu/drm/i915/i915_reg.h
@@ -4271,6 +4271,8 @@
 #define  FORCEWAKE 0xA18C
 #define  FORCEWAKE_VLV 0x1300b0
 #define  FORCEWAKE_ACK_VLV 0x1300b4
+#define  FORCEWAKE_MEDIA_VLV   0x1300b8
+#define  FORCEWAKE_ACK_MEDIA_VLV   0x1300bc
 #define  FORCEWAKE_ACK_HSW 0x130044
 #define  FORCEWAKE_ACK 0x130090
 #define  VLV_GTLC_WAKE_CTRL0x130090
diff --git a/drivers/gpu/drm/i915/intel_pm.c 
b/drivers/gpu/drm/i915/intel_pm.c
index 3e976f4..e3947cb 100644
--- a/drivers/gpu/drm/i915/intel_pm.c
+++ b/drivers/gpu/drm/i915/intel_pm.c
@@ -4423,10 +4423,15 @@ static void vlv_force_wake_get(struct 
drm_i915_private *dev_priv)
DRM_ERROR(Timed out waiting for forcewake old ack to 
clear.\n);
 
I915_WRITE_NOTRACE(FORCEWAKE_VLV, 
_MASKED_BIT_ENABLE(FORCEWAKE_KERNEL));
+   I915_WRITE_NOTRACE(FORCEWAKE_MEDIA_VLV, 
_MASKED_BIT_ENABLE(FORCEWAKE_KERNEL));
 
if (wait_for_atomic((I915_READ_NOTRACE(FORCEWAKE_ACK_VLV)  1),
FORCEWAKE_ACK_TIMEOUT_MS))
-   DRM_ERROR(Timed out waiting for forcewake to ack 
request.\n);
+   DRM_ERROR(Timed out waiting for GT to ack forcewake 
request.\n);
+
+   if (wait_for_atomic((I915_READ_NOTRACE(FORCEWAKE_ACK_MEDIA_VLV) 
 1),
+   FORCEWAKE_ACK_TIMEOUT_MS))
+   DRM_ERROR(Timed out waiting for media to ack forcewake 
request.\n);
   
   Based on some of my recent patches the ' 1's should be
   ' FORCEWAKE_KERNEL'.
  
  And that was based on my misunderstanding of MT forcewake.  I thought
  it was so the BIOS or AMT could do forcewake, but it's actually meant
  for multiple kernel thread accesses.  Since we don't do that, simply
  using the lowest bit all the time is fine.
 
 You're a bit outdated, we now use that facility. It's the only way to pull
 off the forcewake dance required to get scanline waits working on gen7. So
 I guess the same applies for vlv ...

Ah ok, I'll fix this up then.

-- 
Jesse Barnes, Intel Open Source Technology Center
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx