]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
arm_mpam: Fix MPAMCFG_MBW_PBM register setting
authorFenghua Yu <fenghuay@nvidia.com>
Sun, 7 Jun 2026 05:09:25 +0000 (22:09 -0700)
committerWill Deacon <will@kernel.org>
Thu, 16 Jul 2026 13:45:47 +0000 (14:45 +0100)
MPAMCFG_MBW_PBM is written from cfg if cfg has the MBW partition feature.
It is reset when cfg does not have the MBW partition feature.

But the register handling is reversed. This may cause an incorrect
register setting. For example, during an MPAM reset, reset_cfg is
empty (no MBW partition feature set), and cfg->mbw_pbm is 0. Instead of
resetting MPAMCFG_MBW_PBM to all 1's, the current logic will set it to
cfg->mbw_pbm, which is 0.

Fix the issue by swapping the if/else branches.

Fixes: a1cb6577f575 ("arm_mpam: Reset when feature configuration bit unset")
Reported-by: Matt Ochs <mochs@nvidia.com>
Signed-off-by: Fenghua Yu <fenghuay@nvidia.com>
Reviewed-by: Gavin Shan <gshan@redhat.com>
Reviewed-by: Ben Horgan <ben.horgan@arm.com>
Signed-off-by: Will Deacon <will@kernel.org>
drivers/resctrl/mpam_devices.c

index 37ce11d7db92b55247b6a092a1c355d8b96c27d8..8e48b918ae5407661d49c30d07ab12a495969b7d 100644 (file)
@@ -1580,9 +1580,9 @@ static void mpam_reprogram_ris_partid(struct mpam_msc_ris *ris, u16 partid,
 
        if (mpam_has_feature(mpam_feat_mbw_part, rprops)) {
                if (mpam_has_feature(mpam_feat_mbw_part, cfg))
-                       mpam_reset_msc_bitmap(msc, MPAMCFG_MBW_PBM, rprops->mbw_pbm_bits);
-               else
                        mpam_write_partsel_reg(msc, MBW_PBM, cfg->mbw_pbm);
+               else
+                       mpam_reset_msc_bitmap(msc, MPAMCFG_MBW_PBM, rprops->mbw_pbm_bits);
        }
 
        if (mpam_has_feature(mpam_feat_mbw_min, rprops)) {