Merge branch 'tty-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh...
[pandora-kernel.git] / arch / x86 / kernel / apic / apic.c
index f92a8e5..b9338b8 100644 (file)
@@ -390,7 +390,8 @@ static unsigned int reserve_eilvt_offset(int offset, unsigned int new)
 
 /*
  * If mask=1, the LVT entry does not generate interrupts while mask=0
- * enables the vector. See also the BKDGs.
+ * enables the vector. See also the BKDGs. Must be called with
+ * preemption disabled.
  */
 
 int setup_APIC_eilvt(u8 offset, u8 vector, u8 msg_type, u8 mask)
@@ -1461,7 +1462,6 @@ int __init enable_IR(void)
 void __init enable_IR_x2apic(void)
 {
        unsigned long flags;
-       struct IO_APIC_route_entry **ioapic_entries;
        int ret, x2apic_enabled = 0;
        int dmar_table_init_ret;
 
@@ -1469,13 +1469,7 @@ void __init enable_IR_x2apic(void)
        if (dmar_table_init_ret && !x2apic_supported())
                return;
 
-       ioapic_entries = alloc_ioapic_entries();
-       if (!ioapic_entries) {
-               pr_err("Allocate ioapic_entries failed\n");
-               goto out;
-       }
-
-       ret = save_IO_APIC_setup(ioapic_entries);
+       ret = save_ioapic_entries();
        if (ret) {
                pr_info("Saving IO-APIC state failed: %d\n", ret);
                goto out;
@@ -1483,7 +1477,7 @@ void __init enable_IR_x2apic(void)
 
        local_irq_save(flags);
        legacy_pic->mask_all();
-       mask_IO_APIC_setup(ioapic_entries);
+       mask_ioapic_entries();
 
        if (dmar_table_init_ret)
                ret = 0;
@@ -1514,14 +1508,11 @@ void __init enable_IR_x2apic(void)
 
 nox2apic:
        if (!ret) /* IR enabling failed */
-               restore_IO_APIC_setup(ioapic_entries);
+               restore_ioapic_entries();
        legacy_pic->restore_mask();
        local_irq_restore(flags);
 
 out:
-       if (ioapic_entries)
-               free_ioapic_entries(ioapic_entries);
-
        if (x2apic_enabled)
                return;
 
@@ -2095,28 +2086,20 @@ static void lapic_resume(void)
 {
        unsigned int l, h;
        unsigned long flags;
-       int maxlvt, ret;
-       struct IO_APIC_route_entry **ioapic_entries = NULL;
+       int maxlvt;
 
        if (!apic_pm_state.active)
                return;
 
        local_irq_save(flags);
        if (intr_remapping_enabled) {
-               ioapic_entries = alloc_ioapic_entries();
-               if (!ioapic_entries) {
-                       WARN(1, "Alloc ioapic_entries in lapic resume failed.");
-                       goto restore;
-               }
-
-               ret = save_IO_APIC_setup(ioapic_entries);
-               if (ret) {
-                       WARN(1, "Saving IO-APIC state failed: %d\n", ret);
-                       free_ioapic_entries(ioapic_entries);
-                       goto restore;
-               }
-
-               mask_IO_APIC_setup(ioapic_entries);
+               /*
+                * IO-APIC and PIC have their own resume routines.
+                * We just mask them here to make sure the interrupt
+                * subsystem is completely quiet while we enable x2apic
+                * and interrupt-remapping.
+                */
+               mask_ioapic_entries();
                legacy_pic->mask_all();
        }
 
@@ -2159,13 +2142,9 @@ static void lapic_resume(void)
        apic_write(APIC_ESR, 0);
        apic_read(APIC_ESR);
 
-       if (intr_remapping_enabled) {
+       if (intr_remapping_enabled)
                reenable_intr_remapping(x2apic_mode);
-               legacy_pic->restore_mask();
-               restore_IO_APIC_setup(ioapic_entries);
-               free_ioapic_entries(ioapic_entries);
-       }
-restore:
+
        local_irq_restore(flags);
 }