Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

x86/irq: Refine the way to calculate NR_IRQS

Now we have made MSI independent of IOAPIC, so we need to refine the
way to calculate NR_IRQS to support configuration with MSI enabled but
IOAPIC disabled.

Signed-off-by: Jiang Liu <jiang.liu@linux.intel.com>
Tested-by: Joerg Roedel <jroedel@suse.de>
Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Cc: David Cohen <david.a.cohen@linux.intel.com>
Cc: Sander Eikelenboom <linux@eikelenboom.it>
Cc: David Vrabel <david.vrabel@citrix.com>
Cc: Tony Luck <tony.luck@intel.com>
Cc: Joerg Roedel <joro@8bytes.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Bjorn Helgaas <bhelgaas@google.com>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Rafael J. Wysocki <rjw@rjwysocki.net>
Cc: Randy Dunlap <rdunlap@infradead.org>
Cc: Yinghai Lu <yinghai@kernel.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Dimitri Sivanich <sivanich@sgi.com>
Cc: Jan Beulich <JBeulich@suse.com>
Link: http://lkml.kernel.org/r/1428978610-28986-28-git-send-email-jiang.liu@linux.intel.com
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>

authored by

Jiang Liu and committed by
Thomas Gleixner
4399b14f 7f3262ed

+11 -7
+11 -7
arch/x86/include/asm/irq_vectors.h
··· 155 155 * static arrays. 156 156 */ 157 157 158 - #define NR_IRQS_LEGACY 16 158 + #define NR_IRQS_LEGACY 16 159 159 160 - #define IO_APIC_VECTOR_LIMIT ( 32 * MAX_IO_APICS ) 160 + #define CPU_VECTOR_LIMIT (64 * NR_CPUS) 161 + #define IO_APIC_VECTOR_LIMIT (32 * MAX_IO_APICS) 161 162 162 - #ifdef CONFIG_X86_IO_APIC 163 - # define CPU_VECTOR_LIMIT (64 * NR_CPUS) 164 - # define NR_IRQS \ 163 + #if defined(CONFIG_X86_IO_APIC) && defined(CONFIG_PCI_MSI) 164 + #define NR_IRQS \ 165 165 (CPU_VECTOR_LIMIT > IO_APIC_VECTOR_LIMIT ? \ 166 166 (NR_VECTORS + CPU_VECTOR_LIMIT) : \ 167 167 (NR_VECTORS + IO_APIC_VECTOR_LIMIT)) 168 - #else /* !CONFIG_X86_IO_APIC: */ 169 - # define NR_IRQS NR_IRQS_LEGACY 168 + #elif defined(CONFIG_X86_IO_APIC) 169 + #define NR_IRQS (NR_VECTORS + IO_APIC_VECTOR_LIMIT) 170 + #elif defined(CONFIG_PCI_MSI) 171 + #define NR_IRQS (NR_VECTORS + CPU_VECTOR_LIMIT) 172 + #else 173 + #define NR_IRQS NR_IRQS_LEGACY 170 174 #endif 171 175 172 176 #endif /* _ASM_X86_IRQ_VECTORS_H */