mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH]2.6.7-rc1 Fix and Reenable MSI Support on x86_64
@ 2004-06-04  1:20 long
  2004-06-05  6:11 ` Andrew Morton
  0 siblings, 1 reply; 4+ messages in thread
From: long @ 2004-06-04  1:20 UTC (permalink / raw)
  To: linux-kernel, linux-pci; +Cc: ak, akpm, tom.l.nguyen

MSI support for x86_64 is currently disabled in the kernel 2.6.x.
Below is the patch, which provides a fix and reenable it.

In addition, the patch provides a info message during kernel boot
if configuring vector-base indexing. 

Thanks,
Long

-----------------------------------------------------------------
diff -urN linux-2.6.7-rc1/arch/i386/kernel/io_apic.c 2.6.7-rc1-msi64/arch/i386/kernel/io_apic.c
--- linux-2.6.7-rc1/arch/i386/kernel/io_apic.c	2004-06-01 13:55:42.000000000 -0400
+++ 2.6.7-rc1-msi64/arch/i386/kernel/io_apic.c	2004-06-03 10:22:46.069624128 -0400
@@ -1451,12 +1451,17 @@
 		);
 	}
 	}
+	if (use_pci_vector())  
+		printk(KERN_INFO "Using vector-based indexing\n");
 	printk(KERN_DEBUG "IRQ to pin mappings:\n");
 	for (i = 0; i < NR_IRQS; i++) {
 		struct irq_pin_list *entry = irq_2_pin + i;
 		if (entry->pin < 0)
 			continue;
-		printk(KERN_DEBUG "IRQ%d ", i);
+ 		if (use_pci_vector() && !platform_legacy_irq(i))
+			printk(KERN_DEBUG "IRQ%d ", IO_APIC_VECTOR(i));
+		else
+			printk(KERN_DEBUG "IRQ%d ", i);
 		for (;;) {
 			printk("-> %d:%d", entry->apic, entry->pin);
 			if (!entry->next)
diff -urN linux-2.6.7-rc1/arch/x86_64/kernel/i8259.c 2.6.7-rc1-msi64/arch/x86_64/kernel/i8259.c
--- linux-2.6.7-rc1/arch/x86_64/kernel/i8259.c	2004-05-09 22:32:01.000000000 -0400
+++ 2.6.7-rc1-msi64/arch/x86_64/kernel/i8259.c	2004-06-02 13:21:36.000000000 -0400
@@ -47,6 +47,12 @@
 	BI(x,8) BI(x,9) BI(x,a) BI(x,b) \
 	BI(x,c) BI(x,d) BI(x,e) BI(x,f)
 
+#define BUILD_15_IRQS(x) \
+	BI(x,0) BI(x,1) BI(x,2) BI(x,3) \
+	BI(x,4) BI(x,5) BI(x,6) BI(x,7) \
+	BI(x,8) BI(x,9) BI(x,a) BI(x,b) \
+	BI(x,c) BI(x,d) BI(x,e) 
+
 /*
  * ISA PIC or low IO-APIC triggered (INTA-cycle or APIC) interrupts:
  * (these are usually mapped to vectors 0x20-0x2f)
@@ -68,6 +74,11 @@
 BUILD_16_IRQS(0x4) BUILD_16_IRQS(0x5) BUILD_16_IRQS(0x6) BUILD_16_IRQS(0x7)
 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
+	BUILD_15_IRQS(0xe)
+#endif
+
 #endif
 
 #undef BUILD_16_IRQS
@@ -83,6 +94,12 @@
 	IRQ(x,8), IRQ(x,9), IRQ(x,a), IRQ(x,b), \
 	IRQ(x,c), IRQ(x,d), IRQ(x,e), IRQ(x,f)
 
+#define IRQLIST_15(x) \
+	IRQ(x,0), IRQ(x,1), IRQ(x,2), IRQ(x,3), \
+	IRQ(x,4), IRQ(x,5), IRQ(x,6), IRQ(x,7), \
+	IRQ(x,8), IRQ(x,9), IRQ(x,a), IRQ(x,b), \
+	IRQ(x,c), IRQ(x,d), IRQ(x,e)
+
 void (*interrupt[NR_IRQS])(void) = {
 	IRQLIST_16(0x0),
 
@@ -91,6 +108,11 @@
 	IRQLIST_16(0x4), IRQLIST_16(0x5), IRQLIST_16(0x6), IRQLIST_16(0x7),
 	IRQLIST_16(0x8), IRQLIST_16(0x9), IRQLIST_16(0xa), IRQLIST_16(0xb),
 	IRQLIST_16(0xc), IRQLIST_16(0xd)
+
+#ifdef CONFIG_PCI_USE_VECTOR
+	, IRQLIST_15(0xe)
+#endif
+
 #endif
 };
 
diff -urN linux-2.6.7-rc1/arch/x86_64/kernel/io_apic.c 2.6.7-rc1-msi64/arch/x86_64/kernel/io_apic.c
--- linux-2.6.7-rc1/arch/x86_64/kernel/io_apic.c	2004-06-01 13:55:42.000000000 -0400
+++ 2.6.7-rc1-msi64/arch/x86_64/kernel/io_apic.c	2004-06-03 10:25:26.742198184 -0400
@@ -67,8 +67,8 @@
 	short apic, pin, next;
 } irq_2_pin[PIN_MAP_SIZE];
 
+int vector_irq[NR_VECTORS] = { [0 ... NR_VECTORS - 1] = -1};
 #ifdef CONFIG_PCI_USE_VECTOR
-int vector_irq[NR_IRQS] = { [0 ... NR_IRQS -1] = -1};
 #define vector_to_irq(vector) 	\
 	(platform_legacy_irq(vector) ? vector : vector_irq[vector])
 #else
@@ -655,10 +655,14 @@
 /* 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 };
 
-#ifndef CONFIG_PCI_USE_VECTOR
+#ifdef CONFIG_PCI_USE_VECTOR
+int assign_irq_vector(int irq)
+#else
 int __init assign_irq_vector(int irq)
+#endif
 {
 	static int current_vector = FIRST_DEVICE_VECTOR, offset = 0;
+	
 	BUG_ON(irq >= NR_IRQ_VECTORS);
 	if (IO_APIC_VECTOR(irq) > 0)
 		return IO_APIC_VECTOR(irq);
@@ -667,18 +671,19 @@
 	if (current_vector == IA32_SYSCALL_VECTOR)
 		goto next;
 
-	if (current_vector > FIRST_SYSTEM_VECTOR) {
+	if (current_vector >= FIRST_SYSTEM_VECTOR) {
 		offset++;
+		if (!(offset%8))
+			return -ENOSPC;
 		current_vector = FIRST_DEVICE_VECTOR + offset;
 	}
 
-	if (current_vector == FIRST_SYSTEM_VECTOR)
-		panic("ran out of interrupt sources!");
+	vector_irq[current_vector] = irq;
+	if (irq != AUTO_ASSIGN)
+		IO_APIC_VECTOR(irq) = current_vector;
 
-	IO_APIC_VECTOR(irq) = current_vector;
 	return current_vector;
 }
-#endif
 
 extern void (*interrupt[NR_IRQS])(void);
 static struct hw_interrupt_type ioapic_level_type;
@@ -924,12 +929,17 @@
 		);
 	}
 	}
+	if (use_pci_vector())  
+		printk(KERN_INFO "Using vector-based indexing\n");
 	printk(KERN_DEBUG "IRQ to pin mappings:\n");
 	for (i = 0; i < NR_IRQS; i++) {
 		struct irq_pin_list *entry = irq_2_pin + i;
 		if (entry->pin < 0)
 			continue;
-		printk(KERN_DEBUG "IRQ%d ", i);
+ 		if (use_pci_vector() && !platform_legacy_irq(i))
+			printk(KERN_DEBUG "IRQ%d ", IO_APIC_VECTOR(i));
+		else
+			printk(KERN_DEBUG "IRQ%d ", i);
 		for (;;) {
 			printk("-> %d:%d", entry->apic, entry->pin);
 			if (!entry->next)
diff -urN linux-2.6.7-rc1/drivers/pci/Kconfig 2.6.7-rc1-msi64/drivers/pci/Kconfig
--- linux-2.6.7-rc1/drivers/pci/Kconfig	2004-05-09 22:32:26.000000000 -0400
+++ 2.6.7-rc1-msi64/drivers/pci/Kconfig	2004-06-02 15:52:44.000000000 -0400
@@ -3,7 +3,7 @@
 #
 config PCI_USE_VECTOR
 	bool "Vector-based interrupt indexing (MSI)"
-	depends on (X86_LOCAL_APIC && X86_IO_APIC && !X86_64) || IA64
+	depends on (X86_LOCAL_APIC && X86_IO_APIC) || IA64
 	default n
 	help
 	   This replaces the current existing IRQ-based index interrupt scheme
diff -urN linux-2.6.7-rc1/include/asm-x86_64/hw_irq.h 2.6.7-rc1-msi64/include/asm-x86_64/hw_irq.h
--- linux-2.6.7-rc1/include/asm-x86_64/hw_irq.h	2004-05-09 22:33:20.000000000 -0400
+++ 2.6.7-rc1-msi64/include/asm-x86_64/hw_irq.h	2004-06-02 09:09:20.000000000 -0400
@@ -78,6 +78,7 @@
 #ifndef __ASSEMBLY__
 extern u8 irq_vector[NR_IRQ_VECTORS];
 #define IO_APIC_VECTOR(irq)	(irq_vector[irq])
+#define AUTO_ASSIGN		-1
 
 /*
  * Various low-level irq details needed by irq.c, process.c,
diff -urN linux-2.6.7-rc1/include/asm-x86_64/msi.h 2.6.7-rc1-msi64/include/asm-x86_64/msi.h
--- linux-2.6.7-rc1/include/asm-x86_64/msi.h	2004-05-09 22:33:13.000000000 -0400
+++ 2.6.7-rc1-msi64/include/asm-x86_64/msi.h	2004-06-02 10:24:57.000000000 -0400
@@ -11,11 +11,6 @@
 #define LAST_DEVICE_VECTOR		232
 #define MSI_DEST_MODE			MSI_LOGICAL_MODE
 #define MSI_TARGET_CPU_SHIFT		12
-
-#ifdef CONFIG_SMP
-#define MSI_TARGET_CPU		logical_smp_processor_id()
-#else
-#define MSI_TARGET_CPU		TARGET_CPUS
-#endif
+#define MSI_TARGET_CPU			TARGET_CPUS
 
 #endif /* ASM_MSI_H */

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH]2.6.7-rc1 Fix and Reenable MSI Support on x86_64
  2004-06-04  1:20 [PATCH]2.6.7-rc1 Fix and Reenable MSI Support on x86_64 long
@ 2004-06-05  6:11 ` Andrew Morton
  0 siblings, 0 replies; 4+ messages in thread
