* [PATCH mpam mpam/snapshot/v6.14-rc1 0/5] arm_mpam: Introduce the Narrow-PARTID feature for MPAM driver
@ 2025-02-17 3:18 Zeng Heng
2025-02-17 3:18 ` [PATCH mpam mpam/snapshot/v6.14-rc1 1/5] arm_mpam: Introduce the definitions of intPARTID and reqPARTID Zeng Heng
` (4 more replies)
0 siblings, 5 replies; 9+ messages in thread
From: Zeng Heng @ 2025-02-17 3:18 UTC (permalink / raw)
To: Dave.Martin, james.morse
Cc: bobo.shaobowang, linux-kernel, jonathan.cameron, linux-arm-kernel
The patch set is applied for mpam/snapshot/v6.14-rc1 branch of
https://git.kernel.org/pub/scm/linux/kernel/git/morse/linux.git
repository.
The narrow-partid feature in MPAM allows for a more efficient use of
PARTIDs by enabling a many-to-one mapping of reqpartids (requested PARTIDs)
to intpartids (internal PARTIDs). This mapping reduces the number of unique
PARTIDs needed, thus allowing more tasks or processes to be monitored and
managed with the available resources.
For a mixture of MSCs system, for MSCs that do not support narrow-partid,
we use the PARTIDs exceeding the number of closids as reqPARTIDs for
expanding the monitoring groups.
In order to keep the existing resctrl API interface, the rmid contains both
req_idx and PMG information instead of PMG only under the MPAM driver. The
req_idx represents the req_idx-th sub-monitoring group under the control
group. The new rmid would be like:
rmid = (req_idx << shift | pmg).
The new conversion relationship between closid/rmid and (req)PARTID/PMG is:
(req)PARTID = (rmid.req_idx * n) + closid
PMG = rmid.pmg
Each intPARTID has m reqPARTIDs, which are used to expand the number of
monitoring groups under one control group. Therefore, the number of
monitoring groups is no longer limited by the range of MPAM PMG, which
enhances the extensibility of the system's monitoring capabilities.
---
Compared with RFC-v4:
- Rebase the patch set on the v6.14-rc1 branch.
Compared with RFC-v3:
- Add limitation of the Narrow-PARTID feature (See Patch 2).
- Remove redundant reqpartid2closid() and reqpartid_pmg2rmid().
- Refactor closid_rmid2reqpartid() partially.
- Merge the PARTID conversion-related patches into a single patch for
bisectability.
- Skip adaptation of resctrl_arch_set_rmid() which is going to be
removed.
Compared with RFC-v2:
- Refactor closid/rmid pair translation
- Simplify the logic of synchronize configuration
- Remove reqPARTID source bitmap
Compared with RFC-v1:
- Rebase this patch set on latest MPAM driver of the v6.12-rc1 branch.
---
Dave Martin (1):
arm_mpam: Set INTERNAL as needed when setting MSC controls
Zeng Heng (4):
arm_mpam: Introduce the definitions of intPARTID and reqPARTID
arm_mpam: Add limitation for the Narrow-PARTID feature
arm_mpam: Provide conversion method for new closid/rmid pairs
arm_mpam: Automatically synchronize the configuration of all
sub-monitoring groups
drivers/platform/arm64/mpam/mpam_devices.c | 61 ++++++--
drivers/platform/arm64/mpam/mpam_internal.h | 5 +
drivers/platform/arm64/mpam/mpam_resctrl.c | 157 ++++++++++++++------
3 files changed, 172 insertions(+), 51 deletions(-)
--
2.25.1
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH mpam mpam/snapshot/v6.14-rc1 1/5] arm_mpam: Introduce the definitions of intPARTID and reqPARTID
2025-02-17 3:18 [PATCH mpam mpam/snapshot/v6.14-rc1 0/5] arm_mpam: Introduce the Narrow-PARTID feature for MPAM driver Zeng Heng
@ 2025-02-17 3:18 ` Zeng Heng
2025-02-17 3:18 ` [PATCH mpam mpam/snapshot/v6.14-rc1 2/5] arm_mpam: Add limitation for the Narrow-PARTID feature Zeng Heng
` (3 subsequent siblings)
4 siblings, 0 replies; 9+ messages in thread
From: Zeng Heng @ 2025-02-17 3:18 UTC (permalink / raw)
To: Dave.Martin, james.morse
Cc: bobo.shaobowang, linux-kernel, jonathan.cameron, linux-arm-kernel
The narrow-partid feature in MPAM allows for a more efficient use of
PARTIDs by enabling a many-to-one mapping of reqpartids (requested PARTIDs)
to intpartids (internal PARTIDs). This mapping reduces the number of unique
PARTIDs needed, thus allowing more tasks or processes to be monitored and
managed with the available resources.
Regarding intPARTID, MPAM uses it as the unit for control group
configuration delivery. MPAM will synchronize the delivered configuration
to all reqPARTIDs mapped to the same intPARTIDs. The number of intPARTIDs
is indicated by MPAMF_PARTID_NRW_IDR.INTPARTID_MAX if implemented, or
directly use the number of PARTID as intpartid_max if narrow-partid feature
is not supported.
reqPARTIDs can be used to expand the number of monitors, for each control
group is no longer simply restricted by the range of PMG. By mapping
between intPARTID and reqPARTID, the number of monitors would be greatly
expanded and more fine-grained monitoring under a control group will be
achieved.
As a MPAM driver applicable to general scenarios, it needs to be compatible
with systems not supporting narrow-partid and mixed MSCs (some MSCs support
narrow-partid and some do not) systems.
We determine the number of closids in the following manner:
reqPARTID-np -- The number of reqPARTIDs supported by MSCs that support
narrow-partid.
intPARTID-np -- The number of intPARTIDs supported by MSCs that support
narrow partid.
PARTID-nnp -- The number of PARTIDs supported by MSCs that do not
support narrow partid.
n - Indicates the maximum number of control groups
l - Represents the total number of reqpartids
m - Indicates the number of reqpartids per control group
n = min(intPARTID-np, PARTID-nnp)
l = min(reqPARTID-np, PARTID-nnp)
m = l // n
To illustrate how to determine n, l, and m through examples, we can assume
a specific example:
l3 - Does not support the narrow PARTID feature, supports a range of 256
PARTIDs.
mata - Supports the narrow-partid feature, supports 32 intPARTIDs, and
supports 256 reqPARTIDs.
Then,
n = min(PARTID-l3, intPARTID-mata) = min(256, 32) = 32
l = min(PARTID-l3, reqPARTID-mata) = min(256,256) = 256
m = 256 / 32 = 8
After initialization, the driver determines the 'n' parameter returned by
resctrl_arch_get_num_closid() and the 'l' parameter returned by
get_num_reqpartid().
Signed-off-by: Zeng Heng <zengheng4@huawei.com>
---
drivers/platform/arm64/mpam/mpam_devices.c | 12 +++++++++++-
drivers/platform/arm64/mpam/mpam_internal.h | 2 ++
drivers/platform/arm64/mpam/mpam_resctrl.c | 9 +++++++--
3 files changed, 20 insertions(+), 3 deletions(-)
diff --git a/drivers/platform/arm64/mpam/mpam_devices.c b/drivers/platform/arm64/mpam/mpam_devices.c
index 30e94dab6c25..c1b690effe29 100644
--- a/drivers/platform/arm64/mpam/mpam_devices.c
+++ b/drivers/platform/arm64/mpam/mpam_devices.c
@@ -66,6 +66,7 @@ static DEFINE_MUTEX(mpam_cpuhp_state_lock);
* Generating traffic outside this range will result in screaming interrupts.
*/
u16 mpam_partid_max;
+u16 mpam_intpartid_max;
u8 mpam_pmg_max;
static bool partid_max_init, partid_max_published;
static DEFINE_SPINLOCK(partid_max_lock);
@@ -217,10 +218,16 @@ int mpam_register_requestor(u16 partid_max, u8 pmg_max)
spin_lock(&partid_max_lock);
if (!partid_max_init) {
mpam_partid_max = partid_max;
+ /*
+ * Update mpam_intpartid_max here, in case the
+ * system doesn't have narrow-partid feature.
+ */
+ mpam_intpartid_max = partid_max;
mpam_pmg_max = pmg_max;
partid_max_init = true;
} else if (!partid_max_published) {
mpam_partid_max = min(mpam_partid_max, partid_max);
+ mpam_intpartid_max = min(mpam_intpartid_max, partid_max);
mpam_pmg_max = min(mpam_pmg_max, pmg_max);
} else {
/* New requestors can't lower the values */
@@ -978,7 +985,9 @@ static void mpam_ris_hw_probe(struct mpam_msc_ris *ris)
u16 partid_max = FIELD_GET(MPAMF_PARTID_NRW_IDR_INTPARTID_MAX, nrwidr);
mpam_set_feature(mpam_feat_partid_nrw, props);
- msc->partid_max = min(msc->partid_max, partid_max);
+ msc->intpartid_max = min(msc->partid_max, partid_max);
+ } else {
+ msc->intpartid_max = msc->partid_max;
}
mpam_mon_sel_outer_unlock(msc);
@@ -1039,6 +1048,7 @@ static int mpam_msc_hw_probe(struct mpam_msc *msc)
spin_lock(&partid_max_lock);
mpam_partid_max = min(mpam_partid_max, msc->partid_max);
+ mpam_intpartid_max = min(mpam_intpartid_max, msc->intpartid_max);
mpam_pmg_max = min(mpam_pmg_max, msc->pmg_max);
spin_unlock(&partid_max_lock);
diff --git a/drivers/platform/arm64/mpam/mpam_internal.h b/drivers/platform/arm64/mpam/mpam_internal.h
index 831ae17345d7..7bc4694df23a 100644
--- a/drivers/platform/arm64/mpam/mpam_internal.h
+++ b/drivers/platform/arm64/mpam/mpam_internal.h
@@ -84,6 +84,7 @@ struct mpam_msc {
bool error_irq_requested;
bool error_irq_hw_enabled;
u16 partid_max;
+ u16 intpartid_max;
u8 pmg_max;
unsigned long ris_idxs[128 / BITS_PER_LONG];
u32 ris_max;
@@ -463,6 +464,7 @@ static inline void mpam_assert_srcu_read_lock_held(void)
/* System wide partid/pmg values */
extern u16 mpam_partid_max;
+extern u16 mpam_intpartid_max;
extern u8 mpam_pmg_max;
/* Scheduled work callback to enable mpam once all MSC have been probed */
diff --git a/drivers/platform/arm64/mpam/mpam_resctrl.c b/drivers/platform/arm64/mpam/mpam_resctrl.c
index f444c306134d..eedd308d9c88 100644
--- a/drivers/platform/arm64/mpam/mpam_resctrl.c
+++ b/drivers/platform/arm64/mpam/mpam_resctrl.c
@@ -162,6 +162,11 @@ static bool mpam_resctrl_hide_cdp(enum resctrl_res_level rid)
* only the system wide safe value is safe to use.
*/
u32 resctrl_arch_get_num_closid(struct rdt_resource *ignored)
+{
+ return mpam_intpartid_max + 1;
+}
+
+static u32 get_num_reqpartid(void)
{
return mpam_partid_max + 1;
}
@@ -169,9 +174,9 @@ u32 resctrl_arch_get_num_closid(struct rdt_resource *ignored)
u32 resctrl_arch_system_num_rmid_idx(void)
{
u8 closid_shift = fls(mpam_pmg_max);
- u32 num_partid = resctrl_arch_get_num_closid(NULL);
+ u32 num_reqpartid = get_num_reqpartid();
- return num_partid << closid_shift;
+ return num_reqpartid << closid_shift;
}
u32 resctrl_arch_rmid_idx_encode(u32 closid, u32 rmid)
--
2.25.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH mpam mpam/snapshot/v6.14-rc1 2/5] arm_mpam: Add limitation for the Narrow-PARTID feature
2025-02-17 3:18 [PATCH mpam mpam/snapshot/v6.14-rc1 0/5] arm_mpam: Introduce the Narrow-PARTID feature for MPAM driver Zeng Heng
2025-02-17 3:18 ` [PATCH mpam mpam/snapshot/v6.14-rc1 1/5] arm_mpam: Introduce the definitions of intPARTID and reqPARTID Zeng Heng
@ 2025-02-17 3:18 ` Zeng Heng
2025-02-17 3:18 ` [PATCH mpam mpam/snapshot/v6.14-rc1 3/5] arm_mpam: Provide conversion method for new closid/rmid pairs Zeng Heng
` (2 subsequent siblings)
4 siblings, 0 replies; 9+ messages in thread
From: Zeng Heng @ 2025-02-17 3:18 UTC (permalink / raw)
To: Dave.Martin, james.morse
Cc: bobo.shaobowang, linux-kernel, jonathan.cameron, linux-arm-kernel
Because it needs to support mixed systems that include MSCs with and
without Narrow-PARTID support, there are the following incompatible
control issues.
If an MSC does not support Narrow-PARTID and its control method is not of
the "partition bitmap" type, then delivering the resctrl control group
configuration across multiple PARTIDs will change the user's expected
behavior.
Currently, there is no way to solve this problem by programming different
control values simply, so here decide to restrict the usage scenarios of
this feature. When we find that the MATA MSC does not support the
Narrow-PARTID feature, the driver will disable the feature, which means
get_num_reqpartid() directly returns the number of intPARTIDs.
Signed-off-by: Zeng Heng <zengheng4@huawei.com>
---
drivers/platform/arm64/mpam/mpam_resctrl.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/drivers/platform/arm64/mpam/mpam_resctrl.c b/drivers/platform/arm64/mpam/mpam_resctrl.c
index eedd308d9c88..f3f8fb0ff421 100644
--- a/drivers/platform/arm64/mpam/mpam_resctrl.c
+++ b/drivers/platform/arm64/mpam/mpam_resctrl.c
@@ -168,6 +168,21 @@ u32 resctrl_arch_get_num_closid(struct rdt_resource *ignored)
static u32 get_num_reqpartid(void)
{
+ struct mpam_resctrl_res *res;
+ struct rdt_resource *r_mba;
+ struct mpam_props *cprops;
+
+ r_mba = resctrl_arch_get_resource(RDT_RESOURCE_MBA);
+ res = container_of(r_mba, struct mpam_resctrl_res, resctrl_res);
+ cprops = &res->class->props;
+
+ /*
+ * If the MBA does not support Narrow-PARTID,
+ * then the feature should be disabled at the system level.
+ */
+ if (!mpam_has_feature(mpam_feat_partid_nrw, cprops))
+ return resctrl_arch_get_num_closid(NULL);
+
return mpam_partid_max + 1;
}
--
2.25.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH mpam mpam/snapshot/v6.14-rc1 3/5] arm_mpam: Provide conversion method for new closid/rmid pairs
2025-02-17 3:18 [PATCH mpam mpam/snapshot/v6.14-rc1 0/5] arm_mpam: Introduce the Narrow-PARTID feature for MPAM driver Zeng Heng
2025-02-17 3:18 ` [PATCH mpam mpam/snapshot/v6.14-rc1 1/5] arm_mpam: Introduce the definitions of intPARTID and reqPARTID Zeng Heng
2025-02-17 3:18 ` [PATCH mpam mpam/snapshot/v6.14-rc1 2/5] arm_mpam: Add limitation for the Narrow-PARTID feature Zeng Heng
@ 2025-02-17 3:18 ` Zeng Heng
2025-02-17 6:18 ` Zeng Heng
2025-02-17 3:18 ` [PATCH mpam mpam/snapshot/v6.14-rc1 4/5] arm_mpam: Set INTERNAL as needed when setting MSC controls Zeng Heng
2025-02-17 3:18 ` [PATCH mpam mpam/snapshot/v6.14-rc1 5/5] arm_mpam: Automatically synchronize the configuration of all sub-monitoring groups Zeng Heng
4 siblings, 1 reply; 9+ messages in thread
From: Zeng Heng @ 2025-02-17 3:18 UTC (permalink / raw)
To: Dave.Martin, james.morse
Cc: bobo.shaobowang, linux-kernel, jonathan.cameron, linux-arm-kernel
The MPAM driver statically assigns all reqPARTIDs to respective intPARTIDs.
For the new rmid allocation strategy, it will check if there is an
available rmid of any reqPARTID which belongs to the input closid, not just
the rmids belonging to the closid.
For a mixture of MSCs system, for MSCs that do not support narrow-partid,
we use the PARTIDs exceeding the number of closids as reqPARTIDs for
expanding the monitoring groups.
In order to keep the existing resctrl API interface, the rmid contains both
req_idx and PMG information instead of PMG only under the MPAM driver. The
req_idx represents the req_idx-th sub-monitoring group under the control
group. The new rmid would be like:
rmid = (req_idx << shift | pmg).
The mapping relationships between each group's closid/rmid and the
respective MSCs' intPARTID/reqPARTID/PARTID are illustrated:
n - Indicates the total number of intPARTIDs
m - Indicates the number of reqPARTIDs per intPARTID
P - Partition group (control group)
M - Monitoring group
Group closid rmid.req_idx PARTID MSCs with narrow-partid MSCs without narrow-partid
P1 0 - 0 intPARTID_1 PARTID_1
M1_1 0 0 0 ├── reqPARTID_1_1 ├── PARTID_1_1
M1_2 0 1 0+n ├── reqPARTID_1_2 ├── PARTID_1_2
M1_3 0 2 0+n*2 ├── reqPARTID_1_3 ├── PARTID_1_3
... ├── ... ├── ...
M1_m 0 (m-1) 0+n*(m-1) └── reqPARTID_1_m └── PARTID_1_m
P2 1 - 1 intPARTID_2 PARTID_2
M2_1 1 0 1 ├── reqPARTID_2_1 ├── PARTID_2_1
M2_2 1 1 1+n ├── reqPARTID_2_2 ├── PARTID_2_2
M2_3 1 2 1+n*2 ├── reqPARTID_2_3 ├── PARTID_2_3
... ├── ... ├── ...
M2_m 1 (m-1) 1+n*(m-1) └── reqPARTID_2_m └── PARTID_2_m
Pn (n-1) - (n-1) intPARTID_n PARTID_n
Mn_1 (n-1) 0 (n-1) ├── reqPARTID_n_1 ├── PARTID_n_1
Mn_2 (n-1) 1 (n-1)+n ├── reqPARTID_n_2 ├── PARTID_n_2
Mn_3 (n-1) 2 (n-1)+n*2 ├── reqPARTID_n_3 ├── PARTID_n_3
... ├── ... ├── ...
Mn_m (n-1) (m-1) (n-1)+n*(m-1) = n*m-1 └── reqPARTID_n_m └── PARTID_n_m
Based on the example provided, the conversion relationship between
closid/rmid and (req)PARTID/PMG is:
(req)PARTID = (rmid.req_idx * n) + intPARTID
PMG = rmid.pmg
and still,
intPARTID = resctrl_get_config_index(closid, resctrl_conf_type)
The resctrl layer uses the new conversion functions(closid_rmid2reqpartid()
and rmid2pmg() respectively) to gain the new (req)PARTID/PMG pair.
It can be noted that the approach of allocating the first n IDs to
intPARTIDs keeps the existing conversion between closid and intPARTID.
We still use the resctrl_get_config_index() for conversion, maintaining
the original semantics during the MPAM configuration updating. Essentially,
the narrowing feature is an enhanced monitoring feature, we only expand the
definition of rmid, while reqPARTID is only used in monitoring-related
processes.
Now each control group has m (req)PARTIDs, which are used to expand the
number of monitoring groups under one control group. Therefore, the number
of monitoring groups is no longer limited by the range of MPAM's PMG, which
enhances the extensibility of the system's monitoring capabilities.
Signed-off-by: Zeng Heng <zengheng4@huawei.com>
---
drivers/platform/arm64/mpam/mpam_resctrl.c | 133 ++++++++++++++-------
1 file changed, 93 insertions(+), 40 deletions(-)
diff --git a/drivers/platform/arm64/mpam/mpam_resctrl.c b/drivers/platform/arm64/mpam/mpam_resctrl.c
index f3f8fb0ff421..c6ca086f7dd8 100644
--- a/drivers/platform/arm64/mpam/mpam_resctrl.c
+++ b/drivers/platform/arm64/mpam/mpam_resctrl.c
@@ -186,6 +186,11 @@ static u32 get_num_reqpartid(void)
return mpam_partid_max + 1;
}
+static u32 get_num_reqpartid_per_closid(void)
+{
+ return get_num_reqpartid() / resctrl_arch_get_num_closid(NULL);
+}
+
u32 resctrl_arch_system_num_rmid_idx(void)
{
u8 closid_shift = fls(mpam_pmg_max);
@@ -194,24 +199,73 @@ u32 resctrl_arch_system_num_rmid_idx(void)
return num_reqpartid << closid_shift;
}
+/*
+ * Under MPAM driver, the rmid contains two pieces of information: one is
+ * req_idx, and the other is pmg. Therefore,
+ * closid_shift = req_shift + pmg_shift.
+ */
u32 resctrl_arch_rmid_idx_encode(u32 closid, u32 rmid)
{
- u8 closid_shift = fls(mpam_pmg_max);
+ u32 rmid_mask;
+ u8 closid_shift;
+ u8 pmg_shift = fls(mpam_pmg_max);
+ u8 req_shift = fls(get_num_reqpartid_per_closid() - 1);
+
+ closid_shift = req_shift + pmg_shift;
+ rmid_mask = ~(~0 << closid_shift);
WARN_ON_ONCE(closid_shift > 8);
- return (closid << closid_shift) | rmid;
+ return (closid << closid_shift) | (rmid & rmid_mask);
}
void resctrl_arch_rmid_idx_decode(u32 idx, u32 *closid, u32 *rmid)
{
- u8 closid_shift = fls(mpam_pmg_max);
- u32 pmg_mask = ~(~0 << closid_shift);
+ u32 rmid_mask;
+ u8 closid_shift;
+ u8 pmg_shift = fls(mpam_pmg_max);
+ u8 req_shift = fls(get_num_reqpartid_per_closid() - 1);
+
+ closid_shift = req_shift + pmg_shift;
+ rmid_mask = ~(~0 << closid_shift);
WARN_ON_ONCE(closid_shift > 8);
- *closid = idx >> closid_shift;
- *rmid = idx & pmg_mask;
+ if (closid)
+ *closid = idx >> closid_shift;
+ if (rmid)
+ *rmid = idx & rmid_mask;
+}
+
+static u32 closid_rmid2reqpartid(u32 closid, u32 rmid)
+{
+ u32 intpartid;
+ u8 pmg_shift = fls(mpam_pmg_max);
+ u32 req_idx = (rmid >> pmg_shift);
+ u8 intpartid_shift = fls(mpam_intpartid_max);
+
+ if (!cdp_enabled)
+ intpartid = resctrl_get_config_index(closid, CDP_NONE);
+ else
+ intpartid = resctrl_get_config_index(closid, CDP_DATA);
+
+ return (req_idx << intpartid_shift) | intpartid;
+}
+
+static u32 rmid2pmg(u32 rmid)
+{
+ u8 pmg_shift = fls(mpam_pmg_max);
+ u32 pmg_mask = ~(~0 << pmg_shift);
+
+ return rmid & pmg_mask;
+}
+
+static u32 req2intpartid(u32 reqpartid)
+{
+ u8 intpartid_shift = fls(mpam_intpartid_max);
+ u32 intpartid_mask = ~(~0 << intpartid_shift);
+
+ return reqpartid & intpartid_mask;
}
void resctrl_arch_sched_in(struct task_struct *tsk)
@@ -223,21 +277,20 @@ void resctrl_arch_sched_in(struct task_struct *tsk)
void resctrl_arch_set_cpu_default_closid_rmid(int cpu, u32 closid, u32 rmid)
{
- WARN_ON_ONCE(closid > U16_MAX);
- WARN_ON_ONCE(rmid > U8_MAX);
+ u32 reqpartid = closid_rmid2reqpartid(closid, rmid);
+ u32 pmg = rmid2pmg(rmid);
- if (!cdp_enabled) {
- mpam_set_cpu_defaults(cpu, closid, closid, rmid, rmid);
- } else {
+ WARN_ON_ONCE(reqpartid > U16_MAX);
+ WARN_ON_ONCE(pmg > U8_MAX);
+
+ if (!cdp_enabled)
+ mpam_set_cpu_defaults(cpu, reqpartid, reqpartid, pmg, pmg);
+ else
/*
* When CDP is enabled, resctrl halves the closid range and we
* use odd/even partid for one closid.
*/
- u32 partid_d = resctrl_get_config_index(closid, CDP_DATA);
- u32 partid_i = resctrl_get_config_index(closid, CDP_CODE);
-
- mpam_set_cpu_defaults(cpu, partid_d, partid_i, rmid, rmid);
- }
+ mpam_set_cpu_defaults(cpu, reqpartid, reqpartid + 1, pmg, pmg);
}
void resctrl_arch_sync_cpu_closid_rmid(void *info)
@@ -256,41 +309,41 @@ void resctrl_arch_sync_cpu_closid_rmid(void *info)
void resctrl_arch_set_closid_rmid(struct task_struct *tsk, u32 closid, u32 rmid)
{
- WARN_ON_ONCE(closid > U16_MAX);
- WARN_ON_ONCE(rmid > U8_MAX);
+ u32 reqpartid = closid_rmid2reqpartid(closid, rmid);
+ u32 pmg = rmid2pmg(rmid);
- if (!cdp_enabled) {
- mpam_set_task_partid_pmg(tsk, closid, closid, rmid, rmid);
- } else {
- u32 partid_d = resctrl_get_config_index(closid, CDP_DATA);
- u32 partid_i = resctrl_get_config_index(closid, CDP_CODE);
+ WARN_ON_ONCE(reqpartid > U16_MAX);
+ WARN_ON_ONCE(pmg > U8_MAX);
+
+ if (!cdp_enabled)
+ mpam_set_task_partid_pmg(tsk, reqpartid, reqpartid, pmg, pmg);
+ else
+ mpam_set_task_partid_pmg(tsk, reqpartid, reqpartid + 1, pmg, pmg);
- mpam_set_task_partid_pmg(tsk, partid_d, partid_i, rmid, rmid);
- }
}
bool resctrl_arch_match_closid(struct task_struct *tsk, u32 closid)
{
u64 regval = mpam_get_regval(tsk);
- u32 tsk_closid = FIELD_GET(MPAM1_EL1_PARTID_D, regval);
+ u32 tsk_partid = FIELD_GET(MPAM1_EL1_PARTID_D, regval);
+
+ tsk_partid = req2intpartid(tsk_partid);
if (cdp_enabled)
- tsk_closid >>= 1;
+ tsk_partid >>= 1;
- return tsk_closid == closid;
+ return tsk_partid == closid;
}
/* The task's pmg is not unique, the partid must be considered too */
bool resctrl_arch_match_rmid(struct task_struct *tsk, u32 closid, u32 rmid)
{
u64 regval = mpam_get_regval(tsk);
- u32 tsk_closid = FIELD_GET(MPAM1_EL1_PARTID_D, regval);
- u32 tsk_rmid = FIELD_GET(MPAM1_EL1_PMG_D, regval);
-
- if (cdp_enabled)
- tsk_closid >>= 1;
+ u32 tsk_partid = FIELD_GET(MPAM1_EL1_PARTID_D, regval);
+ u32 tsk_pmg = FIELD_GET(MPAM1_EL1_PMG_D, regval);
- return (tsk_closid == closid) && (tsk_rmid == rmid);
+ return (tsk_partid == closid_rmid2reqpartid(closid, rmid)) &&
+ (tsk_pmg == rmid2pmg(rmid));
}
struct rdt_resource *resctrl_arch_get_resource(enum resctrl_res_level l)
@@ -412,7 +465,7 @@ int resctrl_arch_rmid_read(struct rdt_resource *r, struct rdt_mon_domain *d,
cfg.mon = resctrl_arch_rmid_idx_encode(closid, rmid);
cfg.match_pmg = true;
- cfg.pmg = rmid;
+ cfg.pmg = rmid2pmg(rmid);
cfg.opts = resctrl_evt_config_to_mpam(dom->mbm_local_evt_cfg);
if (irqs_disabled()) {
@@ -420,7 +473,7 @@ int resctrl_arch_rmid_read(struct rdt_resource *r, struct rdt_mon_domain *d,
err = -EIO;
} else {
if (cdp_enabled) {
- cfg.partid = closid << 1;
+ cfg.partid = closid_rmid2reqpartid(closid, rmid);
err = mpam_msmon_read(dom->comp, &cfg, type, val);
if (err)
return err;
@@ -430,7 +483,7 @@ int resctrl_arch_rmid_read(struct rdt_resource *r, struct rdt_mon_domain *d,
if (!err)
*val += cdp_val;
} else {
- cfg.partid = closid;
+ cfg.partid = closid_rmid2reqpartid(closid, rmid);
err = mpam_msmon_read(dom->comp, &cfg, type, val);
}
}
@@ -449,18 +502,18 @@ void resctrl_arch_reset_rmid(struct rdt_resource *r, struct rdt_mon_domain *d,
cfg.mon = resctrl_arch_rmid_idx_encode(closid, rmid);
cfg.match_pmg = true;
- cfg.pmg = rmid;
+ cfg.pmg = rmid2pmg(rmid);
dom = container_of(d, struct mpam_resctrl_dom, resctrl_mon_dom);
if (cdp_enabled) {
- cfg.partid = closid << 1;
+ cfg.partid = closid_rmid2reqpartid(closid, rmid);
mpam_msmon_reset_mbwu(dom->comp, &cfg);
cfg.partid += 1;
mpam_msmon_reset_mbwu(dom->comp, &cfg);
} else {
- cfg.partid = closid;
+ cfg.partid = closid_rmid2reqpartid(closid, rmid);
mpam_msmon_reset_mbwu(dom->comp, &cfg);
}
}
--
2.25.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH mpam mpam/snapshot/v6.14-rc1 4/5] arm_mpam: Set INTERNAL as needed when setting MSC controls
2025-02-17 3:18 [PATCH mpam mpam/snapshot/v6.14-rc1 0/5] arm_mpam: Introduce the Narrow-PARTID feature for MPAM driver Zeng Heng
` (2 preceding siblings ...)
2025-02-17 3:18 ` [PATCH mpam mpam/snapshot/v6.14-rc1 3/5] arm_mpam: Provide conversion method for new closid/rmid pairs Zeng Heng
@ 2025-02-17 3:18 ` Zeng Heng
2025-02-17 3:18 ` [PATCH mpam mpam/snapshot/v6.14-rc1 5/5] arm_mpam: Automatically synchronize the configuration of all sub-monitoring groups Zeng Heng
4 siblings, 0 replies; 9+ messages in thread
From: Zeng Heng @ 2025-02-17 3:18 UTC (permalink / raw)
To: Dave.Martin, james.morse
Cc: bobo.shaobowang, linux-kernel, jonathan.cameron, linux-arm-kernel
From: Dave Martin <Dave.Martin@arm.com>
Currently, when an MSC implements PARTID narrowing, MPAMCFG_PART_SEL is
left set to the reqPARTID while programming resource controls in
an MSC.
The MPAM architecture does not guarantee that any particular resource
controls will be updated correctly in this scenario. Instead,
MPAMCFG_PART_SEL must be written with the corresponding intPARTID and
with the INTERNAL bit set before attempting to program resource controls.
Only the PARTID->intPARTID mappings can be written without the INTERNAL
bit set in MPAMCFG_PART_SEL.
Fix it, by rewriting MPAMCFG_PART_SEL appropriately after setting the
intPARTID mapping.
The MPAMCFG_INTPARTID_INTERNAL flag is not currently accepted as
input to the __mpam_part_sel() helper. In the interest of keeping
the code clean, break this helper up.
Signed-off-by: Dave Martin <Dave.Martin@arm.com>
Signed-off-by: James Morse <james.morse@arm.com>
---
drivers/platform/arm64/mpam/mpam_devices.c | 26 +++++++++++++++++-----
1 file changed, 20 insertions(+), 6 deletions(-)
diff --git a/drivers/platform/arm64/mpam/mpam_devices.c b/drivers/platform/arm64/mpam/mpam_devices.c
index c1b690effe29..a1efd08eb914 100644
--- a/drivers/platform/arm64/mpam/mpam_devices.c
+++ b/drivers/platform/arm64/mpam/mpam_devices.c
@@ -200,15 +200,27 @@ static u64 mpam_msc_read_esr(struct mpam_msc *msc)
return (esr_high << 32) | esr_low;
}
+static void __mpam_part_sel_raw(u32 partsel, struct mpam_msc *msc)
+{
+ lockdep_assert_held(&msc->part_sel_lock);
+ mpam_write_partsel_reg(msc, PART_SEL, partsel);
+}
+
static void __mpam_part_sel(u8 ris_idx, u16 partid, struct mpam_msc *msc)
{
- u32 partsel;
+ u32 partsel = FIELD_PREP(MPAMCFG_PART_SEL_RIS, ris_idx) |
+ FIELD_PREP(MPAMCFG_PART_SEL_PARTID_SEL, partid);
- lockdep_assert_held(&msc->part_sel_lock);
+ __mpam_part_sel_raw(partsel, msc);
+}
- partsel = FIELD_PREP(MPAMCFG_PART_SEL_RIS, ris_idx) |
- FIELD_PREP(MPAMCFG_PART_SEL_PARTID_SEL, partid);
- mpam_write_partsel_reg(msc, PART_SEL, partsel);
+static void __mpam_intpart_sel(u8 ris_idx, u16 intpartid, struct mpam_msc *msc)
+{
+ u32 partsel = FIELD_PREP(MPAMCFG_PART_SEL_RIS, ris_idx) |
+ FIELD_PREP(MPAMCFG_PART_SEL_PARTID_SEL, intpartid) |
+ MPAMCFG_PART_SEL_INTERNAL;
+
+ __mpam_part_sel_raw(partsel, msc);
}
int mpam_register_requestor(u16 partid_max, u8 pmg_max)
@@ -1531,9 +1543,11 @@ static void mpam_reprogram_ris_partid(struct mpam_msc_ris *ris, u16 partid,
mutex_lock(&msc->part_sel_lock);
__mpam_part_sel(ris->ris_idx, partid, msc);
- if (mpam_has_feature(mpam_feat_partid_nrw, rprops))
+ if (mpam_has_feature(mpam_feat_partid_nrw, rprops)) {
mpam_write_partsel_reg(msc, INTPARTID,
MPAMCFG_INTPARTID_INTERNAL | partid);
+ __mpam_intpart_sel(ris->ris_idx, partid, msc);
+ }
if (mpam_has_feature(mpam_feat_cpor_part, rprops)) {
if (mpam_has_feature(mpam_feat_cpor_part, cfg))
--
2.25.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH mpam mpam/snapshot/v6.14-rc1 5/5] arm_mpam: Automatically synchronize the configuration of all sub-monitoring groups
2025-02-17 3:18 [PATCH mpam mpam/snapshot/v6.14-rc1 0/5] arm_mpam: Introduce the Narrow-PARTID feature for MPAM driver Zeng Heng
` (3 preceding siblings ...)
2025-02-17 3:18 ` [PATCH mpam mpam/snapshot/v6.14-rc1 4/5] arm_mpam: Set INTERNAL as needed when setting MSC controls Zeng Heng
@ 2025-02-17 3:18 ` Zeng Heng
4 siblings, 0 replies; 9+ messages in thread
From: Zeng Heng @ 2025-02-17 3:18 UTC (permalink / raw)
To: Dave.Martin, james.morse
Cc: bobo.shaobowang, linux-kernel, jonathan.cameron, linux-arm-kernel
After the system expands the narrow-partid feature and statically assigns
all (req)PARTIDs to each control group, the following scenarios require
configuration synchronization operations:
1. MSCs that support narrow-partid need to establish a mapping between
reqPARTID and intPARTID after creating a new monitoring group.
2. MSCs that do not support narrow-partid need to synchronize the
configuration of sub-monitoring groups after users update the control
group configuration.
In __write_config(), we synchronize a control group's configuration to each
sub-monitoring group.
Signed-off-by: Zeng Heng <zengheng4@huawei.com>
---
drivers/platform/arm64/mpam/mpam_devices.c | 25 ++++++++++++++++++---
drivers/platform/arm64/mpam/mpam_internal.h | 3 +++
drivers/platform/arm64/mpam/mpam_resctrl.c | 4 ++--
3 files changed, 27 insertions(+), 5 deletions(-)
diff --git a/drivers/platform/arm64/mpam/mpam_devices.c b/drivers/platform/arm64/mpam/mpam_devices.c
index a1efd08eb914..380e10a7aebd 100644
--- a/drivers/platform/arm64/mpam/mpam_devices.c
+++ b/drivers/platform/arm64/mpam/mpam_devices.c
@@ -1535,6 +1535,7 @@ static void mpam_reprogram_ris_partid(struct mpam_msc_ris *ris, u16 partid,
u32 pri_val = 0;
u16 cmax = MPAMCFG_CMAX_CMAX;
u16 bwa_fract = MPAMCFG_MBW_MAX_MAX;
+ u16 intpartid = req2intpartid(partid);
struct mpam_msc *msc = ris->vmsc->msc;
struct mpam_props *rprops = &ris->props;
u16 dspri = GENMASK(rprops->dspri_wd, 0);
@@ -1545,8 +1546,14 @@ static void mpam_reprogram_ris_partid(struct mpam_msc_ris *ris, u16 partid,
if (mpam_has_feature(mpam_feat_partid_nrw, rprops)) {
mpam_write_partsel_reg(msc, INTPARTID,
- MPAMCFG_INTPARTID_INTERNAL | partid);
- __mpam_intpart_sel(ris->ris_idx, partid, msc);
+ MPAMCFG_INTPARTID_INTERNAL |
+ intpartid);
+
+ /* Already finish mapping reqPARTID to intPARTID */
+ if (partid != intpartid)
+ goto out;
+
+ __mpam_intpart_sel(ris->ris_idx, intpartid, msc);
}
if (mpam_has_feature(mpam_feat_cpor_part, rprops)) {
@@ -1606,6 +1613,7 @@ static void mpam_reprogram_ris_partid(struct mpam_msc_ris *ris, u16 partid,
mpam_quirk_post_config_change(ris, partid, cfg);
+out:
mutex_unlock(&msc->part_sel_lock);
}
@@ -3066,9 +3074,20 @@ struct mpam_write_config_arg {
static int __write_config(void *arg)
{
+ int closid_num = resctrl_arch_get_num_closid(NULL);
struct mpam_write_config_arg *c = arg;
+ u32 reqpartid, req_idx;
+
+ WARN_ON(c->partid >= closid_num);
- mpam_reprogram_ris_partid(c->ris, c->partid, &c->comp->cfg[c->partid]);
+ /* Synchronize the configuration to each sub-monitoring group. */
+ for (req_idx = 0; req_idx < get_num_reqpartid_per_closid();
+ req_idx++) {
+ reqpartid = req_idx * closid_num + c->partid;
+
+ mpam_reprogram_ris_partid(c->ris, reqpartid,
+ &c->comp->cfg[c->partid]);
+ }
return 0;
}
diff --git a/drivers/platform/arm64/mpam/mpam_internal.h b/drivers/platform/arm64/mpam/mpam_internal.h
index 7bc4694df23a..10609d744a2a 100644
--- a/drivers/platform/arm64/mpam/mpam_internal.h
+++ b/drivers/platform/arm64/mpam/mpam_internal.h
@@ -768,4 +768,7 @@ static inline void mpam_resctrl_teardown_class(struct mpam_class *class) { }
*/
#define MSMON_CAPT_EVNT_NOW BIT(0)
+u32 get_num_reqpartid_per_closid(void);
+u32 req2intpartid(u32 reqpartid);
+
#endif /* MPAM_INTERNAL_H */
diff --git a/drivers/platform/arm64/mpam/mpam_resctrl.c b/drivers/platform/arm64/mpam/mpam_resctrl.c
index c6ca086f7dd8..31565a49aee9 100644
--- a/drivers/platform/arm64/mpam/mpam_resctrl.c
+++ b/drivers/platform/arm64/mpam/mpam_resctrl.c
@@ -186,7 +186,7 @@ static u32 get_num_reqpartid(void)
return mpam_partid_max + 1;
}
-static u32 get_num_reqpartid_per_closid(void)
+u32 get_num_reqpartid_per_closid(void)
{
return get_num_reqpartid() / resctrl_arch_get_num_closid(NULL);
}
@@ -260,7 +260,7 @@ static u32 rmid2pmg(u32 rmid)
return rmid & pmg_mask;
}
-static u32 req2intpartid(u32 reqpartid)
+u32 req2intpartid(u32 reqpartid)
{
u8 intpartid_shift = fls(mpam_intpartid_max);
u32 intpartid_mask = ~(~0 << intpartid_shift);
--
2.25.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH mpam mpam/snapshot/v6.14-rc1 3/5] arm_mpam: Provide conversion method for new closid/rmid pairs
2025-02-17 3:18 ` [PATCH mpam mpam/snapshot/v6.14-rc1 3/5] arm_mpam: Provide conversion method for new closid/rmid pairs Zeng Heng
@ 2025-02-17 6:18 ` Zeng Heng
2025-02-17 13:36 ` Dave Martin
0 siblings, 1 reply; 9+ messages in thread
From: Zeng Heng @ 2025-02-17 6:18 UTC (permalink / raw)
To: Dave.Martin, james.morse
Cc: bobo.shaobowang, jonathan.cameron, linux-arm-kernel, linux-kernel
Hi Martin,
On 2025/2/17 11:18, Zeng Heng wrote:
> The MPAM driver statically assigns all reqPARTIDs to respective intPARTIDs.
> For the new rmid allocation strategy, it will check if there is an
> available rmid of any reqPARTID which belongs to the input closid, not just
> the rmids belonging to the closid.
>
> For a mixture of MSCs system, for MSCs that do not support narrow-partid,
> we use the PARTIDs exceeding the number of closids as reqPARTIDs for
> expanding the monitoring groups.
>
> In order to keep the existing resctrl API interface, the rmid contains both
> req_idx and PMG information instead of PMG only under the MPAM driver. The
> req_idx represents the req_idx-th sub-monitoring group under the control
> group. The new rmid would be like:
>
> rmid = (req_idx << shift | pmg).
>
To consider future compatibility with dynamically allocated reqpartid,
should I refactor the rmid?
Instead of defining rmid.req_idx, we could place the entire reqpartid
directly within rmid. In This way, the allocation of reqpartid will no
longer be constrained by the static allocation of closid, facilitating
future compatibility with dynamic allocation mechanisms.
In this case, it needs to refactor the resctrl_arch_rmid_idx_encode()
and resctrl_arch_rmid_idx_decode(), and we can simplify
closid_rmid2reqpartid() to rmid2reqpartid().
What are your thoughts on this idea? Thank you in advance for your
reply.
Best regards,
Zeng Heng
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH mpam mpam/snapshot/v6.14-rc1 3/5] arm_mpam: Provide conversion method for new closid/rmid pairs
2025-02-17 6:18 ` Zeng Heng
@ 2025-02-17 13:36 ` Dave Martin
2025-02-18 6:32 ` Zeng Heng
0 siblings, 1 reply; 9+ messages in thread
From: Dave Martin @ 2025-02-17 13:36 UTC (permalink / raw)
To: Zeng Heng
Cc: james.morse, bobo.shaobowang, jonathan.cameron, linux-arm-kernel,
linux-kernel
Hi,
On Mon, Feb 17, 2025 at 02:18:44PM +0800, Zeng Heng wrote:
> Hi Martin,
>
> On 2025/2/17 11:18, Zeng Heng wrote:
> > The MPAM driver statically assigns all reqPARTIDs to respective intPARTIDs.
> > For the new rmid allocation strategy, it will check if there is an
> > available rmid of any reqPARTID which belongs to the input closid, not just
> > the rmids belonging to the closid.
> >
> > For a mixture of MSCs system, for MSCs that do not support narrow-partid,
> > we use the PARTIDs exceeding the number of closids as reqPARTIDs for
> > expanding the monitoring groups.
> >
> > In order to keep the existing resctrl API interface, the rmid contains both
> > req_idx and PMG information instead of PMG only under the MPAM driver. The
> > req_idx represents the req_idx-th sub-monitoring group under the control
> > group. The new rmid would be like:
> >
> > rmid = (req_idx << shift | pmg).
> >
>
> To consider future compatibility with dynamically allocated reqpartid,
> should I refactor the rmid?
>
> Instead of defining rmid.req_idx, we could place the entire reqpartid
> directly within rmid. In This way, the allocation of reqpartid will no
> longer be constrained by the static allocation of closid, facilitating
> future compatibility with dynamic allocation mechanisms.
>
> In this case, it needs to refactor the resctrl_arch_rmid_idx_encode()
> and resctrl_arch_rmid_idx_decode(), and we can simplify
> closid_rmid2reqpartid() to rmid2reqpartid().
>
> What are your thoughts on this idea? Thank you in advance for your
> reply.
>
> Best regards,
> Zeng Heng
Does this mean that the RMID must be expanded to cover all possible
(reqPARTID, PMG) combinations?
A single reqPARTID cannot be allocated to two different resctrl control
groups at the same time, even though a PMG value can be reused across
multiple control groups -- so it sounds like your proposal would
require changes in the resctrl core code as well as possibly requiring
a larger rmid_ptrs table.
But I might have misunderstood what you are proposing here...
Can you illustrate with one or two examples?
Cheers
---Dave
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH mpam mpam/snapshot/v6.14-rc1 3/5] arm_mpam: Provide conversion method for new closid/rmid pairs
2025-02-17 13:36 ` Dave Martin
@ 2025-02-18 6:32 ` Zeng Heng
0 siblings, 0 replies; 9+ messages in thread
From: Zeng Heng @ 2025-02-18 6:32 UTC (permalink / raw)
To: Dave Martin
Cc: james.morse, bobo.shaobowang, jonathan.cameron, linux-arm-kernel,
linux-kernel
Hi,
On 2025/2/17 21:36, Dave Martin wrote:
> Hi,
>
> On Mon, Feb 17, 2025 at 02:18:44PM +0800, Zeng Heng wrote:
>> Hi Martin,
>>
>> On 2025/2/17 11:18, Zeng Heng wrote:
>>> The MPAM driver statically assigns all reqPARTIDs to respective intPARTIDs.
>>> For the new rmid allocation strategy, it will check if there is an
>>> available rmid of any reqPARTID which belongs to the input closid, not just
>>> the rmids belonging to the closid.
>>>
>>> For a mixture of MSCs system, for MSCs that do not support narrow-partid,
>>> we use the PARTIDs exceeding the number of closids as reqPARTIDs for
>>> expanding the monitoring groups.
>>>
>>> In order to keep the existing resctrl API interface, the rmid contains both
>>> req_idx and PMG information instead of PMG only under the MPAM driver. The
>>> req_idx represents the req_idx-th sub-monitoring group under the control
>>> group. The new rmid would be like:
>>>
>>> rmid = (req_idx << shift | pmg).
>>>
>>
>> To consider future compatibility with dynamically allocated reqpartid,
>> should I refactor the rmid?
>>
>> Instead of defining rmid.req_idx, we could place the entire reqpartid
>> directly within rmid. In This way, the allocation of reqpartid will no
>> longer be constrained by the static allocation of closid, facilitating
>> future compatibility with dynamic allocation mechanisms.
>>
>> In this case, it needs to refactor the resctrl_arch_rmid_idx_encode()
>> and resctrl_arch_rmid_idx_decode(), and we can simplify
>> closid_rmid2reqpartid() to rmid2reqpartid().
>>
>> What are your thoughts on this idea? Thank you in advance for your
>> reply.
>>
>> Best regards,
>> Zeng Heng
>
> Does this mean that the RMID must be expanded to cover all possible
> (reqPARTID, PMG) combinations?
>
> A single reqPARTID cannot be allocated to two different resctrl control
> groups at the same time, even though a PMG value can be reused across
> multiple control groups -- so it sounds like your proposal would
> require changes in the resctrl core code as well as possibly requiring
> a larger rmid_ptrs table.
>
> But I might have misunderstood what you are proposing here...
>
> Can you illustrate with one or two examples?
>
Yes, as you have written. It might be worth trying this approach:
rmid = (reqpartid, pmg).
But to avoid the reuse of rmid across multiple control groups, we will
check the incoming closid in resctrl_arch_rmid_idx_encode() to prevent
rmid from being reallocated by resctrl_find_free_rmid().
We don't need a larger rmid_ptrs table, nor do we need to modify the
existing resctrl common code by continuing with the current static
allocation method.
Below are the implementations of several key functions for reference:
~~~
u32 rmid2reqpartid(u32 rmid)
{
u8 pmg_shift = fls(mpam_pmg_max);
WARN_ON_ONCE(pmg_shift > 8);
return rmid >> pmg_shift;
}
/*
* If the closid and rmid do not match upon inspection,
* immediately return an invalid idx value.
*/
u32 resctrl_arch_rmid_idx_encode(u32 closid, u32 rmid)
{
u32 reqpartid = rmid2reqpartid(rmid);
u32 intpartid = req2intpartid(reqpartid);
if (cdp_enabled)
intpartid >>= 1;
if (closid != intpartid)
return U32_MAX;
return rmid;
}
void resctrl_arch_rmid_idx_decode(u32 idx, u32 *closid, u32 *rmid)
{
u32 reqpartid = rmid2reqpartid(idx);
u32 intpartid = req2intpartid(reqpartid);
if (rmid)
*rmid = idx;
if (closid) {
if (cdp_enabled)
intpartid >>= 1;
*closid = intpartid;
}
}
~~~
Best regards,
Zeng Heng
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2025-02-18 6:32 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-17 3:18 [PATCH mpam mpam/snapshot/v6.14-rc1 0/5] arm_mpam: Introduce the Narrow-PARTID feature for MPAM driver Zeng Heng
2025-02-17 3:18 ` [PATCH mpam mpam/snapshot/v6.14-rc1 1/5] arm_mpam: Introduce the definitions of intPARTID and reqPARTID Zeng Heng
2025-02-17 3:18 ` [PATCH mpam mpam/snapshot/v6.14-rc1 2/5] arm_mpam: Add limitation for the Narrow-PARTID feature Zeng Heng
2025-02-17 3:18 ` [PATCH mpam mpam/snapshot/v6.14-rc1 3/5] arm_mpam: Provide conversion method for new closid/rmid pairs Zeng Heng
2025-02-17 6:18 ` Zeng Heng
2025-02-17 13:36 ` Dave Martin
2025-02-18 6:32 ` Zeng Heng
2025-02-17 3:18 ` [PATCH mpam mpam/snapshot/v6.14-rc1 4/5] arm_mpam: Set INTERNAL as needed when setting MSC controls Zeng Heng
2025-02-17 3:18 ` [PATCH mpam mpam/snapshot/v6.14-rc1 5/5] arm_mpam: Automatically synchronize the configuration of all sub-monitoring groups Zeng Heng
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox