Update MSI Patches
Quoted 5 lines · Zwane Mwaikambo
I think a variable rename should be fine, as long as the reader doesn't get misled into thinking a specific variable is something which it isn't. index sounds fine to me, the nice thing about your patch is that we don't have to touch
pci_dev->irqat all.
I make minor modification to the last patch to reduce some duplicate functions, as shown as below. I think this perhaps looks better. What do you think?
+#ifdef CONFIG_PCI_USE_VECTOR
+static unsigned int startup_edge_ioapic_vector(unsigned int vector) +{
+ int irq = vector_to_irq(vector);
+
+ return (startup_edge_ioapic_irq(irq));
+}
+
+static void ack_edge_ioapic_vector(unsigned int vector)
+{
+ int irq = vector_to_irq(vector);
+
+ ack_edge_ioapic_irq(irq);
+}
+
+static unsigned int startup_level_ioapic_vector (unsigned int vector) +{
+ int irq = vector_to_irq(vector);
+
+ return (startup_level_ioapic_irq (irq));
+}
+
+static void end_level_ioapic_vector (unsigned int vector) +{
+ int irq = vector_to_irq(vector);
+
+ end_level_ioapic_irq(irq);
+}
+
+static void mask_IO_APIC_vector (unsigned int vector)
+{
+ int irq = vector_to_irq(vector);
+
+ mask_IO_APIC_irq(irq);
+}
+
+static void unmask_IO_APIC_vector (unsigned int vector)
+{
+ int irq = vector_to_irq(vector);
+
+ unmask_IO_APIC_irq(irq);
+}
+
+static void set_ioapic_affinity_vector (unsigned int vector,
+ unsigned long cpu_mask)
+{
+ int irq = vector_to_irq(vector);
+
+ set_ioapic_affinity_irq(irq, cpu_mask);
+}
+#endif
Also, attach includes this changes and your comment on warning.
+++ linux-2.6.0-test2-create-vectorbase/arch/i386/kernel/mpparse.c 2003-08-14 13:22:03.000000000 -0400
@@ -1124,14 +1124,21 @@
+ if (!io_apic_set_pci_routing(ioapic, ioapic_pin, irq)) {
+ if (use_pci_vector() && !platform_legacy_irq(irq))
+ entry->irq = IO_APIC_VECTOR(irq);
+ else
+ entry->irq = irq;
+ }
Thanks,
Long
arch/i386/Kconfig +11 -0
@@ -1072,6 +1072,17 @@ depends on PCI && ((PCI_GODIRECT || PCI_GOANY) || X86_VISWS) default y +config PCI_USE_VECTOR + bool "PCI_USE_VECTOR" + 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 + + If you don't know what to do here, say N. + source "drivers/pci/Kconfig" config ISA
arch/i386/kernel/i8259.c +3 -1
@@ -419,8 +419,10 @@* us. (some of these will be overridden and become * 'special' SMP interrupts) */ -for (i =0 ; i <NR_IRQS ; i++) { +for (i =0 ; i < (NR_VECTORS -FIRST_EXTERNAL_VECTOR ); i++) {int vector =FIRST_EXTERNAL_VECTOR + i; +if (i >=NR_IRQS ) +break ;if (vector !=SYSCALL_VECTOR )set_intr_gate (vector, interrupt[i]); }
arch/i386/kernel/io_apic.c +122 -49
293 lines not on this page · raw message
arch/i386/kernel/mpparse.c +10 -3
@@ -1124,14 +1124,21 @@if ((1 <<bit) & mp_ioapic_routing[ioapic].pin_programmed[idx]) {printk (KERN_DEBUG "Pin %d-%d already programmed\n" , mp_ioapic_routing[ioapic].apic_id, ioapic_pin); - entry->irq = irq; +if (use_pci_vector () && !platform_legacy_irq (irq)) + entry->irq =IO_APIC_VECTOR (irq); +else + entry->irq = irq;continue ; } mp_ioapic_routing[ioapic].pin_programmed[idx] |= (1 <<bit); -if (!io_apic_set_pci_routing (ioapic, ioapic_pin, irq)) - entry->irq = irq; +if (!io_apic_set_pci_routing (ioapic, ioapic_pin, irq)) { +if (use_pci_vector () && !platform_legacy_irq (irq)) + entry->irq =IO_APIC_VECTOR (irq); +else + entry->irq = irq; + } printk(KERN_DEBUG "%02x:%02x:%02x[%c] -> %d-%d -> IRQ %d\n", entry->id.segment, entry->id.bus,
arch/i386/pci/irq.c +4 -0
@@ -743,6 +743,10 @@ bridge->bus->number, PCI_SLOT(bridge->devfn), pin, irq); }if (irq >=0 ) { +if (use_pci_vector () && + !platform_legacy_irq (irq)) + irq =IO_APIC_VECTOR (irq); +printk (KERN_INFO "PCI->APIC IRQ transform: (B%d,I%d,P%d) -> %d\n" , dev->bus->number,PCI_SLOT (dev->devfn), pin, irq); dev->irq = irq;
include/asm-i386/hw_irq.h +1 -0
@@ -41,6 +41,7 @@ extern asmlinkage void error_interrupt(void); extern asmlinkage void spurious_interrupt(void); extern asmlinkage void thermal_interrupt(struct pt_regs); +#define platform_legacy_irq (irq) ((irq) < 16)#endif extern void mask_irq (unsigned int irq);
include/asm-i386/io_apic.h +40 -0
@@ -11,6 +11,46 @@* Copyright (C) 1997, 1998, 1999, 2000 Ingo Molnar */ +#ifdef CONFIG_PCI_USE_VECTOR +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) { } +static inline void end_edge_ioapic_vector (unsigned int vector) { } +#define startup_level_ioapic startup_level_ioapic_vector +#define shutdown_level_ioapic mask_IO_APIC_vector +#define enable_level_ioapic unmask_IO_APIC_vector +#define disable_level_ioapic mask_IO_APIC_vector +#define mask_and_ack_level_ioapic mask_and_ack_level_ioapic_vector +#define end_level_ioapic end_level_ioapic_vector +#define set_ioapic_affinity set_ioapic_affinity_vector + +#define startup_edge_ioapic startup_edge_ioapic_vector +#define shutdown_edge_ioapic disable_edge_ioapic_vector +#define enable_edge_ioapic unmask_IO_APIC_vector +#define disable_edge_ioapic disable_edge_ioapic_vector +#define ack_edge_ioapic ack_edge_ioapic_vector +#define end_edge_ioapic end_edge_ioapic_vector +#else +static inline int use_pci_vector (void ) {return 0 ;} +static inline void disable_edge_ioapic_irq (unsigned int irq) { } +static inline void mask_and_ack_level_ioapic_irq (unsigned int irq) { } +static inline void end_edge_ioapic_irq (unsigned int irq) { } +#define startup_level_ioapic startup_level_ioapic_irq +#define shutdown_level_ioapic mask_IO_APIC_irq +#define enable_level_ioapic unmask_IO_APIC_irq +#define disable_level_ioapic mask_IO_APIC_irq +#define mask_and_ack_level_ioapic mask_and_ack_level_ioapic_irq +#define end_level_ioapic end_level_ioapic_irq +#define set_ioapic_affinity set_ioapic_affinity_irq + +#define startup_edge_ioapic startup_edge_ioapic_irq +#define shutdown_edge_ioapic disable_edge_ioapic_irq +#define enable_edge_ioapic unmask_IO_APIC_irq +#define disable_edge_ioapic disable_edge_ioapic_irq +#define ack_edge_ioapic ack_edge_ioapic_irq +#define end_edge_ioapic end_edge_ioapic_irq +#endif +#ifdef CONFIG_X86_IO_APIC #define APIC_MISMATCH_DEBUG
include/asm-i386/mach-default/irq_vectors.h +10 -0
@@ -76,9 +76,19 @@* Since vectors 0x00-0x1f are used/reserved for the CPU, * the usable vector space is 0x20-0xff (224 vectors) */ +/* +* The maximum number of vectors supported by i386 processors +* is limited to 256. For processors other than i386, NR_VECTORS +* should be changed accordingly. +*/ +#define NR_VECTORS 256#ifdef CONFIG_X86_IO_APIC +#ifndef CONFIG_PCI_USE_VECTOR #define NR_IRQS 224#else +#define NR_IRQS FIRST_SYSTEM_VECTOR +#endif +#else #define NR_IRQS 16#endif
Quoted 2 lines · long
I make minor modification to the last patch to reduce some duplicate functions, as shown as below. I think this perhaps looks better. What do you think?
The patch looks fine.
arch/i386/kernel/io_apic.c line 1912
Quoted 7 lines
arch/i386/kernel/io_apic.c +7
-0+#ifdef CONFIG_PCI_USE_VECTOR +static unsigned int startup_edge_ioapic_vector (unsigned int vector) +{ +int irq =vector_to_irq (vector); + +return (startup_edge_ioapic_irq (irq)); +}
Tiny nit, Linux coding style is;
return startup_edge_ioapic_irq(irq);
But you can queue that change for later.