[RFC 07/12] arm_mpam: resctrl: Retrieve priority values from arch code
From: Amit Singh Tomar
Date: Tue Aug 15 2023 - 11:29:13 EST
Downstream priority values can be read from the "schemata" file, which is
fetched from mpam_config structure.
This change does the necessary modifications in arch specific code to
facilitate reading priority values.
Signed-off-by: Amit Singh Tomar <amitsinght@xxxxxxxxxxx>
---
drivers/platform/mpam/mpam_internal.h | 1 +
drivers/platform/mpam/mpam_resctrl.c | 11 ++++++++---
2 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/drivers/platform/mpam/mpam_internal.h b/drivers/platform/mpam/mpam_internal.h
index 30e32389d394..45552ae6548b 100644
--- a/drivers/platform/mpam/mpam_internal.h
+++ b/drivers/platform/mpam/mpam_internal.h
@@ -160,6 +160,7 @@ struct mpam_config {
u32 cpbm;
u32 mbw_pbm;
u16 mbw_max;
+ u16 dspri;
};
struct mpam_component
diff --git a/drivers/platform/mpam/mpam_resctrl.c b/drivers/platform/mpam/mpam_resctrl.c
index b491a0f897fd..dc710c90cfc2 100644
--- a/drivers/platform/mpam/mpam_resctrl.c
+++ b/drivers/platform/mpam/mpam_resctrl.c
@@ -864,7 +864,7 @@ u32 resctrl_arch_get_config(struct rdt_resource *r, struct rdt_domain *d,
lockdep_assert_cpus_held();
if (!mpam_is_enabled())
- return r->default_ctrl;
+ return r->dspri_show ? r->dspri_default_ctrl : r->default_ctrl;
res = container_of(r, struct mpam_resctrl_res, resctrl_res);
dom = container_of(d, struct mpam_resctrl_dom, resctrl_dom);
@@ -876,7 +876,10 @@ u32 resctrl_arch_get_config(struct rdt_resource *r, struct rdt_domain *d,
switch (r->rid) {
case RDT_RESOURCE_L2:
case RDT_RESOURCE_L3:
- configured_by = mpam_feat_cpor_part;
+ if (r->dspri_show)
+ configured_by = mpam_feat_dspri_part;
+ else
+ configured_by = mpam_feat_cpor_part;
break;
case RDT_RESOURCE_MBA:
if (mba_class_use_mbw_part(cprops)) {
@@ -893,12 +896,14 @@ u32 resctrl_arch_get_config(struct rdt_resource *r, struct rdt_domain *d,
if (!r->alloc_capable || partid >= resctrl_arch_get_num_closid(r) ||
!mpam_has_feature(configured_by, cfg))
- return r->default_ctrl;
+ return r->dspri_show ? r->dspri_default_ctrl : r->default_ctrl;
switch (configured_by) {
case mpam_feat_cpor_part:
/* TODO: Scaling is not yet supported */
return cfg->cpbm;
+ case mpam_feat_dspri_part:
+ return cfg->dspri;
case mpam_feat_mbw_part:
/* TODO: Scaling is not yet supported */
return mbw_pbm_to_percent(cfg->mbw_pbm, cprops);
--
2.25.1