* [PATCH mpam/v6.10-rc1 RFC 1/4] arm_mpam: Correct MBA granularity calculation
2024-07-22 4:01 [PATCH mpam/v6.10-rc1 RFC 0/4] arm_mpam: Fix several minor issues Zeng Heng
@ 2024-07-22 4:01 ` Zeng Heng
2024-07-22 4:01 ` [PATCH mpam/v6.10-rc1 RFC 2/4] arm_mpam: Fix the range calculation of the implemented bits Zeng Heng
` (3 subsequent siblings)
4 siblings, 0 replies; 8+ messages in thread
From: Zeng Heng @ 2024-07-22 4:01 UTC (permalink / raw)
To: james.morse, rohit.mathew, amitsinght, sdonthineni
Cc: linux-arm-kernel, linux-kernel, zengheng4, liwei391
Correct MBA granularity calculation function. As said in the comments,
"bwa_wd is the number of bits implemented in the 0.xxx fixed point
fraction".
Fixes: 867471fefd5c ("SPLIT untested: arm_mpam: resctrl: Add support for MB resource")
Signed-off-by: Zeng Heng <zengheng4@huawei.com>
---
drivers/platform/arm64/mpam/mpam_resctrl.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/platform/arm64/mpam/mpam_resctrl.c b/drivers/platform/arm64/mpam/mpam_resctrl.c
index 2fa732a42d4f..a217f2e1f350 100644
--- a/drivers/platform/arm64/mpam/mpam_resctrl.c
+++ b/drivers/platform/arm64/mpam/mpam_resctrl.c
@@ -523,7 +523,7 @@ static u32 get_mba_granularity(struct mpam_props *cprops)
* bwa_wd is the number of bits implemented in the 0.xxx
* fixed point fraction. 1 bit is 50%, 2 is 25% etc.
*/
- return MAX_MBA_BW / (cprops->bwa_wd + 1);
+ return MAX_MBA_BW / (1 << cprops->bwa_wd);
}
return 0;
--
2.25.1
^ permalink raw reply [flat|nested] 8+ messages in thread* [PATCH mpam/v6.10-rc1 RFC 2/4] arm_mpam: Fix the range calculation of the implemented bits
2024-07-22 4:01 [PATCH mpam/v6.10-rc1 RFC 0/4] arm_mpam: Fix several minor issues Zeng Heng
2024-07-22 4:01 ` [PATCH mpam/v6.10-rc1 RFC 1/4] arm_mpam: Correct MBA granularity calculation Zeng Heng
@ 2024-07-22 4:01 ` Zeng Heng
2024-07-22 4:01 ` [PATCH mpam/v6.10-rc1 RFC 3/4] arm_mpam: Correct the judgment condition of the CMAX feature Zeng Heng
` (2 subsequent siblings)
4 siblings, 0 replies; 8+ messages in thread
From: Zeng Heng @ 2024-07-22 4:01 UTC (permalink / raw)
To: james.morse, rohit.mathew, amitsinght, sdonthineni
Cc: linux-arm-kernel, linux-kernel, zengheng4, liwei391
The implemented bits of the MAX field in the MPAMCFG_{MBW_MAX, CMAX}
register are always to the left of the field, so the validated range
should be like [15, 15 - width + 1].
Fixes: 867471fefd5c ("SPLIT untested: arm_mpam: resctrl: Add support for MB resource")
Signed-off-by: Zeng Heng <zengheng4@huawei.com>
---
drivers/platform/arm64/mpam/mpam_resctrl.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/platform/arm64/mpam/mpam_resctrl.c b/drivers/platform/arm64/mpam/mpam_resctrl.c
index a217f2e1f350..e87fca6fc5fd 100644
--- a/drivers/platform/arm64/mpam/mpam_resctrl.c
+++ b/drivers/platform/arm64/mpam/mpam_resctrl.c
@@ -585,7 +585,7 @@ static u16 percent_to_mbw_max(u8 pc, struct mpam_props *cprops)
break;
}
- value &= GENMASK(15, 15 - cprops->bwa_wd);
+ value &= GENMASK(15, 15 - cprops->bwa_wd + 1);
return value;
}
--
2.25.1
^ permalink raw reply [flat|nested] 8+ messages in thread* [PATCH mpam/v6.10-rc1 RFC 3/4] arm_mpam: Correct the judgment condition of the CMAX feature
2024-07-22 4:01 [PATCH mpam/v6.10-rc1 RFC 0/4] arm_mpam: Fix several minor issues Zeng Heng
2024-07-22 4:01 ` [PATCH mpam/v6.10-rc1 RFC 1/4] arm_mpam: Correct MBA granularity calculation Zeng Heng
2024-07-22 4:01 ` [PATCH mpam/v6.10-rc1 RFC 2/4] arm_mpam: Fix the range calculation of the implemented bits Zeng Heng
@ 2024-07-22 4:01 ` Zeng Heng
2024-07-22 4:01 ` [PATCH mpam/v6.10-rc1 RFC 4/4] arm_mpam: Fix typo about mbw_min controls Zeng Heng
2024-12-20 17:51 ` [PATCH mpam/v6.10-rc1 RFC 0/4] arm_mpam: Fix several minor issues James Morse
4 siblings, 0 replies; 8+ messages in thread
From: Zeng Heng @ 2024-07-22 4:01 UTC (permalink / raw)
To: james.morse, rohit.mathew, amitsinght, sdonthineni
Cc: linux-arm-kernel, linux-kernel, zengheng4, liwei391
According to Arm Architecture MPAM Reference Manual (version DDI 0598D.b),
to check whether hardware supports the CMAX feature or not, not only needs
to check the CMAX_WD field of the MPAMF_CCAP_IDR register, but also needs
to check the NO_CMAX field.
Fixes: a275036b6767 ("arm_mpam: Probe and reset the rest of the features")
Signed-off-by: Zeng Heng <zengheng4@huawei.com>
---
drivers/platform/arm64/mpam/mpam_devices.c | 6 ++++--
drivers/platform/arm64/mpam/mpam_internal.h | 1 +
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/platform/arm64/mpam/mpam_devices.c b/drivers/platform/arm64/mpam/mpam_devices.c
index acb91352c524..9acac8a22573 100644
--- a/drivers/platform/arm64/mpam/mpam_devices.c
+++ b/drivers/platform/arm64/mpam/mpam_devices.c
@@ -779,8 +779,10 @@ static void mpam_ris_hw_probe(struct mpam_msc_ris *ris)
u32 ccap_features = mpam_read_partsel_reg(msc, CCAP_IDR);
props->cmax_wd = FIELD_GET(MPAMF_CCAP_IDR_CMAX_WD, ccap_features);
- if (props->cmax_wd)
- mpam_set_feature(mpam_feat_ccap_part, props);
+ if (props->cmax_wd) {
+ if (!FIELD_GET(MPAMF_CCAP_IDR_NO_CMAX, ccap_features))
+ mpam_set_feature(mpam_feat_ccap_part, props);
+ }
}
/* Cache Portion partitioning */
diff --git a/drivers/platform/arm64/mpam/mpam_internal.h b/drivers/platform/arm64/mpam/mpam_internal.h
index 61aea729aa73..0e714ce7fa96 100644
--- a/drivers/platform/arm64/mpam/mpam_internal.h
+++ b/drivers/platform/arm64/mpam/mpam_internal.h
@@ -450,6 +450,7 @@ void mpam_resctrl_exit(void);
/* MPAMF_CCAP_IDR - MPAM features cache capacity partitioning ID register */
#define MPAMF_CCAP_IDR_CMAX_WD GENMASK(5, 0)
+#define MPAMF_CCAP_IDR_NO_CMAX BIT(30)
/* MPAMF_MBW_IDR - MPAM features memory bandwidth partitioning ID register */
#define MPAMF_MBW_IDR_BWA_WD GENMASK(5, 0)
--
2.25.1
^ permalink raw reply [flat|nested] 8+ messages in thread* [PATCH mpam/v6.10-rc1 RFC 4/4] arm_mpam: Fix typo about mbw_min controls
2024-07-22 4:01 [PATCH mpam/v6.10-rc1 RFC 0/4] arm_mpam: Fix several minor issues Zeng Heng
` (2 preceding siblings ...)
2024-07-22 4:01 ` [PATCH mpam/v6.10-rc1 RFC 3/4] arm_mpam: Correct the judgment condition of the CMAX feature Zeng Heng
@ 2024-07-22 4:01 ` Zeng Heng
2024-12-20 17:51 ` [PATCH mpam/v6.10-rc1 RFC 0/4] arm_mpam: Fix several minor issues James Morse
4 siblings, 0 replies; 8+ messages in thread
From: Zeng Heng @ 2024-07-22 4:01 UTC (permalink / raw)
To: james.morse, rohit.mathew, amitsinght, sdonthineni
Cc: linux-arm-kernel, linux-kernel, zengheng4, liwei391
Correct the judgment condition about mbw_min default value.
Fixes: 099f47353bc5 ("arm_mpam: Generate a configuration for min controls")
Signed-off-by: Zeng Heng <zengheng4@huawei.com>
---
drivers/platform/arm64/mpam/mpam_devices.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/platform/arm64/mpam/mpam_devices.c b/drivers/platform/arm64/mpam/mpam_devices.c
index 9acac8a22573..64a1f1767a68 100644
--- a/drivers/platform/arm64/mpam/mpam_devices.c
+++ b/drivers/platform/arm64/mpam/mpam_devices.c
@@ -1483,7 +1483,7 @@ static void mpam_reprogram_ris_partid(struct mpam_msc_ris *ris, u16 partid,
}
if (mpam_has_feature(mpam_feat_mbw_min, rprops)) {
- if (mpam_has_feature(mpam_feat_mbw_max, cfg))
+ if (mpam_has_feature(mpam_feat_mbw_min, cfg))
mpam_write_partsel_reg(msc, MBW_MIN, cfg->mbw_min);
else
mpam_write_partsel_reg(msc, MBW_MIN, 0);
--
2.25.1
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: [PATCH mpam/v6.10-rc1 RFC 0/4] arm_mpam: Fix several minor issues
2024-07-22 4:01 [PATCH mpam/v6.10-rc1 RFC 0/4] arm_mpam: Fix several minor issues Zeng Heng
` (3 preceding siblings ...)
2024-07-22 4:01 ` [PATCH mpam/v6.10-rc1 RFC 4/4] arm_mpam: Fix typo about mbw_min controls Zeng Heng
@ 2024-12-20 17:51 ` James Morse
2025-01-04 10:28 ` Zeng Heng
4 siblings, 1 reply; 8+ messages in thread
From: James Morse @ 2024-12-20 17:51 UTC (permalink / raw)
To: Zeng Heng, rohit.mathew, amitsinght, sdonthineni
Cc: linux-arm-kernel, linux-kernel, liwei391
Hello!
On 22/07/2024 05:01, Zeng Heng wrote:
> After completing the necessary software adaptation for the local chipset,
> the MPAM function is successfully enabled. After related tests are
> completed, some issues were discovered and here attempt to fix them.
>
> Hope to get some suggestions for modifications, if I miss any rules should
> be followed, please let me know.
Sorry for the delay following these up - they should all be fixed in the newer
versions of the tree. I've added 'CC' tags to the patches you fixed here.
Thanks,
James
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: [PATCH mpam/v6.10-rc1 RFC 0/4] arm_mpam: Fix several minor issues
2024-12-20 17:51 ` [PATCH mpam/v6.10-rc1 RFC 0/4] arm_mpam: Fix several minor issues James Morse
@ 2025-01-04 10:28 ` Zeng Heng
0 siblings, 0 replies; 8+ messages in thread
From: Zeng Heng @ 2025-01-04 10:28 UTC (permalink / raw)
To: James Morse; +Cc: linux-arm-kernel, linux-kernel, Wangshaobo (bobo)
On 2024/12/21 1:51, James Morse wrote:
> Hello!
>
> On 22/07/2024 05:01, Zeng Heng wrote:
>> After completing the necessary software adaptation for the local chipset,
>> the MPAM function is successfully enabled. After related tests are
>> completed, some issues were discovered and here attempt to fix them.
>>
>> Hope to get some suggestions for modifications, if I miss any rules should
>> be followed, please let me know.
>
> Sorry for the delay following these up - they should all be fixed in the newer
> versions of the tree. I've added 'CC' tags to the patches you fixed here.
>
>
> Thanks,
>
> James
>
Thanks for your reply!
I have found they are all fixed in the latest branch already.
For the MPAM driver, I have updated the Narrow-PARTID feature patchset.
Please feel free to provide any comments or suggestions, if you were
available.
Here is the link to the v4 of the Narrow-PARTID feature:
https://lore.kernel.org/all/20250104101224.873926-1-zengheng4@huawei.com/
Thank you in advance.
Greetings for new year,
Zeng Heng
^ permalink raw reply [flat|nested] 8+ messages in thread