Re: [PATCH v2 17/45] arm_mpam: resctrl: Pick the caches we will use as resctrl resources
From: Jonathan Cameron <jonathan.cameron@huawei.com>
Date: 2026-01-05 17:46:37
Also in:
kvmarm, lkml
On Fri, 19 Dec 2025 18:11:19 +0000 Ben Horgan [off-list ref] wrote:
From: James Morse <james.morse@arm.com> Systems with MPAM support may have a variety of control types at any point of their system layout. We can only expose certain types of control, and only if they exist at particular locations. Start with the well-known caches. These have to be depth 2 or 3 and support MPAM's cache portion bitmap controls, with a number of portions fewer than resctrl's limit. Signed-off-by: James Morse <james.morse@arm.com> Signed-off-by: Ben Horgan <ben.horgan@arm.com>
Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com> Note that I'm far from familiar with all the details of the resctl side of things so assuming that will be well covered by other reviewers! Jonathan
quoted hunk ↗ jump to hunk
--- Changes since rfc: Jonathan: Remove brackets Compress debug message Use temp var, r --- drivers/resctrl/mpam_resctrl.c | 90 +++++++++++++++++++++++++++++++++- 1 file changed, 88 insertions(+), 2 deletions(-)diff --git a/drivers/resctrl/mpam_resctrl.c b/drivers/resctrl/mpam_resctrl.c index 5481d9cc69d9..bc4f1c80eab5 100644 --- a/drivers/resctrl/mpam_resctrl.c +++ b/drivers/resctrl/mpam_resctrl.c@@ -60,10 +60,95 @@ struct rdt_resource *resctrl_arch_get_resource(enum resctrl_res_level l) return &mpam_resctrl_controls[l].resctrl_res; } +static bool cache_has_usable_cpor(struct mpam_class *class) +{ + struct mpam_props *cprops = &class->props; + + if (!mpam_has_feature(mpam_feat_cpor_part, cprops)) + return false; + + /* resctrl uses u32 for all bitmap configurations */ + return class->props.cpbm_wd <= 32; +}