From: Gavin Shan <gshan@redhat.com>
To: Andre Przywara <andre.przywara@arm.com>,
Lorenzo Pieralisi <lpieralisi@kernel.org>,
Hanjun Guo <guohanjun@huawei.com>,
Sudeep Holla <sudeep.holla@kernel.org>,
Catalin Marinas <catalin.marinas@arm.com>,
Will Deacon <will@kernel.org>,
"Rafael J . Wysocki" <rafael@kernel.org>,
Len Brown <lenb@kernel.org>, James Morse <james.morse@arm.com>,
Ben Horgan <ben.horgan@arm.com>,
Reinette Chatre <reinette.chatre@intel.com>,
Fenghua Yu <fenghuay@nvidia.com>
Cc: Jonathan Cameron <jic23@kernel.org>,
Srivathsa L Rao <srivathsa.rao@oss.qualcomm.com>,
Ganapatrao Kulkarni <ganapatrao.kulkarni@oss.qualcomm.com>,
Trilok Soni <tsoni@quicinc.com>,
Srinivas Ramana <sramana@qti.qualcomm.com>,
Niyas Sait <niyas.sait@arm.com>, Lee Trager <lee@trager.us>,
Ritwick Sharma <ritwick.sharma@arm.com>,
linux-acpi@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v7 00/11] arm_mpam: Add MPAM-Fb firmware support
Date: Tue, 4 Aug 2026 13:29:04 +1000 [thread overview]
Message-ID: <6f8bc358-91a0-4c44-9110-c071e10df385@redhat.com> (raw)
In-Reply-To: <20260731170324.2927758-1-andre.przywara@arm.com>
On 8/1/26 3:03 AM, Andre Przywara wrote:
> v7 is another quick respin of the MPAM-Fb code, for firmware based MSC
> accesses. This propagates MSC access errors in a function where it was
> missing before, covering more functions that pass their return value
> to userspace (new patch 07/11). Also some bug fixes, formatting
> adjustments and adding the accumulated tags - many thanks to the
> reviewers. Find the changelog below. Based on v7.2-rc1.
>
> =======================
> The Arm MPAM specification defines Memory System Components (MSCs),
> which are devices that are programmed through an MMIO register frame. In
> some occasions this turned out to be too limiting: the MSC might be
> located behind a separate bus system (for instance inside an on-board
> controller), it might be mapped secure-only, or in a different processor
> socket without direct MMIO mapping. Also the MMIO access might be too slow
> or it would need to be filtered or otherwise access controlled. Finally
> there might be bugs in the MSC integration, which require a mediating
> firmware to be accessible.
>
> To accommodate all those different use cases, the MPAM-Fb specification
> [1] describes an alternative way to access MSCs. Accesses to an MSC
> would be wrapped in a message and communicated to the system using a
> shared-memory/mailbox system mostly mimicking the Arm SCMI spec.
> For ACPI systems, this would be abstracted through an ACPI PCC channel,
> which provides the shared-memory region and the mailbox trigger. We can
> lean on existing ACPI parsing code to register with these two
> subsystems, but cannot rely on the existing SCMI code in the kernel.
> This means we somewhat need to open code a very simplified SCMI handler,
> which just provides enough functionality for the very basic subset of
> SCMI that the MPAM-Fb spec requires.
>
> The first seven patches rework all MSC access wrappers to propagate error
> information. Pure MMIO based MSC accesses would never fail, but the
> MPAM-Fb access can go wrong in multiple ways. The patches have been split
> up purely for reviewing reasons, if the number is a problem, we could as
> well squash them. Please note that until the very last patch of this series
> any MSC accesses would always only return 0, it's only the final enablement
> of MPAM-Fb that could possibly introduce errors. Hence all former patches
> can add error handling gradually, those code paths wouldn't be triggered
> before patch 11/11.
> Patch 8/11 solves a nasty problem: At the moment we protect stateful MSC
> register accesses (mon_sel) through a spinlock. Unfortunately the mailbox
> subsystem and the slow nature of the communication through this channel
> forbid MPAM-Fb access in atomic context. So this patch keeps using a
> spinlock for MMIO based accesses, but reverts to a mutex otherwise.
> We just deny taking the lock for MPAM-Fb in atomic context, ideally we
> wouldn't need that (no need to IPI another core when the MSC access does
> not need to be local to one particular core), or we simply deny that part
> of the functionality (access through perf).
> Patch 9/11 adds the code to redirect MSC accesses through the
> PCC shmem/mailbox system.
> Patch 10/11 reworks the error interrupt handler to use a threaded IRQ for
> MPAM-Fb, to be able to do MPAM-Fb MSC accesses inside (which might sleep).
> The final patch 11/11 then adds the code to detect and store the PCC
> channel information from the ACPI tables, and eventually enables
> MPAM-Fb accesses.
>
> This would enable systems where some MSCs are not accessible via MMIO to
> use those components anyway.
>
> Please have a look and test!
>
> Cheers,
> Andre
>
> [1] https://developer.arm.com/documentation/den0144/latest
>
> Changes in v7:
> - add tags
> - add new patch to propagate errors in mpam_reprogram_ris_partid()
> - prevent loop when mpam_diable() tries MSC accesses again
> - register MMIO error IRQ handler without IRQF_ONESHOT
> - re-use existing "err" variable instead of declaring "ret"
> - initialise mon_sel_lock later, to wait for interface decision
> - convert timeout units for nominal latency, between us and ms
>
[...]
>
> Andre Przywara (11):
> arm_mpam: let low level MSC accessors return an error
> arm_mpam: propagate MSC access errors for hw_probe functions
> arm_mpam: propagate MSC access errors for MBWU counters
> arm_mpam: propagate MSC access errors for msmon helpers
> arm_mpam: propagate MSC access errors for __ris_msmon_read()
> arm_mpam: propagate MSC access errors for state saving function
> arm_mpam: propagate MSC access errors for mpam_reprogram_ris_partid()
> arm_mpam: prepare mon_sel locking for MPAM-Fb
> arm_mpam: add MPAM-Fb MSC firmware access support
> arm_mpam: change MPAM-Fb error IRQ to use a threaded IRQ handler
> arm_mpam: detect and enable MPAM-Fb PCC support
>
> drivers/resctrl/Makefile | 2 +-
> drivers/resctrl/mpam_devices.c | 820 +++++++++++++++++++++++---------
> drivers/resctrl/mpam_fb.c | 250 ++++++++++
> drivers/resctrl/mpam_internal.h | 62 ++-
> include/linux/arm_mpam.h | 2 +-
> 5 files changed, 915 insertions(+), 221 deletions(-)
> create mode 100644 drivers/resctrl/mpam_fb.c
>
With this series (manually) applied to v7.2.rc6, the tests for the existing functions
like kunit-tests, L3 cache partitioning, MBW (soft) limiting, llc_occupancy monitor
look fine on NVidia's grace-hopper machine.
Tested-by: Gavin Shan <gshan@redhat.com>
Thanks,
Gavin
next prev parent reply other threads:[~2026-08-04 3:29 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-31 17:03 [PATCH v7 00/11] arm_mpam: Add MPAM-Fb firmware support Andre Przywara
2026-07-31 17:03 ` [PATCH v7 01/11] arm_mpam: let low level MSC accessors return an error Andre Przywara
2026-08-04 3:38 ` Gavin Shan
2026-07-31 17:03 ` [PATCH v7 02/11] arm_mpam: propagate MSC access errors for hw_probe functions Andre Przywara
2026-08-04 3:42 ` Gavin Shan
2026-07-31 17:03 ` [PATCH v7 03/11] arm_mpam: propagate MSC access errors for MBWU counters Andre Przywara
2026-08-04 3:43 ` Gavin Shan
2026-07-31 17:03 ` [PATCH v7 04/11] arm_mpam: propagate MSC access errors for msmon helpers Andre Przywara
2026-08-04 3:48 ` Gavin Shan
2026-07-31 17:03 ` [PATCH v7 05/11] arm_mpam: propagate MSC access errors for __ris_msmon_read() Andre Przywara
2026-08-03 17:23 ` Ben Horgan
2026-08-03 22:13 ` Jonathan Cameron
2026-08-04 3:51 ` Gavin Shan
2026-07-31 17:03 ` [PATCH v7 06/11] arm_mpam: propagate MSC access errors for state saving function Andre Przywara
2026-08-03 22:17 ` Jonathan Cameron
2026-08-04 3:53 ` Gavin Shan
2026-07-31 17:03 ` [PATCH v7 07/11] arm_mpam: propagate MSC access errors for mpam_reprogram_ris_partid() Andre Przywara
2026-08-03 17:22 ` Ben Horgan
2026-08-03 22:28 ` Jonathan Cameron
2026-08-04 9:15 ` Andre Przywara
2026-08-04 3:56 ` Gavin Shan
2026-08-04 5:57 ` Srivathsa L Rao
2026-08-04 9:54 ` Andre Przywara
2026-07-31 17:03 ` [PATCH v7 08/11] arm_mpam: prepare mon_sel locking for MPAM-Fb Andre Przywara
2026-08-03 17:24 ` Ben Horgan
2026-08-04 3:58 ` Gavin Shan
2026-07-31 17:03 ` [PATCH v7 09/11] arm_mpam: add MPAM-Fb MSC firmware access support Andre Przywara
2026-08-04 6:09 ` Gavin Shan
2026-08-04 6:36 ` Gavin Shan
2026-07-31 17:03 ` [PATCH v7 10/11] arm_mpam: change MPAM-Fb error IRQ to use a threaded IRQ handler Andre Przywara
2026-08-03 17:30 ` Ben Horgan
2026-08-03 22:46 ` Jonathan Cameron
2026-08-04 8:09 ` Andre Przywara
2026-07-31 17:03 ` [PATCH v7 11/11] arm_mpam: detect and enable MPAM-Fb PCC support Andre Przywara
2026-08-03 10:49 ` Srivathsa L Rao
2026-08-03 13:37 ` Andre Przywara
2026-08-03 14:53 ` Andre Przywara
2026-08-03 17:04 ` [PATCH] FIX: avoid using mailbox client dev pointer for error prints Andre Przywara
2026-08-03 17:35 ` Ben Horgan
2026-08-04 3:29 ` Gavin Shan [this message]
2026-08-04 8:50 ` [PATCH v7 00/11] arm_mpam: Add MPAM-Fb firmware support Andre Przywara
2026-08-04 8:56 ` Gavin Shan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=6f8bc358-91a0-4c44-9110-c071e10df385@redhat.com \
--to=gshan@redhat.com \
--cc=andre.przywara@arm.com \
--cc=ben.horgan@arm.com \
--cc=catalin.marinas@arm.com \
--cc=fenghuay@nvidia.com \
--cc=ganapatrao.kulkarni@oss.qualcomm.com \
--cc=guohanjun@huawei.com \
--cc=james.morse@arm.com \
--cc=jic23@kernel.org \
--cc=lee@trager.us \
--cc=lenb@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lpieralisi@kernel.org \
--cc=niyas.sait@arm.com \
--cc=rafael@kernel.org \
--cc=reinette.chatre@intel.com \
--cc=ritwick.sharma@arm.com \
--cc=sramana@qti.qualcomm.com \
--cc=srivathsa.rao@oss.qualcomm.com \
--cc=sudeep.holla@kernel.org \
--cc=tsoni@quicinc.com \
--cc=will@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox