diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c index 6571b5dde4..4b0d6a873c 100644 --- a/xen/drivers/passthrough/vtd/iommu.c +++ b/xen/drivers/passthrough/vtd/iommu.c @@ -1821,18 +1821,12 @@ int domain_context_unmap_one( return 0; } + iommu_domid = context_domain_id(*context); + context_clear_present(*context); context_clear_entry(*context); iommu_sync_cache(context, sizeof(struct context_entry)); - iommu_domid = get_iommu_did(domid, iommu, !domain->is_dying); - if ( iommu_domid == -1 ) - { - spin_unlock(&iommu->lock); - unmap_vtd_domain_page(context_entries); - return -EINVAL; - } - rc = iommu_flush_context_device(iommu, iommu_domid, PCI_BDF2(bus, devfn), DMA_CCMD_MASK_NOBIT, 0);