[PATCH RFC 0/3] riscv: Add explicit die-level CPU topology
From: Troy Mitchell
Date: Sat Sep 19 2026 - 23:18:43 EST
The generic arch_topology model has no die level. Systems with multiple
dies in one package must flatten their clusters or report each die as a
separate package, losing the die or package boundary.
This RFC adds a die ID and sibling mask to arch_topology, parses optional
dieN nodes in DT cpu-map, and exposes die topology through sysfs on RISC-V.
Clusters can be numbered independently within each die.
The RISC-V sysfs behavior is:
- An explicit dieN node supplies a non-negative die ID within its package
and a die sibling mask. RISC-V exposes die_id, die_cpus, and
die_cpus_list.
- A DT without dieN keeps die_id at -1 and creates no die sysfs files.
Package and cluster parsing is unchanged.
- ACPI die discovery is not implemented. The ACPI and fallback paths
also leave die_id at -1 and create no die sysfs files.
The DT parser is shared by arm64 and RISC-V, so both record dieN nodes
internally. Only RISC-V exposes the die sysfs files in this series. If you
think I should enable this for arm64 as well, please let me know.
The sysfs visibility hook defaults to visible on other architectures,
including powerpc configurations that report die_id as -1. Their existing
sysfs behavior is unchanged.
The dieN hierarchy is a proposed extension to the DT cpu-map binding.
This RFC does not include a schema update. I'd like feedback on the
topology model and sysfs interface before sending the binding update.
Does placing dieN between socket and cluster make sense? I'd also
appreciate feedback on keeping unspecified dies at -1 and on the sysfs
visibility hook.
Tested with W=1 builds of the affected objects for RISC-V, arm64, and ARM,
and with a complete RISC-V Image build. On a 32-CPU QEMU virt guest, a DT
describing one package with two dies, four clusters per die, and four
cores per cluster exposed the expected IDs and masks and updated them
across CPU offline/online. The same guest with a legacy DT exposed no die
sysfs files while retaining package and cluster topology.
Signed-off-by: Troy Mitchell <troy.mitchell@xxxxxxxxx>
---
Troy Mitchell (3):
arch_topology: Add a die level to CPU topology
arch_topology: Parse die nodes in /cpu-map
riscv: topology: Expose explicit CPU die topology
arch/riscv/include/asm/topology.h | 4 +++
drivers/base/arch_topology.c | 68 +++++++++++++++++++++++++++++++--------
drivers/base/topology.c | 28 +++++++++++++++-
include/linux/arch_topology.h | 2 ++
include/linux/topology.h | 3 ++
5 files changed, 91 insertions(+), 14 deletions(-)
---
base-commit: cee9395acd8043be0644b25c34bfa86623f2b935
change-id: 20260904-riscv-die-topology-rfc-c009f6e4be92
Best regards,
--
Troy Mitchell <troy.mitchell@xxxxxxxxx>