Skip to content

Commit 6280ac9

Browse files
nbd168gregkh
authored andcommitted
MIPS: Lantiq: Fix cascaded IRQ setup
commit 6c356eda225e3ee134ed4176b9ae3a76f793f4dd upstream. With the IRQ stack changes integrated, the XRX200 devices started emitting a constant stream of kernel messages like this: [ 565.415310] Spurious IRQ: CAUSE=0x1100c300 This is caused by IP0 getting handled by plat_irq_dispatch() rather than its vectored interrupt handler, which is fixed by commit de856416e714 ("MIPS: IRQ Stack: Fix erroneous jal to plat_irq_dispatch"). Fix plat_irq_dispatch() to handle non-vectored IPI interrupts correctly by setting up IP2-6 as proper chained IRQ handlers and calling do_IRQ for all MIPS CPU interrupts. Signed-off-by: Felix Fietkau <nbd@nbd.name> Acked-by: John Crispin <john@phrozen.org> Cc: linux-mips@linux-mips.org Patchwork: https://patchwork.linux-mips.org/patch/15077/ [james.hogan@imgtec.com: tweaked commit message] Signed-off-by: James Hogan <james.hogan@imgtec.com> Signed-off-by: Amit Pundir <amit.pundir@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 47e2fe1 commit 6280ac9

1 file changed

Lines changed: 17 additions & 21 deletions

File tree

arch/mips/lantiq/irq.c

Lines changed: 17 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,11 @@ static void ltq_hw5_irqdispatch(void)
269269
DEFINE_HWx_IRQDISPATCH(5)
270270
#endif
271271

272+
static void ltq_hw_irq_handler(struct irq_desc *desc)
273+
{
274+
ltq_hw_irqdispatch(irq_desc_get_irq(desc) - 2);
275+
}
276+
272277
#ifdef CONFIG_MIPS_MT_SMP
273278
void __init arch_init_ipiirq(int irq, struct irqaction *action)
274279
{
@@ -313,23 +318,19 @@ static struct irqaction irq_call = {
313318
asmlinkage void plat_irq_dispatch(void)
314319
{
315320
unsigned int pending = read_c0_status() & read_c0_cause() & ST0_IM;
316-
unsigned int i;
317-
318-
if ((MIPS_CPU_TIMER_IRQ == 7) && (pending & CAUSEF_IP7)) {
319-
do_IRQ(MIPS_CPU_TIMER_IRQ);
320-
goto out;
321-
} else {
322-
for (i = 0; i < MAX_IM; i++) {
323-
if (pending & (CAUSEF_IP2 << i)) {
324-
ltq_hw_irqdispatch(i);
325-
goto out;
326-
}
327-
}
321+
int irq;
322+
323+
if (!pending) {
324+
spurious_interrupt();
325+
return;
328326
}
329-
pr_alert("Spurious IRQ: CAUSE=0x%08x\n", read_c0_status());
330327

331-
out:
332-
return;
328+
pending >>= CAUSEB_IP;
329+
while (pending) {
330+
irq = fls(pending) - 1;
331+
do_IRQ(MIPS_CPU_IRQ_BASE + irq);
332+
pending &= ~BIT(irq);
333+
}
333334
}
334335

335336
static int icu_map(struct irq_domain *d, unsigned int irq, irq_hw_number_t hw)
@@ -354,11 +355,6 @@ static const struct irq_domain_ops irq_domain_ops = {
354355
.map = icu_map,
355356
};
356357

357-
static struct irqaction cascade = {
358-
.handler = no_action,
359-
.name = "cascade",
360-
};
361-
362358
int __init icu_of_init(struct device_node *node, struct device_node *parent)
363359
{
364360
struct device_node *eiu_node;
@@ -390,7 +386,7 @@ int __init icu_of_init(struct device_node *node, struct device_node *parent)
390386
mips_cpu_irq_init();
391387

392388
for (i = 0; i < MAX_IM; i++)
393-
setup_irq(i + 2, &cascade);
389+
irq_set_chained_handler(i + 2, ltq_hw_irq_handler);
394390

395391
if (cpu_has_vint) {
396392
pr_info("Setting up vectored interrupts\n");

0 commit comments

Comments
 (0)