HV: fix bug to clear guest flags after it not used

in shutdown_vm, it uses guest flags when handling the phyiscal
CPUs whose LAPIC is pass-through. So if it is cleared first,
the related vCPUs and pCPUs can not be switched to correct state.

so move the clear action after the flags used.

Tracked-On: #4848
Signed-off-by: Minggui Cao <minggui.cao@intel.com>
Reviewed-by: Yin Fengwei <fengwei.yin@intel.com>
This commit is contained in:
Minggui Cao 2020-05-25 18:02:56 +08:00 committed by wenlingz
parent 454bb14348
commit 8c090c71ca
1 changed files with 4 additions and 3 deletions

View File

@ -599,9 +599,6 @@ int32_t shutdown_vm(struct acrn_vm *vm)
/* Only allow shutdown paused vm */
vm->state = VM_POWERED_OFF;
vm_config = get_vm_config(vm->vm_id);
vm_config->guest_flags &= ~DM_OWNED_GUEST_FLAG_MASK;
if (is_sos_vm(vm)) {
sbuf_reset();
}
@ -622,6 +619,10 @@ int32_t shutdown_vm(struct acrn_vm *vm)
offline_vcpu(vcpu);
}
/* after guest_flags not used, then clear it */
vm_config = get_vm_config(vm->vm_id);
vm_config->guest_flags &= ~DM_OWNED_GUEST_FLAG_MASK;
if (is_ready_for_system_shutdown()) {
/* If no any guest running, shutdown system */
shutdown_system();