git: f086a0afe0c9 - stable/12 - arm64: disable the EL2 MMU before dropping to EL1
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sun, 18 Sep 2022 06:27:12 UTC
The branch stable/12 has been updated by kevans:
URL: https://cgit.FreeBSD.org/src/commit/?id=f086a0afe0c90c5a0a24a3d1a5dc2501181ce837
commit f086a0afe0c90c5a0a24a3d1a5dc2501181ce837
Author: Kyle Evans <kevans@FreeBSD.org>
AuthorDate: 2022-05-13 03:03:32 +0000
Commit: Kyle Evans <kevans@FreeBSD.org>
CommitDate: 2022-09-17 19:29:39 +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
(cherry picked from commit 51adf913e8815bdc928cb72dd378c596b8b15336)
---
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 74b1d3609b89..ffa28a136ec5 100644
--- a/sys/arm64/arm64/locore.S
+++ b/sys/arm64/arm64/locore.S
@@ -202,6 +202,16 @@ 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 */
mov x2, #(HCR_RW)
msr hcr_el2, x2