x86/amd-iommu: Fall back to GART if initialization fails
authorJoerg Roedel <joerg.roedel@amd.com>
Mon, 31 May 2010 13:05:20 +0000 (15:05 +0200)
committerJoerg Roedel <joerg.roedel@amd.com>
Tue, 1 Jun 2010 08:20:15 +0000 (10:20 +0200)
This patch implements a fallback to the GART IOMMU if this
is possible and the AMD IOMMU initialization failed.
Otherwise the fallback would be nommu which is very
problematic on machines with more than 4GB of memory or
swiotlb which hurts io-performance.

Cc: stable@kernel.org
Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
arch/x86/kernel/amd_iommu.c
arch/x86/kernel/amd_iommu_init.c

index 8a9aaa8412c90b6425c844cd1ed37d23dc06fe61..0d20286d78c6f6b6b4307ef35dc5001cccc480a9 100644 (file)
@@ -2330,10 +2330,6 @@ int __init amd_iommu_init_dma_ops(void)
 
        iommu_detected = 1;
        swiotlb = 0;
-#ifdef CONFIG_GART_IOMMU
-       gart_iommu_aperture_disabled = 1;
-       gart_iommu_aperture = 0;
-#endif
 
        /* Make the driver finally visible to the drivers */
        dma_ops = &amd_iommu_dma_ops;
index 1405346c62b4a183504bc342ab9cb3f90494cc3b..3cc63e2b8dd4c4acc4ee7f77c3ad432d97beb169 100644 (file)
@@ -1358,6 +1358,15 @@ free:
 
        free_unity_maps();
 
+#ifdef CONFIG_GART_IOMMU
+       /*
+        * We failed to initialize the AMD IOMMU - try fallback to GART
+        * if possible.
+        */
+       gart_iommu_init();
+
+#endif
+
        goto out;
 }