summaryrefslogtreecommitdiffstats
path: root/kernel/arch/arm64/mm/proc-macros.S
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/arch/arm64/mm/proc-macros.S')
-rw-r--r--kernel/arch/arm64/mm/proc-macros.S12
1 files changed, 12 insertions, 0 deletions
diff --git a/kernel/arch/arm64/mm/proc-macros.S b/kernel/arch/arm64/mm/proc-macros.S
index 4c4d93c4b..d69dffffa 100644
--- a/kernel/arch/arm64/mm/proc-macros.S
+++ b/kernel/arch/arm64/mm/proc-macros.S
@@ -62,3 +62,15 @@
bfi \valreg, \tmpreg, #TCR_T0SZ_OFFSET, #TCR_TxSZ_WIDTH
#endif
.endm
+
+/*
+ * reset_pmuserenr_el0 - reset PMUSERENR_EL0 if PMUv3 present
+ */
+ .macro reset_pmuserenr_el0, tmpreg
+ mrs \tmpreg, id_aa64dfr0_el1 // Check ID_AA64DFR0_EL1 PMUVer
+ sbfx \tmpreg, \tmpreg, #8, #4
+ cmp \tmpreg, #1 // Skip if no PMU present
+ b.lt 9000f
+ msr pmuserenr_el0, xzr // Disable PMU access from EL0
+9000:
+ .endm