Skip to content

Commit c5e5ec0

Browse files
author
Marc Zyngier
committed
genirq: Add fasteoi IPI flow
For irqchips using the fasteoi flow, IPIs are a bit special. They need to be EOI'd early (before calling the handler), as funny things may happen in the handler (they do not necessarily behave like a normal interrupt). Reviewed-by: Valentin Schneider <valentin.schneider@arm.com> Signed-off-by: Marc Zyngier <maz@kernel.org>
1 parent f4d51df commit c5e5ec0

2 files changed

Lines changed: 28 additions & 0 deletions

File tree

‎include/linux/irq.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -634,6 +634,7 @@ static inline int irq_set_parent(int irq, int parent_irq)
634634
*/
635635
extern void handle_level_irq(struct irq_desc *desc);
636636
extern void handle_fasteoi_irq(struct irq_desc *desc);
637+
extern void handle_percpu_devid_fasteoi_ipi(struct irq_desc *desc);
637638
extern void handle_edge_irq(struct irq_desc *desc);
638639
extern void handle_edge_eoi_irq(struct irq_desc *desc);
639640
extern void handle_simple_irq(struct irq_desc *desc);

‎kernel/irq/chip.c‎

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -944,6 +944,33 @@ void handle_percpu_devid_irq(struct irq_desc *desc)
944944
chip->irq_eoi(&desc->irq_data);
945945
}
946946

947+
/**
948+
* handle_percpu_devid_fasteoi_ipi - Per CPU local IPI handler with per cpu
949+
* dev ids
950+
* @desc: the interrupt description structure for this irq
951+
*
952+
* The biggest difference with the IRQ version is that the interrupt is
953+
* EOIed early, as the IPI could result in a context switch, and we need to
954+
* make sure the IPI can fire again. We also assume that the arch code has
955+
* registered an action. If not, we are positively doomed.
956+
*/
957+
void handle_percpu_devid_fasteoi_ipi(struct irq_desc *desc)
958+
{
959+
struct irq_chip *chip = irq_desc_get_chip(desc);
960+
struct irqaction *action = desc->action;
961+
unsigned int irq = irq_desc_get_irq(desc);
962+
irqreturn_t res;
963+
964+
__kstat_incr_irqs_this_cpu(desc);
965+
966+
if (chip->irq_eoi)
967+
chip->irq_eoi(&desc->irq_data);
968+
969+
trace_irq_handler_entry(irq, action);
970+
res = action->handler(irq, raw_cpu_ptr(action->percpu_dev_id));
971+
trace_irq_handler_exit(irq, action, res);
972+
}
973+
947974
/**
948975
* handle_percpu_devid_fasteoi_nmi - Per CPU local NMI handler with per cpu
949976
* dev ids

0 commit comments

Comments
 (0)