Re: [PATCH v2 13/29] arm_mpam: Probe the hardware features resctrl supports

Fenghua Yu
2025-10-05T00:53:29Z

On 9/10/25 13:42, James Morse wrote:
> Expand the probing support with the control and monitor types
> we can use with resctrl.
>
> CC: Dave Martin <Dave.Martin@arm.com>
> Signed-off-by: James Morse <james.morse@arm.com>

Reviewed-by: Fenghua Yu <fenghuay@nvidia.com>

A couple of minor comments below.

> ---
> Changes since v1:
> * added an underscore to a variable name.
>
> Changes since RFC:
> * Made mpam_ris_hw_probe_hw_nrdy() more in C.
> * Added static assert on features bitmap size.
> ---
> drivers/resctrl/mpam_devices.c | 151 ++++++++++++++++++++++++++++++++
> drivers/resctrl/mpam_internal.h | 53 +++++++++++
> 2 files changed, 204 insertions(+)
>
> diff --git a/drivers/resctrl/mpam_devices.c b/drivers/resctrl/mpam_devices.c
> index a26b012452e2..ba8e8839cdc4 100644
> --- a/drivers/resctrl/mpam_devices.c
> +++ b/drivers/resctrl/mpam_devices.c
[SNIP]
> @@ -592,6 +736,7 @@ static int mpam_msc_hw_probe(struct mpam_msc *msc)
> mutex_lock(&msc->part_sel_lock);
> idr = mpam_msc_read_idr(msc);
> mutex_unlock(&msc->part_sel_lock);
> +

Adding this blank line is irrelevant to this patch. It's better to move
this blank line to the original patch #11.

> msc->ris_max = FIELD_GET(MPAMF_IDR_RIS_MAX, idr);
>
> /* Use these values so partid/pmg always starts with a valid value */
> @@ -614,6 +759,12 @@ static int mpam_msc_hw_probe(struct mpam_msc *msc)
> mutex_unlock(&mpam_list_lock);
> if (IS_ERR(ris))
> return PTR_ERR(ris);
> + ris->idr = idr;
> +
> + mutex_lock(&msc->part_sel_lock);
> + __mpam_part_sel(ris_idx, 0, msc);
> + mpam_ris_hw_probe(ris);
> + mutex_unlock(&msc->part_sel_lock);
> }
>
> spin_lock(&partid_max_lock);
> diff --git a/drivers/resctrl/mpam_internal.h b/drivers/resctrl/mpam_internal.h
> index 4cc44d4e21c4..5ae5d4eee8ec 100644
> --- a/drivers/resctrl/mpam_internal.h
> +++ b/drivers/resctrl/mpam_internal.h
> @@ -112,6 +112,55 @@ static inline void mpam_mon_sel_lock_init(struct mpam_msc *msc)
> raw_spin_lock_init(&msc->_mon_sel_lock);
> }
>
> +/*
> + * When we compact the supported features, we don't care what they are.
> + * Storing them as a bitmap makes life easy.
> + */
> +typedef u16 mpam_features_t;
> +

mpam_features_t is changed to u32 later in patch #21. It's better to
directly define it as u32 here and remove the type change in patch #21.

[SNIP]

Thanks.

-Fenghua