Merge branch 'irq-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git...
[pandora-kernel.git] / arch / x86 / kernel / apic / apic.c
index 52fa563..a2fd72e 100644 (file)
@@ -1437,27 +1437,21 @@ void enable_x2apic(void)
 
 int __init enable_IR(void)
 {
-#ifdef CONFIG_INTR_REMAP
+#ifdef CONFIG_IRQ_REMAP
        if (!intr_remapping_supported()) {
                pr_debug("intr-remapping not supported\n");
-               return 0;
+               return -1;
        }
 
        if (!x2apic_preenabled && skip_ioapic_setup) {
                pr_info("Skipped enabling intr-remap because of skipping "
                        "io-apic setup\n");
-               return 0;
+               return -1;
        }
 
-       if (enable_intr_remapping(x2apic_supported()))
-               return 0;
-
-       pr_info("Enabled Interrupt-remapping\n");
-
-       return 1;
-
+       return enable_intr_remapping();
 #endif
-       return 0;
+       return -1;
 }
 
 void __init enable_IR_x2apic(void)
@@ -1481,11 +1475,11 @@ void __init enable_IR_x2apic(void)
        mask_ioapic_entries();
 
        if (dmar_table_init_ret)
-               ret = 0;
+               ret = -1;
        else
                ret = enable_IR();
 
-       if (!ret) {
+       if (ret < 0) {
                /* IR is required if there is APIC ID > 255 even when running
                 * under KVM
                 */
@@ -1499,6 +1493,9 @@ void __init enable_IR_x2apic(void)
                x2apic_force_phys();
        }
 
+       if (ret == IRQ_REMAP_XAPIC_MODE)
+               goto nox2apic;
+
        x2apic_enabled = 1;
 
        if (x2apic_supported() && !x2apic_mode) {
@@ -1508,19 +1505,21 @@ void __init enable_IR_x2apic(void)
        }
 
 nox2apic:
-       if (!ret) /* IR enabling failed */
+       if (ret < 0) /* IR enabling failed */
                restore_ioapic_entries();
        legacy_pic->restore_mask();
        local_irq_restore(flags);
 
 out:
-       if (x2apic_enabled)
+       if (x2apic_enabled || !x2apic_supported())
                return;
 
        if (x2apic_preenabled)
                panic("x2apic: enabled by BIOS but kernel init failed.");
-       else if (cpu_has_x2apic)
-               pr_info("Not enabling x2apic, Intr-remapping init failed.\n");
+       else if (ret == IRQ_REMAP_XAPIC_MODE)
+               pr_info("x2apic not enabled, IRQ remapping is in xapic mode\n");
+       else if (ret < 0)
+               pr_info("x2apic not enabled, IRQ remapping init failed\n");
 }
 
 #ifdef CONFIG_X86_64