Skip to contentSkip to conversation

irq handling code consolidation (i386 part)

PATCH In review Andrey Panin 2 participants 4 messages Mar 13, 2003 – Mar 14, 2003

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 irq handling code consolidation (i386 part)

Hi,

irq handling consolidation continues !

i386 specific patch attached. Compiled and WorksForMe(tm)

Best regards.

Signature · 2 lines
Andrey Panin		| Embedded systems software developer
[email protected]	| PGP key: wwwkeys.pgp.net
arch/i386/Kconfig +4 -0
diff --minimal -urN -X /usr/share/dontdiff linux-2.5.64.vanilla/arch/i386/Kconfig linux-2.5.64/arch/i386/Kconfig
@@ -27,6 +27,10 @@
 	  used to provide more virtual memory than the actual RAM present
 	  in your computer.  If unusre say Y.
 
+config GENERIC_IRQ
+	bool
+	default y
+
 config SBUS
 	bool
 
arch/i386/kernel/irq.c +1 -779

812 lines not on this page · raw message

include/asm-i386/hw_irq.h +35 -0
diff --minimal -urN -X /usr/share/dontdiff linux-2.5.64.vanilla/include/asm-i386/hw_irq.h linux-2.5.64/include/asm-i386/hw_irq.h
@@ -116,4 +116,39 @@
 static inline void hw_resend_irq(struct hw_interrupt_type *h, unsigned int i) {}
 #endif
 
+extern irq_desc_t irq_desc[NR_IRQS];
+
+/*
+ * Currently unexpected vectors happen only on SMP and APIC.
+ * We _must_ ack these because every local APIC has only N
+ * irq slots per priority level, and a 'hanging, unacked' IRQ
+ * holds up an irq slot - in excessive cases (when multiple
+ * unexpected vectors occur) that might lock up the APIC
+ * completely.
+ */
+#ifdef CONFIG_X86_LOCAL_APIC
+#define arch_ack_bad_irq(irq) ack_APIC_irq()
+#else
+#define arch_ack_bad_irq(irq) do { } while (0)
+#endif
+
+/* Return a pointer to the irq descriptor for IRQ.  */
+#define irq_desc(irq) (irq_desc + (irq))
+
+/* Check irq number */
+#define irq_valid(irq) ((irq) < NR_IRQS)
+
+/* Arch specific hook for setup_irq() */
+#define arch_setup_irq(irq, desc, irqaction) do { } while (0)
+
+/* Used in setup_irq() */
+#define ARCH_NONSHARED_IRQ_MASK \
+	~(IRQ_DISABLED | IRQ_AUTODETECT | IRQ_WAITING | IRQ_INPROGRESS)
+
+#define ARCH_AFFINITY_WIDTH	8
+
+#define ARCH_DEFAULT_IRQ_AFFINITY	~0UL
+
+#define arch_can_create_irq_proc() (1)
+
 #endif /* _ASM_HW_IRQ_H */
#1 lore raw
Quoted 5 lines · Andrey Panin

Hi,

irq handling consolidation continues !

i386 specific patch attached. Compiled and WorksForMe(tm)

I'm still going through a few tests but here are some compile fixes for some configurations i was trying.

ccache gcc -Wp,-MD,kernel/.irq.o.d -D__KERNEL__ -Iinclude -Wall -Wstrict-prototypes -Wno-trigraphs -O2 -g -fno-strict-aliasing -fno-common -pipe -mpreferred-stack-boundary=2 -march=i586 -Iinclude/asm-i386/mach-default -nostdinc -iwithprefix include -DKBUILD_BASENAME=irq -DKBUILD_MODNAME=irq -c -o kernel/irq.o kernel/irq.c

kernel/irq.c: In function `no_irq_ack':
kernel/irq.c:84: warning: implicit declaration of function `ack_APIC_irq'

CONFIG_X86_UP_APIC=y
CONFIG_X86_UP_IOAPIC=y
CONFIG_X86_LOCAL_APIC=y
CONFIG_X86_IO_APIC=y

Index: linux-2.5.64-unwashed/include/asm/hw_irq.h
===================================================================
RCS file: /build/cvsroot/linux-2.5.64/include/asm-i386/hw_irq.h,v retrieving revision 1.1.1.2

include/asm/hw_irq.h +1 -0
diff -u -r1.1.1.2 hw_irq.h
@@ -16,6 +16,7 @@
 #include <linux/profile.h>
 #include <asm/atomic.h>
 #include <asm/irq.h>
