aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/sh
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/sh')
-rw-r--r--drivers/sh/intc.c31
1 files changed, 30 insertions, 1 deletions
diff --git a/drivers/sh/intc.c b/drivers/sh/intc.c
index a700dfec8dc3..f43850527645 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) | \
@@ -242,6 +243,10 @@ static inline void _intc_enable(unsigned int irq, unsigned long handle)
242 unsigned int cpu; 243 unsigned int cpu;
243 244
244 for (cpu = 0; cpu < SMP_NR(d, _INTC_ADDR_E(handle)); cpu++) { 245 for (cpu = 0; cpu < SMP_NR(d, _INTC_ADDR_E(handle)); cpu++) {
246#ifdef CONFIG_SMP
247 if (!cpumask_test_cpu(cpu, irq_to_desc(irq)->affinity))
248 continue;
249#endif
245 addr = INTC_REG(d, _INTC_ADDR_E(handle), cpu); 250 addr = INTC_REG(d, _INTC_ADDR_E(handle), cpu);
246 intc_enable_fns[_INTC_MODE(handle)](addr, handle, intc_reg_fns\ 251 intc_enable_fns[_INTC_MODE(handle)](addr, handle, intc_reg_fns\
247 [_INTC_FN(handle)], irq); 252 [_INTC_FN(handle)], irq);
@@ -261,6 +266,10 @@ static void intc_disable(unsigned int irq)
261 unsigned int cpu; 266 unsigned int cpu;
262 267
263 for (cpu = 0; cpu < SMP_NR(d, _INTC_ADDR_D(handle)); cpu++) { 268 for (cpu = 0; cpu < SMP_NR(d, _INTC_ADDR_D(handle)); cpu++) {
269#ifdef CONFIG_SMP
270 if (!cpumask_test_cpu(cpu, irq_to_desc(irq)->affinity))
271 continue;
272#endif
264 addr = INTC_REG(d, _INTC_ADDR_D(handle), cpu); 273 addr = INTC_REG(d, _INTC_ADDR_D(handle), cpu);
265 intc_disable_fns[_INTC_MODE(handle)](addr, handle,intc_reg_fns\ 274 intc_disable_fns[_INTC_MODE(handle)](addr, handle,intc_reg_fns\
266 [_INTC_FN(handle)], irq); 275 [_INTC_FN(handle)], irq);
@@ -309,6 +318,23 @@ static int intc_set_wake(unsigned int irq, unsigned int on)
309 return 0; /* allow wakeup, but setup hardware in intc_suspend() */ 318 return 0; /* allow wakeup, but setup hardware in intc_suspend() */
310} 319}
311 320
321#ifdef CONFIG_SMP
322/*
323 * This is held with the irq desc lock held, so we don't require any
324 * additional locking here at the intc desc level. The affinity mask is
325 * later tested in the enable/disable paths.
326 */
327static int intc_set_affinity(unsigned int irq, const struct cpumask *cpumask)
328{
329 if (!cpumask_intersects(cpumask, cpu_online_mask))
330 return -1;
331
332 cpumask_copy(irq_to_desc(irq)->affinity, cpumask);
333
334 return 0;
335}
336#endif
337
312static void intc_mask_ack(unsigned int irq) 338static void intc_mask_ack(unsigned int irq)
313{ 339{
314 struct intc_desc_int *d = get_intc_desc(irq); 340 struct intc_desc_int *d = get_intc_desc(irq);
@@ -916,6 +942,9 @@ int __init register_intc_controller(struct intc_desc *desc)
916 d->chip.shutdown = intc_disable; 942 d->chip.shutdown = intc_disable;
917 d->chip.set_type = intc_set_sense; 943 d->chip.set_type = intc_set_sense;
918 d->chip.set_wake = intc_set_wake; 944 d->chip.set_wake = intc_set_wake;
945#ifdef CONFIG_SMP
946 d->chip.set_affinity = intc_set_affinity;
947#endif
919 948
920 if (hw->ack_regs) { 949 if (hw->ack_regs) {
921 for (i = 0; i < hw->nr_ack_regs; i++) 950 for (i = 0; i < hw->nr_ack_regs; i++)