[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240117141405.3063506-11-amitsinght@marvell.com>
Date: Wed, 17 Jan 2024 19:44:01 +0530
From: Amit Singh Tomar <amitsinght@...vell.com>
To: <linux-kernel@...r.kernel.org>, <linux-arm-kernel@...ts.infradead.org>
CC: <fenghua.yu@...el.com>, <reinette.chatre@...el.com>, <james.morse@....com>,
<gcherian@...vell.com>, <robh@...nel.org>, <peternewman@...gle.com>,
<dfustini@...libre.com>, <jonathan.cameron@...wei.com>,
Amit Singh Tomar <amitsinght@...vell.com>
Subject: [PATCH v1 10/14] arm_mpam: resctrl: Facilitate writing downstream priority value
This change provides a way to write downstream priority value (passed from
schemata file) to arch specific resource control code. The priority value
is stored in mpam_config structure, and eventually gets programmed into
MPAMCFG_PRI register.
Signed-off-by: Amit Singh Tomar <amitsinght@...vell.com>
---
Changes since RFC:
* Schemata write is based on Control type.
---
drivers/platform/mpam/mpam_devices.c | 4 ----
drivers/platform/mpam/mpam_resctrl.c | 26 ++++++++++++++++----------
2 files changed, 16 insertions(+), 14 deletions(-)
diff --git a/drivers/platform/mpam/mpam_devices.c b/drivers/platform/mpam/mpam_devices.c
index 589ff1ef2b6b..3ef9e5d70afc 100644
--- a/drivers/platform/mpam/mpam_devices.c
+++ b/drivers/platform/mpam/mpam_devices.c
@@ -2329,10 +2329,6 @@ int mpam_apply_config(struct mpam_component *comp, u16 partid,
lockdep_assert_cpus_held();
- if (!memcmp(&comp->cfg[partid], cfg, sizeof(*cfg)))
- return 0;
-
- comp->cfg[partid] = *cfg;
arg.comp = comp;
arg.partid = partid;
diff --git a/drivers/platform/mpam/mpam_resctrl.c b/drivers/platform/mpam/mpam_resctrl.c
index 7a797f9bcaed..42602bffba3f 100644
--- a/drivers/platform/mpam/mpam_resctrl.c
+++ b/drivers/platform/mpam/mpam_resctrl.c
@@ -925,7 +925,7 @@ int resctrl_arch_update_one(struct rdt_resource *r, struct rdt_domain *d,
{
int err;
u32 partid;
- struct mpam_config cfg;
+ struct mpam_config *cfg;
struct mpam_props *cprops;
struct mpam_resctrl_res *res;
struct mpam_resctrl_dom *dom;
@@ -940,24 +940,30 @@ int resctrl_arch_update_one(struct rdt_resource *r, struct rdt_domain *d,
cprops = &res->class->props;
partid = resctrl_get_config_index(closid, t);
+ cfg = &dom->comp->cfg[partid];
if (!r->alloc_capable || partid >= resctrl_arch_get_num_closid(r))
return -EINVAL;
switch (r->rid) {
case RDT_RESOURCE_L2:
case RDT_RESOURCE_L3:
+ if (type == SCHEMA_DSPRI) {
+ cfg->dspri = cfg_val;
+ mpam_set_feature(mpam_feat_dspri_part, cfg);
+ } else {
/* TODO: Scaling is not yet supported */
- cfg.cpbm = cfg_val;
- mpam_set_feature(mpam_feat_cpor_part, &cfg);
+ cfg->cpbm = cfg_val;
+ mpam_set_feature(mpam_feat_cpor_part, cfg);
+ }
break;
case RDT_RESOURCE_MBA:
if (mba_class_use_mbw_part(cprops)) {
- cfg.mbw_pbm = percent_to_mbw_pbm(cfg_val, cprops);
- mpam_set_feature(mpam_feat_mbw_part, &cfg);
+ cfg->mbw_pbm = percent_to_mbw_pbm(cfg_val, cprops);
+ mpam_set_feature(mpam_feat_mbw_part, cfg);
break;
} else if (mpam_has_feature(mpam_feat_mbw_max, cprops)) {
- cfg.mbw_max = percent_to_mbw_max(cfg_val, cprops);
- mpam_set_feature(mpam_feat_mbw_max, &cfg);
+ cfg->mbw_max = percent_to_mbw_max(cfg_val, cprops);
+ mpam_set_feature(mpam_feat_mbw_max, cfg);
break;
}
fallthrough;
@@ -971,15 +977,15 @@ int resctrl_arch_update_one(struct rdt_resource *r, struct rdt_domain *d,
*/
if (mpam_resctrl_hide_cdp(r->rid)) {
partid = resctrl_get_config_index(closid, CDP_CODE);
- err = mpam_apply_config(dom->comp, partid, &cfg);
+ err = mpam_apply_config(dom->comp, partid, cfg);
if (err)
return err;
partid = resctrl_get_config_index(closid, CDP_DATA);
- return mpam_apply_config(dom->comp, partid, &cfg);
+ return mpam_apply_config(dom->comp, partid, cfg);
} else {
- return mpam_apply_config(dom->comp, partid, &cfg);
+ return mpam_apply_config(dom->comp, partid, cfg);
}
}
--
2.25.1
Powered by blists - more mailing lists