diff mbox series

[mpam/v6.10-rc1,RFC,2/4] arm_mpam: Fix the range calculation of the implemented bits

Message ID 20240722040121.515021-3-zengheng4@huawei.com (mailing list archive)
State New, archived
Headers show
Series arm_mpam: Fix several minor issues | expand

Commit Message

Zeng Heng July 22, 2024, 4:01 a.m. UTC
The implemented bits of the MAX field in the MPAMCFG_{MBW_MAX, CMAX}
register are always to the left of the field, so the validated range
should be like [15, 15 - width + 1].

Fixes: 867471fefd5c ("SPLIT untested: arm_mpam: resctrl: Add support for MB resource")
Signed-off-by: Zeng Heng <zengheng4@huawei.com>
---
 drivers/platform/arm64/mpam/mpam_resctrl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/drivers/platform/arm64/mpam/mpam_resctrl.c b/drivers/platform/arm64/mpam/mpam_resctrl.c
index a217f2e1f350..e87fca6fc5fd 100644
--- a/drivers/platform/arm64/mpam/mpam_resctrl.c
+++ b/drivers/platform/arm64/mpam/mpam_resctrl.c
@@ -585,7 +585,7 @@  static u16 percent_to_mbw_max(u8 pc, struct mpam_props *cprops)
 			break;
 	}
 
-	value &= GENMASK(15, 15 - cprops->bwa_wd);
+	value &= GENMASK(15, 15 - cprops->bwa_wd + 1);
 
 	return value;
 }