]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
x86/topo: Add topology_num_nodes_per_package()
authorPeter Zijlstra <peterz@infradead.org>
Tue, 3 Mar 2026 10:55:41 +0000 (11:55 +0100)
committerPeter Zijlstra <peterz@infradead.org>
Wed, 4 Mar 2026 15:35:08 +0000 (16:35 +0100)
commitae6730ff42b3a13d94b405edeb5e40108b6d21b6
tree17a87fbab7a69c98ef9c52aa6db4ebb3843591e6
parent48084cc153a5b0fbf0aa98d47670d3be0b9f64d5
x86/topo: Add topology_num_nodes_per_package()

Use the MADT and SRAT table data to compute __num_nodes_per_package.

Specifically, SRAT has already been parsed in x86_numa_init(), which is called
before acpi_boot_init() which parses MADT. So both are available in
topology_init_possible_cpus().

This number is useful to divinate the various Intel CoD/SNC and AMD NPS modes,
since the platforms are failing to provide this otherwise.

Doing it this way is independent of the number of online CPUs and
other such shenanigans.

Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Ingo Molnar <mingo@kernel.org>
Tested-by: Tony Luck <tony.luck@intel.com>
Tested-by: K Prateek Nayak <kprateek.nayak@amd.com>
Tested-by: Zhang Rui <rui.zhang@intel.com>
Tested-by: Chen Yu <yu.c.chen@intel.com>
Tested-by: Kyle Meyer <kyle.meyer@hpe.com>
Link: https://patch.msgid.link/20260303110100.004091624@infradead.org
arch/x86/include/asm/topology.h
arch/x86/kernel/cpu/common.c
arch/x86/kernel/cpu/topology.c