hulk inclusion category: feature bugzilla: https://atomgit.com/openeuler/kernel/issues/9840 ------------------ The current resctrl_arch_would_mbm_overflow() assumes all HiSilicon CPUs do not require MBM overflow handling, returning false for any ARM_CPU_IMP_HISI implementor. However, HIP13 follows the ARM spec and requires proper overflow detection. This leads to incorrect memory bandwidth measurements on HIP13 systems when the MBM counter wraps around. Fix this by explicitly checking for HIP13 in the HiSilicon branch and returning true to enable overflow handling. Signed-off-by: Zeng Heng <zengheng4@huawei.com> --- drivers/platform/mpam/mpam_devices.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/drivers/platform/mpam/mpam_devices.c b/drivers/platform/mpam/mpam_devices.c index d6e29f4fd710d..7180b253cf978 100644 --- a/drivers/platform/mpam/mpam_devices.c +++ b/drivers/platform/mpam/mpam_devices.c @@ -97,6 +97,11 @@ static const struct midr_range hip12_cpus[] = { { /* sentinel */ } }; +static const struct midr_range hip13_cpus[] = { + MIDR_ALL_VERSIONS(MIDR_HISI_HIP13), + { /* sentinel */ } +}; + static const struct midr_range hisi_cpus[] = { MIDR_ALL_VERSIONS(MIDR_HISI_HIP12), MIDR_ALL_VERSIONS(MIDR_HISI_HIP13), @@ -1018,7 +1023,12 @@ static u64 mpam_msmon_overflow_val(struct mpam_msc_ris *ris) bool resctrl_arch_would_mbm_overflow(void) { - return read_cpuid_implementor() != ARM_CPU_IMP_HISI; + /* Non-HiSilicon CPUs and HIP13 need overflow handling */ + if (read_cpuid_implementor() != ARM_CPU_IMP_HISI) + return true; + + /* HIP13 is the exception among HiSilicon CPUs */ + return is_midr_in_range_list(hip13_cpus); } static bool mpam_ris_has_nrdy_bit(struct mpam_msc_ris *ris) -- 2.43.0