ed9344168eec6e231c2958df911085abc9e913e6
[openwrt.git] / target / linux / ramips / patches-3.10 / 0508-MIPS-GIC-Fix-gic_set_affinity-infinite-loop.patch
1 From 553ddf4f3f20c28ab03f87ac8c3cde5edf714675 Mon Sep 17 00:00:00 2001
2 From: Tony Wu <tung7970@gmail.com>
3 Date: Fri, 21 Jun 2013 10:13:08 +0000
4 Subject: [PATCH 022/105] MIPS: GIC: Fix gic_set_affinity infinite loop
5
6 There is an infinite loop in gic_set_affinity. When irq_set_affinity
7 gets called on gic controller, it blocks forever.
8
9 Signed-off-by: Tony Wu <tung7970@gmail.com>
10 Cc: Steven J. Hill <Steven.Hill@imgtec.com>
11 Cc: linux-mips@linux-mips.org
12 Patchwork: https://patchwork.linux-mips.org/patch/5537/
13 Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
14 (cherry picked from commit c214c03512b67e56dea3f4471705f8caae49553a)
15 ---
16  arch/mips/kernel/irq-gic.c |   15 +++++++--------
17  1 file changed, 7 insertions(+), 8 deletions(-)
18
19 diff --git a/arch/mips/kernel/irq-gic.c b/arch/mips/kernel/irq-gic.c
20 index c01b307..5b5ddb2 100644
21 --- a/arch/mips/kernel/irq-gic.c
22 +++ b/arch/mips/kernel/irq-gic.c
23 @@ -219,16 +219,15 @@ static int gic_set_affinity(struct irq_data *d, const struct cpumask *cpumask,
24  
25         /* Assumption : cpumask refers to a single CPU */
26         spin_lock_irqsave(&gic_lock, flags);
27 -       for (;;) {
28 -               /* Re-route this IRQ */
29 -               GIC_SH_MAP_TO_VPE_SMASK(irq, first_cpu(tmp));
30  
31 -               /* Update the pcpu_masks */
32 -               for (i = 0; i < NR_CPUS; i++)
33 -                       clear_bit(irq, pcpu_masks[i].pcpu_mask);
34 -               set_bit(irq, pcpu_masks[first_cpu(tmp)].pcpu_mask);
35 +       /* Re-route this IRQ */
36 +       GIC_SH_MAP_TO_VPE_SMASK(irq, first_cpu(tmp));
37 +
38 +       /* Update the pcpu_masks */
39 +       for (i = 0; i < NR_CPUS; i++)
40 +               clear_bit(irq, pcpu_masks[i].pcpu_mask);
41 +       set_bit(irq, pcpu_masks[first_cpu(tmp)].pcpu_mask);
42  
43 -       }
44         cpumask_copy(d->affinity, cpumask);
45         spin_unlock_irqrestore(&gic_lock, flags);
46  
47 -- 
48 1.7.10.4
49