[BOOT-WRAPPER PATCH] aarch64: Enable access to MPAM by EL2 and below

Vladimir Murzin vladimir.murzin at arm.com
Tue Jun 3 01:49:23 PDT 2025


Disable any EL3 traps for MPAM and reset to default PARTIDs and PMGs
by clearing enable bit.

Signed-off-by: Vladimir Murzin <vladimir.murzin at arm.com>
---
 arch/aarch64/include/asm/cpu.h | 3 +++
 arch/aarch64/init.c            | 5 +++++
 2 files changed, 8 insertions(+)

diff --git a/arch/aarch64/include/asm/cpu.h b/arch/aarch64/include/asm/cpu.h
index 2b3a659..ff38bf8 100644
--- a/arch/aarch64/include/asm/cpu.h
+++ b/arch/aarch64/include/asm/cpu.h
@@ -143,6 +143,9 @@
 #define HCR_EL2_RESET		HCR_EL2_RES1
 
 #define ID_AA64PFR0_EL1_GIC	BITS(27, 24)
+#define ID_AA64PFR0_EL1_MPAM	BITS(43,40)
+
+#define MPAM3_EL3		s3_6_c10_c5_0
 
 /*
  * RES1 bits,  little-endian, caches and MMU off, no alignment checking,
diff --git a/arch/aarch64/init.c b/arch/aarch64/init.c
index e1640a9..b31c4f3 100644
--- a/arch/aarch64/init.c
+++ b/arch/aarch64/init.c
@@ -194,6 +194,11 @@ static void cpu_init_el3(void)
 
 		msr(SMCR_EL3, smcr);
 	}
+
+	if (mrs_field(ID_AA64PFR0_EL1, MPAM)) {
+		/* Use the default partition and disable lower traps */
+		msr(MPAM3_EL3, 0);
+	}
 }
 
 void cpu_init_el2_armv8r(void)
-- 
2.34.1




More information about the linux-arm-kernel mailing list