diff mbox

drm/i915: fix user irq miss in BSD ring on g4x

Message ID 1305532959-12395-1-git-send-email-boqun.feng@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Feng, Boqun May 16, 2011, 8:02 a.m. UTC
On g4x, user interrupt in BSD ring is missed.
This is because though g4x and ironlake share the same bsd_ring, 
their interrupt control interfaces have _two_ differences. 

1.different irq enable/disable functions:
On g4x are i915_enable_irq and i915_disable_irq.
On ironlake are ironlake_enable_irq and ironlake_disable_irq.
2.different irq flag: 
On g4x user interrupt flag in BSD ring on is I915_BSD_USER_INTERRUPT.
On ironlake is GT_BSD_USER_INTERRUPT

Old bsd_ring_get/put_irq call ring_get_irq and ring_get_irq.
ring_get_irq and ring_put_irq only call ironlake_enable/disable_irq.
So comes the irq miss on g4x. 

To fix this, as other rings' code do, conditionally call different 
functions(i915_enable/disable_irq and ironlake_enable/disable_irq)
and use different interrupt flags in bsd_ring_get/put_irq.

Signed-off-by: Feng, Boqun <boqun.feng@intel.com>
Reviewed-by: Xiang, Haihao <haihao.xiang@intel.com>
Cc: stable@kernel.org
---
 drivers/gpu/drm/i915/intel_ringbuffer.c |   29 +++++++++++++++++++++++++++--
 1 files changed, 27 insertions(+), 2 deletions(-)

Comments

Konstantin Belousov May 16, 2011, 10:27 a.m. UTC | #1
On Mon, May 16, 2011 at 04:02:39PM +0800, Feng, Boqun wrote:
> On g4x, user interrupt in BSD ring is missed.
> This is because though g4x and ironlake share the same bsd_ring, 
> their interrupt control interfaces have _two_ differences. 
> 
> 1.different irq enable/disable functions:
> On g4x are i915_enable_irq and i915_disable_irq.
> On ironlake are ironlake_enable_irq and ironlake_disable_irq.
> 2.different irq flag: 
> On g4x user interrupt flag in BSD ring on is I915_BSD_USER_INTERRUPT.
> On ironlake is GT_BSD_USER_INTERRUPT
> 
> Old bsd_ring_get/put_irq call ring_get_irq and ring_get_irq.
> ring_get_irq and ring_put_irq only call ironlake_enable/disable_irq.
> So comes the irq miss on g4x. 
> 
> To fix this, as other rings' code do, conditionally call different 
> functions(i915_enable/disable_irq and ironlake_enable/disable_irq)
> and use different interrupt flags in bsd_ring_get/put_irq.
> 
> Signed-off-by: Feng, Boqun <boqun.feng@intel.com>
> Reviewed-by: Xiang, Haihao <haihao.xiang@intel.com>
> Cc: stable@kernel.org
It seems that the patch removes that last use for ring_get_irq() and
ring_put_irq() ? Are the helpers still needed ?
Keith Packard May 16, 2011, 7:53 p.m. UTC | #2
On Mon, 16 May 2011 13:27:27 +0300, Konstantin Belousov <kostikbel@gmail.com> wrote:

> It seems that the patch removes that last use for ring_get_irq() and
> ring_put_irq() ? Are the helpers still needed ?

You're right -- these helpers are no longer used and are removed in the
second patch in this sequence.
Keith Packard May 16, 2011, 7:58 p.m. UTC | #3
On Mon, 16 May 2011 16:02:39 +0800, "Feng, Boqun" <boqun.feng@intel.com> wrote:
> On g4x, user interrupt in BSD ring is missed.
> This is because though g4x and ironlake share the same bsd_ring, 
> their interrupt control interfaces have _two_ differences.

Merged.
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.c b/drivers/gpu/drm/i915/intel_ringbuffer.c
index e9e6f71..c4504a2 100644
--- a/drivers/gpu/drm/i915/intel_ringbuffer.c
+++ b/drivers/gpu/drm/i915/intel_ringbuffer.c
@@ -666,12 +666,37 @@  gen6_ring_put_irq(struct intel_ring_buffer *ring, u32 gflag, u32 rflag)
 static bool
 bsd_ring_get_irq(struct intel_ring_buffer *ring)
 {
-	return ring_get_irq(ring, GT_BSD_USER_INTERRUPT);
+	struct drm_device *dev = ring->dev;
+	drm_i915_private_t *dev_priv = dev->dev_private;
+
+	if (!dev->irq_enabled)
+		return false;
+
+	spin_lock(&ring->irq_lock);
+	if (ring->irq_refcount++ == 0) {
+		if (IS_G4X(dev))
+			i915_enable_irq(dev_priv, I915_BSD_USER_INTERRUPT);
+		else
+			ironlake_enable_irq(dev_priv, GT_BSD_USER_INTERRUPT);
+	}
+	spin_unlock(&ring->irq_lock);
+
+	return true;
 }
 static void
 bsd_ring_put_irq(struct intel_ring_buffer *ring)
 {
-	ring_put_irq(ring, GT_BSD_USER_INTERRUPT);
+	struct drm_device *dev = ring->dev;
+	drm_i915_private_t *dev_priv = dev->dev_private;
+
+	spin_lock(&ring->irq_lock);
+	if (--ring->irq_refcount == 0) {
+		if (IS_G4X(dev))
+			i915_disable_irq(dev_priv, I915_BSD_USER_INTERRUPT);
+		else
+			ironlake_disable_irq(dev_priv, GT_BSD_USER_INTERRUPT);
+	}
+	spin_unlock(&ring->irq_lock);
 }
 
 static int