diff options
Diffstat (limited to 'arch/x86/kernel/cpu/amd.c')
-rw-r--r-- | arch/x86/kernel/cpu/amd.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c index 6e47e3a916f1..7b76eb67a9b3 100644 --- a/arch/x86/kernel/cpu/amd.c +++ b/arch/x86/kernel/cpu/amd.c | |||
@@ -300,7 +300,6 @@ static int nearby_node(int apicid) | |||
300 | #ifdef CONFIG_SMP | 300 | #ifdef CONFIG_SMP |
301 | static void amd_get_topology(struct cpuinfo_x86 *c) | 301 | static void amd_get_topology(struct cpuinfo_x86 *c) |
302 | { | 302 | { |
303 | u32 cores_per_cu = 1; | ||
304 | u8 node_id; | 303 | u8 node_id; |
305 | int cpu = smp_processor_id(); | 304 | int cpu = smp_processor_id(); |
306 | 305 | ||
@@ -313,8 +312,8 @@ static void amd_get_topology(struct cpuinfo_x86 *c) | |||
313 | 312 | ||
314 | /* get compute unit information */ | 313 | /* get compute unit information */ |
315 | smp_num_siblings = ((ebx >> 8) & 3) + 1; | 314 | smp_num_siblings = ((ebx >> 8) & 3) + 1; |
316 | c->compute_unit_id = ebx & 0xff; | 315 | c->x86_max_cores /= smp_num_siblings; |
317 | cores_per_cu += ((ebx >> 8) & 3); | 316 | c->cpu_core_id = ebx & 0xff; |
318 | } else if (cpu_has(c, X86_FEATURE_NODEID_MSR)) { | 317 | } else if (cpu_has(c, X86_FEATURE_NODEID_MSR)) { |
319 | u64 value; | 318 | u64 value; |
320 | 319 | ||
@@ -325,19 +324,16 @@ static void amd_get_topology(struct cpuinfo_x86 *c) | |||
325 | 324 | ||
326 | /* fixup multi-node processor information */ | 325 | /* fixup multi-node processor information */ |
327 | if (nodes_per_socket > 1) { | 326 | if (nodes_per_socket > 1) { |
328 | u32 cores_per_node; | ||
329 | u32 cus_per_node; | 327 | u32 cus_per_node; |
330 | 328 | ||
331 | set_cpu_cap(c, X86_FEATURE_AMD_DCM); | 329 | set_cpu_cap(c, X86_FEATURE_AMD_DCM); |
332 | cores_per_node = c->x86_max_cores / nodes_per_socket; | 330 | cus_per_node = c->x86_max_cores / nodes_per_socket; |
333 | cus_per_node = cores_per_node / cores_per_cu; | ||
334 | 331 | ||
335 | /* store NodeID, use llc_shared_map to store sibling info */ | 332 | /* store NodeID, use llc_shared_map to store sibling info */ |
336 | per_cpu(cpu_llc_id, cpu) = node_id; | 333 | per_cpu(cpu_llc_id, cpu) = node_id; |
337 | 334 | ||
338 | /* core id has to be in the [0 .. cores_per_node - 1] range */ | 335 | /* core id has to be in the [0 .. cores_per_node - 1] range */ |
339 | c->cpu_core_id %= cores_per_node; | 336 | c->cpu_core_id %= cus_per_node; |
340 | c->compute_unit_id %= cus_per_node; | ||
341 | } | 337 | } |
342 | } | 338 | } |
343 | #endif | 339 | #endif |