Skip to content

Commit 50cb99f

Browse files
Alexandru Eliseictmarinas
authored andcommitted
arm64: Do not trap PMSNEVFR_EL1
Commit 31c00d2 ("arm64: Disable fine grained traps on boot") zeroed the fine grained trap registers to prevent unwanted register traps from occuring. However, for the PMSNEVFR_EL1 register, the corresponding HDFG{R,W}TR_EL2.nPMSNEVFR_EL1 fields must be 1 to disable trapping. Set both fields to 1 if FEAT_SPEv1p2 is detected to disable read and write traps. Fixes: 31c00d2 ("arm64: Disable fine grained traps on boot") Cc: <[email protected]> # 5.13.x Signed-off-by: Alexandru Elisei <[email protected]> Reviewed-by: Mark Brown <[email protected]> Acked-by: Marc Zyngier <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Catalin Marinas <[email protected]>
1 parent 5845e70 commit 50cb99f

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

arch/arm64/include/asm/el2_setup.h

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,8 +150,17 @@
150150
ubfx x1, x1, #ID_AA64MMFR0_FGT_SHIFT, #4
151151
cbz x1, .Lskip_fgt_\@
152152

153-
msr_s SYS_HDFGRTR_EL2, xzr
154-
msr_s SYS_HDFGWTR_EL2, xzr
153+
mov x0, xzr
154+
mrs x1, id_aa64dfr0_el1
155+
ubfx x1, x1, #ID_AA64DFR0_PMSVER_SHIFT, #4
156+
cmp x1, #3
157+
b.lt .Lset_fgt_\@
158+
/* Disable PMSNEVFR_EL1 read and write traps */
159+
orr x0, x0, #(1 << 62)
160+
161+
.Lset_fgt_\@:
162+
msr_s SYS_HDFGRTR_EL2, x0
163+
msr_s SYS_HDFGWTR_EL2, x0
155164
msr_s SYS_HFGRTR_EL2, xzr
156165
msr_s SYS_HFGWTR_EL2, xzr
157166
msr_s SYS_HFGITR_EL2, xzr

0 commit comments

Comments
 (0)