aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/setup_64.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86/kernel/setup_64.c')
-rw-r--r--arch/x86/kernel/setup_64.c25
1 files changed, 18 insertions, 7 deletions
diff --git a/arch/x86/kernel/setup_64.c b/arch/x86/kernel/setup_64.c
index cdcba6975226..31322d42eaae 100644
--- a/arch/x86/kernel/setup_64.c
+++ b/arch/x86/kernel/setup_64.c
@@ -302,6 +302,11 @@ void __init setup_arch(char **cmdline_p)
302 302
303 dmi_scan_machine(); 303 dmi_scan_machine();
304 304
305#ifdef CONFIG_SMP
306 /* setup to use the static apicid table during kernel startup */
307 x86_cpu_to_apicid_ptr = (void *)&x86_cpu_to_apicid_init;
308#endif
309
305#ifdef CONFIG_ACPI 310#ifdef CONFIG_ACPI
306 /* 311 /*
307 * Initialize the ACPI boot-time table parser (gets the RSDP and SDT). 312 * Initialize the ACPI boot-time table parser (gets the RSDP and SDT).
@@ -554,7 +559,7 @@ static void __init amd_detect_cmp(struct cpuinfo_x86 *c)
554 but in the same order as the HT nodeids. 559 but in the same order as the HT nodeids.
555 If that doesn't result in a usable node fall back to the 560 If that doesn't result in a usable node fall back to the
556 path for the previous case. */ 561 path for the previous case. */
557 int ht_nodeid = apicid - (cpu_data[0].phys_proc_id << bits); 562 int ht_nodeid = apicid - (cpu_data(0).phys_proc_id << bits);
558 if (ht_nodeid >= 0 && 563 if (ht_nodeid >= 0 &&
559 apicid_to_node[ht_nodeid] != NUMA_NO_NODE) 564 apicid_to_node[ht_nodeid] != NUMA_NO_NODE)
560 node = apicid_to_node[ht_nodeid]; 565 node = apicid_to_node[ht_nodeid];
@@ -878,6 +883,7 @@ void __cpuinit early_identify_cpu(struct cpuinfo_x86 *c)
878 883
879#ifdef CONFIG_SMP 884#ifdef CONFIG_SMP
880 c->phys_proc_id = (cpuid_ebx(1) >> 24) & 0xff; 885 c->phys_proc_id = (cpuid_ebx(1) >> 24) & 0xff;
886 c->cpu_index = 0;
881#endif 887#endif
882} 888}
883 889
@@ -984,6 +990,7 @@ void __cpuinit print_cpu_info(struct cpuinfo_x86 *c)
984static int show_cpuinfo(struct seq_file *m, void *v) 990static int show_cpuinfo(struct seq_file *m, void *v)
985{ 991{
986 struct cpuinfo_x86 *c = v; 992 struct cpuinfo_x86 *c = v;
993 int cpu = 0;
987 994
988 /* 995 /*
989 * These flag bits must match the definitions in <asm/cpufeature.h>. 996 * These flag bits must match the definitions in <asm/cpufeature.h>.
@@ -1062,8 +1069,9 @@ static int show_cpuinfo(struct seq_file *m, void *v)
1062 1069
1063 1070
1064#ifdef CONFIG_SMP 1071#ifdef CONFIG_SMP
1065 if (!cpu_online(c-cpu_data)) 1072 if (!cpu_online(c->cpu_index))
1066 return 0; 1073 return 0;
1074 cpu = c->cpu_index;
1067#endif 1075#endif
1068 1076
1069 seq_printf(m,"processor\t: %u\n" 1077 seq_printf(m,"processor\t: %u\n"
@@ -1071,7 +1079,7 @@ static int show_cpuinfo(struct seq_file *m, void *v)
1071 "cpu family\t: %d\n" 1079 "cpu family\t: %d\n"
1072 "model\t\t: %d\n" 1080 "model\t\t: %d\n"
1073 "model name\t: %s\n", 1081 "model name\t: %s\n",
1074 (unsigned)(c-cpu_data), 1082 (unsigned)cpu,
1075 c->x86_vendor_id[0] ? c->x86_vendor_id : "unknown", 1083 c->x86_vendor_id[0] ? c->x86_vendor_id : "unknown",
1076 c->x86, 1084 c->x86,
1077 (int)c->x86_model, 1085 (int)c->x86_model,
@@ -1083,7 +1091,7 @@ static int show_cpuinfo(struct seq_file *m, void *v)
1083 seq_printf(m, "stepping\t: unknown\n"); 1091 seq_printf(m, "stepping\t: unknown\n");
1084 1092
1085 if (cpu_has(c,X86_FEATURE_TSC)) { 1093 if (cpu_has(c,X86_FEATURE_TSC)) {
1086 unsigned int freq = cpufreq_quick_get((unsigned)(c-cpu_data)); 1094 unsigned int freq = cpufreq_quick_get((unsigned)cpu);
1087 if (!freq) 1095 if (!freq)
1088 freq = cpu_khz; 1096 freq = cpu_khz;
1089 seq_printf(m, "cpu MHz\t\t: %u.%03u\n", 1097 seq_printf(m, "cpu MHz\t\t: %u.%03u\n",
@@ -1096,7 +1104,6 @@ static int show_cpuinfo(struct seq_file *m, void *v)
1096 1104
1097#ifdef CONFIG_SMP 1105#ifdef CONFIG_SMP
1098 if (smp_num_siblings * c->x86_max_cores > 1) { 1106 if (smp_num_siblings * c->x86_max_cores > 1) {
1099 int cpu = c - cpu_data;
1100 seq_printf(m, "physical id\t: %d\n", c->phys_proc_id); 1107 seq_printf(m, "physical id\t: %d\n", c->phys_proc_id);
1101 seq_printf(m, "siblings\t: %d\n", 1108 seq_printf(m, "siblings\t: %d\n",
1102 cpus_weight(per_cpu(cpu_core_map, cpu))); 1109 cpus_weight(per_cpu(cpu_core_map, cpu)));
@@ -1154,12 +1161,16 @@ static int show_cpuinfo(struct seq_file *m, void *v)
1154 1161
1155static void *c_start(struct seq_file *m, loff_t *pos) 1162static void *c_start(struct seq_file *m, loff_t *pos)
1156{ 1163{
1157 return *pos < NR_CPUS ? cpu_data + *pos : NULL; 1164 if (*pos == 0) /* just in case, cpu 0 is not the first */
1165 *pos = first_cpu(cpu_possible_map);
1166 if ((*pos) < NR_CPUS && cpu_possible(*pos))
1167 return &cpu_data(*pos);
1168 return NULL;
1158} 1169}
1159 1170
1160static void *c_next(struct seq_file *m, void *v, loff_t *pos) 1171static void *c_next(struct seq_file *m, void *v, loff_t *pos)
1161{ 1172{
1162 ++*pos; 1173 *pos = next_cpu(*pos, cpu_possible_map);
1163 return c_start(m, pos); 1174 return c_start(m, pos);
1164} 1175}
1165 1176