git: 20eabb33b464 - main - arm64/vmm: Only store the guest par_el1
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 20 Aug 2024 09:02:22 UTC
The branch main has been updated by andrew:
URL: https://cgit.FreeBSD.org/src/commit/?id=20eabb33b4645bc088c40d6475d5fa628b39031f
commit 20eabb33b4645bc088c40d6475d5fa628b39031f
Author: Andrew Turner <andrew@FreeBSD.org>
AuthorDate: 2024-08-19 12:44:05 +0000
Commit: Andrew Turner <andrew@FreeBSD.org>
CommitDate: 2024-08-20 08:49:15 +0000
arm64/vmm: Only store the guest par_el1
There is no need to store the host par_el1. We don't depend on it not
changing across calls into a guest.
Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D46079
---
sys/arm64/vmm/vmm_hyp.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/sys/arm64/vmm/vmm_hyp.c b/sys/arm64/vmm/vmm_hyp.c
index ae0c46331382..9c84bb4b294e 100644
--- a/sys/arm64/vmm/vmm_hyp.c
+++ b/sys/arm64/vmm/vmm_hyp.c
@@ -220,6 +220,7 @@ vmm_hyp_reg_store(struct hypctx *hypctx, struct hyp *hyp, bool guest)
hypctx->tf.tf_spsr = READ_SPECIALREG(spsr_el2);
if (guest) {
hypctx->tf.tf_esr = READ_SPECIALREG(esr_el2);
+ hypctx->par_el1 = READ_SPECIALREG(par_el1);
}
/* Store the guest special registers */
@@ -232,7 +233,6 @@ vmm_hyp_reg_store(struct hypctx *hypctx, struct hyp *hyp, bool guest)
hypctx->csselr_el1 = READ_SPECIALREG(csselr_el1);
hypctx->mdccint_el1 = READ_SPECIALREG(mdccint_el1);
hypctx->mdscr_el1 = READ_SPECIALREG(mdscr_el1);
- hypctx->par_el1 = READ_SPECIALREG(par_el1);
if (guest_or_nonvhe(guest)) {
hypctx->elr_el1 = READ_SPECIALREG(EL1_REG(ELR));
@@ -279,7 +279,6 @@ vmm_hyp_reg_restore(struct hypctx *hypctx, struct hyp *hyp, bool guest)
WRITE_SPECIALREG(csselr_el1, hypctx->csselr_el1);
WRITE_SPECIALREG(mdccint_el1, hypctx->mdccint_el1);
WRITE_SPECIALREG(mdscr_el1, hypctx->mdscr_el1);
- WRITE_SPECIALREG(par_el1, hypctx->par_el1);
if (guest_or_nonvhe(guest)) {
WRITE_SPECIALREG(EL1_REG(ELR), hypctx->elr_el1);
@@ -302,6 +301,10 @@ vmm_hyp_reg_restore(struct hypctx *hypctx, struct hyp *hyp, bool guest)
WRITE_SPECIALREG(EL1_REG(TTBR1), hypctx->ttbr1_el1);
}
+ if (guest) {
+ WRITE_SPECIALREG(par_el1, hypctx->par_el1);
+ }
+
WRITE_SPECIALREG(cptr_el2, hypctx->cptr_el2);
WRITE_SPECIALREG(vpidr_el2, hypctx->vpidr_el2);
WRITE_SPECIALREG(vmpidr_el2, hypctx->vmpidr_el2);