[PATCH] x86/cpu/hygon: fix missing resctrl_cpu_detect() in bsp_init helper

Tianxiang Peng posted 1 patch 3 months, 3 weeks ago
There is a newer version of this series
arch/x86/kernel/cpu/hygon.c | 3 +++
1 file changed, 3 insertions(+)
[PATCH] x86/cpu/hygon: fix missing resctrl_cpu_detect() in bsp_init helper
Posted by Tianxiang Peng 3 months, 3 weeks ago
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@tencent.com>
Reviewed-by: Hui Li <caelli@tencent.com>
Reviewed-by: Hao Peng <flyingpeng@tencent.com>
---
 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