diff options
author | Thomas Gleixner <tglx@linutronix.de> | 2015-01-15 16:22:17 -0500 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2015-01-22 09:10:54 -0500 |
commit | d524165cb8dbb2ce5916cd7682236b9324ae2644 (patch) | |
tree | a8ea3e36ab009ddfed5ea834ca15c67c21e169ed /arch/x86/kernel/apic | |
parent | 9aa16365275a272283acbda665634ca3dc8b46fe (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')
-rw-r--r-- | arch/x86/kernel/apic/apic.c | 34 |
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) | |||
1541 | x2apic_disabled = 1; | 1541 | x2apic_disabled = 1; |
1542 | } | 1542 | } |
1543 | 1543 | ||
1544 | void check_x2apic(void) | ||
1545 | { | ||
1546 | if (x2apic_enabled()) { | ||
1547 | pr_info("x2apic enabled by BIOS, switching to x2apic ops\n"); | ||
1548 | x2apic_mode = 1; | ||
1549 | } | ||
1550 | } | ||
1551 | |||
1552 | void enable_x2apic(void) | 1544 | void enable_x2apic(void) |
1553 | { | 1545 | { |
1554 | u64 msr; | 1546 | u64 msr; |
@@ -1568,7 +1560,26 @@ void enable_x2apic(void) | |||
1568 | wrmsrl(MSR_IA32_APICBASE, msr | X2APIC_ENABLE); | 1560 | wrmsrl(MSR_IA32_APICBASE, msr | X2APIC_ENABLE); |
1569 | } | 1561 | } |
1570 | } | 1562 | } |
1571 | #endif /* CONFIG_X86_X2APIC */ | 1563 | |
1564 | void __init check_x2apic(void) | ||
1565 | { | ||
1566 | if (x2apic_enabled()) { | ||
1567 | pr_info("x2apic enabled by BIOS, switching to x2apic ops\n"); | ||
1568 | x2apic_mode = 1; | ||
1569 | } | ||
1570 | } | ||
1571 | #else /* CONFIG_X86_X2APIC */ | ||
1572 | static int __init validate_x2apic(void) | ||
1573 | { | ||
1574 | if (!apic_is_x2apic_enabled()) | ||
1575 | return 0; | ||
1576 | /* | ||
1577 | * Checkme: Can we simply turn off x2apic here instead of panic? | ||
1578 | */ | ||
1579 | panic("BIOS has enabled x2apic but kernel doesn't support x2apic, please disable x2apic in BIOS.\n"); | ||
1580 | } | ||
1581 | early_initcall(validate_x2apic); | ||
1582 | #endif /* !CONFIG_X86_X2APIC */ | ||
1572 | 1583 | ||
1573 | static int __init try_to_enable_IR(void) | 1584 | static int __init try_to_enable_IR(void) |
1574 | { | 1585 | { |
@@ -1620,11 +1631,6 @@ void __init enable_IR_x2apic(void) | |||
1620 | unsigned long flags; | 1631 | unsigned long flags; |
1621 | int ret, ir_stat; | 1632 | int ret, ir_stat; |
1622 | 1633 | ||
1623 | if (!IS_ENABLED(CONFIG_X86_X2APIC)) { | ||
1624 | if (apic_is_x2apic_enabled()) | ||
1625 | panic("BIOS has enabled x2apic but kernel doesn't support x2apic, please disable x2apic in BIOS.\n"); | ||
1626 | } | ||
1627 | |||
1628 | ir_stat = irq_remapping_prepare(); | 1634 | ir_stat = irq_remapping_prepare(); |
1629 | if (ir_stat < 0 && !x2apic_supported()) | 1635 | if (ir_stat < 0 && !x2apic_supported()) |
1630 | return; | 1636 | return; |