1 From: Suresh Siddha <suresh.b.siddha@intel.com>
2 Subject: x64, x2apic/intr-remap: generic irq migration support from process context
3 References: fate #303948 and fate #303984
4 Patch-Mainline: queued for .28
5 Commit-ID: 72b1e22dfcad1daca6906148fd956ffe404bb0bc
7 Signed-off-by: Thomas Renninger <trenn@suse.de>
9 Generic infrastructure for migrating the irq from the process context in the
10 presence of CONFIG_GENERIC_PENDING_IRQ.
12 This will be used later for migrating irq in the presence of
15 Signed-off-by: Suresh Siddha <suresh.b.siddha@intel.com>
16 Cc: akpm@linux-foundation.org
17 Cc: arjan@linux.intel.com
18 Cc: andi@firstfloor.org
19 Cc: ebiederm@xmission.com
20 Cc: jbarnes@virtuousgeek.org
22 Signed-off-by: Ingo Molnar <mingo@elte.hu>
25 include/linux/irq.h | 1 +
26 kernel/irq/manage.c | 9 ++++++++-
27 2 files changed, 9 insertions(+), 1 deletion(-)
29 Index: linux-2.6.26/include/linux/irq.h
30 ===================================================================
31 --- linux-2.6.26.orig/include/linux/irq.h
32 +++ linux-2.6.26/include/linux/irq.h
33 @@ -62,6 +62,7 @@ typedef void (*irq_flow_handler_t)(unsig
34 #define IRQ_MOVE_PENDING 0x00200000 /* need to re-target IRQ destination */
35 #define IRQ_NO_BALANCING 0x00400000 /* IRQ is excluded from balancing */
36 #define IRQ_SPURIOUS_DISABLED 0x00800000 /* IRQ was disabled by the spurious trap */
37 +#define IRQ_MOVE_PCNTXT 0x01000000 /* IRQ migration from process context */
39 #ifdef CONFIG_IRQ_PER_CPU
40 # define CHECK_IRQ_PER_CPU(var) ((var) & IRQ_PER_CPU)
41 Index: linux-2.6.26/kernel/irq/manage.c
42 ===================================================================
43 --- linux-2.6.26.orig/kernel/irq/manage.c
44 +++ linux-2.6.26/kernel/irq/manage.c
45 @@ -89,7 +89,14 @@ int irq_set_affinity(unsigned int irq, c
46 set_balance_irq_affinity(irq, cpumask);
48 #ifdef CONFIG_GENERIC_PENDING_IRQ
49 - set_pending_irq(irq, cpumask);
50 + if (desc->status & IRQ_MOVE_PCNTXT) {
51 + unsigned long flags;
53 + spin_lock_irqsave(&desc->lock, flags);
54 + desc->chip->set_affinity(irq, cpumask);
55 + spin_unlock_irqrestore(&desc->lock, flags);
57 + set_pending_irq(irq, cpumask);
59 desc->affinity = cpumask;
60 desc->chip->set_affinity(irq, cpumask);