Page MenuHomeFreeBSD

arm64/vmm: save and restore HCRX_EL2 register
ClosedPublic

Authored by harry.moulton_arm.com on Tue, Jan 21, 5:47 PM.
Tags
None
Referenced Files
F109532187: D48584.id149677.diff
Thu, Feb 6, 8:33 AM
F109530070: D48584.id.diff
Thu, Feb 6, 7:44 AM
F109522384: D48584.diff
Thu, Feb 6, 4:58 AM
Unknown Object (File)
Tue, Feb 4, 12:27 PM
Unknown Object (File)
Sat, Jan 25, 8:37 PM
Subscribers

Details

Summary

With the addition of the Extended Hypervisor Configuration Register
(HCRX_EL2), this change ensures that it is both set to 0 before entering
a vm, and that it is properly saved/restored.

Sponsored By: Arm Ltd
Signed-off-by: Harry Moulton <harry.moulton@arm.com>

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

Does the value of the register matter when no guest is running? Does the hardware change the register when a guest is running? If not we can restrict when we save & restore it, e.g. if the host doesn't care what value it has, and it's never changed by hardware then we only need to restore it for guests and can drop the vmm_hyp_reg_store change.

Does the value of the register matter when no guest is running? Does the hardware change the register when a guest is running? If not we can restrict when we save & restore it, e.g. if the host doesn't care what value it has, and it's never changed by hardware then we only need to restore it for guests and can drop the vmm_hyp_reg_store change.

Makes sense. I think so long as HCRX_EL2 doesn't end up with some unknown value. It's being set to zero, for now, in reset_vm_el2_regs, and that's where we'll set any of it's bits in the future. So yeah, storing it in vmm_hyp_reg_store is not needed.

I think this is what you'll need. We need to save and restore HCRX_EL2 in the non-VHE case, and load it for a VHE guest.

sys/arm64/vmm/vmm_hyp.c
262–267
280–283
This revision is now accepted and ready to land.Wed, Jan 22, 3:46 PM
This revision was automatically updated to reflect the committed changes.