[RFC 12/12] arm_mpam: Program Downstream priority value

From: Amit Singh Tomar
Date: Tue Aug 15 2023 - 11:29:17 EST


Now that Downstream priorities values can be passed from resource control
schemata file, let's program it into memory mapped Priority Partition
Configuration Register.

Signed-off-by: Amit Singh Tomar <amitsinght@xxxxxxxxxxx>
---
TODO:
* Invert Priority value based on DSPRI_0_IS_LOW, suggested
by James.
---
drivers/platform/mpam/mpam_devices.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/platform/mpam/mpam_devices.c b/drivers/platform/mpam/mpam_devices.c
index 59022e42920c..8af6424bb27b 100644
--- a/drivers/platform/mpam/mpam_devices.c
+++ b/drivers/platform/mpam/mpam_devices.c
@@ -1153,8 +1153,12 @@ static void mpam_reprogram_ris_partid(struct mpam_msc_ris *ris, u16 partid,

if (mpam_has_feature(mpam_feat_intpri_part, rprops))
pri_val |= FIELD_PREP(MPAMCFG_PRI_INTPRI, intpri);
- if (mpam_has_feature(mpam_feat_dspri_part, rprops))
- pri_val |= FIELD_PREP(MPAMCFG_PRI_DSPRI, dspri);
+ if (mpam_has_feature(mpam_feat_dspri_part, rprops)) {
+ if (mpam_has_feature(mpam_feat_dspri_part, cfg)) {
+ pri_val |= FIELD_PREP(MPAMCFG_PRI_DSPRI, cfg->dspri & dspri);
+ } else
+ pri_val |= FIELD_PREP(MPAMCFG_PRI_DSPRI, dspri);
+ }

mpam_write_partsel_reg(msc, PRI, pri_val);
}
--
2.25.1