git: 6b17f49da0a2 - main - arm64/vmm: Restore hcr_el2 earlier
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 20 Aug 2024 09:02:19 UTC
The branch main has been updated by andrew:
URL: https://cgit.FreeBSD.org/src/commit/?id=6b17f49da0a2c4cba05e6a1994fb10d16f11fe0a
commit 6b17f49da0a2c4cba05e6a1994fb10d16f11fe0a
Author: Andrew Turner <andrew@FreeBSD.org>
AuthorDate: 2024-08-19 12:43:51 +0000
Commit: Andrew Turner <andrew@FreeBSD.org>
CommitDate: 2024-08-20 08:49:15 +0000
arm64/vmm: Restore hcr_el2 earlier
It may cause fields in other registers to change meaning.
Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D46077
---
sys/arm64/vmm/vmm_hyp.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/sys/arm64/vmm/vmm_hyp.c b/sys/arm64/vmm/vmm_hyp.c
index 92f8cd25251d..9341f42daef6 100644
--- a/sys/arm64/vmm/vmm_hyp.c
+++ b/sys/arm64/vmm/vmm_hyp.c
@@ -262,6 +262,9 @@ vmm_hyp_reg_restore(struct hypctx *hypctx, struct hyp *hyp, bool guest)
uint64_t dfr0;
/* Restore the special registers */
+ WRITE_SPECIALREG(hcr_el2, hypctx->hcr_el2);
+ isb();
+
WRITE_SPECIALREG(elr_el1, hypctx->elr_el1);
WRITE_SPECIALREG(sp_el0, hypctx->sp_el0);
WRITE_SPECIALREG(tpidr_el0, hypctx->tpidr_el0);
@@ -290,7 +293,6 @@ vmm_hyp_reg_restore(struct hypctx *hypctx, struct hyp *hyp, bool guest)
WRITE_SPECIALREG(spsr_el1, hypctx->spsr_el1);
WRITE_SPECIALREG(cptr_el2, hypctx->cptr_el2);
- WRITE_SPECIALREG(hcr_el2, hypctx->hcr_el2);
WRITE_SPECIALREG(vpidr_el2, hypctx->vpidr_el2);
WRITE_SPECIALREG(vmpidr_el2, hypctx->vmpidr_el2);