hulk inclusion category: feature bugzilla: https://atomgit.com/openeuler/kernel/issues/9840 ------------------ HIP13 supports disabling L2 cache entirely by setting CPBM (Cache Portion Bitmask) to zero. This capability is useful for L2 cache isolation scenarios where a task or group should not use any L2 cache. Signed-off-by: Zeng Heng <zengheng4@huawei.com> --- drivers/platform/mpam/mpam_devices.c | 10 ++++++++++ drivers/platform/mpam/mpam_internal.h | 1 + drivers/platform/mpam/mpam_resctrl.c | 2 +- 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/drivers/platform/mpam/mpam_devices.c b/drivers/platform/mpam/mpam_devices.c index 7180b253cf978..3c93dc6b2b1ca 100644 --- a/drivers/platform/mpam/mpam_devices.c +++ b/drivers/platform/mpam/mpam_devices.c @@ -1051,6 +1051,16 @@ static u64 mpam_csu_hisi_need_halved(struct mpam_msc_ris *ris, u64 now) return now >> 1; } +u32 mpam_min_cbm_bits(enum resctrl_res_level rid) +{ + if (rid == RDT_RESOURCE_L2) { + if (is_midr_in_range_list(hip13_cpus)) + return 0; + } + + return 1; +} + static bool read_msmon_mbwu_is_overflow(struct mpam_msc *msc) { u32 ctl; diff --git a/drivers/platform/mpam/mpam_internal.h b/drivers/platform/mpam/mpam_internal.h index 70d4abb93fd19..ce5af77e3d300 100644 --- a/drivers/platform/mpam/mpam_internal.h +++ b/drivers/platform/mpam/mpam_internal.h @@ -331,6 +331,7 @@ void mpam_resctrl_exit(void); u16 mpam_cpbm_wd_hisi_workaround(u16 cpbm_wd, enum mpam_device_features feat, u8 cache_level); bool mpam_cpbm_hisi_check_invalid(struct rdt_resource *r, unsigned long val); +u32 mpam_min_cbm_bits(enum resctrl_res_level rid); /* * MPAM MSCs have the following register layout. See: diff --git a/drivers/platform/mpam/mpam_resctrl.c b/drivers/platform/mpam/mpam_resctrl.c index 93d7d14753237..ce5a894b962ba 100644 --- a/drivers/platform/mpam/mpam_resctrl.c +++ b/drivers/platform/mpam/mpam_resctrl.c @@ -1130,7 +1130,7 @@ static int mpam_resctrl_resource_init(struct mpam_resctrl_res *res) r->cache.arch_has_sparse_bitmasks = true; /* mpam_devices will reject empty bitmaps */ - r->cache.min_cbm_bits = 1; + r->cache.min_cbm_bits = mpam_min_cbm_bits(res->resctrl_res.rid); /* TODO: kill these properties off as they are derivatives */ r->format_str = "%d=%0*x"; -- 2.43.0