diff options
Diffstat (limited to 'arch/i386/kernel/smpboot.c')
-rw-r--r-- | arch/i386/kernel/smpboot.c | 72 |
1 files changed, 20 insertions, 52 deletions
diff --git a/arch/i386/kernel/smpboot.c b/arch/i386/kernel/smpboot.c index 1fb26d0e30b6..5a2bbe0c4fff 100644 --- a/arch/i386/kernel/smpboot.c +++ b/arch/i386/kernel/smpboot.c | |||
@@ -87,7 +87,11 @@ EXPORT_SYMBOL(cpu_online_map); | |||
87 | cpumask_t cpu_callin_map; | 87 | cpumask_t cpu_callin_map; |
88 | cpumask_t cpu_callout_map; | 88 | cpumask_t cpu_callout_map; |
89 | EXPORT_SYMBOL(cpu_callout_map); | 89 | EXPORT_SYMBOL(cpu_callout_map); |
90 | #ifdef CONFIG_HOTPLUG_CPU | ||
91 | cpumask_t cpu_possible_map = CPU_MASK_ALL; | ||
92 | #else | ||
90 | cpumask_t cpu_possible_map; | 93 | cpumask_t cpu_possible_map; |
94 | #endif | ||
91 | EXPORT_SYMBOL(cpu_possible_map); | 95 | EXPORT_SYMBOL(cpu_possible_map); |
92 | static cpumask_t smp_commenced_mask; | 96 | static cpumask_t smp_commenced_mask; |
93 | 97 | ||
@@ -1074,6 +1078,16 @@ void *xquad_portio; | |||
1074 | EXPORT_SYMBOL(xquad_portio); | 1078 | EXPORT_SYMBOL(xquad_portio); |
1075 | #endif | 1079 | #endif |
1076 | 1080 | ||
1081 | /* | ||
1082 | * Fall back to non SMP mode after errors. | ||
1083 | * | ||
1084 | */ | ||
1085 | static __init void disable_smp(void) | ||
1086 | { | ||
1087 | cpu_set(0, cpu_sibling_map[0]); | ||
1088 | cpu_set(0, cpu_core_map[0]); | ||
1089 | } | ||
1090 | |||
1077 | static void __init smp_boot_cpus(unsigned int max_cpus) | 1091 | static void __init smp_boot_cpus(unsigned int max_cpus) |
1078 | { | 1092 | { |
1079 | int apicid, cpu, bit, kicked; | 1093 | int apicid, cpu, bit, kicked; |
@@ -1086,7 +1100,6 @@ static void __init smp_boot_cpus(unsigned int max_cpus) | |||
1086 | printk("CPU%d: ", 0); | 1100 | printk("CPU%d: ", 0); |
1087 | print_cpu_info(&cpu_data[0]); | 1101 | print_cpu_info(&cpu_data[0]); |
1088 | 1102 | ||
1089 | boot_cpu_physical_apicid = GET_APIC_ID(apic_read(APIC_ID)); | ||
1090 | boot_cpu_logical_apicid = logical_smp_processor_id(); | 1103 | boot_cpu_logical_apicid = logical_smp_processor_id(); |
1091 | x86_cpu_to_apicid[0] = boot_cpu_physical_apicid; | 1104 | x86_cpu_to_apicid[0] = boot_cpu_physical_apicid; |
1092 | 1105 | ||
@@ -1098,68 +1111,27 @@ static void __init smp_boot_cpus(unsigned int max_cpus) | |||
1098 | cpus_clear(cpu_core_map[0]); | 1111 | cpus_clear(cpu_core_map[0]); |
1099 | cpu_set(0, cpu_core_map[0]); | 1112 | cpu_set(0, cpu_core_map[0]); |
1100 | 1113 | ||
1114 | map_cpu_to_logical_apicid(); | ||
1115 | |||
1101 | /* | 1116 | /* |
1102 | * If we couldn't find an SMP configuration at boot time, | 1117 | * If we couldn't find an SMP configuration at boot time, |
1103 | * get out of here now! | 1118 | * get out of here now! |
1104 | */ | 1119 | */ |
1105 | if (!smp_found_config && !acpi_lapic) { | 1120 | if (!smp_found_config && !acpi_lapic) { |
1106 | printk(KERN_NOTICE "SMP motherboard not detected.\n"); | 1121 | printk(KERN_NOTICE "SMP motherboard not detected.\n"); |
1107 | smpboot_clear_io_apic_irqs(); | 1122 | disable_smp(); |
1108 | phys_cpu_present_map = physid_mask_of_physid(0); | ||
1109 | if (APIC_init_uniprocessor()) | ||
1110 | printk(KERN_NOTICE "Local APIC not detected." | ||
1111 | " Using dummy APIC emulation.\n"); | ||
1112 | map_cpu_to_logical_apicid(); | ||
1113 | cpu_set(0, cpu_sibling_map[0]); | ||
1114 | cpu_set(0, cpu_core_map[0]); | ||
1115 | return; | 1123 | return; |
1116 | } | 1124 | } |
1117 | 1125 | ||
1118 | /* | 1126 | /* |
1119 | * Should not be necessary because the MP table should list the boot | ||
1120 | * CPU too, but we do it for the sake of robustness anyway. | ||
1121 | * Makes no sense to do this check in clustered apic mode, so skip it | ||
1122 | */ | ||
1123 | if (!check_phys_apicid_present(boot_cpu_physical_apicid)) { | ||
1124 | printk("weird, boot CPU (#%d) not listed by the BIOS.\n", | ||
1125 | boot_cpu_physical_apicid); | ||
1126 | physid_set(hard_smp_processor_id(), phys_cpu_present_map); | ||
1127 | } | ||
1128 | |||
1129 | /* | ||
1130 | * If we couldn't find a local APIC, then get out of here now! | ||
1131 | */ | ||
1132 | if (APIC_INTEGRATED(apic_version[boot_cpu_physical_apicid]) && !cpu_has_apic) { | ||
1133 | printk(KERN_ERR "BIOS bug, local APIC #%d not detected!...\n", | ||
1134 | boot_cpu_physical_apicid); | ||
1135 | printk(KERN_ERR "... forcing use of dummy APIC emulation. (tell your hw vendor)\n"); | ||
1136 | smpboot_clear_io_apic_irqs(); | ||
1137 | phys_cpu_present_map = physid_mask_of_physid(0); | ||
1138 | cpu_set(0, cpu_sibling_map[0]); | ||
1139 | cpu_set(0, cpu_core_map[0]); | ||
1140 | return; | ||
1141 | } | ||
1142 | |||
1143 | verify_local_APIC(); | ||
1144 | |||
1145 | /* | ||
1146 | * If SMP should be disabled, then really disable it! | 1127 | * If SMP should be disabled, then really disable it! |
1147 | */ | 1128 | */ |
1148 | if (!max_cpus) { | 1129 | if (!max_cpus || (enable_local_apic < 0)) { |
1149 | smp_found_config = 0; | 1130 | printk(KERN_INFO "SMP mode deactivated.\n"); |
1150 | printk(KERN_INFO "SMP mode deactivated, forcing use of dummy APIC emulation.\n"); | 1131 | disable_smp(); |
1151 | smpboot_clear_io_apic_irqs(); | ||
1152 | phys_cpu_present_map = physid_mask_of_physid(0); | ||
1153 | cpu_set(0, cpu_sibling_map[0]); | ||
1154 | cpu_set(0, cpu_core_map[0]); | ||
1155 | return; | 1132 | return; |
1156 | } | 1133 | } |
1157 | 1134 | ||
1158 | connect_bsp_APIC(); | ||
1159 | setup_local_APIC(); | ||
1160 | map_cpu_to_logical_apicid(); | ||
1161 | |||
1162 | |||
1163 | setup_portio_remap(); | 1135 | setup_portio_remap(); |
1164 | 1136 | ||
1165 | /* | 1137 | /* |
@@ -1240,10 +1212,6 @@ static void __init smp_boot_cpus(unsigned int max_cpus) | |||
1240 | cpu_set(0, cpu_sibling_map[0]); | 1212 | cpu_set(0, cpu_sibling_map[0]); |
1241 | cpu_set(0, cpu_core_map[0]); | 1213 | cpu_set(0, cpu_core_map[0]); |
1242 | 1214 | ||
1243 | smpboot_setup_io_apic(); | ||
1244 | |||
1245 | setup_boot_APIC_clock(); | ||
1246 | |||
1247 | /* | 1215 | /* |
1248 | * Synchronize the TSC with the AP | 1216 | * Synchronize the TSC with the AP |
1249 | */ | 1217 | */ |