Skip to contentSkip to conversation

RE[PATCH]2.6.4-rc3 MSI Support for IA64

PATCH long 4 participants 4 messages Mar 12, 2004 PCI

lore
Share & tools
lore

long

author
#0 lore raw

Thanks for all inputs received from the previous patch posted a few weeks ago. Based on Zwane Mwaikambo's suggestion of using a standard name like assign_irq_vector(), we made some changes to the previous posted patch. Attached is an update version, based on kernel 2.6.4-rc3.

Please send us your comments on this patch.

Thanks,
Long

----------------------------------------------------------------------------

arch/ia64/Kconfig +12 -0
diff -urN linux-2.6.4-rc3/arch/ia64/Kconfig linux-2.6.4-rc3-msi/arch/ia64/Kconfig
@@ -406,6 +406,18 @@
 	  information about which PCI hardware does work under Linux and which
 	  doesn't.
 
+config PCI_USE_VECTOR
+	bool "Message Signaled Interrupt (MSI) Support"
+	default n
+	help
+	   This enables MSI, Message Signaled Interrupt, on specific 
+	   MSI capable device functions detected upon requests from the
+	   device drivers. 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.
+
+	   If you don't know what to do here, say N.
+
 config PCI_DOMAINS
 	bool
 	default PCI
arch/ia64/kernel/irq_ia64.c +6 -0
diff -urN linux-2.6.4-rc3/arch/ia64/kernel/irq_ia64.c linux-2.6.4-rc3-msi/arch/ia64/kernel/irq_ia64.c
@@ -60,12 +60,18 @@
 int
 ia64_alloc_vector (void)
 {
+#ifdef CONFIG_PCI_USE_VECTOR
+	extern int assign_irq_vector(int irq);
+
+	return assign_irq_vector(AUTO_ASSIGN);
+#else
 	static int next_vector = IA64_FIRST_DEVICE_VECTOR;
 
 	if (next_vector > IA64_LAST_DEVICE_VECTOR)
 		/* XXX could look for sharable vectors instead of panic'ing... */
 		panic("ia64_alloc_vector: out of interrupt vectors!");
 	return next_vector++;
+#endif
 }
 
 extern unsigned int do_IRQ(unsigned long irq, struct pt_regs *regs);
drivers/pci/msi.c +17 -33

111 lines not on this page · raw message

drivers/pci/msi.h +55 -7

99 lines not on this page · raw message

include/asm-ia64/hw_irq.h +2 -0
diff -urN linux-2.6.4-rc3/include/asm-ia64/hw_irq.h linux-2.6.4-rc3-msi/include/asm-ia64/hw_irq.h
@@ -34,6 +34,8 @@
 #define IA64_MAX_VECTORED_IRQ		255
 #define IA64_NUM_VECTORS		256
 
+#define AUTO_ASSIGN			-1
+
 #define IA64_SPURIOUS_INT_VECTOR	0x0f
 
 /*
#1 lore raw
Quoted 5 lines · long

Thanks for all inputs received from the previous patch posted a few weeks ago. Based on Zwane Mwaikambo's suggestion of using a standard name like assign_irq_vector(), we made some changes to the previous posted patch. Attached is an update version, based on kernel 2.6.4-rc3.

Thanks for doing this, i have a few comments;

Quoted 10 lines

diff -urN linux-2.6.4-rc3/arch/ia64/kernel/irq_ia64.c linux-2.6.4-rc3-msi/arch/ia64/kernel/irq_ia64.c

arch/ia64/kernel/irq_ia64.c +3 -0
@@ -60,12 +60,18 @@
 int
 ia64_alloc_vector (void)
 {
+#ifdef CONFIG_PCI_USE_VECTOR
+	extern int assign_irq_vector(int irq);
+

arch/ia64/kernel/irq_ia64.c line 75

Quoted 10 lines
arch/ia64/kernel/irq_ia64.c +3 -0
+	return assign_irq_vector(AUTO_ASSIGN);
+#else
 	static int next_vector = IA64_FIRST_DEVICE_VECTOR;
 
 	if (next_vector > IA64_LAST_DEVICE_VECTOR)
 		/* XXX could look for sharable vectors instead of panic'ing... */
 		panic("ia64_alloc_vector: out of interrupt vectors!");
 	return next_vector++;
+#endif
 }

This one is slightly confusing readability wise since ia64 already does the vector based interrupt numbering. Perhaps CONFIG_PCI_USE_VECTOR should really be CONFIG_MSI but that's up to you. I wonder if we could consolidate these vector allocators as assign_irq_vector(AUTO_ASSIGN) has the same semantics as ia64_alloc_vector() and the one for i386 is also almost the same as its MSI ilk.

Quoted 10 lines
arch/ia64/kernel/irq_ia64.c +10 -0
+static inline int vector_resources(void)
+{
+ 	int res;
+#ifndef CONFIG_IA64
+ 	int i, repeat;
+ 	for (i = NR_REPEATS; i > 0; i--) {
+ 		if ((FIRST_DEVICE_VECTOR + i * 8) > FIRST_SYSTEM_VECTOR)
+ 			continue;
+ 		break;
+ 	}

arch/ia64/kernel/irq_ia64.c

Quoted 10 lines
arch/ia64/kernel/irq_ia64.c +7 -1
+ 	i++;
+ 	repeat = (FIRST_SYSTEM_VECTOR - FIRST_DEVICE_VECTOR)/i;
+ 	res = i * repeat - NR_RESERVED_VECTORS + 1;
 #else
-extern void restore_ioapic_irq_handler(int irq);
+ 	res = LAST_DEVICE_VECTOR - FIRST_DEVICE_VECTOR - 1;
 #endif
+
+ 	return res;
+}

Is this supposed to return number of vectors available for external devices? Also regarding vector allocation, assign_irq_vector() in drivers/pci/msi.c only can allocate 166 vectors before going -ENOSPC is this intentional?

Thanks,
Zwane

#2 lore raw
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line · Zwane Mwaikambo

Zwane> I wonder if we could consolidate these vector allocators as Zwane> assign_irq_vector(AUTO_ASSIGN) has the same semantics as Zwane> ia64_alloc_vector() and the one for i386 is also almost the Zwane> same as its MSI ilk.

Agreed. I don't see any reason why ia64_alloc_vector() and assign_irq_vector() couldn't or shouldn't be one and the same thing (and assign_irq_vector() is a fine name).

Tom, if you want to send me a patch that converts the existing uses of ia64_alloc_vector() to assign_irq_vector(), I'd be happy to apply (assuming it's clean etc., as usual).

	--david
#3 lore raw
In reply to Zwane Mwaikambo
Quoted 3 lines · Zwane Mwaikambo

This one is slightly confusing readability wise since ia64 already does the vector based interrupt numbering. Perhaps CONFIG_PCI_USE_VECTOR should really be CONFIG_MSI but that's up to you.

I don't know much about MSI, but it certainly confused me that the config symbol is CONFIG_PCI_USE_VECTOR. I think CONFIG_PCI_MSI would make the most sense, but maybe it's too late.