xen/18870-vtd-flush-per-device.patch

26 lines
991 B
Diff

# HG changeset patch
# User Keir Fraser <keir.fraser@citrix.com>
# Date 1228474781 0
# Node ID 99f01b8184c7c16f612731e2a525687dc8d424dc
# Parent 09160c3bd1797fdee111c2837f26a749e0bf9435
VT-d code cleanup
This patch narrow context caching flush range from the
domain-selective to the device-selective, when unmapping a device.
Signed-off-by: Yu Zhao <yu.zhao@intel.com>
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -1323,7 +1323,9 @@ static int domain_context_unmap_one(
context_clear_entry(*context);
iommu_flush_cache_entry(context);
- if ( iommu_flush_context_domain(iommu, domain_iommu_domid(domain), 0) )
+ if ( iommu_flush_context_device(iommu, domain_iommu_domid(domain),
+ (((u16)bus) << 8) | devfn,
+ DMA_CCMD_MASK_NOBIT, 0) )
iommu_flush_write_buffer(iommu);
else
iommu_flush_iotlb_dsi(iommu, domain_iommu_domid(domain), 0);