Skip to content

Commit baf4273

Browse files
committed
x86: add support for AMD family 17h
Signed-off-by: Brice Goglin <[email protected]>
1 parent 6b3361f commit baf4273

File tree

1 file changed

+16
-8
lines changed

1 file changed

+16
-8
lines changed

hwloc/topology-x86.c

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,7 @@ static void look_proc(struct hwloc_backend *backend, struct procinfo *infos, uns
357357
* (AMD topology extension)
358358
*/
359359
if (cpuid_type != intel && has_topoext(features)) {
360-
unsigned apic_id, node_id, nodes_per_proc, unit_id, cores_per_unit;
360+
unsigned apic_id, node_id, nodes_per_proc;
361361

362362
eax = 0x8000001e;
363363
cpuid_or_from_dump(&eax, &ebx, &ecx, &edx, src_cpuiddump);
@@ -377,13 +377,21 @@ static void look_proc(struct hwloc_backend *backend, struct procinfo *infos, uns
377377
hwloc_debug("warning: undefined nodes_per_proc value %d, assuming it means %d\n", nodes_per_proc, nodes_per_proc);
378378
}
379379

380-
infos->unitid = unit_id = ebx & 0xff;
381-
cores_per_unit = ((ebx >> 8) & 0xff) + 1;
382-
hwloc_debug("topoext %08x, %d nodes, node %d, %d cores in unit %d\n", apic_id, nodes_per_proc, node_id, cores_per_unit, unit_id);
383-
/* coreid and unitid are package-wide (core 0-15 and unit 0-7 on 16-core 2-NUMAnode processor).
384-
* The Linux kernel reduces theses to NUMA-node-wide (by applying %core_per_node and %unit_per node respectively).
385-
* It's not clear if we should do this as well.
386-
*/
380+
if (infos->cpufamilynumber <= 0x16) { /* topoext appeared in 0x15 and compute-units were only used in 0x15 and 0x16 */
381+
unsigned unit_id, cores_per_unit;
382+
infos->unitid = unit_id = ebx & 0xff;
383+
cores_per_unit = ((ebx >> 8) & 0xff) + 1;
384+
hwloc_debug("topoext %08x, %d nodes, node %d, %d cores in unit %d\n", apic_id, nodes_per_proc, node_id, cores_per_unit, unit_id);
385+
/* coreid and unitid are package-wide (core 0-15 and unit 0-7 on 16-core 2-NUMAnode processor).
386+
* The Linux kernel reduces theses to NUMA-node-wide (by applying %core_per_node and %unit_per node respectively).
387+
* It's not clear if we should do this as well.
388+
*/
389+
} else {
390+
unsigned core_id, threads_per_core;
391+
infos->coreid = core_id = ebx & 0xff;
392+
threads_per_core = ((ebx >> 8) & 0xff) + 1;
393+
hwloc_debug("topoext %08x, %d nodes, node %d, %d threads in core %d\n", apic_id, nodes_per_proc, node_id, threads_per_core, core_id);
394+
}
387395

388396
for (cachenum = 0; ; cachenum++) {
389397
eax = 0x8000001d;

0 commit comments

Comments
 (0)