arm_mpam: Fix several minor issues
cover arm_mpam: Fix several minor issues
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.
Zeng Heng (4):
arm_mpam: Correct MBA granularity calculation
arm_mpam: Fix the range calculation of the implemented bits
arm_mpam: Correct the judgment condition of the CMAX feature
arm_mpam: Fix typo about mbw_min controls
drivers/platform/arm64/mpam/mpam_devices.c | 8 +++++--- drivers/platform/arm64/mpam/mpam_internal.h | 1 + drivers/platform/arm64/mpam/mpam_resctrl.c | 4 ++-- 3 files changed, 8 insertions(+), 5 deletions(-)
--
2.25.1
RFC PATCH 1/4 arm_mpam: Correct MBA granularity calculation
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".
--- drivers/platform/arm64/mpam/mpam_resctrl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/platform/arm64/mpam/mpam_resctrl.c +1 -1
@@ -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 ;
Signature · 1 line
2.25.1
RFC PATCH 2/4 arm_mpam: Fix the range calculation of the implemented bits
In reply to Zeng HengThe 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].
--- drivers/platform/arm64/mpam/mpam_resctrl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/platform/arm64/mpam/mpam_resctrl.c +1 -1
@@ -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; }
Signature · 1 line
2.25.1
RFC PATCH 3/4 arm_mpam: Correct the judgment condition of the CMAX feature
In reply to Zeng HengAccording 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.
--- drivers/platform/arm64/mpam/mpam_devices.c | 6 ++++-- drivers/platform/arm64/mpam/mpam_internal.h | 1 + 2 files changed, 5 insertions(+), 2 deletions(-)
drivers/platform/arm64/mpam/mpam_devices.c +4 -2
@@ -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 */
drivers/platform/arm64/mpam/mpam_internal.h +1 -0
@@ -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)
Signature · 1 line
2.25.1
RFC PATCH 4/4 arm_mpam: Fix typo about mbw_min controls
In reply to Zeng HengCorrect the judgment condition about mbw_min default value.
--- drivers/platform/arm64/mpam/mpam_devices.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/platform/arm64/mpam/mpam_devices.c +1 -1
@@ -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 );
Signature · 1 line
2.25.1
Hello!
Quoted 6 lines · Zeng Heng
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
Quoted 10 lines · James Morse
Hello!
Quoted 6 lines · Zeng Heng
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.
Quoted 8 lines
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/[email protected]/
Thank you in advance.
Greetings for new year,
Zeng Heng