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
This commit is contained in:
Andrew Turner
2024-08-19 13:44:05 +01:00
parent 7861ecd18b
commit 20eabb33b4
+5 -2
View File
@@ -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);