drm/i915: Avoid a double-read of PCH_IIR during interrupt handling
authorChris Wilson <chris@chris-wilson.co.uk>
Wed, 9 May 2012 20:45:43 +0000 (21:45 +0100)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Thu, 10 May 2012 09:51:30 +0000 (11:51 +0200)
Currently the code re-reads PCH_IIR during the hotplug interrupt
processing. Not only is this a wasted read, but introduces a potential
for handling a spurious interrupt as we then may not clear all the
interrupts processed (since the re-read IIR may contains more interrupts
asserted than we clear using the result of the original read).

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Jesse Barnes <jbarnes@virtuousgeek.org>
Cc: stable@kernel.org
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
drivers/gpu/drm/i915/i915_irq.c

index b4999b5288e84be946c63680d28040094be3fbd5..14943ba4d7317b77d1b38ae96aed534aa6ee7a15 100644 (file)
@@ -533,14 +533,11 @@ out:
        return ret;
 }
 
-static void pch_irq_handler(struct drm_device *dev)
+static void pch_irq_handler(struct drm_device *dev, u32 pch_iir)
 {
        drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private;
-       u32 pch_iir;
        int pipe;
 
-       pch_iir = I915_READ(SDEIIR);
-
        if (pch_iir & SDE_AUDIO_POWER_MASK)
                DRM_DEBUG_DRIVER("PCH audio power change on port %d\n",
                                 (pch_iir & SDE_AUDIO_POWER_MASK) >>
@@ -633,7 +630,7 @@ static irqreturn_t ivybridge_irq_handler(DRM_IRQ_ARGS)
        if (de_iir & DE_PCH_EVENT_IVB) {
                if (pch_iir & SDE_HOTPLUG_MASK_CPT)
                        queue_work(dev_priv->wq, &dev_priv->hotplug_work);
-               pch_irq_handler(dev);
+               pch_irq_handler(dev, pch_iir);
        }
 
        if (pm_iir & GEN6_PM_DEFERRED_EVENTS)
@@ -721,7 +718,7 @@ static irqreturn_t ironlake_irq_handler(DRM_IRQ_ARGS)
        if (de_iir & DE_PCH_EVENT) {
                if (pch_iir & hotplug_mask)
                        queue_work(dev_priv->wq, &dev_priv->hotplug_work);
-               pch_irq_handler(dev);
+               pch_irq_handler(dev, pch_iir);
        }
 
        if (de_iir & DE_PCU_EVENT) {