Re: [RFC PATCH 08/38] arm_mpam: resctrl: Pick the caches we will use as resctrl resources

From: Ben Horgan
Date: Tue Dec 09 2025 - 10:57:18 EST


Hi James,

On 12/5/25 21:58, James Morse wrote:
> 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-know 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@xxxxxxx>
> ---
> drivers/resctrl/mpam_resctrl.c | 91 +++++++++++++++++++++++++++++++++-
> 1 file changed, 89 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/resctrl/mpam_resctrl.c b/drivers/resctrl/mpam_resctrl.c
> index 320cebbd37ce..ceaf11af4fc1 100644
> --- a/drivers/resctrl/mpam_resctrl.c
> +++ b/drivers/resctrl/mpam_resctrl.c
> @@ -60,10 +60,96 @@ 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);
> +}

cpbm_wd > 32 is not support properly in mpam_devices.c (e.g. reset and
config value are limited to 32 bits.) and so we should consider just not
adding the feature to the class in that case.

Thanks,

Ben