aboutsummaryrefslogtreecommitdiff
path: root/arch/x86/include/asm/irq_vectors.h
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2009-01-31 02:56:44 +0100
committerIngo Molnar <mingo@elte.hu>2009-01-31 04:21:25 +0100
commit009eb3fe146aa6f1951f3c5235851bb8d1330dfb (patch)
tree6b2cba03c7ab3d3f067729d0e62b7674ba1c3907 /arch/x86/include/asm/irq_vectors.h
parentc379698fdac7cb65c96dec549850ce606dd6ceba (diff)
x86, irq: describe NR_IRQ sizing details, clean up
Impact: cleanup Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86/include/asm/irq_vectors.h')
-rw-r--r--arch/x86/include/asm/irq_vectors.h32
1 files changed, 23 insertions, 9 deletions
diff --git a/arch/x86/include/asm/irq_vectors.h b/arch/x86/include/asm/irq_vectors.h
index ec87910025d..41e2450e13b 100644
--- a/arch/x86/include/asm/irq_vectors.h
+++ b/arch/x86/include/asm/irq_vectors.h
@@ -126,23 +126,37 @@
#define LAST_VM86_IRQ 15
#define invalid_vm86_irq(irq) ((irq) < 3 || (irq) > 15)
+/*
+ * Size the maximum number of interrupts.
+ *
+ * If the irq_desc[] array has a sparse layout, we can size things
+ * generously - it scales up linearly with the maximum number of CPUs,
+ * and the maximum number of IO-APICs, whichever is higher.
+ *
+ * In other cases we size more conservatively, to not create too large
+ * static arrays.
+ */
+
#define NR_IRQS_LEGACY 16
+#define CPU_VECTOR_LIMIT ( 8 * NR_CPUS )
+#define IO_APIC_VECTOR_LIMIT ( 32 * MAX_IO_APICS )
+
#ifdef CONFIG_X86_IO_APIC
-# ifndef CONFIG_SPARSE_IRQ
+# ifdef CONFIG_SPARSE_IRQ
+# define NR_IRQS \
+ (CPU_VECTOR_LIMIT > IO_APIC_VECTOR_LIMIT ? \
+ (NR_VECTORS + CPU_VECTOR_LIMIT) : \
+ (NR_VECTORS + IO_APIC_VECTOR_LIMIT))
+# else
# if NR_CPUS < MAX_IO_APICS
-# define NR_IRQS (NR_VECTORS + (32 * NR_CPUS))
+# define NR_IRQS (NR_VECTORS + 4*CPU_VECTOR_LIMIT)
# else
-# define NR_IRQS (NR_VECTORS + (32 * MAX_IO_APICS))
+# define NR_IRQS (NR_VECTORS + IO_APIC_VECTOR_LIMIT)
# endif
-# else
-# define NR_IRQS \
- ((8 * NR_CPUS) > (32 * MAX_IO_APICS) ? \
- (NR_VECTORS + (8 * NR_CPUS)) : \
- (NR_VECTORS + (32 * MAX_IO_APICS)))
# endif
#else /* !CONFIG_X86_IO_APIC: */
-# define NR_IRQS 16
+# define NR_IRQS NR_IRQS_LEGACY
#endif
#endif /* _ASM_X86_IRQ_VECTORS_H */