
hulk inclusion category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I8T2RT -------------------------------- Support both of CPBM and MBW_PBM features, which provides the cache and memory bandwidth portion bitmap. User can update PBM settings by the interface {L2,L3,MBPBM}:$domain_id=$value in the schemata file. Software would update the MPAMCFG_CPBM<n> register to configure which cache portions the PARTID is allowed to allocate. Signed-off-by: Zeng Heng <zengheng4@huawei.com> --- drivers/platform/mpam/mpam_resctrl.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/drivers/platform/mpam/mpam_resctrl.c b/drivers/platform/mpam/mpam_resctrl.c index d4c770389aee..994c1c6e06c4 100644 --- a/drivers/platform/mpam/mpam_resctrl.c +++ b/drivers/platform/mpam/mpam_resctrl.c @@ -68,6 +68,7 @@ bool resctrl_arch_mon_capable(void) return exposed_mon_capable; } +static bool pbm_capable[RDT_NUM_RESOURCES]; static bool max_capable[RDT_NUM_RESOURCES]; static bool min_capable[RDT_NUM_RESOURCES]; static bool intpri_capable[RDT_NUM_RESOURCES]; @@ -76,9 +77,7 @@ bool resctrl_arch_feat_capable(enum resctrl_res_level level, { switch (feat) { case FEAT_PBM: - if (level == RDT_RESOURCE_L3) - return true; - break; + return pbm_capable[level]; case FEAT_MAX: return max_capable[level]; @@ -100,6 +99,11 @@ const char *resctrl_arch_set_feat_lab(enum resctrl_feat_type feat, unsigned long fflags) { switch (feat) { + case FEAT_PBM: + if (fflags & RFTYPE_RES_CACHE) + break; + return "PBM"; + case FEAT_MAX: if (fflags & RFTYPE_RES_MB) break; @@ -813,6 +817,7 @@ static int mpam_resctrl_resource_init(struct mpam_resctrl_res *res) if (mpam_has_feature(mpam_feat_cpor_part, &class->props)) { r->alloc_capable = true; exposed_alloc_capable = true; + pbm_capable[r->rid] = true; } if (mpam_has_feature(mpam_feat_ccap_part, &class->props)) @@ -865,6 +870,9 @@ static int mpam_resctrl_resource_init(struct mpam_resctrl_res *res) r->alloc_capable = true; exposed_alloc_capable = true; + if (mpam_has_feature(mpam_feat_mbw_part, cprops)) + pbm_capable[r->rid] = true; + if (mpam_has_feature(mpam_feat_mbw_max, cprops)) max_capable[r->rid] = true; } @@ -1032,6 +1040,11 @@ 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)) { + if (configured_by == mpam_feat_cpor_part) + return BIT_MASK(cprops->cpbm_wd) - 1; + if (configured_by == mpam_feat_mbw_part) + return BIT_MASK(cprops->mbw_pbm_bits) - 1; + if ((configured_by == mpam_feat_ccap_part) || (configured_by == mpam_feat_mbw_max)) return MAX_MBA_BW; -- 2.25.1