[PATCH] x86/cpu/hygon: fix missing resctrl_cpu_detect() in bsp_init helper
From: Tianxiang Peng
Date: Mon Jun 16 2025 - 06:06:53 EST
Since upstream commit 923f3a2b48bdccb6a1d1f0dd48de03de7ad936d9
("x86/resctrl: Query LLC monitoring properties once during boot"),
resctrl_cpu_detect() has been moved from common cpu initialization
code to vendor-specific bsp init helper, while hygon didn't put
that call in their code.
This triggers div-zero fault during early booting stage on our
machines with X86_FEATURE_CQM* supported, where
get_rdt_mon_resources() tries to calculate mon_l3_config with
uninitialized boot_cpu_data.x86_cache_occ_scale.
Fix the missing resctrl_cpu_detect() in hygon bsp init helper.
Signed-off-by: Tianxiang Peng <txpeng@xxxxxxxxxxx>
Reviewed-by: Hui Li <caelli@xxxxxxxxxxx>
Reviewed-by: Hao Peng <flyingpeng@xxxxxxxxxxx>
---
arch/x86/kernel/cpu/hygon.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/arch/x86/kernel/cpu/hygon.c b/arch/x86/kernel/cpu/hygon.c
index 2154f12766fb..1fda6c3a2b65 100644
--- a/arch/x86/kernel/cpu/hygon.c
+++ b/arch/x86/kernel/cpu/hygon.c
@@ -16,6 +16,7 @@
#include <asm/spec-ctrl.h>
#include <asm/delay.h>
#include <asm/msr.h>
+#include <asm/resctrl.h>
#include "cpu.h"
@@ -117,6 +118,8 @@ static void bsp_init_hygon(struct cpuinfo_x86 *c)
x86_amd_ls_cfg_ssbd_mask = 1ULL << 10;
}
}
+
+ resctrl_cpu_detect(c);
}
static void early_init_hygon(struct cpuinfo_x86 *c)
--
2.43.5