diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2010-03-19 21:16:20 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-03-19 21:16:20 -0400 |
commit | e4d806377b069881f930089bf880918d3ad555ab (patch) | |
tree | ed03416ddaa770bed16880ffea32b9b71dd5c7c7 /drivers/sh | |
parent | b50df7d1fb37eb6aea87590b391d7111fde87121 (diff) | |
parent | 3f7581d66ece6b7ff643c8c817bfbd72cdbe9077 (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/lethal/sh-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/lethal/sh-2.6:
serial: sh-sci: remove duplicated #include
sh: Export uncached helper symbols.
sh: Fix up NUMA build for 29-bit.
serial: sh-sci: Fix build failure for non-sh architectures.
sh: Fix up uncached offset for legacy 29-bit mode.
sh: Support CPU affinity masks for INTC controllers.
Diffstat (limited to 'drivers/sh')
-rw-r--r-- | drivers/sh/intc.c | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/drivers/sh/intc.c b/drivers/sh/intc.c index c2750391fd34..a3d8677af6a5 100644 --- a/drivers/sh/intc.c +++ b/drivers/sh/intc.c | |||
@@ -2,7 +2,7 @@ | |||
2 | * Shared interrupt handling code for IPR and INTC2 types of IRQs. | 2 | * Shared interrupt handling code for IPR and INTC2 types of IRQs. |
3 | * | 3 | * |
4 | * Copyright (C) 2007, 2008 Magnus Damm | 4 | * Copyright (C) 2007, 2008 Magnus Damm |
5 | * Copyright (C) 2009 Paul Mundt | 5 | * Copyright (C) 2009, 2010 Paul Mundt |
6 | * | 6 | * |
7 | * Based on intc2.c and ipr.c | 7 | * Based on intc2.c and ipr.c |
8 | * | 8 | * |
@@ -26,6 +26,7 @@ | |||
26 | #include <linux/list.h> | 26 | #include <linux/list.h> |
27 | #include <linux/topology.h> | 27 | #include <linux/topology.h> |
28 | #include <linux/bitmap.h> | 28 | #include <linux/bitmap.h> |
29 | #include <linux/cpumask.h> | ||
29 | 30 | ||
30 | #define _INTC_MK(fn, mode, addr_e, addr_d, width, shift) \ | 31 | #define _INTC_MK(fn, mode, addr_e, addr_d, width, shift) \ |
31 | ((shift) | ((width) << 5) | ((fn) << 9) | ((mode) << 13) | \ | 32 | ((shift) | ((width) << 5) | ((fn) << 9) | ((mode) << 13) | \ |
@@ -234,6 +235,10 @@ static inline void _intc_enable(unsigned int irq, unsigned long handle) | |||
234 | unsigned int cpu; | 235 | unsigned int cpu; |
235 | 236 | ||
236 | for (cpu = 0; cpu < SMP_NR(d, _INTC_ADDR_E(handle)); cpu++) { | 237 | for (cpu = 0; cpu < SMP_NR(d, _INTC_ADDR_E(handle)); cpu++) { |
238 | #ifdef CONFIG_SMP | ||
239 | if (!cpumask_test_cpu(cpu, irq_to_desc(irq)->affinity)) | ||
240 | continue; | ||
241 | #endif | ||
237 | addr = INTC_REG(d, _INTC_ADDR_E(handle), cpu); | 242 | addr = INTC_REG(d, _INTC_ADDR_E(handle), cpu); |
238 | intc_enable_fns[_INTC_MODE(handle)](addr, handle, intc_reg_fns\ | 243 | intc_enable_fns[_INTC_MODE(handle)](addr, handle, intc_reg_fns\ |
239 | [_INTC_FN(handle)], irq); | 244 | [_INTC_FN(handle)], irq); |
@@ -253,6 +258,10 @@ static void intc_disable(unsigned int irq) | |||
253 | unsigned int cpu; | 258 | unsigned int cpu; |
254 | 259 | ||
255 | for (cpu = 0; cpu < SMP_NR(d, _INTC_ADDR_D(handle)); cpu++) { | 260 | for (cpu = 0; cpu < SMP_NR(d, _INTC_ADDR_D(handle)); cpu++) { |
261 | #ifdef CONFIG_SMP | ||
262 | if (!cpumask_test_cpu(cpu, irq_to_desc(irq)->affinity)) | ||
263 | continue; | ||
264 | #endif | ||
256 | addr = INTC_REG(d, _INTC_ADDR_D(handle), cpu); | 265 | addr = INTC_REG(d, _INTC_ADDR_D(handle), cpu); |
257 | intc_disable_fns[_INTC_MODE(handle)](addr, handle,intc_reg_fns\ | 266 | intc_disable_fns[_INTC_MODE(handle)](addr, handle,intc_reg_fns\ |
258 | [_INTC_FN(handle)], irq); | 267 | [_INTC_FN(handle)], irq); |
@@ -301,6 +310,23 @@ static int intc_set_wake(unsigned int irq, unsigned int on) | |||
301 | return 0; /* allow wakeup, but setup hardware in intc_suspend() */ | 310 | return 0; /* allow wakeup, but setup hardware in intc_suspend() */ |
302 | } | 311 | } |
303 | 312 | ||
313 | #ifdef CONFIG_SMP | ||
314 | /* | ||
315 | * This is held with the irq desc lock held, so we don't require any | ||
316 | * additional locking here at the intc desc level. The affinity mask is | ||
317 | * later tested in the enable/disable paths. | ||
318 | */ | ||
319 | static int intc_set_affinity(unsigned int irq, const struct cpumask *cpumask) | ||
320 | { | ||
321 | if (!cpumask_intersects(cpumask, cpu_online_mask)) | ||
322 | return -1; | ||
323 | |||
324 | cpumask_copy(irq_to_desc(irq)->affinity, cpumask); | ||
325 | |||
326 | return 0; | ||
327 | } | ||
328 | #endif | ||
329 | |||
304 | static void intc_mask_ack(unsigned int irq) | 330 | static void intc_mask_ack(unsigned int irq) |
305 | { | 331 | { |
306 | struct intc_desc_int *d = get_intc_desc(irq); | 332 | struct intc_desc_int *d = get_intc_desc(irq); |
@@ -847,6 +873,9 @@ void __init register_intc_controller(struct intc_desc *desc) | |||
847 | d->chip.shutdown = intc_disable; | 873 | d->chip.shutdown = intc_disable; |
848 | d->chip.set_type = intc_set_sense; | 874 | d->chip.set_type = intc_set_sense; |
849 | d->chip.set_wake = intc_set_wake; | 875 | d->chip.set_wake = intc_set_wake; |
876 | #ifdef CONFIG_SMP | ||
877 | d->chip.set_affinity = intc_set_affinity; | ||
878 | #endif | ||
850 | 879 | ||
851 | if (hw->ack_regs) { | 880 | if (hw->ack_regs) { |
852 | for (i = 0; i < hw->nr_ack_regs; i++) | 881 | for (i = 0; i < hw->nr_ack_regs; i++) |