Commit e0c1e9bf authored by Kimball Murray's avatar Kimball Murray Committed by Linus Torvalds

[PATCH] x86_64: avoid IRQ0 ioapic pin collision

The patch addresses a problem with ACPI SCI interrupt entry, which gets
re-used, and the IRQ is assigned to another unrelated device.  The patch
corrects the code such that SCI IRQ is skipped and duplicate entry is
avoided.  Second issue came up with VIA chipset, the problem was caused by
original patch assigning IRQs starting 16 and up.  The VIA chipset uses
4-bit IRQ register for internal interrupt routing, and therefore cannot
handle IRQ numbers assigned to its devices.  The patch corrects this
problem by allowing PCI IRQs below 16.

Cc: len.brown@intel.com

Signed-off by: Natalie Protasevich <Natalie.Protasevich@unisys.com>
Signed-off-by: default avatarAndi Kleen <ak@suse.de>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent abfd3057
...@@ -2238,6 +2238,8 @@ static inline void unlock_ExtINT_logic(void) ...@@ -2238,6 +2238,8 @@ static inline void unlock_ExtINT_logic(void)
spin_unlock_irqrestore(&ioapic_lock, flags); spin_unlock_irqrestore(&ioapic_lock, flags);
} }
int timer_uses_ioapic_pin_0;
/* /*
* This code may look a bit paranoid, but it's supposed to cooperate with * This code may look a bit paranoid, but it's supposed to cooperate with
* a wide range of boards and BIOS bugs. Fortunately only the timer IRQ * a wide range of boards and BIOS bugs. Fortunately only the timer IRQ
...@@ -2274,6 +2276,9 @@ static inline void check_timer(void) ...@@ -2274,6 +2276,9 @@ static inline void check_timer(void)
pin2 = ioapic_i8259.pin; pin2 = ioapic_i8259.pin;
apic2 = ioapic_i8259.apic; apic2 = ioapic_i8259.apic;
if (pin1 == 0)
timer_uses_ioapic_pin_0 = 1;
printk(KERN_INFO "..TIMER: vector=0x%02X apic1=%d pin1=%d apic2=%d pin2=%d\n", printk(KERN_INFO "..TIMER: vector=0x%02X apic1=%d pin1=%d apic2=%d pin2=%d\n",
vector, apic1, pin1, apic2, pin2); vector, apic1, pin1, apic2, pin2);
......
...@@ -1130,7 +1130,17 @@ int mp_register_gsi (u32 gsi, int triggering, int polarity) ...@@ -1130,7 +1130,17 @@ int mp_register_gsi (u32 gsi, int triggering, int polarity)
*/ */
int irq = gsi; int irq = gsi;
if (gsi < MAX_GSI_NUM) { if (gsi < MAX_GSI_NUM) {
if (gsi > 15) /*
* Retain the VIA chipset work-around (gsi > 15), but
* avoid a problem where the 8254 timer (IRQ0) is setup
* via an override (so it's not on pin 0 of the ioapic),
* and at the same time, the pin 0 interrupt is a PCI
* type. The gsi > 15 test could cause these two pins
* to be shared as IRQ0, and they are not shareable.
* So test for this condition, and if necessary, avoid
* the pin collision.
*/
if (gsi > 15 || (gsi == 0 && !timer_uses_ioapic_pin_0))
gsi = pci_irq++; gsi = pci_irq++;
/* /*
* Don't assign IRQ used by ACPI SCI * Don't assign IRQ used by ACPI SCI
......
...@@ -1777,6 +1777,8 @@ static inline void unlock_ExtINT_logic(void) ...@@ -1777,6 +1777,8 @@ static inline void unlock_ExtINT_logic(void)
spin_unlock_irqrestore(&ioapic_lock, flags); spin_unlock_irqrestore(&ioapic_lock, flags);
} }
int timer_uses_ioapic_pin_0;
/* /*
* This code may look a bit paranoid, but it's supposed to cooperate with * This code may look a bit paranoid, but it's supposed to cooperate with
* a wide range of boards and BIOS bugs. Fortunately only the timer IRQ * a wide range of boards and BIOS bugs. Fortunately only the timer IRQ
...@@ -1814,6 +1816,9 @@ static inline void check_timer(void) ...@@ -1814,6 +1816,9 @@ static inline void check_timer(void)
pin2 = ioapic_i8259.pin; pin2 = ioapic_i8259.pin;
apic2 = ioapic_i8259.apic; apic2 = ioapic_i8259.apic;
if (pin1 == 0)
timer_uses_ioapic_pin_0 = 1;
apic_printk(APIC_VERBOSE,KERN_INFO "..TIMER: vector=0x%02X apic1=%d pin1=%d apic2=%d pin2=%d\n", apic_printk(APIC_VERBOSE,KERN_INFO "..TIMER: vector=0x%02X apic1=%d pin1=%d apic2=%d pin2=%d\n",
vector, apic1, pin1, apic2, pin2); vector, apic1, pin1, apic2, pin2);
......
...@@ -968,7 +968,17 @@ int mp_register_gsi(u32 gsi, int triggering, int polarity) ...@@ -968,7 +968,17 @@ int mp_register_gsi(u32 gsi, int triggering, int polarity)
*/ */
int irq = gsi; int irq = gsi;
if (gsi < MAX_GSI_NUM) { if (gsi < MAX_GSI_NUM) {
if (gsi > 15) /*
* Retain the VIA chipset work-around (gsi > 15), but
* avoid a problem where the 8254 timer (IRQ0) is setup
* via an override (so it's not on pin 0 of the ioapic),
* and at the same time, the pin 0 interrupt is a PCI
* type. The gsi > 15 test could cause these two pins
* to be shared as IRQ0, and they are not shareable.
* So test for this condition, and if necessary, avoid
* the pin collision.
*/
if (gsi > 15 || (gsi == 0 && !timer_uses_ioapic_pin_0))
gsi = pci_irq++; gsi = pci_irq++;
/* /*
* Don't assign IRQ used by ACPI SCI * Don't assign IRQ used by ACPI SCI
......
...@@ -200,6 +200,7 @@ extern int io_apic_get_unique_id (int ioapic, int apic_id); ...@@ -200,6 +200,7 @@ extern int io_apic_get_unique_id (int ioapic, int apic_id);
extern int io_apic_get_version (int ioapic); extern int io_apic_get_version (int ioapic);
extern int io_apic_get_redir_entries (int ioapic); extern int io_apic_get_redir_entries (int ioapic);
extern int io_apic_set_pci_routing (int ioapic, int pin, int irq, int edge_level, int active_high_low); extern int io_apic_set_pci_routing (int ioapic, int pin, int irq, int edge_level, int active_high_low);
extern int timer_uses_ioapic_pin_0;
#endif /* CONFIG_ACPI */ #endif /* CONFIG_ACPI */
extern int (*ioapic_renumber_irq)(int ioapic, int irq); extern int (*ioapic_renumber_irq)(int ioapic, int irq);
......
...@@ -205,6 +205,7 @@ extern int skip_ioapic_setup; ...@@ -205,6 +205,7 @@ extern int skip_ioapic_setup;
extern int io_apic_get_version (int ioapic); extern int io_apic_get_version (int ioapic);
extern int io_apic_get_redir_entries (int ioapic); extern int io_apic_get_redir_entries (int ioapic);
extern int io_apic_set_pci_routing (int ioapic, int pin, int irq, int, int); extern int io_apic_set_pci_routing (int ioapic, int pin, int irq, int, int);
extern int timer_uses_ioapic_pin_0;
#endif #endif
extern int sis_apic_bug; /* dummy */ extern int sis_apic_bug; /* dummy */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment