x86/amd-iommu: Fix IOMMU-API initialization for iommu=pt
authorJoerg Roedel <joerg.roedel@amd.com>
Wed, 3 Feb 2010 15:13:08 +0000 (16:13 +0100)
committerGreg Kroah-Hartman <gregkh@suse.de>
Tue, 23 Feb 2010 15:37:56 +0000 (07:37 -0800)
commit f5325094379158e6b876ea0010c807bf7890ec8f upstream

This patch moves the initialization of the iommu-api out of
the dma-ops initialization code. This ensures that the
iommu-api is initialized even with iommu=pt.

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
arch/x86/include/asm/amd_iommu.h
arch/x86/kernel/amd_iommu.c
arch/x86/kernel/amd_iommu_init.c

index 4b180897e6b510f0970118fb42f346054554e0d3..18aa3f8e0821674316b29952ff1e5e95e97526bb 100644 (file)
@@ -32,6 +32,7 @@ extern void amd_iommu_flush_all_domains(void);
 extern void amd_iommu_flush_all_devices(void);
 extern void amd_iommu_shutdown(void);
 extern void amd_iommu_apply_erratum_63(u16 devid);
+extern void amd_iommu_init_api(void);
 #else
 static inline int amd_iommu_init(void) { return -ENODEV; }
 static inline void amd_iommu_detect(void) { }
index e3f85feaae2ee1709cf0d6e2ddba0e42e2a6e8f3..ff964960e065e8204d35090d567364837c1935e2 100644 (file)
@@ -2083,6 +2083,11 @@ static struct dma_map_ops amd_iommu_dma_ops = {
        .dma_supported = amd_iommu_dma_supported,
 };
 
+void __init amd_iommu_init_api(void)
+{
+       register_iommu(&amd_iommu_ops);
+}
+
 /*
  * The function which clues the AMD IOMMU driver into dma_ops.
  */
@@ -2124,8 +2129,6 @@ int __init amd_iommu_init_dma_ops(void)
        /* Make the driver finally visible to the drivers */
        dma_ops = &amd_iommu_dma_ops;
 
-       register_iommu(&amd_iommu_ops);
-
        bus_register_notifier(&pci_bus_type, &device_nb);
 
        amd_iommu_stats_init();
index c8243f04e62d6116fc662d30498017c0982b3d41..362ab88c73ac0bedd5f4ce4765ebe596d8c0924b 100644 (file)
@@ -1288,9 +1288,12 @@ int __init amd_iommu_init(void)
                ret = amd_iommu_init_passthrough();
        else
                ret = amd_iommu_init_dma_ops();
+
        if (ret)
                goto free;
 
+       amd_iommu_init_api();
+
        enable_iommus();
 
        if (iommu_pass_through)