Skip to content

Commit eb67532

Browse files
ideaksashalevin
authored andcommitted
drm/i915: avoid processing spurious/shared interrupts in low-power states
commit 2dd2a88 upstream. Atm, it's possible that the interrupt handler is called when the device is in D3 or some other low-power state. It can be due to another device that is still in D0 state and shares the interrupt line with i915, or on some platforms there could be spurious interrupts even without sharing the interrupt line. The latter case was reported by Klaus Ethgen using a Lenovo x61p machine (gen 4). He noticed this issue via a system suspend/resume hang and bisected it to the following commit: commit e11aa36 Author: Jesse Barnes <jbarnes@virtuousgeek.org> Date: Wed Jun 18 09:52:55 2014 -0700 drm/i915: use runtime irq suspend/resume in freeze/thaw This is a problem, since in low-power states IIR will always read 0xffffffff resulting in an endless IRQ servicing loop. Fix this by handling interrupts only when the driver explicitly enables them and so it's guaranteed that the interrupt registers return a valid value. Note that this issue existed even before the above commit, since during runtime suspend/resume we never unregistered the handler. v2: - clarify the purpose of smp_mb() vs. synchronize_irq() in the code comment (Chris) v3: - no need for an explicit smp_mb(), we can assume that synchronize_irq() and the mmio read/writes in the install hooks provide for this (Daniel) - remove code comment as the remaining synchronize_irq() is self explanatory (Daniel) v4: - drm_irq_uninstall() implies synchronize_irq(), so no need to call it explicitly (Daniel) Reference: https://lkml.org/lkml/2015/2/11/205 Reported-and-bisected-by: Klaus Ethgen <Klaus@Ethgen.ch> Signed-off-by: Imre Deak <imre.deak@intel.com> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch> Signed-off-by: Jani Nikula <jani.nikula@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent fc6f347 commit eb67532

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

‎drivers/gpu/drm/i915/i915_irq.c‎

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2123,6 +2123,9 @@ static irqreturn_t valleyview_irq_handler(int irq, void *arg)
21232123
u32 iir, gt_iir, pm_iir;
21242124
irqreturn_t ret = IRQ_NONE;
21252125

2126+
if (!intel_irqs_enabled(dev_priv))
2127+
return IRQ_NONE;
2128+
21262129
while (true) {
21272130
/* Find, clear, then process each source of interrupt */
21282131

@@ -2167,6 +2170,9 @@ static irqreturn_t cherryview_irq_handler(int irq, void *arg)
21672170
u32 master_ctl, iir;
21682171
irqreturn_t ret = IRQ_NONE;
21692172

2173+
if (!intel_irqs_enabled(dev_priv))
2174+
return IRQ_NONE;
2175+
21702176
for (;;) {
21712177
master_ctl = I915_READ(GEN8_MASTER_IRQ) & ~GEN8_MASTER_IRQ_CONTROL;
21722178
iir = I915_READ(VLV_IIR);
@@ -2455,6 +2461,9 @@ static irqreturn_t ironlake_irq_handler(int irq, void *arg)
24552461
u32 de_iir, gt_iir, de_ier, sde_ier = 0;
24562462
irqreturn_t ret = IRQ_NONE;
24572463

2464+
if (!intel_irqs_enabled(dev_priv))
2465+
return IRQ_NONE;
2466+
24582467
/* We get interrupts on unclaimed registers, so check for this before we
24592468
* do any I915_{READ,WRITE}. */
24602469
intel_uncore_check_errors(dev);
@@ -2525,6 +2534,9 @@ static irqreturn_t gen8_irq_handler(int irq, void *arg)
25252534
uint32_t tmp = 0;
25262535
enum pipe pipe;
25272536

2537+
if (!intel_irqs_enabled(dev_priv))
2538+
return IRQ_NONE;
2539+
25282540
master_ctl = I915_READ(GEN8_MASTER_IRQ);
25292541
master_ctl &= ~GEN8_MASTER_IRQ_CONTROL;
25302542
if (!master_ctl)
@@ -4052,6 +4064,9 @@ static irqreturn_t i8xx_irq_handler(int irq, void *arg)
40524064
I915_DISPLAY_PLANE_A_FLIP_PENDING_INTERRUPT |
40534065
I915_DISPLAY_PLANE_B_FLIP_PENDING_INTERRUPT;
40544066

4067+
if (!intel_irqs_enabled(dev_priv))
4068+
return IRQ_NONE;
4069+
40554070
iir = I915_READ16(IIR);
40564071
if (iir == 0)
40574072
return IRQ_NONE;
@@ -4238,6 +4253,9 @@ static irqreturn_t i915_irq_handler(int irq, void *arg)
42384253
I915_DISPLAY_PLANE_B_FLIP_PENDING_INTERRUPT;
42394254
int pipe, ret = IRQ_NONE;
42404255

4256+
if (!intel_irqs_enabled(dev_priv))
4257+
return IRQ_NONE;
4258+
42414259
iir = I915_READ(IIR);
42424260
do {
42434261
bool irq_received = (iir & ~flip_mask) != 0;
@@ -4466,6 +4484,9 @@ static irqreturn_t i965_irq_handler(int irq, void *arg)
44664484
I915_DISPLAY_PLANE_A_FLIP_PENDING_INTERRUPT |
44674485
I915_DISPLAY_PLANE_B_FLIP_PENDING_INTERRUPT;
44684486

4487+
if (!intel_irqs_enabled(dev_priv))
4488+
return IRQ_NONE;
4489+
44694490
iir = I915_READ(IIR);
44704491

44714492
for (;;) {
@@ -4777,4 +4798,5 @@ void intel_runtime_pm_restore_interrupts(struct drm_device *dev)
47774798
dev_priv->pm._irqs_disabled = false;
47784799
dev->driver->irq_preinstall(dev);
47794800
dev->driver->irq_postinstall(dev);
4801+
synchronize_irq(dev_priv->dev->irq);
47804802
}

0 commit comments

Comments
 (0)