Skip to contentSkip to conversation

drm/i915: consolidate interrupt naming scheme

PATCH In review Ben Widawsky 2 participants 4 messages May 18, 2012 – May 21, 2012

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/i915: consolidate interrupt naming scheme

here are some opportunities to do things a bit better with the naming of things now that our hindsight is better.

---
 drivers/gpu/drm/i915/i915_irq.c         |   72 +++++++++++-----------
 drivers/gpu/drm/i915/i915_reg.h         |  100 +++++++++++++------------------
 drivers/gpu/drm/i915/intel_ringbuffer.c |   11 ++--
 3 files changed, 84 insertions(+), 99 deletions(-)
drivers/gpu/drm/i915/i915_irq.c +36 -36
index cc4a633..a13762a 100644
@@ -403,17 +403,17 @@ static void snb_gt_irq_handler(struct drm_device *dev,
 			       u32 gt_iir)
 {
 
-	if (gt_iir & (GEN6_RENDER_USER_INTERRUPT |
-		      GEN6_RENDER_PIPE_CONTROL_NOTIFY_INTERRUPT))
+	if (gt_iir & (INTEL_RENDER_USER_INTERRUPT |
+		      INTEL_RENDER_PIPECTL_NOTIFY_INTERRUPT))
 		notify_ring(dev, &dev_priv->ring[RCS]);
-	if (gt_iir & GEN6_BSD_USER_INTERRUPT)
+	if (gt_iir & INTEL_BSD_USER_INTERRUPT)
 		notify_ring(dev, &dev_priv->ring[VCS]);
-	if (gt_iir & GEN6_BLITTER_USER_INTERRUPT)
+	if (gt_iir & INTEL_BLT_USER_INTERRUPT)
 		notify_ring(dev, &dev_priv->ring[BCS]);
 
-	if (gt_iir & (GT_GEN6_BLT_CS_ERROR_INTERRUPT |
-		      GT_GEN6_BSD_CS_ERROR_INTERRUPT |
-		      GT_RENDER_CS_ERROR_INTERRUPT)) {
+	if (gt_iir & (INTEL_BLT_CS_ERROR_INTERRUPT |
+		      INTEL_BSD_CS_ERROR_INTERRUPT |
+		      INTEL_RENDER_MASTER_ERROR_INTERRUPT)) {
 		DRM_ERROR("GT error interrupt 0x%08x\n", gt_iir);
 		i915_handle_error(dev, false);
 	}
@@ -642,9 +642,10 @@ static void ilk_gt_irq_handler(struct drm_device *dev,
 			       struct drm_i915_private *dev_priv,
 			       u32 gt_iir)
 {
-	if (gt_iir & (GT_USER_INTERRUPT | GT_PIPE_NOTIFY))
+	if (gt_iir & (INTEL_RENDER_USER_INTERRUPT |
+		      INTEL_RENDER_PIPECTL_NOTIFY_INTERRUPT))
 		notify_ring(dev, &dev_priv->ring[RCS]);
-	if (gt_iir & GT_BSD_USER_INTERRUPT)
+	if (gt_iir & ILK_BSD_USER_INTERRUPT)
 		notify_ring(dev, &dev_priv->ring[VCS]);
 }
 
@@ -1718,7 +1719,7 @@ static int ironlake_irq_postinstall(struct drm_device *dev)
 	/* enable kind of interrupts always enabled */
 	u32 display_mask = DE_MASTER_IRQ_CONTROL | DE_GSE | DE_PCH_EVENT |
 			   DE_PLANEA_FLIP_DONE | DE_PLANEB_FLIP_DONE;
-	u32 render_irqs;
+	u32 gt_irqs;
 	u32 hotplug_mask;
 
 	dev_priv->irq_mask = ~display_mask;
@@ -1734,17 +1735,16 @@ static int ironlake_irq_postinstall(struct drm_device *dev)
 	I915_WRITE(GTIIR, I915_READ(GTIIR));
 	I915_WRITE(GTIMR, dev_priv->gt_irq_mask);
 
+	gt_irqs = INTEL_RENDER_USER_INTERRUPT;
+
 	if (IS_GEN6(dev))
-		render_irqs =
-			GT_USER_INTERRUPT |
-			GEN6_BSD_USER_INTERRUPT |
-			GEN6_BLITTER_USER_INTERRUPT;
+		gt_irqs |= INTEL_BLT_USER_INTERRUPT |
+			   INTEL_BSD_USER_INTERRUPT;
 	else
-		render_irqs =
-			GT_USER_INTERRUPT |
-			GT_PIPE_NOTIFY |
-			GT_BSD_USER_INTERRUPT;
-	I915_WRITE(GTIER, render_irqs);
+		gt_irqs |= INTEL_RENDER_PIPECTL_NOTIFY_INTERRUPT |
+			   ILK_BSD_USER_INTERRUPT;
+
+	I915_WRITE(GTIER, gt_irqs);
 	POSTING_READ(GTIER);
 
 	if (HAS_PCH_CPT(dev)) {
@@ -1788,7 +1788,7 @@ static int ivybridge_irq_postinstall(struct drm_device *dev)
 		DE_PLANEC_FLIP_DONE_IVB |
 		DE_PLANEB_FLIP_DONE_IVB |
 		DE_PLANEA_FLIP_DONE_IVB;
-	u32 render_irqs;
+	u32 gt_irqs;
 	u32 hotplug_mask;
 
 	dev_priv->irq_mask = ~display_mask;
@@ -1808,9 +1808,9 @@ static int ivybridge_irq_postinstall(struct drm_device *dev)
 	I915_WRITE(GTIIR, I915_READ(GTIIR));
 	I915_WRITE(GTIMR, dev_priv->gt_irq_mask);
 
-	render_irqs = GT_USER_INTERRUPT | GEN6_BSD_USER_INTERRUPT |
-		GEN6_BLITTER_USER_INTERRUPT;
-	I915_WRITE(GTIER, render_irqs);
+	gt_irqs = INTEL_RENDER_USER_INTERRUPT | INTEL_BSD_USER_INTERRUPT |
+		  INTEL_BLT_USER_INTERRUPT;
+	I915_WRITE(GTIER, gt_irqs);
 	POSTING_READ(GTIER);
 
 	hotplug_mask = (SDE_CRT_HOTPLUG_CPT |
@@ -1832,7 +1832,7 @@ static int ivybridge_irq_postinstall(struct drm_device *dev)
 static int valleyview_irq_postinstall(struct drm_device *dev)
 {
 	drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private;
-	u32 render_irqs;
+	u32 gt_irqs;
 	u32 enable_mask;
 	u32 hotplug_en = I915_READ(PORT_HOTPLUG_EN);
 	u16 msid;
@@ -1863,23 +1863,23 @@ static int valleyview_irq_postinstall(struct drm_device *dev)
 	I915_WRITE(VLV_IIR, 0xffffffff);
 	I915_WRITE(VLV_IIR, 0xffffffff);
 
-	render_irqs = GT_GEN6_BLT_FLUSHDW_NOTIFY_INTERRUPT |
-		GT_GEN6_BLT_CS_ERROR_INTERRUPT |
-		GT_GEN6_BLT_USER_INTERRUPT |
-		GT_GEN6_BSD_USER_INTERRUPT |
-		GT_GEN6_BSD_CS_ERROR_INTERRUPT |
-		GT_GEN7_L3_PARITY_ERROR_INTERRUPT |
-		GT_PIPE_NOTIFY |
-		GT_RENDER_CS_ERROR_INTERRUPT |
-		GT_SYNC_STATUS |
-		GT_USER_INTERRUPT;
+	gt_irqs = INTEL_BLT_FLUSHDW_NOTIFY_INTERRUPT |
+		INTEL_BLT_CS_ERROR_INTERRUPT |
+		INTEL_BLT_USER_INTERRUPT |
+		INTEL_BSD_USER_INTERRUPT |
+		INTEL_BSD_CS_ERROR_INTERRUPT |
+		INTEL_RENDER_L3_PARITY_ERROR_INTERRUPT |
+		INTEL_RENDER_PIPECTL_NOTIFY_INTERRUPT |
+		INTEL_RENDER_MASTER_ERROR_INTERRUPT |
+		INTEL_RENDER_SYNC_STATUS_INTERRUPT |
+		INTEL_RENDER_USER_INTERRUPT;
 
-	dev_priv->gt_irq_mask = ~render_irqs;
+	dev_priv->gt_irq_mask = ~gt_irqs;
 
 	I915_WRITE(GTIIR, I915_READ(GTIIR));
 	I915_WRITE(GTIIR, I915_READ(GTIIR));
 	I915_WRITE(GTIMR, 0);
-	I915_WRITE(GTIER, render_irqs);
+	I915_WRITE(GTIER, gt_irqs);
 	POSTING_READ(GTIER);
 
 	/* ack & enable invalid PTE error interrupts */
drivers/gpu/drm/i915/i915_reg.h +42 -58

124 lines not on this page · raw message

drivers/gpu/drm/i915/intel_ringbuffer.c +6 -5
index 5b30815..7ce40c4 100644
@@ -1327,7 +1327,7 @@ int intel_init_render_ring_buffer(struct drm_device *dev)
 		ring->flush = gen6_render_ring_flush;
 		ring->irq_get = gen6_ring_get_irq;
 		ring->irq_put = gen6_ring_put_irq;
-		ring->irq_enable_mask = GT_USER_INTERRUPT;
+		ring->irq_enable_mask = INTEL_RENDER_USER_INTERRUPT;
 		ring->get_seqno = gen6_ring_get_seqno;
 		ring->sync_to = gen6_ring_sync;
 		ring->semaphore_register[RCS] = MI_SEMAPHORE_SYNC_INVALID;
@@ -1341,7 +1341,8 @@ int intel_init_render_ring_buffer(struct drm_device *dev)
 		ring->get_seqno = pc_render_get_seqno;
 		ring->irq_get = gen5_ring_get_irq;
 		ring->irq_put = gen5_ring_put_irq;
-		ring->irq_enable_mask = GT_USER_INTERRUPT | GT_PIPE_NOTIFY;
+		ring->irq_enable_mask = INTEL_RENDER_USER_INTERRUPT |
+					INTEL_RENDER_PIPECTL_NOTIFY_INTERRUPT;
 	} else {
 		ring->add_request = i9xx_add_request;
 		if (INTEL_INFO(dev)->gen < 4)
@@ -1460,7 +1461,7 @@ int intel_init_bsd_ring_buffer(struct drm_device *dev)
 		ring->flush = gen6_bsd_ring_flush;
 		ring->add_request = gen6_add_request;
 		ring->get_seqno = gen6_ring_get_seqno;
-		ring->irq_enable_mask = GEN6_BSD_USER_INTERRUPT;
+		ring->irq_enable_mask = INTEL_BSD_USER_INTERRUPT;
 		ring->irq_get = gen6_ring_get_irq;
 		ring->irq_put = gen6_ring_put_irq;
 		ring->dispatch_execbuffer = gen6_ring_dispatch_execbuffer;
@@ -1476,7 +1477,7 @@ int intel_init_bsd_ring_buffer(struct drm_device *dev)
 		ring->add_request = i9xx_add_request;
 		ring->get_seqno = ring_get_seqno;
 		if (IS_GEN5(dev)) {
-			ring->irq_enable_mask = GT_BSD_USER_INTERRUPT;
+			ring->irq_enable_mask = ILK_BSD_USER_INTERRUPT;
 			ring->irq_get = gen5_ring_get_irq;
 			ring->irq_put = gen5_ring_put_irq;
 		} else {
@@ -1505,7 +1506,7 @@ int intel_init_blt_ring_buffer(struct drm_device *dev)
 	ring->flush = gen6_ring_flush;
 	ring->add_request = gen6_add_request;
 	ring->get_seqno = gen6_ring_get_seqno;
-	ring->irq_enable_mask = GEN6_BLITTER_USER_INTERRUPT;
+	ring->irq_enable_mask = INTEL_BLT_USER_INTERRUPT;
 	ring->irq_get = gen6_ring_get_irq;
 	ring->irq_put = gen6_ring_put_irq;
 	ring->dispatch_execbuffer = gen6_ring_dispatch_execbuffer;
Signature · 1 line
1.7.10.2
#1 lore raw
Quoted 2 lines · Ben Widawsky

here are some opportunities to do things a bit better with the naming of things now that our hindsight is better.

The major problem with this is that it breaks the expectations of the INTEL_ namespace, masquerading per-gen values as fixed constants for all chipsets.
-Chris

Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
#2 lore raw
Quoted 9 lines · On Mon, 21 May 2012 09:46:00 +0100 Chris Wilson <[email protected]>…
Quoted 2 lines · Ben Widawsky

here are some opportunities to do things a bit better with the naming of things now that our hindsight is better.

The major problem with this is that it breaks the expectations of the INTEL_ namespace, masquerading per-gen values as fixed constants for all chipsets.
-Chris

With only a couple of exceptions (BSD user interrupt) there is no need for per-gen values. I think we shouldn't have much trouble maintaining this as is. The existing naming scheme wrongly calls things GEN6 when they were introduced earlier (I'm also not sure GT_ is valid for every interrupt). So the goal was to have I915_* for old stuff, INTEL_* for everything, and DEVICENAME_ for special cases.

Signature · 1 line
Ben Widawsky, Intel Open Source Technology Center
#3 lore raw
Quoted 13 lines · Ben Widawsky
Quoted 9 lines · On Mon, 21 May 2012 09:46:00 +0100 Chris Wilson <[email protected]>…
Quoted 2 lines · Ben Widawsky

here are some opportunities to do things a bit better with the naming of things now that our hindsight is better.

The major problem with this is that it breaks the expectations of the INTEL_ namespace, masquerading per-gen values as fixed constants for all chipsets.
-Chris

Quoted 6 lines

With only a couple of exceptions (BSD user interrupt) there is no need for per-gen values. I think we shouldn't have much trouble maintaining this as is. The existing naming scheme wrongly calls things GEN6 when they were introduced earlier (I'm also not sure GT_ is valid for every interrupt). So the goal was to have I915_* for old stuff, INTEL_* for everything, and DEVICENAME_ for special cases.

I concur that the current names are rather ad-hoc and not well thought out. I'm just not buying that this replacement is any better. INTEL_BSD is a complete turn off.
-Chris

Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre