summaryrefslogtreecommitdiff
path: root/arch/x86/kernel/apic/apic.c
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2015-01-15 21:22:17 +0000
committerThomas Gleixner <tglx@linutronix.de>2015-01-22 15:10:54 +0100
commitd524165cb8dbb2ce5916cd7682236b9324ae2644 (patch)
treea8ea3e36ab009ddfed5ea834ca15c67c21e169ed /arch/x86/kernel/apic/apic.c
parent9aa16365275a272283acbda665634ca3dc8b46fe (diff)
x86/apic: Check x2apic early
No point in delaying the x2apic detection for the CONFIG_X86_X2APIC=n case to enable_IR_x2apic(). We rather detect that before we try to setup anything there. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Cc: Jiang Liu <jiang.liu@linux.intel.com> Cc: Joerg Roedel <joro@8bytes.org> Cc: Tony Luck <tony.luck@intel.com> Cc: Borislav Petkov <bp@alien8.de> Link: http://lkml.kernel.org/r/20150115211702.702479404@linutronix.de Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'arch/x86/kernel/apic/apic.c')
-rw-r--r--arch/x86/kernel/apic/apic.c34
1 files changed, 20 insertions, 14 deletions
diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c
index fdc6c60faa6b..d5c35346b556 100644
--- a/arch/x86/kernel/apic/apic.c
+++ b/arch/x86/kernel/apic/apic.c
@@ -1541,14 +1541,6 @@ static __init void disable_x2apic(void)
x2apic_disabled = 1;
}
-void check_x2apic(void)
-{
- if (x2apic_enabled()) {
- pr_info("x2apic enabled by BIOS, switching to x2apic ops\n");
- x2apic_mode = 1;
- }
-}
-
void enable_x2apic(void)
{
u64 msr;
@@ -1568,7 +1560,26 @@ void enable_x2apic(void)
wrmsrl(MSR_IA32_APICBASE, msr | X2APIC_ENABLE);
}
}
-#endif /* CONFIG_X86_X2APIC */
+
+void __init check_x2apic(void)
+{
+ if (x2apic_enabled()) {
+ pr_info("x2apic enabled by BIOS, switching to x2apic ops\n");
+ x2apic_mode = 1;
+ }
+}
+#else /* CONFIG_X86_X2APIC */
+static int __init validate_x2apic(void)
+{
+ if (!apic_is_x2apic_enabled())
+ return 0;
+ /*
+ * Checkme: Can we simply turn off x2apic here instead of panic?
+ */
+ panic("BIOS has enabled x2apic but kernel doesn't support x2apic, please disable x2apic in BIOS.\n");
+}
+early_initcall(validate_x2apic);
+#endif /* !CONFIG_X86_X2APIC */
static int __init try_to_enable_IR(void)
{
@@ -1620,11 +1631,6 @@ void __init enable_IR_x2apic(void)
unsigned long flags;
int ret, ir_stat;
- if (!IS_ENABLED(CONFIG_X86_X2APIC)) {
- if (apic_is_x2apic_enabled())
- panic("BIOS has enabled x2apic but kernel doesn't support x2apic, please disable x2apic in BIOS.\n");
- }
-
ir_stat = irq_remapping_prepare();
if (ir_stat < 0 && !x2apic_supported())
return;