hv: destroy IOMMU domain after vpci_cleanup()

In partition mode, unassign_iommu_device() is called from vpci_cleanup(),
so when shutdown_vm() is called, unassign_iommu_device() could fail because
of "domain id mismatch" and DMAR is not cleared.

Also move destroy_ept() after the call to destroy_iommu_domain().

Tracked-On: #2700
Signed-off-by: Zide Chen <zide.chen@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
Zide Chen 2019-03-07 15:42:22 -08:00 committed by ACRN System Integration
parent c0400b99fb
commit bf1aa5c134

View File

@ -449,18 +449,19 @@ int32_t shutdown_vm(struct acrn_vm *vm)
ptdev_release_all_entries(vm); ptdev_release_all_entries(vm);
/* Free EPT allocated resources assigned to VM */ vpci_cleanup(vm);
destroy_ept(vm);
/* Free iommu */ /* Free iommu */
if (vm->iommu != NULL) { if (vm->iommu != NULL) {
destroy_iommu_domain(vm->iommu); destroy_iommu_domain(vm->iommu);
} }
/* Free EPT allocated resources assigned to VM */
destroy_ept(vm);
/* Free vm id */ /* Free vm id */
free_vm_id(vm); free_vm_id(vm);
vpci_cleanup(vm);
ret = 0; ret = 0;
} else { } else {
ret = -EINVAL; ret = -EINVAL;