diff options
Diffstat (limited to 'arch/sh/kernel/irq.c')
-rw-r--r-- | arch/sh/kernel/irq.c | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/arch/sh/kernel/irq.c b/arch/sh/kernel/irq.c index f6a9319c28e2..257de1f0692b 100644 --- a/arch/sh/kernel/irq.c +++ b/arch/sh/kernel/irq.c | |||
@@ -12,6 +12,7 @@ | |||
12 | #include <linux/kernel_stat.h> | 12 | #include <linux/kernel_stat.h> |
13 | #include <linux/seq_file.h> | 13 | #include <linux/seq_file.h> |
14 | #include <linux/ftrace.h> | 14 | #include <linux/ftrace.h> |
15 | #include <linux/delay.h> | ||
15 | #include <asm/processor.h> | 16 | #include <asm/processor.h> |
16 | #include <asm/machvec.h> | 17 | #include <asm/machvec.h> |
17 | #include <asm/uaccess.h> | 18 | #include <asm/uaccess.h> |
@@ -292,3 +293,44 @@ int __init arch_probe_nr_irqs(void) | |||
292 | return 0; | 293 | return 0; |
293 | } | 294 | } |
294 | #endif | 295 | #endif |
296 | |||
297 | #ifdef CONFIG_HOTPLUG_CPU | ||
298 | static void route_irq(struct irq_desc *desc, unsigned int irq, unsigned int cpu) | ||
299 | { | ||
300 | printk(KERN_INFO "IRQ%u: moving from cpu%u to cpu%u\n", | ||
301 | irq, desc->node, cpu); | ||
302 | |||
303 | raw_spin_lock_irq(&desc->lock); | ||
304 | desc->chip->set_affinity(irq, cpumask_of(cpu)); | ||
305 | raw_spin_unlock_irq(&desc->lock); | ||
306 | } | ||
307 | |||
308 | /* | ||
309 | * The CPU has been marked offline. Migrate IRQs off this CPU. If | ||
310 | * the affinity settings do not allow other CPUs, force them onto any | ||
311 | * available CPU. | ||
312 | */ | ||
313 | void migrate_irqs(void) | ||
314 | { | ||
315 | struct irq_desc *desc; | ||
316 | unsigned int irq, cpu = smp_processor_id(); | ||
317 | |||
318 | for_each_irq_desc(irq, desc) { | ||
319 | if (desc->node == cpu) { | ||
320 | unsigned int newcpu = cpumask_any_and(desc->affinity, | ||
321 | cpu_online_mask); | ||
322 | if (newcpu >= nr_cpu_ids) { | ||
323 | if (printk_ratelimit()) | ||
324 | printk(KERN_INFO "IRQ%u no longer affine to CPU%u\n", | ||
325 | irq, cpu); | ||
326 | |||
327 | cpumask_setall(desc->affinity); | ||
328 | newcpu = cpumask_any_and(desc->affinity, | ||
329 | cpu_online_mask); | ||
330 | } | ||
331 | |||
332 | route_irq(desc, irq, newcpu); | ||
333 | } | ||
334 | } | ||
335 | } | ||
336 | #endif | ||