irq handling code consolidation (common part)
PATCH 1/1 irq handling code consolidation (common part)
Hi all,
this is a 3rd try on irq handling consolidation work. Patch creates common kernel/irq.c which is used by following arch specific patches.
Please take a look at it. Comments are welcome (especially from arch maintainers)
BTW is here a possibility that this code will be accepted or feature freeze denies it and i'm wasting everyone's time ?
Best regards.
Signature · 2 lines
Andrey Panin | Embedded systems software developer [email protected] | PGP key: wwwkeys.pgp.net
kernel/Makefile +1 -0
@@ -22,6 +22,7 @@ obj-$(CONFIG_BSD_PROCESS_ACCT) += acct.o obj-$(CONFIG_SOFTWARE_SUSPEND) += suspend.o obj-$(CONFIG_COMPAT) += compat.o +obj-$(CONFIG_GENERIC_IRQ) += irq.o ifneq ($(CONFIG_IA64),y) # According to Alan Modra <[email protected]>, the -fno-omit-frame-pointer is
kernel/irq.c +810 -0
810 lines not on this page · raw message
PATCH 1/1 irq handling code consolidation (i386 part)
This patch contains i386 specific changes for irq handling code consolidation. Compiles and works for me.
Please take a look.
Signature · 2 lines
Andrey Panin | Embedded systems software developer [email protected] | PGP key: wwwkeys.pgp.net
arch/i386/Kconfig +4 -0
@@ -22,6 +22,10 @@ bool default 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
@@ -140,4 +140,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 */
PATCH 1/1 irq handling code consolidation (alpha part)
In reply to Andrey PaninThis patch contains alpha specific changes for irq handling code consolidation. Compiled successfuly.
Please take a look.
Signature · 2 lines
Andrey Panin | Embedded systems software developer [email protected] | PGP key: wwwkeys.pgp.net
arch/alpha/Kconfig +4 -0
@@ -19,6 +19,10 @@ bool default y +config GENERIC_IRQ + bool + default y + config UID16 bool
arch/alpha/kernel/irq.c +5 -641
685 lines not on this page · raw message
include/asm-alpha/hw_irq.h +30 -1
@@ -2,15 +2,44 @@#define _ALPHA_HW_IRQ_H#include <linux/config.h> +#include <asm/machvec.h> static inline void hw_resend_irq (struct hw_interrupt_type *h,unsigned int i) {} -extern volatile unsigned long irq_err_count; +extern atomic_t irq_err_count; + +extern void select_smp_affinity (int irq); + +extern irq_desc_t irq_desc[NR_IRQS ];#ifdef CONFIG_ALPHA_GENERIC #define ACTUAL_NR_IRQS alpha_mv.nr_irqs#else #define ACTUAL_NR_IRQS NR_IRQS#endif + +#define arch_ack_bad_irq (irq) do { } while (0) + +/* Return a pointer to the irq descriptor for IRQ. */ +#define irq_desc (irq) (irq_desc + (irq)) + +/* Check irq number */ +#define irq_valid (irq) ((irq) < ACTUAL_NR_IRQS) + +/* Arch specific hook for setup_irq() */ +#ifdef CONFIG_SMP +#define arch_setup_irq (irq, desc, irqaction) select_smp_affinity(irq) +#else +#define arch_setup_irq (irq, desc, irqaction) do { } while (0) +#endif + +/* Used in setup_irq() */ +#define ARCH_NONSHARED_IRQ_MASK ~IRQ_DISABLED + +#define ARCH_AFFINITY_WIDTH 16 + +#define ARCH_DEFAULT_IRQ_AFFINITY ~0UL + +#define arch_can_create_irq_proc () (ACTUAL_NR_IRQS < (PROC_NDYNAMIC / 4))#endif
PATCH 1/1 irq handling code consolidation (ppc part)
In reply to Andrey PaninThis patch contains powerpc specific changes for irq handling code consolidation. Compiled successfuly.
Please take a look.
Signature · 2 lines
Andrey Panin | Embedded systems software developer [email protected] | PGP key: wwwkeys.pgp.net
arch/ppc/Kconfig +4 -0
@@ -6,6 +6,10 @@ bool default y +config GENERIC_IRQ + bool + default y + config UID16 bool
arch/ppc/kernel/irq.c +2 -487
551 lines not on this page · raw message
arch/ppc/mm/4xx_mmu.c +1 -1
@@ -96,7 +96,7 @@unsigned long __init mmu_mapin_ram (void ) {unsigned long v, s; -phys_addr_t p; +/*phys_addr_t*/ unsigned long p; v =KERNELBASE ; p =PPC_MEMSTART ;
include/asm-ppc/hw_irq.h +26 -0
@@ -71,6 +71,32 @@struct hw_interrupt_type ;static inline void hw_resend_irq (struct hw_interrupt_type *h,unsigned int i) {} +#define arch_ack_bad_irq (irq) do { } while (0) + +/* 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) + +#define HAVE_ARCH_IRQ_PROBE + +#define ARCH_AFFINITY_WIDTH 8 + +#ifdef CONFIG_IRQ_ALL_CPUS +#define ARCH_DEFAULT_CPU_AFFINITY +#define ARCH_DEFAULT_IRQ_AFFINITY ~0UL +#else +#define ARCH_DEFAULT_IRQ_AFFINITY 0x00000001 +#endif + +#define arch_can_create_irq_proc () (1)#endif /* _PPC_HW_IRQ_H */ #endif /* __KERNEL__ */
include/asm-ppc/ocp.h +2 -2
@@ -76,7 +76,7 @@struct ocp_def {unsigned int vendor;unsigned int device; -phys_addr_t paddr; +/*phys_addr_t */ unsigned int paddr;int irq;unsigned long pm; };
@@ -89,7 +89,7 @@char name[80 ];/* device name */ unsigned int vendor;unsigned int device; -phys_addr_t paddr; +/*phys_addr_t */ unsigned int paddr;int irq;unsigned long pm;void *ocpdev;/* driver data for this device */
PATCH 1/1 irq handling code consolidation (v850 part)
In reply to Andrey PaninThis patch contains v850 specific changes for irq handling code consolidation. Totally untested.
Please take a look.
Signature · 2 lines
Andrey Panin | Embedded systems software developer [email protected] | PGP key: wwwkeys.pgp.net
arch/v850/Kconfig +3 -0
@@ -16,6 +16,9 @@ config UID16 bool default n +config GENERIC_IRQ + bool + default y config RWSEM_GENERIC_SPINLOCK bool default y
arch/v850/kernel/irq.c +1 -538
557 lines not on this page · raw message
include/asm-v850/hw_irq.h +19 -0
@@ -5,4 +5,23 @@ { } +#define arch_ack_bad_irq (irq) do { } while (0) + +/* 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 HAVE_ARCH_IRQ_PROC + +#define register_irq_proc (irq) do { } while (0) +#endif /* __V850_HW_IRQ_H__ */
Re: [PATCH] irq handling code consolidation (v850 part)
Quoted 2 lines · Andrey Panin
This patch contains v850 specific changes for irq handling code consolidation. Totally untested.
Works fine for me, with a small change:
arch/v850/kernel/irq.c renamed from arch/v850/kernel/irq.c.~1~ +4 -4
@@ -1,8 +1,8 @@/* * arch/v850/kernel/irq.c -- High-level interrupt handling * -* Copyright (C) 2001,02 NEC Corporation -* Copyright (C) 2001,02 Miles Bader <[email protected]> +* Copyright (C) 2001,02,03 NEC Electronics Corporation +* Copyright (C) 2001,02,03 Miles Bader <[email protected]> * Copyright (C) 1994-2000 Ralf Baechle * Copyright (C) 1992 Linus Torvalds *
@@ -25,7 +25,7 @@#include <asm/system.h> -volatile unsigned long spurious_count; +extern atomic_t irq_err_count;/* * Generic, controller-independent functions:
@@ -71,7 +71,7 @@ int show_interrupts(struct seq_file *p,seq_printf (p,", %s" , action->name);seq_putc (p,'\n' ); } -seq_printf (p,"ERR: %10lu\n" , irq_err_count); +seq_printf (p,"ERR: %10d\n" ,atomic_read (&irq_err_count));return 0 ; }
[Can someone pick this up? It seems like a nice straight-forward cleanup that doesn't change any functionality, and deletes a buttload of duplicated code.]
-Miles
Signature · 1 line
Fast, small, soon; pick any 2.
PATCH 1/1 irq handling code consolidation (x8_64 part)
In reply to Andrey PaninThis patch contains x86_64 specific changes for irq handling code consolidation. Totally untested.
Please take a look.
Signature · 2 lines
Andrey Panin | Embedded systems software developer [email protected] | PGP key: wwwkeys.pgp.net
arch/x86_64/Kconfig +4 -0
@@ -33,6 +33,10 @@ bool default y +config GENERIC_IRQ + bool + default y + config ISA bool help
arch/x86_64/kernel/irq.c +1 -766
790 lines not on this page · raw message
include/asm-x86_64/hw_irq.h +33 -0
@@ -197,4 +197,37 @@#endif +/* +* 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) + +#define ARCH_AFF_WIDTH 8 + +#define ARCH_DEFAULT_IRQ_AFFINITY ~0UL + +#define arch_can_create_irq_proc () (1) +#endif /* _ASM_HW_IRQ_H */