[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <36aae6f9-e819-4a12-bad3-d7f6b3c45caf@arm.com>
Date: Fri, 19 Dec 2025 12:19:35 +0000
From: Ben Horgan <ben.horgan@....com>
To: Jonathan Cameron <jonathan.cameron@...wei.com>,
James Morse <james.morse@....com>
Cc: linux-kernel@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
D Scott Phillips OS <scott@...amperecomputing.com>,
carl@...amperecomputing.com, lcherian@...vell.com,
bobo.shaobowang@...wei.com, tan.shaopeng@...itsu.com,
baolin.wang@...ux.alibaba.com, Jamie Iles <quic_jiles@...cinc.com>,
Xin Hao <xhao@...ux.alibaba.com>, peternewman@...gle.com,
dfustini@...libre.com, amitsinght@...vell.com,
David Hildenbrand <david@...nel.org>, Dave Martin <dave.martin@....com>,
Koba Ko <kobak@...dia.com>, Shanker Donthineni <sdonthineni@...dia.com>,
fenghuay@...dia.com, baisheng.gao@...soc.com, Gavin Shan <gshan@...hat.com>,
rohit.mathew@....com, reinette.chatre@...el.com,
Punit Agrawal <punit.agrawal@....qualcomm.com>
Subject: Re: [RFC PATCH 34/38] arm_mpam: Add quirk framework
Hi Jonathan,
Thanks for your review. I haven't replied to every point but unless
commented I have acted on them.
On 12/18/25 14:04, Jonathan Cameron wrote:
> On Fri, 5 Dec 2025 21:58:57 +0000
> James Morse <james.morse@....com> wrote:
>
>> From: Shanker Donthineni <sdonthineni@...dia.com>
>>
>> The MPAM specification includes the MPAMF_IIDR, which serves to
>> uniquely identify the MSC implementation through a combination of
>> implementer details, product ID, variant, and revision. Certain
>> hardware issues/errata can be resolved using software workarounds.
>>
>> Introduce a quirk framework to allow workarounds to be enabled based
>> on the MPAMF_IIDR value.
>>
>> Signed-off-by: Shanker Donthineni <sdonthineni@...dia.com>
>> [ morse: Stash the IIDR so this doesn't need an IPI, enable quirks only
>> once, move the description to the callback so it can be pr_once()d, add
>> an enum of workarounds for popular errata. Add macros for making lists
>> of product/revision/vendor half readable ]
>> Signed-off-by: James Morse <james.morse@....com>
>> ---
>> drivers/resctrl/mpam_devices.c | 27 +++++++++++++++++++++++++++
>> drivers/resctrl/mpam_internal.h | 26 ++++++++++++++++++++++++++
>> 2 files changed, 53 insertions(+)
>>
>> diff --git a/drivers/resctrl/mpam_devices.c b/drivers/resctrl/mpam_devices.c
>> index 741e14e1e6cf..f0f6f9b55ad4 100644
>> --- a/drivers/resctrl/mpam_devices.c
>> +++ b/drivers/resctrl/mpam_devices.c
>> @@ -630,6 +630,25 @@ static struct mpam_msc_ris *mpam_get_or_create_ris(struct mpam_msc *msc,
>> return ERR_PTR(-ENOENT);
>> }
>>
>> +static const struct mpam_quirk mpam_quirks[] = {
>> + { NULL }, /* Sentinel */
>
> Drop the trailing , given I assume whole point is nothing after this?
>
>> +};
>> +
>> +static void mpam_enable_quirks(struct mpam_msc *msc)
>> +{
>> + const struct mpam_quirk *quirk;
>> +
>> + for (quirk = &mpam_quirks[0]; quirk->iidr_mask; quirk++) {
>> + if (quirk->iidr != (msc->iidr & quirk->iidr_mask))
>> + continue;
>> +
>> + if (quirk->init)
>> + quirk->init(msc, quirk);
>
> I'm curious why you don't return a bool from this and call
> mpam_set_quirk() if that's not indicating it should not be set.
> Seems a bit odd to push the tracking that is relevant to the generic
> framework (mpam_set_quirk) down into the particular quirk inits.
Good point. I've changed the init to return 0 or an error.
>
>> + else
>> + mpam_set_quirk(quirk->workaround, msc);
>> + }
>> +}
>
>> diff --git a/drivers/resctrl/mpam_internal.h b/drivers/resctrl/mpam_internal.h
>> index d381906545ed..de3e5faa12b2 100644
>> --- a/drivers/resctrl/mpam_internal.h
>> +++ b/drivers/resctrl/mpam_internal.h
>> @@ -88,6 +88,8 @@ struct mpam_msc {
>> u8 pmg_max;
>> unsigned long ris_idxs;
>> u32 ris_max;
>> + u32 iidr;
>> + u16 quirks;
>>
>> /*
>> * error_irq_lock is taken when registering/unregistering the error
>> @@ -215,6 +217,29 @@ struct mpam_props {
>> #define mpam_set_feature(_feat, x) set_bit(_feat, (x)->features)
>> #define mpam_clear_feature(_feat, x) clear_bit(_feat, (x)->features)
>>
>> +/* Workaround bits for msc->quirks */
>> +enum mpam_device_quirks {
>> + MPAM_QUIRK_LAST,
>
> Dropping this comma should make it harder for anyone to stick an entry
> after this.
Commas removed.
Thanks,
Ben
Powered by blists - more mailing lists