MIPS: GIC: Generalise check for pending interrupts
authorJeffrey Deans <jeffrey.deans@imgtec.com>
Thu, 17 Jul 2014 08:20:57 +0000 (09:20 +0100)
committerRalf Baechle <ralf@linux-mips.org>
Fri, 1 Aug 2014 22:06:41 +0000 (00:06 +0200)
Move most of the functionality of gic_get_int() into a new function
gic_get_int_mask() which takes a bitmask of interrupts in which the
caller is interested, and returns the subset which are pending for the
current CPU.

This allows CP0 IRQ dispatch routines to check only the GIC interrupts
which are routed to a particular CPU interrupt input.

gic_get_int() is reimplemented using gic_get_int_mask() and is retained
for use by any platforms for which gic_get_int() is sufficient.

Signed-off-by: Jeffrey Deans <jeffrey.deans@imgtec.com>
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/7376/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
arch/mips/include/asm/gic.h
arch/mips/kernel/irq-gic.c

index 394d366b8fc1e242e549b5b95eba294e1756f044..8b30befd99d6fb89612251868bee5489969b5b9f 100644 (file)
@@ -373,6 +373,7 @@ extern unsigned int plat_ipi_call_int_xlate(unsigned int);
 extern unsigned int plat_ipi_resched_int_xlate(unsigned int);
 extern void gic_bind_eic_interrupt(int irq, int set);
 extern unsigned int gic_get_timer_pending(void);
+extern void gic_get_int_mask(unsigned long *dst, const unsigned long *src);
 extern unsigned int gic_get_int(void);
 extern void gic_enable_interrupt(int irq_vec);
 extern void gic_disable_interrupt(int irq_vec);
index 9932aef91abb7a1859997b41e7468125c0ca827c..9e9d8b9a5b97afe43e5d29f2184779b14b475ae2 100644 (file)
@@ -189,7 +189,7 @@ unsigned int gic_compare_int(void)
                return 0;
 }
 
-unsigned int gic_get_int(void)
+void gic_get_int_mask(unsigned long *dst, const unsigned long *src)
 {
        unsigned int i;
        unsigned long *pending, *intrmask, *pcpu_mask;
@@ -214,8 +214,17 @@ unsigned int gic_get_int(void)
 
        bitmap_and(pending, pending, intrmask, GIC_NUM_INTRS);
        bitmap_and(pending, pending, pcpu_mask, GIC_NUM_INTRS);
+       bitmap_and(dst, src, pending, GIC_NUM_INTRS);
+}
+
+unsigned int gic_get_int(void)
+{
+       DECLARE_BITMAP(interrupts, GIC_NUM_INTRS);
+
+       bitmap_fill(interrupts, GIC_NUM_INTRS);
+       gic_get_int_mask(interrupts, interrupts);
 
-       return find_first_bit(pending, GIC_NUM_INTRS);
+       return find_first_bit(interrupts, GIC_NUM_INTRS);
 }
 
 static void gic_mask_irq(struct irq_data *d)
This page took 0.027325 seconds and 5 git commands to generate.