Skip to content

Commit 7812957

Browse files
committed
genirq: Add preflow handler support
sparc64 needs to call a preflow handler on certain interrupts befor calling the action chain. Integrate it into handle_fasteoi_irq. Must be enabled via CONFIG_IRQ_FASTEOI_PREFLOW. No impact when disabled. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Cc: David S. Miller <davem@davemloft.net>
1 parent 3836ca0 commit 7812957

4 files changed

Lines changed: 30 additions & 1 deletion

File tree

‎include/linux/irq.h‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,10 @@
2929
#include <asm/irq_regs.h>
3030

3131
struct irq_desc;
32+
struct irq_data;
3233
typedef void (*irq_flow_handler_t)(unsigned int irq,
3334
struct irq_desc *desc);
34-
35+
typedef void (*irq_preflow_handler_t)(struct irq_data *data);
3536

3637
/*
3738
* IRQ line status.

‎include/linux/irqdesc.h‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,9 @@ struct irq_desc {
6363
struct timer_rand_state *timer_rand_state;
6464
unsigned int __percpu *kstat_irqs;
6565
irq_flow_handler_t handle_irq;
66+
#ifdef CONFIG_IRQ_PREFLOW_FASTEOI
67+
irq_preflow_handler_t preflow_handler;
68+
#endif
6669
struct irqaction *action; /* IRQ action list */
6770
#ifdef CONFIG_GENERIC_HARDIRQS_NO_COMPAT
6871
unsigned int status_use_accessors;
@@ -187,6 +190,17 @@ static inline void __set_irq_handler_unlocked(int irq,
187190
desc = irq_to_desc(irq);
188191
desc->handle_irq = handler;
189192
}
193+
194+
#ifdef CONFIG_IRQ_PREFLOW_FASTEOI
195+
static inline void
196+
__irq_set_preflow_handler(unsigned int irq, irq_preflow_handler_t handler)
197+
{
198+
struct irq_desc *desc;
199+
200+
desc = irq_to_desc(irq);
201+
desc->preflow_handler = handler;
202+
}
203+
#endif
190204
#endif
191205

192206
#endif

‎kernel/irq/Kconfig‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ config AUTO_IRQ_AFFINITY
3535
config HARDIRQS_SW_RESEND
3636
def_bool n
3737

38+
config IRQ_PREFLOW_FASTEOI
39+
def_bool n
40+
3841
config SPARSE_IRQ
3942
bool "Support sparse irq numbering"
4043
depends on HAVE_SPARSE_IRQ

‎kernel/irq/chip.c‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -471,6 +471,16 @@ handle_level_irq(unsigned int irq, struct irq_desc *desc)
471471
}
472472
EXPORT_SYMBOL_GPL(handle_level_irq);
473473

474+
#ifdef CONFIG_IRQ_PREFLOW_FASTEOI
475+
static inline void preflow_handler(struct irq_desc *desc)
476+
{
477+
if (desc->preflow_handler)
478+
desc->preflow_handler(&desc->irq_data);
479+
}
480+
#else
481+
static inline void preflow_handler(struct irq_desc *desc) { }
482+
#endif
483+
474484
/**
475485
* handle_fasteoi_irq - irq handler for transparent controllers
476486
* @irq: the interrupt number
@@ -503,6 +513,7 @@ handle_fasteoi_irq(unsigned int irq, struct irq_desc *desc)
503513
mask_irq(desc);
504514
goto out;
505515
}
516+
preflow_handler(desc);
506517
handle_irq_event(desc);
507518
out:
508519
desc->irq_data.chip->irq_eoi(&desc->irq_data);

0 commit comments

Comments
 (0)