From: Joerg Roedel <jroe...@suse.de>

The checks for IRQ remapping support rely on ordering with
dmar_table_init(), which is called in
intel_prepare_irq_remapping(). Move the checks for IRQ
remapping support to this function to ensure the right
ordering.

Signed-off-by: Joerg Roedel <jroe...@suse.de>
---
 drivers/iommu/intel_irq_remapping.c | 39 +++++++++++++++++++++----------------
 1 file changed, 22 insertions(+), 17 deletions(-)

diff --git a/drivers/iommu/intel_irq_remapping.c 
b/drivers/iommu/intel_irq_remapping.c
index 45223ea..0c9226f 100644
--- a/drivers/iommu/intel_irq_remapping.c
+++ b/drivers/iommu/intel_irq_remapping.c
@@ -512,23 +512,6 @@ static int __init dmar_x2apic_optout(void)
 
 static int __init intel_irq_remapping_supported(void)
 {
-       if (disable_irq_remap)
-               return 0;
-       if (irq_remap_broken) {
-               printk(KERN_WARNING
-                       "This system BIOS has enabled interrupt remapping\n"
-                       "on a chipset that contains an erratum making that\n"
-                       "feature unstable.  To maintain system stability\n"
-                       "interrupt remapping is being disabled.  Please\n"
-                       "contact your BIOS vendor for an update\n");
-               add_taint(TAINT_FIRMWARE_WORKAROUND, LOCKDEP_STILL_OK);
-               disable_irq_remap = 1;
-               return 0;
-       }
-
-       if (!dmar_ir_support())
-               return 0;
-
        return 1;
 }
 
@@ -553,6 +536,24 @@ static int __init intel_prepare_irq_remapping(void)
        struct dmar_drhd_unit *drhd;
        struct intel_iommu *iommu;
 
+       /* First check whether IRQ remapping should be enabled */
+       if (disable_irq_remap)
+               return -1;
+
+       /* Are we running on sane hardware? */
+       if (irq_remap_broken) {
+               printk(KERN_WARNING
+                       "This system BIOS has enabled interrupt remapping\n"
+                       "on a chipset that contains an erratum making that\n"
+                       "feature unstable.  To maintain system stability\n"
+                       "interrupt remapping is being disabled.  Please\n"
+                       "contact your BIOS vendor for an update\n");
+               add_taint(TAINT_FIRMWARE_WORKAROUND, LOCKDEP_STILL_OK);
+               disable_irq_remap = 1;
+               return -1;
+       }
+
+       /* Everthing seems fine so far, parse the DMAR table */
        if (dmar_table_init() < 0)
                return -1;
 
@@ -561,6 +562,10 @@ static int __init intel_prepare_irq_remapping(void)
                goto error;
        }
 
+       /* Is interrupt remapping supported by hardware? */
+       if (!dmar_ir_support())
+               return 0;
+
        /* First make sure all IOMMUs support IRQ remapping */
        for_each_iommu(iommu, drhd)
                if (!ecap_ir_support(iommu->ecap))
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to