Patch 1/2 reset vm and vm_config structure to initial value when shutdown the vm.
Patch 2/2 fixes the following issue.
The normal vm can't boot up on the pcpu which ever run lapic_pt vm. The reason
is that the guest will directly write to the passthroughed physical lapic msrs.
The lapic will stay at disabled state or other invalid state. For example, the
lapic will stay at software disabled state when shutdown the linux guest with LAPIC_PT.
So the 2/2 patch reset the physical core of lapic_pt vm when shutdown the vm for security
and correctness. Physical core and lapic will return to initial state after reset.
v2 -> v3:
- Just reset vm_config->guest_flags instead of whole structure.
- Wait the target cpu really enter into dead state before start_cpu and wrap it as reset_cpu.
v1 -> v2:
- Reset physical core of lapic_pt vm instead of save/restore lapic msrs.
- Change the cover letter title "Save/restore LAPIC MSRs for LAPIC_PT vm".
Kaige Fu (2):
HV: Assign the guest_flags with cv.vm_flag
HV: Reset physical core of lapic_pt vm when shutdown
hypervisor/arch/x86/cpu.c | 24 ++++++++++++++++++++++++
hypervisor/arch/x86/guest/vm.c | 5 +++++
hypervisor/common/hypercall.c | 2 +-
hypervisor/include/arch/x86/cpu.h | 1 +
4 files changed, 31 insertions(+), 1 deletion(-)