git: 5a08fbb315e8 - stable/13 - 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:02 UTC
The branch stable/13 has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=5a08fbb315e82a08022e205e2c2ea4f4d0857f9e commit 5a08fbb315e82a08022e205e2c2ea4f4d0857f9e Author: Kyle Evans <kevans@FreeBSD.org> AuthorDate: 2022-05-13 03:03:32 +0000 Commit: Kyle Evans <kevans@FreeBSD.org> CommitDate: 2022-09-18 06:26: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 9aeb83008a15..94c8f8b87403 100644 --- a/sys/arm64/arm64/locore.S +++ b/sys/arm64/arm64/locore.S @@ -237,6 +237,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 */ mov x2, #(HCR_RW) msr hcr_el2, x2