Linux Documentation
 help / color / mirror / Atom feed
From: Ben Horgan <ben.horgan@arm.com>
To: Fuad Tabba <fuad.tabba@linux.dev>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Will Deacon <will@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>,
	Jonathan Corbet <corbet@lwn.net>,
	Shuah Khan <skhan@linuxfoundation.org>,
	Randy Dunlap <rdunlap@infradead.org>,
	James Morse <james.morse@arm.com>, Xi Ruoyao <xry111@xry111.site>,
	Marc Zyngier <maz@kernel.org>,
	Bradley Morgan <brads@mainlining.org>,
	Fuad Tabba <tabba@google.com>,
	linux-arm-kernel@lists.infradead.org, linux-doc@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] arm64: mpam: Document when to set arm64.nompam
Date: Thu, 3 Sep 2026 10:55:29 +0100	[thread overview]
Message-ID: <cf59d824-80dc-446f-9b1b-ac9841a96a9d@arm.com> (raw)
In-Reply-To: <20260903084809.2027326-1-fuad.tabba@linux.dev>

Hi Fuad,

On 03/09/2026 09:48, Fuad Tabba wrote:
> arm64.nompam skips the MPAM2_EL2 and MPAMHCR_EL2 writes in
> finalise_el2_state and leaves the ARM64_MPAM cpucap unset. Where EL3
> firmware has enabled MPAM, the EL2 trap controls are left unwritten, at
> reset values that are UNKNOWN, and KVM still hides MPAM from the guest
> but no longer enables the traps that stop a guest from using it. The
> kernel cannot restore the writes: they trap to EL3 on the firmware the
> option exists for, and MPAM3_EL3.TRAPLOWER cannot be read below EL3.
> 
> Say so in mpam.rst, and add the rule and a pointer to the
> kernel-parameters entry.
> 
> No functional change intended.
> 
> Suggested-by: Ben Horgan <ben.horgan@arm.com>
> Link: https://lore.kernel.org/all/CA+EHjTxeWxZiuSmnKLGLxTBXP4oJT7-LuffbPAyCSZZ5TW=5Ew@mail.gmail.com/
> Signed-off-by: Fuad Tabba <fuad.tabba@linux.dev>
> ---
>  Documentation/admin-guide/kernel-parameters.txt |  3 ++-
>  Documentation/arch/arm64/mpam.rst               | 17 +++++++++++++++++
>  2 files changed, 19 insertions(+), 1 deletion(-)
> 
> diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
> index 68647ff4bdd24..e6d543de3cde5 100644
> --- a/Documentation/admin-guide/kernel-parameters.txt
> +++ b/Documentation/admin-guide/kernel-parameters.txt
> @@ -575,7 +575,8 @@ Kernel parameters
>  			Set instructions support
>  
>  	arm64.nompam	[ARM64] Unconditionally disable Memory Partitioning And
> -			Monitoring support
> +			Monitoring support. Only for a machine that does not
> +			boot without it. See Documentation/arch/arm64/mpam.rst
>  
>  	arm64.nomte	[ARM64] Unconditionally disable Memory Tagging Extension
>  			support
> diff --git a/Documentation/arch/arm64/mpam.rst b/Documentation/arch/arm64/mpam.rst
> index 67fe515ed501c..67c8a95391171 100644
> --- a/Documentation/arch/arm64/mpam.rst
> +++ b/Documentation/arch/arm64/mpam.rst
> @@ -87,6 +87,23 @@ The supported features are:
>    MBWU monitors can be exposed to the user after support for more monitoring
>    scopes is added to resctrl.
>  
> +arm64.nompam
> +============

This assumes that the reader already knows or can guess that arm64.nompam is a command line
parameter. Perhaps the section name can be 'Command line parameters' with a single 'arm64.nompam'
subsection underneath or all in the section name.

> +Firmware must enable MPAM at the highest implemented exception level and
> +leave the MPAM system registers accessible to the kernel, or trap the
> +accesses and emulate MPAM as disabled. Where it does neither, the CPUs
> +still advertise MPAM in the ID registers, the first kernel access to an
> +MPAM register traps to EL3, and the boot fails. ``arm64.nompam`` exists
> +for that firmware: it makes the kernel treat the CPUs as not implementing
> +MPAM, so no MPAM system register is accessed. Set it only on a machine
> +that does not boot without it.
> +
> +It is not a way to turn MPAM off. On a system whose firmware has enabled
> +MPAM at EL3, the option leaves the trap controls in MPAM2_EL2 and> +MPAMHCR_EL2 unwritten, and their reset values are UNKNOWN.

Enabling MPAM at EL3 is separate from disabling traps. Setting MPAM3_EL3.MPAMEN to 1 means that the
values in MPAMn_ELx are used to determine the PARTID and PMG for CPU requests. At this point EL3 can
configure the PARTID and PMG for the different exception levels and MPAM can be used in the system
under firmware control. Setting MPAM3_EL3.TRAPLOWER to 0 is what enables EL2 to access the MPAM
registers without trapping and configure the traps for MPAM register accesses at EL1.

> KVM still
> +hides MPAM from guests but no longer enables the traps that stop a guest
> +from using it, so a guest may be able to choose its own PARTID and PMG.
>
Shouldn't this also mention that the MPAM_*_EL1 are not save restored and so if the traps aren't
enabled provide a side channel between guests.

Thanks,

Ben

>  Reporting Bugs
>  ==============
>  If you are not seeing the counters or controls you expect please share the


  parent reply	other threads:[~2026-09-03  9:55 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-03  8:48 [PATCH] arm64: mpam: Document when to set arm64.nompam Fuad Tabba
2026-09-03  9:04 ` Bradley Morgan
2026-09-03  9:55 ` Ben Horgan [this message]
2026-09-03 11:14   ` Fuad Tabba

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=cf59d824-80dc-446f-9b1b-ac9841a96a9d@arm.com \
    --to=ben.horgan@arm.com \
    --cc=brads@mainlining.org \
    --cc=catalin.marinas@arm.com \
    --cc=corbet@lwn.net \
    --cc=fuad.tabba@linux.dev \
    --cc=james.morse@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=maz@kernel.org \
    --cc=rdunlap@infradead.org \
    --cc=skhan@linuxfoundation.org \
    --cc=tabba@google.com \
    --cc=will@kernel.org \
    --cc=xry111@xry111.site \
    /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