arm64: disable the EL2 MMU before dropping to EL1

An earlier stage may have set HCR_EL2.E2H, the clearing of which may
break address translation.  We don't need the EL2 MMU at this point, so
we can avoid re-enabling it for now and just drop to EL1 as usual.

Suggested by:	andrew
Reviewed by:	andrew
Differential Revision:	https://reviews.freebsd.org/D34644
This commit is contained in:
Kyle Evans 2022-05-12 22:03:32 -05:00
parent 4581cffb3d
commit 51adf913e8

View File

@ -247,6 +247,16 @@ LENTRY(drop_to_el1)
b.eq 1f
ret
1:
/*
* Disable the MMU. If the HCR_EL2.E2H field is set we will clear it
* which may break address translation.
*/
dsb sy
mrs x2, sctlr_el2
bic x2, x2, SCTLR_M
msr sctlr_el2, x2
isb
/* Configure the Hypervisor */
ldr x2, =(HCR_RW | HCR_APK | HCR_API)
msr hcr_el2, x2