# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1211617668 -3600
# Node ID 5590509941b1cc12a5408d773532d9aa21e93e8e
# Parent 572701272661884f40796c2090cb2c1a366b5e6a
Fix iommu_unmap_page for VT-d
Signed-off-by: Espen Skoglund <espen.skoglund@xxxxxxxxxxxxx>
---
xen/drivers/passthrough/vtd/iommu.c | 21 ++++++++++++++++++++-
1 files changed, 20 insertions(+), 1 deletion(-)
diff -r 572701272661 -r 5590509941b1 xen/drivers/passthrough/vtd/iommu.c
--- a/xen/drivers/passthrough/vtd/iommu.c Sat May 24 09:25:04 2008 +0100
+++ b/xen/drivers/passthrough/vtd/iommu.c Sat May 24 09:27:48 2008 +0100
@@ -1518,6 +1518,8 @@ int intel_iommu_unmap_page(struct domain
{
struct acpi_drhd_unit *drhd;
struct iommu *iommu;
+ struct dma_pte *page = NULL, *pte = NULL;
+ u64 pg_maddr;
drhd = list_entry(acpi_drhd_units.next, typeof(*drhd), list);
iommu = drhd->iommu;
@@ -1528,7 +1530,24 @@ int intel_iommu_unmap_page(struct domain
return 0;
#endif
- dma_pte_clear_one(d, (paddr_t)gfn << PAGE_SHIFT_4K);
+ pg_maddr = addr_to_dma_page_maddr(d, (paddr_t)gfn << PAGE_SHIFT_4K);
+ if ( pg_maddr == 0 )
+ return -ENOMEM;
+ page = (struct dma_pte *)map_vtd_domain_page(pg_maddr);
+ pte = page + (gfn & LEVEL_MASK);
+ dma_clear_pte(*pte);
+ iommu_flush_cache_entry(drhd->iommu, pte);
+ unmap_vtd_domain_page(page);
+
+ for_each_drhd_unit ( drhd )
+ {
+ iommu = drhd->iommu;
+ if ( cap_caching_mode(iommu->cap) )
+ iommu_flush_iotlb_psi(iommu, domain_iommu_domid(d),
+ (paddr_t)gfn << PAGE_SHIFT_4K, 1, 0);
+ else if ( cap_rwbf(iommu->cap) )
+ iommu_flush_write_buffer(iommu);
+ }
return 0;
}
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|