From: Bjorn Helgaas The "vector" terminology is architecture-dependent. The PCI MSI interface actually deals with Linux IRQ numbers (i.e., things you can pass to request_irq()), and we shouldn't confuse things by calling them "vectors" just because we're using MSI rather than an IOSAPIC. Signed-off-by: Bjorn Helgaas Signed-off-by: Andrew Morton --- 25-akpm/Documentation/MSI-HOWTO.txt | 8 ++--- 25-akpm/arch/i386/kernel/io_apic.c | 6 ++-- 25-akpm/arch/i386/pci/irq.c | 4 +- 25-akpm/arch/x86_64/kernel/i8259.c | 4 +- 25-akpm/arch/x86_64/kernel/io_apic.c | 6 ++-- 25-akpm/drivers/pci/Kconfig | 19 ++++--------- 25-akpm/drivers/pci/Makefile | 2 - 25-akpm/include/asm-i386/io_apic.h | 2 - 25-akpm/include/asm-i386/mach-default/irq_vectors_limits.h | 2 - 25-akpm/include/asm-x86_64/io_apic.h | 2 - 25-akpm/include/asm-x86_64/irq.h | 2 - 25-akpm/include/linux/pci.h | 2 - 12 files changed, 26 insertions(+), 33 deletions(-) diff -puN arch/i386/kernel/io_apic.c~rename-config_pci_use_vector-to-config_pci_msi arch/i386/kernel/io_apic.c --- 25/arch/i386/kernel/io_apic.c~rename-config_pci_use_vector-to-config_pci_msi Wed Jul 28 15:19:34 2004 +++ 25-akpm/arch/i386/kernel/io_apic.c Wed Jul 28 15:19:34 2004 @@ -74,7 +74,7 @@ static struct irq_pin_list { } irq_2_pin[PIN_MAP_SIZE]; int vector_irq[NR_VECTORS] = { [0 ... NR_VECTORS - 1] = -1}; -#ifdef CONFIG_PCI_USE_VECTOR +#ifdef CONFIG_PCI_MSI #define vector_to_irq(vector) \ (platform_legacy_irq(vector) ? vector : vector_irq[vector]) #else @@ -1115,7 +1115,7 @@ static inline int IO_APIC_irq_trigger(in /* 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 }; -#ifdef CONFIG_PCI_USE_VECTOR +#ifdef CONFIG_PCI_MSI int assign_irq_vector(int irq) #else int __init assign_irq_vector(int irq) @@ -1869,7 +1869,7 @@ static void end_level_ioapic_irq (unsign } } -#ifdef CONFIG_PCI_USE_VECTOR +#ifdef CONFIG_PCI_MSI static unsigned int startup_edge_ioapic_vector(unsigned int vector) { int irq = vector_to_irq(vector); diff -puN arch/i386/pci/irq.c~rename-config_pci_use_vector-to-config_pci_msi arch/i386/pci/irq.c --- 25/arch/i386/pci/irq.c~rename-config_pci_use_vector-to-config_pci_msi Wed Jul 28 15:19:34 2004 +++ 25-akpm/arch/i386/pci/irq.c Wed Jul 28 15:19:34 2004 @@ -817,7 +817,7 @@ static int pcibios_lookup_irq(struct pci if ( dev2->irq && dev2->irq != irq && \ (!(pci_probe & PCI_USE_PIRQ_MASK) || \ ((1 << dev2->irq) & mask)) ) { -#ifndef CONFIG_PCI_USE_VECTOR +#ifndef CONFIG_PCI_MSI printk(KERN_INFO "IRQ routing conflict for %s, have irq %d, want irq %d\n", pci_name(dev2), dev2->irq, irq); #endif @@ -1034,7 +1034,7 @@ int pirq_enable_irq(struct pci_dev *dev) } dev = temp_dev; if (irq >= 0) { -#ifdef CONFIG_PCI_USE_VECTOR +#ifdef CONFIG_PCI_MSI if (!platform_legacy_irq(irq)) irq = IO_APIC_VECTOR(irq); #endif diff -puN arch/x86_64/kernel/i8259.c~rename-config_pci_use_vector-to-config_pci_msi arch/x86_64/kernel/i8259.c --- 25/arch/x86_64/kernel/i8259.c~rename-config_pci_use_vector-to-config_pci_msi Wed Jul 28 15:19:34 2004 +++ 25-akpm/arch/x86_64/kernel/i8259.c Wed Jul 28 15:19:34 2004 @@ -76,7 +76,7 @@ BUILD_16_IRQS(0x4) BUILD_16_IRQS(0x5) BU BUILD_16_IRQS(0x8) BUILD_16_IRQS(0x9) BUILD_16_IRQS(0xa) BUILD_16_IRQS(0xb) BUILD_16_IRQS(0xc) BUILD_16_IRQS(0xd) -#ifdef CONFIG_PCI_USE_VECTOR +#ifdef CONFIG_PCI_MSI BUILD_14_IRQS(0xe) #endif @@ -111,7 +111,7 @@ void (*interrupt[NR_IRQS])(void) = { IRQLIST_16(0x8), IRQLIST_16(0x9), IRQLIST_16(0xa), IRQLIST_16(0xb), IRQLIST_16(0xc), IRQLIST_16(0xd) -#ifdef CONFIG_PCI_USE_VECTOR +#ifdef CONFIG_PCI_MSI , IRQLIST_14(0xe) #endif diff -puN arch/x86_64/kernel/io_apic.c~rename-config_pci_use_vector-to-config_pci_msi arch/x86_64/kernel/io_apic.c --- 25/arch/x86_64/kernel/io_apic.c~rename-config_pci_use_vector-to-config_pci_msi Wed Jul 28 15:19:34 2004 +++ 25-akpm/arch/x86_64/kernel/io_apic.c Wed Jul 28 15:19:34 2004 @@ -68,7 +68,7 @@ static struct irq_pin_list { } irq_2_pin[PIN_MAP_SIZE]; int vector_irq[NR_VECTORS] = { [0 ... NR_VECTORS - 1] = -1}; -#ifdef CONFIG_PCI_USE_VECTOR +#ifdef CONFIG_PCI_MSI #define vector_to_irq(vector) \ (platform_legacy_irq(vector) ? vector : vector_irq[vector]) #else @@ -656,7 +656,7 @@ static inline int IO_APIC_irq_trigger(in /* 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 }; -#ifdef CONFIG_PCI_USE_VECTOR +#ifdef CONFIG_PCI_MSI int assign_irq_vector(int irq) #else int __init assign_irq_vector(int irq) @@ -1406,7 +1406,7 @@ static void set_ioapic_affinity_irq(unsi spin_unlock_irqrestore(&ioapic_lock, flags); } -#ifdef CONFIG_PCI_USE_VECTOR +#ifdef CONFIG_PCI_MSI static unsigned int startup_edge_ioapic_vector(unsigned int vector) { int irq = vector_to_irq(vector); diff -puN Documentation/MSI-HOWTO.txt~rename-config_pci_use_vector-to-config_pci_msi Documentation/MSI-HOWTO.txt --- 25/Documentation/MSI-HOWTO.txt~rename-config_pci_use_vector-to-config_pci_msi Wed Jul 28 15:19:34 2004 +++ 25-akpm/Documentation/MSI-HOWTO.txt Wed Jul 28 15:19:34 2004 @@ -93,7 +93,7 @@ increase scalability. 5. Configuring a driver to use MSI/MSI-X By default, the kernel will not enable MSI/MSI-X on all devices that -support this capability. The CONFIG_PCI_USE_VECTOR kernel option +support this capability. The CONFIG_PCI_MSI kernel option must be selected to enable MSI/MSI-X support. 5.1 Including MSI/MSI-X support into the kernel @@ -101,10 +101,10 @@ must be selected to enable MSI/MSI-X sup To allow MSI/MSI-X capable device drivers to selectively enable MSI/MSI-X (using pci_enable_msi()/pci_enable_msix() as described below), the VECTOR based scheme needs to be enabled by setting -CONFIG_PCI_USE_VECTOR during kernel config. +CONFIG_PCI_MSI during kernel config. Since the target of the inbound message is the local APIC, providing -CONFIG_X86_LOCAL_APIC must be enabled as well as CONFIG_PCI_USE_VECTOR. +CONFIG_X86_LOCAL_APIC must be enabled as well as CONFIG_PCI_MSI. 5.2 Configuring for MSI support @@ -410,7 +410,7 @@ system whether it runs when CONFIG_X86_L In SMP environment, CONFIG_X86_LOCAL_APIC is automatically set; however, in UP environment, users must manually set CONFIG_X86_LOCAL_APIC. Once CONFIG_X86_LOCAL_APIC=y, setting -CONFIG_PCI_USE_VECTOR enables the VECTOR based scheme and +CONFIG_PCI_MSI enables the VECTOR based scheme and the option for MSI-capable device drivers to selectively enable MSI/MSI-X. diff -puN drivers/pci/Kconfig~rename-config_pci_use_vector-to-config_pci_msi drivers/pci/Kconfig --- 25/drivers/pci/Kconfig~rename-config_pci_use_vector-to-config_pci_msi Wed Jul 28 15:19:34 2004 +++ 25-akpm/drivers/pci/Kconfig Wed Jul 28 15:19:34 2004 @@ -1,22 +1,15 @@ # # PCI configuration # -config PCI_USE_VECTOR - bool "Vector-based interrupt indexing (MSI)" +config PCI_MSI + bool "Message Signaled Interrupts (MSI and MSI-X)" depends on (X86_LOCAL_APIC && X86_IO_APIC) || IA64 default n help - This replaces the current existing IRQ-based index interrupt scheme - with the vector-base index scheme. The advantages of vector base - over IRQ base are listed below: - 1) Support MSI implementation. - 2) Support future IOxAPIC hotplug - - Note that this allows the device drivers to enable MSI, Message - Signaled Interrupt, on all MSI capable device functions detected. - Message Signal Interrupt enables an MSI-capable hardware device to - send an inbound Memory Write on its PCI bus instead of asserting - IRQ signal on device IRQ pin. + This allows device drivers to enable MSI (Message Signaled + Interrupts). Message Signaled Interrupts enable a device to + generate an interrupt using an inbound Memory Write on its + PCI bus instead of asserting a device IRQ pin. If you don't know what to do here, say N. diff -puN drivers/pci/Makefile~rename-config_pci_use_vector-to-config_pci_msi drivers/pci/Makefile --- 25/drivers/pci/Makefile~rename-config_pci_use_vector-to-config_pci_msi Wed Jul 28 15:19:34 2004 +++ 25-akpm/drivers/pci/Makefile Wed Jul 28 15:19:34 2004 @@ -26,7 +26,7 @@ obj-$(CONFIG_PPC32) += setup-irq.o obj-$(CONFIG_PPC64) += setup-bus.o obj-$(CONFIG_MIPS) += setup-bus.o setup-irq.o obj-$(CONFIG_X86_VISWS) += setup-irq.o -obj-$(CONFIG_PCI_USE_VECTOR) += msi.o +obj-$(CONFIG_PCI_MSI) += msi.o # Cardbus & CompactPCI use setup-bus obj-$(CONFIG_HOTPLUG) += setup-bus.o diff -puN include/asm-i386/io_apic.h~rename-config_pci_use_vector-to-config_pci_msi include/asm-i386/io_apic.h --- 25/include/asm-i386/io_apic.h~rename-config_pci_use_vector-to-config_pci_msi Wed Jul 28 15:19:34 2004 +++ 25-akpm/include/asm-i386/io_apic.h Wed Jul 28 15:19:34 2004 @@ -13,7 +13,7 @@ #ifdef CONFIG_X86_IO_APIC -#ifdef CONFIG_PCI_USE_VECTOR +#ifdef CONFIG_PCI_MSI static inline int use_pci_vector(void) {return 1;} static inline void disable_edge_ioapic_vector(unsigned int vector) { } static inline void mask_and_ack_level_ioapic_vector(unsigned int vector) { } diff -puN include/asm-i386/mach-default/irq_vectors_limits.h~rename-config_pci_use_vector-to-config_pci_msi include/asm-i386/mach-default/irq_vectors_limits.h --- 25/include/asm-i386/mach-default/irq_vectors_limits.h~rename-config_pci_use_vector-to-config_pci_msi Wed Jul 28 15:19:34 2004 +++ 25-akpm/include/asm-i386/mach-default/irq_vectors_limits.h Wed Jul 28 15:19:34 2004 @@ -1,7 +1,7 @@ #ifndef _ASM_IRQ_VECTORS_LIMITS_H #define _ASM_IRQ_VECTORS_LIMITS_H -#ifdef CONFIG_PCI_USE_VECTOR +#ifdef CONFIG_PCI_MSI #define NR_IRQS FIRST_SYSTEM_VECTOR #define NR_IRQ_VECTORS NR_IRQS #else diff -puN include/asm-x86_64/io_apic.h~rename-config_pci_use_vector-to-config_pci_msi include/asm-x86_64/io_apic.h --- 25/include/asm-x86_64/io_apic.h~rename-config_pci_use_vector-to-config_pci_msi Wed Jul 28 15:19:34 2004 +++ 25-akpm/include/asm-x86_64/io_apic.h Wed Jul 28 15:19:34 2004 @@ -13,7 +13,7 @@ #ifdef CONFIG_X86_IO_APIC -#ifdef CONFIG_PCI_USE_VECTOR +#ifdef CONFIG_PCI_MSI static inline int use_pci_vector(void) {return 1;} static inline void disable_edge_ioapic_vector(unsigned int vector) { } static inline void mask_and_ack_level_ioapic_vector(unsigned int vector) { } diff -puN include/asm-x86_64/irq.h~rename-config_pci_use_vector-to-config_pci_msi include/asm-x86_64/irq.h --- 25/include/asm-x86_64/irq.h~rename-config_pci_use_vector-to-config_pci_msi Wed Jul 28 15:19:34 2004 +++ 25-akpm/include/asm-x86_64/irq.h Wed Jul 28 15:19:34 2004 @@ -31,7 +31,7 @@ #define FIRST_SYSTEM_VECTOR 0xee /* duplicated in hw_irq.h */ -#ifdef CONFIG_PCI_USE_VECTOR +#ifdef CONFIG_PCI_MSI #define NR_IRQS FIRST_SYSTEM_VECTOR #define NR_IRQ_VECTORS NR_IRQS #else diff -puN include/linux/pci.h~rename-config_pci_use_vector-to-config_pci_msi include/linux/pci.h --- 25/include/linux/pci.h~rename-config_pci_use_vector-to-config_pci_msi Wed Jul 28 15:19:34 2004 +++ 25-akpm/include/linux/pci.h Wed Jul 28 15:19:34 2004 @@ -836,7 +836,7 @@ struct msix_entry { u16 entry; /* driver uses to specify entry, OS writes */ }; -#ifndef CONFIG_PCI_USE_VECTOR +#ifndef CONFIG_PCI_MSI static inline void pci_scan_msi_device(struct pci_dev *dev) {} static inline int pci_enable_msi(struct pci_dev *dev) {return -1;} static inline void pci_disable_msi(struct pci_dev *dev) {} _