brcm63xx: update bmips patches with upstream submission
[openwrt.git] / target / linux / brcm63xx / patches-3.10 / 318-MIPS-BCM63XX-add-cpu-argument-to-dispatch-internal.patch
1 From b6b668f780d62d41bc14bc7baba1692e17cabf84 Mon Sep 17 00:00:00 2001
2 From: Jonas Gorski <jogo@openwrt.org>
3 Date: Fri, 26 Apr 2013 11:21:16 +0200
4 Subject: [PATCH 10/14] MIPS: BCM63XX: add cpu argument to dispatch internal
5
6 Signed-off-by: Jonas Gorski <jogo@openwrt.org>
7 ---
8  arch/mips/bcm63xx/irq.c |   21 +++++++++++----------
9  1 file changed, 11 insertions(+), 10 deletions(-)
10
11 --- a/arch/mips/bcm63xx/irq.c
12 +++ b/arch/mips/bcm63xx/irq.c
13 @@ -19,8 +19,8 @@
14  #include <bcm63xx_io.h>
15  #include <bcm63xx_irq.h>
16  
17 -static void __dispatch_internal_32(void) __maybe_unused;
18 -static void __dispatch_internal_64(void) __maybe_unused;
19 +static void __dispatch_internal_32(int cpu) __maybe_unused;
20 +static void __dispatch_internal_64(int cpu) __maybe_unused;
21  static void __internal_irq_mask_32(unsigned int irq) __maybe_unused;
22  static void __internal_irq_mask_64(unsigned int irq) __maybe_unused;
23  static void __internal_irq_unmask_32(unsigned int irq) __maybe_unused;
24 @@ -158,7 +158,7 @@ static inline void bcm63xx_init_irq(void
25  #else /* ! BCMCPU_RUNTIME_DETECT */
26  
27  static u32 irq_stat_addr0, irq_mask_addr0, irq_stat_addr1, irq_mask_addr1;
28 -static void (*dispatch_internal)(void);
29 +static void (*dispatch_internal)(int cpu);
30  static int is_ext_irq_cascaded;
31  static unsigned int ext_irq_count;
32  static unsigned int ext_irq_start, ext_irq_end;
33 @@ -315,14 +315,15 @@ static inline void handle_internal(int i
34   */
35  
36  #define BUILD_IPIC_INTERNAL(width)                                     \
37 -void __dispatch_internal_##width(void)                                 \
38 +void __dispatch_internal_##width(int cpu)                              \
39  {                                                                      \
40         u32 pending[width / 32];                                        \
41         unsigned int src, tgt;                                          \
42         bool irqs_pending = false;                                      \
43 -       static int i;                                                   \
44 -       u32 irq_stat_addr = get_irq_stat_addr(0);                       \
45 -       u32 irq_mask_addr = get_irq_mask_addr(0);                       \
46 +       static int i[NR_CPUS];                                          \
47 +       u32 irq_stat_addr = get_irq_stat_addr(cpu);                     \
48 +       u32 irq_mask_addr = get_irq_mask_addr(cpu);                     \
49 +       int *next = &i[cpu];                                            \
50                                                                         \
51         /* read registers in reverse order */                           \
52         for (src = 0, tgt = (width / 32); src < (width / 32); src++) {  \
53 @@ -340,9 +341,9 @@ void __dispatch_internal_##width(void)
54                 return;                                                 \
55                                                                         \
56         while (1) {                                                     \
57 -               int to_call = i;                                        \
58 +               int to_call = *next;                                    \
59                                                                         \
60 -               i = (i + 1) & (width - 1);                              \
61 +               *next = (*next + 1) & (width - 1);                      \
62                 if (pending[to_call / 32] & (1 << (to_call & 0x1f))) {  \
63                         handle_internal(to_call);                       \
64                         break;                                          \
65 @@ -394,7 +395,7 @@ asmlinkage void plat_irq_dispatch(void)
66                 if (cause & CAUSEF_IP1)
67                         do_IRQ(1);
68                 if (cause & CAUSEF_IP2)
69 -                       dispatch_internal();
70 +                       dispatch_internal(0);
71                 if (!is_ext_irq_cascaded) {
72                         if (cause & CAUSEF_IP3)
73                                 do_IRQ(IRQ_EXT_0);