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

[Xen-changelog] [xen-unstable] AMD-IOMMU: fix initialization order (after 23863:9e0259239822)



# HG changeset patch
# User Jan Beulich <jbeulich@xxxxxxxx>
# Date 1317136509 -3600
# Node ID ade44be5b9364b66d76ad9448d158c26444c4d61
# Parent  651aed73b39c4d1613e7b95c29953309b38f7cc2
AMD-IOMMU: fix initialization order (after 23863:9e0259239822)

That original patch caused alloc_ivrs_mappings() to be called too
early, so things get moved back to where they were, just converting
the single call there to a loop over all IOMMUs.

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
---


diff -r 651aed73b39c -r ade44be5b936 xen/drivers/passthrough/amd/iommu_detect.c
--- a/xen/drivers/passthrough/amd/iommu_detect.c        Mon Sep 26 22:19:42 
2011 +0100
+++ b/xen/drivers/passthrough/amd/iommu_detect.c        Tue Sep 27 16:15:09 
2011 +0100
@@ -122,10 +122,6 @@
     spin_lock_init(&iommu->lock);
 
     iommu->seg = ivhd_block->pci_segment;
-    if (alloc_ivrs_mappings(ivhd_block->pci_segment)) {
-        xfree(iommu);
-        return -ENOMEM;
-    }
     iommu->bdf = ivhd_block->header.dev_id;
     iommu->cap_offset = ivhd_block->cap_offset;
     iommu->mmio_base_phys = ivhd_block->mmio_base;
diff -r 651aed73b39c -r ade44be5b936 xen/drivers/passthrough/amd/iommu_init.c
--- a/xen/drivers/passthrough/amd/iommu_init.c  Mon Sep 26 22:19:42 2011 +0100
+++ b/xen/drivers/passthrough/amd/iommu_init.c  Tue Sep 27 16:15:09 2011 +0100
@@ -769,7 +769,7 @@
     return rc;
 }
 
-int __init alloc_ivrs_mappings(u16 seg)
+static int __init alloc_ivrs_mappings(u16 seg)
 {
     struct ivrs_mappings *ivrs_mappings;
     int bdf;
@@ -882,8 +882,9 @@
         goto error_out;
 
     radix_tree_init(&ivrs_maps);
-    if ( alloc_ivrs_mappings(0) != 0 )
-        goto error_out;
+    for_each_amd_iommu ( iommu )
+        if ( alloc_ivrs_mappings(iommu->seg) != 0 )
+            goto error_out;
 
     if ( amd_iommu_update_ivrs_mapping_acpi() != 0 )
         goto error_out;
diff -r 651aed73b39c -r ade44be5b936 xen/include/asm-x86/amd-iommu.h
--- a/xen/include/asm-x86/amd-iommu.h   Mon Sep 26 22:19:42 2011 +0100
+++ b/xen/include/asm-x86/amd-iommu.h   Tue Sep 27 16:15:09 2011 +0100
@@ -103,7 +103,6 @@
 
 extern unsigned short ivrs_bdf_entries;
 
-int alloc_ivrs_mappings(u16 seg);
 struct ivrs_mappings *get_ivrs_mappings(u16 seg);
 int iterate_ivrs_mappings(int (*)(u16 seg, struct ivrs_mappings *));
 int iterate_ivrs_entries(int (*)(u16 seg, struct ivrs_mappings *));

_______________________________________________
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®.