Skip to content

Commit 0521c8f

Browse files
committed
genirq: Provide edge_eoi flow handler
This is a replacment for the cell flow handler which is in the way of cleanups. Must be selected to avoid general bloat. Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
1 parent 32f4125 commit 0521c8f

3 files changed

Lines changed: 50 additions & 0 deletions

File tree

‎include/linux/irq.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -423,6 +423,7 @@ extern irqreturn_t handle_IRQ_event(unsigned int irq, struct irqaction *action);
423423
extern void handle_level_irq(unsigned int irq, struct irq_desc *desc);
424424
extern void handle_fasteoi_irq(unsigned int irq, struct irq_desc *desc);
425425
extern void handle_edge_irq(unsigned int irq, struct irq_desc *desc);
426+
extern void handle_edge_eoi_irq(unsigned int irq, struct irq_desc *desc);
426427
extern void handle_simple_irq(unsigned int irq, struct irq_desc *desc);
427428
extern void handle_percpu_irq(unsigned int irq, struct irq_desc *desc);
428429
extern void handle_bad_irq(unsigned int irq, struct irq_desc *desc);

‎kernel/irq/Kconfig‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,10 @@ config HARDIRQS_SW_RESEND
5151
config IRQ_PREFLOW_FASTEOI
5252
bool
5353

54+
# Edge style eoi based handler (cell)
55+
config IRQ_EDGE_EOI_HANDLER
56+
bool
57+
5458
# Support forced irq threading
5559
config IRQ_FORCED_THREADING
5660
bool

‎kernel/irq/chip.c‎

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -604,6 +604,51 @@ handle_edge_irq(unsigned int irq, struct irq_desc *desc)
604604
raw_spin_unlock(&desc->lock);
605605
}
606606

607+
#ifdef CONFIG_IRQ_EDGE_EOI_HANDLER
608+
/**
609+
* handle_edge_eoi_irq - edge eoi type IRQ handler
610+
* @irq: the interrupt number
611+
* @desc: the interrupt description structure for this irq
612+
*
613+
* Similar as the above handle_edge_irq, but using eoi and w/o the
614+
* mask/unmask logic.
615+
*/
616+
void handle_edge_eoi_irq(unsigned int irq, struct irq_desc *desc)
617+
{
618+
struct irq_chip *chip = irq_desc_get_chip(desc);
619+
620+
raw_spin_lock(&desc->lock);
621+
622+
desc->istate &= ~(IRQS_REPLAY | IRQS_WAITING);
623+
/*
624+
* If we're currently running this IRQ, or its disabled,
625+
* we shouldn't process the IRQ. Mark it pending, handle
626+
* the necessary masking and go out
627+
*/
628+
if (unlikely(irqd_irq_disabled(&desc->irq_data) ||
629+
irqd_irq_inprogress(&desc->irq_data) || !desc->action)) {
630+
if (!irq_check_poll(desc)) {
631+
desc->istate |= IRQS_PENDING;
632+
goto out_eoi;
633+
}
634+
}
635+
kstat_incr_irqs_this_cpu(irq, desc);
636+
637+
do {
638+
if (unlikely(!desc->action))
639+
goto out_eoi;
640+
641+
handle_irq_event(desc);
642+
643+
} while ((desc->istate & IRQS_PENDING) &&
644+
!irqd_irq_disabled(&desc->irq_data));
645+
646+
out_unlock:
647+
chip->irq_eoi(&desc->irq_data);
648+
raw_spin_unlock(&desc->lock);
649+
}
650+
#endif
651+
607652
/**
608653
* handle_percpu_irq - Per CPU local irq handler
609654
* @irq: the interrupt number

0 commit comments

Comments
 (0)