[PATCH 1/8] x86/cpu/hygon: Adjust the die_id and logical_die_id for Hygon model 4h~8h
From: Fu Hao
Date: Fri Mar 27 2026 - 04:16:18 EST
The die id should be get from the NodeId field of CPUID leaf 0x8000001e
ecx for Hygon model 4h~8h processors.
Signed-off-by: Fu Hao <fuhao@xxxxxxxxxxxxxx>
---
arch/x86/kernel/cpu/hygon.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/arch/x86/kernel/cpu/hygon.c b/arch/x86/kernel/cpu/hygon.c
index 7f95a74e4..f39d32a68 100644
--- a/arch/x86/kernel/cpu/hygon.c
+++ b/arch/x86/kernel/cpu/hygon.c
@@ -168,6 +168,19 @@ static void early_init_hygon(struct cpuinfo_x86 *c)
set_cpu_cap(c, X86_FEATURE_VMMCALL);
}
+/*
+ * Adjust the die_id and logical_die_id for Hygon model 4h~8h.
+ */
+static void cpu_topology_fixup_hygon(struct cpuinfo_x86 *c)
+{
+ if (c->x86_model >= 0x4 && c->x86_model <= 0x8) {
+ c->topo.die_id = cpuid_ecx(0x8000001e) & 0xff;
+ c->topo.logical_die_id = (c->topo.die_id >> 4) *
+ topology_amd_nodes_per_pkg() +
+ (c->topo.die_id & 0xf);
+ }
+}
+
static void init_hygon(struct cpuinfo_x86 *c)
{
u64 vm_cr;
@@ -191,6 +204,8 @@ static void init_hygon(struct cpuinfo_x86 *c)
init_hygon_cacheinfo(c);
+ cpu_topology_fixup_hygon(c);
+
if (cpu_has(c, X86_FEATURE_SVM)) {
rdmsrq(MSR_VM_CR, vm_cr);
if (vm_cr & SVM_VM_CR_SVM_DIS_MASK) {
--
2.34.1