On MIPS, platforms need to implement their own dispatcher, which
is a globally visible function (bad). For the traditional 8 MIPS
interrupts an irq_chip already exists and is registered on most
platforms. This patch allows platforms to selectively get rid of
the plat_irq_dispatch function and instead register their custom
IRQ controllers as chained handlers for one or more of the MIPS
interrupts.
Signed-off-by: Manuel Lauss <manuel.lauss@googlemail.com>
---
arch/mips/Kconfig | 3 +++
arch/mips/kernel/genex.S | 4 ++++
arch/mips/kernel/irq_cpu.c | 7 +++++++
3 files changed, 14 insertions(+), 0 deletions(-)
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index 177cdaf..43d9d7f 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -955,6 +955,9 @@ config SYNC_R4K
config MIPS_MACHINE
def_bool n
+config MIPS_NO_PLAT_IRQ_DISPATCH
+ def_bool n
+
config NO_IOPORT
def_bool n
diff --git a/arch/mips/kernel/genex.S b/arch/mips/kernel/genex.S
index 8882e57..d8bdb65 100644
--- a/arch/mips/kernel/genex.S
+++ b/arch/mips/kernel/genex.S
@@ -202,7 +202,11 @@ NESTED(handle_int, PT_SIZE, sp)
LONG_L s0, TI_REGS($28)
LONG_S sp, TI_REGS($28)
PTR_LA ra, ret_from_irq
+#ifdef CONFIG_MIPS_NO_PLAT_IRQ_DISPATCH
+ j mips_irq_dispatch
+#else
j plat_irq_dispatch
+#endif
END(handle_int)
__INIT
diff --git a/arch/mips/kernel/irq_cpu.c b/arch/mips/kernel/irq_cpu.c
index 191eb52..73f1dd4 100644
--- a/arch/mips/kernel/irq_cpu.c
+++ b/arch/mips/kernel/irq_cpu.c
@@ -37,6 +37,13 @@
#include <asm/mipsmtregs.h>
#include <asm/system.h>
+/* I wish I could inline this function directly into genex.S' handle_int */
+void mips_irq_dispatch(void)
+{
+ unsigned long c = (read_c0_cause() & read_c0_status()) >> 8;
+ do_IRQ(MIPS_CPU_IRQ_BASE + __ffs(c & 0xff));
+}
+
static inline void unmask_mips_irq(struct irq_data *d)
{
set_c0_status(0x100 << (d->irq - MIPS_CPU_IRQ_BASE));
--
1.7.6
|