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

From: Jonathan Cameron
Date: Fri Sep 01 2023 - 09:17:38 EST


On Tue, 15 Aug 2023 20:57:12 +0530
Amit Singh Tomar <amitsinght@xxxxxxxxxxx> wrote:

> 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.

Ah. In testing I just hit this as well as I was expecting the default
to change depending on 0_IS_LOW.



> ---
> 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);

Note that it's not as simple as inverting the value for DSPRI_0_IS_LOW setting being the opposite
as in that case dspri is st to 0 a few lines up... So this always ends up 0.

> + } else
> + pri_val |= FIELD_PREP(MPAMCFG_PRI_DSPRI, dspri);
> + }
>
> mpam_write_partsel_reg(msc, PRI, pri_val);
> }