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 (1/3)
From: Xen patchbot-unstable <patchbot@xxxxxxx>
Date: Sat, 29 Jan 2011 15:05:40 -0800
Delivery-date: Sat, 29 Jan 2011 15:11:11 -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 1296144652 0
# Node ID 969f26450ad5b192a8dffcb7066839c910be58d7
# Parent  f346343cb9786978767e219c2bf8c116a169f6f2
amd iommu: reduce io page level for hvm guest (1/3)

Since in most case, 2 or 3 - level IO page tables are sufficient, this
patch updates page table level for device assignment to reduces
overhead of dma translation

Signed-off-by: Wei Wang <wei.wang2@xxxxxxx>
---
 xen/drivers/passthrough/amd/iommu_map.c     |   12 ++++++++----
 xen/drivers/passthrough/amd/pci_amd_iommu.c |    9 +++++----
 2 files changed, 13 insertions(+), 8 deletions(-)

diff -r f346343cb978 -r 969f26450ad5 xen/drivers/passthrough/amd/iommu_map.c
--- a/xen/drivers/passthrough/amd/iommu_map.c   Thu Jan 27 14:59:04 2011 +0000
+++ b/xen/drivers/passthrough/amd/iommu_map.c   Thu Jan 27 16:10:52 2011 +0000
@@ -411,10 +411,14 @@ static u64 iommu_l2e_from_pfn(struct pag
     void *pde = NULL;
     void *table_vaddr;
     u64 next_table_maddr = 0;
-
-    BUG_ON( table == NULL || level == 0 );
-
-    while ( level > 1 )
+    unsigned int lowest = 1;
+
+    BUG_ON( table == NULL || level < lowest );
+
+    if ( level == lowest )
+        return page_to_maddr(table);
+
+    while ( level > lowest )
     {
         offset = io_pfn >> ((PTE_PER_TABLE_SHIFT *
                              (level - IOMMU_PAGING_MODE_LEVEL_1)));
diff -r f346343cb978 -r 969f26450ad5 xen/drivers/passthrough/amd/pci_amd_iommu.c
--- a/xen/drivers/passthrough/amd/pci_amd_iommu.c       Thu Jan 27 14:59:04 
2011 +0000
+++ b/xen/drivers/passthrough/amd/pci_amd_iommu.c       Thu Jan 27 16:10:52 
2011 +0000
@@ -190,10 +190,7 @@ static int get_paging_mode(unsigned long
 {
     int level = 1;
 
-    BUG_ON(!max_page);
-
-    if ( entries > max_page )
-        entries = max_page;
+    BUG_ON( !entries );
 
     while ( entries > PTE_PER_TABLE_SIZE )
     {
@@ -278,6 +275,7 @@ static int reassign_device( struct domai
     struct pci_dev *pdev;
     struct amd_iommu *iommu;
     int bdf;
+    struct hvm_iommu *t = domain_hvm_iommu(target);
 
     ASSERT(spin_is_locked(&pcidevs_lock));
     pdev = pci_get_pdev_by_domain(source, bus, devfn);
@@ -299,6 +297,9 @@ static int reassign_device( struct domai
 
     list_move(&pdev->domain_list, &target->arch.pdev_list);
     pdev->domain = target;
+
+    if ( target->max_pages > 0 )
+        t->paging_mode = get_paging_mode(target->max_pages);
 
     amd_iommu_setup_domain_device(target, iommu, bdf);
     AMD_IOMMU_DEBUG("Re-assign %02x:%02x.%x from domain %d to domain %d\n",

_______________________________________________
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 (1/3), Xen patchbot-unstable <=