d976903d2fed7d55d21106620f20e7e0b4fa8b1a
[openwrt/staging/chunkeey.git] / target / linux / brcm63xx / patches-3.9 / 322-MIPS-BCM63XX-allow-setting-affinity-for-IPIC.patch
1 From a8bb19e5ba9a3a73fe6a761295b67b641a7bc9df Mon Sep 17 00:00:00 2001
2 From: Jonas Gorski <jogo@openwrt.org>
3 Date: Fri, 26 Apr 2013 12:06:03 +0200
4 Subject: [PATCH 13/13] MIPS: BCM63XX: allow setting affinity for IPIC
5
6 Add support for setting the SMP affinity for the IPIC IRQs.
7
8 Signed-off-by: Jonas Gorski <jogo@openwrt.org>
9 ---
10 arch/mips/bcm63xx/irq.c | 27 ++++++++++++++++++++++++++-
11 1 file changed, 26 insertions(+), 1 deletion(-)
12
13 --- a/arch/mips/bcm63xx/irq.c
14 +++ b/arch/mips/bcm63xx/irq.c
15 @@ -418,9 +418,14 @@ static void bcm63xx_internal_irq_mask(st
16 static void bcm63xx_internal_irq_unmask(struct irq_data *d)
17 {
18 unsigned long flags;
19 + const struct cpumask *dest = cpu_online_mask;
20
21 spin_lock_irqsave(&ipic_lock, flags);
22 - internal_irq_unmask(d->irq - IRQ_INTERNAL_BASE, cpu_online_mask);
23 +#ifdef CONFIG_SMP
24 + if (irqd_affinity_was_set(d))
25 + dest = d->affinity;
26 +#endif
27 + internal_irq_unmask(d->irq - IRQ_INTERNAL_BASE, dest);
28 spin_unlock_irqrestore(&ipic_lock, flags);
29 }
30
31 @@ -596,10 +601,30 @@ static int bcm63xx_external_irq_set_type
32 return IRQ_SET_MASK_OK_NOCOPY;
33 }
34
35 +#ifdef CONFIG_SMP
36 +static int bcm63xx_internal_set_affinity(struct irq_data *data,
37 + const struct cpumask *dest,
38 + bool force)
39 +{
40 + unsigned int irq = data->irq - IRQ_INTERNAL_BASE;
41 + unsigned long flags;
42 +
43 + spin_lock_irqsave(&ipic_lock, flags);
44 + if (!irqd_irq_disabled(data))
45 + internal_irq_unmask(irq, dest);
46 + spin_unlock_irqrestore(&ipic_lock, flags);
47 +
48 + return 0;
49 +}
50 +#endif
51 +
52 static struct irq_chip bcm63xx_internal_irq_chip = {
53 .name = "bcm63xx_ipic",
54 .irq_mask = bcm63xx_internal_irq_mask,
55 .irq_unmask = bcm63xx_internal_irq_unmask,
56 +#ifdef CONFIG_SMP
57 + .irq_set_affinity = bcm63xx_internal_set_affinity,
58 +#endif
59 };
60
61 static struct irq_chip bcm63xx_external_irq_chip = {