Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Sudeep Holla <sudeep.holla@kernel.org>
To: Andre Przywara <andre.przywara@arm.com>
Cc: Lorenzo Pieralisi <lpieralisi@kernel.org>,
	Hanjun Guo <guohanjun@huawei.com>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Sudeep Holla <sudeep.holla@kernel.org>,
	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>,
	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>,
	linux-acpi@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v4 08/10] arm_mpam: add MPAM-Fb MSC firmware access support
Date: Fri, 24 Jul 2026 13:22:18 +0100	[thread overview]
Message-ID: <20260724-romantic-stoic-hippo-3f897b@sudeepholla> (raw)
In-Reply-To: <9d5fd63a-5e9d-4e44-8f63-864764caf20d@arm.com>

On Fri, Jul 24, 2026 at 01:17:41PM +0200, Andre Przywara wrote:
> Hi Sudeep,
> 
> many thanks for having a look!
> 
> On 7/24/26 11:55, Sudeep Holla wrote:
> > On Thu, Jul 23, 2026 at 05:54:52PM +0200, Andre Przywara wrote:
> > > The Arm MPAM Firmware-backed (Fb) Profile document[1] describes an
> > > alternative way of accessing the "Memory System Components" (MSC) in an
> > > MPAM enabled system.
> > > 
> > > Normally the MSCs are MMIO mapped, but in some implementations this
> > > might not be possible (MSC located outside of the local socket, MSC
> > > mapped secure-only) or desirable (direct MMIO access too slow or needs
> > > to be mediated through a control processor). MPAM-fb standardises a
> > > protocol to abstract MSC accesses, building on the SCMI protocol.
> > > 
> > > Add functions that do an MSC read or write access by redirecting the
> > > request through a firmware interface. For now this done via an ACPI
> > > PCC shared memory and mailbox combination.
> > > 
> > > Since the protocol used is only a small subset of the full SCMI spec,
> > > and the SCMI protocol has no full ACPI support anyway, open-code the
> > > (simple) SCMI message generation, for just the fields we need.
> > > 
> > > [1] https://developer.arm.com/documentation/den0144/latest
> > > 
> > > Signed-off-by: Andre Przywara <andre.przywara@arm.com>
> > > ---
> > >   drivers/resctrl/Makefile        |   2 +-
> > >   drivers/resctrl/mpam_devices.c  |  27 ++++-
> > >   drivers/resctrl/mpam_fb.c       | 197 ++++++++++++++++++++++++++++++++
> > >   drivers/resctrl/mpam_internal.h |  20 ++++
> > >   include/linux/arm_mpam.h        |   2 +-
> > >   5 files changed, 240 insertions(+), 8 deletions(-)
> > >   create mode 100644 drivers/resctrl/mpam_fb.c
> > > 
> > > diff --git a/drivers/resctrl/Makefile b/drivers/resctrl/Makefile
> > > index 4f6d0e81f9b8..097c036724e9 100644
> > > --- a/drivers/resctrl/Makefile
> > > +++ b/drivers/resctrl/Makefile
> > > @@ -1,5 +1,5 @@
> > >   obj-$(CONFIG_ARM64_MPAM_DRIVER)			+= mpam.o
> > > -mpam-y						+= mpam_devices.o
> > > +mpam-y						+= mpam_devices.o mpam_fb.o
> > >   mpam-$(CONFIG_ARM64_MPAM_RESCTRL_FS)		+= mpam_resctrl.o
> > >   ccflags-$(CONFIG_ARM64_MPAM_DRIVER_DEBUG)	+= -DDEBUG
> > > diff --git a/drivers/resctrl/mpam_devices.c b/drivers/resctrl/mpam_devices.c
> > > index e2cb884eacf4..b8108ed4b32c 100644
> > > --- a/drivers/resctrl/mpam_devices.c
> > > +++ b/drivers/resctrl/mpam_devices.c
> > > @@ -181,6 +181,9 @@ static int __mpam_read_reg(struct mpam_msc *msc, u16 reg, u32 *res)
> > >   {
> > >   	WARN_ON_ONCE(!cpumask_test_cpu(smp_processor_id(), &msc->accessibility));
> > > 
> > 
> > The above doesn't make any sense for PCC accesses, perhaps need to be pushed
> > down ?
> 
> Well, the idea was that the mask would always encompass all CPUs when using
> MPAM-Fb, but to consider this an implementation detail of MPAM-Fb.
> We can of course move this out of the way for MPAM-Fb.
> 

I prefer that.

> > 
> > > +	if (msc->iface == MPAM_IFACE_PCC)
> > > +		return mpam_fb_send_read_request(msc, reg, res);
> > > +
> > >   	*res = readl_relaxed(msc->mapped_hwpage + reg);
> > >   	return 0;
> > > @@ -197,9 +200,12 @@ static inline int _mpam_read_partsel_reg(struct mpam_msc *msc, u16 reg,
> > >   static int __mpam_write_reg(struct mpam_msc *msc, u16 reg, u32 val)
> > >   {
> > > -	WARN_ON_ONCE(reg + sizeof(u32) > msc->mapped_hwpage_sz);
> > >   	WARN_ON_ONCE(!cpumask_test_cpu(smp_processor_id(), &msc->accessibility));
> > 
> 
> And by the way: I think the hwpage_sz check should belong to the probe
> function, not be done on every access. Or are there optional registers that
> might not be part of the mapping on devices that don't support them?
> 

No, I was just referring the cpumask and not hwpage_sz check.

-- 
Regards,
Sudeep


  reply	other threads:[~2026-07-24 12:22 UTC|newest]

Thread overview: 52+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-23 15:54 [PATCH v4 00/10] arm_mpam: Add MPAM-Fb firmware support Andre Przywara
2026-07-23 15:54 ` [PATCH v4 01/10] arm_mpam: let low level MSC accessors return an error Andre Przywara
2026-07-27 22:12   ` Jonathan Cameron
2026-07-28 15:35     ` Andre Przywara
2026-07-23 15:54 ` [PATCH v4 02/10] arm_mpam: propagate MSC access errors for hw_probe functions Andre Przywara
2026-07-27 22:21   ` Jonathan Cameron
2026-07-23 15:54 ` [PATCH v4 03/10] arm_mpam: propagate MSC access errors for MBWU counters Andre Przywara
2026-07-27 22:37   ` Jonathan Cameron
2026-07-23 15:54 ` [PATCH v4 04/10] arm_mpam: propagate MSC access errors for msmon helpers Andre Przywara
2026-07-27 22:41   ` Jonathan Cameron
2026-07-23 15:54 ` [PATCH v4 05/10] arm_mpam: propagate MSC access errors for __ris_msmon_read() Andre Przywara
2026-07-24 10:02   ` Sudeep Holla
2026-07-24 11:17     ` Andre Przywara
2026-07-24 12:19       ` Sudeep Holla
2026-07-27 22:44   ` Jonathan Cameron
2026-07-23 15:54 ` [PATCH v4 06/10] arm_mpam: propagate MSC access errors for state saving function Andre Przywara
2026-07-24 10:07   ` Sudeep Holla
2026-07-24 11:19     ` Andre Przywara
2026-07-24 12:27       ` Sudeep Holla
2026-07-24 16:43         ` Ben Horgan
2026-07-27 22:51           ` Jonathan Cameron
2026-07-28  8:43             ` Ben Horgan
2026-07-27 22:46   ` Jonathan Cameron
2026-07-23 15:54 ` [PATCH v4 07/10] arm_mpam: prepare mon_sel locking for MPAM-Fb Andre Przywara
2026-07-24 16:56   ` Ben Horgan
2026-07-23 15:54 ` [PATCH v4 08/10] arm_mpam: add MPAM-Fb MSC firmware access support Andre Przywara
2026-07-24  9:55   ` Sudeep Holla
2026-07-24 11:17     ` Andre Przywara
2026-07-24 12:22       ` Sudeep Holla [this message]
2026-07-24 17:08   ` Ben Horgan
2026-07-24 18:03     ` Sudeep Holla
2026-07-28 12:27       ` Andre Przywara
2026-07-28 16:04     ` Andre Przywara
2026-07-27 23:22   ` Jonathan Cameron
2026-07-29  8:07     ` Andre Przywara
2026-07-28  6:27   ` Srivathsa L Rao
2026-07-28 16:19     ` Andre Przywara
     [not found]   ` <20260728100421.4047928-1-ritwick.sharma@arm.com>
2026-07-28 10:24     ` Andre Przywara
2026-07-23 15:54 ` [PATCH v4 09/10] arm_mpam: prevent MPAM-Fb accesses inside IRQ handler Andre Przywara
2026-07-24 16:52   ` Ben Horgan
2026-07-23 15:54 ` [PATCH v4 10/10] arm_mpam: detect and enable MPAM-Fb PCC support Andre Przywara
2026-07-24 10:18   ` Sudeep Holla
2026-07-27 12:48     ` Lorenzo Pieralisi
2026-07-27 13:20       ` Sudeep Holla
2026-07-27 13:33         ` Lorenzo Pieralisi
2026-07-27 13:39           ` Sudeep Holla
2026-07-27 13:39         ` Andre Przywara
2026-07-27 16:27   ` Srivathsa L Rao
2026-07-27 23:36     ` Jonathan Cameron
2026-07-29 11:53     ` Andre Przywara
2026-07-29  8:56   ` Ben Horgan
2026-07-29  9:21     ` Andre Przywara

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=20260724-romantic-stoic-hippo-3f897b@sudeepholla \
    --to=sudeep.holla@kernel.org \
    --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=sramana@qti.qualcomm.com \
    --cc=srivathsa.rao@oss.qualcomm.com \
    --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