aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorBen Widawsky <ben@bwidawsk.net>2012-03-29 22:11:26 -0400
committerDaniel Vetter <daniel.vetter@ffwll.ch>2012-04-09 12:04:05 -0400
commite2a1e2f0242c363ed80458282d67039c373fbb1f (patch)
tree7219f4986094a8f86bcb09fe39af1e73199916f8 /drivers
parent96d6e3506739c1ca2ebe578eb157dfd504bfad3a (diff)
drm/i915: ring irq cleanups
- gen6 put/get only need one argument rflags and gflags are always the same (see above explanation) - remove a couple redundantly defined IRQs - reordered some lines to make things go in descending order Every ring has its own interrupts, enables, masks, and status bits that are fed into the main interrupt enable/mask/status registers. At one point in time it seemed like a good idea to make our functions support the notion that each interrupt may have a different bit position in the corresponding register (blitter parser error may be bit n in IMR, but bit m in blitter IMR). It turned out though that the HW designers did us a solid on Gen6+ and this unfortunate situation has been avoided. This allows our interrupt code to be cleaned up a bit. I jammed this into one commit because there should be no functional change with this commit, and staging it into multiple commits was unnecessarily artificial IMO. CC: Chris Wilson <chris@chris-wilson.co.uk> CC: Jesse Barnes <jbarnes@virtuousgeek.org> Signed-off-by: Ben Widawsky <benjamin.widawsky@intel.com> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk> [danvet: - fixed up merged conflict with vlv changes. - added GEN6 to GT blitter bit, we only use it on gen6+. - added a comment to both ring irq bits and GT irq bits that on gen6+ these alias. - added comment that GT_BSD_USER_INTERRUPT is ilk-only. - I've got confused a bit that we still use GT_USER_INTERRUPT on ivb for the render ring - but this goes back to ilk where we have only gt interrupt bits and so we be equally confusing if changed.] Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/gpu/drm/i915/i915_irq.c20
-rw-r--r--drivers/gpu/drm/i915/i915_reg.h12
-rw-r--r--drivers/gpu/drm/i915/intel_ringbuffer.c36
3 files changed, 30 insertions, 38 deletions
diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
index 01fb65097977..06286a270b07 100644
--- a/drivers/gpu/drm/i915/i915_irq.c
+++ b/drivers/gpu/drm/i915/i915_irq.c
@@ -462,7 +462,7 @@ static irqreturn_t valleyview_irq_handler(DRM_IRQ_ARGS)
462 notify_ring(dev, &dev_priv->ring[RCS]); 462 notify_ring(dev, &dev_priv->ring[RCS]);
463 if (gt_iir & GT_GEN6_BSD_USER_INTERRUPT) 463 if (gt_iir & GT_GEN6_BSD_USER_INTERRUPT)
464 notify_ring(dev, &dev_priv->ring[VCS]); 464 notify_ring(dev, &dev_priv->ring[VCS]);
465 if (gt_iir & GT_BLT_USER_INTERRUPT) 465 if (gt_iir & GT_GEN6_BLT_USER_INTERRUPT)
466 notify_ring(dev, &dev_priv->ring[BCS]); 466 notify_ring(dev, &dev_priv->ring[BCS]);
467 467
468 if (gt_iir & (GT_GEN6_BLT_CS_ERROR_INTERRUPT | 468 if (gt_iir & (GT_GEN6_BLT_CS_ERROR_INTERRUPT |
@@ -620,9 +620,9 @@ static irqreturn_t ivybridge_irq_handler(DRM_IRQ_ARGS)
620 620
621 if (gt_iir & (GT_USER_INTERRUPT | GT_PIPE_NOTIFY)) 621 if (gt_iir & (GT_USER_INTERRUPT | GT_PIPE_NOTIFY))
622 notify_ring(dev, &dev_priv->ring[RCS]); 622 notify_ring(dev, &dev_priv->ring[RCS]);
623 if (gt_iir & GT_GEN6_BSD_USER_INTERRUPT) 623 if (gt_iir & GEN6_BSD_USER_INTERRUPT)
624 notify_ring(dev, &dev_priv->ring[VCS]); 624 notify_ring(dev, &dev_priv->ring[VCS]);
625 if (gt_iir & GT_BLT_USER_INTERRUPT) 625 if (gt_iir & GEN6_BLITTER_USER_INTERRUPT)
626 notify_ring(dev, &dev_priv->ring[BCS]); 626 notify_ring(dev, &dev_priv->ring[BCS]);
627 627
628 if (de_iir & DE_GSE_IVB) 628 if (de_iir & DE_GSE_IVB)
@@ -688,7 +688,7 @@ static irqreturn_t ironlake_irq_handler(DRM_IRQ_ARGS)
688 atomic_inc(&dev_priv->irq_received); 688 atomic_inc(&dev_priv->irq_received);
689 689
690 if (IS_GEN6(dev)) 690 if (IS_GEN6(dev))
691 bsd_usr_interrupt = GT_GEN6_BSD_USER_INTERRUPT; 691 bsd_usr_interrupt = GEN6_BSD_USER_INTERRUPT;
692 692
693 /* disable master interrupt before clearing iir */ 693 /* disable master interrupt before clearing iir */
694 de_ier = I915_READ(DEIER); 694 de_ier = I915_READ(DEIER);
@@ -722,7 +722,7 @@ static irqreturn_t ironlake_irq_handler(DRM_IRQ_ARGS)
722 notify_ring(dev, &dev_priv->ring[RCS]); 722 notify_ring(dev, &dev_priv->ring[RCS]);
723 if (gt_iir & bsd_usr_interrupt) 723 if (gt_iir & bsd_usr_interrupt)
724 notify_ring(dev, &dev_priv->ring[VCS]); 724 notify_ring(dev, &dev_priv->ring[VCS]);
725 if (gt_iir & GT_BLT_USER_INTERRUPT) 725 if (gt_iir & GEN6_BLITTER_USER_INTERRUPT)
726 notify_ring(dev, &dev_priv->ring[BCS]); 726 notify_ring(dev, &dev_priv->ring[BCS]);
727 727
728 if (de_iir & DE_GSE) 728 if (de_iir & DE_GSE)
@@ -2081,8 +2081,8 @@ static int ironlake_irq_postinstall(struct drm_device *dev)
2081 if (IS_GEN6(dev)) 2081 if (IS_GEN6(dev))
2082 render_irqs = 2082 render_irqs =
2083 GT_USER_INTERRUPT | 2083 GT_USER_INTERRUPT |
2084 GT_GEN6_BSD_USER_INTERRUPT | 2084 GEN6_BSD_USER_INTERRUPT |
2085 GT_BLT_USER_INTERRUPT; 2085 GEN6_BLITTER_USER_INTERRUPT;
2086 else 2086 else
2087 render_irqs = 2087 render_irqs =
2088 GT_USER_INTERRUPT | 2088 GT_USER_INTERRUPT |
@@ -2154,8 +2154,8 @@ static int ivybridge_irq_postinstall(struct drm_device *dev)
2154 I915_WRITE(GTIIR, I915_READ(GTIIR)); 2154 I915_WRITE(GTIIR, I915_READ(GTIIR));
2155 I915_WRITE(GTIMR, dev_priv->gt_irq_mask); 2155 I915_WRITE(GTIMR, dev_priv->gt_irq_mask);
2156 2156
2157 render_irqs = GT_USER_INTERRUPT | GT_GEN6_BSD_USER_INTERRUPT | 2157 render_irqs = GT_USER_INTERRUPT | GEN6_BSD_USER_INTERRUPT |
2158 GT_BLT_USER_INTERRUPT; 2158 GEN6_BLITTER_USER_INTERRUPT;
2159 I915_WRITE(GTIER, render_irqs); 2159 I915_WRITE(GTIER, render_irqs);
2160 POSTING_READ(GTIER); 2160 POSTING_READ(GTIER);
2161 2161
@@ -2218,7 +2218,7 @@ static int valleyview_irq_postinstall(struct drm_device *dev)
2218 2218
2219 render_irqs = GT_GEN6_BLT_FLUSHDW_NOTIFY_INTERRUPT | 2219 render_irqs = GT_GEN6_BLT_FLUSHDW_NOTIFY_INTERRUPT |
2220 GT_GEN6_BLT_CS_ERROR_INTERRUPT | 2220 GT_GEN6_BLT_CS_ERROR_INTERRUPT |
2221 GT_BLT_USER_INTERRUPT | 2221 GT_GEN6_BLT_USER_INTERRUPT |
2222 GT_GEN6_BSD_USER_INTERRUPT | 2222 GT_GEN6_BSD_USER_INTERRUPT |
2223 GT_GEN6_BSD_CS_ERROR_INTERRUPT | 2223 GT_GEN6_BSD_CS_ERROR_INTERRUPT |
2224 GT_GEN7_L3_PARITY_ERROR_INTERRUPT | 2224 GT_GEN7_L3_PARITY_ERROR_INTERRUPT |
diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
index 0f6f567ae507..56d4db8026e3 100644
--- a/drivers/gpu/drm/i915/i915_reg.h
+++ b/drivers/gpu/drm/i915/i915_reg.h
@@ -643,7 +643,9 @@
643#define CACHE_MODE_1 0x7004 /* IVB+ */ 643#define CACHE_MODE_1 0x7004 /* IVB+ */
644#define PIXEL_SUBSPAN_COLLECT_OPT_DISABLE (1<<6) 644#define PIXEL_SUBSPAN_COLLECT_OPT_DISABLE (1<<6)
645 645
646/* GEN6 interrupt control */ 646/* GEN6 interrupt control
647 * Note that the per-ring interrupt bits do alias with the global interrupt bits
648 * in GTIMR. */
647#define GEN6_RENDER_HWSTAM 0x2098 649#define GEN6_RENDER_HWSTAM 0x2098
648#define GEN6_RENDER_IMR 0x20a8 650#define GEN6_RENDER_IMR 0x20a8
649#define GEN6_RENDER_CONTEXT_SWITCH_INTERRUPT (1 << 8) 651#define GEN6_RENDER_CONTEXT_SWITCH_INTERRUPT (1 << 8)
@@ -3203,13 +3205,15 @@
3203#define DEIIR 0x44008 3205#define DEIIR 0x44008
3204#define DEIER 0x4400c 3206#define DEIER 0x4400c
3205 3207
3206/* GT interrupt */ 3208/* GT interrupt.
3209 * Note that for gen6+ the ring-specific interrupt bits do alias with the
3210 * corresponding bits in the per-ring interrupt control registers. */
3207#define GT_GEN6_BLT_FLUSHDW_NOTIFY_INTERRUPT (1 << 26) 3211#define GT_GEN6_BLT_FLUSHDW_NOTIFY_INTERRUPT (1 << 26)
3208#define GT_GEN6_BLT_CS_ERROR_INTERRUPT (1 << 25) 3212#define GT_GEN6_BLT_CS_ERROR_INTERRUPT (1 << 25)
3209#define GT_BLT_USER_INTERRUPT (1 << 22) 3213#define GT_GEN6_BLT_USER_INTERRUPT (1 << 22)
3210#define GT_GEN6_BSD_CS_ERROR_INTERRUPT (1 << 15) 3214#define GT_GEN6_BSD_CS_ERROR_INTERRUPT (1 << 15)
3211#define GT_GEN6_BSD_USER_INTERRUPT (1 << 12) 3215#define GT_GEN6_BSD_USER_INTERRUPT (1 << 12)
3212#define GT_BSD_USER_INTERRUPT (1 << 5) 3216#define GT_BSD_USER_INTERRUPT (1 << 5) /* ilk only */
3213#define GT_GEN7_L3_PARITY_ERROR_INTERRUPT (1 << 5) 3217#define GT_GEN7_L3_PARITY_ERROR_INTERRUPT (1 << 5)
3214#define GT_PIPE_NOTIFY (1 << 4) 3218#define GT_PIPE_NOTIFY (1 << 4)
3215#define GT_RENDER_CS_ERROR_INTERRUPT (1 << 3) 3219#define GT_RENDER_CS_ERROR_INTERRUPT (1 << 3)
diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.c b/drivers/gpu/drm/i915/intel_ringbuffer.c
index 75081f146390..c7eea7fad16f 100644
--- a/drivers/gpu/drm/i915/intel_ringbuffer.c
+++ b/drivers/gpu/drm/i915/intel_ringbuffer.c
@@ -788,7 +788,7 @@ ring_add_request(struct intel_ring_buffer *ring,
788} 788}
789 789
790static bool 790static bool
791gen6_ring_get_irq(struct intel_ring_buffer *ring, u32 gflag, u32 rflag) 791gen6_ring_get_irq(struct intel_ring_buffer *ring, u32 mask)
792{ 792{
793 struct drm_device *dev = ring->dev; 793 struct drm_device *dev = ring->dev;
794 drm_i915_private_t *dev_priv = dev->dev_private; 794 drm_i915_private_t *dev_priv = dev->dev_private;
@@ -803,9 +803,9 @@ gen6_ring_get_irq(struct intel_ring_buffer *ring, u32 gflag, u32 rflag)
803 803
804 spin_lock(&ring->irq_lock); 804 spin_lock(&ring->irq_lock);
805 if (ring->irq_refcount++ == 0) { 805 if (ring->irq_refcount++ == 0) {
806 ring->irq_mask &= ~rflag; 806 ring->irq_mask &= ~mask;
807 I915_WRITE_IMR(ring, ring->irq_mask); 807 I915_WRITE_IMR(ring, ring->irq_mask);
808 ironlake_enable_irq(dev_priv, gflag); 808 ironlake_enable_irq(dev_priv, mask);
809 } 809 }
810 spin_unlock(&ring->irq_lock); 810 spin_unlock(&ring->irq_lock);
811 811
@@ -813,16 +813,16 @@ gen6_ring_get_irq(struct intel_ring_buffer *ring, u32 gflag, u32 rflag)
813} 813}
814 814
815static void 815static void
816gen6_ring_put_irq(struct intel_ring_buffer *ring, u32 gflag, u32 rflag) 816gen6_ring_put_irq(struct intel_ring_buffer *ring, u32 mask)
817{ 817{
818 struct drm_device *dev = ring->dev; 818 struct drm_device *dev = ring->dev;
819 drm_i915_private_t *dev_priv = dev->dev_private; 819 drm_i915_private_t *dev_priv = dev->dev_private;
820 820
821 spin_lock(&ring->irq_lock); 821 spin_lock(&ring->irq_lock);
822 if (--ring->irq_refcount == 0) { 822 if (--ring->irq_refcount == 0) {
823 ring->irq_mask |= rflag; 823 ring->irq_mask |= mask;
824 I915_WRITE_IMR(ring, ring->irq_mask); 824 I915_WRITE_IMR(ring, ring->irq_mask);
825 ironlake_disable_irq(dev_priv, gflag); 825 ironlake_disable_irq(dev_priv, mask);
826 } 826 }
827 spin_unlock(&ring->irq_lock); 827 spin_unlock(&ring->irq_lock);
828 828
@@ -1376,33 +1376,25 @@ gen6_ring_dispatch_execbuffer(struct intel_ring_buffer *ring,
1376static bool 1376static bool
1377gen6_render_ring_get_irq(struct intel_ring_buffer *ring) 1377gen6_render_ring_get_irq(struct intel_ring_buffer *ring)
1378{ 1378{
1379 return gen6_ring_get_irq(ring, 1379 return gen6_ring_get_irq(ring, GT_USER_INTERRUPT);
1380 GT_USER_INTERRUPT,
1381 GEN6_RENDER_USER_INTERRUPT);
1382} 1380}
1383 1381
1384static void 1382static void
1385gen6_render_ring_put_irq(struct intel_ring_buffer *ring) 1383gen6_render_ring_put_irq(struct intel_ring_buffer *ring)
1386{ 1384{
1387 return gen6_ring_put_irq(ring, 1385 return gen6_ring_put_irq(ring, GT_USER_INTERRUPT);
1388 GT_USER_INTERRUPT,
1389 GEN6_RENDER_USER_INTERRUPT);
1390} 1386}
1391 1387
1392static bool 1388static bool
1393gen6_bsd_ring_get_irq(struct intel_ring_buffer *ring) 1389gen6_bsd_ring_get_irq(struct intel_ring_buffer *ring)
1394{ 1390{
1395 return gen6_ring_get_irq(ring, 1391 return gen6_ring_get_irq(ring, GEN6_BSD_USER_INTERRUPT);
1396 GT_GEN6_BSD_USER_INTERRUPT,
1397 GEN6_BSD_USER_INTERRUPT);
1398} 1392}
1399 1393
1400static void 1394static void
1401gen6_bsd_ring_put_irq(struct intel_ring_buffer *ring) 1395gen6_bsd_ring_put_irq(struct intel_ring_buffer *ring)
1402{ 1396{
1403 return gen6_ring_put_irq(ring, 1397 return gen6_ring_put_irq(ring, GEN6_BSD_USER_INTERRUPT);
1404 GT_GEN6_BSD_USER_INTERRUPT,
1405 GEN6_BSD_USER_INTERRUPT);
1406} 1398}
1407 1399
1408/* ring buffer for Video Codec for Gen6+ */ 1400/* ring buffer for Video Codec for Gen6+ */
@@ -1431,17 +1423,13 @@ static const struct intel_ring_buffer gen6_bsd_ring = {
1431static bool 1423static bool
1432blt_ring_get_irq(struct intel_ring_buffer *ring) 1424blt_ring_get_irq(struct intel_ring_buffer *ring)
1433{ 1425{
1434 return gen6_ring_get_irq(ring, 1426 return gen6_ring_get_irq(ring, GEN6_BLITTER_USER_INTERRUPT);
1435 GT_BLT_USER_INTERRUPT,
1436 GEN6_BLITTER_USER_INTERRUPT);
1437} 1427}
1438 1428
1439static void 1429static void
1440blt_ring_put_irq(struct intel_ring_buffer *ring) 1430blt_ring_put_irq(struct intel_ring_buffer *ring)
1441{ 1431{
1442 gen6_ring_put_irq(ring, 1432 gen6_ring_put_irq(ring, GEN6_BLITTER_USER_INTERRUPT);
1443 GT_BLT_USER_INTERRUPT,
1444 GEN6_BLITTER_USER_INTERRUPT);
1445} 1433}
1446 1434
1447static int blt_ring_flush(struct intel_ring_buffer *ring, 1435static int blt_ring_flush(struct intel_ring_buffer *ring,