From: Andrew Morton @ 2004-06-05  6:11 UTC (permalink / raw)
  To: long; +Cc: linux-kernel, linux-pci, ak, tom.l.nguyen

long <tlnguyen@snoqualmie.dp.intel.com> wrote:
>
> 
>  MSI support for x86_64 is currently disabled in the kernel 2.6.x.
>  Below is the patch, which provides a fix and reenable it.

Could you please fix this up?

arch/x86_64/kernel/i8259.c:118: warning: excess elements in array initializer
arch/x86_64/kernel/i8259.c:118: warning: (near initialization for `interrupt')

.config is at http://www.zip.com.au/~akpm/linux/patches/stuff/config

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH]2.6.7-rc1 Fix and Reenable MSI Support on x86_64
  2004-06-07 16:28 Nguyen, Tom L
@ 2004-06-07 16:33 ` Randy.Dunlap
  0 siblings, 0 replies; 4+ messages in thread
From: Randy.Dunlap @ 2004-06-07 16:33 UTC (permalink / raw)
  To: Nguyen, Tom L; +Cc: akpm, tlnguyen, linux-kernel, linux-pci, ak

On Mon, 7 Jun 2004 09:28:31 -0700 Nguyen, Tom L wrote:

| On Friday, June 04, 2004 Andrew Morton wrote: 
| 
| >>
| >> 
| >>  MSI support for x86_64 is currently disabled in the kernel 2.6.x.
| >>  Below is the patch, which provides a fix and reenable it.
| >
| >Could you please fix this up?
| >
| >arch/x86_64/kernel/i8259.c:118: warning: excess elements in array
| initializer
| >arch/x86_64/kernel/i8259.c:118: warning: (near initialization for
| `interrupt')
| >
| >.config is at http://www.zip.com.au/~akpm/linux/patches/stuff/config
| 
| Yes, I am looking into it right now. Please let me know which kernel you
| detected these warnings; so, I can repeat these warnings.

This is too simple, I guess, but I'd like to see .config contain
kernel version info....
updated by any "make *config", of course.

--
~Randy

^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: [PATCH]2.6.7-rc1 Fix and Reenable MSI Support on x86_64
@ 2004-06-07 16:28 Nguyen, Tom L
  2004-06-07 16:33 ` Randy.Dunlap
  0 siblings, 1 reply; 4+ messages in thread
From: Nguyen, Tom L @ 2004-06-07 16:28 UTC (permalink / raw)
  To: Andrew Morton, long; +Cc: linux-kernel, linux-pci, ak

On Friday, June 04, 2004 Andrew Morton wrote: 

>>
>> 
>>  MSI support for x86_64 is currently disabled in the kernel 2.6.x.
>>  Below is the patch, which provides a fix and reenable it.
>
>Could you please fix this up?
>
>arch/x86_64/kernel/i8259.c:118: warning: excess elements in array
initializer
>arch/x86_64/kernel/i8259.c:118: warning: (near initialization for
`interrupt')
>
>.config is at http://www.zip.com.au/~akpm/linux/patches/stuff/config

Yes, I am looking into it right now. Please let me know which kernel you
detected these warnings; so, I can repeat these warnings.

Thanks,
Long

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2004-06-07 16:34 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-06-04  1:20 [PATCH]2.6.7-rc1 Fix and Reenable MSI Support on x86_64 long
2004-06-05  6:11 ` Andrew Morton
2004-06-07 16:28 Nguyen, Tom L
2004-06-07 16:33 ` Randy.Dunlap

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®