diff options
author | Yang Li <leoli@freescale.com> | 2009-12-16 15:18:11 -0500 |
---|---|---|
committer | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2009-12-17 23:13:57 -0500 |
commit | 38e1313fc753482b93aa6c6f11cfbd43a5bcd963 (patch) | |
tree | 0adcc3a9db52c5689b9386673f22fa0f892a7630 /arch/powerpc/sysdev | |
parent | a1128f8f0ff06ccbea5d6b4a69446b506c57bfbc (diff) |
powerpc/mpic: Fix problem that affinity is not updated
Since commit 57b150cce8e004ddd36330490a68bfb59b7271e9, desc->affinity
of an irq is changed after calling desc->chip->set_affinity.
Therefore we need to fix the irq_choose_cpu() not to depend on the
desc->affinity for new mask.
Signed-off-by: Jiajun Wu <b06378@freescale.com>
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc/sysdev')
-rw-r--r-- | arch/powerpc/sysdev/mpic.c | 19 |
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 |
570 | static int irq_choose_cpu(unsigned int virt_irq) | 570 | static 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 |
610 | static int irq_choose_cpu(unsigned int virt_irq) | 603 | static 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 { |