[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] AMD IOV: Fix dom0 initialisation.



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1208966324 -3600
# Node ID 77dec8732cde02bab4db07acf191eb3042224692
# Parent  2bc699de2297aefb4eb07f1f6b8586e5fe92c6bb
AMD IOV: Fix dom0 initialisation.
Signed-off-by: Wei Wang <wei.wang2@xxxxxxx>
---
 xen/drivers/passthrough/amd/pci_amd_iommu.c |   33 +++++++++++++---------------
 1 files changed, 16 insertions(+), 17 deletions(-)

diff -r 2bc699de2297 -r 77dec8732cde xen/drivers/passthrough/amd/pci_amd_iommu.c
--- a/xen/drivers/passthrough/amd/pci_amd_iommu.c       Wed Apr 23 16:57:23 
2008 +0100
+++ b/xen/drivers/passthrough/amd/pci_amd_iommu.c       Wed Apr 23 16:58:44 
2008 +0100
@@ -290,9 +290,9 @@ static void amd_iommu_setup_domain_devic
     }
 }
 
-static void __init amd_iommu_setup_dom0_devices(void)
-{
-    struct hvm_iommu *hd = domain_hvm_iommu(dom0);
+static void amd_iommu_setup_dom0_devices(struct domain *d)
+{
+    struct hvm_iommu *hd = domain_hvm_iommu(d);
     struct amd_iommu *iommu;
     struct pci_dev *pdev;
     int bus, dev, func;
@@ -322,7 +322,7 @@ static void __init amd_iommu_setup_dom0_
                     find_iommu_for_device(bus, pdev->devfn) : NULL;
 
                 if ( iommu )
-                    amd_iommu_setup_domain_device(dom0, iommu, bdf);
+                    amd_iommu_setup_domain_device(d, iommu, bdf);
             }
         }
     }
@@ -330,7 +330,6 @@ static void __init amd_iommu_setup_dom0_
 
 int amd_iov_detect(void)
 {
-    unsigned long i;
     int last_bus;
     struct amd_iommu *iommu, *next;
 
@@ -372,14 +371,6 @@ int amd_iov_detect(void)
         goto error_out;
     }
 
-    if ( iommu_domain_init(dom0) != 0 )
-        goto error_out;
-
-    /* setup 1:1 page table for dom0 */
-    for ( i = 0; i < max_page; i++ )
-        amd_iommu_map_page(dom0, i, i);
-
-    amd_iommu_setup_dom0_devices();
     return 0;
 
  error_out:
@@ -451,10 +442,18 @@ static int amd_iommu_domain_init(struct 
         return -ENOMEM;
     }
 
-    if ( is_hvm_domain(domain) )
-        hd->paging_mode = IOMMU_PAGE_TABLE_LEVEL_4;
-    else
-        hd->paging_mode = get_paging_mode(max_page);
+    hd->paging_mode = is_hvm_domain(domain)?
+        IOMMU_PAGE_TABLE_LEVEL_4 : get_paging_mode(max_page);
+
+    if ( domain->domain_id == 0 )
+    {
+        unsigned long i; 
+       /* setup 1:1 page table for dom0 */
+        for ( i = 0; i < max_page; i++ )
+            amd_iommu_map_page(domain, i, i);
+
+        amd_iommu_setup_dom0_devices(domain);
+    }
 
     hd->domain_id = domain->domain_id;
 

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.