Skip to content

Commit 6b776d3

Browse files
jgoulyctmarinas
authored andcommitted
arm64: transfer permission indirection settings to EL2
Copy the EL1 registers: TCR2_EL1, PIR_EL1, PIRE0_EL1, such that PIE is also enabled for EL2. Signed-off-by: Joey Gouly <[email protected]> Cc: Will Deacon <[email protected]> Cc: Marc Zyngier <[email protected]> Cc: Oliver Upton <[email protected]> Reviewed-by: Catalin Marinas <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Catalin Marinas <[email protected]>
1 parent 9e9bb6e commit 6b776d3

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

arch/arm64/kernel/hyp-stub.S

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,24 @@ SYM_CODE_START_LOCAL(__finalise_el2)
119119
msr ttbr1_el1, x0
120120
mrs_s x0, SYS_MAIR_EL12
121121
msr mair_el1, x0
122+
mrs x1, REG_ID_AA64MMFR3_EL1
123+
ubfx x1, x1, #ID_AA64MMFR3_EL1_TCRX_SHIFT, #4
124+
cbz x1, .Lskip_tcr2
125+
mrs x0, REG_TCR2_EL12
126+
msr REG_TCR2_EL1, x0
127+
128+
// Transfer permission indirection state
129+
mrs x1, REG_ID_AA64MMFR3_EL1
130+
ubfx x1, x1, #ID_AA64MMFR3_EL1_S1PIE_SHIFT, #4
131+
cbz x1, .Lskip_indirection
132+
mrs x0, REG_PIRE0_EL12
133+
msr REG_PIRE0_EL1, x0
134+
mrs x0, REG_PIR_EL12
135+
msr REG_PIR_EL1, x0
136+
137+
.Lskip_indirection:
138+
.Lskip_tcr2:
139+
122140
isb
123141

124142
// Hack the exception return to stay at EL2

0 commit comments

Comments
 (0)