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] amd iommu: reduce io page level for hvm g

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] amd iommu: reduce io page level for hvm guest (2/3)
From: Xen patchbot-unstable <patchbot@xxxxxxx>
Date: Sat, 29 Jan 2011 15:05:42 -0800
Delivery-date: Sat, 29 Jan 2011 15:11:17 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
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/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/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 Wei Wang <wei.wang2@xxxxxxx>
# Date 1296144697 0
# Node ID 699f2248147996173f13cc8a9cf097fcbf5cb7de
# Parent  969f26450ad5b192a8dffcb7066839c910be58d7
amd iommu: reduce io page level for hvm guest (2/3)

Clean up amd_iommu_reserve_domain_unity_map function to reduce code
duplication.

Signed-off-by: Wei Wang <wei.wang2@xxxxxxx>
---
 xen/drivers/passthrough/amd/iommu_map.c |   46 +++++++++++---------------------
 1 files changed, 17 insertions(+), 29 deletions(-)

diff -r 969f26450ad5 -r 699f22481479 xen/drivers/passthrough/amd/iommu_map.c
--- a/xen/drivers/passthrough/amd/iommu_map.c   Thu Jan 27 16:10:52 2011 +0000
+++ b/xen/drivers/passthrough/amd/iommu_map.c   Thu Jan 27 16:11:37 2011 +0000
@@ -518,38 +518,26 @@ int amd_iommu_unmap_page(struct domain *
     return 0;
 }
 
-int amd_iommu_reserve_domain_unity_map(
-    struct domain *domain,
-    unsigned long phys_addr,
-    unsigned long size, int iw, int ir)
-{
-    u64 iommu_l2e;
+int amd_iommu_reserve_domain_unity_map(struct domain *domain,
+                                       u64 phys_addr,
+                                       unsigned long size, int iw, int ir)
+{
     unsigned long npages, i;
-    struct hvm_iommu *hd = domain_hvm_iommu(domain);
+    unsigned long gfn;
+    unsigned int flags = !!ir;
+    int rt = 0;
+
+    if ( iw )
+        flags |= IOMMUF_writable;
 
     npages = region_to_pages(phys_addr, size);
-
-    spin_lock(&hd->mapping_lock);
-    for ( i = 0; i < npages; ++i )
-    {
-        iommu_l2e = iommu_l2e_from_pfn(
-            hd->root_table, hd->paging_mode, phys_addr >> PAGE_SHIFT);
-
-        if ( iommu_l2e == 0 )
-        {
-            spin_unlock(&hd->mapping_lock);
-            AMD_IOMMU_DEBUG("Invalid IO pagetable entry phys_addr = %lx\n",
-                            phys_addr);
-            domain_crash(domain);
-            return -EFAULT;
-        }
-
-        set_iommu_l1e_present(iommu_l2e,
-            (phys_addr >> PAGE_SHIFT), phys_addr, iw, ir);
-
-        phys_addr += PAGE_SIZE;
-    }
-    spin_unlock(&hd->mapping_lock);
+    gfn = phys_addr >> PAGE_SHIFT;
+    for ( i = 0; i < npages; i++ )
+    {
+        rt = amd_iommu_map_page(domain, gfn +i, gfn +i, flags);
+        if ( rt != 0 )
+            return rt;
+    }
     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] amd iommu: reduce io page level for hvm guest (2/3), Xen patchbot-unstable <=