diff options
author | Yinghai Lu <yhlu.kernel@gmail.com> | 2008-08-24 05:01:47 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-10-16 10:53:01 -0400 |
commit | 49899eacce79ce39faf531dad3e00f771eba2eb1 (patch) | |
tree | 288951ef512ef7e5e100a14aa72933e2c7c9383d /arch/x86/kernel/apic_64.c | |
parent | b3c5117050e8028d48b2fa0ea09c7a50dd7f3414 (diff) |
x86: use HAVE_X2APIC in apic_64.c
Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86/kernel/apic_64.c')
-rw-r--r-- | arch/x86/kernel/apic_64.c | 35 |
1 files changed, 23 insertions, 12 deletions
diff --git a/arch/x86/kernel/apic_64.c b/arch/x86/kernel/apic_64.c index c40a900e155b..d3ec746aede4 100644 --- a/arch/x86/kernel/apic_64.c +++ b/arch/x86/kernel/apic_64.c | |||
@@ -82,10 +82,23 @@ static __init int setup_apicpmtimer(char *s) | |||
82 | __setup("apicpmtimer", setup_apicpmtimer); | 82 | __setup("apicpmtimer", setup_apicpmtimer); |
83 | #endif | 83 | #endif |
84 | 84 | ||
85 | int disable_x2apic; | 85 | #ifdef CONFIG_X86_64 |
86 | #define HAVE_X2APIC | ||
87 | #endif | ||
88 | |||
89 | #ifdef HAVE_X2APIC | ||
86 | int x2apic; | 90 | int x2apic; |
87 | /* x2apic enabled before OS handover */ | 91 | /* x2apic enabled before OS handover */ |
88 | int x2apic_preenabled; | 92 | int x2apic_preenabled; |
93 | int disable_x2apic; | ||
94 | static __init int setup_nox2apic(char *str) | ||
95 | { | ||
96 | disable_x2apic = 1; | ||
97 | setup_clear_cpu_cap(X86_FEATURE_X2APIC); | ||
98 | return 0; | ||
99 | } | ||
100 | early_param("nox2apic", setup_nox2apic); | ||
101 | #endif | ||
89 | 102 | ||
90 | unsigned long mp_lapic_addr; | 103 | unsigned long mp_lapic_addr; |
91 | int disable_apic; | 104 | int disable_apic; |
@@ -228,6 +241,7 @@ static struct apic_ops xapic_ops = { | |||
228 | struct apic_ops __read_mostly *apic_ops = &xapic_ops; | 241 | struct apic_ops __read_mostly *apic_ops = &xapic_ops; |
229 | EXPORT_SYMBOL_GPL(apic_ops); | 242 | EXPORT_SYMBOL_GPL(apic_ops); |
230 | 243 | ||
244 | #ifdef HAVE_X2APIC | ||
231 | static void x2apic_wait_icr_idle(void) | 245 | static void x2apic_wait_icr_idle(void) |
232 | { | 246 | { |
233 | /* no need to wait for icr idle in x2apic */ | 247 | /* no need to wait for icr idle in x2apic */ |
@@ -261,6 +275,7 @@ static struct apic_ops x2apic_ops = { | |||
261 | .wait_icr_idle = x2apic_wait_icr_idle, | 275 | .wait_icr_idle = x2apic_wait_icr_idle, |
262 | .safe_wait_icr_idle = safe_x2apic_wait_icr_idle, | 276 | .safe_wait_icr_idle = safe_x2apic_wait_icr_idle, |
263 | }; | 277 | }; |
278 | #endif | ||
264 | 279 | ||
265 | /** | 280 | /** |
266 | * enable_NMI_through_LVT0 - enable NMI through local vector table 0 | 281 | * enable_NMI_through_LVT0 - enable NMI through local vector table 0 |
@@ -1125,6 +1140,7 @@ void __cpuinit end_local_APIC_setup(void) | |||
1125 | apic_pm_activate(); | 1140 | apic_pm_activate(); |
1126 | } | 1141 | } |
1127 | 1142 | ||
1143 | #ifdef HAVE_X2APIC | ||
1128 | void check_x2apic(void) | 1144 | void check_x2apic(void) |
1129 | { | 1145 | { |
1130 | int msr, msr2; | 1146 | int msr, msr2; |
@@ -1243,6 +1259,7 @@ end: | |||
1243 | 1259 | ||
1244 | return; | 1260 | return; |
1245 | } | 1261 | } |
1262 | #endif /* HAVE_X2APIC */ | ||
1246 | 1263 | ||
1247 | /* | 1264 | /* |
1248 | * Detect and enable local APICs on non-SMP boards. | 1265 | * Detect and enable local APICs on non-SMP boards. |
@@ -1291,10 +1308,12 @@ void __init early_init_lapic_mapping(void) | |||
1291 | */ | 1308 | */ |
1292 | void __init init_apic_mappings(void) | 1309 | void __init init_apic_mappings(void) |
1293 | { | 1310 | { |
1311 | #ifdef HAVE_X2APIC | ||
1294 | if (x2apic) { | 1312 | if (x2apic) { |
1295 | boot_cpu_physical_apicid = read_apic_id(); | 1313 | boot_cpu_physical_apicid = read_apic_id(); |
1296 | return; | 1314 | return; |
1297 | } | 1315 | } |
1316 | #endif | ||
1298 | 1317 | ||
1299 | /* | 1318 | /* |
1300 | * If no local APIC can be found then set up a fake all | 1319 | * If no local APIC can be found then set up a fake all |
@@ -1335,8 +1354,9 @@ int __init APIC_init_uniprocessor(void) | |||
1335 | printk(KERN_INFO "Apic disabled by BIOS\n"); | 1354 | printk(KERN_INFO "Apic disabled by BIOS\n"); |
1336 | return -1; | 1355 | return -1; |
1337 | } | 1356 | } |
1338 | 1357 | #ifdef HAVE_X2APIC | |
1339 | enable_IR_x2apic(); | 1358 | enable_IR_x2apic(); |
1359 | #endif | ||
1340 | setup_apic_routing(); | 1360 | setup_apic_routing(); |
1341 | 1361 | ||
1342 | verify_local_APIC(); | 1362 | verify_local_APIC(); |
@@ -1672,7 +1692,7 @@ static int lapic_resume(struct sys_device *dev) | |||
1672 | 1692 | ||
1673 | local_irq_save(flags); | 1693 | local_irq_save(flags); |
1674 | 1694 | ||
1675 | #ifdef CONFIG_X86_64 | 1695 | #ifdef HAVE_X2APIC |
1676 | if (x2apic) | 1696 | if (x2apic) |
1677 | enable_x2apic(); | 1697 | enable_x2apic(); |
1678 | else | 1698 | else |
@@ -1836,15 +1856,6 @@ __cpuinit int apic_is_clustered_box(void) | |||
1836 | return (clusters > 2); | 1856 | return (clusters > 2); |
1837 | } | 1857 | } |
1838 | 1858 | ||
1839 | static __init int setup_nox2apic(char *str) | ||
1840 | { | ||
1841 | disable_x2apic = 1; | ||
1842 | clear_cpu_cap(&boot_cpu_data, X86_FEATURE_X2APIC); | ||
1843 | return 0; | ||
1844 | } | ||
1845 | early_param("nox2apic", setup_nox2apic); | ||
1846 | |||
1847 | |||
1848 | /* | 1859 | /* |
1849 | * APIC command line parameters | 1860 | * APIC command line parameters |
1850 | */ | 1861 | */ |