[RFC][PATCH 2/6] x86/topo: Add TOPO_NUMA_DOMAIN
From: Peter Zijlstra
Date: Thu Feb 26 2026 - 05:58:59 EST
Use the SRAT data to add an extra NUMA domain. Since the SLIT table is
a matrix, the SRAT proximity domain 'must' be a dense set and will not
exceed MAX_LOCAL_APIC.
Signed-off-by: Peter Zijlstra (Intel) <peterz@xxxxxxxxxxxxx>
---
arch/x86/include/asm/topology.h | 3 +++
arch/x86/kernel/cpu/topology.c | 9 +++++++++
2 files changed, 12 insertions(+)
--- a/arch/x86/include/asm/topology.h
+++ b/arch/x86/include/asm/topology.h
@@ -111,6 +111,9 @@ enum x86_topology_domains {
TOPO_DIE_DOMAIN,
TOPO_DIEGRP_DOMAIN,
TOPO_PKG_DOMAIN,
+#ifdef CONFIG_NUMA
+ TOPO_NUMA_DOMAIN,
+#endif
TOPO_MAX_DOMAIN,
};
--- a/arch/x86/kernel/cpu/topology.c
+++ b/arch/x86/kernel/cpu/topology.c
@@ -31,6 +31,7 @@
#include <asm/mpspec.h>
#include <asm/msr.h>
#include <asm/smp.h>
+#include <asm/numa.h>
#include "cpu.h"
@@ -88,6 +89,14 @@ static inline u32 topo_apicid(u32 apicid
{
if (dom == TOPO_SMT_DOMAIN)
return apicid;
+#ifdef CONFIG_NUMA
+ if (dom == TOPO_NUMA_DOMAIN) {
+ int nid = __apicid_to_phys_node[apicid];
+ if (nid == NUMA_NO_NODE)
+ nid = 0;
+ return nid;
+ }
+#endif
return apicid & (UINT_MAX << x86_topo_system.dom_shifts[dom - 1]);
}