mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v3] arm64: mpam: Document when to set arm64.nompam
@ 2026-09-08 14:56 Fuad Tabba
  2026-09-25  9:26 ` Ben Horgan
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Fuad Tabba @ 2026-09-08 14:56 UTC (permalink / raw)
  To: Catalin Marinas, Will Deacon
  Cc: Mark Rutland, Jonathan Corbet, Shuah Khan, Randy Dunlap,
	Ben Horgan, James Morse, Xi Ruoyao, Marc Zyngier, Bradley Morgan,
	Fuad Tabba, linux-arm-kernel, linux-doc, linux-kernel

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 cleared MPAM3_EL3.TRAPLOWER, 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. KVM never saves or restores MPAM0_EL1, MPAM1_EL1 and
MPAMSM_EL1, so what one guest writes reaches the next guest and the
host. Nor can the kernel make the EL2 writes unconditionally: they trap
to EL3 on the firmware the option exists for, and TRAPLOWER cannot be
read below EL3.

Say so in mpam.rst, and add the rule and a pointer to the
kernel-parameters entry.

Suggested-by: Ben Horgan <ben.horgan@arm.com>
Link: https://lore.kernel.org/all/CA+EHjTxeWxZiuSmnKLGLxTBXP4oJT7-LuffbPAyCSZZ5TW=5Ew@mail.gmail.com/
Reviewed-by: Bradley Morgan <brads@mainlining.org>
Signed-off-by: Fuad Tabba <fuad.tabba@linux.dev>
---

Notes:
    Changes since v2:
     - Add MPAMSM_EL1 to the registers a guest can reach (Ben).
     - Carry Bradley's Reviewed-by, dropped at v2 and reaffirmed there.
    
    v1: https://lore.kernel.org/all/20260903084809.2027326-1-fuad.tabba@linux.dev/
    v2: https://lore.kernel.org/all/20260904103131.627392-1-fuad.tabba@linux.dev/

 .../admin-guide/kernel-parameters.txt         |  3 ++-
 Documentation/arch/arm64/mpam.rst             | 26 +++++++++++++++++++
 2 files changed, 28 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..e445f4078ee1a 100644
--- a/Documentation/arch/arm64/mpam.rst
+++ b/Documentation/arch/arm64/mpam.rst
@@ -87,6 +87,32 @@ The supported features are:
   MBWU monitors can be exposed to the user after support for more monitoring
   scopes is added to resctrl.
 
+Command line parameters
+=======================
+
+arm64.nompam
+------------
+Firmware controls MPAM through two bits of MPAM3_EL3. MPAMEN enables
+it: while set, the PARTID and PMG in the MPAMn_ELx registers label the
+CPU's memory requests. TRAPLOWER, which resets to 1, traps accesses to
+the MPAM system registers from the lower exception levels to EL3.
+Firmware must clear it, or handle the trap and emulate MPAM as disabled.
+Where it does neither, the CPUs still advertise MPAM in the ID registers,
+the kernel's MPAM register accesses trap 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. Where firmware has cleared TRAPLOWER,
+the option leaves the trap controls in MPAM2_EL2 and MPAMHCR_EL2
+unwritten, and their reset values are UNKNOWN. 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 read and write MPAM0_EL1, MPAM1_EL1 and
+MPAMSM_EL1. KVM does not save or restore them, so what one guest writes
+is still there when the next guest runs on that CPU, and when the host
+does. With MPAMEN set, EL0 and EL1 requests then carry that PARTID and
+PMG.
+
 Reporting Bugs
 ==============
 If you are not seeing the counters or controls you expect please share the
-- 
2.39.5


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v3] arm64: mpam: Document when to set arm64.nompam
  2026-09-08 14:56 [PATCH v3] arm64: mpam: Document when to set arm64.nompam Fuad Tabba
@ 2026-09-25  9:26 ` Ben Horgan
  2026-09-28  6:56 ` Fuad Tabba
  2026-10-01 16:12 ` Catalin Marinas
  2 siblings, 0 replies; 5+ messages in thread
From: Ben Horgan @ 2026-09-25  9:26 UTC (permalink / raw)
  To: Fuad Tabba, Catalin Marinas, Will Deacon
  Cc: Mark Rutland, Jonathan Corbet, Shuah Khan, Randy Dunlap,
	James Morse, Xi Ruoyao, Marc Zyngier, Bradley Morgan, Fuad Tabba,
	linux-arm-kernel, linux-doc, linux-kernel

Hi Fuad,

