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>, <dfustini@baylibre.com>,
	<jonathan.cameron@huawei.com>,
	Amit Singh Tomar <amitsinght@marvell.com>
Subject: [PATCH v1 06/14] arm_mpam: resctrl: Retrieve priority values from arch code
Date: Wed, 17 Jan 2024 19:43:57 +0530	[thread overview]
Message-ID: <20240117141405.3063506-7-amitsinght@marvell.com> (raw)
In-Reply-To: <20240117141405.3063506-1-amitsinght@marvell.com>

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@marvell.com>
---
Changes since RFC:
                * Reworked, To configure DSPRI partition control use
                  control type instead of dspri_show/store flags.
---
 drivers/platform/mpam/mpam_internal.h |  1 +
 drivers/platform/mpam/mpam_resctrl.c  | 23 ++++++++++++++++++-----
 2 files changed, 19 insertions(+), 5 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 4c44d65e6047..0de09e9deee5 100644
--- a/drivers/platform/mpam/mpam_resctrl.c
+++ b/drivers/platform/mpam/mpam_resctrl.c
@@ -860,8 +860,12 @@ 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;
+	if (!mpam_is_enabled()) {
+		if (ctrl_type == SCHEMA_DSPRI)
+			return r->default_dspri_ctrl;
+		else
+			return r->default_ctrl;
+	}
 
 	res = container_of(r, struct mpam_resctrl_res, resctrl_res);
 	dom = container_of(d, struct mpam_resctrl_dom, resctrl_dom);
@@ -873,7 +877,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 (ctrl_type == SCHEMA_DSPRI)
+			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)) {
@@ -889,13 +896,19 @@ 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;
+	    !mpam_has_feature(configured_by, cfg)) {
+		if (ctrl_type == SCHEMA_DSPRI)
+			return r->default_dspri_ctrl;
+		else
+			return 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


  parent reply	other threads:[~2024-01-17 14:14 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-17 14:13 [PATCH v1 00/14] ARM: MPAM: add support for priority partitioning control Amit Singh Tomar
2024-01-17 14:13 ` [PATCH v1 01/14] fs/resctrl: group the resource control types for schemata list Amit Singh Tomar
2024-01-17 19:21   ` Peter Newman
2024-01-17 14:13 ` [PATCH v1 02/14] arm_mpam: resctrl: Detect priority partitioning capability Amit Singh Tomar
2024-01-17 14:13 ` [PATCH v1 03/14] arm_mpam: resctrl: extend the schemata list to support priority partition Amit Singh Tomar
2024-01-17 14:13 ` [PATCH v1 04/14] fs/resctrl: Set-up downstream priority partition resources Amit Singh Tomar
2024-01-17 14:13 ` [PATCH v1 05/14] fs/resctrl: fetch configuration based on control type Amit Singh Tomar
2024-01-17 14:13 ` Amit Singh Tomar [this message]
2024-01-17 14:13 ` [PATCH v1 07/14] fs/resctrl: Schemata write only for intended resource Amit Singh Tomar
2024-01-17 14:13 ` [PATCH v1 08/14] fs/resctrl: Extend schemata write for priority partition control Amit Singh Tomar
2024-01-17 14:14 ` [PATCH v1 09/14] fs/resctrl: set configuration based on Control type Amit Singh Tomar
2024-01-17 14:14 ` [PATCH v1 10/14] arm_mpam: resctrl: Facilitate writing downstream priority value Amit Singh Tomar
2024-01-17 14:14 ` [PATCH v1 11/14] arm_mpam: Fix Downstream and internal priority mask Amit Singh Tomar
2024-01-17 14:14 ` [PATCH v1 12/14] arm_mpam: Program Downstream priority value Amit Singh Tomar
2024-01-17 14:14 ` [PATCH v1 13/14] arm_mpam: Handle resource instances mapped to different controls Amit Singh Tomar
2024-01-17 18:03   ` Peter Newman
2024-01-19 13:01     ` [EXT] " Amit Singh Tomar
2024-01-19 22:05       ` Peter Newman
2024-05-08 13:55         ` Amit Singh Tomar
2024-01-17 14:14 ` [PATCH v1 14/14] arm64/mpam: resctrl: export DSPRI value to info directory Amit Singh Tomar
2024-01-17 23:59 ` [PATCH v1 00/14] ARM: MPAM: add support for priority partitioning control Reinette Chatre

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=20240117141405.3063506-7-amitsinght@marvell.com \
    --to=amitsinght@marvell.com \
    --cc=dfustini@baylibre.com \
    --cc=fenghua.yu@intel.com \
    --cc=gcherian@marvell.com \
    --cc=james.morse@arm.com \
    --cc=jonathan.cameron@huawei.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®