aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2015-01-15 16:22:42 -0500
committerThomas Gleixner <tglx@linutronix.de>2015-01-22 09:10:56 -0500
commit613c25efbdc763ee8b9d732368106d2456279356 (patch)
tree27988534fee5f3180bfb0f5f312747a1cc098f2e /arch/x86/kernel
parent05f7e46d2aac359b6bcfc06b302bdd03ca0bcada (diff)
x86/smpboot: Sanitize uniprocessor init
The UP related setups for local apic are mangled into smp_sanity_check(). That results in duplicate calls to disable_smp() and makes the code hard to follow. Let smp_sanity_check() return dedicated values for the various exit reasons and handle them at the call site. 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/20150115211703.987833932@linutronix.de Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'arch/x86/kernel')
-rw-r--r--arch/x86/kernel/smpboot.c37
1 files changed, 26 insertions, 11 deletions
diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c
index d53870928824..fe8783d500c2 100644
--- a/arch/x86/kernel/smpboot.c
+++ b/arch/x86/kernel/smpboot.c
@@ -990,6 +990,8 @@ void arch_disable_smp_support(void)
990 */ 990 */
991static __init void disable_smp(void) 991static __init void disable_smp(void)
992{ 992{
993 pr_info("SMP disabled\n");
994
993 disable_ioapic_support(); 995 disable_ioapic_support();
994 996
995 init_cpu_present(cpumask_of(0)); 997 init_cpu_present(cpumask_of(0));
@@ -1003,6 +1005,13 @@ static __init void disable_smp(void)
1003 cpumask_set_cpu(0, cpu_core_mask(0)); 1005 cpumask_set_cpu(0, cpu_core_mask(0));
1004} 1006}
1005 1007
1008enum {
1009 SMP_OK,
1010 SMP_NO_CONFIG,
1011 SMP_NO_APIC,
1012 SMP_FORCE_UP,
1013};
1014
1006/* 1015/*
1007 * Various sanity checks. 1016 * Various sanity checks.
1008 */ 1017 */
@@ -1050,10 +1059,7 @@ static int __init smp_sanity_check(unsigned max_cpus)
1050 if (!smp_found_config && !acpi_lapic) { 1059 if (!smp_found_config && !acpi_lapic) {
1051 preempt_enable(); 1060 preempt_enable();
1052 pr_notice("SMP motherboard not detected\n"); 1061 pr_notice("SMP motherboard not detected\n");
1053 disable_smp(); 1062 return SMP_NO_CONFIG;
1054 if (APIC_init_uniprocessor())
1055 pr_notice("Local APIC not detected. Using dummy APIC emulation.\n");
1056 return -1;
1057 } 1063 }
1058 1064
1059 /* 1065 /*
@@ -1077,7 +1083,7 @@ static int __init smp_sanity_check(unsigned max_cpus)
1077 boot_cpu_physical_apicid); 1083 boot_cpu_physical_apicid);
1078 pr_err("... forcing use of dummy APIC emulation (tell your hw vendor)\n"); 1084 pr_err("... forcing use of dummy APIC emulation (tell your hw vendor)\n");
1079 } 1085 }
1080 return -1; 1086 return SMP_NO_APIC;
1081 } 1087 }
1082 1088
1083 verify_local_APIC(); 1089 verify_local_APIC();
@@ -1087,12 +1093,10 @@ static int __init smp_sanity_check(unsigned max_cpus)
1087 */ 1093 */
1088 if (!max_cpus) { 1094 if (!max_cpus) {
1089 pr_info("SMP mode deactivated\n"); 1095 pr_info("SMP mode deactivated\n");
1090 disable_ioapic_support(); 1096 return SMP_FORCE_UP;
1091 apic_bsp_setup();
1092 return -1;
1093 } 1097 }
1094 1098
1095 return 0; 1099 return SMP_OK;
1096} 1100}
1097 1101
1098static void __init smp_cpu_index_default(void) 1102static void __init smp_cpu_index_default(void)
@@ -1132,10 +1136,21 @@ void __init native_smp_prepare_cpus(unsigned int max_cpus)
1132 } 1136 }
1133 set_cpu_sibling_map(0); 1137 set_cpu_sibling_map(0);
1134 1138
1135 if (smp_sanity_check(max_cpus) < 0) { 1139 switch (smp_sanity_check(max_cpus)) {
1136 pr_info("SMP disabled\n"); 1140 case SMP_NO_CONFIG:
1137 disable_smp(); 1141 disable_smp();
1142 if (APIC_init_uniprocessor())
1143 pr_notice("Local APIC not detected. Using dummy APIC emulation.\n");
1144 return;
1145 case SMP_NO_APIC:
1146 disable_smp();
1147 return;
1148 case SMP_FORCE_UP:
1149 disable_smp();
1150 apic_bsp_setup();
1138 return; 1151 return;
1152 case SMP_OK:
1153 break;
1139 } 1154 }
1140 1155
1141 default_setup_apic_routing(); 1156 default_setup_apic_routing();