aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/sysdev/mpic.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/powerpc/sysdev/mpic.c')
-rw-r--r--arch/powerpc/sysdev/mpic.c19
1 files changed, 6 insertions, 13 deletions
diff --git a/arch/powerpc/sysdev/mpic.c b/arch/powerpc/sysdev/mpic.c
index aa9d06e5925b..470dc6c11d57 100644
--- a/arch/powerpc/sysdev/mpic.c
+++ b/arch/powerpc/sysdev/mpic.c
@@ -567,13 +567,11 @@ static void __init mpic_scan_ht_pics(struct mpic *mpic)
567#endif /* CONFIG_MPIC_U3_HT_IRQS */ 567#endif /* CONFIG_MPIC_U3_HT_IRQS */
568 568
569#ifdef CONFIG_SMP 569#ifdef CONFIG_SMP
570static int irq_choose_cpu(unsigned int virt_irq) 570static int irq_choose_cpu(const cpumask_t *mask)
571{ 571{
572 cpumask_t mask;
573 int cpuid; 572 int cpuid;
574 573
575 cpumask_copy(&mask, irq_to_desc(virt_irq)->affinity); 574 if (cpumask_equal(mask, cpu_all_mask)) {
576 if (cpus_equal(mask, CPU_MASK_ALL)) {
577 static int irq_rover; 575 static int irq_rover;
578 static DEFINE_SPINLOCK(irq_rover_lock); 576 static DEFINE_SPINLOCK(irq_rover_lock);
579 unsigned long flags; 577 unsigned long flags;
@@ -594,20 +592,15 @@ static int irq_choose_cpu(unsigned int virt_irq)
594 592
595 spin_unlock_irqrestore(&irq_rover_lock, flags); 593 spin_unlock_irqrestore(&irq_rover_lock, flags);
596 } else { 594 } else {
597 cpumask_t tmp; 595 cpuid = cpumask_first_and(mask, cpu_online_mask);
598 596 if (cpuid >= nr_cpu_ids)
599 cpus_and(tmp, cpu_online_map, mask);
600
601 if (cpus_empty(tmp))
602 goto do_round_robin; 597 goto do_round_robin;
603
604 cpuid = first_cpu(tmp);
605 } 598 }
606 599
607 return get_hard_smp_processor_id(cpuid); 600 return get_hard_smp_processor_id(cpuid);
608} 601}
609#else 602#else
610static int irq_choose_cpu(unsigned int virt_irq) 603static int irq_choose_cpu(const cpumask_t *mask)
611{ 604{
612 return hard_smp_processor_id(); 605 return hard_smp_processor_id();
613} 606}
@@ -816,7 +809,7 @@ int mpic_set_affinity(unsigned int irq, const struct cpumask *cpumask)
816 unsigned int src = mpic_irq_to_hw(irq); 809 unsigned int src = mpic_irq_to_hw(irq);
817 810
818 if (mpic->flags & MPIC_SINGLE_DEST_CPU) { 811 if (mpic->flags & MPIC_SINGLE_DEST_CPU) {
819 int cpuid = irq_choose_cpu(irq); 812 int cpuid = irq_choose_cpu(cpumask);
820 813
821 mpic_irq_write(src, MPIC_INFO(IRQ_DESTINATION), 1 << cpuid); 814 mpic_irq_write(src, MPIC_INFO(IRQ_DESTINATION), 1 << cpuid);
822 } else { 815 } else {