On 08/09/2026 15:56, 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 cleared MPAM3_EL3.TRAPLOWER, 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. KVM never saves or restores MPAM0_EL1, MPAM1_EL1 and
> MPAMSM_EL1, so what one guest writes reaches the next guest and the
> host. Nor can the kernel make the EL2 writes unconditionally: they trap
> to EL3 on the firmware the option exists for, and TRAPLOWER cannot be
> read below EL3.
> 
> Say so in mpam.rst, and add the rule and a pointer to the
> kernel-parameters entry.
> 
> Suggested-by: Ben Horgan <ben.horgan@arm.com>
> Link: https://lore.kernel.org/all/CA+EHjTxeWxZiuSmnKLGLxTBXP4oJT7-LuffbPAyCSZZ5TW=5Ew@mail.gmail.com/
> Reviewed-by: Bradley Morgan <brads@mainlining.org>
> Signed-off-by: Fuad Tabba <fuad.tabba@linux.dev>

Reviewed-by: Ben Horgan <ben.horgan@arm.com>

Thanks,

Ben


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v3] arm64: mpam: Document when to set arm64.nompam
  2026-09-08 14:56 [PATCH v3] arm64: mpam: Document when to set arm64.nompam Fuad Tabba
  2026-09-25  9:26 ` Ben Horgan
@ 2026-09-28  6:56 ` Fuad Tabba
  2026-10-01 16:00   ` Catalin Marinas
  2026-10-01 16:12 ` Catalin Marinas
  2 siblings, 1 reply; 5+ messages in thread
From: Fuad Tabba @ 2026-09-28  6:56 UTC (permalink / raw)
  To: Catalin Marinas, Will Deacon
  Cc: Mark Rutland, Jonathan Corbet, Shuah Khan, Randy Dunlap,
	Ben Horgan, James Morse, Xi Ruoyao, Marc Zyngier, Bradley Morgan,
	linux-arm-kernel, linux-doc, linux-kernel

Hi Catalin, Will,

On Tue, 8 Sept 2026 at 15:56, Fuad Tabba <fuad.tabba@linux.dev> 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 cleared MPAM3_EL3.TRAPLOWER, 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. KVM never saves or restores MPAM0_EL1, MPAM1_EL1 and
> MPAMSM_EL1, so what one guest writes reaches the next guest and the
> host. Nor can the kernel make the EL2 writes unconditionally: they trap
> to EL3 on the firmware the option exists for, and TRAPLOWER cannot be
> read below EL3.
>
> Say so in mpam.rst, and add the rule and a pointer to the
> kernel-parameters entry.

Gentle ping on this one; it has Ben's and Bradley's R-b. I think it
still stands regardless of the other cpufeature work going on now.
Anything else needed for it to go in?

Cheers,
/fuad

>
> Suggested-by: Ben Horgan <ben.horgan@arm.com>
> Link: https://lore.kernel.org/all/CA+EHjTxeWxZiuSmnKLGLxTBXP4oJT7-LuffbPAyCSZZ5TW=5Ew@mail.gmail.com/
> Reviewed-by: Bradley Morgan <brads@mainlining.org>
> Signed-off-by: Fuad Tabba <fuad.tabba@linux.dev>
> ---
>
> Notes:
>     Changes since v2:
>      - Add MPAMSM_EL1 to the registers a guest can reach (Ben).
>      - Carry Bradley's Reviewed-by, dropped at v2 and reaffirmed there.
>
>     v1: https://lore.kernel.org/all/20260903084809.2027326-1-fuad.tabba@linux.dev/
>     v2: https://lore.kernel.org/all/20260904103131.627392-1-fuad.tabba@linux.dev/
>
>  .../admin-guide/kernel-parameters.txt         |  3 ++-
>  Documentation/arch/arm64/mpam.rst             | 26 +++++++++++++++++++
>  2 files changed, 28 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..e445f4078ee1a 100644
> --- a/Documentation/arch/arm64/mpam.rst
> +++ b/Documentation/arch/arm64/mpam.rst
> @@ -87,6 +87,32 @@ The supported features are:
>    MBWU monitors can be exposed to the user after support for more monitoring
>    scopes is added to resctrl.
>
> +Command line parameters
> +=======================
> +
> +arm64.nompam
> +------------
> +Firmware controls MPAM through two bits of MPAM3_EL3. MPAMEN enables
> +it: while set, the PARTID and PMG in the MPAMn_ELx registers label the
> +CPU's memory requests. TRAPLOWER, which resets to 1, traps accesses to
> +the MPAM system registers from the lower exception levels to EL3.
> +Firmware must clear it, or handle the trap and emulate MPAM as disabled.
> +Where it does neither, the CPUs still advertise MPAM in the ID registers,
> +the kernel's MPAM register accesses trap 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. Where firmware has cleared TRAPLOWER,
> +the option leaves the trap controls in MPAM2_EL2 and MPAMHCR_EL2
> +unwritten, and their reset values are UNKNOWN. 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 read and write MPAM0_EL1, MPAM1_EL1 and
> +MPAMSM_EL1. KVM does not save or restore them, so what one guest writes
> +is still there when the next guest runs on that CPU, and when the host
> +does. With MPAMEN set, EL0 and EL1 requests then carry that PARTID and
> +PMG.
> +
>  Reporting Bugs
>  ==============
>  If you are not seeing the counters or controls you expect please share the
> --
> 2.39.5
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v3] arm64: mpam: Document when to set arm64.nompam
  2026-09-28  6:56 ` Fuad Tabba
@ 2026-10-01 16:00   ` Catalin Marinas
  0 siblings, 0 replies; 5+ messages in thread
