diff options
author | Thomas Gleixner <tglx@linutronix.de> | 2015-01-15 16:22:12 -0500 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2015-01-22 09:10:54 -0500 |
commit | bfb050702990d6a2033d072cb2af583aee5c6fc5 (patch) | |
tree | 159575eedb649269cc87e87322f48bebad339c37 | |
parent | 81a46dd8249d7fa72a8557e58a38aa984e6b5e16 (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.c | 58 |
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 | */ |
135 | static int force_enable_local_apic __initdata; | 135 | static int force_enable_local_apic __initdata; |
136 | 136 | ||
137 | /* Control whether x2APIC mode is enabled or not */ | ||
138 | static 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 | ||
165 | int x2apic_mode; | ||
166 | /* x2apic enabled before OS handover */ | ||
167 | int x2apic_preenabled; | ||
168 | static int x2apic_disabled; | ||
169 | static 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 | } | ||
188 | early_param("nox2apic", setup_nox2apic); | ||
189 | #endif | ||
190 | |||
191 | unsigned long mp_lapic_addr; | 161 | unsigned long mp_lapic_addr; |
192 | int disable_apic; | 162 | int 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 */ | ||
1478 | static bool nox2apic __initdata; | ||
1479 | |||
1507 | #ifdef CONFIG_X86_X2APIC | 1480 | #ifdef CONFIG_X86_X2APIC |
1481 | int x2apic_mode; | ||
1482 | /* x2apic enabled before OS handover */ | ||
1483 | int x2apic_preenabled; | ||
1484 | static int x2apic_disabled; | ||
1485 | static 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 | } | ||
1504 | early_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 | */ |