x86: apic honour irq affinity which was set in early boot

setup_ioapic_dest() is called after the non boot cpus have been
brought up. It sets the irq affinity of all already configured
interrupts to all cpus and ignores affinity settings which were
done by the early bootup code.

If the IRQ_NO_BALANCING or IRQ_AFFINITY_SET flags are set then use the
affinity mask from the irq descriptor and not TARGET_CPUS.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Ingo Molnar <mingo@elte.hu>

authored by Thomas Gleixner and committed by Ingo Molnar 6c2e9403 612e3684

+22 -6
+22 -6
arch/x86/kernel/io_apic.c
··· 3761 void __init setup_ioapic_dest(void) 3762 { 3763 int pin, ioapic, irq, irq_entry; 3764 struct irq_cfg *cfg; 3765 3766 if (skip_ioapic_setup == 1) 3767 return; ··· 3780 * cpu is online. 3781 */ 3782 cfg = irq_cfg(irq); 3783 - if (!cfg->vector) 3784 setup_IO_APIC_irq(ioapic, pin, irq, 3785 irq_trigger(irq_entry), 3786 irq_polarity(irq_entry)); 3787 - #ifdef CONFIG_INTR_REMAP 3788 - else if (intr_remapping_enabled) 3789 - set_ir_ioapic_affinity_irq(irq, TARGET_CPUS); 3790 - #endif 3791 else 3792 - set_ioapic_affinity_irq(irq, TARGET_CPUS); 3793 } 3794 3795 }
··· 3761 void __init setup_ioapic_dest(void) 3762 { 3763 int pin, ioapic, irq, irq_entry; 3764 + struct irq_desc *desc; 3765 struct irq_cfg *cfg; 3766 + cpumask_t mask; 3767 3768 if (skip_ioapic_setup == 1) 3769 return; ··· 3778 * cpu is online. 3779 */ 3780 cfg = irq_cfg(irq); 3781 + if (!cfg->vector) { 3782 setup_IO_APIC_irq(ioapic, pin, irq, 3783 irq_trigger(irq_entry), 3784 irq_polarity(irq_entry)); 3785 + continue; 3786 + 3787 + } 3788 + 3789 + /* 3790 + * Honour affinities which have been set in early boot 3791 + */ 3792 + desc = irq_to_desc(irq); 3793 + if (desc->status & 3794 + (IRQ_NO_BALANCING | IRQ_AFFINITY_SET)) 3795 + mask = desc->affinity; 3796 else 3797 + mask = TARGET_CPUS; 3798 + 3799 + #ifdef CONFIG_INTR_REMAP 3800 + if (intr_remapping_enabled) 3801 + set_ir_ioapic_affinity_irq(irq, mask); 3802 + else 3803 + #endif 3804 + set_ioapic_affinity_irq(irq, mask); 3805 } 3806 3807 }