WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-unstable] Fix iommu_unmap_page for VT-d

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] Fix iommu_unmap_page for VT-d
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Sat, 24 May 2008 07:00:11 -0700
Delivery-date: Sat, 24 May 2008 07:00:22 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# 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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] Fix iommu_unmap_page for VT-d, Xen patchbot-unstable <=