aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2015-01-15 16:22:12 -0500
committerThomas Gleixner <tglx@linutronix.de>2015-01-22 09:10:54 -0500
commitbfb050702990d6a2033d072cb2af583aee5c6fc5 (patch)
tree159575eedb649269cc87e87322f48bebad339c37
parent81a46dd8249d7fa72a8557e58a38aa984e6b5e16 (diff)
x86/apic: Move x2apic code to one place
Having several disjunct pieces of code for x2apic support makes reading the code unnecessarily hard. Move it to one ifdeffed section. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Acked-by: Borislav Petkov <bp@alien8.de> Cc: Jiang Liu <jiang.liu@linux.intel.com> Cc: Joerg Roedel <joro@8bytes.org> Cc: Tony Luck <tony.luck@intel.com> Link: http://lkml.kernel.org/r/20150115211702.445212133@linutronix.de Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
-rw-r--r--arch/x86/kernel/apic/apic.c58
1 files changed, 28 insertions, 30 deletions
diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c
index a7d3b64ff3e5..ff2a8b8ffa0a 100644
--- a/arch/x86/kernel/apic/apic.c
+++ b/arch/x86/kernel/apic/apic.c
@@ -134,9 +134,6 @@ static inline void imcr_apic_to_pic(void)
134 */ 134 */
135static int force_enable_local_apic __initdata; 135static int force_enable_local_apic __initdata;
136 136
137/* Control whether x2APIC mode is enabled or not */
138static bool nox2apic __initdata;
139
140/* 137/*
141 * APIC command line parameters 138 * APIC command line parameters
142 */ 139 */
@@ -161,33 +158,6 @@ static __init int setup_apicpmtimer(char *s)
161__setup("apicpmtimer", setup_apicpmtimer); 158__setup("apicpmtimer", setup_apicpmtimer);
162#endif 159#endif
163 160
164#ifdef CONFIG_X86_X2APIC
165int x2apic_mode;
166/* x2apic enabled before OS handover */
167int x2apic_preenabled;
168static int x2apic_disabled;
169static int __init setup_nox2apic(char *str)
170{
171 if (x2apic_enabled()) {
172 int apicid = native_apic_msr_read(APIC_ID);
173
174 if (apicid >= 255) {
175 pr_warning("Apicid: %08x, cannot enforce nox2apic\n",
176 apicid);
177 return 0;
178 }
179
180 pr_warning("x2apic already enabled. will disable it\n");
181 } else
182 setup_clear_cpu_cap(X86_FEATURE_X2APIC);
183
184 nox2apic = true;
185
186 return 0;
187}
188early_param("nox2apic", setup_nox2apic);
189#endif
190
191unsigned long mp_lapic_addr; 161unsigned long mp_lapic_addr;
192int disable_apic; 162int disable_apic;
193/* Disable local APIC timer from the kernel commandline or via dmi quirk */ 163/* Disable local APIC timer from the kernel commandline or via dmi quirk */
@@ -1504,7 +1474,35 @@ void __init bsp_end_local_APIC_setup(void)
1504 1474
1505} 1475}
1506 1476
1477/* Control whether x2APIC mode is enabled or not */
1478static bool nox2apic __initdata;
1479
1507#ifdef CONFIG_X86_X2APIC 1480#ifdef CONFIG_X86_X2APIC
1481int x2apic_mode;
1482/* x2apic enabled before OS handover */
1483int x2apic_preenabled;
1484static int x2apic_disabled;
1485static int __init setup_nox2apic(char *str)
1486{
1487 if (x2apic_enabled()) {
1488 int apicid = native_apic_msr_read(APIC_ID);
1489
1490 if (apicid >= 255) {
1491 pr_warning("Apicid: %08x, cannot enforce nox2apic\n",
1492 apicid);
1493 return 0;
1494 }
1495
1496 pr_warning("x2apic already enabled. will disable it\n");
1497 } else
1498 setup_clear_cpu_cap(X86_FEATURE_X2APIC);
1499
1500 nox2apic = true;
1501
1502 return 0;
1503}
1504early_param("nox2apic", setup_nox2apic);
1505
1508/* 1506/*
1509 * Need to disable xapic and x2apic at the same time and then enable xapic mode 1507 * Need to disable xapic and x2apic at the same time and then enable xapic mode
1510 */ 1508 */