aboutsummaryrefslogtreecommitdiffstats
path: root/arch/i386/kernel/mpparse.c
diff options
context:
space:
mode:
authorNatalie Protasevich <Natalie.Protasevich@unisys.com>2005-06-23 03:08:29 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-06-23 12:45:10 -0400
commitc434b7a6aedfe428ad17cd61b21b125a7b7a29ce (patch)
tree1b1fb9d7279e715b765d8a4dd8a439166d68c516 /arch/i386/kernel/mpparse.c
parentb5d23e5b8c7ecd97d32f6ad7680d9909977580a7 (diff)
[PATCH] x86: avoid wasting IRQs for PCI devices
I have submitted the patch for x86_64, this is submission for i386. The patch changes the way IRQs are handed out to PCI devices. Currently, each I/O APIC pin gets associated with an IRQ, no matter if the pin is used or not. This imposes severe limitation on systems that have designs that employ many I/O APICs, only utilizing couple lines of each, such as P64H2 chipset. It is used in ES7000, and currently, there is no way to boot the system with more that 9 I/O APICs. The simple change below allows to boot a system with say 64 (or more) I/O APICs, each providing 1 slot, which otherwise impossible because of the IRQ gaps created for unused lines on each I/O APIC. It does not resolve the problem with number of devices that exceeds number of possible IRQs, but eases up a tension for IRQs on any large system with potentually large number of devices. Signed-off-by: Natalie Protasevich <Natalie.Protasevich@unisys.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'arch/i386/kernel/mpparse.c')
-rw-r--r--arch/i386/kernel/mpparse.c26
1 files changed, 25 insertions, 1 deletions
diff --git a/arch/i386/kernel/mpparse.c b/arch/i386/kernel/mpparse.c
index 0a061056b828..383a11600d2c 100644
--- a/arch/i386/kernel/mpparse.c
+++ b/arch/i386/kernel/mpparse.c
@@ -1058,11 +1058,20 @@ void __init mp_config_acpi_legacy_irqs (void)
1058 } 1058 }
1059} 1059}
1060 1060
1061#define MAX_GSI_NUM 4096
1062
1061int mp_register_gsi (u32 gsi, int edge_level, int active_high_low) 1063int mp_register_gsi (u32 gsi, int edge_level, int active_high_low)
1062{ 1064{
1063 int ioapic = -1; 1065 int ioapic = -1;
1064 int ioapic_pin = 0; 1066 int ioapic_pin = 0;
1065 int idx, bit = 0; 1067 int idx, bit = 0;
1068 static int pci_irq = 16;
1069 /*
1070 * Mapping between Global System Interrups, which
1071 * represent all possible interrupts, and IRQs
1072 * assigned to actual devices.
1073 */
1074 static int gsi_to_irq[MAX_GSI_NUM];
1066 1075
1067#ifdef CONFIG_ACPI_BUS 1076#ifdef CONFIG_ACPI_BUS
1068 /* Don't set up the ACPI SCI because it's already set up */ 1077 /* Don't set up the ACPI SCI because it's already set up */
@@ -1097,11 +1106,26 @@ int mp_register_gsi (u32 gsi, int edge_level, int active_high_low)
1097 if ((1<<bit) & mp_ioapic_routing[ioapic].pin_programmed[idx]) { 1106 if ((1<<bit) & mp_ioapic_routing[ioapic].pin_programmed[idx]) {
1098 Dprintk(KERN_DEBUG "Pin %d-%d already programmed\n", 1107 Dprintk(KERN_DEBUG "Pin %d-%d already programmed\n",
1099 mp_ioapic_routing[ioapic].apic_id, ioapic_pin); 1108 mp_ioapic_routing[ioapic].apic_id, ioapic_pin);
1100 return gsi; 1109 return gsi_to_irq[gsi];
1101 } 1110 }
1102 1111
1103 mp_ioapic_routing[ioapic].pin_programmed[idx] |= (1<<bit); 1112 mp_ioapic_routing[ioapic].pin_programmed[idx] |= (1<<bit);
1104 1113
1114 if (edge_level) {
1115 /*
1116 * For PCI devices assign IRQs in order, avoiding gaps
1117 * due to unused I/O APIC pins.
1118 */
1119 int irq = gsi;
1120 if (gsi < MAX_GSI_NUM) {
1121 gsi = pci_irq++;
1122 gsi_to_irq[irq] = gsi;
1123 } else {
1124 printk(KERN_ERR "GSI %u is too high\n", gsi);
1125 return gsi;
1126 }
1127 }
1128
1105 io_apic_set_pci_routing(ioapic, ioapic_pin, gsi, 1129 io_apic_set_pci_routing(ioapic, ioapic_pin, gsi,
1106 edge_level == ACPI_EDGE_SENSITIVE ? 0 : 1, 1130 edge_level == ACPI_EDGE_SENSITIVE ? 0 : 1,
1107 active_high_low == ACPI_ACTIVE_HIGH ? 0 : 1); 1131 active_high_low == ACPI_ACTIVE_HIGH ? 0 : 1);