hulk inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/I8T2RT
--------------------------------
Because MSMON_MBWU_CAPTURE register is implemented in different definition according to the corresponding versions of the protocol. This would affect mbm_total_bytes interface returns the various result.
Consequently, it is necessary to determine the specification definition followed by according to the chip model.
Fixes: 21ac9fc8f275 ("arm_mpam: Track bandwidth counter state for overflow and power management") Signed-off-by: Zeng Heng zengheng4@huawei.com --- drivers/platform/mpam/mpam_devices.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
diff --git a/drivers/platform/mpam/mpam_devices.c b/drivers/platform/mpam/mpam_devices.c index 19bd40814685..719c8d404526 100644 --- a/drivers/platform/mpam/mpam_devices.c +++ b/drivers/platform/mpam/mpam_devices.c @@ -915,6 +915,12 @@ static u64 mpam_msmon_overflow_val(struct mpam_msc_ris *ris) return GENMASK_ULL(30, 0); }
+static const struct midr_range mbwu_flowrate_list[] = { + MIDR_ALL_VERSIONS(MIDR_HISI_TSV110), + MIDR_ALL_VERSIONS(MIDR_HISI_LINXICORE9100), + { /* sentinel */ } +}; + static void __ris_msmon_read(void *arg) { bool nrdy = false; @@ -986,6 +992,18 @@ static void __ris_msmon_read(void *arg) if (!mbwu_state) break;
+ /* + * Following the definition of the DDI0598 version, + * the value field of MPAM Memory Bandwidth Usage Monitor Register + * indicates the memory bandwidth usage in bytes per second, + * instead the scaled count of bytes transferred since the monitor + * was last reset in the latest version (DDI0598D_b). + */ + if (ris->comp->class->type == MPAM_CLASS_MEMORY) { + if (is_midr_in_range_list(read_cpuid_id(), mbwu_flowrate_list)) + break; + } + /* Add any pre-overflow value to the mbwu_state->val */ if (mbwu_state->prev_val > now) overflow_val = mpam_msmon_overflow_val(ris) - mbwu_state->prev_val;