[PATCH v5 02/10] x86/topology: Export topo_lookup_cpuid() for resctrl use
From: Chen Yu
Date: Wed Jul 01 2026 - 09:59:30 EST
Make topo_lookup_cpuid() accessible outside of topology.c and add its
declaration to asm/apic.h. This is needed by Enhanced RDT (ERDT) to
resolve x2APIC IDs from ACPI tables to logical CPU numbers.
No functional change expected.
Tested-by: Hongyu Ning <hongyu.ning@xxxxxxxxxxxxxxx>
Signed-off-by: Chen Yu <yu.c.chen@xxxxxxxxx>
---
v4->v5:
New patch.
---
arch/x86/include/asm/apic.h | 1 +
arch/x86/kernel/cpu/topology.c | 2 +-
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/arch/x86/include/asm/apic.h b/arch/x86/include/asm/apic.h
index 9cd493d467d4..bb84651b14bd 100644
--- a/arch/x86/include/asm/apic.h
+++ b/arch/x86/include/asm/apic.h
@@ -54,6 +54,7 @@ static inline void x86_32_probe_apic(void) { }
#endif
extern u32 cpuid_to_apicid[];
+int topo_lookup_cpuid(u32 apic_id);
#define CPU_ACPIID_INVALID U32_MAX
diff --git a/arch/x86/kernel/cpu/topology.c b/arch/x86/kernel/cpu/topology.c
index 4913b64ec592..bcee70fb9277 100644
--- a/arch/x86/kernel/cpu/topology.c
+++ b/arch/x86/kernel/cpu/topology.c
@@ -92,7 +92,7 @@ static inline u32 topo_apicid(u32 apicid, enum x86_topology_domains dom)
return apicid & (UINT_MAX << x86_topo_system.dom_shifts[dom - 1]);
}
-static int topo_lookup_cpuid(u32 apic_id)
+int topo_lookup_cpuid(u32 apic_id)
{
int i;
--
2.45.2