summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/linux/irq.h18
-rw-r--r--kernel/irq/Kconfig5
-rw-r--r--kernel/irq/handle.c15
3 files changed, 38 insertions, 0 deletions
diff --git a/include/linux/irq.h b/include/linux/irq.h
index 979eed1b2654..65916a305f3d 100644
--- a/include/linux/irq.h
+++ b/include/linux/irq.h
@@ -1165,4 +1165,22 @@ int __ipi_send_mask(struct irq_desc *desc, const struct cpumask *dest);
1165int ipi_send_single(unsigned int virq, unsigned int cpu); 1165int ipi_send_single(unsigned int virq, unsigned int cpu);
1166int ipi_send_mask(unsigned int virq, const struct cpumask *dest); 1166int ipi_send_mask(unsigned int virq, const struct cpumask *dest);
1167 1167
1168#ifdef CONFIG_GENERIC_IRQ_MULTI_HANDLER
1169/*
1170 * Registers a generic IRQ handling function as the top-level IRQ handler in
1171 * the system, which is generally the first C code called from an assembly
1172 * architecture-specific interrupt handler.
1173 *
1174 * Returns 0 on success, or -EBUSY if an IRQ handler has already been
1175 * registered.
1176 */
1177int __init set_handle_irq(void (*handle_irq)(struct pt_regs *));
1178
1179/*
1180 * Allows interrupt handlers to find the irqchip that's been registered as the
1181 * top-level IRQ handler.
1182 */
1183extern void (*handle_arch_irq)(struct pt_regs *) __ro_after_init;
1184#endif
1185
1168#endif /* _LINUX_IRQ_H */ 1186#endif /* _LINUX_IRQ_H */
diff --git a/kernel/irq/Kconfig b/kernel/irq/Kconfig
index 6fc87ccda1d7..5f3e2baefca9 100644
--- a/kernel/irq/Kconfig
+++ b/kernel/irq/Kconfig
@@ -132,3 +132,8 @@ config GENERIC_IRQ_DEBUGFS
132 If you don't know what to do here, say N. 132 If you don't know what to do here, say N.
133 133
134endmenu 134endmenu
135
136config GENERIC_IRQ_MULTI_HANDLER
137 bool
138 help
139 Allow to specify the low level IRQ handler at run time.
diff --git a/kernel/irq/handle.c b/kernel/irq/handle.c
index 79f987b942b8..3570c715c3e7 100644
--- a/kernel/irq/handle.c
+++ b/kernel/irq/handle.c
@@ -20,6 +20,10 @@
20 20
21#include "internals.h" 21#include "internals.h"
22 22
23#ifdef CONFIG_GENERIC_IRQ_MULTI_HANDLER
24void (*handle_arch_irq)(struct pt_regs *) __ro_after_init;
25#endif
26
23/** 27/**
24 * handle_bad_irq - handle spurious and unhandled irqs 28 * handle_bad_irq - handle spurious and unhandled irqs
25 * @desc: description of the interrupt 29 * @desc: description of the interrupt
@@ -207,3 +211,14 @@ irqreturn_t handle_irq_event(struct irq_desc *desc)
207 irqd_clear(&desc->irq_data, IRQD_IRQ_INPROGRESS); 211 irqd_clear(&desc->irq_data, IRQD_IRQ_INPROGRESS);
208 return ret; 212 return ret;
209} 213}
214
215#ifdef CONFIG_GENERIC_IRQ_MULTI_HANDLER
216int __init set_handle_irq(void (*handle_irq)(struct pt_regs *))
217{
218 if (handle_arch_irq)
219 return -EBUSY;
220
221 handle_arch_irq = handle_irq;
222 return 0;
223}
224#endif