From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6404E33971E for ; Fri, 19 Dec 2025 12:19:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766146782; cv=none; b=uRMK2ViOhS1tsya/BlBDXN8ypNTpkQTUEJRn43CGJf+B14o6JufDzZk8byXkyr8LBjWqzsZhzs8ECiEgmrLHwZt8BZapXJVuW19ZRXpuh0KjmrW0TGulN8MyB4I7lItZ76kI5RDG5WfhwOFxCbvmLOr/7s3yfEUp2+ZLkf5i1E0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766146782; c=relaxed/simple; bh=5vRRiqpNxLoBRfLHaPkiw6vJCBAGlRMHJrytjOyb284=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=QKEJOcxgYgl2CKwx1OJ9r2YDp87gN+UKpqpAHrH60nVXr1rBGsrdlxN8XmMWu9HCd8h2cxDSwf8KJPy8pmN8DPjOC1PqK2GqH1vWTZcgZEmIUi5c+lFkc6czihDJBu0byS+BDxLVv771WN6AH/nf5JxB91DAWaNUdfaSQE0AHik= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 92229106F; Fri, 19 Dec 2025 04:19:32 -0800 (PST) Received: from [10.1.196.46] (e134344.arm.com [10.1.196.46]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 663093F762; Fri, 19 Dec 2025 04:19:36 -0800 (PST) Message-ID: <36aae6f9-e819-4a12-bad3-d7f6b3c45caf@arm.com> Date: Fri, 19 Dec 2025 12:19:35 +0000 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [RFC PATCH 34/38] arm_mpam: Add quirk framework To: Jonathan Cameron , James Morse Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, D Scott Phillips OS , carl@os.amperecomputing.com, lcherian@marvell.com, bobo.shaobowang@huawei.com, tan.shaopeng@fujitsu.com, baolin.wang@linux.alibaba.com, Jamie Iles , Xin Hao , peternewman@google.com, dfustini@baylibre.com, amitsinght@marvell.com, David Hildenbrand , Dave Martin , Koba Ko , Shanker Donthineni , fenghuay@nvidia.com, baisheng.gao@unisoc.com, Gavin Shan , rohit.mathew@arm.com, reinette.chatre@intel.com, Punit Agrawal References: <20251205215901.17772-1-james.morse@arm.com> <20251205215901.17772-35-james.morse@arm.com> <20251218140401.000062ce@huawei.com> From: Ben Horgan Content-Language: en-US In-Reply-To: <20251218140401.000062ce@huawei.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit 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 wrote: > >> From: Shanker Donthineni >> >> 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 >> [ 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 >> --- >> 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