aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
Diffstat (limited to 'arch')
-rw-r--r--arch/i386/kernel/cpu/amd.c7
-rw-r--r--arch/i386/kernel/cpu/common.c7
-rw-r--r--arch/x86_64/kernel/setup.c11
3 files changed, 20 insertions, 5 deletions
diff --git a/arch/i386/kernel/cpu/amd.c b/arch/i386/kernel/cpu/amd.c
index 16dbc4151be4..fa34a06c0d79 100644
--- a/arch/i386/kernel/cpu/amd.c
+++ b/arch/i386/kernel/cpu/amd.c
@@ -24,9 +24,6 @@ __asm__(".align 4\nvide: ret");
24 24
25static void __init init_amd(struct cpuinfo_x86 *c) 25static void __init init_amd(struct cpuinfo_x86 *c)
26{ 26{
27#ifdef CONFIG_X86_SMP
28 int cpu = c == &boot_cpu_data ? 0 : c - cpu_data;
29#endif
30 u32 l, h; 27 u32 l, h;
31 int mbytes = num_physpages >> (20-PAGE_SHIFT); 28 int mbytes = num_physpages >> (20-PAGE_SHIFT);
32 int r; 29 int r;
@@ -205,7 +202,9 @@ static void __init init_amd(struct cpuinfo_x86 *c)
205 * of two. 202 * of two.
206 */ 203 */
207 if (c->x86_num_cores > 1) { 204 if (c->x86_num_cores > 1) {
208 cpu_core_id[cpu] = cpu >> hweight32(c->x86_num_cores - 1); 205 int cpu = smp_processor_id();
206 /* Fix up the APIC ID following AMD specifications. */
207 cpu_core_id[cpu] >>= hweight32(c->x86_num_cores - 1);
209 printk(KERN_INFO "CPU %d(%d) -> Core %d\n", 208 printk(KERN_INFO "CPU %d(%d) -> Core %d\n",
210 cpu, c->x86_num_cores, cpu_core_id[cpu]); 209 cpu, c->x86_num_cores, cpu_core_id[cpu]);
211 } 210 }
diff --git a/arch/i386/kernel/cpu/common.c b/arch/i386/kernel/cpu/common.c
index 6be0310e3cd3..11e6e6f23fa0 100644
--- a/arch/i386/kernel/cpu/common.c
+++ b/arch/i386/kernel/cpu/common.c
@@ -243,6 +243,13 @@ static void __init early_cpu_detect(void)
243 } 243 }
244 244
245 early_intel_workaround(c); 245 early_intel_workaround(c);
246
247#ifdef CONFIG_SMP
248#ifdef CONFIG_X86_HT
249 phys_proc_id[smp_processor_id()] =
250#endif
251 cpu_core_id[smp_processor_id()] = (cpuid_ebx(1) >> 24) & 0xff;
252#endif
246} 253}
247 254
248void __init generic_identify(struct cpuinfo_x86 * c) 255void __init generic_identify(struct cpuinfo_x86 * c)
diff --git a/arch/x86_64/kernel/setup.c b/arch/x86_64/kernel/setup.c
index 2129cf9ba6b2..aab249a57464 100644
--- a/arch/x86_64/kernel/setup.c
+++ b/arch/x86_64/kernel/setup.c
@@ -731,7 +731,8 @@ static void __init amd_detect_cmp(struct cpuinfo_x86 *c)
731 int node = 0; 731 int node = 0;
732 if (c->x86_num_cores == 1) 732 if (c->x86_num_cores == 1)
733 return; 733 return;
734 cpu_core_id[cpu] = cpu >> hweight32(c->x86_num_cores - 1); 734 /* Fix up the APIC ID following the AMD specification. */
735 cpu_core_id[cpu] >>= hweight32(c->x86_num_cores - 1);
735 736
736#ifdef CONFIG_NUMA 737#ifdef CONFIG_NUMA
737 /* When an ACPI SRAT table is available use the mappings from SRAT 738 /* When an ACPI SRAT table is available use the mappings from SRAT
@@ -745,6 +746,9 @@ static void __init amd_detect_cmp(struct cpuinfo_x86 *c)
745 node = cpu_to_node[cpu]; 746 node = cpu_to_node[cpu];
746 } 747 }
747#endif 748#endif
749 /* For now: - better than BAD_APIC_ID at least*/
750 phys_proc_id[cpu] = cpu_core_id[cpu];
751
748 printk(KERN_INFO "CPU %d(%d) -> Node %d -> Core %d\n", 752 printk(KERN_INFO "CPU %d(%d) -> Node %d -> Core %d\n",
749 cpu, c->x86_num_cores, node, cpu_core_id[cpu]); 753 cpu, c->x86_num_cores, node, cpu_core_id[cpu]);
750#endif 754#endif
@@ -959,6 +963,11 @@ void __init early_identify_cpu(struct cpuinfo_x86 *c)
959 /* Have CPUID level 0 only - unheard of */ 963 /* Have CPUID level 0 only - unheard of */
960 c->x86 = 4; 964 c->x86 = 4;
961 } 965 }
966
967#ifdef CONFIG_SMP
968 phys_proc_id[smp_processor_id()] =
969 cpu_core_id[smp_processor_id()] = (cpuid_ebx(1) >> 24) & 0xff;
970#endif
962} 971}
963 972
964/* 973/*