x86, intr-remap: fix x2apic/intr-remap resume
authorWeidong Han <weidong.han@intel.com>
Fri, 17 Apr 2009 08:42:16 +0000 (16:42 +0800)
committerIngo Molnar <mingo@elte.hu>
Sun, 19 Apr 2009 08:22:05 +0000 (10:22 +0200)
Interrupt remapping was decoupled from x2apic. Shouldn't check
x2apic before resume interrupt remapping. Otherwise, interrupt
remapping won't be resumed when x2apic is not enabled.

[ Impact: fix potential intr-remap resume hang on !x2apic ]

Signed-off-by: Suresh Siddha <suresh.b.siddha@intel.com>
Signed-off-by: Weidong Han <weidong.han@intel.com>
Acked-by: David Woodhouse <David.Woodhouse@intel.com>
Cc: iommu@lists.linux-foundation.org
Cc: allen.m.kay@intel.com
Cc: fenghua.yu@intel.com
LKML-Reference: <1239957736-6161-6-git-send-email-weidong.han@intel.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
arch/x86/kernel/apic/apic.c

index 0cf1eea750cc439a444e530f1999df0c021426db..7b41a32339e0a0ae3a5b29c8aa50827b6a354480 100644 (file)
@@ -2032,7 +2032,7 @@ static int lapic_resume(struct sys_device *dev)
                return 0;
 
        local_irq_save(flags);
-       if (x2apic) {
+       if (intr_remapping_enabled) {
                ioapic_entries = alloc_ioapic_entries();
                if (!ioapic_entries) {
                        WARN(1, "Alloc ioapic_entries in lapic resume failed.");
@@ -2048,8 +2048,10 @@ static int lapic_resume(struct sys_device *dev)
 
                mask_IO_APIC_setup(ioapic_entries);
                mask_8259A();
-               enable_x2apic();
        }
+
+       if (x2apic)
+               enable_x2apic();
 #else
        if (!apic_pm_state.active)
                return 0;
@@ -2097,10 +2099,12 @@ static int lapic_resume(struct sys_device *dev)
        apic_read(APIC_ESR);
 
 #ifdef CONFIG_INTR_REMAP
-       if (intr_remapping_enabled)
-               reenable_intr_remapping(EIM_32BIT_APIC_ID);
+       if (intr_remapping_enabled) {
+               if (x2apic)
+                       reenable_intr_remapping(EIM_32BIT_APIC_ID);
+               else
+                       reenable_intr_remapping(EIM_8BIT_APIC_ID);
 
-       if (x2apic) {
                unmask_8259A();
                restore_IO_APIC_setup(ioapic_entries);
                free_ioapic_entries(ioapic_entries);
@@ -2109,7 +2113,6 @@ static int lapic_resume(struct sys_device *dev)
 
        local_irq_restore(flags);
 
-
        return 0;
 }