hulk inclusion category: feature bugzilla: https://atomgit.com/openeuler/kernel/issues/8421 -------------------------------- Fix the issue where the MSMON_MBWU monitor does not properly update statistics results on certain platforms due to the absence of NRDY bit functionality. On such platforms, when configuring a new partid, the NRDY bit remains 0, causing the monitor to remain 0 or the previous statistics result. For the specified chip vendors, assume the NRDY bit is set on the time configuration update and force the software to re-read the statistics result to ensure accurate data. Signed-off-by: Quanmin Yan <yanquanmin1@huawei.com> --- arch/arm64/kernel/mpam/mpam_device.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/arch/arm64/kernel/mpam/mpam_device.c b/arch/arm64/kernel/mpam/mpam_device.c index cc87e25769b1..4ed99caa8052 100644 --- a/arch/arm64/kernel/mpam/mpam_device.c +++ b/arch/arm64/kernel/mpam/mpam_device.c @@ -1238,8 +1238,16 @@ static u32 mpam_device_read_csu_mon(struct mpam_device *dev, return mpam_read_reg(dev, MSMON_CSU); } +static bool mpam_dev_has_nrdy_bit(struct mpam_device *dev) +{ + if (mpam_has_feature(mpam_feat_msmon_mbwu, dev->features)) + return read_cpuid_implementor() != ARM_CPU_IMP_HISI; + + return true; +} + static u32 mpam_device_read_mbwu_mon(struct mpam_device *dev, - struct sync_args *args) + struct sync_args *args, bool *config_mismatch) { u16 mon; u32 clt, flt, cur_clt, cur_flt; @@ -1282,6 +1290,8 @@ static u32 mpam_device_read_mbwu_mon(struct mpam_device *dev, clt |= MSMON_CFG_CTL_EN; mpam_write_reg(dev, MSMON_CFG_MBWU_CTL, clt); wmb(); + + *config_mismatch = true; } return mpam_read_reg(dev, MSMON_MBWU); @@ -1292,6 +1302,7 @@ static int mpam_device_frob_mon(struct mpam_device *dev, { struct sync_args *args = ctx->args; u32 val; + bool config_mismatch = false; lockdep_assert_held(&dev->lock); @@ -1306,11 +1317,12 @@ static int mpam_device_frob_mon(struct mpam_device *dev, val = mpam_device_read_csu_mon(dev, args); else if (args->eventid == QOS_L3_MBM_LOCAL_EVENT_ID && mpam_has_feature(mpam_feat_msmon_mbwu, dev->features)) - val = mpam_device_read_mbwu_mon(dev, args); + val = mpam_device_read_mbwu_mon(dev, args, &config_mismatch); else return -EOPNOTSUPP; - if (val & MSMON___NRDY) + if (val & MSMON___NRDY || + (config_mismatch && !mpam_dev_has_nrdy_bit(dev))) return -EBUSY; val = val & MSMON___VALUE; -- 2.43.0