aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86_64
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86_64')
-rw-r--r--arch/x86_64/kernel/setup.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/arch/x86_64/kernel/setup.c b/arch/x86_64/kernel/setup.c
index fb850b52b4da..1cb3e21c571a 100644
--- a/arch/x86_64/kernel/setup.c
+++ b/arch/x86_64/kernel/setup.c
@@ -873,10 +873,18 @@ static void __init amd_detect_cmp(struct cpuinfo_x86 *c)
873 int node = 0; 873 int node = 0;
874 unsigned apicid = hard_smp_processor_id(); 874 unsigned apicid = hard_smp_processor_id();
875#endif 875#endif
876 unsigned ecx = cpuid_ecx(0x80000008);
876 877
877 bits = 0; 878 c->x86_max_cores = (ecx & 0xff) + 1;
878 while ((1 << bits) < c->x86_max_cores) 879
879 bits++; 880 /* CPU telling us the core id bits shift? */
881 bits = (ecx >> 12) & 0xF;
882
883 /* Otherwise recompute */
884 if (bits == 0) {
885 while ((1 << bits) < c->x86_max_cores)
886 bits++;
887 }
880 888
881 /* Low order bits define the core id (index of core in socket) */ 889 /* Low order bits define the core id (index of core in socket) */
882 cpu_core_id[cpu] = phys_proc_id[cpu] & ((1 << bits)-1); 890 cpu_core_id[cpu] = phys_proc_id[cpu] & ((1 << bits)-1);
@@ -964,11 +972,9 @@ static int __init init_amd(struct cpuinfo_x86 *c)
964 if (c->x86_power & (1<<8)) 972 if (c->x86_power & (1<<8))
965 set_bit(X86_FEATURE_CONSTANT_TSC, &c->x86_capability); 973 set_bit(X86_FEATURE_CONSTANT_TSC, &c->x86_capability);
966 974
967 if (c->extended_cpuid_level >= 0x80000008) { 975 /* Multi core CPU? */
968 c->x86_max_cores = (cpuid_ecx(0x80000008) & 0xff) + 1; 976 if (c->extended_cpuid_level >= 0x80000008)
969
970 amd_detect_cmp(c); 977 amd_detect_cmp(c);
971 }
972 978
973 return r; 979 return r;
974} 980}