From bb5d5261dc337a3022ce0336412a2630b4f7ff99 Mon Sep 17 00:00:00 2001 From: Wenhui Fan Date: Fri, 17 Apr 2026 15:43:45 +0800 Subject: [PATCH] anolis: x86/cpu/hygon: Fix node ID overflow for Hygon models 0x4-0x8 ANBZ: #33321 Node ID will overflow when both NUMA and SMT are turned off in BIOS setup on Hygon platform, this cause kernel panic when system boot. Fix the node id calculation according to the scenario describe above. Hygon-SIG: commit none hygon anolis: Fix node ID overflow for Hygon models 0x4-0x8 Signed-off-by: Wenhui Fan --- arch/x86/kernel/cpu/hygon.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/arch/x86/kernel/cpu/hygon.c b/arch/x86/kernel/cpu/hygon.c index a4d667ef2068..19e03380ffda 100644 --- a/arch/x86/kernel/cpu/hygon.c +++ b/arch/x86/kernel/cpu/hygon.c @@ -54,8 +54,15 @@ static void srat_detect_node(struct cpuinfo_x86 *c) unsigned int apicid = c->topo.apicid; node = numa_cpu_node(cpu); - if (node == NUMA_NO_NODE) - node = c->topo.llc_id; + if (node == NUMA_NO_NODE) { + if (c->x86_model >= 0x4 && c->x86_model <= 0x8) { + node = cpu_to_node(cpu); + numa_set_node(cpu, node); + return; + } else { + node = c->topo.llc_id; + } + } /* * On multi-fabric platform (e.g. Numascale NumaChip) a -- Gitee