diff mbox series

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

Message ID 20230815152712.1760046-13-amitsinght@marvell.com (mailing list archive)
State New, archived
Headers show
Series ARM: MPAM: add support for priority partitioning control | expand

Commit Message

Amit Singh Tomar Aug. 15, 2023, 3:27 p.m. UTC
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@marvell.com>
---
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(-)

Comments

Jonathan Cameron Sept. 1, 2023, 1:17 p.m. UTC | #1
On Tue, 15 Aug 2023 20:57:12 +0530
Amit Singh Tomar <amitsinght@marvell.com> 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@marvell.com>
> ---
> 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);
>  	}
diff mbox series

Patch

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