From f2cee0af20f7e0b0cf297c52a6c151978083ea3e Mon Sep 17 00:00:00 2001 From: James Cleverdon Date: Tue, 21 Oct 2003 07:27:58 -0700 Subject: [PATCH] [PATCH] Allow more APIC irq sources The "irq_vector[]" array is indexed by the sum of all RTEs in all I/O APICs, and is not necessarily limited by the x86 CPU irq vector inputs. In fact, the irq vector index would overflow on big machines with lots of IO APIC's, causing the boot to fail. So grow the array for the big SMP boxes, keeping the default the same as before (and shrink the vector entry size down to a 8-bit value, since that's the size of the actual CPU vector entry). --- arch/i386/kernel/io_apic.c | 5 +++-- include/asm-i386/hw_irq.h | 4 ++-- include/asm-i386/mach-default/irq_vectors.h | 6 ++++++ 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/arch/i386/kernel/io_apic.c b/arch/i386/kernel/io_apic.c index e9e656a63d75c..2907f82f69887 100644 --- a/arch/i386/kernel/io_apic.c +++ b/arch/i386/kernel/io_apic.c @@ -1138,12 +1138,13 @@ static inline int IO_APIC_irq_trigger(int irq) return 0; } -int irq_vector[NR_IRQS] = { FIRST_DEVICE_VECTOR , 0 }; +/* irq_vectors is indexed by the sum of all RTEs in all I/O APICs. */ +u8 irq_vector[NR_IRQ_VECTORS] = { FIRST_DEVICE_VECTOR , 0 }; static int __init assign_irq_vector(int irq) { static int current_vector = FIRST_DEVICE_VECTOR, offset = 0; - BUG_ON(irq >= NR_IRQS); + BUG_ON(irq >= NR_IRQ_VECTORS); if (IO_APIC_VECTOR(irq) > 0) return IO_APIC_VECTOR(irq); next: diff --git a/include/asm-i386/hw_irq.h b/include/asm-i386/hw_irq.h index 0ed5a111d7ca3..225539187eb60 100644 --- a/include/asm-i386/hw_irq.h +++ b/include/asm-i386/hw_irq.h @@ -25,8 +25,8 @@ * Interrupt entry/exit code at both C and assembly level */ -extern int irq_vector[NR_IRQS]; -#define IO_APIC_VECTOR(irq) irq_vector[irq] +extern u8 irq_vector[NR_IRQ_VECTORS]; +#define IO_APIC_VECTOR(irq) ((int)irq_vector[irq]) extern void (*interrupt[NR_IRQS])(void); diff --git a/include/asm-i386/mach-default/irq_vectors.h b/include/asm-i386/mach-default/irq_vectors.h index df6191450ed5c..a0371dc311373 100644 --- a/include/asm-i386/mach-default/irq_vectors.h +++ b/include/asm-i386/mach-default/irq_vectors.h @@ -78,8 +78,14 @@ */ #ifdef CONFIG_X86_IO_APIC #define NR_IRQS 224 +# if (224 >= 32 * NR_CPUS) +# define NR_IRQ_VECTORS NR_IRQS +# else +# define NR_IRQ_VECTORS (32 * NR_CPUS) +# endif #else #define NR_IRQS 16 +#define NR_IRQ_VECTORS NR_IRQS #endif #define FPU_IRQ 13 -- 2.53.0