diff options
author | Andreas Herrmann <andreas.herrmann3@amd.com> | 2010-09-30 08:38:57 -0400 |
---|---|---|
committer | H. Peter Anvin <hpa@linux.intel.com> | 2010-10-01 19:18:32 -0400 |
commit | 6057b4d331f19a3ea51aec463ea7839c128b3227 (patch) | |
tree | 0bcf33ac60389ab21781b565aaf5b5e8c0fa60d8 /arch/x86/kernel/cpu/amd.c | |
parent | 23588c38a84c9175c6668789b64ffba4651e5c6a (diff) |
x86, amd: Extract compute unit information for AMD CPUs
Get compute unit information from CPUID Fn8000_001E_EBX.
(See AMD CPUID Specification - publication # 25481, revision 2.34,
September 2010.)
Note that each core on a compute unit still has a core_id of its own.
Signed-off-by: Andreas Herrmann <andreas.herrmann3@amd.com>
LKML-Reference: <20100930123857.GE20545@loge.amd.com>
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Diffstat (limited to 'arch/x86/kernel/cpu/amd.c')
-rw-r--r-- | arch/x86/kernel/cpu/amd.c | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c index 7e6a37d24253..70168ab88b7f 100644 --- a/arch/x86/kernel/cpu/amd.c +++ b/arch/x86/kernel/cpu/amd.c | |||
@@ -256,21 +256,29 @@ static int __cpuinit nearby_node(int apicid) | |||
256 | * Fixup core topology information for | 256 | * Fixup core topology information for |
257 | * (1) AMD multi-node processors | 257 | * (1) AMD multi-node processors |
258 | * Assumption: Number of cores in each internal node is the same. | 258 | * Assumption: Number of cores in each internal node is the same. |
259 | * (2) AMD processors supporting compute units | ||
259 | */ | 260 | */ |
260 | #ifdef CONFIG_X86_HT | 261 | #ifdef CONFIG_X86_HT |
261 | static void __cpuinit amd_get_topology(struct cpuinfo_x86 *c) | 262 | static void __cpuinit amd_get_topology(struct cpuinfo_x86 *c) |
262 | { | 263 | { |
263 | u32 nodes, cores_per_node; | 264 | u32 nodes; |
264 | u8 node_id; | 265 | u8 node_id; |
265 | unsigned long long value; | ||
266 | int cpu = smp_processor_id(); | 266 | int cpu = smp_processor_id(); |
267 | 267 | ||
268 | /* get information required for multi-node processors */ | 268 | /* get information required for multi-node processors */ |
269 | if (cpu_has(c, X86_FEATURE_TOPOEXT)) { | 269 | if (cpu_has(c, X86_FEATURE_TOPOEXT)) { |
270 | value = cpuid_ecx(0x8000001e); | 270 | u32 eax, ebx, ecx, edx; |
271 | nodes = ((value >> 8) & 7) + 1; | 271 | |
272 | node_id = value & 7; | 272 | cpuid(0x8000001e, &eax, &ebx, &ecx, &edx); |
273 | nodes = ((ecx >> 8) & 7) + 1; | ||
274 | node_id = ecx & 7; | ||
275 | |||
276 | /* get compute unit information */ | ||
277 | smp_num_siblings = ((ebx >> 8) & 3) + 1; | ||
278 | c->compute_unit_id = ebx & 0xff; | ||
273 | } else if (cpu_has(c, X86_FEATURE_NODEID_MSR)) { | 279 | } else if (cpu_has(c, X86_FEATURE_NODEID_MSR)) { |
280 | u64 value; | ||
281 | |||
274 | rdmsrl(MSR_FAM10H_NODE_ID, value); | 282 | rdmsrl(MSR_FAM10H_NODE_ID, value); |
275 | nodes = ((value >> 3) & 7) + 1; | 283 | nodes = ((value >> 3) & 7) + 1; |
276 | node_id = value & 7; | 284 | node_id = value & 7; |
@@ -279,6 +287,8 @@ static void __cpuinit amd_get_topology(struct cpuinfo_x86 *c) | |||
279 | 287 | ||
280 | /* fixup multi-node processor information */ | 288 | /* fixup multi-node processor information */ |
281 | if (nodes > 1) { | 289 | if (nodes > 1) { |
290 | u32 cores_per_node; | ||
291 | |||
282 | set_cpu_cap(c, X86_FEATURE_AMD_DCM); | 292 | set_cpu_cap(c, X86_FEATURE_AMD_DCM); |
283 | cores_per_node = c->x86_max_cores / nodes; | 293 | cores_per_node = c->x86_max_cores / nodes; |
284 | 294 | ||