[PATCH 3.16 217/346] x86/apic: Do not init irq remapping if ioapic is disabled

From: Ben Hutchings
Date: Sun Nov 13 2016 - 21:41:31 EST


3.16.39-rc1 review patch. If anyone has any objections, please let me know.

------------------

From: Wanpeng Li <wanpeng.li@xxxxxxxxxxx>

commit 2e63ad4bd5dd583871e6602f9d398b9322d358d9 upstream.

native_smp_prepare_cpus
-> default_setup_apic_routing
-> enable_IR_x2apic
-> irq_remapping_prepare
-> intel_prepare_irq_remapping
-> intel_setup_irq_remapping

So IR table is setup even if "noapic" boot parameter is added. As a result we
crash later when the interrupt affinity is set due to a half initialized
remapping infrastructure.

Prevent remap initialization when IOAPIC is disabled.

Signed-off-by: Wanpeng Li <wanpeng.li@xxxxxxxxxxx>
Cc: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
Cc: Joerg Roedel <joro@xxxxxxxxxx>
Link: http://lkml.kernel.org/r/1471954039-3942-1-git-send-email-wanpeng.li@xxxxxxxxxxx
Signed-off-by: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
[bwh: Backported to 3.16: adjust context]
Signed-off-by: Ben Hutchings <ben@xxxxxxxxxxxxxxx>
---
arch/x86/kernel/apic/apic.c | 3 +++
1 file changed, 3 insertions(+)

--- a/arch/x86/kernel/apic/apic.c
+++ b/arch/x86/kernel/apic/apic.c
@@ -1615,6 +1615,9 @@ void __init enable_IR_x2apic(void)
int ret, x2apic_enabled = 0;
int hardware_init_ret;

+ if (skip_ioapic_setup)
+ return;
+
/* Make sure irq_remap_ops are initialized */
setup_irq_remapping_ops();