From: Catalin Marinas @ 2026-10-01 16:00 UTC (permalink / raw)
  To: Fuad Tabba
  Cc: Will Deacon, Mark Rutland, Jonathan Corbet, Shuah Khan,
	Randy Dunlap, Ben Horgan, James Morse, Xi Ruoyao, Marc Zyngier,
	Bradley Morgan, linux-arm-kernel, linux-doc, linux-kernel

On Mon, Sep 28, 2026 at 07:56:14AM +0100, Fuad Tabba wrote:
> On Tue, 8 Sept 2026 at 15:56, Fuad Tabba <fuad.tabba@linux.dev> 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 cleared MPAM3_EL3.TRAPLOWER, 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. KVM never saves or restores MPAM0_EL1, MPAM1_EL1 and
> > MPAMSM_EL1, so what one guest writes reaches the next guest and the
> > host. Nor can the kernel make the EL2 writes unconditionally: they trap
> > to EL3 on the firmware the option exists for, and TRAPLOWER cannot be
> > read below EL3.
> >
> > Say so in mpam.rst, and add the rule and a pointer to the
> > kernel-parameters entry.
> 
> Gentle ping on this one; it has Ben's and Bradley's R-b. I think it
> still stands regardless of the other cpufeature work going on now.
> Anything else needed for it to go in?

Normally I expect a pull request from Ben or James but they rarely send
one in time ;). I'll apply it directly.

-- 
Catalin

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v3] arm64: mpam: Document when to set arm64.nompam
  2026-09-08 14:56 [PATCH v3] arm64: mpam: Document when to set arm64.nompam Fuad Tabba
  2026-09-25  9:26 ` Ben Horgan
  2026-09-28  6:56 ` Fuad Tabba
@ 2026-10-01 16:12 ` Catalin Marinas
  2 siblings, 0 replies; 5+ messages in thread
From: Catalin Marinas @ 2026-10-01 16:12 UTC (permalink / raw)
  To: Will Deacon, Fuad Tabba
  Cc: Mark Rutland, Jonathan Corbet, Shuah Khan, Randy Dunlap,
	Ben Horgan, James Morse, Xi Ruoyao, Marc Zyngier, Bradley Morgan,
	linux-arm-kernel, linux-doc, linux-kernel

On Tue, 08 Sep 2026 15:56:22 +0100, 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 cleared MPAM3_EL3.TRAPLOWER, 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. KVM never saves or restores MPAM0_EL1, MPAM1_EL1 and
> MPAMSM_EL1, so what one guest writes reaches the next guest and the
> host. Nor can the kernel make the EL2 writes unconditionally: they trap
> to EL3 on the firmware the option exists for, and TRAPLOWER cannot be
> read below EL3.
> 
> [...]

Applied to arm64 (for-next/mpam), thanks!

[1/1] arm64: mpam: Document when to set arm64.nompam
      https://git.kernel.org/arm64/c/eb0fde98fee4

(and this wasn't a pure mpam patch, should have picked it directly ;))

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-10-01 16:13 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-08 14:56 [PATCH v3] arm64: mpam: Document when to set arm64.nompam Fuad Tabba
2026-09-25  9:26 ` Ben Horgan
2026-09-28  6:56 ` Fuad Tabba
2026-10-01 16:00   ` Catalin Marinas
2026-10-01 16:12 ` Catalin Marinas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®