diff options
Diffstat (limited to 'arch/powerpc/kernel/irq.c')
-rw-r--r-- | arch/powerpc/kernel/irq.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/arch/powerpc/kernel/irq.c b/arch/powerpc/kernel/irq.c index 5b428e308666..38dd10e2841d 100644 --- a/arch/powerpc/kernel/irq.c +++ b/arch/powerpc/kernel/irq.c | |||
@@ -882,6 +882,41 @@ unsigned int irq_find_mapping(struct irq_host *host, | |||
882 | } | 882 | } |
883 | EXPORT_SYMBOL_GPL(irq_find_mapping); | 883 | EXPORT_SYMBOL_GPL(irq_find_mapping); |
884 | 884 | ||
885 | #ifdef CONFIG_SMP | ||
886 | int irq_choose_cpu(const struct cpumask *mask) | ||
887 | { | ||
888 | int cpuid; | ||
889 | |||
890 | if (cpumask_equal(mask, cpu_all_mask)) { | ||
891 | static int irq_rover; | ||
892 | static DEFINE_RAW_SPINLOCK(irq_rover_lock); | ||
893 | unsigned long flags; | ||
894 | |||
895 | /* Round-robin distribution... */ | ||
896 | do_round_robin: | ||
897 | raw_spin_lock_irqsave(&irq_rover_lock, flags); | ||
898 | |||
899 | irq_rover = cpumask_next(irq_rover, cpu_online_mask); | ||
900 | if (irq_rover >= nr_cpu_ids) | ||
901 | irq_rover = cpumask_first(cpu_online_mask); | ||
902 | |||
903 | cpuid = irq_rover; | ||
904 | |||
905 | raw_spin_unlock_irqrestore(&irq_rover_lock, flags); | ||
906 | } else { | ||
907 | cpuid = cpumask_first_and(mask, cpu_online_mask); | ||
908 | if (cpuid >= nr_cpu_ids) | ||
909 | goto do_round_robin; | ||
910 | } | ||
911 | |||
912 | return get_hard_smp_processor_id(cpuid); | ||
913 | } | ||
914 | #else | ||
915 | int irq_choose_cpu(const struct cpumask *mask) | ||
916 | { | ||
917 | return hard_smp_processor_id(); | ||
918 | } | ||
919 | #endif | ||
885 | 920 | ||
886 | unsigned int irq_radix_revmap_lookup(struct irq_host *host, | 921 | unsigned int irq_radix_revmap_lookup(struct irq_host *host, |
887 | irq_hw_number_t hwirq) | 922 | irq_hw_number_t hwirq) |