mirror of
https://github.com/torvalds/linux.git
synced 2024-11-10 22:21:40 +00:00
genirq: Unmask oneshot irqs when thread was not woken
When the primary handler of an interrupt which is marked IRQ_ONESHOT returns IRQ_HANDLED or IRQ_NONE, then the interrupt thread is not woken and the unmask logic of the interrupt line is never invoked. This keeps the interrupt masked forever. This was not noticed as most IRQ_ONESHOT users wake the thread unconditionally (usually because they cannot access the underlying device from hard interrupt context). Though this behaviour was nowhere documented and not necessarily intentional. Some drivers can avoid the thread wakeup in certain cases and run into the situation where the interrupt line s kept masked. Handle it gracefully. Reported-and-tested-by: Lothar Wassmann <lw@karo-electronics.de> Cc: stable@vger.kernel.org Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
This commit is contained in:
parent
7ada1dd628
commit
ac56376111
@ -330,6 +330,24 @@ out_unlock:
|
|||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(handle_simple_irq);
|
EXPORT_SYMBOL_GPL(handle_simple_irq);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Called unconditionally from handle_level_irq() and only for oneshot
|
||||||
|
* interrupts from handle_fasteoi_irq()
|
||||||
|
*/
|
||||||
|
static void cond_unmask_irq(struct irq_desc *desc)
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
* We need to unmask in the following cases:
|
||||||
|
* - Standard level irq (IRQF_ONESHOT is not set)
|
||||||
|
* - Oneshot irq which did not wake the thread (caused by a
|
||||||
|
* spurious interrupt or a primary handler handling it
|
||||||
|
* completely).
|
||||||
|
*/
|
||||||
|
if (!irqd_irq_disabled(&desc->irq_data) &&
|
||||||
|
irqd_irq_masked(&desc->irq_data) && !desc->threads_oneshot)
|
||||||
|
unmask_irq(desc);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* handle_level_irq - Level type irq handler
|
* handle_level_irq - Level type irq handler
|
||||||
* @irq: the interrupt number
|
* @irq: the interrupt number
|
||||||
@ -362,8 +380,8 @@ handle_level_irq(unsigned int irq, struct irq_desc *desc)
|
|||||||
|
|
||||||
handle_irq_event(desc);
|
handle_irq_event(desc);
|
||||||
|
|
||||||
if (!irqd_irq_disabled(&desc->irq_data) && !(desc->istate & IRQS_ONESHOT))
|
cond_unmask_irq(desc);
|
||||||
unmask_irq(desc);
|
|
||||||
out_unlock:
|
out_unlock:
|
||||||
raw_spin_unlock(&desc->lock);
|
raw_spin_unlock(&desc->lock);
|
||||||
}
|
}
|
||||||
@ -417,6 +435,9 @@ handle_fasteoi_irq(unsigned int irq, struct irq_desc *desc)
|
|||||||
preflow_handler(desc);
|
preflow_handler(desc);
|
||||||
handle_irq_event(desc);
|
handle_irq_event(desc);
|
||||||
|
|
||||||
|
if (desc->istate & IRQS_ONESHOT)
|
||||||
|
cond_unmask_irq(desc);
|
||||||
|
|
||||||
out_eoi:
|
out_eoi:
|
||||||
desc->irq_data.chip->irq_eoi(&desc->irq_data);
|
desc->irq_data.chip->irq_eoi(&desc->irq_data);
|
||||||
out_unlock:
|
out_unlock:
|
||||||
|
Loading…
Reference in New Issue
Block a user