
hulk inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/ICNW85 CVE: NA ---------------------------------------------------------------------- This patch addresses two issues related to the SPE (Statistical Profiling Extension) boost feature: 1. The SPE boost feature was being enabled on supporting hardware even when the 'enable_mm_spe_boost' command line parameter wasn't passed. This violates the explicit opt-in design and may cause unintended performance impacts. 2. During continuation scenarios, the SPE boost feature register wasn't being properly reset, which could lead to the feature remaining active when it shouldn't be. The fix ensures: - SPE boost is only enabled when explicitly requested via cmdline - The feature register is properly reset during continuation Fixes: b963a30f4ded ("arm-spe: Add kernel cmdline option to enable SPE boost") Signed-off-by: Ze Zuo <zuoze1@huawei.com> --- drivers/arm/mm_monitor/mm_spe.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/arm/mm_monitor/mm_spe.c b/drivers/arm/mm_monitor/mm_spe.c index 192f1f9c6adb..3bdece2ccee4 100644 --- a/drivers/arm/mm_monitor/mm_spe.c +++ b/drivers/arm/mm_monitor/mm_spe.c @@ -332,7 +332,7 @@ int mm_spe_start(void) isb(); write_sysreg_s(reg, SYS_PMSCR_EL1); - if (spe->support_boost_spe) { + if (spe->support_boost_spe && mm_spe_boost_enable) { reg = arm_spe_to_htpg(); isb(); write_sysreg_s(reg, SYS_OMHTPG_EL1); @@ -345,6 +345,12 @@ void mm_spe_continue(void) { int reg; + if (spe->support_boost_spe && mm_spe_boost_enable) { + reg = arm_spe_to_htpg(); + isb(); + write_sysreg_s(reg, SYS_OMHTPG_EL1); + } + mm_spe_buffer_init(); reg = mm_spe_to_pmscr(); @@ -445,7 +451,7 @@ static void mm_spe_sample_para_init(void) spe->min_latency = 120; - if (spe->support_boost_spe) + if (spe->support_boost_spe && mm_spe_boost_enable) arm_spe_boost_spe_para_init(); } -- 2.25.1