+#include <asm/apic.h>
 
 /*
  * Various low-level irq details needed by irq.c, process.c,
#2 lore raw
Quoted 10 lines · Zwane Mwaikambo
Quoted 5 lines · Andrey Panin

Hi,

irq handling consolidation continues !

i386 specific patch attached. Compiled and WorksForMe(tm)

I'm still going through a few tests but here are some compile fixes for some configurations i was trying.

Does this look ok? I tested compiled the following combinations;

i386 - NUMAQ, SMP, UP w/ IOAPIC, UP VISWS and SMP VISWS, i only did visual inspection of Alpha.

ccache gcc -Wp,-MD,kernel/.irq.o.d -D__KERNEL__ -Iinclude -Wall -Wstrict-prototypes -Wno-trigraphs -O2 -g -fno-strict-aliasing -fno-common -pipe -mpreferred-stack-boundary=2 -march=i586 -Iinclude/asm-i386/mach-default -nostdinc -iwithprefix include -DKBUILD_BASENAME=irq -DKBUILD_MODNAME=irq -c -o kernel/irq.o kernel/irq.c

kernel/irq.c: In function `irq_affinity_read_proc':
kernel/irq.c:691: irq_affinity' undeclared (first use in this function) kernel/irq.c:691: (Each undeclared identifier is reported only once kernel/irq.c:691: for each function it appears in.) kernel/irq.c: In function irq_affinity_write_proc':
kernel/irq.c:713: `irq_affinity' undeclared (first use in this function) include/asm/uaccess.h: At top level:
kernel/irq.c:687: warning: irq_affinity_read_proc' defined but not used kernel/irq.c:696: warning: irq_affinity_write_proc' defined but not used kernel/irq.c:756: warning: prof_cpu_mask_read_proc' defined but not used kernel/irq.c:766: warning: prof_cpu_mask_write_proc' defined but not used make[2]: *** [kernel/irq.o] Error 1
make[1]: *** [kernel] Error 2
make: *** [vmlinux] Error 2

Index: linux-2.5.64-unwashed/kernel/irq.c
===================================================================
RCS file: /build/cvsroot/linux-2.5.64/kernel/Attic/irq.c,v retrieving revision 1.1.2.1

kernel/irq.c +3 -1
diff -u -r1.1.2.1 irq.c
@@ -680,7 +680,6 @@
 unsigned long irq_affinity[NR_IRQS] = { 
 	[0 ... NR_IRQS - 1] = ARCH_DEFAULT_IRQ_AFFINITY
 };
-#endif
 
 static int irq_affinity_read_proc(char *page, char **start, off_t off,
 				  int count, int *eof, void *data)
@@ -715,6 +714,7 @@
 
 	return full_count;
 }
+#endif
 
 void register_irq_proc(unsigned int irq)
 {
@@ -751,6 +751,7 @@
 
 unsigned long prof_cpu_mask = ~0UL;
 
+#ifdef CONFIG_SMP
 static int prof_cpu_mask_read_proc(char *page, char **start, off_t off,
 				   int count, int *eof, void *data)
 {
@@ -774,6 +775,7 @@
 	*mask = new_value;
 	return full_count;
 }
+#endif
 
 void init_irq_proc(void)
 {
#3 lore raw

This one is for UP w/ IOAPIC

arch/i386/kernel/built-in.o: In function `end_level_ioapic_irq':
/build/source/linux-2.5.64-unwashed/include/asm/atomic.h:107: undefined reference to `irq_mis_count'
nm: vmlinux: No such file or directory
make -f scripts/Makefile.build obj=arch/i386/boot arch/i386/boot/bzImage
ccache gcc -Wp,-MD,arch/i386/boot/.setup.o.d -D__ASSEMBLY__ -D__KERNEL__
-Iinclude -Iinclude/asm-i386/mach-default -nostdinc -iwithprefix include -traditional -DSVGA_MODE=NORMAL_VGA -D__BIG_KERNEL__ -c -o
arch/i386/boot/setup.o arch/i386/boot/setup.S

Index: linux-2.5.64-unwashed/arch/i386/kernel/irq.c
===================================================================
RCS file: /build/cvsroot/linux-2.5.64/arch/i386/kernel/irq.c,v retrieving revision 1.1.1.2

arch/i386/kernel/irq.c +1 -0
diff -u -r1.1.1.2 irq.c
@@ -10,6 +10,7 @@
 #include <linux/seq_file.h>
 
 #include <asm/atomic.h>
+#include <asm/io_apic.h>	/* for APIC_MISMATCH_DEBUG */
 
 /*
  * Various interrupt controllers we handle: 8259 PIC, SMP IO-APIC,