IRQCHIP: mips-gic: Don't nest calls to do_IRQ()

The GIC chained handlers use do_IRQ() to call the subhandlers. This
means that irq_enter() calls get nested, which leads to preempt count
looking like we're in nested interrupts, which in turn leads to all
system time being accounted as IRQ time in account_system_time().

Fix it by using generic_handle_irq(). Since these same functions are
used in some systems (if cpu_has_veic) from a low-level vectored
interrupt handler which does not go throught do_IRQ(), we need to do it
conditionally.

Signed-off-by: Rabin Vincent <rabin.vincent@axis.com>
Reviewed-by: Andrew Bresticker <abrestic@chromium.org>
Acked-by: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-mips@linux-mips.org
Cc: tglx@linutronix.de
Cc: jason@lakedaemon.net
Patchwork: https://patchwork.linux-mips.org/patch/10545/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>

authored by Rabin Vincent and committed by Ralf Baechle 1b3ed367 9cc719ab

Changed files
+14 -7
drivers
irqchip
+14 -7
drivers/irqchip/irq-mips-gic.c
··· 271 271 GIC_LOCAL_TO_HWIRQ(GIC_LOCAL_INT_FDC)); 272 272 } 273 273 274 - static void gic_handle_shared_int(void) 274 + static void gic_handle_shared_int(bool chained) 275 275 { 276 276 unsigned int i, intr, virq; 277 277 unsigned long *pcpu_mask; ··· 299 299 while (intr != gic_shared_intrs) { 300 300 virq = irq_linear_revmap(gic_irq_domain, 301 301 GIC_SHARED_TO_HWIRQ(intr)); 302 - do_IRQ(virq); 302 + if (chained) 303 + generic_handle_irq(virq); 304 + else 305 + do_IRQ(virq); 303 306 304 307 /* go to next pending bit */ 305 308 bitmap_clear(pending, intr, 1); ··· 434 431 #endif 435 432 }; 436 433 437 - static void gic_handle_local_int(void) 434 + static void gic_handle_local_int(bool chained) 438 435 { 439 436 unsigned long pending, masked; 440 437 unsigned int intr, virq; ··· 448 445 while (intr != GIC_NUM_LOCAL_INTRS) { 449 446 virq = irq_linear_revmap(gic_irq_domain, 450 447 GIC_LOCAL_TO_HWIRQ(intr)); 451 - do_IRQ(virq); 448 + if (chained) 449 + generic_handle_irq(virq); 450 + else 451 + do_IRQ(virq); 452 452 453 453 /* go to next pending bit */ 454 454 bitmap_clear(&pending, intr, 1); ··· 515 509 516 510 static void __gic_irq_dispatch(void) 517 511 { 518 - gic_handle_local_int(); 519 - gic_handle_shared_int(); 512 + gic_handle_local_int(false); 513 + gic_handle_shared_int(false); 520 514 } 521 515 522 516 static void gic_irq_dispatch(unsigned int irq, struct irq_desc *desc) 523 517 { 524 - __gic_irq_dispatch(); 518 + gic_handle_local_int(true); 519 + gic_handle_shared_int(true); 525 520 } 526 521 527 522 #ifdef CONFIG_MIPS_GIC_IPI