diff options
-rw-r--r-- | arch/x86/kernel/apic/apic.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c index 06b75216d171..b374b0de342b 100644 --- a/arch/x86/kernel/apic/apic.c +++ b/arch/x86/kernel/apic/apic.c | |||
@@ -1480,6 +1480,14 @@ static bool nox2apic __initdata; | |||
1480 | #ifdef CONFIG_X86_X2APIC | 1480 | #ifdef CONFIG_X86_X2APIC |
1481 | int x2apic_mode; | 1481 | int x2apic_mode; |
1482 | static int x2apic_disabled; | 1482 | static int x2apic_disabled; |
1483 | |||
1484 | enum { | ||
1485 | X2APIC_OFF, | ||
1486 | X2APIC_ON, | ||
1487 | X2APIC_DISABLED, | ||
1488 | }; | ||
1489 | static int x2apic_state; | ||
1490 | |||
1483 | static int __init setup_nox2apic(char *str) | 1491 | static int __init setup_nox2apic(char *str) |
1484 | { | 1492 | { |
1485 | if (x2apic_enabled()) { | 1493 | if (x2apic_enabled()) { |
@@ -1496,7 +1504,7 @@ static int __init setup_nox2apic(char *str) | |||
1496 | setup_clear_cpu_cap(X86_FEATURE_X2APIC); | 1504 | setup_clear_cpu_cap(X86_FEATURE_X2APIC); |
1497 | 1505 | ||
1498 | nox2apic = true; | 1506 | nox2apic = true; |
1499 | 1507 | x2apic_state = X2APIC_DISABLED; | |
1500 | return 0; | 1508 | return 0; |
1501 | } | 1509 | } |
1502 | early_param("nox2apic", setup_nox2apic); | 1510 | early_param("nox2apic", setup_nox2apic); |
@@ -1539,6 +1547,7 @@ static __init void disable_x2apic(void) | |||
1539 | } | 1547 | } |
1540 | 1548 | ||
1541 | x2apic_disabled = 1; | 1549 | x2apic_disabled = 1; |
1550 | x2apic_state = X2APIC_DISABLED; | ||
1542 | } | 1551 | } |
1543 | 1552 | ||
1544 | void enable_x2apic(void) | 1553 | void enable_x2apic(void) |
@@ -1559,6 +1568,7 @@ void enable_x2apic(void) | |||
1559 | printk_once(KERN_INFO "Enabling x2apic\n"); | 1568 | printk_once(KERN_INFO "Enabling x2apic\n"); |
1560 | wrmsrl(MSR_IA32_APICBASE, msr | X2APIC_ENABLE); | 1569 | wrmsrl(MSR_IA32_APICBASE, msr | X2APIC_ENABLE); |
1561 | } | 1570 | } |
1571 | x2apic_state = X2APIC_ON; | ||
1562 | } | 1572 | } |
1563 | 1573 | ||
1564 | static __init void try_to_enable_x2apic(int remap_mode) | 1574 | static __init void try_to_enable_x2apic(int remap_mode) |
@@ -1597,6 +1607,9 @@ void __init check_x2apic(void) | |||
1597 | if (x2apic_enabled()) { | 1607 | if (x2apic_enabled()) { |
1598 | pr_info("x2apic: enabled by BIOS, switching to x2apic ops\n"); | 1608 | pr_info("x2apic: enabled by BIOS, switching to x2apic ops\n"); |
1599 | x2apic_mode = 1; | 1609 | x2apic_mode = 1; |
1610 | x2apic_state = X2APIC_ON; | ||
1611 | } else if (!cpu_has_x2apic) { | ||
1612 | x2apic_state = X2APIC_DISABLED; | ||
1600 | } | 1613 | } |
1601 | } | 1614 | } |
1602 | #else /* CONFIG_X86_X2APIC */ | 1615 | #else /* CONFIG_X86_X2APIC */ |