HV: Clear DM set guest_flags when shutdown vm

Currently, the previous configurations about guest_flags set by DM will
not be cleared when shutdown the vm. Then it might bring issue for the
next dm-launched vm.

For example, if we create one vm with LAPIC_PASSTHROUGH flag and shutdown it.
Then the next dm-launched vm will has the LAPIC_PASSTHROUGH flag set no matter
whether we set it in DM.

This patch clears all the DM set flags when shtudown vm.

Tracked-On: #2991
Signed-off-by: Kaige Fu <kaige.fu@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
Kaige Fu
2019-04-16 09:11:58 +00:00
committed by wenlingz
parent a3207b2bc2
commit 565f3c723a
4 changed files with 15 additions and 1 deletions

View File

@@ -157,7 +157,9 @@ int32_t hcall_create_vm(struct acrn_vm *vm, uint64_t param)
if ((vm_id < CONFIG_MAX_VM_NUM)
&& (!is_valid_vm(get_vm_from_vmid(vm_id)))) {
vm_config = get_vm_config(vm_id);
vm_config->guest_flags |= cv.vm_flag;
/* Filter out the bits should not set by DM and then assign it to guest_flags */
vm_config->guest_flags |= (cv.vm_flag & DM_OWNED_GUEST_FLAG_MASK);
/* GUEST_FLAG_RT must be set if we have GUEST_FLAG_LAPIC_PASSTHROUGH set in guest_flags */
if (((vm_config->guest_flags & GUEST_FLAG_LAPIC_PASSTHROUGH) != 0U)