aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKyle Evans <kevans@FreeBSD.org>2022-05-13 03:03:32 +0000
committerKyle Evans <kevans@FreeBSD.org>2022-05-13 03:04:24 +0000
commit51adf913e8815bdc928cb72dd378c596b8b15336 (patch)
tree9add4a86fd063d5331fe51c9da6e2264ccfb047d
parent4581cffb3d52b863cd853e923edc8e2b5cce425c (diff)
downloadsrc-51adf913e8815bdc928cb72dd378c596b8b15336.tar.gz
src-51adf913e8815bdc928cb72dd378c596b8b15336.zip
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
-rw-r--r--sys/arm64/arm64/locore.S10
1 files changed, 10 insertions, 0 deletions
diff --git a/sys/arm64/arm64/locore.S b/sys/arm64/arm64/locore.S
index e1b0530006cb..ba85bb4e46b2 100644
--- a/sys/arm64/arm64/locore.S
+++ b/sys/arm64/arm64/locore.S
@@ -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