mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Amit Singh Tomar <amitsinght@marvell.com>
To: <linux-kernel@vger.kernel.org>, <linux-arm-kernel@lists.infradead.org>
Cc: <fenghua.yu@intel.com>, <reinette.chatre@intel.com>,
	<james.morse@arm.com>, <gcherian@marvell.com>, <robh@kernel.org>,
	<peternewman@google.com>,
	Amit Singh Tomar <amitsinght@marvell.com>
Subject: [RFC 10/12] arm_mpam: resctrl: Facilitate writing downstream priority value
Date: Tue, 15 Aug 2023 20:57:10 +0530	[thread overview]
Message-ID: <20230815152712.1760046-11-amitsinght@marvell.com> (raw)
In-Reply-To: <20230815152712.1760046-1-amitsinght@marvell.com>

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@marvell.com>
---
 drivers/platform/mpam/mpam_devices.c |  4 ----
 drivers/platform/mpam/mpam_resctrl.c | 27 +++++++++++++++++----------
 2 files changed, 17 insertions(+), 14 deletions(-)

diff --git a/drivers/platform/mpam/mpam_devices.c b/drivers/platform/mpam/mpam_devices.c
index 137cbff925ba..c0c83c04c77c 100644
--- a/drivers/platform/mpam/mpam_devices.c
+++ b/drivers/platform/mpam/mpam_devices.c
@@ -2351,10 +2351,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 dc710c90cfc2..ffd0fa84d37d 100644
--- a/drivers/platform/mpam/mpam_resctrl.c
+++ b/drivers/platform/mpam/mpam_resctrl.c
@@ -919,7 +919,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;
@@ -934,6 +934,7 @@ 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;
 
@@ -941,17 +942,22 @@ int resctrl_arch_update_one(struct rdt_resource *r, struct rdt_domain *d,
 	case RDT_RESOURCE_L2:
 	case RDT_RESOURCE_L3:
 		/* TODO: Scaling is not yet supported */
-		cfg.cpbm = cfg_val;
-		mpam_set_feature(mpam_feat_cpor_part, &cfg);
+		if (r->dspri_store) {
+			cfg->dspri = cfg_val;
+			mpam_set_feature(mpam_feat_dspri_part, cfg);
+		} else {
+			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;
@@ -965,15 +971,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);
 	}
 }
 
@@ -998,6 +1004,7 @@ int resctrl_arch_update_domains(struct rdt_resource *r, u32 closid)
 						      cfg->new_ctrl);
 			if (err)
 				return err;
+			cfg->have_new_ctrl = false;
 		}
 	}
 
-- 
2.25.1


  parent reply	other threads:[~2023-08-15 15:29 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-15 15:27 [RFC 00/12] ARM: MPAM: add support for priority partitioning control Amit Singh Tomar
2023-08-15 15:27 ` [RFC 01/12] arm_mpam: Handle resource instances mapped to different controls Amit Singh Tomar
2023-09-01 12:39   ` Jonathan Cameron
2023-08-15 15:27 ` [RFC 02/12] arm_mpam: resctrl: Detect priority partitioning capability Amit Singh Tomar
2023-09-01 12:30   ` Jonathan Cameron
2023-08-15 15:27 ` [RFC 03/12] arm_mpam: resctrl: Define new schemata format for priority partition Amit Singh Tomar
2023-08-15 15:27 ` [RFC 04/12] fs/resctrl: Obtain CPBM upon priority partition presence Amit Singh Tomar
2023-08-15 15:27 ` [RFC 05/12] fs/resctrl: Set-up downstream priority partition resources Amit Singh Tomar
2023-08-17 17:39   ` Fenghua Yu
2023-08-15 15:27 ` [RFC 06/12] fs/resctrl: Extend schemata read for priority partition control Amit Singh Tomar
2023-08-17 17:42   ` Fenghua Yu
2023-08-15 15:27 ` [RFC 07/12] arm_mpam: resctrl: Retrieve priority values from arch code Amit Singh Tomar
2023-08-15 15:27 ` [RFC 08/12] fs/resctrl: Schemata write only for intended resource Amit Singh Tomar
2023-08-15 15:27 ` [RFC 09/12] fs/resctrl: Extend schemata write for priority partition control Amit Singh Tomar
2023-08-17 17:27   ` Fenghua Yu
2023-08-17 17:53   ` Fenghua Yu
2023-08-15 15:27 ` Amit Singh Tomar [this message]
2023-08-15 15:27 ` [RFC 11/12] arm_mpam: Fix Downstream priority mask Amit Singh Tomar
2023-09-01 13:32   ` Jonathan Cameron
2023-08-15 15:27 ` [RFC 12/12] arm_mpam: Program Downstream priority value Amit Singh Tomar
2023-09-01 13:17   ` Jonathan Cameron
2023-08-17 19:11 ` [RFC 00/12] ARM: MPAM: add support for priority partitioning control Reinette Chatre
2023-08-17 20:29   ` Reinette Chatre
2023-08-22 12:44   ` [EXT] " Amit Singh Tomar
2023-08-23 19:06     ` Reinette Chatre
2023-08-23 21:33       ` Amit Singh Tomar
2023-08-23 22:20         ` Reinette Chatre
2023-08-23 22:36           ` Luck, Tony
2023-08-24  8:52           ` Amit Singh Tomar
2023-08-24 15:30             ` Luck, Tony
2023-08-24 18:00             ` Reinette Chatre
2024-01-11 20:56             ` Peter Newman
2024-01-11 21:40               ` Tony Luck
2024-01-11 22:01                 ` Reinette Chatre
2024-01-11 23:14                   ` Luck, Tony
2024-01-11 23:31                     ` Reinette Chatre
2023-08-22  9:01 ` Peter Newman
2023-09-01 14:42 ` Jonathan Cameron
2023-09-01 15:04 ` Jonathan Cameron

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230815152712.1760046-11-amitsinght@marvell.com \
    --to=amitsinght@marvell.com \
    --cc=fenghua.yu@intel.com \
    --cc=gcherian@marvell.com \
    --cc=james.morse@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peternewman@google.com \
    --cc=reinette.chatre@intel.com \
    --cc=robh@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®