git: 51adf913e881 - main - arm64: disable the EL2 MMU before dropping to EL1
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 13 May 2022 03:07:27 UTC
The branch main has been updated by kevans:
URL: https://cgit.FreeBSD.org/src/commit/?id=51adf913e8815bdc928cb72dd378c596b8b15336
commit 51adf913e8815bdc928cb72dd378c596b8b15336
Author: Kyle Evans <kevans@FreeBSD.org>
AuthorDate: 2022-05-13 03:03:32 +0000
Commit: Kyle Evans <kevans@FreeBSD.org>
CommitDate: 2022-05-13 03:04:24 +0000
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
---
sys/arm64/arm64/locore.S | 10 ++++++++++
1 file changed, 10 insertions(+)
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