aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2015-01-15 16:22:16 -0500
committerThomas Gleixner <tglx@linutronix.de>2015-01-22 09:10:54 -0500
commit9aa16365275a272283acbda665634ca3dc8b46fe (patch)
tree18f9b207e9d2dd37775b3c872625e134d0bf62ab /arch/x86/kernel
parent2ca5b40479246087695d9e6343075b47ee6887ea (diff)
x86/apic: Make disable x2apic work really
If x2apic_preenabled is not enabled, then disable_x2apic() is not called from various places which results in x2apic_disabled not being set. So other code pathes can happily reenable the x2apic. 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.621431109@linutronix.de Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'arch/x86/kernel')
-rw-r--r--arch/x86/kernel/apic/apic.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c
index 08144f5c1236..fdc6c60faa6b 100644
--- a/arch/x86/kernel/apic/apic.c
+++ b/arch/x86/kernel/apic/apic.c
@@ -1479,8 +1479,6 @@ static bool nox2apic __initdata;
1479 1479
1480#ifdef CONFIG_X86_X2APIC 1480#ifdef CONFIG_X86_X2APIC
1481int x2apic_mode; 1481int x2apic_mode;
1482/* x2apic enabled before OS handover */
1483static int x2apic_preenabled;
1484static int x2apic_disabled; 1482static int x2apic_disabled;
1485static int __init setup_nox2apic(char *str) 1483static int __init setup_nox2apic(char *str)
1486{ 1484{
@@ -1535,18 +1533,19 @@ static __init void disable_x2apic(void)
1535 setup_clear_cpu_cap(X86_FEATURE_X2APIC); 1533 setup_clear_cpu_cap(X86_FEATURE_X2APIC);
1536 } 1534 }
1537 1535
1538 x2apic_disabled = 1;
1539 x2apic_mode = 0; 1536 x2apic_mode = 0;
1540 1537
1541 register_lapic_address(mp_lapic_addr); 1538 register_lapic_address(mp_lapic_addr);
1542 } 1539 }
1540
1541 x2apic_disabled = 1;
1543} 1542}
1544 1543
1545void check_x2apic(void) 1544void check_x2apic(void)
1546{ 1545{
1547 if (x2apic_enabled()) { 1546 if (x2apic_enabled()) {
1548 pr_info("x2apic enabled by BIOS, switching to x2apic ops\n"); 1547 pr_info("x2apic enabled by BIOS, switching to x2apic ops\n");
1549 x2apic_preenabled = x2apic_mode = 1; 1548 x2apic_mode = 1;
1550 } 1549 }
1551} 1550}
1552 1551
@@ -1569,8 +1568,6 @@ void enable_x2apic(void)
1569 wrmsrl(MSR_IA32_APICBASE, msr | X2APIC_ENABLE); 1568 wrmsrl(MSR_IA32_APICBASE, msr | X2APIC_ENABLE);
1570 } 1569 }
1571} 1570}
1572#else
1573#define x2apic_preenabled (0)
1574#endif /* CONFIG_X86_X2APIC */ 1571#endif /* CONFIG_X86_X2APIC */
1575 1572
1576static int __init try_to_enable_IR(void) 1573static int __init try_to_enable_IR(void)
@@ -1599,8 +1596,7 @@ static __init void try_to_enable_x2apic(int ir_stat)
1599 (IS_ENABLED(CONFIG_HYPERVISOR_GUEST) && 1596 (IS_ENABLED(CONFIG_HYPERVISOR_GUEST) &&
1600 !hypervisor_x2apic_available())) { 1597 !hypervisor_x2apic_available())) {
1601 pr_info("IRQ remapping doesn't support X2APIC mode, disable x2apic.\n"); 1598 pr_info("IRQ remapping doesn't support X2APIC mode, disable x2apic.\n");
1602 if (x2apic_preenabled) 1599 disable_x2apic();
1603 disable_x2apic();
1604 return; 1600 return;
1605 } 1601 }
1606 1602
@@ -1643,7 +1639,7 @@ void __init enable_IR_x2apic(void)
1643 legacy_pic->mask_all(); 1639 legacy_pic->mask_all();
1644 mask_ioapic_entries(); 1640 mask_ioapic_entries();
1645 1641
1646 if (x2apic_preenabled && nox2apic) 1642 if (nox2apic)
1647 disable_x2apic(); 1643 disable_x2apic();
1648 /* If irq_remapping_prepare() succeded, try to enable it */ 1644 /* If irq_remapping_prepare() succeded, try to enable it */
1649 if (ir_stat >= 0) 1645 if (ir_stat >= 0)