diff options
author | Thomas Gleixner <tglx@linutronix.de> | 2015-01-15 16:22:19 -0500 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2015-01-22 09:10:54 -0500 |
commit | 55eae7de727e9ecc814853ec364fbbb352c337df (patch) | |
tree | 4df5ccd96f822894f95a205434e703b33daa1af0 /arch/x86/kernel/apic | |
parent | d524165cb8dbb2ce5916cd7682236b9324ae2644 (diff) |
x86/x2apic: Move code in conditional region
No point in having try_to_enable_x2apic() outside of the
CONFIG_X86_X2APIC section and having inline functions and more ifdefs
to deal with it. Move the code into the existing ifdef section and
remove the inline cruft.
Fixup the printk about not enabling interrupt remapping as suggested
by Boris.
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.795388613@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 | 67 |
1 files changed, 33 insertions, 34 deletions
diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c index d5c35346b556..bda56eea929c 100644 --- a/arch/x86/kernel/apic/apic.c +++ b/arch/x86/kernel/apic/apic.c | |||
@@ -1561,41 +1561,8 @@ void enable_x2apic(void) | |||
1561 | } | 1561 | } |
1562 | } | 1562 | } |
1563 | 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 */ | ||
1583 | |||
1584 | static int __init try_to_enable_IR(void) | ||
1585 | { | ||
1586 | #ifdef CONFIG_X86_IO_APIC | ||
1587 | if (!x2apic_enabled() && skip_ioapic_setup) { | ||
1588 | pr_info("Skipped enabling intr-remap because of skipping " | ||
1589 | "io-apic setup\n"); | ||
1590 | return -1; | ||
1591 | } | ||
1592 | #endif | ||
1593 | return irq_remapping_enable(); | ||
1594 | } | ||
1595 | |||
1596 | static __init void try_to_enable_x2apic(int ir_stat) | 1564 | static __init void try_to_enable_x2apic(int ir_stat) |
1597 | { | 1565 | { |
1598 | #ifdef CONFIG_X86_X2APIC | ||
1599 | if (!x2apic_supported()) | 1566 | if (!x2apic_supported()) |
1600 | return; | 1567 | return; |
1601 | 1568 | ||
@@ -1615,7 +1582,7 @@ static __init void try_to_enable_x2apic(int ir_stat) | |||
1615 | * without IR all CPUs can be addressed by IOAPIC/MSI | 1582 | * without IR all CPUs can be addressed by IOAPIC/MSI |
1616 | * only in physical mode | 1583 | * only in physical mode |
1617 | */ | 1584 | */ |
1618 | x2apic_force_phys(); | 1585 | x2apic_phys = 1; |
1619 | } | 1586 | } |
1620 | 1587 | ||
1621 | if (!x2apic_mode) { | 1588 | if (!x2apic_mode) { |
@@ -1623,7 +1590,39 @@ static __init void try_to_enable_x2apic(int ir_stat) | |||
1623 | enable_x2apic(); | 1590 | enable_x2apic(); |
1624 | pr_info("Enabled x2apic\n"); | 1591 | pr_info("Enabled x2apic\n"); |
1625 | } | 1592 | } |
1593 | } | ||
1594 | |||
1595 | void __init check_x2apic(void) | ||
1596 | { | ||
1597 | if (x2apic_enabled()) { | ||
1598 | pr_info("x2apic: enabled by BIOS, switching to x2apic ops\n"); | ||
1599 | x2apic_mode = 1; | ||
1600 | } | ||
1601 | } | ||
1602 | #else /* CONFIG_X86_X2APIC */ | ||
1603 | static int __init validate_x2apic(void) | ||
1604 | { | ||
1605 | if (!apic_is_x2apic_enabled()) | ||
1606 | return 0; | ||
1607 | /* | ||
1608 | * Checkme: Can we simply turn off x2apic here instead of panic? | ||
1609 | */ | ||
1610 | panic("BIOS has enabled x2apic but kernel doesn't support x2apic, please disable x2apic in BIOS.\n"); | ||
1611 | } | ||
1612 | early_initcall(validate_x2apic); | ||
1613 | |||
1614 | static inline void try_to_enable_x2apic(int ir_stat) { } | ||
1615 | #endif /* !CONFIG_X86_X2APIC */ | ||
1616 | |||
1617 | static int __init try_to_enable_IR(void) | ||
1618 | { | ||
1619 | #ifdef CONFIG_X86_IO_APIC | ||
1620 | if (!x2apic_enabled() && skip_ioapic_setup) { | ||
1621 | pr_info("Not enabling interrupt remapping due to skipped IO-APIC setup\n"); | ||
1622 | return -1; | ||
1623 | } | ||
1626 | #endif | 1624 | #endif |
1625 | return irq_remapping_enable(); | ||
1627 | } | 1626 | } |
1628 | 1627 | ||
1629 | void __init enable_IR_x2apic(void) | 1628 | void __init enable_IR_x2apic(void) |