[RFC PATCH 06/10] arm_mpam: Clamp cmax_wd to 16
From: Jinjie Ruan
Date: Thu Oct 22 2026 - 22:54:52 EST
The CMAX_WD field of MPAMF_CCAP_IDR describes the width of a 16-bit
register field, as BWA_WD does, but can report up to 63. The
fixed-point conversion of a CMAX/CMIN value shifts by 16 - wd, so a
width above 16 would shift the wrong way.
Clamp it the same way bwa_wd is clamped.
Signed-off-by: Jinjie Ruan <ruanjinjie@xxxxxxxxxx>
---
drivers/resctrl/mpam_devices.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/resctrl/mpam_devices.c b/drivers/resctrl/mpam_devices.c
index 22169436689a..0bed6c430af7 100644
--- a/drivers/resctrl/mpam_devices.c
+++ b/drivers/resctrl/mpam_devices.c
@@ -803,6 +803,8 @@ static void mpam_ris_hw_probe(struct mpam_msc_ris *ris)
u32 ccap_features = mpam_read_partsel_reg(msc, CCAP_IDR);
props->cmax_wd = FIELD_GET(MPAMF_CCAP_IDR_CMAX_WD, ccap_features);
+ /* As with bwa_wd, the field reports a 16-bit register field */
+ props->cmax_wd = min(props->cmax_wd, 16);
if (props->cmax_wd &&
FIELD_GET(MPAMF_CCAP_IDR_HAS_CMAX_SOFTLIM, ccap_features))
mpam_set_feature(mpam_feat_cmax_softlim, props);
--
2.34.1