From: Wang ShaoBo bobo.shaobowang@huawei.com
hulk inclusion category: feature bugzilla: 34278 CVE: NA
-------------------------------------------------
Now mpam sysprops have been probed, maximum support of partid and pmg should be exported to resctrl.
For MPAM, Processing elements (PEs) issue memory-system requests, PEs must implement the MPAMn_ELx registers and their behaviors to generate the PARTID and PMG fields of memory-system requests.
For resctrl, partid and pmg should be used to combined into a unique rmid for labeling each group, and partid for determining the maximum number of ctrl groups.
Signed-off-by: Wang ShaoBo bobo.shaobowang@huawei.com Reviewed-by: Xiongfeng Wang wangxiongfeng2@huawei.com Reviewed-by: Cheng Jian cj.chengjian@huawei.com Signed-off-by: Yang Yingliang yangyingliang@huawei.com Signed-off-by: Cheng Jian cj.chengjian@huawei.com --- arch/arm64/kernel/mpam/mpam_device.c | 12 ++++++++++++ arch/arm64/kernel/mpam/mpam_internal.h | 3 +++ 2 files changed, 15 insertions(+)
diff --git a/arch/arm64/kernel/mpam/mpam_device.c b/arch/arm64/kernel/mpam/mpam_device.c index e14d8edbafd6..a72d5f0251a9 100644 --- a/arch/arm64/kernel/mpam/mpam_device.c +++ b/arch/arm64/kernel/mpam/mpam_device.c @@ -676,3 +676,15 @@ void __init mpam_discovery_failed(void) } mutex_unlock(&mpam_devices_lock); } + +u16 mpam_sysprops_num_partid(void) +{ + /* At least one partid for system width */ + return mpam_sysprops.max_partid + 1; +} + +u16 mpam_sysprops_num_pmg(void) +{ + /* At least one pmg for system width */ + return mpam_sysprops.max_pmg + 1; +} diff --git a/arch/arm64/kernel/mpam/mpam_internal.h b/arch/arm64/kernel/mpam/mpam_internal.h index 24b26dc0e3d0..2579d111d7df 100644 --- a/arch/arm64/kernel/mpam/mpam_internal.h +++ b/arch/arm64/kernel/mpam/mpam_internal.h @@ -48,4 +48,7 @@ static inline void mpam_clear_feature(enum mpam_device_features feat,
#define MPAM_ARCHITECTURE_V1 0x10
+u16 mpam_sysprops_num_partid(void); +u16 mpam_sysprops_num_pmg(void); + #endif