aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/cpu/amd.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86/kernel/cpu/amd.c')
-rw-r--r--arch/x86/kernel/cpu/amd.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c
index 48eaa1b6fc4..58f1b012e1c 100644
--- a/arch/x86/kernel/cpu/amd.c
+++ b/arch/x86/kernel/cpu/amd.c
@@ -261,7 +261,7 @@ static int __cpuinit nearby_node(int apicid)
261#ifdef CONFIG_X86_HT 261#ifdef CONFIG_X86_HT
262static void __cpuinit amd_get_topology(struct cpuinfo_x86 *c) 262static void __cpuinit amd_get_topology(struct cpuinfo_x86 *c)
263{ 263{
264 u32 nodes; 264 u32 nodes, cores_per_cu = 1;
265 u8 node_id; 265 u8 node_id;
266 int cpu = smp_processor_id(); 266 int cpu = smp_processor_id();
267 267
@@ -276,6 +276,7 @@ static void __cpuinit amd_get_topology(struct cpuinfo_x86 *c)
276 /* get compute unit information */ 276 /* get compute unit information */
277 smp_num_siblings = ((ebx >> 8) & 3) + 1; 277 smp_num_siblings = ((ebx >> 8) & 3) + 1;
278 c->compute_unit_id = ebx & 0xff; 278 c->compute_unit_id = ebx & 0xff;
279 cores_per_cu += ((ebx >> 8) & 3);
279 } else if (cpu_has(c, X86_FEATURE_NODEID_MSR)) { 280 } else if (cpu_has(c, X86_FEATURE_NODEID_MSR)) {
280 u64 value; 281 u64 value;
281 282
@@ -288,15 +289,18 @@ static void __cpuinit amd_get_topology(struct cpuinfo_x86 *c)
288 /* fixup multi-node processor information */ 289 /* fixup multi-node processor information */
289 if (nodes > 1) { 290 if (nodes > 1) {
290 u32 cores_per_node; 291 u32 cores_per_node;
292 u32 cus_per_node;
291 293
292 set_cpu_cap(c, X86_FEATURE_AMD_DCM); 294 set_cpu_cap(c, X86_FEATURE_AMD_DCM);
293 cores_per_node = c->x86_max_cores / nodes; 295 cores_per_node = c->x86_max_cores / nodes;
296 cus_per_node = cores_per_node / cores_per_cu;
294 297
295 /* store NodeID, use llc_shared_map to store sibling info */ 298 /* store NodeID, use llc_shared_map to store sibling info */
296 per_cpu(cpu_llc_id, cpu) = node_id; 299 per_cpu(cpu_llc_id, cpu) = node_id;
297 300
298 /* core id to be in range from 0 to (cores_per_node - 1) */ 301 /* core id has to be in the [0 .. cores_per_node - 1] range */
299 c->cpu_core_id = c->cpu_core_id % cores_per_node; 302 c->cpu_core_id %= cores_per_node;
303 c->compute_unit_id %= cus_per_node;
300 } 304 }
301} 305}
302#endif 306#endif