dyn_array/nr_irqs/sparse_irq support v5
Subsystems (40)
cover dyn_array/nr_irqs/sparse_irq support v5
Please check dyn_array support for x86
v3: split changing to nr_irqs to small patches
fix checkpatch error
reorder the patch sequence to make dyn_array support go at first
so could use that with arrays other than NR_IRQS
v4: add CONFIG_HAVE_SPARSE_IRQ with list to use condensed irq_desc array
so could use 32 init, and init more if needed.
x86 32bit: have CONFIG_HAVE_DYN_ARRAY
x86 64bit: have CONFIG_HAVE_DYN_ARRAY and CONFIG_HAVE_SPARSE_IRQ
v5: apply alan cox patch with NR_IRQS for serial at first
seperate irq_descX with irq_descX_free, so could use -1U as valid irq expand /proc/interrupts to process > nr_irqs
hook irq_2_iommu to irq_desc
more other arch irq_desc[] to irq_desc(), and kstat_cpu().irqs[] to kstat_irqs_cpu..
based on tip/master
to do:
so dyn irq_desc is done, and ready to:
make create_irq to get irq according to bus/dev/func/vector
Thanks
Yinghai Lu
PATCH 1/42 8250: Remove NR_IRQ usage
From: Alan Cox <[email protected]>
Works on my test box with a quick test.
From: Alan Cox <[email protected]>
--- drivers/serial/68328serial.c | 11 +----- drivers/serial/8250.c | 73 +++++++++++++++++++++++++++++++++-------- 2 files changed, 60 insertions(+), 24 deletions(-)
drivers/serial/68328serial.c +2 -9
@@ -66,7 +66,6 @@#endif static struct m68k_serial m68k_soft[NR_PORTS ]; -struct m68k_serial *IRQ_ports[NR_IRQS ];static unsigned int uart_irqs[NR_PORTS ] =UART_IRQ_DEFNS ;
@@ -375,15 +374,11 @@ clear_and_return:*/ irqreturn_t rs_interrupt (int irq,void *dev_id) { -struct m68k_serial * info; +struct m68k_serial * info = dev_id;m68328_uart *uart;unsigned short rx;unsigned short tx; - info = IRQ_ports[irq]; -if (!info) -return IRQ_NONE ; - uart = &uart_addr[info->line]; rx = uart->urx.w;
@@ -1383,8 +1378,6 @@ rs68328_init(void) info->port, info->irq);printk (" is a builtin MC68328 UART\n" ); - IRQ_ports[info->irq] = info;/* waste of space */ -#ifdef CONFIG_M68VZ328 if (i >0 )PJSEL &=0xCF ;/* PSW enable second port output */
@@ -1393,7 +1386,7 @@ rs68328_init(void)if (request_irq (uart_irqs[i], rs_interrupt,IRQF_DISABLED , -"M68328_UART" ,NULL )) +"M68328_UART" , info))panic ("Unable to attach 68328 serial interrupt\n" ); }local_irq_restore (flags);
drivers/serial/8250.c +58 -15
125 lines not on this page · raw message
Signature · 1 line
1.5.4.5
PATCH 2/42 x86: add after_bootmem for 32bit
to prepare to use dyn_array support etc.
--- arch/x86/mm/init_32.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-)
arch/x86/mm/init_32.c +3 -0
@@ -65,6 +65,7 @@ static unsigned long __meminitdata table_end;static unsigned long __meminitdata table_top;static int __initdata after_init_bootmem; +int after_bootmem;static __init void *alloc_low_page (unsigned long *phys) {
@@ -924,6 +925,8 @@ void __init mem_init(void)set_highmem_pages_init (); + after_bootmem =1 ; + codesize = (unsigned long ) &_etext - (unsigned long ) &_text; datasize = (unsigned long ) &_edata - (unsigned long ) &_etext; initsize = (unsigned long ) &__init_end - (unsigned long ) &__init_begin;
Signature · 1 line
1.5.4.5
PATCH 3/42 x86: remove irq_vectors_limits
no user
--- include/asm-x86/mach-generic/irq_vectors_limits.h | 14 -------------- include/asm-x86/summit/irq_vectors_limits.h | 14 -------------- 2 files changed, 0 insertions(+), 28 deletions(-) delete mode 100644 include/asm-x86/mach-generic/irq_vectors_limits.h delete mode 100644 include/asm-x86/summit/irq_vectors_limits.h
include/asm-x86/mach-generic/irq_vectors_limits.h deleted +0 -14
@@ -1,14 +0,0 @@ -#ifndef ASM_X86__MACH_GENERIC__IRQ_VECTORS_LIMITS_H -#define ASM_X86__MACH_GENERIC__IRQ_VECTORS_LIMITS_H - -/* -* For Summit or generic (i.e. installer) kernels, we have lots of I/O APICs, -* even with uni-proc kernels, so use a big array. -* -* This value should be the same in both the generic and summit subarches. -* Change one, change 'em both. -*/ -#define NR_IRQS 224 -#define NR_IRQ_VECTORS 1024 - -#endif /* ASM_X86__MACH_GENERIC__IRQ_VECTORS_LIMITS_H */
include/asm-x86/summit/irq_vectors_limits.h deleted +0 -14
@@ -1,14 +0,0 @@ -#ifndef _ASM_IRQ_VECTORS_LIMITS_H -#define _ASM_IRQ_VECTORS_LIMITS_H - -/* -* For Summit or generic (i.e. installer) kernels, we have lots of I/O APICs, -* even with uni-proc kernels, so use a big array. -* -* This value should be the same in both the generic and summit subarches. -* Change one, change 'em both. -*/ -#define NR_IRQS 224 -#define NR_IRQ_VECTORS 1024 - -#endif /* _ASM_IRQ_VECTORS_LIMITS_H */
Signature · 1 line
1.5.4.5
PATCH 4/42 add dyn_array support
could have crazy big arrays and allocate them in bootmem at init stage. also also to allocate array according to size we need to use to avoid wasting memory
use CONFIG_HAVE_DYN_ARRAY to enable it or not
usage:
|static struct irq_desc irq_desc_init __initdata = {
| .status = IRQ_DISABLED,
| .chip = &no_irq_chip,
| .handle_irq = handle_bad_irq,
| .depth = 1,
| .lock = __SPIN_LOCK_UNLOCKED(irq_desc->lock),
|#ifdef CONFIG_SMP
| .affinity = CPU_MASK_ALL
|#endif
|};
|
|static void __init init_work(void *data)
|{
| struct dyn_array *da = data;
| struct irq_desc *desc;
| int i;
|
| desc = *da->name;
|
| for (i = 0; i < *da->nr; i++)
| memcpy(&desc[i], &irq_desc_init, sizeof(struct irq_desc));
|}
|
|struct irq_desc *irq_desc;
|DEFINE_DYN_ARRAY(irq_desc, sizeof(struct irq_desc), nr_irqs, PAGE_SIZE, init_work);after pre_alloc_dyn_array() after setup_arch(), that array is ready to use in this way could replace irq_desc[NR_IRQS] array with dyn_array irq_desc[nr_irqs]
v2: remove _nopanic in pre_alloc_dyn_array()
--- include/asm-generic/vmlinux.lds.h | 7 +++++++ include/linux/init.h | 23 +++++++++++++++++++++++ init/main.c | 24 ++++++++++++++++++++++++ 3 files changed, 54 insertions(+), 0 deletions(-)
include/asm-generic/vmlinux.lds.h +7 -0
@@ -214,6 +214,13 @@* All archs are supposed to use RO_DATA() */ #define RODATA RO_DATA(4096) +#define DYN_ARRAY_INIT (align) \ + . = ALIGN((align)); \ + .dyn_array.init : AT(ADDR(.dyn_array.init) - LOAD_OFFSET) { \ + VMLINUX_SYMBOL(__dyn_array_start) = .; \ + *(.dyn_array.init) \ + VMLINUX_SYMBOL(__dyn_array_end) = .; \ + }#define SECURITY_INIT \ .security_initcall.init : AT(ADDR(.security_initcall.init) - LOAD_OFFSET) { \ VMLINUX_SYMBOL(__security_initcall_start) = .; \
include/linux/init.h +23 -0
@@ -249,6 +249,29 @@ struct obs_kernel_param {/* Relies on boot_command_line being set */ void __init parse_early_param (void ); + +struct dyn_array { +void **name; +unsigned long size; +unsigned int *nr; +unsigned long align; +void (*init_work)(void *); +}; +extern struct dyn_array *__dyn_array_start[], *__dyn_array_end[]; + +#define DEFINE_DYN_ARRAY (nameX, sizeX, nrX, alignX, init_workX) \ + static struct dyn_array __dyn_array_##nameX __initdata = \ + { .name = (void **)&nameX,\ + .size = sizeX,\ + .nr = &nrX,\ + .align = alignX,\ + .init_work = init_workX,\ + }; \ + static struct dyn_array *__dyn_array_ptr_##nameX __used \ + __attribute__((__section__(".dyn_array.init"))) = \ + &__dyn_array_##nameX + +extern void pre_alloc_dyn_array (void );#endif /* __ASSEMBLY__ */ /**
init/main.c +24 -0
@@ -539,6 +539,29 @@ void __init __weak thread_info_cache_init(void) { } +void pre_alloc_dyn_array (void ) +{ +#ifdef CONFIG_HAVE_DYN_ARRAY +unsigned long size, phys =0 ; +struct dyn_array **daa; + +for (daa = __dyn_array_start ; daa < __dyn_array_end; daa++) { +struct dyn_array *da = *daa; + + size = da->size * (*da->nr); +print_fn_descriptor_symbol ("dyna_array %s " , da->name); +printk (KERN_CONT "size:%#lx nr:%d align:%#lx" , + da->size, *da->nr, da->align); + *da->name =__alloc_bootmem (size, da->align, phys); + phys =virt_to_phys (*da->name); +printk (KERN_CONT " ==> [%#lx - %#lx]\n" , phys, phys + size); + +if (da->init_work) + da->init_work (da); + } +#endif +} + asmlinkage void __init start_kernel(void) {char * command_line;
@@ -576,6 +599,7 @@ asmlinkage void __init start_kernel(void)printk (KERN_NOTICE );printk (linux_banner);setup_arch (&command_line); +pre_alloc_dyn_array ();mm_init_owner (&init_mm, &init_task);setup_command_line (command_line);unwind_setup ();
Signature · 1 line
1.5.4.5
PATCH 5/42 add per_cpu_dyn_array support
could make array in per_cpu is allocated dynamically too
usage:
| /* in .h */
|struct kernel_stat {
| struct cpu_usage_stat cpustat;
| unsigned int *irqs;
|};
|
| /* in .c */
|DEFINE_PER_CPU(struct kernel_stat, kstat);
|
|DEFINE_PER_CPU_DYN_ARRAY_ADDR(per_cpu__kstat_irqs, per_cpu__kstat.irqs, sizeof(unsigned int), nr_irqs, sizeof(unsigned long), NULL);after setup_percpu()/per_cpu_alloc_dyn_array(), that dyn_array in per_cpu area is ready to use
--- arch/x86/kernel/setup_percpu.c | 7 +++- include/asm-generic/vmlinux.lds.h | 6 +++ include/linux/init.h | 27 ++++++++++++++-- init/main.c | 63 +++++++++++++++++++++++++++++++++++- 4 files changed, 96 insertions(+), 7 deletions(-)
arch/x86/kernel/setup_percpu.c +5 -2
@@ -140,7 +140,7 @@ static void __init setup_cpu_pda_map(void)*/ void __init setup_per_cpu_areas (void ) { -ssize_t size =PERCPU_ENOUGH_ROOM ; +ssize_t size, old_size;char *ptr;int cpu;
@@ -148,7 +148,8 @@ void __init setup_per_cpu_areas(void)setup_cpu_pda_map ();/* Copy section for each CPU (we discard the original) */ - size =PERCPU_ENOUGH_ROOM ; + old_size =PERCPU_ENOUGH_ROOM ; + size = old_size +per_cpu_dyn_array_size ();printk (KERN_INFO "PERCPU: Allocating %zd bytes of per cpu data\n" , size);
@@ -176,6 +177,8 @@ void __init setup_per_cpu_areas(void)per_cpu_offset (cpu) = ptr - __per_cpu_start;memcpy (ptr, __per_cpu_start, __per_cpu_end - __per_cpu_start); +per_cpu_alloc_dyn_array (cpu, ptr + old_size); + } printk(KERN_DEBUG "NR_CPUS: %d, nr_cpu_ids: %d, nr_node_ids %d\n",
include/asm-generic/vmlinux.lds.h +6 -0
@@ -220,6 +220,12 @@ VMLINUX_SYMBOL(__dyn_array_start) = .; \ *(.dyn_array.init) \ VMLINUX_SYMBOL(__dyn_array_end) = .; \ + } \ + . = ALIGN((align)); \ + .per_cpu_dyn_array.init : AT(ADDR(.per_cpu_dyn_array.init) - LOAD_OFFSET) { \ + VMLINUX_SYMBOL(__per_cpu_dyn_array_start) = .; \ + *(.per_cpu_dyn_array.init) \ + VMLINUX_SYMBOL(__per_cpu_dyn_array_end) = .; \ }#define SECURITY_INIT \ .security_initcall.init : AT(ADDR(.security_initcall.init) - LOAD_OFFSET) { \
include/linux/init.h +24 -3
@@ -258,12 +258,13 @@ struct dyn_array {void (*init_work)(void *); };extern struct dyn_array *__dyn_array_start[], *__dyn_array_end[]; +extern struct dyn_array *__per_cpu_dyn_array_start[], *__per_cpu_dyn_array_end[]; -#define DEFINE_DYN_ARRAY (nameX, sizeX, nrX, alignX, init_workX) \ +#define DEFINE_DYN_ARRAY_ADDR (nameX, addrX, sizeX, nrX, alignX, init_workX) \ static struct dyn_array __dyn_array_##nameX __initdata = \ - { .name = (void **)&nameX,\ + { .name = (void **)&(nameX),\ .size = sizeX,\ - .nr = &nrX,\ + .nr = &(nrX),\ .align = alignX,\ .init_work = init_workX,\ }; \
@@ -271,7 +272,27 @@ extern struct dyn_array *__dyn_array_start[], *__dyn_array_end[]; __attribute__((__section__(".dyn_array.init"))) = \ &__dyn_array_##nameX +#define DEFINE_DYN_ARRAY(nameX, sizeX, nrX, alignX, init_workX) \ + DEFINE_DYN_ARRAY_ADDR(nameX, nameX, sizeX, nrX, alignX, init_workX) + +#define DEFINE_PER_CPU_DYN_ARRAY_ADDR(nameX, addrX, sizeX, nrX, alignX, init_workX) \ + static struct dyn_array __per_cpu_dyn_array_##nameX __initdata = \ + { .name = (void **)&(addrX),\ + .size = sizeX,\ + .nr = &(nrX),\ + .align = alignX,\ + .init_work = init_workX,\ + }; \ + static struct dyn_array *__per_cpu_dyn_array_ptr_##nameX __used \ + __attribute__((__section__(".per_cpu_dyn_array.init"))) = \ + &__per_cpu_dyn_array_##nameX + +#define DEFINE_PER_CPU_DYN_ARRAY (nameX, sizeX, nrX, alignX, init_workX) \ + DEFINE_PER_CPU_DYN_ARRAY_ADDR(nameX, nameX, nrX, alignX, init_workX) +extern void pre_alloc_dyn_array (void ); +extern unsigned long per_cpu_dyn_array_size (void ); +extern void per_cpu_alloc_dyn_array (int cpu,char *ptr);#endif /* __ASSEMBLY__ */ /**
init/main.c +61 -2
84 lines not on this page · raw message
Signature · 1 line
1.5.4.5
PATCH 6/42 x86: alloc dyn_array all alltogether
so could spare some memory with small alignment in bootmem
also tighten the alignment checking..., and make print out less debug info
--- arch/x86/kernel/setup_percpu.c | 16 +++++++--- include/linux/init.h | 2 +- init/main.c | 65 ++++++++++++++++++++++++++++++--------- 3 files changed, 62 insertions(+), 21 deletions(-)
arch/x86/kernel/setup_percpu.c +11 -5
@@ -140,26 +140,31 @@ static void __init setup_cpu_pda_map(void)*/ void __init setup_per_cpu_areas (void ) { -ssize_t size, old_size; +ssize_t size, old_size, da_size;char *ptr;int cpu; +unsigned long align =1 ;/* Setup cpu_pda map */ setup_cpu_pda_map ();/* Copy section for each CPU (we discard the original) */ old_size =PERCPU_ENOUGH_ROOM ; - size = old_size +per_cpu_dyn_array_size (); + da_size =per_cpu_dyn_array_size (&align); + align = max_t(unsigned long, PAGE_SIZE, align); + size =roundup (old_size + da_size, align);printk (KERN_INFO "PERCPU: Allocating %zd bytes of per cpu data\n" , size);for_each_possible_cpu (cpu) {#ifndef CONFIG_NEED_MULTIPLE_NODES - ptr =alloc_bootmem_pages (size); + ptr =__alloc_bootmem (size, align, +__pa (MAX_DMA_ADDRESS ));#else int node =early_cpu_to_node (cpu);if (!node_online (node) || !NODE_DATA (node)) { - ptr =alloc_bootmem_pages (size); + ptr =__alloc_bootmem (size, align, +__pa (MAX_DMA_ADDRESS ));printk (KERN_INFO "cpu %d has no node %d or node-local memory\n" , cpu, node);
@@ -168,7 +173,8 @@ void __init setup_per_cpu_areas(void) cpu, __pa(ptr)); }else { - ptr =alloc_bootmem_pages_node (NODE_DATA (node), size); + ptr =__alloc_bootmem_node (NODE_DATA (node), size, align, +__pa (MAX_DMA_ADDRESS ));if (ptr)printk (KERN_DEBUG "per cpu data for cpu%d on node%d at %016lx\n" , cpu, node,__pa (ptr));
include/linux/init.h +1 -1
@@ -291,7 +291,7 @@ extern struct dyn_array *__per_cpu_dyn_array_start[], *__per_cpu_dyn_array_end[] DEFINE_PER_CPU_DYN_ARRAY_ADDR(nameX, nameX, nrX, alignX, init_workX)extern void pre_alloc_dyn_array (void ); -extern unsigned long per_cpu_dyn_array_size (void ); +extern unsigned long per_cpu_dyn_array_size (unsigned long *align);extern void per_cpu_alloc_dyn_array (int cpu,char *ptr);#endif /* __ASSEMBLY__ */
init/main.c +50 -15
126 lines not on this page · raw message
Signature · 1 line
1.5.4.5
PATCH 7/42 x86: enable dyn_array support
--- arch/Kconfig | 2 ++ arch/x86/Kconfig | 1 + arch/x86/kernel/vmlinux_32.lds.S | 1 + arch/x86/kernel/vmlinux_64.lds.S | 3 +++ 4 files changed, 7 insertions(+), 0 deletions(-)
arch/Kconfig +2 -0
@@ -103,3 +103,5 @@ config HAVE_CLK The <linux/clk.h> calls support software clock gating and thus are a key power management tool on many systems. +config HAVE_DYN_ARRAY + def_bool n
arch/x86/Kconfig +1 -0
@@ -33,6 +33,7 @@ config X86 select HAVE_ARCH_TRACEHOOK select HAVE_GENERIC_DMA_COHERENT if X86_32 select HAVE_EFFICIENT_UNALIGNED_ACCESS + select HAVE_DYN_ARRAY config ARCH_DEFCONFIG string
arch/x86/kernel/vmlinux_32.lds.S +1 -0
@@ -145,6 +145,7 @@ SECTIONS *(.x86cpuvendor.init) __x86cpuvendor_end = .; } + DYN_ARRAY_INIT(8) SECURITY_INIT . = ALIGN(4); .altinstructions : AT(ADDR(.altinstructions) - LOAD_OFFSET) {
arch/x86/kernel/vmlinux_64.lds.S +3 -0
@@ -174,6 +174,9 @@ SECTIONS *(.x86cpuvendor.init) } __x86cpuvendor_end = .; + + DYN_ARRAY_INIT(8) + SECURITY_INIT . = ALIGN(8);
Signature · 1 line
1.5.4.5
PATCH 8/42 introduce nr_irqs
and at this point it is equal NR_IRQS
--- include/linux/irq.h | 2 ++ kernel/irq/autoprobe.c | 10 +++++----- kernel/irq/chip.c | 20 ++++++++++---------- kernel/irq/handle.c | 3 ++- kernel/irq/manage.c | 16 ++++++++-------- kernel/irq/proc.c | 2 +- kernel/irq/resend.c | 4 ++-- kernel/irq/spurious.c | 4 ++-- 8 files changed, 32 insertions(+), 29 deletions(-)
include/linux/irq.h +2 -0
@@ -24,6 +24,8 @@#include <asm/ptrace.h> #include <asm/irq_regs.h> +extern int nr_irqs; +struct irq_desc ;typedef void (*irq_flow_handler_t )(unsigned int irq,struct irq_desc *desc);
kernel/irq/autoprobe.c +5 -5
@@ -38,7 +38,7 @@ unsigned long probe_irq_on(void)* something may have generated an irq long ago and we want to * flush such a longstanding irq before considering it as spurious. */ -for (i =NR_IRQS -1 ; i >0 ; i--) { +for (i = nr_irqs-1 ; i >0 ; i--) { desc = irq_desc + i;spin_lock_irq (&desc->lock);
@@ -68,7 +68,7 @@ unsigned long probe_irq_on(void)* (we must startup again here because if a longstanding irq * happened in the previous stage, it may have masked itself) */ -for (i =NR_IRQS -1 ; i >0 ; i--) { +for (i = nr_irqs-1 ; i >0 ; i--) { desc = irq_desc + i;spin_lock_irq (&desc->lock);
@@ -89,7 +89,7 @@ unsigned long probe_irq_on(void)* Now filter out any obviously spurious interrupts */ mask =0 ; -for (i =0 ; i <NR_IRQS ; i++) { +for (i =0 ; i < nr_irqs; i++) {unsigned int status; desc = irq_desc + i;
@@ -130,7 +130,7 @@ unsigned int probe_irq_mask(unsigned long val)int i; mask =0 ; -for (i =0 ; i <NR_IRQS ; i++) { +for (i =0 ; i < nr_irqs; i++) {struct irq_desc *desc = irq_desc + i;unsigned int status;
@@ -173,7 +173,7 @@ int probe_irq_off(unsigned long val) {int i, irq_found =0 , nr_irqs =0 ; -for (i =0 ; i <NR_IRQS ; i++) { +for (i =0 ; i < nr_irqs; i++) {struct irq_desc *desc = irq_desc + i;unsigned int status;
kernel/irq/chip.c +10 -10
@@ -27,7 +27,7 @@ void dynamic_irq_init(unsigned int irq)struct irq_desc *desc;unsigned long flags; -if (irq >=NR_IRQS ) { +if (irq >= nr_irqs) {WARN (1 ,KERN_ERR "Trying to initialize invalid IRQ%d\n" , irq);return ; }
@@ -60,7 +60,7 @@ void dynamic_irq_cleanup(unsigned int irq)struct irq_desc *desc;unsigned long flags; -if (irq >=NR_IRQS ) { +if (irq >= nr_irqs) {WARN (1 ,KERN_ERR "Trying to cleanup invalid IRQ%d\n" , irq);return ; }
@@ -92,7 +92,7 @@ int set_irq_chip(unsigned int irq, struct irq_chip *chip)struct irq_desc *desc;unsigned long flags; -if (irq >=NR_IRQS ) { +if (irq >= nr_irqs) {WARN (1 ,KERN_ERR "Trying to install chip for IRQ%d\n" , irq);return -EINVAL ; }
@@ -121,7 +121,7 @@ int set_irq_type(unsigned int irq, unsigned int type)unsigned long flags;int ret = -ENXIO ; -if (irq >=NR_IRQS ) { +if (irq >= nr_irqs) {printk (KERN_ERR "Trying to set irq type for IRQ%d\n" , irq);return -ENODEV ; }
@@ -148,7 +148,7 @@ int set_irq_data(unsigned int irq, void *data)struct irq_desc *desc;unsigned long flags; -if (irq >=NR_IRQS ) { +if (irq >= nr_irqs) {printk (KERN_ERR "Trying to install controller data for IRQ%d\n" , irq);return -EINVAL ;
@@ -174,7 +174,7 @@ int set_irq_msi(unsigned int irq, struct msi_desc *entry)struct irq_desc *desc;unsigned long flags; -if (irq >=NR_IRQS ) { +if (irq >= nr_irqs) {printk (KERN_ERR "Trying to install msi data for IRQ%d\n" , irq);return -EINVAL ;
@@ -200,7 +200,7 @@ int set_irq_chip_data(unsigned int irq, void *data)struct irq_desc *desc = irq_desc + irq;unsigned long flags; -if (irq >=NR_IRQS || !desc->chip) { +if (irq >= nr_irqs || !desc->chip) {printk (KERN_ERR "BUG: bad set_irq_chip_data(IRQ#%d)\n" , irq);return -EINVAL ; }
@@ -544,7 +544,7 @@ __set_irq_handler(unsigned int irq, irq_flow_handler_t handle, int is_chained,struct irq_desc *desc;unsigned long flags; -if (irq >=NR_IRQS ) { +if (irq >= nr_irqs) {printk (KERN_ERR "Trying to install type control for IRQ%d\n" , irq);return ;
@@ -609,7 +609,7 @@ void __init set_irq_noprobe(unsigned int irq)struct irq_desc *desc;unsigned long flags; -if (irq >=NR_IRQS ) { +if (irq >= nr_irqs) {printk (KERN_ERR "Trying to mark IRQ%d non-probeable\n" , irq);return ;
@@ -627,7 +627,7 @@ void __init set_irq_probe(unsigned int irq)struct irq_desc *desc;unsigned long flags; -if (irq >=NR_IRQS ) { +if (irq >= nr_irqs) {printk (KERN_ERR "Trying to mark IRQ%d probeable\n" , irq);return ;
kernel/irq/handle.c +2 -1
@@ -47,6 +47,7 @@ handle_bad_irq(unsigned int irq, struct irq_desc *desc)* * Controller mappings for all interrupt sources: */ +int nr_irqs =NR_IRQS ; struct irq_desc irq_desc[NR_IRQS] __cacheline_aligned_in_smp = { [0 ...NR_IRQS -1 ] = { .status =IRQ_DISABLED ,
@@ -265,7 +266,7 @@ void early_init_irq_lock_class(void) {int i; -for (i =0 ; i <NR_IRQS ; i++) +for (i =0 ; i < nr_irqs; i++)lockdep_set_class (&irq_desc[i].lock, &irq_desc_lock_class); }
kernel/irq/manage.c +8 -8
@@ -34,7 +34,7 @@ void synchronize_irq(unsigned int irq)struct irq_desc *desc = irq_desc + irq;unsigned int status; -if (irq >=NR_IRQS ) +if (irq >= nr_irqs)return ; do {
@@ -143,7 +143,7 @@ void disable_irq_nosync(unsigned int irq)struct irq_desc *desc = irq_desc + irq;unsigned long flags; -if (irq >=NR_IRQS ) +if (irq >= nr_irqs)return ;spin_lock_irqsave (&desc->lock, flags);
@@ -171,7 +171,7 @@ void disable_irq(unsigned int irq) {struct irq_desc *desc = irq_desc + irq; -if (irq >=NR_IRQS ) +if (irq >= nr_irqs)return ;disable_irq_nosync (irq);
@@ -214,7 +214,7 @@ void enable_irq(unsigned int irq)struct irq_desc *desc = irq_desc + irq;unsigned long flags; -if (irq >=NR_IRQS ) +if (irq >= nr_irqs)return ;spin_lock_irqsave (&desc->lock, flags);
@@ -290,7 +290,7 @@ int can_request_irq(unsigned int irq, unsigned long irqflags) {struct irqaction *action; -if (irq >=NR_IRQS || irq_desc[irq].status &IRQ_NOREQUEST ) +if (irq >= nr_irqs || irq_desc[irq].status &IRQ_NOREQUEST )return 0 ; action = irq_desc[irq].action;
@@ -349,7 +349,7 @@ int setup_irq(unsigned int irq, struct irqaction *new)int shared =0 ;int ret; -if (irq >=NR_IRQS ) +if (irq >= nr_irqs)return -EINVAL ;if (desc->chip == &no_irq_chip)
@@ -503,7 +503,7 @@ void free_irq(unsigned int irq, void *dev_id)unsigned long flags;WARN_ON (in_interrupt ()); -if (irq >=NR_IRQS ) +if (irq >= nr_irqs)return ; desc = irq_desc + irq;
@@ -617,7 +617,7 @@ int request_irq(unsigned int irq, irq_handler_t handler,*/ if ((irqflags &IRQF_SHARED ) && !dev_id)return -EINVAL ; -if (irq >=NR_IRQS ) +if (irq >= nr_irqs)return -EINVAL ;if (irq_desc[irq].status &IRQ_NOREQUEST )return -EINVAL ;
kernel/irq/proc.c +1 -1
@@ -234,7 +234,7 @@ void init_irq_proc(void)/* * Create entries for all existing IRQs. */ -for (i =0 ; i <NR_IRQS ; i++) +for (i =0 ; i < nr_irqs; i++)register_irq_proc (i); }
kernel/irq/resend.c +2 -2
@@ -33,8 +33,8 @@ static void resend_irqs(unsigned long arg)struct irq_desc *desc;int irq; -while (!bitmap_empty (irqs_resend,NR_IRQS )) { - irq =find_first_bit (irqs_resend,NR_IRQS ); +while (!bitmap_empty (irqs_resend, nr_irqs)) { + irq =find_first_bit (irqs_resend, nr_irqs);clear_bit (irq, irqs_resend); desc = irq_desc + irq;local_irq_disable ();
kernel/irq/spurious.c +2 -2
@@ -91,7 +91,7 @@ static int misrouted_irq(int irq)int i;int ok =0 ; -for (i =1 ; i <NR_IRQS ; i++) { +for (i =1 ; i < nr_irqs; i++) {struct irq_desc *desc = irq_desc + i;if (i == irq)/* Already tried */
@@ -107,7 +107,7 @@ static int misrouted_irq(int irq)static void poll_spurious_irqs (unsigned long dummy) {int i; -for (i =1 ; i <NR_IRQS ; i++) { +for (i =1 ; i < nr_irqs; i++) {struct irq_desc *desc = irq_desc + i;unsigned int status;
Signature · 1 line
1.5.4.5
PATCH 9/42 x86: using nr_irqs
also add first_free_entry and pin_map_size
--- arch/x86/kernel/io_apic_32.c | 26 ++++++++++++++------------ arch/x86/kernel/io_apic_64.c | 33 +++++++++++++++++---------------- arch/x86/kernel/irq_32.c | 8 ++++---- arch/x86/kernel/irq_64.c | 8 ++++---- arch/x86/kernel/irqinit_32.c | 2 +- arch/x86/kernel/irqinit_64.c | 2 +- include/asm-x86/irq.h | 3 +++ 7 files changed, 44 insertions(+), 38 deletions(-)
arch/x86/kernel/io_apic_32.c +14 -12
@@ -70,6 +70,7 @@ int timer_through_8259 __initdata;*/ int sis_apic_bug =-1 ; +int first_free_entry =NR_IRQS ;/* * # of IRQ routing registers */
@@ -100,6 +101,8 @@ static int disable_timer_pin_1 __initdata;#define MAX_PLUS_SHARED_IRQS NR_IRQS#define PIN_MAP_SIZE (MAX_PLUS_SHARED_IRQS + NR_IRQS) +int pin_map_size =PIN_MAP_SIZE ; +/* * This is performance-critical, we want to do it O(1) *
@@ -213,7 +216,6 @@ static void ioapic_mask_entry(int apic, int pin)*/ static void add_pin_to_irq (unsigned int irq,int apic,int pin) { -static int first_free_entry =NR_IRQS ;struct irq_pin_list *entry = irq_2_pin + irq;while (entry->next)
@@ -222,7 +224,7 @@ static void add_pin_to_irq(unsigned int irq, int apic, int pin)if (entry->pin !=-1 ) { entry->next = first_free_entry; entry = irq_2_pin + entry->next; -if (++first_free_entry >=PIN_MAP_SIZE ) +if (++first_free_entry >= pin_map_size)panic ("io_apic.c: whoops" ); } entry->apic = apic;
@@ -457,7 +459,7 @@ static inline void rotate_irqs_among_cpus(unsigned long useful_load_threshold)int i, j;for_each_online_cpu (i) { -for (j =0 ; j <NR_IRQS ; j++) { +for (j =0 ; j < nr_irqs; j++) {if (!irq_desc[j].action)continue ;/* Is it a significant load ? */
@@ -492,7 +494,7 @@ static void do_irq_balance(void)if (!cpu_online (i))continue ; package_index =CPU_TO_PACKAGEINDEX (i); -for (j =0 ; j <NR_IRQS ; j++) { +for (j =0 ; j < nr_irqs; j++) {unsigned long value_now, delta;/* Is this an active IRQ or balancing disabled ? */ if (!irq_desc[j].action ||irq_balancing_disabled (j))
@@ -587,7 +589,7 @@ tryanotherirq:*/ move_this_load =0 ; selected_irq =-1 ; -for (j =0 ; j <NR_IRQS ; j++) { +for (j =0 ; j < nr_irqs; j++) {/* Is this an active IRQ? */ if (!irq_desc[j].action)continue ;
@@ -664,7 +666,7 @@ static int balanced_irq(void *unused)long time_remaining = balanced_irq_interval;/* push everything to CPU 0 to give us a starting point. */ -for (i =0 ; i <NR_IRQS ; i++) { +for (i =0 ; i < nr_irqs ; i++) { irq_desc[i].pending_mask =cpumask_of_cpu (0 );set_pending_irq (i,cpumask_of_cpu (0 )); }
@@ -712,8 +714,8 @@ static int __init balanced_irq_init(void) physical_balance =1 ;for_each_online_cpu (i) { - irq_cpu_data[i].irq_delta =kzalloc (sizeof (unsigned long ) *NR_IRQS ,GFP_KERNEL ); - irq_cpu_data[i].last_irq =kzalloc (sizeof (unsigned long ) *NR_IRQS ,GFP_KERNEL ); + irq_cpu_data[i].irq_delta =kzalloc (sizeof (unsigned long ) * nr_irqs,GFP_KERNEL ); + irq_cpu_data[i].last_irq =kzalloc (sizeof (unsigned long ) * nr_irqs,GFP_KERNEL );if (irq_cpu_data[i].irq_delta ==NULL || irq_cpu_data[i].last_irq ==NULL ) {printk (KERN_ERR "balanced_irq_init: out of memory" ); goto failed;
@@ -1445,7 +1447,7 @@ __apicdebuginit(void) print_IO_APIC(void) } }printk (KERN_DEBUG "IRQ to pin mappings:\n" ); -for (i =0 ; i <NR_IRQS ; i++) { +for (i =0 ; i < nr_irqs; i++) {struct irq_pin_list *entry = irq_2_pin + i;if (entry->pin <0 )continue ;
@@ -1625,7 +1627,7 @@ static void __init enable_IO_APIC(void)int i, apic;unsigned long flags; -for (i =0 ; i <PIN_MAP_SIZE ; i++) { +for (i =0 ; i < pin_map_size; i++) { irq_2_pin[i].pin =-1 ; irq_2_pin[i].next =0 ; }
@@ -2009,7 +2011,7 @@ static inline void init_IO_APIC_traps(void)* Also, we've got to be careful not to trash gate * 0x80, because int 0x80 is hm, kind of importantish. ;) */ -for (irq =0 ; irq <NR_IRQS ; irq++) { +for (irq =0 ; irq < nr_irqs ; irq++) {if (IO_APIC_IRQ (irq) && !irq_vector[irq]) {/* * Hmm.. We don't have an entry for this,
@@ -2453,7 +2455,7 @@ int create_irq(void) irq = -ENOSPC ;spin_lock_irqsave (&vector_lock, flags); -for (new = (NR_IRQS -1 ); new >=0 ; new--) { +for (new = (nr_irqs -1 ); new >=0 ; new--) {if (platform_legacy_irq (new))continue ;if (irq_vector[new] !=0 )
arch/x86/kernel/io_apic_64.c +17 -16
@@ -132,6 +132,7 @@ DECLARE_BITMAP(mp_bus_not_pci, MAX_MP_BUSSES);#define MAX_PLUS_SHARED_IRQS NR_IRQS#define PIN_MAP_SIZE (MAX_PLUS_SHARED_IRQS + NR_IRQS) +int pin_map_size =PIN_MAP_SIZE ;/* * This is performance-critical, we want to do it O(1) *
@@ -224,7 +225,7 @@ static inline void io_apic_sync(unsigned int apic)int pin; \struct irq_pin_list *entry = irq_2_pin + irq; \ \ -BUG_ON (irq >=NR_IRQS ); \ +BUG_ON (irq >= nr_irqs); \for (;;) { \unsigned int reg; \ pin = entry->pin; \
@@ -301,7 +302,7 @@ static void __target_IO_APIC_irq(unsigned int irq, unsigned int dest, u8 vector)int apic, pin;struct irq_pin_list *entry = irq_2_pin + irq; -BUG_ON (irq >=NR_IRQS ); +BUG_ON (irq >= nr_irqs);for (;;) {unsigned int reg; apic = entry->apic;
@@ -358,19 +359,19 @@ static void set_ioapic_affinity_irq(unsigned int irq, cpumask_t mask)* shared ISA-space IRQs, so we have to support them. We are super * fast in the common case, and fast for shared ISA-space IRQs. */ +int first_free_entry =NR_IRQS ;static void add_pin_to_irq (unsigned int irq,int apic,int pin) { -static int first_free_entry =NR_IRQS ;struct irq_pin_list *entry = irq_2_pin + irq; -BUG_ON (irq >=NR_IRQS ); +BUG_ON (irq >= nr_irqs);while (entry->next) entry = irq_2_pin + entry->next;if (entry->pin !=-1 ) { entry->next = first_free_entry; entry = irq_2_pin + entry->next; -if (++first_free_entry >=PIN_MAP_SIZE ) +if (++first_free_entry >= pin_map_size)panic ("io_apic.c: ran out of irq_2_pin entries!" ); } entry->apic = apic;
@@ -634,7 +635,7 @@ int IO_APIC_get_PCI_irq_vector(int bus, int slot, int pin) best_guess = irq; } } -BUG_ON (best_guess >=NR_IRQS ); +BUG_ON (best_guess >= nr_irqs);return best_guess; }
@@ -766,7 +767,7 @@ static int pin_2_irq(int idx, int apic, int pin) irq += nr_ioapic_registers[i++]; irq += pin; } -BUG_ON (irq >=NR_IRQS ); +BUG_ON (irq >= nr_irqs);return irq; }
@@ -788,7 +789,7 @@ static int __assign_irq_vector(int irq, cpumask_t mask)int cpu;struct irq_cfg *cfg; -BUG_ON ((unsigned )irq >=NR_IRQS ); +BUG_ON ((unsigned )irq >= nr_irqs); cfg = &irq_cfg[irq];/* Only try and allocate irqs on cpus that are present */
@@ -862,7 +863,7 @@ static void __clear_irq_vector(int irq)cpumask_t mask;int cpu, vector; -BUG_ON ((unsigned )irq >=NR_IRQS ); +BUG_ON ((unsigned )irq >= nr_irqs); cfg = &irq_cfg[irq];BUG_ON (!cfg->vector);
@@ -882,7 +883,7 @@ static void __setup_vector_irq(int cpu)int irq, vector;/* Mark the inuse vectors */ -for (irq =0 ; irq <NR_IRQS ; ++irq) { +for (irq =0 ; irq < nr_irqs; ++irq) {if (!cpu_isset (cpu, irq_cfg[irq].domain))continue ; vector = irq_cfg[irq].vector;
@@ -1188,7 +1189,7 @@ __apicdebuginit(void) print_IO_APIC(void) } }printk (KERN_DEBUG "IRQ to pin mappings:\n" ); -for (i =0 ; i <NR_IRQS ; i++) { +for (i =0 ; i < nr_irqs; i++) {struct irq_pin_list *entry = irq_2_pin + i;if (entry->pin <0 )continue ;
@@ -1361,7 +1362,7 @@ void __init enable_IO_APIC(void)int i, apic;unsigned long flags; -for (i =0 ; i <PIN_MAP_SIZE ; i++) { +for (i =0 ; i < pin_map_size; i++) { irq_2_pin[i].pin =-1 ; irq_2_pin[i].next =0 ; }
@@ -1655,7 +1656,7 @@ static void ir_irq_migration(struct work_struct *work) {int irq; -for (irq =0 ; irq <NR_IRQS ; irq++) { +for (irq =0 ; irq < nr_irqs; irq++) {struct irq_desc *desc = irq_desc + irq;if (desc->status &IRQ_MOVE_PENDING ) {unsigned long flags;
@@ -1704,7 +1705,7 @@ asmlinkage void smp_irq_move_cleanup_interrupt(void)struct irq_desc *desc;struct irq_cfg *cfg; irq =__get_cpu_var (vector_irq)[vector]; -if (irq >=NR_IRQS ) +if (irq >= nr_irqs)continue ; desc = irq_desc + irq;
@@ -1862,7 +1863,7 @@ static inline void init_IO_APIC_traps(void)* Also, we've got to be careful not to trash gate * 0x80, because int 0x80 is hm, kind of importantish. ;) */ -for (irq =0 ; irq <NR_IRQS ; irq++) { +for (irq =0 ; irq < nr_irqs ; irq++) {if (IO_APIC_IRQ (irq) && !irq_cfg[irq].vector) {/* * Hmm.. We don't have an entry for this,
@@ -2276,7 +2277,7 @@ int create_irq(void) irq = -ENOSPC ;spin_lock_irqsave (&vector_lock, flags); -for (new = (NR_IRQS -1 ); new >=0 ; new--) { +for (new = (nr_irqs -1 ); new >=0 ; new--) {if (platform_legacy_irq (new))continue ;if (irq_cfg[new].vector !=0 )
arch/x86/kernel/irq_32.c +4 -4
@@ -226,7 +226,7 @@ unsigned int do_IRQ(struct pt_regs *regs)int overflow, irq = ~regs->orig_ax;struct irq_desc *desc = irq_desc + irq; -if (unlikely ((unsigned )irq >=NR_IRQS )) { +if (unlikely ((unsigned )irq >= nr_irqs)) {printk (KERN_EMERG "%s: cannot handle IRQ %d\n" , __func__, irq);BUG ();
@@ -271,7 +271,7 @@ int show_interrupts(struct seq_file *p, void *v)seq_putc (p,'\n' ); } -if (i <NR_IRQS ) { +if (i < nr_irqs) {unsigned any_count =0 ;spin_lock_irqsave (&irq_desc[i].lock, flags);
@@ -303,7 +303,7 @@ int show_interrupts(struct seq_file *p, void *v)seq_putc (p,'\n' ); skip:spin_unlock_irqrestore (&irq_desc[i].lock, flags); - }else if (i ==NR_IRQS ) { + }else if (i == nr_irqs) {seq_printf (p,"NMI: " );for_each_online_cpu (j)seq_printf (p,"%10u " ,nmi_count (j));
@@ -396,7 +396,7 @@ void fixup_irqs(cpumask_t map)unsigned int irq;static int warned; -for (irq =0 ; irq <NR_IRQS ; irq++) { +for (irq =0 ; irq < nr_irqs; irq++) {cpumask_t mask;if (irq ==2 )continue ;
arch/x86/kernel/irq_64.c +4 -4
@@ -81,7 +81,7 @@ int show_interrupts(struct seq_file *p, void *v)seq_putc (p,'\n' ); } -if (i <NR_IRQS ) { +if (i < nr_irqs) {unsigned any_count =0 ;spin_lock_irqsave (&irq_desc[i].lock, flags);
@@ -112,7 +112,7 @@ int show_interrupts(struct seq_file *p, void *v)seq_putc (p,'\n' ); skip:spin_unlock_irqrestore (&irq_desc[i].lock, flags); - }else if (i ==NR_IRQS ) { + }else if (i == nr_irqs) {seq_printf (p,"NMI: " );for_each_online_cpu (j)seq_printf (p,"%10u " ,cpu_pda (j)->__nmi_count);
@@ -201,7 +201,7 @@ asmlinkage unsigned int do_IRQ(struct pt_regs *regs)stack_overflow_check (regs);#endif -if (likely (irq <NR_IRQS )) +if (likely (irq < nr_irqs))generic_handle_irq (irq);else {if (!disable_apic)
@@ -224,7 +224,7 @@ void fixup_irqs(cpumask_t map)unsigned int irq;static int warned; -for (irq =0 ; irq <NR_IRQS ; irq++) { +for (irq =0 ; irq < nr_irqs; irq++) {cpumask_t mask;int break_affinity =0 ;int set_affinity =1 ;
arch/x86/kernel/irqinit_32.c +1 -1
@@ -91,7 +91,7 @@ void __init native_init_IRQ(void)*/ for (i =0 ; i < (NR_VECTORS -FIRST_EXTERNAL_VECTOR ); i++) {int vector =FIRST_EXTERNAL_VECTOR + i; -if (i >=NR_IRQS ) +if (i >= nr_irqs)break ;/* SYSCALL_VECTOR was reserved in trap_init. */ if (!test_bit (vector, used_vectors))
arch/x86/kernel/irqinit_64.c +1 -1
@@ -142,7 +142,7 @@ static void __init init_ISA_irqs (void)init_bsp_APIC ();init_8259A (0 ); -for (i =0 ; i <NR_IRQS ; i++) { +for (i =0 ; i < nr_irqs; i++) { irq_desc[i].status =IRQ_DISABLED ; irq_desc[i].action =NULL ; irq_desc[i].depth =1 ;
include/asm-x86/irq.h +3 -0
@@ -10,6 +10,9 @@#include <asm/apicdef.h> #include <asm/irq_vectors.h> +extern int pin_map_size; +extern int first_free_entry; +static inline int irq_canonicalize (int irq) {return ((irq ==2 ) ?9 : irq);
Signature · 1 line
1.5.4.5
PATCH 10/42 drivers/char to use nr_irqs
--- drivers/char/hpet.c | 2 +- drivers/char/random.c | 4 ++-- drivers/char/vr41xx_giu.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-)
drivers/char/hpet.c +1 -1
@@ -219,7 +219,7 @@ static void hpet_timer_set_irq(struct hpet_dev *devp)for (irq =find_first_bit (&v,HPET_MAX_IRQ ); irq <HPET_MAX_IRQ ; irq =find_next_bit (&v,HPET_MAX_IRQ ,1 + irq)) { -if (irq >=NR_IRQS ) { +if (irq >= nr_irqs) { irq =HPET_MAX_IRQ ;break ; }
drivers/char/random.c +2 -2
@@ -647,7 +647,7 @@ EXPORT_SYMBOL_GPL(add_input_randomness);void add_interrupt_randomness (int irq) { -if (irq >=NR_IRQS || irq_timer_state[irq] ==NULL ) +if (irq >= nr_irqs || irq_timer_state[irq] ==NULL )return ;DEBUG_ENT ("irq event %d\n" , irq);
@@ -911,7 +911,7 @@ void rand_initialize_irq(int irq) {struct timer_rand_state *state; -if (irq >=NR_IRQS || irq_timer_state[irq]) +if (irq >= nr_irqs || irq_timer_state[irq])return ;/*
drivers/char/vr41xx_giu.c +1 -1
@@ -641,7 +641,7 @@ static int __devinit giu_probe(struct platform_device *dev) } irq =platform_get_irq (dev,0 ); -if (irq <0 || irq >=NR_IRQS ) +if (irq <0 || irq >= nr_irqs)return -EBUSY ;return cascade_irq (irq, giu_get_irq);
Signature · 1 line
1.5.4.5
PATCH 11/42 drivers/net to use nr_irqs
--- drivers/net/3c59x.c | 4 ++-- drivers/net/hamradio/baycom_ser_fdx.c | 4 ++-- drivers/net/hamradio/scc.c | 6 +++--- drivers/net/wan/sbni.c | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-)
drivers/net/3c59x.c +2 -2
@@ -90,7 +90,7 @@ static int vortex_debug = 1;#include <linux/eisa.h> #include <linux/bitops.h> #include <linux/jiffies.h> -#include <asm/irq.h> /* For NR_IRQS only. */ +#include <asm/irq.h> /* For nr_irqs only. */ #include <asm/io.h> #include <asm/uaccess.h>
@@ -1221,7 +1221,7 @@ static int __devinit vortex_probe1(struct device *gendev,if (print_info)printk (", IRQ %d\n" , dev->irq);/* Tell them about an invalid IRQ. */ -if (dev->irq <=0 || dev->irq >=NR_IRQS ) +if (dev->irq <=0 || dev->irq >= nr_irqs)printk (KERN_WARNING " *** Warning: IRQ %d is unlikely to work! ***\n" , dev->irq);
drivers/net/hamradio/baycom_ser_fdx.c +2 -2
@@ -416,10 +416,10 @@ static int ser12_open(struct net_device *dev)if (!dev || !bc)return -ENXIO ;if (!dev->base_addr || dev->base_addr >0xffff -SER12_EXTENT || - dev->irq <2 || dev->irq >NR_IRQS ) { + dev->irq <2 || dev->irq > nr_irqs) {printk (KERN_INFO "baycom_ser_fdx: invalid portnumber (max %u) " "or irq (2 <= irq <= %d)\n" , -0xffff -SER12_EXTENT ,NR_IRQS ); +0xffff -SER12_EXTENT , nr_irqs);return -ENXIO ; }if (bc->baud <300 || bc->baud >4800 ) {
drivers/net/hamradio/scc.c +3 -3
@@ -1465,7 +1465,7 @@ static void z8530_init(void)printk (KERN_INFO "Init Z8530 driver: %u channels, IRQ" , Nchips*2 ); flag=" " ; -for (k =0 ; k <NR_IRQS ; k++) +for (k =0 ; k < nr_irqs; k++)if (Ivec[k].used) {printk ("%s%d" , flag, k);
@@ -1728,7 +1728,7 @@ static int scc_net_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)if (hwcfg.irq ==2 ) hwcfg.irq =9 ; -if (hwcfg.irq <0 || hwcfg.irq >=NR_IRQS ) +if (hwcfg.irq <0 || hwcfg.irq >= nr_irqs)return -EINVAL ;if (!Ivec[hwcfg.irq].used && hwcfg.irq)
@@ -2148,7 +2148,7 @@ static void __exit scc_cleanup_driver(void) }/* To unload the port must be closed so no real IRQ pending */ -for (k=0 ; k <NR_IRQS ; k++) +for (k =0 ; k < nr_irqs ; k++)if (Ivec[k].used)free_irq (k,NULL );local_irq_enable ();
drivers/net/wan/sbni.c +1 -1
@@ -318,7 +318,7 @@ sbni_pci_probe( struct net_device *dev )continue ; } -if ( pci_irq_line <=0 || pci_irq_line >=NR_IRQS ) +if (pci_irq_line <=0 || pci_irq_line >= nr_irqs)printk (KERN_WARNING " WARNING: The PCI BIOS assigned " "this PCI card to IRQ %d, which is unlikely " "to work!.\n"
Signature · 1 line
1.5.4.5
PATCH 12/42 drivers intr remapping to use nr_irqs
--- drivers/pci/intr_remapping.c | 16 ++++++++-------- 1 files changed, 8 insertions(+), 8 deletions(-)
drivers/pci/intr_remapping.c +8 -8
@@ -22,7 +22,7 @@ static DEFINE_SPINLOCK(irq_2_ir_lock);int irq_remapped (int irq) { -if (irq >NR_IRQS ) +if (irq > nr_irqs)return 0 ;if (!irq_2_iommu[irq].iommu)
@@ -35,7 +35,7 @@ int get_irte(int irq, struct irte *entry) {int index; -if (!entry || irq >NR_IRQS ) +if (!entry || irq > nr_irqs)return -1 ;spin_lock (&irq_2_ir_lock);
@@ -126,7 +126,7 @@ int map_irq_to_irte_handle(int irq, u16 *sub_handle)int index;spin_lock (&irq_2_ir_lock); -if (irq >=NR_IRQS || !irq_2_iommu[irq].iommu) { +if (irq >= nr_irqs || !irq_2_iommu[irq].iommu) {spin_unlock (&irq_2_ir_lock);return -1 ; }
@@ -140,7 +140,7 @@ int map_irq_to_irte_handle(int irq, u16 *sub_handle)int set_irte_irq (int irq,struct intel_iommu *iommu,u16 index,u16 subhandle) {spin_lock (&irq_2_ir_lock); -if (irq >=NR_IRQS || irq_2_iommu[irq].iommu) { +if (irq >= nr_irqs || irq_2_iommu[irq].iommu) {spin_unlock (&irq_2_ir_lock);return -1 ; }
@@ -158,7 +158,7 @@ int set_irte_irq(int irq, struct intel_iommu *iommu, u16 index, u16 subhandle)int clear_irte_irq (int irq,struct intel_iommu *iommu,u16 index) {spin_lock (&irq_2_ir_lock); -if (irq >=NR_IRQS || !irq_2_iommu[irq].iommu) { +if (irq >= nr_irqs || !irq_2_iommu[irq].iommu) {spin_unlock (&irq_2_ir_lock);return -1 ; }
@@ -180,7 +180,7 @@ int modify_irte(int irq, struct irte *irte_modified)struct intel_iommu *iommu;spin_lock (&irq_2_ir_lock); -if (irq >=NR_IRQS || !irq_2_iommu[irq].iommu) { +if (irq >= nr_irqs || !irq_2_iommu[irq].iommu) {spin_unlock (&irq_2_ir_lock);return -1 ; }
@@ -205,7 +205,7 @@ int flush_irte(int irq)struct intel_iommu *iommu;spin_lock (&irq_2_ir_lock); -if (irq >=NR_IRQS || !irq_2_iommu[irq].iommu) { +if (irq >= nr_irqs || !irq_2_iommu[irq].iommu) {spin_unlock (&irq_2_ir_lock);return -1 ; }
@@ -248,7 +248,7 @@ int free_irte(int irq)struct intel_iommu *iommu;spin_lock (&irq_2_ir_lock); -if (irq >=NR_IRQS || !irq_2_iommu[irq].iommu) { +if (irq >= nr_irqs || !irq_2_iommu[irq].iommu) {spin_unlock (&irq_2_ir_lock);return -1 ; }
Signature · 1 line
1.5.4.5
PATCH 13/42 drivers/pcmcia to use nr_irqs
--- drivers/pcmcia/at91_cf.c | 2 +- drivers/pcmcia/vrc4171_card.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/pcmcia/at91_cf.c +1 -1
@@ -273,7 +273,7 @@ static int __init at91_cf_probe(struct platform_device *pdev) goto fail0d; cf->socket.pci_irq = board->irq_pin; }else - cf->socket.pci_irq =NR_IRQS +1 ; + cf->socket.pci_irq = nr_irqs +1 ;/* pcmcia layer only remaps "real" memory not iospace */ cf->socket.io_offset = (unsigned long)
drivers/pcmcia/vrc4171_card.c +1 -1
@@ -639,7 +639,7 @@ static int __devinit vrc4171_card_setup(char *options)int irq; options +=4 ; irq =simple_strtoul (options, &options,0 ); -if (irq >=0 && irq <NR_IRQS ) +if (irq >=0 && irq < nr_irqs) vrc4171_irq = irq;if (*options !=',' )
Signature · 1 line
1.5.4.5
PATCH 14/42 drivers/rtc to use nr_irqs
--- drivers/rtc/rtc-vr41xx.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/rtc/rtc-vr41xx.c +2 -2
@@ -360,7 +360,7 @@ static int __devinit rtc_probe(struct platform_device *pdev)spin_unlock_irq (&rtc_lock); aie_irq =platform_get_irq (pdev,0 ); -if (aie_irq <0 || aie_irq >=NR_IRQS ) { +if (aie_irq <0 || aie_irq >= nr_irqs) { retval = -EBUSY ; goto err_device_unregister; }
@@ -371,7 +371,7 @@ static int __devinit rtc_probe(struct platform_device *pdev) goto err_device_unregister; pie_irq =platform_get_irq (pdev,1 ); -if (pie_irq <0 || pie_irq >=NR_IRQS ) +if (pie_irq <0 || pie_irq >= nr_irqs) goto err_free_irq; retval = request_irq(pie_irq, rtclong1_interrupt, IRQF_DISABLED,
Signature · 1 line
1.5.4.5
PATCH 15/42 drivers/scsi to use nr_irqs
--- drivers/scsi/aha152x.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/scsi/aha152x.c +1 -1
@@ -337,7 +337,7 @@ CMD_INC_RESID(struct scsi_cmnd *cmd, int inc)#else #define IRQ_MIN 9#if defined(__PPC) -#define IRQ_MAX (NR_IRQS-1) +#define IRQ_MAX (nr_irqs-1)#else #define IRQ_MAX 12#endif
Signature · 1 line
1.5.4.5
PATCH 16/42 drivers/serial to use nr_irqs
--- drivers/serial/8250.c | 2 +- drivers/serial/amba-pl010.c | 2 +- drivers/serial/amba-pl011.c | 2 +- drivers/serial/cpm_uart/cpm_uart_core.c | 2 +- drivers/serial/m32r_sio.c | 4 ++-- drivers/serial/serial_core.c | 2 +- drivers/serial/serial_lh7a40x.c | 2 +- drivers/serial/sh-sci.c | 2 +- drivers/serial/ucc_uart.c | 2 +- 9 files changed, 10 insertions(+), 10 deletions(-)
drivers/serial/8250.c +1 -1
@@ -2479,7 +2479,7 @@ static void serial8250_config_port(struct uart_port *port, int flags)static int serial8250_verify_port (struct uart_port *port,struct serial_struct *ser) { -if (ser->irq >=NR_IRQS || ser->irq <0 || +if (ser->irq >= nr_irqs || ser->irq <0 || ser->baud_base <9600 || ser->type <PORT_UNKNOWN || ser->type >=ARRAY_SIZE (uart_config) || ser->type ==PORT_CIRRUS || ser->type ==PORT_STARTECH )
drivers/serial/amba-pl010.c +1 -1
@@ -512,7 +512,7 @@ static int pl010_verify_port(struct uart_port *port, struct serial_struct *ser)int ret =0 ;if (ser->type !=PORT_UNKNOWN && ser->type !=PORT_AMBA ) ret = -EINVAL ; -if (ser->irq <0 || ser->irq >=NR_IRQS ) +if (ser->irq <0 || ser->irq >= nr_irqs) ret = -EINVAL ;if (ser->baud_base <9600 ) ret = -EINVAL ;
drivers/serial/amba-pl011.c +1 -1
@@ -572,7 +572,7 @@ static int pl010_verify_port(struct uart_port *port, struct serial_struct *ser)int ret =0 ;if (ser->type !=PORT_UNKNOWN && ser->type !=PORT_AMBA ) ret = -EINVAL ; -if (ser->irq <0 || ser->irq >=NR_IRQS ) +if (ser->irq <0 || ser->irq >= nr_irqs) ret = -EINVAL ;if (ser->baud_base <9600 ) ret = -EINVAL ;
drivers/serial/cpm_uart/cpm_uart_core.c +1 -1
@@ -589,7 +589,7 @@ static int cpm_uart_verify_port(struct uart_port *port,if (ser->type !=PORT_UNKNOWN && ser->type !=PORT_CPM ) ret = -EINVAL ; -if (ser->irq <0 || ser->irq >=NR_IRQS ) +if (ser->irq <0 || ser->irq >= nr_irqs) ret = -EINVAL ;if (ser->baud_base <9600 ) ret = -EINVAL ;
drivers/serial/m32r_sio.c +2 -2
@@ -922,7 +922,7 @@ static void m32r_sio_config_port(struct uart_port *port, int flags)static int m32r_sio_verify_port (struct uart_port *port,struct serial_struct *ser) { -if (ser->irq >=NR_IRQS || ser->irq <0 || +if (ser->irq >= nr_irqs || ser->irq <0 || ser->baud_base <9600 || ser->type <PORT_UNKNOWN || ser->type >=ARRAY_SIZE (uart_config))return -EINVAL ;
@@ -1162,7 +1162,7 @@ static int __init m32r_sio_init(void)printk (KERN_INFO "Serial: M32R SIO driver\n" ); -for (i =0 ; i <NR_IRQS ; i++) +for (i =0 ; i < nr_irqs; i++)spin_lock_init (&irq_lists[i].lock); ret =uart_register_driver (&m32r_sio_reg);
drivers/serial/serial_core.c +1 -1
@@ -741,7 +741,7 @@ static int uart_set_info(struct uart_state *state,if (port->ops->verify_port) retval = port->ops->verify_port (port, &new_serial); -if ((new_serial.irq >=NR_IRQS ) || (new_serial.irq <0 ) || +if ((new_serial.irq >= nr_irqs) || (new_serial.irq <0 ) || (new_serial.baud_base <9600 )) retval = -EINVAL ;
drivers/serial/serial_lh7a40x.c +1 -1
@@ -460,7 +460,7 @@ static int lh7a40xuart_verify_port (struct uart_port* port,if (ser->type !=PORT_UNKNOWN && ser->type !=PORT_LH7A40X ) ret = -EINVAL ; -if (ser->irq <0 || ser->irq >=NR_IRQS ) +if (ser->irq <0 || ser->irq >= nr_irqs) ret = -EINVAL ;if (ser->baud_base <9600 )/* *** FIXME: is this true? */ ret = -EINVAL ;
drivers/serial/sh-sci.c +1 -1
@@ -1157,7 +1157,7 @@ static int sci_verify_port(struct uart_port *port, struct serial_struct *ser) {struct sci_port *s = &sci_ports[port->line]; -if (ser->irq != s->irqs[SCIx_TXI_IRQ] || ser->irq >NR_IRQS ) +if (ser->irq != s->irqs[SCIx_TXI_IRQ] || ser->irq > nr_irqs)return -EINVAL ;if (ser->baud_base <2400 )/* No paper tape reader for Mitch.. */
drivers/serial/ucc_uart.c +1 -1
@@ -1066,7 +1066,7 @@ static int qe_uart_verify_port(struct uart_port *port,if (ser->type !=PORT_UNKNOWN && ser->type !=PORT_CPM )return -EINVAL ; -if (ser->irq <0 || ser->irq >=NR_IRQS ) +if (ser->irq <0 || ser->irq >= nr_irqs)return -EINVAL ;if (ser->baud_base <9600 )
Signature · 1 line
1.5.4.5
PATCH 17/42 drivers proc to use nr_irqs
--- fs/proc/proc_misc.c | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-)
fs/proc/proc_misc.c +5 -5
@@ -503,7 +503,7 @@ static int show_stat(struct seq_file *p, void *v)struct timespec boottime;unsigned int *per_irq_sum; - per_irq_sum =kzalloc (sizeof (unsigned int )*NR_IRQS ,GFP_KERNEL ); + per_irq_sum =kzalloc (sizeof (unsigned int )*nr_irqs,GFP_KERNEL );if (!per_irq_sum)return -ENOMEM ;
@@ -525,7 +525,7 @@ static int show_stat(struct seq_file *p, void *v) softirq =cputime64_add (softirq,kstat_cpu (i).cpustat.softirq); steal =cputime64_add (steal,kstat_cpu (i).cpustat.steal); guest =cputime64_add (guest,kstat_cpu (i).cpustat.guest); -for (j =0 ; j <NR_IRQS ; j++) { +for (j =0 ; j < nr_irqs; j++) {unsigned int temp =kstat_cpu (i).irqs[j]; sum += temp; per_irq_sum[j] += temp;
@@ -571,7 +571,7 @@ static int show_stat(struct seq_file *p, void *v) }seq_printf (p,"intr %llu" , (unsigned long long )sum); -for (i =0 ; i <NR_IRQS ; i++) +for (i =0 ; i < nr_irqs; i++)seq_printf (p," %u" , per_irq_sum[i]); seq_printf(p,
@@ -625,13 +625,13 @@ static const struct file_operations proc_stat_operations = {*/ static void *int_seq_start (struct seq_file *f,loff_t *pos) { -return (*pos <=NR_IRQS ) ? pos :NULL ; +return (*pos <= nr_irqs) ? pos :NULL ; }static void *int_seq_next (struct seq_file *f,void *v,loff_t *pos) { (*pos)++; -if (*pos >NR_IRQS ) +if (*pos > nr_irqs)return NULL ;return pos; }
Signature · 1 line
1.5.4.5
PATCH 18/42 drivers xen events to use nr_irqs
--- drivers/xen/events.c | 12 ++++++------ 1 files changed, 6 insertions(+), 6 deletions(-)
drivers/xen/events.c +6 -6
@@ -139,7 +139,7 @@ static void init_evtchn_cpu_bindings(void)#ifdef CONFIG_SMP int i;/* By default all event channels notify CPU#0. */ -for (i =0 ; i <NR_IRQS ; i++) +for (i =0 ; i < nr_irqs; i++) irq_desc[i].affinity =cpumask_of_cpu (0 );#endif
@@ -223,12 +223,12 @@ static int find_unbound_irq(void)int irq;/* Only allocate from dynirq range */ -for (irq =0 ; irq <NR_IRQS ; irq++) +for (irq =0 ; irq < nr_irqs; irq++)if (irq_bindcount[irq] ==0 )break ; -if (irq ==NR_IRQS ) -panic ("No available IRQ to bind to: increase NR_IRQS!\n" ); +if (irq == nr_irqs) +panic ("No available IRQ to bind to: increase nr_irqs!\n" );return irq; }
@@ -761,7 +761,7 @@ void xen_irq_resume(void)mask_evtchn (evtchn);/* No IRQ <-> event-channel mappings. */ -for (irq =0 ; irq <NR_IRQS ; irq++) +for (irq =0 ; irq < nr_irqs; irq++) irq_info[irq].evtchn =0 ;/* zap event-channel binding */ for (evtchn =0 ; evtchn <NR_EVENT_CHANNELS ; evtchn++)
@@ -793,7 +793,7 @@ void __init xen_init_IRQ(void)mask_evtchn (i);/* Dynamic IRQ space is currently unbound. Zero the refcnts. */ -for (i =0 ; i <NR_IRQS ; i++) +for (i =0 ; i < nr_irqs; i++) irq_bindcount[i] =0 ;irq_ctx_init (smp_processor_id ());
Signature · 1 line
1.5.4.5
PATCH 19/42 make irq_timer_state to use dyn_array
--- drivers/char/random.c | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-)
drivers/char/random.c +6 -0
@@ -558,7 +558,13 @@ struct timer_rand_state { };static struct timer_rand_state input_timer_state; + +#ifdef CONFIG_HAVE_DYN_ARRAY +static struct timer_rand_state **irq_timer_state; +DEFINE_DYN_ARRAY (irq_timer_state,sizeof (struct timer_rand_state *), nr_irqs,PAGE_SIZE ,NULL ); +#else static struct timer_rand_state *irq_timer_state[NR_IRQS ]; +#endif /* * This function adds entropy to the entropy "pool" by using timing
Signature · 1 line
1.5.4.5
PATCH 20/42 make irq2_iommu to use dyn_array
--- drivers/pci/intr_remapping.c | 11 +++++++++-- 1 files changed, 9 insertions(+), 2 deletions(-)
drivers/pci/intr_remapping.c +9 -2
@@ -11,12 +11,19 @@ static struct ioapic_scope ir_ioapic[MAX_IO_APICS];static int ir_ioapic_num;int intr_remapping_enabled; -static struct { +struct irq_2_iommu {struct intel_iommu *iommu;u16 irte_index;u16 sub_handle;u8 irte_mask; -} irq_2_iommu[NR_IRQS ]; +}; + +#ifdef CONFIG_HAVE_DYNA_ARRAY +static struct irq_2_iommu *irq_2_iommu; +DEFINE_DYN_ARRAY (irq_2_iommu,sizeof (struct irq_2_iommu ), nr_irqs,PAGE_SIZE ,NULL ); +#else +static struct irq_2_iommu irq_2_iommu[NR_IRQS ]; +#endif static DEFINE_SPINLOCK (irq_2_ir_lock);
Signature · 1 line
1.5.4.5
PATCH 21/42 make irq_desc to use dyn_array
--- include/linux/irq.h | 4 ++++ kernel/irq/handle.c | 31 +++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+), 0 deletions(-)
include/linux/irq.h +4 -0
@@ -181,7 +181,11 @@ struct irq_desc {const char *name; }____cacheline_internodealigned_in_smp ; +#ifdef CONFIG_HAVE_DYN_ARRAY +extern struct irq_desc *irq_desc; +#else extern struct irq_desc irq_desc[NR_IRQS ]; +#endif /* * Migration helpers for obsolete names, they will go away:
kernel/irq/handle.c +31 -0
@@ -48,6 +48,36 @@ handle_bad_irq(unsigned int irq, struct irq_desc *desc)* Controller mappings for all interrupt sources: */ int nr_irqs =NR_IRQS ; + +#ifdef CONFIG_HAVE_DYN_ARRAY +static struct irq_desc irq_desc_init __initdata = { + .status = IRQ_DISABLED, + .chip = &no_irq_chip, + .handle_irq = handle_bad_irq, + .depth = 1, + .lock = __SPIN_LOCK_UNLOCKED(irq_desc_init.lock), +#ifdef CONFIG_SMP + .affinity = CPU_MASK_ALL +#endif +}; + +static void __init init_work(void *data) +{ + struct dyn_array *da = data; + int i; + struct irq_desc *desc; + + desc = *da->name; + + for (i = 0; i < *da->nr; i++) + memcpy(&desc[i], &irq_desc_init, sizeof(struct irq_desc)); +} + +struct irq_desc *irq_desc; +DEFINE_DYN_ARRAY(irq_desc, sizeof(struct irq_desc), nr_irqs, PAGE_SIZE, init_work); + +#else + struct irq_desc irq_desc[NR_IRQS] __cacheline_aligned_in_smp = { [0 ... NR_IRQS-1] = { .status = IRQ_DISABLED,
@@ -60,6 +90,7 @@ struct irq_desc irq_desc[NR_IRQS] __cacheline_aligned_in_smp = { #endif } }; +#endif /* * What should we do if we get a hw irq event on an illegal vector?
Signature · 1 line
1.5.4.5
PATCH 22/42 irq: make irqs in kernel stat use per_cpu_dyn_array
--- include/linux/kernel_stat.h | 4 ++++ kernel/sched.c | 5 ++++- 2 files changed, 8 insertions(+), 1 deletions(-)
include/linux/kernel_stat.h +4 -0
@@ -28,7 +28,11 @@ struct cpu_usage_stat {struct kernel_stat {struct cpu_usage_stat cpustat; +#ifdef CONFIG_HAVE_DYN_ARRAY +unsigned int *irqs; +#else unsigned int irqs[NR_IRQS ]; +#endif }; DECLARE_PER_CPU(struct kernel_stat, kstat);
kernel/sched.c +4 -1
@@ -4021,9 +4021,12 @@ static inline void idle_balance(int cpu, struct rq *rq)#endif DEFINE_PER_CPU(struct kernel_stat, kstat); -EXPORT_PER_CPU_SYMBOL (kstat); +#ifdef CONFIG_HAVE_DYN_ARRAY +DEFINE_PER_CPU_DYN_ARRAY_ADDR (per_cpu__kstat_irqs, per_cpu__kstat.irqs,sizeof (unsigned int ), nr_irqs,sizeof (unsigned long ),NULL ); +#endif +/* * Return p->sum_exec_runtime plus any more ns on the sched_clock * that have not yet been banked in case the task is currently running.
Signature · 1 line
1.5.4.5
PATCH 23/42 x86: use dyn_array in io_apic_xx.c
--- arch/x86/kernel/io_apic_32.c | 54 +++++++++++++++++++++++++++++++++-------- arch/x86/kernel/io_apic_64.c | 28 ++++++++++++++++----- arch/x86/kernel/setup.c | 6 ++++ 3 files changed, 70 insertions(+), 18 deletions(-)
arch/x86/kernel/io_apic_32.c +43 -11
@@ -70,7 +70,7 @@ int timer_through_8259 __initdata;*/ int sis_apic_bug =-1 ; -int first_free_entry =NR_IRQS ; +int first_free_entry;/* * # of IRQ routing registers */
@@ -98,10 +98,7 @@ static int disable_timer_pin_1 __initdata;* Rough estimation of how many shared IRQs there are, can * be changed anytime. */ -#define MAX_PLUS_SHARED_IRQS NR_IRQS -#define PIN_MAP_SIZE (MAX_PLUS_SHARED_IRQS + NR_IRQS) - -int pin_map_size =PIN_MAP_SIZE ; +int pin_map_size;/* * This is performance-critical, we want to do it O(1)
@@ -112,7 +109,9 @@ int pin_map_size = PIN_MAP_SIZE;static struct irq_pin_list {int apic, pin, next; -} irq_2_pin[PIN_MAP_SIZE ]; +} *irq_2_pin; + +DEFINE_DYN_ARRAY (irq_2_pin,sizeof (struct irq_pin_list ), pin_map_size,16 ,NULL );struct io_apic {unsigned int index;
@@ -403,9 +402,28 @@ static struct irq_cpu_info {#define CPU_TO_PACKAGEINDEX (i) (first_cpu(per_cpu(cpu_sibling_map, i))) -static cpumask_t balance_irq_affinity[NR_IRQS ] = { - [0 ...NR_IRQS -1 ] =CPU_MASK_ALL -}; +static cpumask_t balance_irq_affinity_init__initdata =CPU_MASK_ALL ; + +static cpumask_t *balance_irq_affinity; + + +static void __init irq_affinity_init_work (void *data) +{ +struct dyn_array *da = data; + +int i; +struct balance_irq_affinity *affinity; + + affinity = *da->name; + +for (i =0 ; i < *da->nr; i++) +memcpy (&affinity[i], &balance_irq_affinity_init, +sizeof (struct balance_irq_affinity )); + +} + +DEFINE_DYN_ARRAY (balance_irq_affinity,sizeof (struct balance_irq_affinity ), nr_irqs,PAGE_SIZE , irq_affinity_init_work); +void set_balance_irq_affinity (unsigned int irq,cpumask_t mask) {
@@ -1170,14 +1188,28 @@ static inline int IO_APIC_irq_trigger(int irq) }/* irq_vectors is indexed by the sum of all RTEs in all I/O APICs. */ -static u8 irq_vector[NR_IRQ_VECTORS ]__read_mostly = {FIRST_DEVICE_VECTOR ,0 }; +static u8 irq_vector_init_first__initdata =FIRST_DEVICE_VECTOR ; +static u8 *irq_vector; + +static void __init irq_vector_init_work (void *data) +{ +struct dyn_array *da = data; + +u8 *irq_vec; + + irq_vec = *da->name; + + irq_vec[0 ] = irq_vector_init_first; +} + +DEFINE_DYN_ARRAY (irq_vector,sizeof (u8), nr_irqs,PAGE_SIZE , irq_vector_init_work);static int __assign_irq_vector (int irq) {static int current_vector =FIRST_DEVICE_VECTOR , current_offset;int vector, offset; -BUG_ON ((unsigned )irq >=NR_IRQ_VECTORS ); +BUG_ON ((unsigned )irq >= nr_irqs);if (irq_vector[irq] >0 )return irq_vector[irq];
arch/x86/kernel/io_apic_64.c +21 -7
@@ -66,7 +66,7 @@ struct irq_cfg { };/* irq_cfg is indexed by the sum of all RTEs in all I/O APICs. */ -static struct irq_cfg irq_cfg[NR_IRQS ]__read_mostly = { +static struct irq_cfg irq_cfg_legacy[]__initdata = { [0 ] = { .domain =CPU_MASK_ALL , .vector =IRQ0_VECTOR , }, [1 ] = { .domain =CPU_MASK_ALL , .vector =IRQ1_VECTOR , }, [2 ] = { .domain =CPU_MASK_ALL , .vector =IRQ2_VECTOR , },
@@ -85,6 +85,17 @@ static struct irq_cfg irq_cfg[NR_IRQS] __read_mostly = { [15] = { .domain = CPU_MASK_ALL, .vector = IRQ15_VECTOR, }, }; +static struct irq_cfg *irq_cfg; + +static void __init init_work (void *data) +{ +struct dyn_array *da = data; + +memcpy (*da->name, irq_cfg_legacy,sizeof (irq_cfg_legacy)); +} + +DEFINE_DYN_ARRAY (irq_cfg,sizeof (struct irq_cfg ), nr_irqs,PAGE_SIZE , init_work); +static int assign_irq_vector (int irq,cpumask_t mask);int first_system_vector =0xfe ;
@@ -129,10 +140,9 @@ DECLARE_BITMAP(mp_bus_not_pci, MAX_MP_BUSSES);* Rough estimation of how many shared IRQs there are, can * be changed anytime. */ -#define MAX_PLUS_SHARED_IRQS NR_IRQS -#define PIN_MAP_SIZE (MAX_PLUS_SHARED_IRQS + NR_IRQS) -int pin_map_size =PIN_MAP_SIZE ; +int pin_map_size; +/* * This is performance-critical, we want to do it O(1) *
@@ -141,8 +151,12 @@ int pin_map_size = PIN_MAP_SIZE;*/ static struct irq_pin_list { -short apic, pin, next; -} irq_2_pin[PIN_MAP_SIZE ]; +short apic, pin; +int next; +} *irq_2_pin; + +DEFINE_DYN_ARRAY (irq_2_pin,sizeof (struct irq_pin_list ), pin_map_size,sizeof (struct irq_pin_list ),NULL ); +struct io_apic {unsigned int index;
@@ -359,7 +373,7 @@ static void set_ioapic_affinity_irq(unsigned int irq, cpumask_t mask)* shared ISA-space IRQs, so we have to support them. We are super * fast in the common case, and fast for shared ISA-space IRQs. */ -int first_free_entry =NR_IRQS ; +int first_free_entry;static void add_pin_to_irq (unsigned int irq,int apic,int pin) {struct irq_pin_list *entry = irq_2_pin + irq;
arch/x86/kernel/setup.c +6 -0
@@ -856,9 +856,15 @@ void __init setup_arch(char **cmdline_p)#endif prefill_possible_map (); +#ifdef CONFIG_X86_64 +/* need to wait for nr_cpu_ids settle down */ +if (nr_irqs ==NR_IRQS ) + nr_irqs =32 * nr_cpu_ids +224 ;init_cpu_to_node ();#endif + pin_map_size = nr_irqs *2 ; + first_free_entry = nr_irqs;init_apic_mappings ();ioapic_init_mappings ();
Signature · 1 line
1.5.4.5
PATCH 24/42 x86: get mp_irqs from madt
--- arch/x86/kernel/acpi/boot.c | 30 ++++++++++++++++++++++++++++-- include/asm-x86/mpspec.h | 1 + 2 files changed, 29 insertions(+), 2 deletions(-)
arch/x86/kernel/acpi/boot.c +28 -2
@@ -962,6 +962,29 @@ void __init mp_register_ioapic(int id, u32 address, u32 gsi_base) nr_ioapics++; } +int get_nr_irqs_via_madt (void ) +{ +int idx; +int nr =0 ; + +for (idx =0 ; idx < nr_ioapics; idx++) { +if (mp_ioapic_routing[idx].gsi_end > nr) + nr = mp_ioapic_routing[idx].gsi_end; + } + + nr++; + +/* double it for hotplug and msi and nmi */ + nr <<=1 ; + +/* something wrong ? */ +if (nr <32 ) + nr =32 ; + +return nr; + +} +static void assign_to_mp_irq (struct mp_config_intsrc *m,struct mp_config_intsrc *mp_irq) {
@@ -1259,9 +1282,12 @@ static int __init acpi_parse_madt_ioapic_entries(void)return count; } + + nr_irqs =get_nr_irqs_via_madt (); + count =acpi_table_parse_madt (ACPI_MADT_TYPE_INTERRUPT_OVERRIDE , acpi_parse_int_src_ovr, -NR_IRQ_VECTORS ); + nr_irqs);if (count <0 ) { printk(KERN_ERR PREFIX "Error parsing interrupt source overrides entry\n");
@@ -1281,7 +1307,7 @@ static int __init acpi_parse_madt_ioapic_entries(void) count =acpi_table_parse_madt (ACPI_MADT_TYPE_NMI_SOURCE , acpi_parse_nmi_src, -NR_IRQ_VECTORS ); + nr_irqs);if (count <0 ) { printk(KERN_ERR PREFIX "Error parsing NMI SRC entry\n");/* TBD: Cleanup to allow fallback to MPS */
include/asm-x86/mpspec.h +1 -0
@@ -59,6 +59,7 @@ extern void mp_override_legacy_irq(u8 bus_irq, u8 polarity, u8 trigger, u32 gsi);extern void mp_config_acpi_legacy_irqs (void );extern int mp_register_gsi (u32 gsi,int edge_level,int active_high_low); +extern int get_nr_irqs_via_madt (void );#ifdef CONFIG_X86_IO_APIC extern int mp_config_acpi_gsi (unsigned char number,unsigned int devfn,u8 pin,u32 gsi,int triggering,int polarity);
Signature · 1 line
1.5.4.5
PATCH 25/42 x86: remove nr_irq_vectors
--- include/asm-x86/irq_vectors.h | 2 -- 1 files changed, 0 insertions(+), 2 deletions(-)
include/asm-x86/irq_vectors.h +0 -2
@@ -127,8 +127,6 @@#endif /* VISWS */ -#define NR_IRQ_VECTORS NR_IRQS -/* Voyager specific defines */ /* These define the CPIs we use in linux */ #define VIC_CPI_LEVEL0 0
Signature · 1 line
1.5.4.5
PATCH 26/42 x86_64: use irq_desc() together with dyn_array
add CONFIG_HAVE_SPARSE_IRQ to for use condensed array preallocate 32 irq_desc, and irq_desc() will try to get more.
v2: accrording to Eric, change get_irq_desc() to irq_desc()
--- arch/Kconfig | 4 + arch/alpha/kernel/irq.c | 19 ++- arch/alpha/kernel/irq_alpha.c | 5 +- arch/alpha/kernel/irq_i8259.c | 8 +- arch/alpha/kernel/irq_pyxis.c | 9 +- arch/alpha/kernel/irq_srm.c | 9 +- arch/alpha/kernel/sys_alcor.c | 9 +- arch/alpha/kernel/sys_cabriolet.c | 8 +- arch/alpha/kernel/sys_dp264.c | 9 +- arch/alpha/kernel/sys_eb64p.c | 8 +- arch/alpha/kernel/sys_eiger.c | 7 +- arch/alpha/kernel/sys_jensen.c | 21 ++-- arch/alpha/kernel/sys_marvel.c | 20 ++- arch/alpha/kernel/sys_mikasa.c | 8 +- arch/alpha/kernel/sys_noritake.c | 8 +- arch/alpha/kernel/sys_rawhide.c | 8 +- arch/alpha/kernel/sys_rx164.c | 8 +- arch/alpha/kernel/sys_sable.c | 8 +- arch/alpha/kernel/sys_takara.c | 8 +- arch/alpha/kernel/sys_titan.c | 8 +- arch/alpha/kernel/sys_wildfire.c | 19 ++-- arch/arm/common/gic.c | 2 +- arch/arm/kernel/irq.c | 12 +- arch/arm/mach-at91/gpio.c | 4 +- arch/arm/mach-davinci/gpio.c | 13 ++- arch/arm/mach-ep93xx/core.c | 4 +- arch/arm/mach-orion5x/irq.c | 8 +- arch/arm/mach-sa1100/h3600.c | 10 +- arch/arm/plat-mxc/gpio.c | 7 +- arch/arm/plat-omap/gpio.c | 10 +- arch/arm/plat-orion/irq.c | 2 +- arch/avr32/kernel/irq.c | 10 +- arch/avr32/mach-at32ap/extint.c | 7 +- arch/avr32/mach-at32ap/pio.c | 2 +- arch/blackfin/kernel/irqchip.c | 8 +- arch/blackfin/kernel/traps.c | 8 +- arch/blackfin/mach-bf527/boards/cm_bf527.c | 2 +- arch/blackfin/mach-bf527/boards/ezkit.c | 2 +- arch/blackfin/mach-bf533/boards/cm_bf533.c | 2 +- arch/blackfin/mach-bf533/boards/ezkit.c | 2 +- arch/blackfin/mach-bf533/boards/stamp.c | 2 +- arch/blackfin/mach-bf537/boards/cm_bf537.c | 2 +- arch/blackfin/mach-bf537/boards/generic_board.c | 2 +- arch/blackfin/mach-bf537/boards/stamp.c | 2 +- arch/blackfin/mach-bf561/boards/cm_bf561.c | 2 +- arch/blackfin/mach-bf561/boards/ezkit.c | 2 +- arch/cris/arch-v10/kernel/irq.c | 2 +- arch/cris/arch-v32/kernel/irq.c | 6 +- arch/cris/kernel/irq.c | 10 +- arch/frv/kernel/irq.c | 10 +- arch/h8300/kernel/irq.c | 22 ++-- arch/ia64/kernel/iosapic.c | 11 +- arch/ia64/kernel/irq.c | 16 ++- arch/ia64/kernel/msi_ia64.c | 2 +- arch/ia64/sn/kernel/irq.c | 2 +- arch/ia64/sn/kernel/msi_sn.c | 2 +- arch/m32r/kernel/irq.c | 10 +- arch/m32r/platforms/m32104ut/setup.c | 37 +++--- arch/m32r/platforms/m32700ut/setup.c | 133 +++++++++++--------- arch/m32r/platforms/mappi/setup.c | 84 ++++++++----- arch/m32r/platforms/mappi2/setup.c | 103 ++++++++++------ arch/m32r/platforms/mappi3/setup.c | 103 ++++++++++------ arch/m32r/platforms/oaks32r/setup.c | 62 ++++++---- arch/m32r/platforms/opsput/setup.c | 149 ++++++++++++++--------- arch/m32r/platforms/usrv/setup.c | 92 +++++++++------ arch/m68knommu/kernel/irq.c | 16 ++- arch/mips/au1000/common/irq.c | 2 +- arch/mips/dec/ioasic-irq.c | 2 +- arch/mips/emma2rh/markeins/irq_markeins.c | 2 +- arch/mips/kernel/irq-gic.c | 2 +- arch/mips/kernel/irq-msc01.c | 2 +- arch/mips/kernel/irq.c | 10 +- arch/mips/kernel/smtc.c | 2 +- arch/mips/mti-malta/malta-smtc.c | 2 +- arch/mips/sgi-ip32/ip32-irq.c | 10 +- arch/mips/sibyte/bcm1480/irq.c | 2 +- arch/mips/sibyte/sb1250/irq.c | 2 +- arch/mips/sni/a20r.c | 2 +- arch/mips/sni/pcimt.c | 2 +- arch/mips/sni/pcit.c | 2 +- arch/mips/sni/rm200.c | 2 +- arch/mn10300/kernel/irq.c | 12 +- arch/parisc/kernel/irq.c | 41 ++++--- arch/powerpc/kernel/irq.c | 11 +- arch/powerpc/platforms/powermac/pic.c | 2 +- arch/powerpc/platforms/pseries/xics.c | 4 +- arch/powerpc/sysdev/cpm2_pic.c | 5 +- arch/powerpc/sysdev/mpic.c | 16 ++-- arch/powerpc/sysdev/qe_lib/qe_ic.c | 2 +- arch/sh/boards/cayman/irq.c | 4 +- arch/sh/boards/dreamcast/irq.c | 2 +- arch/sh/boards/dreamcast/setup.c | 2 +- arch/sh/boards/renesas/systemh/irq.c | 4 +- arch/sh/boards/se/7206/irq.c | 2 +- arch/sh/boards/superh/microdev/irq.c | 4 +- arch/sh/cchips/hd6446x/hd64461.c | 4 +- arch/sh/cchips/hd6446x/hd64465/setup.c | 4 +- arch/sh/kernel/cpu/irq/imask.c | 4 +- arch/sh/kernel/cpu/irq/intc-sh5.c | 4 +- arch/sh/kernel/irq.c | 12 +- arch/sparc64/kernel/irq.c | 31 +++-- arch/um/kernel/irq.c | 29 +++-- arch/x86/Kconfig | 1 + arch/x86/kernel/io_apic_32.c | 46 +++++-- arch/x86/kernel/io_apic_64.c | 75 ++++++++---- arch/x86/kernel/irq_32.c | 24 ++-- arch/x86/kernel/irq_64.c | 35 +++--- arch/x86/kernel/irqinit_64.c | 10 +- arch/x86/kernel/visws_quirks.c | 30 +++-- arch/x86/mach-voyager/voyager_smp.c | 4 +- arch/xtensa/kernel/irq.c | 10 +- drivers/gpio/gpiolib.c | 2 +- drivers/mfd/asic3.c | 4 +- drivers/mfd/htc-egpio.c | 2 +- drivers/parisc/dino.c | 6 +- drivers/parisc/eisa.c | 4 +- drivers/parisc/gsc.c | 12 ++- drivers/parisc/iosapic.c | 4 +- drivers/parisc/superio.c | 4 +- drivers/pcmcia/hd64465_ss.c | 12 ++- drivers/xen/events.c | 8 +- include/asm-ia64/hw_irq.h | 2 +- include/asm-mips/irq.h | 2 +- include/asm-powerpc/irq.h | 2 +- include/linux/irq.h | 34 ++++-- kernel/irq/autoprobe.c | 10 +- kernel/irq/chip.c | 32 +++-- kernel/irq/handle.c | 144 +++++++++++++++++++--- kernel/irq/manage.c | 35 +++--- kernel/irq/migration.c | 14 +- kernel/irq/proc.c | 36 +++--- kernel/irq/resend.c | 2 +- kernel/irq/spurious.c | 5 +- 133 files changed, 1271 insertions(+), 795 deletions(-)
arch/Kconfig +4 -0
@@ -105,3 +105,7 @@ config HAVE_CLK config HAVE_DYN_ARRAY def_bool n + +config HAVE_SPARSE_IRQ + def_bool n +
arch/alpha/kernel/irq.c +12 -7
@@ -46,16 +46,19 @@ int irq_select_affinity(unsigned int irq) {static int last_cpu;int cpu = last_cpu +1 ; +struct irq_desc *desc; -if (!irq_desc[irq].chip->set_affinity || irq_user_affinity[irq]) + desc =irq_desc (irq); + +if (!desc->chip->set_affinity || irq_user_affinity[irq])return 1 ;while (!cpu_possible (cpu) || !cpu_isset (cpu, irq_default_affinity)) cpu = (cpu < (NR_CPUS -1 ) ? cpu +1 :0 ); last_cpu = cpu; - irq_desc[irq].affinity =cpumask_of_cpu (cpu); - irq_desc[irq].chip->set_affinity (irq,cpumask_of_cpu (cpu)); + desc->affinity =cpumask_of_cpu (cpu); + desc->chip->set_affinity (irq,cpumask_of_cpu (cpu));return 0 ; }#endif /* CONFIG_SMP */
@@ -80,8 +83,10 @@ show_interrupts(struct seq_file *p, void *v)#endif if (irq <ACTUAL_NR_IRQS ) { -spin_lock_irqsave (&irq_desc[irq].lock, flags); - action = irq_desc[irq].action; +struct irq_desc *desc =irq_desc (irq); + +spin_lock_irqsave (&desc->lock, flags); + action = desc->action;if (!action) goto unlock;seq_printf (p,"%3d: " , irq);
@@ -91,7 +96,7 @@ show_interrupts(struct seq_file *p, void *v)for_each_online_cpu (j)seq_printf (p,"%10u " ,kstat_cpu (j).irqs[irq]);#endif -seq_printf (p," %14s" , irq_desc[irq].chip->typename); +seq_printf (p," %14s" , desc->chip->typename);seq_printf (p," %c%s" , (action->flags &IRQF_DISABLED )?'+' :' ' , action->name);
@@ -104,7 +109,7 @@ show_interrupts(struct seq_file *p, void *v)seq_putc (p,'\n' ); unlock: -spin_unlock_irqrestore (&irq_desc[irq].lock, flags); +spin_unlock_irqrestore (&desc->lock, flags); }else if (irq ==ACTUAL_NR_IRQS ) {#ifdef CONFIG_SMP seq_puts (p,"IPI: " );
arch/alpha/kernel/irq_alpha.c +3 -2
@@ -240,8 +240,9 @@ static struct hw_interrupt_type rtc_irq_type = {void __init init_rtc_irq (void ) { - irq_desc[RTC_IRQ ].status =IRQ_DISABLED ; - irq_desc[RTC_IRQ ].chip = &rtc_irq_type; +struct irq_desc *desc =irq_desc (RTC_IRQ ); + desc->status =IRQ_DISABLED ; + desc->chip = &rtc_irq_type;setup_irq (RTC_IRQ , &timer_irqaction); }
arch/alpha/kernel/irq_i8259.c +5 -3
@@ -79,7 +79,7 @@ i8259a_startup_irq(unsigned int irq)void i8259a_end_irq (unsigned int irq) { -if (!(irq_desc[irq].status & (IRQ_DISABLED |IRQ_INPROGRESS ))) +if (!(irq_desc (irq)->status & (IRQ_DISABLED |IRQ_INPROGRESS )))i8259a_enable_irq (irq); }
@@ -107,8 +107,10 @@ init_i8259a_irqs(void)outb (0xff ,0xA1 );/* mask all of 8259A-2 */ for (i =0 ; i <16 ; i++) { - irq_desc[i].status =IRQ_DISABLED ; - irq_desc[i].chip = &i8259a_irq_type; +struct irq_desc *desc; + desc =irq_desc (i); + desc->status =IRQ_DISABLED ; + desc->chip = &i8259a_irq_type; }setup_irq (2 , &cascade);
arch/alpha/kernel/irq_pyxis.c +6 -3
@@ -50,7 +50,7 @@ pyxis_startup_irq(unsigned int irq)static void pyxis_end_irq (unsigned int irq) { -if (!(irq_desc[irq].status & (IRQ_DISABLED |IRQ_INPROGRESS ))) +if (!(irq_desc (irq)->status & (IRQ_DISABLED |IRQ_INPROGRESS )))pyxis_enable_irq (irq); }
@@ -117,10 +117,13 @@ init_pyxis_irqs(unsigned long ignore_mask) *(vuip )CIA_IACK_SC ;for (i =16 ; i <48 ; ++i) { +struct irq_desc *desc; +if ((ignore_mask >> i) &1 )continue ; - irq_desc[i].status =IRQ_DISABLED |IRQ_LEVEL ; - irq_desc[i].chip = &pyxis_irq_type; + desc =irq_desc (i); + desc->status =IRQ_DISABLED |IRQ_LEVEL ; + desc->chip = &pyxis_irq_type; }setup_irq (16 +7 , &isa_cascade_irqaction);
arch/alpha/kernel/irq_srm.c +6 -3
@@ -43,7 +43,7 @@ srm_startup_irq(unsigned int irq)static void srm_end_irq (unsigned int irq) { -if (!(irq_desc[irq].status & (IRQ_DISABLED |IRQ_INPROGRESS ))) +if (!(irq_desc (irq)->status & (IRQ_DISABLED |IRQ_INPROGRESS )))srm_enable_irq (irq); }
@@ -64,10 +64,13 @@ init_srm_irqs(long max, unsigned long ignore_mask)long i;for (i =16 ; i < max; ++i) { +struct irq_desc *desc; +if (i <64 && ((ignore_mask >> i) &1 ))continue ; - irq_desc[i].status =IRQ_DISABLED |IRQ_LEVEL ; - irq_desc[i].chip = &srm_irq_type; + desc =irq_desc (i); + desc->status =IRQ_DISABLED |IRQ_LEVEL ; + desc->chip = &srm_irq_type; } }
arch/alpha/kernel/sys_alcor.c +6 -3
@@ -85,7 +85,7 @@ alcor_isa_mask_and_ack_irq(unsigned int irq)static void alcor_end_irq (unsigned int irq) { -if (!(irq_desc[irq].status & (IRQ_DISABLED |IRQ_INPROGRESS ))) +if (!(irq_desc (irq)->status & (IRQ_DISABLED |IRQ_INPROGRESS )))alcor_enable_irq (irq); }
@@ -137,13 +137,16 @@ alcor_init_irq(void) *(vuip )GRU_INT_CLEAR =0 ;mb ();/* all clear */ for (i =16 ; i <48 ; ++i) { +struct irq_desc *desc; +/* On Alcor, at least, lines 20..30 are not connected and can generate spurious interrupts if we turn them on while IRQ probing. */ if (i >=16 +20 && i <=16 +30 )continue ; - irq_desc[i].status =IRQ_DISABLED |IRQ_LEVEL ; - irq_desc[i].chip = &alcor_irq_type; + desc =irq_desc (i); + desc->status =IRQ_DISABLED |IRQ_LEVEL ; + desc->chip = &alcor_irq_type; } i8259a_irq_type.ack = alcor_isa_mask_and_ack_irq;
arch/alpha/kernel/sys_cabriolet.c +5 -3
@@ -67,7 +67,7 @@ cabriolet_startup_irq(unsigned int irq)static void cabriolet_end_irq (unsigned int irq) { -if (!(irq_desc[irq].status & (IRQ_DISABLED |IRQ_INPROGRESS ))) +if (!(irq_desc (irq)->status & (IRQ_DISABLED |IRQ_INPROGRESS )))cabriolet_enable_irq (irq); }
@@ -122,8 +122,10 @@ common_init_irq(void (*srm_dev_int)(unsigned long v))outb (0xff ,0x806 );for (i =16 ; i <35 ; ++i) { - irq_desc[i].status =IRQ_DISABLED |IRQ_LEVEL ; - irq_desc[i].chip = &cabriolet_irq_type; +struct irq_desc *desc =irq_desc (i); + + desc->status =IRQ_DISABLED |IRQ_LEVEL ; + desc->chip = &cabriolet_irq_type; } }
arch/alpha/kernel/sys_dp264.c +5 -4
@@ -125,7 +125,7 @@ dp264_startup_irq(unsigned int irq)static void dp264_end_irq (unsigned int irq) { -if (!(irq_desc[irq].status & (IRQ_DISABLED |IRQ_INPROGRESS ))) +if (!(irq_desc (irq)->status & (IRQ_DISABLED |IRQ_INPROGRESS )))dp264_enable_irq (irq); }
@@ -157,7 +157,7 @@ clipper_startup_irq(unsigned int irq)static void clipper_end_irq (unsigned int irq) { -if (!(irq_desc[irq].status & (IRQ_DISABLED |IRQ_INPROGRESS ))) +if (!(irq_desc (irq)->status & (IRQ_DISABLED |IRQ_INPROGRESS )))clipper_enable_irq (irq); }
@@ -298,8 +298,9 @@ init_tsunami_irqs(struct hw_interrupt_type * ops, int imin, int imax) {long i;for (i = imin; i <= imax; ++i) { - irq_desc[i].status =IRQ_DISABLED |IRQ_LEVEL ; - irq_desc[i].chip = ops; +struct irq_desc *desc =irq_desc (i); + desc->status =IRQ_DISABLED |IRQ_LEVEL ; + desc->chip = ops; } }
arch/alpha/kernel/sys_eb64p.c +5 -3
@@ -65,7 +65,7 @@ eb64p_startup_irq(unsigned int irq)static void eb64p_end_irq (unsigned int irq) { -if (!(irq_desc[irq].status & (IRQ_DISABLED |IRQ_INPROGRESS ))) +if (!(irq_desc (irq)->status & (IRQ_DISABLED |IRQ_INPROGRESS )))eb64p_enable_irq (irq); }
@@ -135,8 +135,10 @@ eb64p_init_irq(void)init_i8259a_irqs ();for (i =16 ; i <32 ; ++i) { - irq_desc[i].status =IRQ_DISABLED |IRQ_LEVEL ; - irq_desc[i].chip = &eb64p_irq_type; +struct irq_desc *desc =irq_desc (i); + + desc->status =IRQ_DISABLED |IRQ_LEVEL ; + desc->chip = &eb64p_irq_type; }common_init_isa_dma ();
arch/alpha/kernel/sys_eiger.c +4 -3
@@ -76,7 +76,7 @@ eiger_startup_irq(unsigned int irq)static void eiger_end_irq (unsigned int irq) { -if (!(irq_desc[irq].status & (IRQ_DISABLED |IRQ_INPROGRESS ))) +if (!(irq_desc (irq)->status & (IRQ_DISABLED |IRQ_INPROGRESS )))eiger_enable_irq (irq); }
@@ -153,8 +153,9 @@ eiger_init_irq(void)init_i8259a_irqs ();for (i =16 ; i <128 ; ++i) { - irq_desc[i].status =IRQ_DISABLED |IRQ_LEVEL ; - irq_desc[i].chip = &eiger_irq_type; +struct irq_desc *desc =irq_desc (i); + desc->status =IRQ_DISABLED |IRQ_LEVEL ; + desc->chip = &eiger_irq_type; } }
arch/alpha/kernel/sys_jensen.c +12 -9
@@ -68,13 +68,16 @@ jensen_local_startup(unsigned int irq)/* the parport is really hw IRQ 1, silly Jensen. */ if (irq ==7 )i8259a_startup_irq (1 ); -else +else { +struct irq_desc *desc =irq_desc (irq); +/* * For all true local interrupts, set the flag that prevents * the IPL from being dropped during handler processing. */ -if (irq_desc[irq].action) - irq_desc[irq].action->flags |=IRQF_DISABLED ; +if (desc->action) + desc->action->flags |=IRQF_DISABLED ; + }return 0 ; }
@@ -158,7 +161,7 @@ jensen_device_interrupt(unsigned long vector) }/* If there is no handler yet... */ -if (irq_desc[irq].action ==NULL ) { +if (irq_desc (irq)->action ==NULL ) {/* If it is a local interrupt that cannot be masked... */ if (vector >=0x900 ) {
@@ -206,11 +209,11 @@ jensen_init_irq(void) {init_i8259a_irqs (); - irq_desc[1 ].chip = &jensen_local_irq_type; - irq_desc[4 ].chip = &jensen_local_irq_type; - irq_desc[3 ].chip = &jensen_local_irq_type; - irq_desc[7 ].chip = &jensen_local_irq_type; - irq_desc[9 ].chip = &jensen_local_irq_type; +irq_desc (1 )->chip = &jensen_local_irq_type; +irq_desc (4 )->chip = &jensen_local_irq_type; +irq_desc (3 )->chip = &jensen_local_irq_type; +irq_desc (7 )->chip = &jensen_local_irq_type; +irq_desc (9 )->chip = &jensen_local_irq_type;common_init_isa_dma (); }
arch/alpha/kernel/sys_marvel.c +13 -7
@@ -152,7 +152,7 @@ io7_startup_irq(unsigned int irq)static void io7_end_irq (unsigned int irq) { -if (!(irq_desc[irq].status & (IRQ_DISABLED |IRQ_INPROGRESS ))) +if (!(irq_desc (irq)->status & (IRQ_DISABLED |IRQ_INPROGRESS )))io7_enable_irq (irq); }
@@ -303,8 +303,10 @@ init_io7_irqs(struct io7 *io7,/* Set up the lsi irqs. */ for (i =0 ; i <128 ; ++i) { - irq_desc[base + i].status =IRQ_DISABLED |IRQ_LEVEL ; - irq_desc[base + i].chip = lsi_ops; +struct irq_desc *desc =irq_desc (base + i); + + desc->status =IRQ_DISABLED |IRQ_LEVEL ; + desc->chip = lsi_ops; }/* Disable the implemented irqs in hardware. */
@@ -317,8 +319,10 @@ init_io7_irqs(struct io7 *io7,/* Set up the msi irqs. */ for (i =128 ; i < (128 +512 ); ++i) { - irq_desc[base + i].status =IRQ_DISABLED |IRQ_LEVEL ; - irq_desc[base + i].chip = msi_ops; +struct irq_desc *desc =irq_desc (base + i); + + desc->status =IRQ_DISABLED |IRQ_LEVEL ; + desc->chip = msi_ops; }for (i =0 ; i <16 ; ++i)
@@ -335,8 +339,10 @@ marvel_init_irq(void)/* Reserve the legacy irqs. */ for (i =0 ; i <16 ; ++i) { - irq_desc[i].status =IRQ_DISABLED ; - irq_desc[i].chip = &marvel_legacy_irq_type; +struct irq_desc *desc =irq_desc (i); + + desc->status =IRQ_DISABLED ; + desc->chip = &marvel_legacy_irq_type; }/* Init the io7 irqs. */
arch/alpha/kernel/sys_mikasa.c +5 -3
@@ -64,7 +64,7 @@ mikasa_startup_irq(unsigned int irq)static void mikasa_end_irq (unsigned int irq) { -if (!(irq_desc[irq].status & (IRQ_DISABLED |IRQ_INPROGRESS ))) +if (!(irq_desc (irq)->status & (IRQ_DISABLED |IRQ_INPROGRESS )))mikasa_enable_irq (irq); }
@@ -115,8 +115,10 @@ mikasa_init_irq(void)mikasa_update_irq_hw (0 );for (i =16 ; i <32 ; ++i) { - irq_desc[i].status =IRQ_DISABLED |IRQ_LEVEL ; - irq_desc[i].chip = &mikasa_irq_type; +struct irq_desc *desc =irq_desc (i); + + desc->status =IRQ_DISABLED |IRQ_LEVEL ; + desc->chip = &mikasa_irq_type; }init_i8259a_irqs ();
arch/alpha/kernel/sys_noritake.c +5 -3
@@ -69,7 +69,7 @@ noritake_startup_irq(unsigned int irq)static void noritake_end_irq (unsigned int irq) { -if (!(irq_desc[irq].status & (IRQ_DISABLED |IRQ_INPROGRESS ))) +if (!(irq_desc (irq)->status & (IRQ_DISABLED |IRQ_INPROGRESS )))noritake_enable_irq (irq); }
@@ -144,8 +144,10 @@ noritake_init_irq(void)outw (0 ,0x54c );for (i =16 ; i <48 ; ++i) { - irq_desc[i].status =IRQ_DISABLED |IRQ_LEVEL ; - irq_desc[i].chip = &noritake_irq_type; +struct irq_desc *desc =irq_desc (i); + + desc->status =IRQ_DISABLED |IRQ_LEVEL ; + desc->chip = &noritake_irq_type; }init_i8259a_irqs ();
arch/alpha/kernel/sys_rawhide.c +5 -3
@@ -131,7 +131,7 @@ rawhide_startup_irq(unsigned int irq)static void rawhide_end_irq (unsigned int irq) { -if (!(irq_desc[irq].status & (IRQ_DISABLED |IRQ_INPROGRESS ))) +if (!(irq_desc (irq)->status & (IRQ_DISABLED |IRQ_INPROGRESS )))rawhide_enable_irq (irq); }
@@ -194,8 +194,10 @@ rawhide_init_irq(void) }for (i =16 ; i <128 ; ++i) { - irq_desc[i].status =IRQ_DISABLED |IRQ_LEVEL ; - irq_desc[i].chip = &rawhide_irq_type; +struct irq_desc *desc =irq_desc (i); + + desc->status =IRQ_DISABLED |IRQ_LEVEL ; + desc->chip = &rawhide_irq_type; }init_i8259a_irqs ();
arch/alpha/kernel/sys_rx164.c +5 -3
@@ -68,7 +68,7 @@ rx164_startup_irq(unsigned int irq)static void rx164_end_irq (unsigned int irq) { -if (!(irq_desc[irq].status & (IRQ_DISABLED |IRQ_INPROGRESS ))) +if (!(irq_desc (irq)->status & (IRQ_DISABLED |IRQ_INPROGRESS )))rx164_enable_irq (irq); }
@@ -116,8 +116,10 @@ rx164_init_irq(void)rx164_update_irq_hw (0 );for (i =16 ; i <40 ; ++i) { - irq_desc[i].status =IRQ_DISABLED |IRQ_LEVEL ; - irq_desc[i].chip = &rx164_irq_type; +struct irq_desc *desc =irq_desc (i); + + desc->status =IRQ_DISABLED |IRQ_LEVEL ; + desc->chip = &rx164_irq_type; }init_i8259a_irqs ();
arch/alpha/kernel/sys_sable.c +5 -3
@@ -484,7 +484,7 @@ sable_lynx_startup_irq(unsigned int irq)static void sable_lynx_end_irq (unsigned int irq) { -if (!(irq_desc[irq].status & (IRQ_DISABLED |IRQ_INPROGRESS ))) +if (!(irq_desc (irq)->status & (IRQ_DISABLED |IRQ_INPROGRESS )))sable_lynx_enable_irq (irq); }
@@ -535,8 +535,10 @@ sable_lynx_init_irq(int nr_irqs)long i;for (i =0 ; i < nr_irqs; ++i) { - irq_desc[i].status =IRQ_DISABLED |IRQ_LEVEL ; - irq_desc[i].chip = &sable_lynx_irq_type; +struct irq_desc *desc =irq_desc (i); + + desc->status =IRQ_DISABLED |IRQ_LEVEL ; + desc->hip = &sable_lynx_irq_type; }common_init_isa_dma ();
arch/alpha/kernel/sys_takara.c +5 -3
@@ -70,7 +70,7 @@ takara_startup_irq(unsigned int irq)static void takara_end_irq (unsigned int irq) { -if (!(irq_desc[irq].status & (IRQ_DISABLED |IRQ_INPROGRESS ))) +if (!(irq_desc (irq)->status & (IRQ_DISABLED |IRQ_INPROGRESS )))takara_enable_irq (irq); }
@@ -153,8 +153,10 @@ takara_init_irq(void)takara_update_irq_hw (i,-1 );for (i =16 ; i <128 ; ++i) { - irq_desc[i].status =IRQ_DISABLED |IRQ_LEVEL ; - irq_desc[i].chip = &takara_irq_type; +struct irq_desc *desc =irq_desc (i); + + desc->status =IRQ_DISABLED |IRQ_LEVEL ; + desc->chip = &takara_irq_type; }common_init_isa_dma ();
arch/alpha/kernel/sys_titan.c +5 -3
@@ -139,7 +139,7 @@ titan_startup_irq(unsigned int irq)static void titan_end_irq (unsigned int irq) { -if (!(irq_desc[irq].status & (IRQ_DISABLED |IRQ_INPROGRESS ))) +if (!(irq_desc (irq)->status & (IRQ_DISABLED |IRQ_INPROGRESS )))titan_enable_irq (irq); }
@@ -187,8 +187,10 @@ init_titan_irqs(struct hw_interrupt_type * ops, int imin, int imax) {long i;for (i = imin; i <= imax; ++i) { - irq_desc[i].status =IRQ_DISABLED |IRQ_LEVEL ; - irq_desc[i].chip = ops; +struct irq_desc *desc =irq_desc (i); + + desc->status =IRQ_DISABLED |IRQ_LEVEL ; + desc->chip = ops; } }
arch/alpha/kernel/sys_wildfire.c +11 -8
@@ -150,10 +150,10 @@ static void wildfire_end_irq(unsigned int irq) {#if 0 -if (!irq_desc[irq].action) +if (!irq_desc (irq)->action)printk ("got irq %d\n" , irq);#endif -if (!(irq_desc[irq].status & (IRQ_DISABLED |IRQ_INPROGRESS ))) +if (!(irq_desc (irq)->status & (IRQ_DISABLED |IRQ_INPROGRESS )))wildfire_enable_irq (irq); }
@@ -196,17 +196,20 @@ wildfire_init_irq_per_pca(int qbbno, int pcano)#endif for (i =0 ; i <16 ; ++i) { +struct irq_desc *desc;if (i ==2 )continue ; - irq_desc[i+irq_bias].status =IRQ_DISABLED |IRQ_LEVEL ; - irq_desc[i+irq_bias].chip = &wildfire_irq_type; + desc =irq_desc (i+irq_bias); + desc->status =IRQ_DISABLED |IRQ_LEVEL ; + irq_desc->chip = &wildfire_irq_type; } - irq_desc[36 +irq_bias].status =IRQ_DISABLED |IRQ_LEVEL ; - irq_desc[36 +irq_bias].chip = &wildfire_irq_type; +irq_desc (36 +irq_bias)->status =IRQ_DISABLED |IRQ_LEVEL ; +irq_desc (36 +irq_bias)->chip = &wildfire_irq_type;for (i =40 ; i <64 ; ++i) { - irq_desc[i+irq_bias].status =IRQ_DISABLED |IRQ_LEVEL ; - irq_desc[i+irq_bias].chip = &wildfire_irq_type; +struct irq_desc *desc =irq_desc (i+irq_bias); + desc->status =IRQ_DISABLED |IRQ_LEVEL ; + desc->chip = &wildfire_irq_type; }setup_irq (32 +irq_bias, &isa_enable);
arch/arm/common/gic.c +1 -1
@@ -117,7 +117,7 @@ static void gic_set_cpu(unsigned int irq, cpumask_t mask_val)u32 val;spin_lock (&irq_controller_lock); - irq_desc[irq].cpu = cpu; +irq_desc (irq)->cpu = cpu; val =readl (reg) & ~(0xff << shift); val |=1 << (cpu + shift);writel (val, reg);
arch/arm/kernel/irq.c +7 -5
@@ -68,22 +68,24 @@ int show_interrupts(struct seq_file *p, void *v) }if (i <NR_IRQS ) { -spin_lock_irqsave (&irq_desc[i].lock, flags); - action = irq_desc[i].action; +struct irq_desc *desc =irq_desc (i); + +spin_lock_irqsave (&desc->lock, flags); + action = desc->action;if (!action) goto unlock;seq_printf (p,"%3d: " , i);for_each_present_cpu (cpu)seq_printf (p,"%10u " ,kstat_cpu (cpu).irqs[i]); -seq_printf (p," %10s" , irq_desc[i].chip->name ? :"-" ); +seq_printf (p," %10s" , desc->chip->name ? :"-" );seq_printf (p," %s" , action->name);for (action = action->next; action; action = action->next)seq_printf (p,", %s" , action->name);seq_putc (p,'\n' ); unlock: -spin_unlock_irqrestore (&irq_desc[i].lock, flags); +spin_unlock_irqrestore (&desc->lock, flags); }else if (i ==NR_IRQS ) {#ifdef CONFIG_ARCH_ACORN show_fiq_list (p, v);
@@ -158,7 +160,7 @@ void __init init_IRQ(void)int irq;for (irq =0 ; irq <NR_IRQS ; irq++) - irq_desc[irq].status |=IRQ_NOREQUEST |IRQ_NOPROBE ; +irq_desc (irq)->status |=IRQ_NOREQUEST |IRQ_NOPROBE ;#ifdef CONFIG_SMP bad_irq_desc.affinity =CPU_MASK_ALL ;
arch/arm/mach-at91/gpio.c +2 -2
@@ -404,7 +404,7 @@ static void gpio_irq_handler(unsigned irq, struct irq_desc *desc) } pin = bank->chipbase; - gpio = &irq_desc[pin]; + gpio =irq_desc (pin);while (isr) {if (isr &1 ) {
@@ -515,7 +515,7 @@ void __init at91_gpio_irq_setup(void)__raw_writel (~0 , this->regbase +PIO_IDR );for (i =0 , pin = this->chipbase; i <32 ; i++, pin++) { -lockdep_set_class (&irq_desc[pin].lock, &gpio_lock_class); +lockdep_set_class (&irq_desc (pin)->lock, &gpio_lock_class);/* * Can use the "simple" and not "edge" handler since it's
arch/arm/mach-davinci/gpio.c +8 -5
@@ -155,10 +155,11 @@ static void gpio_irq_enable(unsigned irq) {struct gpio_controller *__iomem g =get_irq_chip_data (irq);u32 mask =__gpio_mask (irq_to_gpio (irq)); +struct irq_desc *desc =irq_desc (irq); -if (irq_desc[irq].status &IRQ_TYPE_EDGE_FALLING ) +if (desc->status &IRQ_TYPE_EDGE_FALLING )__raw_writel (mask, &g->set_falling); -if (irq_desc[irq].status &IRQ_TYPE_EDGE_RISING ) +if (desc->status &IRQ_TYPE_EDGE_RISING )__raw_writel (mask, &g->set_rising); }
@@ -166,12 +167,14 @@ static int gpio_irq_type(unsigned irq, unsigned trigger) {struct gpio_controller *__iomem g =get_irq_chip_data (irq);u32 mask =__gpio_mask (irq_to_gpio (irq)); +struct irq_desc *desc;if (trigger & ~(IRQ_TYPE_EDGE_FALLING |IRQ_TYPE_EDGE_RISING ))return -EINVAL ; - irq_desc[irq].status &= ~IRQ_TYPE_SENSE_MASK ; - irq_desc[irq].status |= trigger; + desc =irq_desc (irq); + desc->status &= ~IRQ_TYPE_SENSE_MASK ; + desc->status |= trigger;__raw_writel (mask, (trigger &IRQ_TYPE_EDGE_FALLING ) ? &g->set_falling : &g->clr_falling);
@@ -215,7 +218,7 @@ gpio_irq_handler(unsigned irq, struct irq_desc *desc)/* now demux them to the right lowlevel handler */ n = (int )get_irq_data (irq); - gpio = &irq_desc[n]; + gpio =irq_desc (n);while (status) { res =ffs (status); n += res;
arch/arm/mach-ep93xx/core.c +2 -2
@@ -226,7 +226,7 @@ static void ep93xx_gpio_irq_ack(unsigned int irq)int port = line >>3 ;int port_mask =1 << (line &7 ); -if ((irq_desc[irq].status &IRQ_TYPE_SENSE_MASK ) ==IRQ_TYPE_EDGE_BOTH ) { +if ((irq_desc (irq)->status &IRQ_TYPE_SENSE_MASK ) ==IRQ_TYPE_EDGE_BOTH ) { gpio_int_type2[port] ^= port_mask;/* switch edge direction */ ep93xx_gpio_update_int_params (port); }
@@ -240,7 +240,7 @@ static void ep93xx_gpio_irq_mask_ack(unsigned int irq)int port = line >>3 ;int port_mask =1 << (line &7 ); -if ((irq_desc[irq].status &IRQ_TYPE_SENSE_MASK ) ==IRQ_TYPE_EDGE_BOTH ) +if ((irq_desc (irq)->status &IRQ_TYPE_SENSE_MASK ) ==IRQ_TYPE_EDGE_BOTH ) gpio_int_type2[port] ^= port_mask;/* switch edge direction */ gpio_int_unmasked[port] &= ~port_mask;
arch/arm/mach-orion5x/irq.c +4 -4
@@ -47,7 +47,7 @@static void orion5x_gpio_irq_ack (u32 irq) {int pin =irq_to_gpio (irq); -if (irq_desc[irq].status &IRQ_LEVEL ) +if (irq_desc (irq)->status &IRQ_LEVEL )/* * Mask bit for level interrupt */
@@ -62,7 +62,7 @@ static void orion5x_gpio_irq_ack(u32 irq)static void orion5x_gpio_irq_mask (u32 irq) {int pin =irq_to_gpio (irq); -if (irq_desc[irq].status &IRQ_LEVEL ) +if (irq_desc (irq)->status &IRQ_LEVEL )orion5x_clrbits (GPIO_LEVEL_MASK ,1 << pin);else orion5x_clrbits (GPIO_EDGE_MASK ,1 << pin);
@@ -71,7 +71,7 @@ static void orion5x_gpio_irq_mask(u32 irq)static void orion5x_gpio_irq_unmask (u32 irq) {int pin =irq_to_gpio (irq); -if (irq_desc[irq].status &IRQ_LEVEL ) +if (irq_desc (irq)->status &IRQ_LEVEL )orion5x_setbits (GPIO_LEVEL_MASK ,1 << pin);else orion5x_setbits (GPIO_EDGE_MASK ,1 << pin);
@@ -88,7 +88,7 @@ static int orion5x_gpio_set_irq_type(u32 irq, u32 type)return -EINVAL ; } - desc = irq_desc + irq; + desc =irq_desc (irq);switch (type) {case IRQ_TYPE_LEVEL_HIGH :
arch/arm/mach-sa1100/h3600.c +6 -4
@@ -822,15 +822,17 @@ static void __init h3800_init_irq(void)#if 0 for (i =0 ; i <H3800_KPIO_IRQ_COUNT ; i++) {int irq = i +H3800_KPIO_IRQ_START ; - irq_desc[irq].valid =1 ; - irq_desc[irq].probe_ok =1 ; +struct irq_desc *desc =irq_desc (irq); + desc->valid =1 ; + desc->probe_ok =1 ;set_irq_chip (irq, &h3800_kpio_irqchip); }for (i =0 ; i <H3800_GPIO_IRQ_COUNT ; i++) {int irq = i +H3800_GPIO_IRQ_START ; - irq_desc[irq].valid =1 ; - irq_desc[irq].probe_ok =1 ; +struct irq_desc *desc =irq_desc (irq); + desc->valid =1 ; + desc->probe_ok =1 ;set_irq_chip (irq, &h3800_gpio_irqchip); }#endif
arch/arm/plat-mxc/gpio.c +4 -3
@@ -105,13 +105,14 @@ static void mxc_gpio_irq_handler(struct mxc_gpio_port *port, u32 irq_stat) gpio_irq_no = port->virtual_irq_start;for (; irq_stat !=0 ; irq_stat >>=1 , gpio_irq_no++) { +struct irq_desc *desc;if ((irq_stat &1 ) ==0 )continue ; -BUG_ON (!(irq_desc[gpio_irq_no].handle_irq)); - irq_desc[gpio_irq_no].handle_irq (gpio_irq_no, - &irq_desc[gpio_irq_no]); + desc =irq_desc (gpio_irq_no); +BUG_ON (!(desc->handle_irq)); + desc->handle_irq (gpio_irq_no, desc); } }
arch/arm/plat-omap/gpio.c +6 -4
@@ -648,8 +648,10 @@ static int gpio_irq_type(unsigned irq, unsigned type)spin_lock_irqsave (&bank->lock, flags); retval =_set_gpio_triggering (bank,get_gpio_index (gpio), type);if (retval ==0 ) { - irq_desc[irq].status &= ~IRQ_TYPE_SENSE_MASK ; - irq_desc[irq].status |= type; +struct irq_desc *desc =irq_desc (irq); + + desc->status &= ~IRQ_TYPE_SENSE_MASK ; + desc->status |= type; }spin_unlock_irqrestore (&bank->lock, flags);
@@ -1503,7 +1505,7 @@ static int __init _omap_gpio_init(void)for (j = bank->virtual_irq_start; j < bank->virtual_irq_start + gpio_count; j++) { -lockdep_set_class (&irq_desc[j].lock, &gpio_lock_class); +lockdep_set_class (&irq_desc (j)->lock, &gpio_lock_class);set_irq_chip_data (j, bank);if (bank_is_mpuio (bank))set_irq_chip (j, &mpuio_irq_chip);
@@ -1818,7 +1820,7 @@ static int dbg_gpio_show(struct seq_file *s, void *unused)/* FIXME for at least omap2, show pullup/pulldown state */ - irqstat = irq_desc[irq].status; + irqstat =irq_desc (irq)->status;if (is_in && ((bank->suspend_wakeup & mask) || irqstat &IRQ_TYPE_SENSE_MASK )) {char *trigger =NULL ;
arch/arm/plat-orion/irq.c +1 -1
@@ -59,7 +59,7 @@ void __init orion_irq_init(unsigned int irq_start, void __iomem *maskaddr)set_irq_chip (irq, &orion_irq_chip);set_irq_chip_data (irq, maskaddr);set_irq_handler (irq, handle_level_irq); - irq_desc[irq].status |=IRQ_LEVEL ; +irq_desc (irq)->status |=IRQ_LEVEL ;set_irq_flags (irq,IRQF_VALID ); } }
arch/avr32/kernel/irq.c +6 -4
@@ -51,22 +51,24 @@ int show_interrupts(struct seq_file *p, void *v) }if (i <NR_IRQS ) { -spin_lock_irqsave (&irq_desc[i].lock, flags); - action = irq_desc[i].action; +struct irq_desc *desc =irq_desc (i); + +spin_lock_irqsave (&desc->lock, flags); + action = desc->action;if (!action) goto unlock;seq_printf (p,"%3d: " , i);for_each_online_cpu (cpu)seq_printf (p,"%10u " ,kstat_cpu (cpu).irqs[i]); -seq_printf (p," %8s" , irq_desc[i].chip->name ? :"-" ); +seq_printf (p," %8s" , desc->chip->name ? :"-" );seq_printf (p," %s" , action->name);for (action = action->next; action; action = action->next)seq_printf (p,", %s" , action->name);seq_putc (p,'\n' ); unlock: -spin_unlock_irqrestore (&irq_desc[i].lock, flags); +spin_unlock_irqrestore (&desc->lock, flags); }return 0 ;
arch/avr32/mach-at32ap/extint.c +4 -3
@@ -88,7 +88,6 @@ static void eic_unmask_irq(unsigned int irq)static int eic_set_irq_type (unsigned int irq,unsigned int flow_type) {struct eic *eic =get_irq_chip_data (irq); -struct irq_desc *desc;unsigned int i = irq - eic->first_irq;u32 mode, edge, level;int ret =0 ;
@@ -97,8 +96,6 @@ static int eic_set_irq_type(unsigned int irq, unsigned int flow_type)if (flow_type ==IRQ_TYPE_NONE ) flow_type =IRQ_TYPE_LEVEL_LOW ; - desc = &irq_desc[irq]; - mode =eic_readl (eic,MODE ); edge =eic_readl (eic,EDGE ); level =eic_readl (eic,LEVEL );
@@ -126,6 +123,10 @@ static int eic_set_irq_type(unsigned int irq, unsigned int flow_type) }if (ret ==0 ) { +struct irq_desc *desc; + + desc =irq_desc (irq); +eic_writel (eic,MODE , mode);eic_writel (eic,EDGE , edge);eic_writel (eic,LEVEL , level);
arch/avr32/mach-at32ap/pio.c +1 -1
@@ -262,7 +262,7 @@ static void gpio_irq_handler(unsigned irq, struct irq_desc *desc) isr &= ~(1 << i); i += gpio_irq; - d = &irq_desc[i]; + d =irq_desc (i); d->handle_irq (i, d); }while (isr);
arch/blackfin/kernel/irqchip.c +5 -3
@@ -77,8 +77,10 @@ int show_interrupts(struct seq_file *p, void *v)unsigned long flags;if (i <NR_IRQS ) { -spin_lock_irqsave (&irq_desc[i].lock, flags); - action = irq_desc[i].action; +struct irq_desc *desc =irq_desc (i); + +spin_lock_irqsave (&desc->lock, flags); + action = desc->action;if (!action) goto unlock;
@@ -89,7 +91,7 @@ int show_interrupts(struct seq_file *p, void *v)seq_putc (p,'\n' ); unlock: -spin_unlock_irqrestore (&irq_desc[i].lock, flags); +spin_unlock_irqrestore (&desc->lock, flags); }else if (i ==NR_IRQS ) {seq_printf (p,"Err: %10lu\n" , irq_err_count); }
arch/blackfin/kernel/traps.c +5 -3
@@ -985,8 +985,10 @@ void show_regs(struct pt_regs *fp)/* if no interrupts are going off, don't print this out */ if (fp->ipend & ~0x3F ) {for (i =0 ; i < (NR_IRQS -1 ); i++) { -spin_lock_irqsave (&irq_desc[i].lock, flags); - action = irq_desc[i].action; +struct irq_desc *desc =irq_desc (i); + +spin_lock_irqsave (&desc->lock, flags); + action = desc->action;if (!action) goto unlock;
@@ -998,7 +1000,7 @@ void show_regs(struct pt_regs *fp) }printk ("\n" ); unlock: -spin_unlock_irqrestore (&irq_desc[i].lock, flags); +spin_unlock_irqrestore (&desc->lock, flags); } }
arch/blackfin/mach-bf527/boards/cm_bf527.c +1 -1
@@ -989,7 +989,7 @@ static int __init stamp_init(void)spi_register_board_info (bfin_spi_board_info,ARRAY_SIZE (bfin_spi_board_info));#if defined(CONFIG_PATA_PLATFORM ) || defined(CONFIG_PATA_PLATFORM_MODULE ) - irq_desc[PATA_INT ].status |=IRQ_NOAUTOEN ; +irq_desc (PATA_INT )->status |=IRQ_NOAUTOEN ;#endif return 0 ; }
arch/blackfin/mach-bf527/boards/ezkit.c +1 -1
@@ -1024,7 +1024,7 @@ static int __init stamp_init(void)spi_register_board_info (bfin_spi_board_info,ARRAY_SIZE (bfin_spi_board_info));#if defined(CONFIG_PATA_PLATFORM ) || defined(CONFIG_PATA_PLATFORM_MODULE ) - irq_desc[PATA_INT ].status |=IRQ_NOAUTOEN ; +irq_desc (PATA_INT )->status |=IRQ_NOAUTOEN ;#endif return 0 ; }
arch/blackfin/mach-bf533/boards/cm_bf533.c +1 -1
@@ -418,7 +418,7 @@ static int __init cm_bf533_init(void)#endif #if defined(CONFIG_PATA_PLATFORM ) || defined(CONFIG_PATA_PLATFORM_MODULE ) - irq_desc[PATA_INT ].status |=IRQ_NOAUTOEN ; +irq_desc (PATA_INT )->status |=IRQ_NOAUTOEN ;#endif return 0 ; }
arch/blackfin/mach-bf533/boards/ezkit.c +1 -1
@@ -426,7 +426,7 @@ static int __init ezkit_init(void)spi_register_board_info (bfin_spi_board_info,ARRAY_SIZE (bfin_spi_board_info));#if defined(CONFIG_PATA_PLATFORM ) || defined(CONFIG_PATA_PLATFORM_MODULE ) - irq_desc[PATA_INT ].status |=IRQ_NOAUTOEN ; +irq_desc (PATA_INT )->status |=IRQ_NOAUTOEN ;#endif return 0 ; }
arch/blackfin/mach-bf533/boards/stamp.c +1 -1
@@ -627,7 +627,7 @@ static int __init stamp_init(void)spi_register_board_info (bfin_spi_board_info,ARRAY_SIZE (bfin_spi_board_info));#if defined(CONFIG_PATA_PLATFORM ) || defined(CONFIG_PATA_PLATFORM_MODULE ) - irq_desc[PATA_INT ].status |=IRQ_NOAUTOEN ; +irq_desc (PATA_INT )->status |=IRQ_NOAUTOEN ;#endif return 0 ; }
arch/blackfin/mach-bf537/boards/cm_bf537.c +1 -1
@@ -521,7 +521,7 @@ static int __init cm_bf537_init(void)#endif #if defined(CONFIG_PATA_PLATFORM ) || defined(CONFIG_PATA_PLATFORM_MODULE ) - irq_desc[PATA_INT ].status |=IRQ_NOAUTOEN ; +irq_desc (PATA_INT )->status |=IRQ_NOAUTOEN ;#endif return 0 ; }
arch/blackfin/mach-bf537/boards/generic_board.c +1 -1
@@ -733,7 +733,7 @@ static int __init stamp_init(void)#endif #if defined(CONFIG_PATA_PLATFORM ) || defined(CONFIG_PATA_PLATFORM_MODULE ) - irq_desc[PATA_INT ].status |=IRQ_NOAUTOEN ; +irq_desc (PATA_INT )->status |=IRQ_NOAUTOEN ;#endif return 0 ; }
arch/blackfin/mach-bf537/boards/stamp.c +1 -1
@@ -1026,7 +1026,7 @@ static int __init stamp_init(void)spi_register_board_info (bfin_spi_board_info,ARRAY_SIZE (bfin_spi_board_info));#if defined(CONFIG_PATA_PLATFORM ) || defined(CONFIG_PATA_PLATFORM_MODULE ) - irq_desc[PATA_INT ].status |=IRQ_NOAUTOEN ; +irq_desc (PATA_INT )->status |=IRQ_NOAUTOEN ;#endif return 0 ;
arch/blackfin/mach-bf561/boards/cm_bf561.c +1 -1
@@ -411,7 +411,7 @@ static int __init cm_bf561_init(void)#endif #if defined(CONFIG_PATA_PLATFORM ) || defined(CONFIG_PATA_PLATFORM_MODULE ) - irq_desc[PATA_INT ].status |=IRQ_NOAUTOEN ; +irq_desc (PATA_INT )->status |=IRQ_NOAUTOEN ;#endif return 0 ; }
arch/blackfin/mach-bf561/boards/ezkit.c +1 -1
@@ -540,7 +540,7 @@ static int __init ezkit_init(void)spi_register_board_info (bfin_spi_board_info,ARRAY_SIZE (bfin_spi_board_info));#if defined(CONFIG_PATA_PLATFORM ) || defined(CONFIG_PATA_PLATFORM_MODULE ) - irq_desc[PATA_INT ].status |=IRQ_NOAUTOEN ; +irq_desc (PATA_INT )->status |=IRQ_NOAUTOEN ;#endif return 0 ; }
arch/cris/arch-v10/kernel/irq.c +1 -1
@@ -221,7 +221,7 @@ init_IRQ(void)/* Initialize IRQ handler descriptors. */ for (i =2 ; i <NR_IRQS ; i++) { - irq_desc[i].chip = &crisv10_irq_type; +irq_desc (i)->chip = &crisv10_irq_type;set_int_vector (i, interrupt[i]); }
arch/cris/arch-v32/kernel/irq.c +3 -3
@@ -475,15 +475,15 @@ init_IRQ(void)/* Point all IRQ's to bad handlers. */ for (i =FIRST_IRQ , j =0 ; j <NR_IRQS ; i++, j++) { - irq_desc[j].chip = &crisv32_irq_type; +irq_desc (j)->chip = &crisv32_irq_type;set_exception_vector (i, interrupt[j]); }/* Mark Timer and IPI IRQs as CPU local */ irq_allocations[TIMER0_INTR_VECT -FIRST_IRQ ].cpu =CPU_FIXED ; - irq_desc[TIMER0_INTR_VECT ].status |=IRQ_PER_CPU ; +irq_desc (TIMER0_INTR_VECT )->status |=IRQ_PER_CPU ; irq_allocations[IPI_INTR_VECT -FIRST_IRQ ].cpu =CPU_FIXED ; - irq_desc[IPI_INTR_VECT ].status |=IRQ_PER_CPU ; +irq_desc (IPI_INTR_VECT )->status |=IRQ_PER_CPU ;set_exception_vector (0x00 , nmi_interrupt);set_exception_vector (0x30 , multiple_interrupt);
arch/cris/kernel/irq.c +6 -4
@@ -57,8 +57,10 @@ int show_interrupts(struct seq_file *p, void *v) }if (i <NR_IRQS ) { -spin_lock_irqsave (&irq_desc[i].lock, flags); - action = irq_desc[i].action; +struct irq_desc *desc =irq_desc (i); + +spin_lock_irqsave (&desc->lock, flags); + action = desc->action;if (!action) goto skip;seq_printf (p,"%3d: " ,i);
@@ -68,7 +70,7 @@ int show_interrupts(struct seq_file *p, void *v)for_each_online_cpu (j)seq_printf (p,"%10u " ,kstat_cpu (j).irqs[i]);#endif -seq_printf (p," %14s" , irq_desc[i].chip->typename); +seq_printf (p," %14s" , desc->chip->typename);seq_printf (p," %s" , action->name);for (action=action->next; action; action = action->next)
@@ -76,7 +78,7 @@ int show_interrupts(struct seq_file *p, void *v)seq_putc (p,'\n' ); skip: -spin_unlock_irqrestore (&irq_desc[i].lock, flags); +spin_unlock_irqrestore (&desc->lock, flags); }return 0 ; }
arch/frv/kernel/irq.c +6 -4
@@ -69,13 +69,15 @@ int show_interrupts(struct seq_file *p, void *v) }if (i <NR_IRQS ) { -spin_lock_irqsave (&irq_desc[i].lock, flags); - action = irq_desc[i].action; +struct irq_desc *desc =irq_desc (i); + +spin_lock_irqsave (&desc->lock, flags); + action = desc->action;if (action) {seq_printf (p,"%3d: " , i);for_each_present_cpu (cpu)seq_printf (p,"%10u " ,kstat_cpu (cpu).irqs[i]); -seq_printf (p," %10s" , irq_desc[i].chip->name ? :"-" ); +seq_printf (p," %10s" , desc->chip->name ? :"-" );seq_printf (p," %s" , action->name); for (action = action->next; action;
@@ -85,7 +87,7 @@ int show_interrupts(struct seq_file *p, void *v)seq_putc (p,'\n' ); } -spin_unlock_irqrestore (&irq_desc[i].lock, flags); +spin_unlock_irqrestore (&desc->lock, flags); }else if (i ==NR_IRQS ) {seq_printf (p,"Err: %10u\n" ,atomic_read (&irq_err_count)); }
arch/h8300/kernel/irq.c +13 -9
@@ -166,10 +166,12 @@ void __init init_IRQ(void)setup_vector ();for (c =0 ; c <NR_IRQS ; c++) { - irq_desc[c].status =IRQ_DISABLED ; - irq_desc[c].action =NULL ; - irq_desc[c].depth =1 ; - irq_desc[c].chip = &h8300irq_chip; +struct irq_desc *desc =irq_desc (c); + + desc->status =IRQ_DISABLED ; + desc->action =NULL ; + desc->depth =1 ; + desc->chip = &h8300irq_chip; } }
@@ -191,21 +193,23 @@ int show_interrupts(struct seq_file *p, void *v)seq_puts (p," CPU0" );if (i <NR_IRQS ) { -spin_lock_irqsave (&irq_desc[i].lock, flags); - action = irq_desc[i].action; +struct irq_desc *desc =irq_desc (i); + +spin_lock_irqsave (&desc->lock, flags); + action = desc->action;if (!action) goto unlock;seq_printf (p,"%3d: " ,i);seq_printf (p,"%10u " ,kstat_cpu (j).irqs[i]); -seq_printf (p," %14s" , irq_desc[i].chip->name); -seq_printf (p,"-%-8s" , irq_desc[i].name); +seq_printf (p," %14s" , desc->chip->name); +seq_printf (p,"-%-8s" , desc->name);seq_printf (p," %s" , action->name);for (action=action->next; action; action = action->next)seq_printf (p,", %s" , action->name);seq_putc (p,'\n' ); unlock: -spin_unlock_irqrestore (&irq_desc[i].lock, flags); +spin_unlock_irqrestore (&desc->lock, flags); }return 0 ; }
arch/ia64/kernel/iosapic.c +7 -4
@@ -398,7 +398,7 @@ iosapic_end_level_irq (unsigned int irq)int do_unmask_irq =0 ;irq_complete_move (irq); -if (unlikely (irq_desc[irq].status &IRQ_MOVE_PENDING )) { +if (unlikely (irq_desc (irq)->status &IRQ_MOVE_PENDING )) { do_unmask_irq =1 ;mask_irq (irq); }
@@ -765,6 +765,7 @@ iosapic_register_intr (unsigned int gsi,struct iosapic_rte_info *rte;u32 low32;unsigned char dmode; +struct irq_desc *desc;/* * If this GSI has already been registered (i.e., it's a
@@ -792,12 +793,14 @@ iosapic_register_intr (unsigned int gsi, goto unlock_iosapic_lock; } -spin_lock (&irq_desc[irq].lock); + desc =irq_desc (irq); + +spin_lock (&desc->lock); dest =get_target_cpu (gsi, irq); dmode =choose_dmode (); err =register_intr (gsi, irq, dmode, polarity, trigger);if (err <0 ) { -spin_unlock (&irq_desc[irq].lock); +spin_unlock (&desc->lock); irq = err; goto unlock_iosapic_lock; }
@@ -816,7 +819,7 @@ iosapic_register_intr (unsigned int gsi, (polarity ==IOSAPIC_POL_HIGH ?"high" :"low" ), cpu_logical_id(dest), dest, irq_to_vector(irq)); -spin_unlock (&irq_desc[irq].lock); +spin_unlock (&desc->lock); unlock_iosapic_lock:spin_unlock_irqrestore (&iosapic_lock, flags);return irq;
arch/ia64/kernel/irq.c +9 -7
@@ -71,8 +71,10 @@ int show_interrupts(struct seq_file *p, void *v) }if (i <NR_IRQS ) { -spin_lock_irqsave (&irq_desc[i].lock, flags); - action = irq_desc[i].action; +struct irq_desc *desc =irq_desc (i); + +spin_lock_irqsave (&desc->lock, flags); + action = desc->action;if (!action) goto skip;seq_printf (p,"%3d: " ,i);
@@ -83,7 +85,7 @@ int show_interrupts(struct seq_file *p, void *v) seq_printf(p, "%10u ", kstat_cpu(j).irqs[i]); }#endif -seq_printf (p," %14s" , irq_desc[i].chip->name); +seq_printf (p," %14s" , desc->chip->name);seq_printf (p," %s" , action->name);for (action=action->next; action; action = action->next)
@@ -91,7 +93,7 @@ int show_interrupts(struct seq_file *p, void *v)seq_putc (p,'\n' ); skip: -spin_unlock_irqrestore (&irq_desc[i].lock, flags); +spin_unlock_irqrestore (&desc->lock, flags); }else if (i ==NR_IRQS )seq_printf (p,"ERR: %10u\n" ,atomic_read (&irq_err_count));return 0 ;
@@ -107,7 +109,7 @@ void set_irq_affinity_info (unsigned int irq, int hwid, int redir)cpu_set (cpu_logical_id (hwid), mask);if (irq <NR_IRQS ) { - irq_desc[irq].affinity = mask; +irq_desc (irq)->affinity = mask; irq_redir[irq] = (char ) (redir &0xff ); } }
@@ -138,7 +140,7 @@ static void migrate_irqs(void)int irq, new_cpu;for (irq=0 ; irq <NR_IRQS ; irq++) { - desc = irq_desc + irq; + desc =irq_desc (irq);if (desc->status ==IRQ_DISABLED )continue ;
@@ -152,7 +154,7 @@ static void migrate_irqs(void)if (desc->status ==IRQ_PER_CPU )continue ; -cpus_and (mask, irq_desc[irq].affinity, cpu_online_map); +cpus_and (mask, desc->affinity, cpu_online_map);if (any_online_cpu (mask) ==NR_CPUS ) {/* * Save it for phase 2 processing
arch/ia64/kernel/msi_ia64.c +1 -1
@@ -73,7 +73,7 @@ static void ia64_set_msi_irq_affinity(unsigned int irq, cpumask_t cpu_mask) msg.data = data;write_msi_msg (irq, &msg); - irq_desc[irq].affinity = cpumask_of_cpu(cpu); + irq_desc(irq)->affinity = cpumask_of_cpu(cpu); }#endif /* CONFIG_SMP */
arch/ia64/sn/kernel/irq.c +1 -1
@@ -429,7 +429,7 @@ sn_call_force_intr_provider(struct sn_irq_info *sn_irq_info) pci_provider = sn_pci_provider[sn_irq_info->irq_bridge_type];/* Don't force an interrupt if the irq has been disabled */ -if (!(irq_desc[sn_irq_info->irq_irq].status &IRQ_DISABLED ) && +if (!(irq_desc (sn_irq_info->irq_irq)->status &IRQ_DISABLED ) && pci_provider && pci_provider->force_interrupt) (*pci_provider->force_interrupt)(sn_irq_info); }
arch/ia64/sn/kernel/msi_sn.c +1 -1
@@ -204,7 +204,7 @@ static void sn_set_msi_irq_affinity(unsigned int irq, cpumask_t cpu_mask) msg.address_lo = (u32)(bus_addr &0x00000000ffffffff );write_msi_msg (irq, &msg); - irq_desc[irq].affinity = cpu_mask; + irq_desc(irq)->affinity = cpu_mask; }#endif /* CONFIG_SMP */
arch/m32r/kernel/irq.c +6 -4
@@ -43,8 +43,10 @@ int show_interrupts(struct seq_file *p, void *v) }if (i <NR_IRQS ) { -spin_lock_irqsave (&irq_desc[i].lock, flags); - action = irq_desc[i].action; +struct irq_desc *desc =irq_desc (i); + +spin_lock_irqsave (&desc->lock, flags); + action = desc->action;if (!action) goto skip;seq_printf (p,"%3d: " ,i);
@@ -54,7 +56,7 @@ int show_interrupts(struct seq_file *p, void *v)for_each_online_cpu (j)seq_printf (p,"%10u " ,kstat_cpu (j).irqs[i]);#endif -seq_printf (p," %14s" , irq_desc[i].chip->typename); +seq_printf (p," %14s" , desc->chip->typename);seq_printf (p," %s" , action->name);for (action=action->next; action; action = action->next)
@@ -62,7 +64,7 @@ int show_interrupts(struct seq_file *p, void *v)seq_putc (p,'\n' ); skip: -spin_unlock_irqrestore (&irq_desc[i].lock, flags); +spin_unlock_irqrestore (&desc->lock, flags); }else if (i ==NR_IRQS ) {seq_printf (p,"ERR: %10u\n" ,atomic_read (&irq_err_count));seq_printf (p,"MIS: %10u\n" ,atomic_read (&irq_mis_count));
arch/m32r/platforms/m32104ut/setup.c +21 -16
@@ -77,6 +77,7 @@ static struct hw_interrupt_type m32104ut_irq_type =void __init init_IRQ (void ) {static int once =0 ; +struct irq_desc *desc;if (once)return ;
@@ -85,36 +86,40 @@ void __init init_IRQ(void)#if defined(CONFIG_SMC91X )/* INT#0: LAN controller on M32104UT-LAN (SMC91C111)*/ - irq_desc[M32R_IRQ_INT0 ].status =IRQ_DISABLED ; - irq_desc[M32R_IRQ_INT0 ].chip = &m32104ut_irq_type; - irq_desc[M32R_IRQ_INT0 ].action =0 ; - irq_desc[M32R_IRQ_INT0 ].depth =1 ; + desc =irq_desc (M32R_IRQ_INT0 ); + desc->status =IRQ_DISABLED ; + desc->chip = &m32104ut_irq_type; + desc->action =0 ; + desc->depth =1 ; icu_data[M32R_IRQ_INT0 ].icucr =M32R_ICUCR_IEN |M32R_ICUCR_ISMOD11 ;/* "H" level sense */ disable_m32104ut_irq (M32R_IRQ_INT0 );#endif /* CONFIG_SMC91X */ /* MFT2 : system timer */ - irq_desc[M32R_IRQ_MFT2 ].status =IRQ_DISABLED ; - irq_desc[M32R_IRQ_MFT2 ].chip = &m32104ut_irq_type; - irq_desc[M32R_IRQ_MFT2 ].action =0 ; - irq_desc[M32R_IRQ_MFT2 ].depth =1 ; + desc =irq_desc (M32R_IRQ_MFT2 ); + desc->status =IRQ_DISABLED ; + desc->chip = &m32104ut_irq_type; + desc->action =0 ; + desc->depth =1 ; icu_data[M32R_IRQ_MFT2 ].icucr =M32R_ICUCR_IEN ;disable_m32104ut_irq (M32R_IRQ_MFT2 );#ifdef CONFIG_SERIAL_M32R_SIO /* SIO0_R : uart receive data */ - irq_desc[M32R_IRQ_SIO0_R ].status =IRQ_DISABLED ; - irq_desc[M32R_IRQ_SIO0_R ].chip = &m32104ut_irq_type; - irq_desc[M32R_IRQ_SIO0_R ].action =0 ; - irq_desc[M32R_IRQ_SIO0_R ].depth =1 ; + desc =irq_desc (M32R_IRQ_SIO0_R ); + desc->status =IRQ_DISABLED ; + desc->chip = &m32104ut_irq_type; + desc->action =0 ; + desc->depth =1 ; icu_data[M32R_IRQ_SIO0_R ].icucr =M32R_ICUCR_IEN ;disable_m32104ut_irq (M32R_IRQ_SIO0_R );/* SIO0_S : uart send data */ - irq_desc[M32R_IRQ_SIO0_S ].status =IRQ_DISABLED ; - irq_desc[M32R_IRQ_SIO0_S ].chip = &m32104ut_irq_type; - irq_desc[M32R_IRQ_SIO0_S ].action =0 ; - irq_desc[M32R_IRQ_SIO0_S ].depth =1 ; + desc =irq_desc (M32R_IRQ_SIO0_S ); + desc->status =IRQ_DISABLED ; + desc->chip = &m32104ut_irq_type; + desc->action =0 ; + desc->depth =1 ; icu_data[M32R_IRQ_SIO0_S ].icucr =M32R_ICUCR_IEN ;disable_m32104ut_irq (M32R_IRQ_SIO0_S );#endif /* CONFIG_SERIAL_M32R_SIO */
arch/m32r/platforms/m32700ut/setup.c +74 -59
200 lines not on this page · raw message
arch/m32r/platforms/mappi/setup.c +51 -33
134 lines not on this page · raw message
arch/m32r/platforms/mappi2/setup.c +63 -40
152 lines not on this page · raw message
arch/m32r/platforms/mappi3/setup.c +63 -40
154 lines not on this page · raw message
arch/m32r/platforms/oaks32r/setup.c +38 -24
96 lines not on this page · raw message
arch/m32r/platforms/opsput/setup.c +90 -59
221 lines not on this page · raw message
arch/m32r/platforms/usrv/setup.c +56 -36
144 lines not on this page · raw message
arch/m68knommu/kernel/irq.c +10 -6
@@ -48,10 +48,12 @@ void __init init_IRQ(void)init_vectors ();for (irq =0 ; (irq <NR_IRQS ); irq++) { - irq_desc[irq].status =IRQ_DISABLED ; - irq_desc[irq].action =NULL ; - irq_desc[irq].depth =1 ; - irq_desc[irq].chip = &m_irq_chip; +struct irq_desc *desc =irq_desc (irq); + + desc->status =IRQ_DISABLED ; + desc->action =NULL ; + desc->depth =1 ; + desc->chip = &m_irq_chip; } }
@@ -64,11 +66,13 @@ int show_interrupts(struct seq_file *p, void *v)seq_puts (p," CPU0\n" );if (irq <NR_IRQS ) { - ap = irq_desc[irq].action; +struct irq_desc *desc =irq_desc (irq); + + ap = desc->action;if (ap) {seq_printf (p,"%3d: " , irq);seq_printf (p,"%10u " ,kstat_irqs (irq)); -seq_printf (p,"%14s " , irq_desc[irq].chip->name); +seq_printf (p,"%14s " , desc->chip->name);seq_printf (p,"%s" , ap->name);for (ap = ap->next; ap; ap = ap->next)
arch/mips/au1000/common/irq.c +1 -1
@@ -224,7 +224,7 @@ static inline void mask_and_ack_level_irq(unsigned int irq_nr)static void end_irq (unsigned int irq_nr) { -if (!(irq_desc[irq_nr].status & (IRQ_DISABLED |IRQ_INPROGRESS ))) +if (!(irq_desc (irq_nr)->status & (IRQ_DISABLED |IRQ_INPROGRESS )))local_enable_irq (irq_nr);#if defined(CONFIG_MIPS_PB1000 )
arch/mips/dec/ioasic-irq.c +1 -1
@@ -57,7 +57,7 @@ static inline void ack_ioasic_irq(unsigned int irq)static inline void end_ioasic_irq (unsigned int irq) { -if (!(irq_desc[irq].status & (IRQ_DISABLED |IRQ_INPROGRESS ))) +if (!(irq_desc (irq)->status & (IRQ_DISABLED |IRQ_INPROGRESS )))unmask_ioasic_irq (irq); }
arch/mips/emma2rh/markeins/irq_markeins.c +1 -1
@@ -110,7 +110,7 @@ static void emma2rh_gpio_irq_ack(unsigned int irq)static void emma2rh_gpio_irq_end (unsigned int irq) { -if (!(irq_desc[irq].status & (IRQ_DISABLED |IRQ_INPROGRESS ))) + if (!(irq_desc(irq)status & (IRQ_DISABLED | IRQ_INPROGRESS)))ll_emma2rh_gpio_irq_enable (irq - emma2rh_gpio_irq_base); }
arch/mips/kernel/irq-gic.c +1 -1
@@ -187,7 +187,7 @@ static void gic_set_affinity(unsigned int irq, cpumask_t cpumask)set_bit (irq, pcpu_masks[first_cpu (tmp)].pcpu_mask); } - irq_desc[irq].affinity = cpumask; +irq_desc (irq)->affinity = cpumask;spin_unlock_irqrestore (&gic_lock, flags); }
arch/mips/kernel/irq-msc01.c +1 -1
@@ -79,7 +79,7 @@ static void edge_mask_and_ack_msc_irq(unsigned int irq)*/ static void end_msc_irq (unsigned int irq) { -if (!(irq_desc[irq].status & (IRQ_DISABLED |IRQ_INPROGRESS ))) +if (!(irq_desc (irq)->status & (IRQ_DISABLED |IRQ_INPROGRESS )))unmask_msc_irq (irq); }
arch/mips/kernel/irq.c +6 -4
@@ -94,8 +94,10 @@ int show_interrupts(struct seq_file *p, void *v) }if (i <NR_IRQS ) { -spin_lock_irqsave (&irq_desc[i].lock, flags); - action = irq_desc[i].action; +struct irq_desc *desc =irq_desc (i); + +spin_lock_irqsave (&desc->lock, flags); + action = desc->action;if (!action) goto skip;seq_printf (p,"%3d: " , i);
@@ -105,7 +107,7 @@ int show_interrupts(struct seq_file *p, void *v)for_each_online_cpu (j)seq_printf (p,"%10u " ,kstat_cpu (j).irqs[i]);#endif -seq_printf (p," %14s" , irq_desc[i].chip->name); +seq_printf (p," %14s" , desc->chip->name);seq_printf (p," %s" , action->name);for (action=action->next; action; action = action->next)
@@ -113,7 +115,7 @@ int show_interrupts(struct seq_file *p, void *v)seq_putc (p,'\n' ); skip: -spin_unlock_irqrestore (&irq_desc[i].lock, flags); +spin_unlock_irqrestore (&desc->lock, flags); }else if (i ==NR_IRQS ) {seq_putc (p,'\n' );seq_printf (p,"ERR: %10u\n" ,atomic_read (&irq_err_count));
arch/mips/kernel/smtc.c +1 -1
@@ -663,7 +663,7 @@ void smtc_forward_irq(unsigned int irq)* and efficiency, we just pick the easiest one to find. */ - target =first_cpu (irq_desc[irq].affinity); + target =first_cpu (irq_desc (irq)->affinity);/* * We depend on the platform code to have correctly processed
arch/mips/mti-malta/malta-smtc.c +1 -1
@@ -138,7 +138,7 @@ void plat_set_irq_affinity(unsigned int irq, cpumask_t affinity)if ((cpu_data[cpu].vpe_id !=0 ) || !cpu_online (cpu))cpu_clear (cpu, tmask); } - irq_desc[irq].affinity = tmask; +irq_desc (irq)->affinity = tmask;if (cpus_empty (tmask))/*
arch/mips/sgi-ip32/ip32-irq.c +5 -5
@@ -157,7 +157,7 @@ static void crime_level_mask_and_ack_irq(unsigned int irq)static void crime_level_end_irq (unsigned int irq) { -if (!(irq_desc[irq].status & (IRQ_DISABLED |IRQ_INPROGRESS ))) +if (!(irq_desc (irq).status & (IRQ_DISABLED |IRQ_INPROGRESS )))crime_enable_irq (irq); }
@@ -186,7 +186,7 @@ static void crime_edge_mask_and_ack_irq(unsigned int irq)static void crime_edge_end_irq (unsigned int irq) { -if (!(irq_desc[irq].status & (IRQ_DISABLED |IRQ_INPROGRESS ))) +if (!(irq_desc (irq)->status & (IRQ_DISABLED |IRQ_INPROGRESS )))crime_enable_irq (irq); }
@@ -227,7 +227,7 @@ static void disable_macepci_irq(unsigned int irq)static void end_macepci_irq (unsigned int irq) { -if (!(irq_desc[irq].status & (IRQ_DISABLED |IRQ_INPROGRESS ))) +if (!(irq_desc (irq)->status & (IRQ_DISABLED |IRQ_INPROGRESS )))enable_macepci_irq (irq); }
@@ -340,7 +340,7 @@ static void mask_and_ack_maceisa_irq(unsigned int irq)static void end_maceisa_irq (unsigned irq) { -if (!(irq_desc[irq].status & (IRQ_DISABLED |IRQ_INPROGRESS ))) +if (!(irq_desc (irq)->status & (IRQ_DISABLED |IRQ_INPROGRESS )))enable_maceisa_irq (irq); }
@@ -376,7 +376,7 @@ static void disable_mace_irq(unsigned int irq)static void end_mace_irq (unsigned int irq) { -if (!(irq_desc[irq].status & (IRQ_DISABLED |IRQ_INPROGRESS ))) +if (!(irq_desc (irq)->status & (IRQ_DISABLED |IRQ_INPROGRESS )))enable_mace_irq (irq); }
arch/mips/sibyte/bcm1480/irq.c +1 -1
@@ -249,7 +249,7 @@ static void ack_bcm1480_irq(unsigned int irq)static void end_bcm1480_irq (unsigned int irq) { -if (!(irq_desc[irq].status & (IRQ_DISABLED |IRQ_INPROGRESS ))) { +if (!(irq_desc (irq)->status & (IRQ_DISABLED |IRQ_INPROGRESS ))) {bcm1480_unmask_irq (bcm1480_irq_owner[irq], irq); } }
arch/mips/sibyte/sb1250/irq.c +1 -1
@@ -219,7 +219,7 @@ static void ack_sb1250_irq(unsigned int irq)static void end_sb1250_irq (unsigned int irq) { -if (!(irq_desc[irq].status & (IRQ_DISABLED |IRQ_INPROGRESS ))) { +if (!(irq_desc (irq)->status & (IRQ_DISABLED |IRQ_INPROGRESS ))) {sb1250_unmask_irq (sb1250_irq_owner[irq], irq); } }
arch/mips/sni/a20r.c +1 -1
@@ -181,7 +181,7 @@ static inline void mask_a20r_irq(unsigned int irq)static void end_a20r_irq (unsigned int irq) { -if (!(irq_desc[irq].status & (IRQ_DISABLED |IRQ_INPROGRESS ))) { +if (!(irq_desc (irq)->status & (IRQ_DISABLED |IRQ_INPROGRESS ))) {a20r_ack_hwint ();unmask_a20r_irq (irq); }
arch/mips/sni/pcimt.c +1 -1
@@ -209,7 +209,7 @@ void disable_pcimt_irq(unsigned int irq)static void end_pcimt_irq (unsigned int irq) { -if (!(irq_desc[irq].status & (IRQ_DISABLED |IRQ_INPROGRESS ))) +if (!(irq_desc (irq)->status & (IRQ_DISABLED |IRQ_INPROGRESS )))enable_pcimt_irq (irq); }
arch/mips/sni/pcit.c +1 -1
@@ -171,7 +171,7 @@ void disable_pcit_irq(unsigned int irq)void end_pcit_irq (unsigned int irq) { -if (!(irq_desc[irq].status & (IRQ_DISABLED |IRQ_INPROGRESS ))) +if (!(irq_desc (irq)->status & (IRQ_DISABLED |IRQ_INPROGRESS )))enable_pcit_irq (irq); }
arch/mips/sni/rm200.c +1 -1
@@ -443,7 +443,7 @@ void disable_rm200_irq(unsigned int irq)void end_rm200_irq (unsigned int irq) { -if (!(irq_desc[irq].status & (IRQ_DISABLED |IRQ_INPROGRESS ))) +if (!(irq_desc (irq)->status & (IRQ_DISABLED |IRQ_INPROGRESS )))enable_rm200_irq (irq); }
arch/mn10300/kernel/irq.c +7 -5
@@ -125,7 +125,7 @@ void __init init_IRQ(void)int irq;for (irq =0 ; irq <NR_IRQS ; irq++) -if (irq_desc[irq].chip == &no_irq_type) +if (irq_desc (irq)->chip == &no_irq_type)set_irq_chip_and_handler (irq, &mn10300_cpu_pic, handle_edge_irq);unit_init_IRQ ();
@@ -183,6 +183,7 @@ int show_interrupts(struct seq_file *p, void *v)int i = *(loff_t *) v, j, cpu;struct irqaction *action;unsigned long flags; +struct irq_desc *desc;switch (i) {/* display column title bar naming CPUs */
@@ -196,14 +197,15 @@ int show_interrupts(struct seq_file *p, void *v)/* display information rows, one per active CPU */ case 1 ... NR_IRQS - 1: -spin_lock_irqsave (&irq_desc[i].lock, flags); + desc =irq_desc (i); +spin_lock_irqsave (&desc->lock, flags); - action = irq_desc[i].action; + action = desc->action;if (action) {seq_printf (p,"%3d: " , i);for_each_present_cpu (cpu)seq_printf (p,"%10u " ,kstat_cpu (cpu).irqs[i]); -seq_printf (p," %14s.%u" , irq_desc[i].chip->name, +seq_printf (p," %14s.%u" , desc->chip->name, (GxICR (i) & GxICR_LEVEL) >> GxICR_LEVEL_SHIFT);seq_printf (p," %s" , action->name);
@@ -216,7 +218,7 @@ int show_interrupts(struct seq_file *p, void *v)seq_putc (p,'\n' ); } -spin_unlock_irqrestore (&irq_desc[i].lock, flags); +spin_unlock_irqrestore (&desc->lock, flags);break ;/* polish off with NMI and error counters */
arch/parisc/kernel/irq.c +23 -18
109 lines not on this page · raw message
arch/powerpc/kernel/irq.c +6 -5
@@ -244,18 +244,19 @@ void fixup_irqs(cpumask_t map)for_each_irq (irq) {cpumask_t mask; +struct irq_desc *desc =irq_desc (irq); -if (irq_desc[irq].status &IRQ_PER_CPU ) +if (desc->status &IRQ_PER_CPU )continue ; -cpus_and (mask, irq_desc[irq].affinity, map); +cpus_and (mask, desc->affinity, map);if (any_online_cpu (mask) ==NR_CPUS ) {printk ("Breaking affinity for irq %i\n" , irq); mask = map; } -if (irq_desc[irq].chip->set_affinity) - irq_desc[irq].chip->set_affinity (irq, mask); -else if (irq_desc[irq].action && !(warned++)) +if (desc->chip->set_affinity) + desc->chip->set_affinity (irq, mask); +else if (desc->action && !(warned++))printk ("Cannot set affinity for irq %i\n" , irq); }
arch/powerpc/platforms/powermac/pic.c +1 -1
@@ -153,7 +153,7 @@ static unsigned int pmac_startup_irq(unsigned int virq)int i = src >>5 ;spin_lock_irqsave (&pmac_pic_lock, flags); -if ((irq_desc[virq].status &IRQ_LEVEL ) ==0 ) +if ((irq_desc (virq)->status &IRQ_LEVEL ) ==0 )out_le32 (&pmac_irq_hw[i]->ack, bit);__set_bit (src, ppc_cached_irq_mask);__pmac_set_irq_mask (src,0 );
arch/powerpc/platforms/pseries/xics.c +2 -2
@@ -205,7 +205,7 @@ static int get_irq_server(unsigned int virq, unsigned int strict_check) {int server;/* For the moment only implement delivery to all cpus or one cpu */ -cpumask_t cpumask = irq_desc[virq].affinity; +cpumask_t cpumask =irq_desc (virq)->affinity;cpumask_t tmp =CPU_MASK_NONE ;if (!cpu_isset (default_server, cpu_online_map))
@@ -808,7 +808,7 @@ void xics_migrate_irqs_away(void) virq, cpu);/* Reset affinity to all cpus */ - irq_desc[virq].affinity =CPU_MASK_ALL ; +irq_desc (virq)->affinity =CPU_MASK_ALL ; desc->chip->set_affinity (virq,CPU_MASK_ALL ); unlock:spin_unlock_irqrestore (&desc->lock, flags);
arch/powerpc/sysdev/cpm2_pic.c +3 -2
@@ -117,9 +117,10 @@ static void cpm2_end_irq(unsigned int virq) {int bit, word;unsigned int irq_nr =virq_to_hw (virq); +struct irq_desc *desc =irq_desc (irq_nr); -if (!(irq_desc[irq_nr].status & (IRQ_DISABLED |IRQ_INPROGRESS )) - && irq_desc[irq_nr].action) { +if (!(desc->status & (IRQ_DISABLED |IRQ_INPROGRESS )) + && desc->action) { bit = irq_to_siubit[irq_nr]; word = irq_to_siureg[irq_nr];
arch/powerpc/sysdev/mpic.c +8 -8
@@ -575,7 +575,7 @@ static struct mpic *mpic_find(unsigned int irq, unsigned int *is_ipi)if (irq <NUM_ISA_INTERRUPTS )return NULL ; - mpic = irq_desc[irq].chip_data; + mpic =irq_desc (irq)->chip_data;if (is_ipi) *is_ipi = (src >= mpic->ipi_vecs[0] &&
@@ -599,14 +599,14 @@ static inline u32 mpic_physmask(u32 cpumask)/* Get the mpic structure from the IPI number */ static inline struct mpic *mpic_from_ipi (unsigned int ipi) { -return irq_desc[ipi].chip_data; +return irq_desc (ipi)->chip_data; }#endif /* Get the mpic structure from the irq number */ static inline struct mpic *mpic_from_irq (unsigned int irq) { -return irq_desc[irq].chip_data; +return irq_desc (irq)->chip_data; }/* Send an EOI */
@@ -697,7 +697,7 @@ static void mpic_unmask_ht_irq(unsigned int irq)mpic_unmask_irq (irq); -if (irq_desc[irq].status &IRQ_LEVEL ) +if (irq_desc (irq)->status &IRQ_LEVEL )mpic_ht_end_irq (mpic, src); }
@@ -707,7 +707,7 @@ static unsigned int mpic_startup_ht_irq(unsigned int irq)unsigned int src =mpic_irq_to_hw (irq);mpic_unmask_irq (irq); -mpic_startup_ht_interrupt (mpic, src, irq_desc[irq].status); +mpic_startup_ht_interrupt (mpic, src,irq_desc (irq)->status);return 0 ; }
@@ -717,7 +717,7 @@ static void mpic_shutdown_ht_irq(unsigned int irq)struct mpic *mpic =mpic_from_irq (irq);unsigned int src =mpic_irq_to_hw (irq); -mpic_shutdown_ht_interrupt (mpic, src, irq_desc[irq].status); +mpic_shutdown_ht_interrupt (mpic, src,irq_desc (irq)->status);mpic_mask_irq (irq); }
@@ -734,7 +734,7 @@ static void mpic_end_ht_irq(unsigned int irq)* latched another edge interrupt coming in anyway */ -if (irq_desc[irq].status &IRQ_LEVEL ) +if (irq_desc (irq)->status &IRQ_LEVEL )mpic_ht_end_irq (mpic, src);mpic_eoi (mpic); }
@@ -1368,7 +1368,7 @@ void mpic_setup_this_cpu(void)/* let the mpic know we want intrs. default affinity is 0xffffffff * until changed via /proc. That's how it's done on x86. If we want * it differently, then we should make sure we also change the default -* values of irq_desc[].affinity in irq.c. +* values of irq_desc()->affinity in irq.c. */ if (distribute_irqs) {for (i =0 ; i < mpic->num_sources ; i++)
arch/powerpc/sysdev/qe_lib/qe_ic.c +1 -1
@@ -189,7 +189,7 @@ static inline void qe_ic_write(volatile __be32 __iomem * base, unsigned int regstatic inline struct qe_ic *qe_ic_from_irq (unsigned int virq) { -return irq_desc[virq].chip_data; +return irq_desc (virq)->chip_data; }#define virq_to_hw (virq) ((unsigned int)irq_map[virq].hwirq)
arch/sh/boards/cayman/irq.c +2 -2
@@ -96,7 +96,7 @@ static void ack_cayman_irq(unsigned int irq)static void end_cayman_irq (unsigned int irq) { -if (!(irq_desc[irq].status & (IRQ_DISABLED |IRQ_INPROGRESS ))) +if (!(irq_desc (irq)->status & (IRQ_DISABLED |IRQ_INPROGRESS )))enable_cayman_irq (irq); }
@@ -188,7 +188,7 @@ void init_cayman_irq(void) }for (i=0 ; i<NR_EXT_IRQS ; i++) { - irq_desc[START_EXT_IRQS + i].chip = &cayman_irq_type; +irq_desc (START_EXT_IRQS + i)->chip = &cayman_irq_type; }/* Setup the SMSC interrupt */
arch/sh/boards/dreamcast/irq.c +1 -1
@@ -86,7 +86,7 @@ static void ack_systemasic_irq(unsigned int irq)/* After a IRQ has been ack'd and responded to, it needs to be renabled */ static void end_systemasic_irq (unsigned int irq) { -if (!(irq_desc[irq].status & (IRQ_DISABLED |IRQ_INPROGRESS ))) +if (!(irq_desc (irq)->status & (IRQ_DISABLED |IRQ_INPROGRESS )))enable_systemasic_irq (irq); }
arch/sh/boards/dreamcast/setup.c +1 -1
@@ -47,7 +47,7 @@ static void __init dreamcast_setup(char **cmdline_p)/* Assign all virtual IRQs to the System ASIC int. handler */ for (i =HW_EVENT_IRQ_BASE ; i <HW_EVENT_IRQ_MAX ; i++) - irq_desc[i].chip = &systemasic_int; +irq_desc (i)->chip = &systemasic_int; board_time_init = aica_time_init;
arch/sh/boards/renesas/systemh/irq.c +2 -2
@@ -89,14 +89,14 @@ static void mask_and_ack_systemh(unsigned int irq)static void end_systemh_irq (unsigned int irq) { -if (!(irq_desc[irq].status & (IRQ_DISABLED |IRQ_INPROGRESS ))) +if (!(irq_desc (irq)->status & (IRQ_DISABLED |IRQ_INPROGRESS )))enable_systemh_irq (irq); }void make_systemh_irq (unsigned int irq) {disable_irq_nosync (irq); - irq_desc[irq].chip = &systemh_irq_type; +irq_desc (irq)->chip = &systemh_irq_type;disable_systemh_irq (irq); }
arch/sh/boards/se/7206/irq.c +1 -1
@@ -90,7 +90,7 @@ static void eoi_se7206_irq(unsigned int irq) {unsigned short sts0,sts1; -if (!(irq_desc[irq].status & (IRQ_DISABLED |IRQ_INPROGRESS ))) +if (!(irq_desc (irq)->status & (IRQ_DISABLED |IRQ_INPROGRESS )))enable_se7206_irq (irq);/* FPGA isr clear */ sts0 =ctrl_inw (INTSTS0 );
arch/sh/boards/superh/microdev/irq.c +2 -2
@@ -134,7 +134,7 @@ static void enable_microdev_irq(unsigned int irq)static void __init make_microdev_irq (unsigned int irq) {disable_irq_nosync (irq); - irq_desc[irq].chip = µdev_irq_type; +irq_desc (irq)->chip = µdev_irq_type;disable_microdev_irq (irq); }
@@ -145,7 +145,7 @@ static void mask_and_ack_microdev(unsigned int irq)static void end_microdev_irq (unsigned int irq) { -if (!(irq_desc[irq].status & (IRQ_DISABLED |IRQ_INPROGRESS ))) +if (!(irq_desc (irq)->status & (IRQ_DISABLED |IRQ_INPROGRESS )))enable_microdev_irq (irq); }
arch/sh/cchips/hd6446x/hd64461.c +2 -2
@@ -48,7 +48,7 @@ static void mask_and_ack_hd64461(unsigned int irq)static void end_hd64461_irq (unsigned int irq) { -if (!(irq_desc[irq].status & (IRQ_DISABLED |IRQ_INPROGRESS ))) +if (!(irq_desc (irq)->status & (IRQ_DISABLED |IRQ_INPROGRESS )))enable_hd64461_irq (irq); }
@@ -153,7 +153,7 @@ int __init setup_hd64461(void)/* IRQ 80 -> 95 belongs to HD64461 */ for (i =HD64461_IRQBASE ; i <HD64461_IRQBASE +16 ; i++) { - irq_desc[i].chip = &hd64461_irq_type; +irq_desc (i)->chip = &hd64461_irq_type; }setup_irq (CONFIG_HD64461_IRQ , &irq0);
arch/sh/cchips/hd6446x/hd64465/setup.c +2 -2
@@ -50,7 +50,7 @@ static void mask_and_ack_hd64465(unsigned int irq)static void end_hd64465_irq (unsigned int irq) { -if (!(irq_desc[irq].status & (IRQ_DISABLED |IRQ_INPROGRESS ))) +if (!(irq_desc (irq)->status & (IRQ_DISABLED |IRQ_INPROGRESS )))enable_hd64465_irq (irq); }
@@ -164,7 +164,7 @@ static int __init setup_hd64465(void)outw (0xffff ,HD64465_REG_NIMR );/* mask all interrupts */ for (i =0 ; i <HD64465_IRQ_NUM ; i++) { - irq_desc[HD64465_IRQ_BASE + i].chip = &hd64465_irq_type; +irq_desc (HD64465_IRQ_BASE + i)->chip = &hd64465_irq_type; }setup_irq (CONFIG_HD64465_IRQ , &irq0);
arch/sh/kernel/cpu/irq/imask.c +2 -2
@@ -96,7 +96,7 @@ static void mask_and_ack_imask(unsigned int irq)static void end_imask_irq (unsigned int irq) { -if (!(irq_desc[irq].status & (IRQ_DISABLED |IRQ_INPROGRESS ))) +if (!(irq_desc (irq)->status & (IRQ_DISABLED |IRQ_INPROGRESS )))enable_imask_irq (irq); }
@@ -108,6 +108,6 @@ static void shutdown_imask_irq(unsigned int irq)void make_imask_irq (unsigned int irq) {disable_irq_nosync (irq); - irq_desc[irq].chip = &imask_irq_type; +irq_desc (irq)->chip = &imask_irq_type;enable_irq (irq); }
arch/sh/kernel/cpu/irq/intc-sh5.c +2 -2
@@ -156,7 +156,7 @@ static void end_intc_irq(unsigned int irq)void make_intc_irq (unsigned int irq) {disable_irq_nosync (irq); - irq_desc[irq].chip = &intc_irq_type; +irq_desc (irq)->chip = &intc_irq_type;disable_intc_irq (irq); }
@@ -196,7 +196,7 @@ void __init plat_irq_setup(void)/* Set default: per-line enable/disable, priority driven ack/eoi */ for (i =0 ; i <NR_INTC_IRQS ; i++) - irq_desc[i].chip = &intc_irq_type; +irq_desc (i)->chip = &intc_irq_type;/* Disable all interrupts and set all priorities to 0 to avoid trouble */
arch/sh/kernel/irq.c +7 -5
@@ -45,22 +45,24 @@ int show_interrupts(struct seq_file *p, void *v) }if (i < sh_mv.mv_nr_irqs) { -spin_lock_irqsave (&irq_desc[i].lock, flags); - action = irq_desc[i].action; +struct irq_desc *desc =irq_desc (i); + +spin_lock_irqsave (&desc->lock, flags); + action = desc->action;if (!action) goto unlock;seq_printf (p,"%3d: " ,i);for_each_online_cpu (j)seq_printf (p,"%10u " ,kstat_cpu (j).irqs[i]); -seq_printf (p," %14s" , irq_desc[i].chip->name); -seq_printf (p,"-%-8s" , irq_desc[i].name); +seq_printf (p," %14s" , desc->chip->name); +seq_printf (p,"-%-8s" , desc->name);seq_printf (p," %s" , action->name);for (action=action->next; action; action = action->next)seq_printf (p,", %s" , action->name);seq_putc (p,'\n' ); unlock: -spin_unlock_irqrestore (&irq_desc[i].lock, flags); +spin_unlock_irqrestore (&desc->lock, flags); }else if (i == sh_mv.mv_nr_irqs)seq_printf (p,"Err: %10u\n" ,atomic_read (&irq_err_count));
arch/sparc64/kernel/irq.c +17 -14
@@ -176,8 +176,10 @@ int show_interrupts(struct seq_file *p, void *v) }if (i <NR_IRQS ) { -spin_lock_irqsave (&irq_desc[i].lock, flags); - action = irq_desc[i].action; +struct irq_desc *desc =irq_desc (i); + +spin_lock_irqsave (&desc->lock, flags); + action = desc->action;
Lines of this file are not shown. View the raw message.
arch/x86/kernel/io_apic_32.c +34 -12
46 lines not on this page · raw message
arch/x86/kernel/io_apic_64.c +49 -26
75 lines not on this page · raw message
kernel/irq/handle.c +128 -16
144 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
1.5.4.5
Part of the diff is not shown here. View the raw message.
PATCH 27/42 x86: add irq_cfg in io_apic_64.c
preallocate size is 32, and if is not enough, irq_cfg will more with alloc_bootmem or kzalloc
v2: fix typo about size of init_one_irq_cfg ... should use sizeof(struct irq_cfg)
v3: according to Eric, change get_irq_cfg() to irq_cfg()
--- arch/x86/kernel/io_apic_64.c | 182 ++++++++++++++++++++++++++++++++--------- 1 files changed, 142 insertions(+), 40 deletions(-)
arch/x86/kernel/io_apic_64.c +142 -40
@@ -57,7 +57,11 @@#define __apicdebuginit (type) static type __init +struct irq_cfg ; +struct irq_cfg { +unsigned int irq; +struct irq_cfg *next;cpumask_t domain;cpumask_t old_domain;unsigned move_cleanup_count;
@@ -67,34 +71,112 @@ struct irq_cfg {/* irq_cfg is indexed by the sum of all RTEs in all I/O APICs. */ static struct irq_cfg irq_cfg_legacy[]__initdata = { - [0 ] = { .domain =CPU_MASK_ALL , .vector =IRQ0_VECTOR , }, - [1 ] = { .domain =CPU_MASK_ALL , .vector =IRQ1_VECTOR , }, - [2 ] = { .domain =CPU_MASK_ALL , .vector =IRQ2_VECTOR , }, - [3 ] = { .domain =CPU_MASK_ALL , .vector =IRQ3_VECTOR , }, - [4 ] = { .domain =CPU_MASK_ALL , .vector =IRQ4_VECTOR , }, - [5 ] = { .domain =CPU_MASK_ALL , .vector =IRQ5_VECTOR , }, - [6 ] = { .domain =CPU_MASK_ALL , .vector =IRQ6_VECTOR , }, - [7 ] = { .domain =CPU_MASK_ALL , .vector =IRQ7_VECTOR , }, - [8 ] = { .domain =CPU_MASK_ALL , .vector =IRQ8_VECTOR , }, - [9 ] = { .domain =CPU_MASK_ALL , .vector =IRQ9_VECTOR , }, - [10 ] = { .domain =CPU_MASK_ALL , .vector =IRQ10_VECTOR , }, - [11 ] = { .domain =CPU_MASK_ALL , .vector =IRQ11_VECTOR , }, - [12 ] = { .domain =CPU_MASK_ALL , .vector =IRQ12_VECTOR , }, - [13 ] = { .domain =CPU_MASK_ALL , .vector =IRQ13_VECTOR , }, - [14 ] = { .domain =CPU_MASK_ALL , .vector =IRQ14_VECTOR , }, - [15 ] = { .domain =CPU_MASK_ALL , .vector =IRQ15_VECTOR , }, + [0 ] = { .irq =0 , .domain =CPU_MASK_ALL , .vector =IRQ0_VECTOR , }, + [1 ] = { .irq =1 , .domain =CPU_MASK_ALL , .vector =IRQ1_VECTOR , }, + [2 ] = { .irq =2 , .domain =CPU_MASK_ALL , .vector =IRQ2_VECTOR , }, + [3 ] = { .irq =3 , .domain =CPU_MASK_ALL , .vector =IRQ3_VECTOR , }, + [4 ] = { .irq =4 , .domain =CPU_MASK_ALL , .vector =IRQ4_VECTOR , }, + [5 ] = { .irq =5 , .domain =CPU_MASK_ALL , .vector =IRQ5_VECTOR , }, + [6 ] = { .irq =6 , .domain =CPU_MASK_ALL , .vector =IRQ6_VECTOR , }, + [7 ] = { .irq =7 , .domain =CPU_MASK_ALL , .vector =IRQ7_VECTOR , }, + [8 ] = { .irq =8 , .domain =CPU_MASK_ALL , .vector =IRQ8_VECTOR , }, + [9 ] = { .irq =9 , .domain =CPU_MASK_ALL , .vector =IRQ9_VECTOR , }, + [10 ] = { .irq =10 , .domain =CPU_MASK_ALL , .vector =IRQ10_VECTOR , }, + [11 ] = { .irq =11 , .domain =CPU_MASK_ALL , .vector =IRQ11_VECTOR , }, + [12 ] = { .irq =12 , .domain =CPU_MASK_ALL , .vector =IRQ12_VECTOR , }, + [13 ] = { .irq =13 , .domain =CPU_MASK_ALL , .vector =IRQ13_VECTOR , }, + [14 ] = { .irq =14 , .domain =CPU_MASK_ALL , .vector =IRQ14_VECTOR , }, + [15 ] = { .irq =15 , .domain =CPU_MASK_ALL , .vector =IRQ15_VECTOR , }, }; -static struct irq_cfg *irq_cfg; +static struct irq_cfg irq_cfg_init = { .irq =-1U , }; +/* need to be biger than size of irq_cfg_legacy */ +static int nr_irq_cfg =32 ; + +static int __init parse_nr_irq_cfg (char *arg) +{ +if (arg) { + nr_irq_cfg =simple_strtoul (arg,NULL ,0 ); +if (nr_irq_cfg <32 ) + nr_irq_cfg =32 ; + } +return 0 ; +} + +early_param ("nr_irq_cfg" , parse_nr_irq_cfg); + +static void init_one_irq_cfg (struct irq_cfg *cfg) +{ +memcpy (cfg, &irq_cfg_init,sizeof (struct irq_cfg )); +}static void __init init_work (void *data) {struct dyn_array *da = data; +struct irq_cfg *cfg; +int i; -memcpy (*da->name, irq_cfg_legacy,sizeof (irq_cfg_legacy)); + cfg = *da->name; + +memcpy (cfg, irq_cfg_legacy,sizeof (irq_cfg_legacy)); + + i =sizeof (irq_cfg_legacy)/sizeof (irq_cfg_legacy[0 ]); +for (; i < *da->nr; i++) +init_one_irq_cfg (&cfg[i]); + +for (i =1 ; i < *da->nr; i++) + cfg[i-1 ].next = &cfg[i]; } -DEFINE_DYN_ARRAY (irq_cfg,sizeof (struct irq_cfg ), nr_irqs,PAGE_SIZE , init_work); +static struct irq_cfg *irq_cfgx; +DEFINE_DYN_ARRAY (irq_cfgx,sizeof (struct irq_cfg ), nr_irq_cfg,PAGE_SIZE , init_work); + +static struct irq_cfg *irq_cfg (unsigned int irq) +{ +struct irq_cfg *cfg, *cfg_pri; +int i; +int count =0 ; + +BUG_ON (irq ==-1U ); + + cfg_pri = cfg = &irq_cfgx[0 ]; +while (cfg) { +if (cfg->irq == irq) +return cfg; + +if (cfg->irq ==-1U ) { + cfg->irq = irq; +return cfg; + } + cfg_pri = cfg; + cfg = cfg->next; + count++; + } + +/* +* we run out of pre-allocate ones, allocate more +*/ +printk (KERN_DEBUG "try to get more irq_cfg %d\n" , nr_irq_cfg); + +if (after_bootmem) + cfg =kzalloc (sizeof (struct irq_cfg )*nr_irq_cfg,GFP_ATOMIC ); +else + cfg =__alloc_bootmem_nopanic (sizeof (struct irq_cfg )*nr_irq_cfg,PAGE_SIZE ,0 ); + +if (!cfg) +panic ("please boot with nr_irq_cfg= %d\n" , count *2 ); + +for (i =0 ; i < nr_irq_cfg; i++) +init_one_irq_cfg (&cfg[i]); + +for (i =1 ; i < nr_irq_cfg; i++) + cfg[i-1 ].next = &cfg[i]; + + cfg->irq = irq; + cfg_pri->next = cfg; + +return cfg; +}static int assign_irq_vector (int irq,cpumask_t mask);
@@ -341,7 +423,7 @@ static void __target_IO_APIC_irq(unsigned int irq, unsigned int dest, u8 vector)static void set_ioapic_affinity_irq (unsigned int irq,cpumask_t mask) { -struct irq_cfg *cfg = irq_cfg + irq; +struct irq_cfg *cfg =irq_cfg (irq);unsigned long flags;unsigned int dest;cpumask_t tmp;
@@ -806,7 +888,7 @@ static int __assign_irq_vector(int irq, cpumask_t mask)struct irq_cfg *cfg;BUG_ON ((unsigned )irq >= nr_irqs); - cfg = &irq_cfg[irq]; + cfg =irq_cfg (irq);/* Only try and allocate irqs on cpus that are present */ cpus_and (mask, mask, cpu_online_map);
@@ -880,7 +962,7 @@ static void __clear_irq_vector(int irq)int cpu, vector;BUG_ON ((unsigned )irq >= nr_irqs); - cfg = &irq_cfg[irq]; + cfg =irq_cfg (irq);BUG_ON (!cfg->vector); vector = cfg->vector;
@@ -900,17 +982,23 @@ static void __setup_vector_irq(int cpu)/* Mark the inuse vectors */ for (irq =0 ; irq < nr_irqs; ++irq) { -if (!cpu_isset (cpu, irq_cfg[irq].domain)) +struct irq_cfg *cfg =irq_cfg (irq); + +if (!cpu_isset (cpu, cfg->domain))continue ; - vector = irq_cfg[irq].vector; + vector = cfg->vector;per_cpu (vector_irq, cpu)[vector] = irq; }/* Mark the free vectors */ for (vector =0 ; vector <NR_VECTORS ; ++vector) { +struct irq_cfg *cfg; + irq =per_cpu (vector_irq, cpu)[vector];if (irq <0 )continue ; -if (!cpu_isset (cpu, irq_cfg[irq].domain)) + + cfg =irq_cfg (irq); +if (!cpu_isset (cpu, cfg->domain))per_cpu (vector_irq, cpu)[vector] =-1 ; } }
@@ -1024,7 +1112,7 @@ static int setup_ioapic_entry(int apic, int irq,static void setup_IO_APIC_irq (int apic,int pin,unsigned int irq,int trigger,int polarity) { -struct irq_cfg *cfg = irq_cfg + irq; +struct irq_cfg *cfg =irq_cfg (irq);struct IO_APIC_route_entry entry;cpumask_t mask;
@@ -1550,7 +1638,7 @@ static unsigned int startup_ioapic_irq(unsigned int irq)static int ioapic_retrigger_irq (unsigned int irq) { -struct irq_cfg *cfg = &irq_cfg[irq]; +struct irq_cfg *cfg =irq_cfg (irq);unsigned long flags;spin_lock_irqsave (&vector_lock, flags);
@@ -1597,7 +1685,7 @@ static DECLARE_DELAYED_WORK(ir_migration_work, ir_irq_migration);*/ static void migrate_ioapic_irq (int irq,cpumask_t mask) { -struct irq_cfg *cfg = irq_cfg + irq; +struct irq_cfg *cfg;struct irq_desc *desc;cpumask_t tmp, cleanup_mask;struct irte irte;
@@ -1615,6 +1703,7 @@ static void migrate_ioapic_irq(int irq, cpumask_t mask)if (assign_irq_vector (irq, mask))return ; + cfg =irq_cfg (irq);cpus_and (tmp, cfg->domain, mask); dest =cpu_mask_to_apicid (tmp);
@@ -1732,7 +1821,7 @@ asmlinkage void smp_irq_move_cleanup_interrupt(void)continue ; desc =irq_desc (irq); - cfg = irq_cfg + irq; + cfg =irq_cfg (irq);spin_lock (&desc->lock);if (!cfg->move_cleanup_count) goto unlock;
@@ -1751,7 +1840,7 @@ unlock:static void irq_complete_move (unsigned int irq) { -struct irq_cfg *cfg = irq_cfg + irq; +struct irq_cfg *cfg =irq_cfg (irq);unsigned vector, me;if (likely (!cfg->move_in_progress))
@@ -1888,7 +1977,10 @@ static inline void init_IO_APIC_traps(void)* 0x80, because int 0x80 is hm, kind of importantish. ;) */ for (irq =0 ; irq < nr_irqs ; irq++) { -if (IO_APIC_IRQ (irq) && !irq_cfg[irq].vector) { +struct irq_cfg *cfg; + + cfg =irq_cfg (irq); +if (IO_APIC_IRQ (irq) && !cfg->vector) {/* * Hmm.. We don't have an entry for this, * so default to an old-fashioned 8259
@@ -2025,7 +2117,7 @@ static inline void __init unlock_ExtINT_logic(void)*/ static inline void __init check_timer (void ) { -struct irq_cfg *cfg = irq_cfg +0 ; +struct irq_cfg *cfg =irq_cfg (0 );int apic1, pin1, apic2, pin2;unsigned long flags;int no_pin1 =0 ;
@@ -2303,13 +2395,15 @@ int create_irq(void)int irq;int new;unsigned long flags; +struct irq_cfg *cfg_new; irq = -ENOSPC ;spin_lock_irqsave (&vector_lock, flags);for (new = (nr_irqs -1 ); new >=0 ; new--) {if (platform_legacy_irq (new))continue ; -if (irq_cfg[new].vector !=0 ) + cfg_new =irq_cfg (new); +if (cfg_new->vector !=0 )continue ;if (__assign_irq_vector (new,TARGET_CPUS ) ==0 ) irq = new;
@@ -2343,7 +2437,7 @@ void destroy_irq(unsigned int irq)#ifdef CONFIG_PCI_MSI static int msi_compose_msg (struct pci_dev *pdev,unsigned int irq,struct msi_msg *msg) { -struct irq_cfg *cfg = irq_cfg + irq; +struct irq_cfg *cfg;int err;unsigned dest;cpumask_t tmp;
@@ -2353,6 +2447,7 @@ static int msi_compose_msg(struct pci_dev *pdev, unsigned int irq, struct msi_msif (err)return err; + cfg =irq_cfg (irq);cpus_and (tmp, cfg->domain, tmp); dest =cpu_mask_to_apicid (tmp);
@@ -2410,7 +2505,7 @@ static int msi_compose_msg(struct pci_dev *pdev, unsigned int irq, struct msi_ms#ifdef CONFIG_SMP static void set_msi_irq_affinity (unsigned int irq,cpumask_t mask) { -struct irq_cfg *cfg = irq_cfg + irq; +struct irq_cfg *cfg;struct msi_msg msg;unsigned int dest;cpumask_t tmp;
@@ -2423,6 +2518,7 @@ static void set_msi_irq_affinity(unsigned int irq, cpumask_t mask)if (assign_irq_vector (irq, mask))return ; + cfg =irq_cfg (irq);cpus_and (tmp, cfg->domain, mask); dest =cpu_mask_to_apicid (tmp);
@@ -2445,7 +2541,7 @@ static void set_msi_irq_affinity(unsigned int irq, cpumask_t mask)*/ static void ir_set_msi_irq_affinity (unsigned int irq,cpumask_t mask) { -struct irq_cfg *cfg = irq_cfg + irq; +struct irq_cfg *cfg;unsigned int dest;cpumask_t tmp, cleanup_mask;struct irte irte;
@@ -2461,6 +2557,7 @@ static void ir_set_msi_irq_affinity(unsigned int irq, cpumask_t mask)if (assign_irq_vector (irq, mask))return ; + cfg =irq_cfg (irq);cpus_and (tmp, cfg->domain, mask); dest =cpu_mask_to_apicid (tmp);
@@ -2667,7 +2764,7 @@ void arch_teardown_msi_irq(unsigned int irq)#ifdef CONFIG_SMP static void dmar_msi_set_affinity (unsigned int irq,cpumask_t mask) { -struct irq_cfg *cfg = irq_cfg + irq; +struct irq_cfg *cfg;struct msi_msg msg;unsigned int dest;cpumask_t tmp;
@@ -2680,6 +2777,7 @@ static void dmar_msi_set_affinity(unsigned int irq, cpumask_t mask)if (assign_irq_vector (irq, mask))return ; + cfg =irq_cfg (irq);cpus_and (tmp, cfg->domain, mask); dest =cpu_mask_to_apicid (tmp);
@@ -2746,7 +2844,7 @@ static void target_ht_irq(unsigned int irq, unsigned int dest, u8 vector)static void set_ht_irq_affinity (unsigned int irq,cpumask_t mask) { -struct irq_cfg *cfg = irq_cfg + irq; +struct irq_cfg *cfg;unsigned int dest;cpumask_t tmp;struct irq_desc *desc;
@@ -2758,6 +2856,7 @@ static void set_ht_irq_affinity(unsigned int irq, cpumask_t mask)if (assign_irq_vector (irq, mask))return ; + cfg =irq_cfg (irq);cpus_and (tmp, cfg->domain, mask); dest =cpu_mask_to_apicid (tmp);
@@ -2780,7 +2879,7 @@ static struct irq_chip ht_irq_chip = {int arch_setup_ht_irq (unsigned int irq,struct pci_dev *dev) { -struct irq_cfg *cfg = irq_cfg + irq; +struct irq_cfg *cfg;int err;cpumask_t tmp;
@@ -2790,6 +2889,7 @@ int arch_setup_ht_irq(unsigned int irq, struct pci_dev *dev)struct ht_irq_msg msg;unsigned dest; + cfg =irq_cfg (irq);cpus_and (tmp, cfg->domain, tmp); dest =cpu_mask_to_apicid (tmp);
@@ -2888,6 +2988,7 @@ int acpi_get_override_irq(int bus_irq, int *trigger, int *polarity)void __init setup_ioapic_dest (void ) {int pin, ioapic, irq, irq_entry; +struct irq_cfg *cfg;if (skip_ioapic_setup ==1 )return ;
@@ -2903,7 +3004,8 @@ void __init setup_ioapic_dest(void)* when you have too many devices, because at that time only boot * cpu is online. */ -if (!irq_cfg[irq].vector) + cfg =irq_cfg (irq); +if (!cfg->vector)setup_IO_APIC_irq (ioapic, pin, irq,irq_trigger (irq_entry),irq_polarity (irq_entry));
Signature · 1 line
1.5.4.5
PATCH 28/42 x86: put irq_2_pin pointer into irq_cfg
preallocate 32 irq_2_pin, and use get_one_free_irq_2_pin to get one and link to irq_cfg if needed.
so don't waste one for no irq is enabled.
--- arch/x86/kernel/io_apic_64.c | 162 +++++++++++++++++++++++++++++++----------- 1 files changed, 121 insertions(+), 41 deletions(-)
arch/x86/kernel/io_apic_64.c +120 -40
@@ -58,10 +58,11 @@#define __apicdebuginit (type) static type __initstruct irq_cfg ; - +struct irq_pin_list ;struct irq_cfg {unsigned int irq;struct irq_cfg *next; +struct irq_pin_list *irq_2_pin;cpumask_t domain;cpumask_t old_domain;unsigned move_cleanup_count;
@@ -232,13 +233,66 @@ int pin_map_size;* between pins and IRQs. */ -static struct irq_pin_list { -short apic, pin; -int next; -} *irq_2_pin; +struct irq_pin_list { +int apic, pin; +struct irq_pin_list *next; +}; + +static struct irq_pin_list *irq_2_pin_head; +/* fill one page ? */ +static int nr_irq_2_pin =0x100 ; +static struct irq_pin_list *irq_2_pin_ptr; +static void __init irq_2_pin_init_work (void *data) +{ +struct dyn_array *da = data; +struct irq_pin_list *pin; +int i; + + pin = *da->name; + +for (i =1 ; i < *da->nr; i++) + pin[i-1 ].next = &pin[i]; + + irq_2_pin_ptr = &pin[0 ]; +} +DEFINE_DYN_ARRAY (irq_2_pin_head,sizeof (struct irq_pin_list ), nr_irq_2_pin,PAGE_SIZE , irq_2_pin_init_work); + +static struct irq_pin_list *get_one_free_irq_2_pin (void ) +{ +struct irq_pin_list *pin; +int i; + + pin = irq_2_pin_ptr; + +if (pin) { + irq_2_pin_ptr = pin->next; + pin->next =NULL ; +return pin; + } + +/* +* we run out of pre-allocate ones, allocate more +*/ +printk (KERN_DEBUG "try to get more irq_2_pin %d\n" , nr_irq_2_pin); + +if (after_bootmem) + pin =kzalloc (sizeof (struct irq_pin_list )*nr_irq_2_pin, +GFP_ATOMIC ); +else + pin =__alloc_bootmem_nopanic (sizeof (struct irq_pin_list ) * + nr_irq_2_pin,PAGE_SIZE ,0 ); + +if (!pin) +panic ("can not get more irq_2_pin\n" ); + +for (i =1 ; i < nr_irq_2_pin; i++) + pin[i-1 ].next = &pin[i]; -DEFINE_DYN_ARRAY (irq_2_pin,sizeof (struct irq_pin_list ), pin_map_size,sizeof (struct irq_pin_list ),NULL ); + irq_2_pin_ptr = pin->next; + pin->next =NULL ; +return pin; +}struct io_apic {unsigned int index;
@@ -280,16 +334,17 @@ static bool io_apic_level_ack_pending(unsigned int irq) {struct irq_pin_list *entry;unsigned long flags; +struct irq_cfg *cfg =irq_cfg (irq);spin_lock_irqsave (&ioapic_lock, flags); - entry = irq_2_pin + irq; + entry = cfg->irq_2_pin;for (;;) {unsigned int reg;int pin; - pin = entry->pin; -if (pin ==-1 ) +if (!entry)break ; + pin = entry->pin; reg =io_apic_read (entry->apic,0x10 + pin*2 );/* Is the remote IRR bit set? */ if (reg &IO_APIC_REDIR_REMOTE_IRR ) {
@@ -298,7 +353,7 @@ static bool io_apic_level_ack_pending(unsigned int irq) }if (!entry->next)break ; - entry = irq_2_pin + entry->next; + entry = entry->next; }spin_unlock_irqrestore (&ioapic_lock, flags);
@@ -319,21 +374,24 @@ static inline void io_apic_sync(unsigned int apic) \ { \int pin; \ -struct irq_pin_list *entry = irq_2_pin + irq; \ +struct irq_cfg *cfg; \ +struct irq_pin_list *entry; \ \BUG_ON (irq >= nr_irqs); \ + cfg =irq_cfg (irq); \ + entry = cfg->irq_2_pin; \for (;;) { \unsigned int reg; \ - pin = entry->pin; \ -if (pin ==-1 ) \ +if (!entry) \break ; \ + pin = entry->pin; \ reg =io_apic_read (entry->apic,0x10 +R + pin*2 ); \reg ACTION ; \io_apic_modify (entry->apic, reg); \FINAL ; \if (!entry->next) \break ; \ - entry = irq_2_pin + entry->next; \ + entry = entry->next; \ } \ }
@@ -396,15 +454,20 @@ static void ioapic_mask_entry(int apic, int pin)static void __target_IO_APIC_irq (unsigned int irq,unsigned int dest,u8 vector) {int apic, pin; -struct irq_pin_list *entry = irq_2_pin + irq; +struct irq_cfg *cfg; +struct irq_pin_list *entry;BUG_ON (irq >= nr_irqs); + cfg =irq_cfg (irq); + entry = cfg->irq_2_pin;for (;;) {unsigned int reg; + +if (!entry) +break ; + apic = entry->apic; pin = entry->pin; -if (pin ==-1 ) -break ;/* * With interrupt-remapping, destination information comes * from interrupt-remapping table entry.
@@ -417,7 +480,7 @@ static void __target_IO_APIC_irq(unsigned int irq, unsigned int dest, u8 vector)io_apic_modify (apic, reg);if (!entry->next)break ; - entry = irq_2_pin + entry->next; + entry = entry->next; } }
@@ -460,20 +523,34 @@ static void set_ioapic_affinity_irq(unsigned int irq, cpumask_t mask)int first_free_entry;static void add_pin_to_irq (unsigned int irq,int apic,int pin) { -struct irq_pin_list *entry = irq_2_pin + irq; +struct irq_cfg *cfg; +struct irq_pin_list *entry;BUG_ON (irq >= nr_irqs); -while (entry->next) - entry = irq_2_pin + entry->next; + cfg =irq_cfg (irq); + entry = cfg->irq_2_pin; +if (!entry) { + entry =get_one_free_irq_2_pin (); + cfg->irq_2_pin = entry; + entry->apic = apic; + entry->pin = pin; +printk (KERN_DEBUG " 0 add_pin_to_irq: irq %d --> apic %d pin %d\n" , irq, apic, pin); +return ; + } -if (entry->pin !=-1 ) { - entry->next = first_free_entry; - entry = irq_2_pin + entry->next; -if (++first_free_entry >= pin_map_size) -panic ("io_apic.c: ran out of irq_2_pin entries!" ); +while (entry->next) { +/* not again, please */ +if (entry->apic == apic && entry->pin == pin) +return ; + + entry = entry->next; } + + entry->next =get_one_free_irq_2_pin (); + entry = entry->next; entry->apic = apic; entry->pin = pin; +printk (KERN_DEBUG " x add_pin_to_irq: irq %d --> apic %d pin %d\n" , irq, apic, pin); }/*
@@ -483,17 +560,24 @@ static void __init replace_pin_at_irq(unsigned int irq, int oldapic, int oldpin, int newapic, int newpin) { - struct irq_pin_list *entry = irq_2_pin + irq; + struct irq_cfg *cfg = irq_cfg(irq); +struct irq_pin_list *entry = cfg->irq_2_pin; +int replaced =0 ; -while (1 ) { +while (entry) {if (entry->apic == oldapic && entry->pin == oldpin) { entry->apic = newapic; entry->pin = newpin; - } -if (!entry->next) + replaced =1 ; +/* every one is different, right? */ break ; - entry = irq_2_pin + entry->next; + } + entry = entry->next; } + +/* why? call replace before add? */ +if (!replaced) +add_pin_to_irq (irq, newapic, newpin); }
@@ -1297,15 +1381,16 @@ __apicdebuginit(void) print_IO_APIC(void) }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 ) +struct irq_cfg *cfg =irq_cfg (i); +struct irq_pin_list *entry = cfg->irq_2_pin; +if (!entry)continue ;printk (KERN_DEBUG "IRQ%d " , i);for (;;) {printk ("-> %d:%d" , entry->apic, entry->pin);if (!entry->next)break ; - entry = irq_2_pin + entry->next; + entry = entry->next; }printk ("\n" ); }
@@ -1466,14 +1551,9 @@ void __init enable_IO_APIC(void) {union IO_APIC_reg_01 reg_01;int i8259_apic, i8259_pin; -int i, apic; +int apic;unsigned long flags; -for (i =0 ; i < pin_map_size; i++) { - irq_2_pin[i].pin =-1 ; - irq_2_pin[i].next =0 ; - } -/* * The number of IO-APIC IRQ registers (== #pins): */
Signature · 1 line
1.5.4.5
PATCH 29/42 x86: put timer_rand_state pointer into irq_desc
so could remove timer_rand_state pointer array
--- drivers/char/random.c | 31 ++++++++++++++++++++----------- include/linux/irq.h | 2 ++ 2 files changed, 22 insertions(+), 11 deletions(-)
drivers/char/random.c +20 -11
@@ -559,13 +559,6 @@ struct timer_rand_state {static struct timer_rand_state input_timer_state; -#ifdef CONFIG_HAVE_DYN_ARRAY -static struct timer_rand_state **irq_timer_state; -DEFINE_DYN_ARRAY (irq_timer_state,sizeof (struct timer_rand_state *), nr_irqs,PAGE_SIZE ,NULL ); -#else -static struct timer_rand_state *irq_timer_state[NR_IRQS ]; -#endif -/* * This function adds entropy to the entropy "pool" by using timing * delays. It uses the timer_rand_state structure to make an estimate
@@ -653,11 +646,20 @@ EXPORT_SYMBOL_GPL(add_input_randomness);void add_interrupt_randomness (int irq) { -if (irq >= nr_irqs || irq_timer_state[irq] ==NULL ) +struct timer_rand_state *state; +struct irq_desc *desc; + +if (irq >= nr_irqs) +return ; + + desc =irq_desc (irq); + state = desc->timer_rand_state; + +if (state ==NULL )return ;DEBUG_ENT ("irq event %d\n" , irq); -add_timer_randomness (irq_timer_state[irq],0x100 + irq); +add_timer_randomness (state,0x100 + irq); }#ifdef CONFIG_BLOCK
@@ -916,8 +918,15 @@ module_init(rand_initialize);void rand_initialize_irq (int irq) {struct timer_rand_state *state; +struct irq_desc *desc; + +if (irq >= nr_irqs) +return ; + + desc =irq_desc (irq); + state = desc->timer_rand_state; -if (irq >= nr_irqs || irq_timer_state[irq]) +if (state)return ;/*
@@ -926,7 +935,7 @@ void rand_initialize_irq(int irq)*/ state =kzalloc (sizeof (struct timer_rand_state ),GFP_KERNEL );if (state) - irq_timer_state[irq] = state; + desc->timer_rand_state = state; }#ifdef CONFIG_BLOCK
include/linux/irq.h +2 -0
@@ -129,6 +129,7 @@ struct irq_chip {const char *typename; }; +struct timer_rand_state ;/** * struct irq_desc - interrupt descriptor *
@@ -158,6 +159,7 @@ struct irq_desc {#ifdef CONFIG_HAVE_SPARSE_IRQ struct irq_desc *next;#endif +struct timer_rand_state *timer_rand_state;irq_flow_handler_t handle_irq;struct irq_chip *chip;struct msi_desc *msi_desc;
Signature · 1 line
1.5.4.5
PATCH 30/42 x86: move kstat_irqs from kstat to irq_desc
based Eric's patch ...
together mold it with dyn_array for irq_desc, will allcate kstat_irqs for nr_irq_desc alltogether if needed. -- at that point nr_cpus is known already.
--- arch/alpha/kernel/irq.c | 2 +- arch/alpha/kernel/irq_alpha.c | 2 +- arch/arm/kernel/irq.c | 2 +- arch/arm/mach-ns9xxx/irq.c | 3 +- arch/avr32/kernel/irq.c | 2 +- arch/cris/kernel/irq.c | 2 +- arch/frv/kernel/irq.c | 2 +- arch/h8300/kernel/irq.c | 2 +- arch/ia64/kernel/irq.c | 2 +- arch/ia64/kernel/irq_ia64.c | 8 +- arch/m32r/kernel/irq.c | 2 +- arch/m68k/kernel/ints.c | 6 +- arch/m68k/sun3/sun3ints.c | 8 +- arch/mips/kernel/irq.c | 2 +- arch/mips/sgi-ip22/ip22-int.c | 2 +- arch/mips/sgi-ip22/ip22-time.c | 2 +- arch/mips/sibyte/bcm1480/smp.c | 2 +- arch/mips/sibyte/sb1250/irq.c | 2 +- arch/mips/sibyte/sb1250/smp.c | 2 +- arch/mn10300/kernel/irq.c | 2 +- arch/parisc/kernel/irq.c | 2 +- arch/powerpc/kernel/irq.c | 2 +- arch/powerpc/platforms/cell/interrupt.c | 2 +- arch/s390/kernel/irq.c | 2 +- arch/s390/kernel/s390_ext.c | 2 +- arch/sh/kernel/irq.c | 2 +- arch/sparc/kernel/irq.c | 7 +- arch/sparc/kernel/sun4d_irq.c | 5 +- arch/sparc64/kernel/irq.c | 2 +- arch/sparc64/kernel/time.c | 2 +- arch/um/kernel/irq.c | 2 +- arch/x86/kernel/io_apic_32.c | 2 +- arch/x86/kernel/irq_32.c | 4 +- arch/x86/kernel/irq_64.c | 4 +- arch/x86/kernel/visws_quirks.c | 2 +- arch/xtensa/kernel/irq.c | 2 +- drivers/s390/cio/cio.c | 2 +- fs/proc/proc_misc.c | 2 +- include/linux/irq.h | 7 ++ include/linux/kernel_stat.h | 14 ++--- kernel/irq/chip.c | 15 ++--- kernel/irq/handle.c | 97 ++++++++++++++++++++++--------- kernel/sched.c | 5 +- 43 files changed, 140 insertions(+), 103 deletions(-)
arch/alpha/kernel/irq.c +1 -1
@@ -94,7 +94,7 @@ show_interrupts(struct seq_file *p, void *v)seq_printf (p,"%10u " ,kstat_irqs (irq));#else for_each_online_cpu (j) -seq_printf (p,"%10u " ,kstat_cpu (j).irqs[irq]); +seq_printf (p,"%10u " ,kstat_irqs_cpu (irq, j));#endif seq_printf (p," %14s" , desc->chip->typename); seq_printf(p, " %c%s",
arch/alpha/kernel/irq_alpha.c +1 -1
@@ -64,7 +64,7 @@ do_entInt(unsigned long type, unsigned long vector,smp_percpu_timer_interrupt (regs); cpu =smp_processor_id ();if (cpu != boot_cpuid) { -kstat_cpu (cpu).irqs[RTC_IRQ ]++; +irq_desc (RTC_IRQ )->kstat_irqs[cpu]++; }else {handle_irq (RTC_IRQ ); }
arch/arm/kernel/irq.c +1 -1
@@ -77,7 +77,7 @@ int show_interrupts(struct seq_file *p, void *v)seq_printf (p,"%3d: " , i);for_each_present_cpu (cpu) -seq_printf (p,"%10u " ,kstat_cpu (cpu).irqs[i]); +seq_printf (p,"%10u " ,kstat_irqs_cpu (i, cpu));seq_printf (p," %10s" , desc->chip->name ? :"-" );seq_printf (p," %s" , action->name);for (action = action->next; action; action = action->next)
arch/arm/mach-ns9xxx/irq.c +1 -2
@@ -64,7 +64,6 @@ static struct irq_chip ns9xxx_chip = {#else static void handle_prio_irq (unsigned int irq,struct irq_desc *desc) { -unsigned int cpu =smp_processor_id ();struct irqaction *action;irqreturn_t action_ret;
@@ -73,7 +72,7 @@ static void handle_prio_irq(unsigned int irq, struct irq_desc *desc)BUG_ON (desc->status &IRQ_INPROGRESS ); desc->status &= ~(IRQ_REPLAY |IRQ_WAITING ); -kstat_cpu (cpu).irqs[irq]++; +kstat_irqs_this_cpu (desc)++; action = desc->action;if (unlikely (!action || (desc->status &IRQ_DISABLED )))
arch/avr32/kernel/irq.c +1 -1
@@ -60,7 +60,7 @@ int show_interrupts(struct seq_file *p, void *v)seq_printf (p,"%3d: " , i);for_each_online_cpu (cpu) -seq_printf (p,"%10u " ,kstat_cpu (cpu).irqs[i]); +seq_printf (p,"%10u " ,kstat_irqs_cpu (i, cpu));seq_printf (p," %8s" , desc->chip->name ? :"-" );seq_printf (p," %s" , action->name);for (action = action->next; action; action = action->next)
arch/cris/kernel/irq.c +1 -1
@@ -68,7 +68,7 @@ int show_interrupts(struct seq_file *p, void *v)seq_printf (p,"%10u " ,kstat_irqs (i));#else for_each_online_cpu (j) -seq_printf (p,"%10u " ,kstat_cpu (j).irqs[i]); +seq_printf (p,"%10u " ,kstat_irqs_cpu (i,j));#endif seq_printf (p," %14s" , desc->chip->typename);seq_printf (p," %s" , action->name);
arch/frv/kernel/irq.c +1 -1
@@ -76,7 +76,7 @@ int show_interrupts(struct seq_file *p, void *v)if (action) {seq_printf (p,"%3d: " , i);for_each_present_cpu (cpu) -seq_printf (p,"%10u " ,kstat_cpu (cpu).irqs[i]); +seq_printf (p,"%10u " ,kstat_irqs_cpu (i, cpu));seq_printf (p," %10s" , desc->chip->name ? :"-" );seq_printf (p," %s" , action->name); for (action = action->next;
arch/h8300/kernel/irq.c +1 -1
@@ -200,7 +200,7 @@ int show_interrupts(struct seq_file *p, void *v)if (!action) goto unlock;seq_printf (p,"%3d: " ,i); -seq_printf (p,"%10u " ,kstat_cpu (j).irqs[i]); +seq_printf (p,"%10u " ,kstat_irqs_cpu (i, j));seq_printf (p," %14s" , desc->chip->name);seq_printf (p,"-%-8s" , desc->name);seq_printf (p," %s" , action->name);
arch/ia64/kernel/irq.c +1 -1
@@ -82,7 +82,7 @@ int show_interrupts(struct seq_file *p, void *v)seq_printf (p,"%10u " ,kstat_irqs (i));#else for_each_online_cpu (j) { -seq_printf (p,"%10u " ,kstat_cpu (j).irqs[i]); +seq_printf (p,"%10u " ,kstat_irqs_cpu (i, j)); }#endif seq_printf (p," %14s" , desc->chip->name);
arch/ia64/kernel/irq_ia64.c +4 -4
@@ -495,9 +495,9 @@ ia64_handle_irq (ia64_vector vector, struct pt_regs *regs)while (vector !=IA64_SPURIOUS_INT_VECTOR ) {if (unlikely (IS_LOCAL_TLB_FLUSH (vector))) {smp_local_flush_tlb (); - kstat_this_cpu.irqs[vector]++; +kstat_irqs_this_cpu (irq_desc (vector))++; }else if (unlikely (IS_RESCHEDULE (vector))) - kstat_this_cpu.irqs[vector]++; +kstat_irqs_this_cpu (irq_desc (vector))++;else {int irq =local_vector_to_irq (vector);
@@ -553,9 +553,9 @@ void ia64_process_pending_intr(void)while (vector !=IA64_SPURIOUS_INT_VECTOR ) {if (unlikely (IS_LOCAL_TLB_FLUSH (vector))) {smp_local_flush_tlb (); - kstat_this_cpu.irqs[vector]++; +kstat_irqs_this_cpu (irq_desc (vector))++; }else if (unlikely (IS_RESCHEDULE (vector))) - kstat_this_cpu.irqs[vector]++; +kstat_irqs_this_cpu (irq_desc (vector))++;else {struct pt_regs *old_regs =set_irq_regs (NULL );int irq =local_vector_to_irq (vector);
arch/m32r/kernel/irq.c +1 -1
@@ -54,7 +54,7 @@ int show_interrupts(struct seq_file *p, void *v)seq_printf (p,"%10u " ,kstat_irqs (i));#else for_each_online_cpu (j) -seq_printf (p,"%10u " ,kstat_cpu (j).irqs[i]); +seq_printf (p,"%10u " ,kstat_irqs_cpu (i,j));#endif seq_printf (p," %14s" , desc->chip->typename);seq_printf (p," %s" , action->name);
arch/m68k/kernel/ints.c +3 -3
@@ -389,7 +389,7 @@ EXPORT_SYMBOL(irq_canonicalize); asmlinkage void m68k_handle_int(unsigned int irq) {struct irq_node *node; -kstat_cpu (0 ).irqs[irq]++; +kstat_irqs_this_cpu (irq_desc (irq))++; node = irq_list[irq]; do { node->handler(irq, node->dev_id);
@@ -407,7 +407,7 @@ asmlinkage void __m68k_handle_int(unsigned int irq, struct pt_regs *regs) asmlinkage void handle_badint(struct pt_regs *regs) { -kstat_cpu (0 ).irqs[0 ]++; +kstat_irqs_this_cpu (irq_desc (0 ))++;printk ("unexpected interrupt from %u\n" , regs->vector); }
@@ -421,7 +421,7 @@ int show_interrupts(struct seq_file *p, void *v)if (irq_list[i]) { contr = irq_controller[i]; node = irq_list[i]; -seq_printf (p,"%-8s %3u: %10u %s" , contr->name, i,kstat_cpu (0 ).irqs[i], node->devname); +seq_printf (p,"%-8s %3u: %10u %s" , contr->name, i,kstat_irqs_cpu (i,0 ), node->devname);while ((node = node->next))seq_printf (p,", %s" , node->devname);seq_puts (p,"\n" );
arch/m68k/sun3/sun3ints.c +4 -4
@@ -52,8 +52,8 @@ void sun3_disable_irq(unsigned int irq)static irqreturn_t sun3_int7 (int irq,void *dev_id) { *sun3_intreg |= (1 << irq); -if (!(kstat_cpu (0 ).irqs[irq] %2000 )) -sun3_leds (led_pattern[(kstat_cpu (0 ).irqs[irq] %16000 ) /2000 ]); +if (!(kstat_irqs_cpu (irq,0 ) %2000 )) +sun3_leds (led_pattern[(kstat_irqs_cpu (irq,0 ) %16000 ) /2000 ]);return IRQ_HANDLED ; }
@@ -70,8 +70,8 @@ static irqreturn_t sun3_int5(int irq, void *dev_id)#ifndef CONFIG_SMP update_process_times (user_mode (get_irq_regs ()));#endif -if (!(kstat_cpu (0 ).irqs[irq] %20 )) -sun3_leds (led_pattern[(kstat_cpu (0 ).irqs[irq] %160 ) /20 ]); +if (!(kstat_irqs_cpu (irq,0 ) %20 )) +sun3_leds (led_pattern[(kstat_irqs_cpu (irq,0 ) %160 ) /20 ]);return IRQ_HANDLED ; }
arch/mips/kernel/irq.c +1 -1
@@ -105,7 +105,7 @@ int show_interrupts(struct seq_file *p, void *v)seq_printf (p,"%10u " ,kstat_irqs (i));#else for_each_online_cpu (j) -seq_printf (p,"%10u " ,kstat_cpu (j).irqs[i]); +seq_printf (p,"%10u " ,kstat_irqs_cpu (i, j));#endif seq_printf (p," %14s" , desc->chip->name);seq_printf (p," %s" , action->name);
arch/mips/sgi-ip22/ip22-int.c +1 -1
@@ -164,7 +164,7 @@ static void indy_buserror_irq(void)int irq =SGI_BUSERR_IRQ ;irq_enter (); - kstat_this_cpu.irqs[irq]++; +kstat_irqs_this_cpu (irq_desc (irq))++;ip22_be_interrupt (irq);irq_exit (); }
arch/mips/sgi-ip22/ip22-time.c +1 -1
@@ -186,7 +186,7 @@ void indy_8254timer_irq(void)char c;irq_enter (); - kstat_this_cpu.irqs[irq]++; +kstat_irqs_this_cpu (irq_desc (irq))++;printk (KERN_ALERT "Oops, got 8254 interrupt.\n" );ArcRead (0 , &c,1 , &cnt);ArcEnterInteractiveMode ();
arch/mips/sibyte/bcm1480/smp.c +1 -1
@@ -180,7 +180,7 @@ void bcm1480_mailbox_interrupt(void)int cpu =smp_processor_id ();unsigned int action; - kstat_this_cpu.irqs[K_BCM1480_INT_MBOX_0_0 ]++; +irq_desc (K_BCM1480_INT_MBOX_0_0 ).kstat_irqs[cpu]++;/* Load the mailbox register to figure out what we're supposed to do */ action = (__raw_readq (mailbox_0_regs[cpu]) >>48 ) &0xffff ;
arch/mips/sibyte/sb1250/irq.c +1 -1
@@ -353,7 +353,7 @@ static void sb1250_kgdb_interrupt(void)* host to stop the break, since we would see another * interrupt on the end-of-break too) */ - kstat_this_cpu.irqs[kgdb_irq]++; +kstat_irqs_this_cpu (irq_desc (kgdb_irq))++;mdelay (500 );duart_out (R_DUART_CMD ,V_DUART_MISC_CMD_RESET_BREAK_INT |M_DUART_RX_EN |M_DUART_TX_EN );
arch/mips/sibyte/sb1250/smp.c +1 -1
@@ -168,7 +168,7 @@ void sb1250_mailbox_interrupt(void)int cpu =smp_processor_id ();unsigned int action; - kstat_this_cpu.irqs[K_INT_MBOX_0 ]++; +irq_desc (K_INT_MBOX_0 )->kstat_irqs[cpu]++;/* Load the mailbox register to figure out what we're supposed to do */ action = (____raw_readq (mailbox_regs[cpu]) >>48 ) &0xffff ;
arch/mn10300/kernel/irq.c +1 -1
@@ -204,7 +204,7 @@ int show_interrupts(struct seq_file *p, void *v)if (action) {seq_printf (p,"%3d: " , i);for_each_present_cpu (cpu) -seq_printf (p,"%10u " ,kstat_cpu (cpu).irqs[i]); +seq_printf (p,"%10u " ,kstat_irqs_cpu (i, cpu));seq_printf (p," %14s.%u" , desc->chip->name, (GxICR (i) & GxICR_LEVEL) >> GxICR_LEVEL_SHIFT);
arch/parisc/kernel/irq.c +1 -1
@@ -184,7 +184,7 @@ int show_interrupts(struct seq_file *p, void *v)seq_printf (p,"%3d: " , i);#ifdef CONFIG_SMP for_each_online_cpu (j) -seq_printf (p,"%10u " ,kstat_cpu (j).irqs[i]); +seq_printf (p,"%10u " ,kstat_irqs_cpu (i, j));#else seq_printf (p,"%10u " ,kstat_irqs (i));#endif
arch/powerpc/kernel/irq.c +1 -1
@@ -200,7 +200,7 @@ int show_interrupts(struct seq_file *p, void *v)seq_printf (p,"%3d: " , i);#ifdef CONFIG_SMP for_each_online_cpu (j) -seq_printf (p,"%10u " ,kstat_cpu (j).irqs[i]); +seq_printf (p,"%10u " ,kstat_irqs_cpu (i, j));#else seq_printf (p,"%10u " ,kstat_irqs (i));#endif /* CONFIG_SMP */
arch/powerpc/platforms/cell/interrupt.c +1 -1
@@ -254,7 +254,7 @@ static void handle_iic_irq(unsigned int irq, struct irq_desc *desc) goto out_eoi; } -kstat_cpu (cpu).irqs[irq]++; +kstat_irqs_this_cpu (desc)++;/* Mark the IRQ currently in progress.*/ desc->status |=IRQ_INPROGRESS ;
arch/s390/kernel/irq.c +1 -1
@@ -39,7 +39,7 @@ int show_interrupts(struct seq_file *p, void *v)seq_printf (p,"%10u " ,kstat_irqs (i));#else for_each_online_cpu (j) -seq_printf (p,"%10u " ,kstat_cpu (j).irqs[i]); +seq_printf (p,"%10u " ,kstat_irqs_cpu (i, j));#endif seq_putc (p,'\n' );
arch/s390/kernel/s390_ext.c +1 -1
@@ -124,7 +124,7 @@ void do_extint(struct pt_regs *regs, unsigned short code)if (S390_lowcore.int_clock >= S390_lowcore.clock_comparator)/* Serve timer interrupts first. */ clock_comparator_work (); -kstat_cpu (smp_processor_id ()).irqs[EXTERNAL_INTERRUPT ]++; +kstat_irqs_this_cpu (irq_desc (EXTERNAL_INTERRUPT ))++; index =ext_hash (code);for (p = ext_int_hash[index]; p; p = p->next) {if (likely (p->code == code))
arch/sh/kernel/irq.c +1 -1
@@ -53,7 +53,7 @@ int show_interrupts(struct seq_file *p, void *v) goto unlock;seq_printf (p,"%3d: " ,i);for_each_online_cpu (j) -seq_printf (p,"%10u " ,kstat_cpu (j).irqs[i]); +seq_printf (p,"%10u " ,kstat_irqs_cpu (i, j));seq_printf (p," %14s" , desc->chip->name);seq_printf (p,"-%-8s" , desc->name);seq_printf (p," %s" , action->name);
arch/sparc/kernel/irq.c +3 -4
@@ -187,8 +187,7 @@ int show_interrupts(struct seq_file *p, void *v)seq_printf (p,"%10u " ,kstat_irqs (i));#else for_each_online_cpu (j) { -seq_printf (p,"%10u " , -kstat_cpu (j).irqs[i]); +seq_printf (p,"%10u " ,kstat_irqs_cpu (i, j)); }#endif seq_printf(p, " %c %s",
@@ -337,7 +336,7 @@ void handler_irq(int irq, struct pt_regs * regs)#endif action = sparc_irq[irq].action; sparc_irq[irq].flags |=SPARC_IRQ_INPROGRESS ; -kstat_cpu (cpu).irqs[irq]++; +kstat_irqs_this_cpu (irq_desc (irq))++; do { if (!action || !action->handler) unexpected_irq(irq, NULL, regs);
@@ -488,7 +487,7 @@ void sparc_floppy_irq(int irq, void *dev_id, struct pt_regs *regs) old_regs =set_irq_regs (regs);disable_pil_irq (irq);irq_enter (); -kstat_cpu (cpu).irqs[irq]++; +kstat_irqs_this_cpu (irq_desc (irq))++;floppy_irq_handler (irq, dev_id);irq_exit ();enable_pil_irq (irq);
arch/sparc/kernel/sun4d_irq.c +2 -3
@@ -106,7 +106,7 @@ found_it: seq_printf(p, "%3d: ", i);#else for_each_online_cpu (x)seq_printf (p,"%10u " , -kstat_cpu (cpu_logical_map (x)).irqs[i]); +kstat_irqs_cpu (i,cpu_logical_map (x)));#endif seq_printf(p, "%c %s", (action->flags & IRQF_DISABLED) ? '+' : ' ',
@@ -202,7 +202,6 @@ void sun4d_handler_irq(int irq, struct pt_regs * regs) {struct pt_regs *old_regs;struct irqaction * action; -int cpu =smp_processor_id ();/* SBUS IRQ level (1 - 7) */ int sbusl = pil_to_sbus[irq];
@@ -213,7 +212,7 @@ void sun4d_handler_irq(int irq, struct pt_regs * regs) old_regs =set_irq_regs (regs);irq_enter (); -kstat_cpu (cpu).irqs[irq]++; +kstat_irqs_this_cpu (irq_desc (irq))++;if (!sbusl) { action = *(irq + irq_action);if (!action)
arch/sparc64/kernel/irq.c +1 -1
@@ -187,7 +187,7 @@ int show_interrupts(struct seq_file *p, void *v)seq_printf (p,"%10u " ,kstat_irqs (i));#else for_each_online_cpu (j) -seq_printf (p,"%10u " ,kstat_cpu (j).irqs[i]); +seq_printf (p,"%10u " ,kstat_irqs_cpu (i, j));#endif seq_printf (p," %9s" , desc->chip->typename);seq_printf (p," %s" , action->name);
arch/sparc64/kernel/time.c +1 -1
@@ -942,7 +942,7 @@ void timer_interrupt(int irq, struct pt_regs *regs)irq_enter (); - kstat_this_cpu.irqs[0 ]++; +irq_desc (0 )->kstat_irqs[0 ]++;if (unlikely (!evt->event_handler)) { printk(KERN_WARNING
arch/um/kernel/irq.c +1 -1
@@ -44,7 +44,7 @@ int show_interrupts(struct seq_file *p, void *v)seq_printf (p,"%10u " ,kstat_irqs (i));#else for_each_online_cpu (j) -seq_printf (p,"%10u " ,kstat_cpu (j).irqs[i]); +seq_printf (p,"%10u " ,kstat_irqs_cpu (i, j));#endif seq_printf (p," %14s" , desc->chip->typename);seq_printf (p," %s" , action->name);
arch/x86/kernel/io_apic_32.c +1 -1
@@ -526,7 +526,7 @@ static void do_irq_balance(void)if (package_index == i)IRQ_DELTA (package_index, j) =0 ;/* Determine the total count per processor per IRQ */ - value_now = (unsigned long )kstat_cpu (i).irqs[j]; + value_now = (unsigned long )kstat_irqs_cpu (j,i);/* Determine the activity per processor per IRQ */ delta = value_now -LAST_CPU_IRQ (i, j);
arch/x86/kernel/irq_32.c +2 -2
@@ -280,7 +280,7 @@ int show_interrupts(struct seq_file *p, void *v) any_count =kstat_irqs (i);#else for_each_online_cpu (j) - any_count |=kstat_cpu (j).irqs[i]; + any_count |=kstat_irqs_cpu (i, j);#endif action = desc->action;if (!action && !any_count)
@@ -290,7 +290,7 @@ int show_interrupts(struct seq_file *p, void *v)seq_printf (p,"%10u " ,kstat_irqs (i));#else for_each_online_cpu (j) -seq_printf (p,"%10u " ,kstat_cpu (j).irqs[i]); +seq_printf (p,"%10u " ,kstat_irqs_cpu (i,j));#endif seq_printf (p," %8s" , desc->chip->name);seq_printf (p,"-%-8s" , desc->name);
arch/x86/kernel/irq_64.c +2 -2
@@ -90,7 +90,7 @@ int show_interrupts(struct seq_file *p, void *v) any_count =kstat_irqs (i);#else for_each_online_cpu (j) - any_count |=kstat_cpu (j).irqs[i]; + any_count |=kstat_irqs_cpu (i, j);#endif action = desc->action;if (!action && !any_count)
@@ -100,7 +100,7 @@ int show_interrupts(struct seq_file *p, void *v)seq_printf (p,"%10u " ,kstat_irqs (i));#else for_each_online_cpu (j) -seq_printf (p,"%10u " ,kstat_cpu (j).irqs[i]); +seq_printf (p,"%10u " ,kstat_irqs_cpu (i,j));#endif seq_printf (p," %8s" , desc->chip->name);seq_printf (p,"-%-8s" , desc->name);
arch/x86/kernel/visws_quirks.c +1 -1
@@ -635,7 +635,7 @@ static irqreturn_t piix4_master_intr(int irq, void *dev_id)/* * handle this 'virtual interrupt' as a Cobalt one now. */ -kstat_cpu (smp_processor_id ()).irqs[realirq]++; +kstat_irqs_this_cpu (desc)++;if (likely (desc->action !=NULL ))handle_IRQ_event (realirq, desc->action);
arch/xtensa/kernel/irq.c +1 -1
@@ -101,7 +101,7 @@ int show_interrupts(struct seq_file *p, void *v)seq_printf (p,"%10u " ,kstat_irqs (i));#else for_each_online_cpu (j) -seq_printf (p,"%10u " ,kstat_cpu (j).irqs[i]); +seq_printf (p,"%10u " ,kstat_irqs_cpu (i, j));#endif seq_printf (p," %14s" , desc->chip->typename);seq_printf (p," %s" , action->name);
drivers/s390/cio/cio.c +1 -1
@@ -634,7 +634,7 @@ do_IRQ (struct pt_regs *regs) tpi_info = (struct tpi_info *) __LC_SUBCHANNEL_ID; irb = (struct irb *) __LC_IRB; do { - kstat_cpu(smp_processor_id()).irqs[IO_INTERRUPT]++; + kstat_irqs_this_cpu(irq_desc(IO_INTERRUPT))++; /* * Non I/O-subchannel thin interrupts are processed differently */
fs/proc/proc_misc.c +1 -1
@@ -526,7 +526,7 @@ static int show_stat(struct seq_file *p, void *v) steal =cputime64_add (steal,kstat_cpu (i).cpustat.steal); guest =cputime64_add (guest,kstat_cpu (i).cpustat.guest);for (j =0 ; j < nr_irqs; j++) { -unsigned int temp =kstat_cpu (i).irqs[j]; +unsigned int temp =kstat_irqs_cpu (j, i); sum += temp; per_irq_sum[j] += temp; }
include/linux/irq.h +7 -0
@@ -159,6 +159,11 @@ struct irq_desc {#ifdef CONFIG_HAVE_SPARSE_IRQ struct irq_desc *next;#endif +#ifdef CONFIG_HAVE_DYN_ARRAY +unsigned int *kstat_irqs; +#else +unsigned int kstat_irqs[NR_CPUS ]; +#endif struct timer_rand_state *timer_rand_state;irq_flow_handler_t handle_irq;struct irq_chip *chip;
@@ -192,6 +197,8 @@ extern struct irq_desc *irq_desc(unsigned int irq);/* could be removed if we get rid of all irq_desc reference */ extern struct irq_desc irq_descX[NR_IRQS ];#endif +#define kstat_irqs_this_cpu (DESC ) \ + ((DESC)->kstat_irqs[smp_processor_id()])/* * Migration helpers for obsolete names, they will go away:
include/linux/kernel_stat.h +6 -8
@@ -28,11 +28,6 @@ struct cpu_usage_stat {struct kernel_stat {struct cpu_usage_stat cpustat; -#ifdef CONFIG_HAVE_DYN_ARRAY -unsigned int *irqs; -#else -unsigned int irqs[NR_IRQS ]; -#endif }; DECLARE_PER_CPU(struct kernel_stat, kstat);
@@ -43,15 +38,18 @@ DECLARE_PER_CPU(struct kernel_stat, kstat);extern unsigned long long nr_context_switches (void ); +extern unsigned int kstat_irqs_cpu (unsigned int irq,int cpu); +/* * Number of interrupts per specific IRQ source, since bootup */ -static inline int kstat_irqs (int irq) +static inline unsigned int kstat_irqs (unsigned int irq) { -int cpu, sum =0 ; +unsigned int sum =0 ; +int cpu;for_each_possible_cpu (cpu) - sum +=kstat_cpu (cpu).irqs[irq]; + sum +=kstat_irqs_cpu (irq, cpu);return sum; }
kernel/irq/chip.c +5 -10
@@ -311,14 +311,13 @@ handle_simple_irq(unsigned int irq, struct irq_desc *desc) {struct irqaction *action;irqreturn_t action_ret; -const unsigned int cpu =smp_processor_id ();spin_lock (&desc->lock);if (unlikely (desc->status &IRQ_INPROGRESS )) goto out_unlock; desc->status &= ~(IRQ_REPLAY |IRQ_WAITING ); -kstat_cpu (cpu).irqs[irq]++; +kstat_irqs_this_cpu (desc)++; action = desc->action;if (unlikely (!action || (desc->status &IRQ_DISABLED )))
@@ -350,7 +349,6 @@ out_unlock:void handle_level_irq (unsigned int irq,struct irq_desc *desc) { -unsigned int cpu =smp_processor_id ();struct irqaction *action;irqreturn_t action_ret;
@@ -360,7 +358,7 @@ handle_level_irq(unsigned int irq, struct irq_desc *desc)if (unlikely (desc->status &IRQ_INPROGRESS )) goto out_unlock; desc->status &= ~(IRQ_REPLAY |IRQ_WAITING ); -kstat_cpu (cpu).irqs[irq]++; +kstat_irqs_this_cpu (desc)++;/* * If its disabled or no action available
@@ -398,7 +396,6 @@ out_unlock:void handle_fasteoi_irq (unsigned int irq,struct irq_desc *desc) { -unsigned int cpu =smp_processor_id ();struct irqaction *action;irqreturn_t action_ret;
@@ -408,7 +405,7 @@ handle_fasteoi_irq(unsigned int irq, struct irq_desc *desc) goto out; desc->status &= ~(IRQ_REPLAY |IRQ_WAITING ); -kstat_cpu (cpu).irqs[irq]++; +kstat_irqs_this_cpu (desc)++;/* * If its disabled or no action available
@@ -457,8 +454,6 @@ out:void handle_edge_irq (unsigned int irq,struct irq_desc *desc) { -const unsigned int cpu =smp_processor_id (); -spin_lock (&desc->lock); desc->status &= ~(IRQ_REPLAY |IRQ_WAITING );
@@ -475,7 +470,7 @@ handle_edge_irq(unsigned int irq, struct irq_desc *desc) goto out_unlock; } -kstat_cpu (cpu).irqs[irq]++; +kstat_irqs_this_cpu (desc)++;/* Start handling the irq */ desc->chip->ack (irq);
@@ -530,7 +525,7 @@ handle_percpu_irq(unsigned int irq, struct irq_desc *desc) {irqreturn_t action_ret; - kstat_this_cpu.irqs[irq]++; +kstat_irqs_this_cpu (desc)++;if (desc->chip->ack) desc->chip->ack (irq);
kernel/irq/handle.c +70 -27
167 lines not on this page · raw message
kernel/sched.c +1 -4
@@ -4021,11 +4021,8 @@ static inline void idle_balance(int cpu, struct rq *rq)#endif DEFINE_PER_CPU(struct kernel_stat, kstat); -EXPORT_PER_CPU_SYMBOL (kstat); -#ifdef CONFIG_HAVE_DYN_ARRAY -DEFINE_PER_CPU_DYN_ARRAY_ADDR (per_cpu__kstat_irqs, per_cpu__kstat.irqs,sizeof (unsigned int ), nr_irqs,sizeof (unsigned long ),NULL ); -#endif +EXPORT_PER_CPU_SYMBOL (kstat);/* * Return p->sum_exec_runtime plus any more ns on the sched_clock
Signature · 1 line
1.5.4.5
PATCH 31/42 replace loop with nr_irqs with for_each_irq_desc
so don't all irq_desc at begining to allocate all. and only call that when needed
--- arch/x86/kernel/io_apic_64.c | 6 +++--- arch/x86/kernel/irq_64.c | 5 ++--- arch/x86/kernel/irqinit_64.c | 17 +++++------------ fs/proc/proc_misc.c | 7 +++++-- include/linux/irq.h | 18 ++++++++++++++++++ kernel/irq/handle.c | 27 ++++++++++++++++++++++++--- kernel/irq/internals.h | 4 ++-- kernel/irq/manage.c | 2 +- kernel/irq/proc.c | 10 +++++----- 9 files changed, 65 insertions(+), 31 deletions(-)
arch/x86/kernel/io_apic_64.c +3 -3
@@ -1845,10 +1845,10 @@ unmask:static void ir_irq_migration (struct work_struct *work) { -int irq; +unsigned int irq; +struct irq_desc *desc; -for (irq =0 ; irq < nr_irqs; irq++) { -struct irq_desc *desc =irq_desc (irq); +for_each_irq_desc (irq, desc) {if (desc->status &IRQ_MOVE_PENDING ) {unsigned long flags;
arch/x86/kernel/irq_64.c +2 -3
@@ -224,17 +224,16 @@ void fixup_irqs(cpumask_t map) {unsigned int irq;static int warned; +struct irq_desc *desc; -for (irq =0 ; irq < nr_irqs; irq++) { +for_each_irq_desc (irq, desc) {cpumask_t mask;int break_affinity =0 ;int set_affinity =1 ; -struct irq_desc *desc;if (irq ==2 )continue ; - desc =irq_desc (irq);/* interrupt's are disabled at this point */ spin_lock (&desc->lock);
arch/x86/kernel/irqinit_64.c +5 -12
@@ -142,25 +142,18 @@ static void __init init_ISA_irqs (void)init_bsp_APIC ();init_8259A (0 ); -for (i =0 ; i < nr_irqs; i++) { +for (i =0 ; i <16 ; i++) {struct irq_desc *desc =irq_desc (i); desc->status =IRQ_DISABLED ; desc->action =NULL ; desc->depth =1 ; -if (i <16 ) { -/* -* 16 old-style INTA-cycle interrupts: -*/ -set_irq_chip_and_handler_name (i, &i8259A_chip, +/* +* 16 old-style INTA-cycle interrupts: +*/ +set_irq_chip_and_handler_name (i, &i8259A_chip, handle_level_irq,"XT" ); - }else { -/* -* 'high' PCI IRQs filled in on demand -*/ - desc->chip = &no_irq_chip; - } } }
fs/proc/proc_misc.c +5 -2
@@ -502,6 +502,7 @@ static int show_stat(struct seq_file *p, void *v)u64 sum =0 ;struct timespec boottime;unsigned int *per_irq_sum; +struct irq_desc *desc; per_irq_sum =kzalloc (sizeof (unsigned int )*nr_irqs,GFP_KERNEL );if (!per_irq_sum)
@@ -525,8 +526,10 @@ static int show_stat(struct seq_file *p, void *v) softirq =cputime64_add (softirq,kstat_cpu (i).cpustat.softirq); steal =cputime64_add (steal,kstat_cpu (i).cpustat.steal); guest =cputime64_add (guest,kstat_cpu (i).cpustat.guest); -for (j =0 ; j < nr_irqs; j++) { -unsigned int temp =kstat_irqs_cpu (j, i); +for_each_irq_desc (j, desc) { +unsigned int temp; + + temp =kstat_irqs_cpu (j, i); sum += temp; per_irq_sum[j] += temp; }
include/linux/irq.h +18 -0
@@ -193,10 +193,28 @@ struct irq_desc { }____cacheline_internodealigned_in_smp ;extern struct irq_desc *irq_desc (unsigned int irq); +extern struct irq_desc *irq_desc_without_new (unsigned int irq); + +#ifndef CONFIG_HAVE_SPARSE_IRQ +#ifndef CONFIG_HAVE_DYN_ARRAY /* could be removed if we get rid of all irq_desc reference */ extern struct irq_desc irq_descX[NR_IRQS ]; +#else +extern struct irq_desc *irq_descX; +#endif + +#define for_each_irq_desc (irq, desc) \ + for (irq = 0, desc = irq_descX; irq < nr_irqs; irq++, desc = &irq_descX[irq]) + +#else + +extern struct irq_desc *irq_descX; +#define for_each_irq_desc (irqX, desc) \ + for (desc = irq_descX, irqX = desc->irq; desc && irqX != -1U; desc = desc->next, irqX = desc ? desc->irq: -1U) +#endif +#define kstat_irqs_this_cpu (DESC ) \ ((DESC)->kstat_irqs[smp_processor_id()])
kernel/irq/handle.c +24 -3
@@ -111,7 +111,6 @@ static void init_kstat_irqs(struct irq_desc *desc, int nr_desc, int nr) } } -static void __init init_work (void *data) {struct dyn_array *da = data;
@@ -148,9 +147,27 @@ static int __init parse_nr_irq_desc(char *arg)early_param ("nr_irq_desc" , parse_nr_irq_desc); -static struct irq_desc *irq_descX; +struct irq_desc *irq_descX;DEFINE_DYN_ARRAY (irq_descX,sizeof (struct irq_desc ), nr_irq_desc,PAGE_SIZE , init_work); +struct irq_desc *irq_desc_without_new (unsigned int irq) +{ +struct irq_desc *desc; + +BUG_ON (irq ==-1U ); + + desc = &irq_descX[0 ]; +while (desc) { +if (desc->irq == irq) +return desc; + +if (desc->irq ==-1U ) +return NULL ; + + desc = desc->next; + } +return NULL ; +}struct irq_desc *irq_desc (unsigned int irq) {struct irq_desc *desc, *desc_pri;
@@ -208,7 +225,7 @@ struct irq_desc *irq_desc(unsigned int irq) }#else -static struct irq_desc *irq_descX; +struct irq_desc *irq_descX;DEFINE_DYN_ARRAY (irq_descX,sizeof (struct irq_desc ), nr_irqs,PAGE_SIZE , init_work);#endif
@@ -238,6 +255,10 @@ struct irq_desc *irq_desc(unsigned int irq) return NULL; } +struct irq_desc *irq_desc_without_new (unsigned int irq) +{ +return irq_desc (irq); +}#endif /*
kernel/irq/internals.h +2 -2
@@ -11,11 +11,11 @@ extern void irq_chip_set_defaults(struct irq_chip *chip);extern void compat_irq_chip_set_default_handler (struct irq_desc *desc);#ifdef CONFIG_PROC_FS -extern void register_irq_proc (unsigned int irq); +extern void register_irq_proc (unsigned int irq,struct irq_desc *desc);extern void register_handler_proc (unsigned int irq,struct irqaction *action);extern void unregister_handler_proc (unsigned int irq,struct irqaction *action);#else -static inline void register_irq_proc (unsigned int irq) { } +static inline void register_irq_proc (unsigned int irq,struct irq_desc *desc) { }static inline void register_handler_proc (unsigned int irq,struct irqaction *action) { } static inline void unregister_handler_proc(unsigned int irq,
kernel/irq/manage.c +1 -1
@@ -466,7 +466,7 @@ int setup_irq(unsigned int irq, struct irqaction *new)spin_unlock_irqrestore (&desc->lock, flags); new->irq = irq; -register_irq_proc (irq); +register_irq_proc (irq, desc); new->dir =NULL ;register_handler_proc (irq, new);
kernel/irq/proc.c +5 -5
@@ -163,11 +163,10 @@ void register_handler_proc(unsigned int irq, struct irqaction *action)#define MAX_NAMELEN 10 -void register_irq_proc (unsigned int irq) +void register_irq_proc (unsigned int irq,struct irq_desc *desc) {char name [MAX_NAMELEN ];struct proc_dir_entry *entry; -struct irq_desc *desc =irq_desc (irq);if (!root_irq_dir || (desc->chip == &no_irq_chip) || desc->dir)
@@ -226,7 +225,8 @@ void register_default_affinity_proc(void)void init_irq_proc (void ) { -int i; +unsigned int irq; +struct irq_desc *desc;/* create /proc/irq */ root_irq_dir =proc_mkdir ("irq" ,NULL );
@@ -238,7 +238,7 @@ void init_irq_proc(void)/* * Create entries for all existing IRQs. */ -for (i =0 ; i < nr_irqs; i++) -register_irq_proc (i); +for_each_irq_desc (irq, desc) +register_irq_proc (irq, desc); }
Signature · 1 line
1.5.4.5
PATCH 32/42 replace loop with nr_irqs with for_each_irq_icfg
so don't all irq_cfg at begining to allocate all.
and only call that when needed
--- arch/x86/kernel/io_apic_64.c | 24 ++++++++++++------------ 1 files changed, 12 insertions(+), 12 deletions(-)
arch/x86/kernel/io_apic_64.c +12 -12
@@ -129,6 +129,9 @@ static void __init init_work(void *data) cfg[i-1 ].next = &cfg[i]; } +#define for_each_irq_cfg (cfg) \ + for(cfg = irq_cfgx; cfg && cfg->irq != -1U; cfg = cfg->next) +static struct irq_cfg *irq_cfgx;DEFINE_DYN_ARRAY (irq_cfgx,sizeof (struct irq_cfg ), nr_irq_cfg,PAGE_SIZE , init_work);
@@ -1063,20 +1066,18 @@ static void __setup_vector_irq(int cpu)/* Initialize vector_irq on a new cpu */ /* This function must be called with vector_lock held */ int irq, vector; +struct irq_cfg *cfg;/* Mark the inuse vectors */ -for (irq =0 ; irq < nr_irqs; ++irq) { -struct irq_cfg *cfg =irq_cfg (irq); - +for_each_irq_cfg (cfg) {if (!cpu_isset (cpu, cfg->domain))continue ; vector = cfg->vector; + irq = cfg->irq;per_cpu (vector_irq, cpu)[vector] = irq; }/* Mark the free vectors */ for (vector =0 ; vector <NR_VECTORS ; ++vector) { -struct irq_cfg *cfg; - irq =per_cpu (vector_irq, cpu)[vector];if (irq <0 )continue ;
@@ -1312,6 +1313,7 @@ __apicdebuginit(void) print_IO_APIC(void)union IO_APIC_reg_01 reg_01;union IO_APIC_reg_02 reg_02;unsigned long flags; +struct irq_cfg *cfg;if (apic_verbosity ==APIC_QUIET )return ;
@@ -1380,12 +1382,11 @@ __apicdebuginit(void) print_IO_APIC(void) } }printk (KERN_DEBUG "IRQ to pin mappings:\n" ); -for (i =0 ; i < nr_irqs; i++) { -struct irq_cfg *cfg =irq_cfg (i); +for_each_irq_cfg (cfg) {struct irq_pin_list *entry = cfg->irq_2_pin;if (!entry)continue ; -printk (KERN_DEBUG "IRQ%d " , i); +printk (KERN_DEBUG "IRQ%d " , cfg->irq);for (;;) {printk ("-> %d:%d" , entry->apic, entry->pin);if (!entry->next)
@@ -2044,6 +2045,7 @@ static inline void init_IO_APIC_traps(void) {int irq;struct irq_desc *desc; +struct irq_cfg *cfg;/* * NOTE! The local APIC isn't very good at handling
@@ -2056,10 +2058,8 @@ static inline void init_IO_APIC_traps(void)* Also, we've got to be careful not to trash gate * 0x80, because int 0x80 is hm, kind of importantish. ;) */ -for (irq =0 ; irq < nr_irqs ; irq++) { -struct irq_cfg *cfg; - - cfg =irq_cfg (irq); +for_each_irq_cfg (cfg) { + irq = cfg->irq;if (IO_APIC_IRQ (irq) && !cfg->vector) {/* * Hmm.. We don't have an entry for this,
Signature · 1 line
1.5.4.5
PATCH 33/42 remove >= nr_irqs checking with config_have_sparse_irq
v2: fix checking about result irq_cfg_without_new, so could use msi again
--- arch/x86/kernel/io_apic_64.c | 29 ++++++++++++++++++++--------- arch/x86/kernel/irq_64.c | 2 +- drivers/char/random.c | 4 ++++ fs/proc/proc_misc.c | 29 +++++++++++++++++------------ kernel/irq/chip.c | 28 +++++++++++++++++++++++++++- kernel/irq/manage.c | 37 +++++++++++++++++++++++++++++++------ 6 files changed, 100 insertions(+), 29 deletions(-)
arch/x86/kernel/io_apic_64.c +20 -9
@@ -135,6 +135,26 @@ static void __init init_work(void *data)static struct irq_cfg *irq_cfgx;DEFINE_DYN_ARRAY (irq_cfgx,sizeof (struct irq_cfg ), nr_irq_cfg,PAGE_SIZE , init_work); +static struct irq_cfg *irq_cfg_without_new (unsigned int irq) +{ +struct irq_cfg *cfg; + +BUG_ON (irq ==-1U ); + + cfg = &irq_cfgx[0 ]; +while (cfg) { +if (cfg->irq == irq) +return cfg; + +if (cfg->irq ==-1U ) { +return NULL ; + } + cfg = cfg->next; + } + +return NULL ; +} +static struct irq_cfg *irq_cfg (unsigned int irq) {struct irq_cfg *cfg, *cfg_pri;
@@ -380,7 +400,6 @@ static inline void io_apic_sync(unsigned int apic)struct irq_cfg *cfg; \struct irq_pin_list *entry; \ \ -BUG_ON (irq >= nr_irqs); \ cfg =irq_cfg (irq); \ entry = cfg->irq_2_pin; \for (;;) { \
@@ -460,7 +479,6 @@ static void __target_IO_APIC_irq(unsigned int irq, unsigned int dest, u8 vector)struct irq_cfg *cfg;struct irq_pin_list *entry; -BUG_ON (irq >= nr_irqs); cfg =irq_cfg (irq); entry = cfg->irq_2_pin;for (;;) {
@@ -529,7 +547,6 @@ static void add_pin_to_irq(unsigned int irq, int apic, int pin)struct irq_cfg *cfg;struct irq_pin_list *entry; -BUG_ON (irq >= nr_irqs); cfg =irq_cfg (irq); entry = cfg->irq_2_pin;if (!entry) {
@@ -820,7 +837,6 @@ int IO_APIC_get_PCI_irq_vector(int bus, int slot, int pin) best_guess = irq; } } -BUG_ON (best_guess >= nr_irqs);return best_guess; }
@@ -952,7 +968,6 @@ static int pin_2_irq(int idx, int apic, int pin) irq += nr_ioapic_registers[i++]; irq += pin; } -BUG_ON (irq >= nr_irqs);return irq; }
@@ -974,7 +989,6 @@ static int __assign_irq_vector(int irq, cpumask_t mask)int cpu;struct irq_cfg *cfg; -BUG_ON ((unsigned )irq >= nr_irqs); cfg =irq_cfg (irq);/* Only try and allocate irqs on cpus that are present */
@@ -1048,7 +1062,6 @@ static void __clear_irq_vector(int irq)cpumask_t mask;int cpu, vector; -BUG_ON ((unsigned )irq >= nr_irqs); cfg =irq_cfg (irq);BUG_ON (!cfg->vector);
@@ -1898,8 +1911,6 @@ asmlinkage void smp_irq_move_cleanup_interrupt(void)struct irq_desc *desc;struct irq_cfg *cfg; irq =__get_cpu_var (vector_irq)[vector]; -if (irq >= nr_irqs) -continue ; desc =irq_desc (irq); cfg =irq_cfg (irq);
arch/x86/kernel/irq_64.c +1 -1
@@ -202,7 +202,7 @@ asmlinkage unsigned int do_IRQ(struct pt_regs *regs)stack_overflow_check (regs);#endif -if (likely (irq < nr_irqs)) +if (likely (irq_desc_without_new (irq)))generic_handle_irq (irq);else {if (!disable_apic)
drivers/char/random.c +4 -0
@@ -649,8 +649,10 @@ void add_interrupt_randomness(int irq)struct timer_rand_state *state;struct irq_desc *desc; +#ifndef CONFIG_HAVE_SPARSE_IRQ if (irq >= nr_irqs)return ; +#endif desc =irq_desc (irq); state = desc->timer_rand_state;
@@ -920,8 +922,10 @@ void rand_initialize_irq(int irq)struct timer_rand_state *state;struct irq_desc *desc; +#ifndef CONFIG_HAVE_SPARSE_IRQ if (irq >= nr_irqs)return ; +#endif desc =irq_desc (irq); state = desc->timer_rand_state;
fs/proc/proc_misc.c +17 -12
@@ -495,19 +495,15 @@ static const struct file_operations proc_vmalloc_operations = {static int show_stat (struct seq_file *p,void *v) { -int i; +int i, j;unsigned long jif;cputime64_t user, nice, system, idle, iowait, irq, softirq, steal;cputime64_t guest;u64 sum =0 ;struct timespec boottime; -unsigned int *per_irq_sum; +unsigned int per_irq_sum;struct irq_desc *desc; - per_irq_sum =kzalloc (sizeof (unsigned int )*nr_irqs,GFP_KERNEL ); -if (!per_irq_sum) -return -ENOMEM ; - user = nice = system = idle = iowait = irq = softirq = steal = cputime64_zero; guest = cputime64_zero;
@@ -515,8 +511,6 @@ static int show_stat(struct seq_file *p, void *v) jif = boottime.tv_sec;for_each_possible_cpu (i) { -int j; - user =cputime64_add (user,kstat_cpu (i).cpustat.user); nice =cputime64_add (nice,kstat_cpu (i).cpustat.nice); system =cputime64_add (system,kstat_cpu (i).cpustat.system);
@@ -531,7 +525,6 @@ static int show_stat(struct seq_file *p, void *v) temp =kstat_irqs_cpu (j, i); sum += temp; - per_irq_sum[j] += temp; } sum +=arch_irq_stat_cpu (i); }
@@ -574,8 +567,21 @@ static int show_stat(struct seq_file *p, void *v) }seq_printf (p,"intr %llu" , (unsigned long long )sum); -for (i =0 ; i < nr_irqs; i++) -seq_printf (p," %u" , per_irq_sum[i]); +/* sum again ? it could be updated? have another field in irq_desc?*/ +for (j =0 ; j < nr_irqs; j++) { + per_irq_sum =0 ; + desc =irq_desc_without_new (j); + +if (desc) +for_each_possible_cpu (i) { +unsigned int temp; + + temp =kstat_irqs_cpu (j, i); + per_irq_sum += temp; + } + +seq_printf (p," %u" , per_irq_sum); + }seq_printf (p, "\nctxt %llu\n"
@@ -589,7 +595,6 @@ static int show_stat(struct seq_file *p, void *v)nr_running (), nr_iowait()); -kfree (per_irq_sum);return 0 ; }
kernel/irq/chip.c +27 -1
@@ -27,10 +27,12 @@ void dynamic_irq_init(unsigned int irq)struct irq_desc *desc;unsigned long flags; +#ifndef CONFIG_HAVE_SPARSE_IRQ if (irq >= nr_irqs) {WARN (1 ,KERN_ERR "Trying to initialize invalid IRQ%d\n" , irq);return ; } +#endif /* Ensure we don't have left over values from a previous use of this irq */ desc =irq_desc (irq);
@@ -60,10 +62,12 @@ void dynamic_irq_cleanup(unsigned int irq)struct irq_desc *desc;unsigned long flags; +#ifndef CONFIG_HAVE_SPARSE_IRQ if (irq >= nr_irqs) {WARN (1 ,KERN_ERR "Trying to cleanup invalid IRQ%d\n" , irq);return ; } +#endif desc =irq_desc (irq);spin_lock_irqsave (&desc->lock, flags);
@@ -92,10 +96,12 @@ int set_irq_chip(unsigned int irq, struct irq_chip *chip)struct irq_desc *desc;unsigned long flags; +#ifndef CONFIG_HAVE_SPARSE_IRQ if (irq >= nr_irqs) {WARN (1 ,KERN_ERR "Trying to install chip for IRQ%d\n" , irq);return -EINVAL ; } +#endif if (!chip) chip = &no_irq_chip;
@@ -121,10 +127,12 @@ int set_irq_type(unsigned int irq, unsigned int type)unsigned long flags;int ret = -ENXIO ; +#ifndef CONFIG_HAVE_SPARSE_IRQ if (irq >= nr_irqs) {printk (KERN_ERR "Trying to set irq type for IRQ%d\n" , irq);return -ENODEV ; } +#endif desc =irq_desc (irq);if (desc->chip->set_type) {
@@ -148,11 +156,13 @@ int set_irq_data(unsigned int irq, void *data)struct irq_desc *desc;unsigned long flags; +#ifndef CONFIG_HAVE_SPARSE_IRQ if (irq >= nr_irqs) {printk (KERN_ERR "Trying to install controller data for IRQ%d\n" , irq);return -EINVAL ; } +#endif desc =irq_desc (irq);spin_lock_irqsave (&desc->lock, flags);
@@ -174,11 +184,13 @@ int set_irq_msi(unsigned int irq, struct msi_desc *entry)struct irq_desc *desc;unsigned long flags; +#ifndef CONFIG_HAVE_SPARSE_IRQ if (irq >= nr_irqs) {printk (KERN_ERR "Trying to install msi data for IRQ%d\n" , irq);return -EINVAL ; } +#endif desc =irq_desc (irq);spin_lock_irqsave (&desc->lock, flags); desc->msi_desc = entry;
@@ -200,8 +212,16 @@ int set_irq_chip_data(unsigned int irq, void *data)struct irq_desc *desc;unsigned long flags; +#ifndef CONFIG_HAVE_SPARSE_IRQ +if (irq >= nr_irqs) { +printk (KERN_ERR +"Trying to install chip data for IRQ%d\n" , irq); +return -EINVAL ; + } +#endif + desc =irq_desc (irq); -if (irq >= nr_irqs || !desc->chip) { +if (!desc->chip) {printk (KERN_ERR "BUG: bad set_irq_chip_data(IRQ#%d)\n" , irq);return -EINVAL ; }
@@ -545,11 +565,13 @@ __set_irq_handler(unsigned int irq, irq_flow_handler_t handle, int is_chained,struct irq_desc *desc;unsigned long flags; +#ifndef CONFIG_HAVE_SPARSE_IRQ if (irq >= nr_irqs) {printk (KERN_ERR "Trying to install type control for IRQ%d\n" , irq);return ; } +#endif desc =irq_desc (irq);
@@ -610,11 +632,13 @@ void __init set_irq_noprobe(unsigned int irq)struct irq_desc *desc;unsigned long flags; +#ifndef CONFIG_HAVE_SPARSE_IRQ if (irq >= nr_irqs) {printk (KERN_ERR "Trying to mark IRQ%d non-probeable\n" , irq);return ; } +#endif desc =irq_desc (irq);
@@ -628,11 +652,13 @@ void __init set_irq_probe(unsigned int irq)struct irq_desc *desc;unsigned long flags; +#ifndef CONFIG_HAVE_SPARSE_IRQ if (irq >= nr_irqs) {printk (KERN_ERR "Trying to mark IRQ%d probeable\n" , irq);return ; } +#endif desc =irq_desc (irq);
kernel/irq/manage.c +31 -6
@@ -34,8 +34,10 @@ void synchronize_irq(unsigned int irq)struct irq_desc *desc =irq_desc (irq);unsigned int status; +#ifndef CONFIG_HAVE_SPARSE_IRQ if (irq >= nr_irqs)return ; +#endif do { unsigned long flags;
@@ -142,12 +144,15 @@ int irq_select_affinity(unsigned int irq)*/ void disable_irq_nosync (unsigned int irq) { -struct irq_desc *desc =irq_desc (irq); +struct irq_desc *desc;unsigned long flags; +#ifndef CONFIG_HAVE_SPARSE_IRQ if (irq >= nr_irqs)return ; +#endif + desc =irq_desc (irq);spin_lock_irqsave (&desc->lock, flags);if (!desc->depth++) { desc->status |=IRQ_DISABLED ;
@@ -171,11 +176,14 @@ EXPORT_SYMBOL(disable_irq_nosync);*/ void disable_irq (unsigned int irq) { -struct irq_desc *desc =irq_desc (irq); +struct irq_desc *desc; +#ifndef CONFIG_HAVE_SPARSE_IRQ if (irq >= nr_irqs)return ; +#endif + desc =irq_desc (irq);disable_irq_nosync (irq);if (desc->action)synchronize_irq (irq);
@@ -213,12 +221,15 @@ static void __enable_irq(struct irq_desc *desc, unsigned int irq)*/ void enable_irq (unsigned int irq) { -struct irq_desc *desc =irq_desc (irq); +struct irq_desc *desc;unsigned long flags; +#ifndef CONFIG_HAVE_SPARSE_IRQ if (irq >= nr_irqs)return ; +#endif + desc =irq_desc (irq);spin_lock_irqsave (&desc->lock, flags);__enable_irq (desc, irq);spin_unlock_irqrestore (&desc->lock, flags);
@@ -290,10 +301,16 @@ EXPORT_SYMBOL(set_irq_wake);*/ int can_request_irq (unsigned int irq,unsigned long irqflags) { -struct irq_desc *desc =irq_desc (irq); +struct irq_desc *desc;struct irqaction *action; -if (irq >= nr_irqs || desc->status &IRQ_NOREQUEST ) +#ifndef CONFIG_HAVE_SPARSE_IRQ +if (irq >= nr_irqs) +return 0 ; +#endif + + desc =irq_desc (irq); +if (desc->status &IRQ_NOREQUEST )return 0 ; action =desc->action;
@@ -345,16 +362,19 @@ static int __irq_set_trigger(struct irq_chip *chip, unsigned int irq,*/ int setup_irq (unsigned int irq,struct irqaction *new) { -struct irq_desc *desc =irq_desc (irq); +struct irq_desc *desc;struct irqaction *old, **p;const char *old_name =NULL ;unsigned long flags;int shared =0 ;int ret; +#ifndef CONFIG_HAVE_SPARSE_IRQ if (irq >= nr_irqs)return -EINVAL ; +#endif + desc =irq_desc (irq);if (desc->chip == &no_irq_chip)return -ENOSYS ;/*
@@ -506,8 +526,11 @@ void free_irq(unsigned int irq, void *dev_id)unsigned long flags;WARN_ON (in_interrupt ()); + +#ifndef CONFIG_HAVE_SPARSE_IRQ if (irq >= nr_irqs)return ; +#endif desc =irq_desc (irq);spin_lock_irqsave (&desc->lock, flags);
@@ -621,8 +644,10 @@ int request_irq(unsigned int irq, irq_handler_t handler,*/ if ((irqflags &IRQF_SHARED ) && !dev_id)return -EINVAL ; +#ifndef CONFIG_HAVE_SPARSE_IRQ if (irq >= nr_irqs)return -EINVAL ; +#endif desc =irq_desc (irq);if (desc->status &IRQ_NOREQUEST )return -EINVAL ;
Signature · 1 line
1.5.4.5
PATCH 34/42 x86_64: add irq_desc in function in paramater
So could remove some duplicated calling to irq_desc
--- arch/x86/kernel/io_apic_32.c | 6 ++- arch/x86/kernel/io_apic_64.c | 49 +++++++++++++------------------ arch/x86/kernel/irq_32.c | 3 +- arch/x86/kernel/irq_64.c | 8 +++-- drivers/mfd/tc6393xb.c | 7 +++- drivers/parisc/dino.c | 3 +- drivers/parisc/eisa.c | 4 ++- drivers/parisc/gsc.c | 3 +- drivers/parisc/superio.c | 4 ++- include/linux/irq.h | 30 +++++++++++++------ init/main.c | 5 +++ kernel/irq/chip.c | 26 +++++++++++++++- kernel/irq/handle.c | 65 +++++++++++++++++++++++++++++++++++++++-- kernel/irq/manage.c | 8 +++++ kernel/irq/migration.c | 15 +++++---- 15 files changed, 172 insertions(+), 64 deletions(-)
arch/x86/kernel/io_apic_32.c +4 -2
@@ -1975,7 +1975,8 @@ static unsigned int startup_ioapic_irq(unsigned int irq)static void ack_ioapic_irq (unsigned int irq) { -move_native_irq (irq); +struct irq_desc *desc =irq_desc (irq); +move_native_irq (irq, desc);ack_APIC_irq (); }
@@ -1983,8 +1984,9 @@ static void ack_ioapic_quirk_irq(unsigned int irq) {unsigned long v;int i; +struct irq_desc *desc =irq_desc (irq); -move_native_irq (irq); +move_native_irq (irq, desc);/* * It appears there is an erratum which affects at least version 0x11 * of I/O APIC (that's the 82093AA and cores integrated into various
arch/x86/kernel/io_apic_64.c +20 -29
204 lines not on this page · raw message
arch/x86/kernel/irq_32.c +2 -1
@@ -224,7 +224,7 @@ unsigned int do_IRQ(struct pt_regs *regs)struct pt_regs *old_regs;/* high bit used in ret_from_ code */ int overflow, irq = ~regs->orig_ax; -struct irq_desc *desc =irq_desc (irq); +struct irq_desc *desc;if (unlikely ((unsigned )irq >= nr_irqs)) { printk(KERN_EMERG "%s: cannot handle IRQ %d\n",
@@ -232,6 +232,7 @@ unsigned int do_IRQ(struct pt_regs *regs)BUG (); } + desc =irq_desc (irq); old_regs =set_irq_regs (regs);irq_enter ();
arch/x86/kernel/irq_64.c +5 -3
@@ -189,6 +189,7 @@ u64 arch_irq_stat(void) asmlinkage unsigned int do_IRQ(struct pt_regs *regs) {struct pt_regs *old_regs =set_irq_regs (regs); +struct irq_desc *desc;/* high bit used in ret_from_ code */ unsigned vector = ~regs->orig_ax;
@@ -202,8 +203,9 @@ asmlinkage unsigned int do_IRQ(struct pt_regs *regs)stack_overflow_check (regs);#endif -if (likely (irq_desc_without_new (irq))) -generic_handle_irq (irq); + desc =irq_desc_without_new (irq); +if (likely (desc)) +generic_handle_irq (irq, desc);else {if (!disable_apic)ack_APIC_irq ();
@@ -253,7 +255,7 @@ void fixup_irqs(cpumask_t map) desc->chip->mask (irq);if (desc->chip->set_affinity) - desc->chip->set_affinity (irq, mask); + desc->chip->set_affinity (irq, desc, mask);else if (!(warned++)) set_affinity =0 ;
drivers/mfd/tc6393xb.c +5 -2
@@ -262,14 +262,17 @@ tc6393xb_irq(unsigned int irq, struct irq_desc *desc)struct tc6393xb *tc6393xb =get_irq_data (irq);unsigned int isr;unsigned int i, irq_base; +struct irq_desc *descx; irq_base = tc6393xb->irq_base;while ((isr =ioread8 (tc6393xb->scr +SCR_ISR ) & ~ioread8 (tc6393xb->scr +SCR_IMR )))for (i =0 ; i <TC6393XB_NR_IRQS ; i++) { -if (isr & (1 << i)) -generic_handle_irq (irq_base + i); +if (isr & (1 << i)) { + descx =irq_desc (irq_base + i); +generic_handle_irq (irq_base + i, descx); + } } }
drivers/parisc/dino.c +2 -1
@@ -389,9 +389,10 @@ ilr_again:do {int local_irq =__ffs (mask);int irq = dino_dev->global_irq[local_irq]; +struct irq_desc *desc =irq_desc (irq);DBG (KERN_DEBUG "%s(%d, %p) mask 0x%x\n" , __func__, irq, intr_dev, mask); -__do_IRQ (irq); +__do_IRQ (irq, desc); mask &= ~(1 << local_irq); }while (mask);
drivers/parisc/eisa.c +3 -1
@@ -202,6 +202,7 @@ static irqreturn_t eisa_irq(int wax_irq, void *intr_dev) {int irq =gsc_readb (0xfc01f000 );/* EISA supports 16 irqs */ unsigned long flags; +struct irq_desc *desc;spin_lock_irqsave (&eisa_irq_lock, flags);/* read IRR command */
@@ -233,7 +234,8 @@ static irqreturn_t eisa_irq(int wax_irq, void *intr_dev) }spin_unlock_irqrestore (&eisa_irq_lock, flags); -__do_IRQ (irq); + desc =irq_desc (irq); +__do_IRQ (irq, desc);spin_lock_irqsave (&eisa_irq_lock, flags);/* unmask */
drivers/parisc/gsc.c +2 -1
@@ -87,7 +87,8 @@ irqreturn_t gsc_asic_intr(int gsc_asic_irq, void *dev)do {int local_irq =__ffs (irr);unsigned int irq = gsc_asic->global_irq[local_irq]; -__do_IRQ (irq); +struct irq_desc *desc =irq_desc (irq); +__do_IRQ (irq, desc); irr &= ~(1 << local_irq); }while (irr);
drivers/parisc/superio.c +3 -1
@@ -99,6 +99,7 @@ superio_interrupt(int parent_irq, void *devp) {u8 results;u8 local_irq; +struct irq_desc *desc;/* Poll the 8259 to see if there's an interrupt. */ outb (OCW3_POLL ,IC_PIC1 +0 );
@@ -139,7 +140,8 @@ superio_interrupt(int parent_irq, void *devp) }/* Call the appropriate device's interrupt */ -__do_IRQ (local_irq); + desc =irq_desc (local_irq); +__do_IRQ (local_irq, desc);/* set EOI - forces a new interrupt if a lower priority device * still needs service.
include/linux/irq.h +20 -10
@@ -106,14 +106,26 @@ struct irq_chip {void (*enable)(unsigned int irq);void (*disable)(unsigned int irq); +#ifdef CONFIG_HAVE_SPARSE_IRQ +void (*ack)(unsigned int irq,struct irq_desc *desc); +#else void (*ack)(unsigned int irq); +#endif void (*mask)(unsigned int irq);void (*mask_ack)(unsigned int irq);void (*unmask)(unsigned int irq); +#ifdef CONFIG_HAVE_SPARSE_IRQ +void (*eoi)(unsigned int irq,struct irq_desc *desc); +#else void (*eoi)(unsigned int irq); +#endif void (*end)(unsigned int irq); +#ifdef CONFIG_HAVE_SPARSE_IRQ +void (*set_affinity)(unsigned int irq,struct irq_desc *desc,cpumask_t dest); +#else void (*set_affinity)(unsigned int irq,cpumask_t dest); +#endif int (*retrigger)(unsigned int irq);int (*set_type)(unsigned int irq,unsigned int flow_type);int (*set_wake)(unsigned int irq,unsigned int on);
@@ -240,8 +252,8 @@ extern int setup_irq(unsigned int irq, struct irqaction *new);#if defined(CONFIG_GENERIC_PENDING_IRQ ) || defined(CONFIG_IRQBALANCE )void set_pending_irq (unsigned int irq,cpumask_t mask); -void move_native_irq (int irq); -void move_masked_irq (int irq); +void move_native_irq (int irq,struct irq_desc *desc); +void move_masked_irq (int irq,struct irq_desc *desc);#else /* CONFIG_GENERIC_PENDING_IRQ || CONFIG_IRQBALANCE */
@@ -249,11 +261,11 @@ static inline void move_irq(int irq) { } -static inline void move_native_irq (int irq) +static inline void move_native_irq (int irq,struct irq_desc *desc) { } -static inline void move_masked_irq (int irq) +static inline void move_masked_irq (int irq,struct irq_desc *desc) { }
@@ -265,7 +277,7 @@ static inline void set_pending_irq(unsigned int irq, cpumask_t mask)#else /* CONFIG_SMP */ -#define move_native_irq (x) +#define move_native_irq (x, y)#define move_masked_irq (x)#endif /* CONFIG_SMP */
@@ -306,7 +318,7 @@ extern void handle_bad_irq(unsigned int irq, struct irq_desc *desc);* Monolithic do_IRQ implementation. */ #ifndef CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ -extern unsigned int __do_IRQ (unsigned int irq); +extern unsigned int __do_IRQ (unsigned int irq,struct irq_desc *desc);#endif /*
@@ -315,17 +327,15 @@ extern unsigned int __do_IRQ(unsigned int irq);* irqchip-style controller then we call the ->handle_irq() handler, * and it calls __do_IRQ() if it's attached to an irqtype-style controller. */ -static inline void generic_handle_irq (unsigned int irq) +static inline void generic_handle_irq (unsigned int irq,struct irq_desc *desc) { -struct irq_desc *desc =irq_desc (irq); -#ifdef CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ desc->handle_irq (irq, desc);#else if (likely (desc->handle_irq)) desc->handle_irq (irq, desc);else -__do_IRQ (irq); +__do_IRQ (irq, desc);#endif }
init/main.c +5 -0
@@ -593,6 +593,11 @@ void pre_alloc_dyn_array(void)if (da->init_work) da->init_work(da); } +#else +unsigned int i; + +for (i =0 ; i <NR_IRQS ; i++) + irq_desc[i].irq = i;#endif }
kernel/irq/chip.c +24 -2
@@ -310,7 +310,11 @@ static inline void mask_ack_irq(struct irq_desc *desc, int irq) desc->chip->mask_ack (irq); else { desc->chip->mask (irq); +#ifdef CONFIG_HAVE_SPARSE_IRQ + desc->chip->ack (irq, desc); +#else desc->chip->ack (irq); +#endif } }
@@ -450,7 +454,11 @@ handle_fasteoi_irq(unsigned int irq, struct irq_desc *desc)spin_lock (&desc->lock); desc->status &= ~IRQ_INPROGRESS ; out: +#ifdef CONFIG_HAVE_SPARSE_IRQ + desc->chip->eoi (irq, desc); +#else desc->chip->eoi (irq); +#endif spin_unlock (&desc->lock); }
@@ -493,7 +501,11 @@ handle_edge_irq(unsigned int irq, struct irq_desc *desc)kstat_irqs_this_cpu (desc)++;/* Start handling the irq */ +#ifdef CONFIG_HAVE_SPARSE_IRQ + desc->chip->ack (irq, desc); +#else desc->chip->ack (irq); +#endif /* Mark the IRQ currently in progress.*/ desc->status |=IRQ_INPROGRESS ;
@@ -547,15 +559,25 @@ handle_percpu_irq(unsigned int irq, struct irq_desc *desc)kstat_irqs_this_cpu (desc)++; -if (desc->chip->ack) +if (desc->chip->ack) { +#ifdef CONFIG_HAVE_SPARSE_IRQ + desc->chip->ack (irq, desc); +#else desc->chip->ack (irq); +#endif + } action_ret =handle_IRQ_event (irq, desc->action);if (!noirqdebug)note_interrupt (irq, desc, action_ret); -if (desc->chip->eoi) +if (desc->chip->eoi) { +#ifdef CONFIG_HAVE_SPARSE_IRQ + desc->chip->eoi (irq, desc); +#else desc->chip->eoi (irq); +#endif + } }void
kernel/irq/handle.c +61 -4
123 lines not on this page · raw message
kernel/irq/manage.c +8 -0
@@ -95,7 +95,11 @@ int irq_set_affinity(unsigned int irq, cpumask_t cpumask)unsigned long flags;spin_lock_irqsave (&desc->lock, flags); +#ifdef CONFIG_HAVE_SPARSE_IRQ + desc->chip->set_affinity (irq, desc, cpumask); +#else desc->chip->set_affinity (irq, cpumask); +#endif spin_unlock_irqrestore (&desc->lock, flags); }else set_pending_irq (irq, cpumask);
@@ -122,7 +126,11 @@ int irq_select_affinity(unsigned int irq) desc =irq_desc (irq); desc->affinity = mask; +#ifdef CONFIG_HAVE_SPARSE_IRQ + desc->chip->set_affinity (irq, desc, mask); +#else desc->chip->set_affinity (irq, mask); +#endif set_balance_irq_affinity (irq, mask);return 0 ;
kernel/irq/migration.c +8 -7
@@ -12,9 +12,8 @@ void set_pending_irq(unsigned int irq, cpumask_t mask)spin_unlock_irqrestore (&desc->lock, flags); } -void move_masked_irq (int irq) +void move_masked_irq (int irq,struct irq_desc *desc) { -struct irq_desc *desc =irq_desc (irq);cpumask_t tmp;if (likely (!(desc->status &IRQ_MOVE_PENDING )))
@@ -53,15 +52,17 @@ void move_masked_irq(int irq)* masking the irqs. */ if (likely (!cpus_empty (tmp))) { - desc->chip->set_affinity (irq,tmp); +#ifdef CONFIG_HAVE_SPARSE_IRQ + desc->chip->set_affinity (irq, desc, tmp); +#else + desc->chip->set_affinity (irq, tmp); +#endif }cpus_clear (desc->pending_mask); } -void move_native_irq (int irq) +void move_native_irq (int irq,struct irq_desc *desc) { -struct irq_desc *desc =irq_desc (irq); -if (likely (!(desc->status &IRQ_MOVE_PENDING )))return ;
@@ -69,7 +70,7 @@ void move_native_irq(int irq)return ; desc->chip->mask (irq); -move_masked_irq (irq); +move_masked_irq (irq, desc); desc->chip->unmask (irq); }
Signature · 1 line
1.5.4.5
PATCH 35/42 x86: check with without_new in show_interrupts
so don't get new one that we don't need
--- arch/x86/kernel/irq_64.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-)
arch/x86/kernel/irq_64.c +4 -1
@@ -83,7 +83,10 @@ int show_interrupts(struct seq_file *p, void *v)if (i < nr_irqs) {unsigned any_count =0 ; -struct irq_desc *desc =irq_desc (i); +struct irq_desc *desc =irq_desc_without_new (i); + +if (!desc) +return 0 ;spin_lock_irqsave (&desc->lock, flags);#ifndef CONFIG_SMP
Signature · 1 line
1.5.4.5
PATCH 36/42 x86_64: introduce irq_cfg_with_new
So could only call that one time, when we call add_irq_2_pin
--- arch/x86/kernel/io_apic_64.c | 16 +++++++++++----- 1 files changed, 11 insertions(+), 5 deletions(-)
arch/x86/kernel/io_apic_64.c +11 -5
@@ -135,7 +135,7 @@ static void __init init_work(void *data)static struct irq_cfg *irq_cfgx;DEFINE_DYN_ARRAY (irq_cfgx,sizeof (struct irq_cfg ), nr_irq_cfg,PAGE_SIZE , init_work); -static struct irq_cfg *irq_cfg_without_new (unsigned int irq) +static struct irq_cfg *irq_cfg (unsigned int irq) {struct irq_cfg *cfg;
@@ -155,7 +155,7 @@ static struct irq_cfg *irq_cfg_without_new(unsigned int irq)return NULL ; } -static struct irq_cfg *irq_cfg (unsigned int irq) +static struct irq_cfg *irq_cfg_with_new (unsigned int irq) {struct irq_cfg *cfg, *cfg_pri;int i;
@@ -545,7 +545,8 @@ static void add_pin_to_irq(unsigned int irq, int apic, int pin)struct irq_cfg *cfg;struct irq_pin_list *entry; - cfg =irq_cfg (irq); +/* first time to refer irq_cfg, so with new */ + cfg =irq_cfg_with_new (irq); entry = cfg->irq_2_pin;if (!entry) { entry =get_one_free_irq_2_pin ();
@@ -1208,13 +1209,15 @@ static int setup_ioapic_entry(int apic, int irq,static void setup_IO_APIC_irq (int apic,int pin,unsigned int irq,int trigger,int polarity) { -struct irq_cfg *cfg =irq_cfg (irq); +struct irq_cfg *cfg;struct IO_APIC_route_entry entry;cpumask_t mask;if (!IO_APIC_IRQ (irq))return ; + cfg =irq_cfg (irq); + mask =TARGET_CPUS ;if (assign_irq_vector (irq, mask))return ;
@@ -2490,8 +2493,11 @@ int create_irq(void)if (platform_legacy_irq (new))continue ; cfg_new =irq_cfg (new); -if (cfg_new->vector !=0 ) +if (cfg_new && cfg_new->vector !=0 )continue ; +/* check if need to create one */ +if (!cfg_new) + cfg_new =irq_cfg_with_new (new);if (__assign_irq_vector (new,TARGET_CPUS ) ==0 ) irq = new;break ;
Signature · 1 line
1.5.4.5
PATCH 37/42 x86_64: introduce irq_desc_with_new
So could only call that one time
--- arch/x86/kernel/io_apic_64.c | 18 ++++++++++++------ arch/x86/kernel/irq_64.c | 4 ++-- arch/x86/kernel/irqinit_64.c | 3 ++- fs/proc/proc_misc.c | 2 +- include/linux/irq.h | 2 +- kernel/irq/chip.c | 5 +++++ kernel/irq/handle.c | 23 +++++------------------ 7 files changed, 28 insertions(+), 29 deletions(-)
arch/x86/kernel/io_apic_64.c +12 -6
@@ -1117,7 +1117,12 @@ static void ioapic_register_intr(int irq, unsigned long trigger) {struct irq_desc *desc; - desc =irq_desc (irq); +/* first time to use this irq_desc */ +if (irq <16 ) + desc =irq_desc (irq); +else + desc =irq_desc_with_new (irq); +if (trigger) desc->status |=IRQ_LEVEL ;else
@@ -3086,8 +3091,6 @@ void __init setup_ioapic_dest(void)continue ; irq =pin_2_irq (irq_entry, ioapic, pin); - desc =irq_desc (irq); -/* setup_IO_APIC_irqs could fail to get vector for some device * when you have too many devices, because at that time only boot * cpu is online.
@@ -3098,13 +3101,16 @@ void __init setup_ioapic_dest(void)irq_trigger (irq_entry), irq_polarity(irq_entry));#ifdef CONFIG_INTR_REMAP - else if (intr_remapping_enabled) + else if (intr_remapping_enabled) { + desc =irq_desc (irq);set_ir_ioapic_affinity_irq (irq, desc,TARGET_CPUS ); + }#endif - else + else { + desc =irq_desc (irq);set_ioapic_affinity_irq (irq, desc,TARGET_CPUS ); + } } - } }#endif
arch/x86/kernel/irq_64.c +2 -2
@@ -83,7 +83,7 @@ int show_interrupts(struct seq_file *p, void *v)if (i < nr_irqs) {unsigned any_count =0 ; -struct irq_desc *desc =irq_desc_without_new (i); +struct irq_desc *desc =irq_desc (i);if (!desc)return 0 ;
@@ -206,7 +206,7 @@ asmlinkage unsigned int do_IRQ(struct pt_regs *regs)stack_overflow_check (regs);#endif - desc =irq_desc_without_new (irq); + desc =irq_desc (irq);if (likely (desc))generic_handle_irq (irq, desc);else {
arch/x86/kernel/irqinit_64.c +2 -1
@@ -143,7 +143,8 @@ static void __init init_ISA_irqs (void)init_8259A (0 );for (i =0 ; i <16 ; i++) { -struct irq_desc *desc =irq_desc (i); +/* first time call this irq_desc */ +struct irq_desc *desc =irq_desc_with_new (i); desc->status =IRQ_DISABLED ; desc->action =NULL ;
fs/proc/proc_misc.c +1 -1
@@ -570,7 +570,7 @@ static int show_stat(struct seq_file *p, void *v)/* sum again ? it could be updated? have another field in irq_desc?*/ for (j =0 ; j < nr_irqs; j++) { per_irq_sum =0 ; - desc =irq_desc_without_new (j); + desc =irq_desc (j);if (desc)for_each_possible_cpu (i) {
include/linux/irq.h +1 -1
@@ -205,7 +205,7 @@ struct irq_desc { }____cacheline_internodealigned_in_smp ;extern struct irq_desc *irq_desc (unsigned int irq); -extern struct irq_desc *irq_desc_without_new (unsigned int irq); +extern struct irq_desc *irq_desc_with_new (unsigned int irq);#ifndef CONFIG_HAVE_SPARSE_IRQ
kernel/irq/chip.c +5 -0
@@ -36,6 +36,11 @@ void dynamic_irq_init(unsigned int irq)/* Ensure we don't have left over values from a previous use of this irq */ desc =irq_desc (irq); +if (!desc) { +/* first time to use this irq_desc */ + desc =irq_desc_with_new (irq); +return ; + }spin_lock_irqsave (&desc->lock, flags); desc->status =IRQ_DISABLED ; desc->chip = &no_irq_chip;
kernel/irq/handle.c +5 -18
@@ -150,7 +150,7 @@ early_param("nr_irq_desc", parse_nr_irq_desc);struct irq_desc *irq_descX;DEFINE_DYN_ARRAY (irq_descX,sizeof (struct irq_desc ), nr_irq_desc,PAGE_SIZE , init_work); -struct irq_desc *irq_desc_without_new (unsigned int irq) +struct irq_desc *irq_desc (unsigned int irq) {struct irq_desc *desc;
@@ -168,7 +168,7 @@ struct irq_desc *irq_desc_without_new(unsigned int irq) }return NULL ; } -struct irq_desc *irq_desc (unsigned int irq) +struct irq_desc *irq_desc_with_new (unsigned int irq) {struct irq_desc *desc, *desc_pri;int i;
@@ -185,6 +185,7 @@ struct irq_desc *irq_desc(unsigned int irq)if (desc->irq ==-1U ) { desc->irq = irq; +printk ("found new irq_desc for irq %d\n" , desc->irq);return desc; } desc_pri = desc;
@@ -235,21 +236,7 @@ struct irq_desc *irq_desc(unsigned int irq) desc->irq = irq; desc_pri->next = desc; - { -/* double check if some one mess up the list */ -struct irq_desc *desc; -int count =0 ; - - desc = &irq_descX[0 ]; -while (desc) { -printk ("1 found irq_desc for irq %d\n" , desc->irq); -if (desc->next) -printk ("1 found irq_desc for irq %d and next will be irq %d\n" , desc->irq, desc->next->irq); - desc = desc->next; - count++; - } -printk ("1 all preallocted %d\n" , count); - } +printk ("1 found new irq_desc for irq %d and pri will be irq %d\n" , desc->irq, desc_pri->irq);return desc; }
@@ -285,7 +272,7 @@ struct irq_desc *irq_desc(unsigned int irq)return NULL ; } -struct irq_desc *irq_desc_without_new (unsigned int irq) +struct irq_desc *irq_desc_with_new (unsigned int irq) {return irq_desc (irq); }
Signature · 1 line
1.5.4.5
PATCH 38/42 seperate irq_descX with irq_descX_free
so later don't need compare with -1U
--- include/linux/irq.h | 2 +- kernel/irq/handle.c | 113 ++++++++++++++++++++++++++------------------------ 2 files changed, 60 insertions(+), 55 deletions(-)
include/linux/irq.h +1 -1
@@ -223,7 +223,7 @@ extern struct irq_desc *irq_descX;extern struct irq_desc *irq_descX;#define for_each_irq_desc (irqX, desc) \ - for (desc = irq_descX, irqX = desc->irq; desc && irqX != -1U; desc = desc->next, irqX = desc ? desc->irq: -1U) + for (desc = irq_descX, irqX = desc->irq; desc; desc = desc->next, irqX = desc ? desc->irq: -1U)#endif
kernel/irq/handle.c +59 -54
170 lines not on this page · raw message
Signature · 1 line
1.5.4.5
PATCH 39/42 x86_64: sperate irq_cfgx with irq_cfgx_free
so later don't need compare with -1U
--- arch/x86/kernel/io_apic_64.c | 90 ++++++++++++++++++++++++++--------------- 1 files changed, 57 insertions(+), 33 deletions(-)
arch/x86/kernel/io_apic_64.c +57 -33
@@ -111,44 +111,44 @@ static void init_one_irq_cfg(struct irq_cfg *cfg)memcpy (cfg, &irq_cfg_init,sizeof (struct irq_cfg )); } +static struct irq_cfg *irq_cfgx; +static struct irq_cfg *irq_cfgx_free;static void __init init_work (void *data) {struct dyn_array *da = data;struct irq_cfg *cfg; +int legacy_count;int i; cfg = *da->name;memcpy (cfg, irq_cfg_legacy,sizeof (irq_cfg_legacy)); - i =sizeof (irq_cfg_legacy)/sizeof (irq_cfg_legacy[0 ]); -for (; i < *da->nr; i++) + legacy_count =sizeof (irq_cfg_legacy)/sizeof (irq_cfg_legacy[0 ]); +for (i = legacy_count; i < *da->nr; i++)init_one_irq_cfg (&cfg[i]);for (i =1 ; i < *da->nr; i++) cfg[i-1 ].next = &cfg[i]; + + irq_cfgx_free = &irq_cfgx[legacy_count]; + irq_cfgx[legacy_count -1 ].next =NULL ; }#define for_each_irq_cfg (cfg) \ - for(cfg = irq_cfgx; cfg && cfg->irq != -1U; cfg = cfg->next) + for(cfg = irq_cfgx; cfg; cfg = cfg->next) -static struct irq_cfg *irq_cfgx;DEFINE_DYN_ARRAY (irq_cfgx,sizeof (struct irq_cfg ), nr_irq_cfg,PAGE_SIZE , init_work);static struct irq_cfg *irq_cfg (unsigned int irq) {struct irq_cfg *cfg; -BUG_ON (irq ==-1U ); - - cfg = &irq_cfgx[0 ]; + cfg = irq_cfgx;while (cfg) {if (cfg->irq == irq)return cfg; -if (cfg->irq ==-1U ) { -return NULL ; - } cfg = cfg->next; }
@@ -161,44 +161,68 @@ static struct irq_cfg *irq_cfg_with_new(unsigned int irq)int i;int count =0 ; -BUG_ON (irq ==-1U ); - - cfg_pri = cfg = &irq_cfgx[0 ]; + cfg_pri = cfg = irq_cfgx;while (cfg) {if (cfg->irq == irq)return cfg; -if (cfg->irq ==-1U ) { - cfg->irq = irq; -return cfg; - } cfg_pri = cfg; cfg = cfg->next; count++; } -/* -* we run out of pre-allocate ones, allocate more -*/ -printk (KERN_DEBUG "try to get more irq_cfg %d\n" , nr_irq_cfg); +if (!irq_cfgx_free) { +unsigned long phys; +unsigned long total_bytes; +/* +* we run out of pre-allocate ones, allocate more +*/ +printk (KERN_DEBUG "try to get more irq_cfg %d\n" , nr_irq_cfg); -if (after_bootmem) - cfg =kzalloc (sizeof (struct irq_cfg )*nr_irq_cfg,GFP_ATOMIC ); -else - cfg =__alloc_bootmem_nopanic (sizeof (struct irq_cfg )*nr_irq_cfg,PAGE_SIZE ,0 ); + total_bytes =sizeof (struct irq_cfg ) * nr_irq_cfg; +if (after_bootmem) + cfg =kzalloc (total_bytes,GFP_ATOMIC ); +else + cfg =__alloc_bootmem_nopanic (total_bytes,PAGE_SIZE ,0 ); -if (!cfg) -panic ("please boot with nr_irq_cfg= %d\n" , count *2 ); +if (!cfg) +panic ("please boot with nr_irq_cfg= %d\n" , count *2 ); -for (i =0 ; i < nr_irq_cfg; i++) -init_one_irq_cfg (&cfg[i]); + phys =__pa (cfg); +printk (KERN_DEBUG "irq_irq ==> [%#lx - %#lx]\n" , phys, phys + total_bytes); -for (i =1 ; i < nr_irq_cfg; i++) - cfg[i-1 ].next = &cfg[i]; +for (i =0 ; i < nr_irq_cfg; i++) +init_one_irq_cfg (&cfg[i]); - cfg->irq = irq; - cfg_pri->next = cfg; +for (i =1 ; i < nr_irq_cfg; i++) + cfg[i-1 ].next = &cfg[i]; + + irq_cfgx_free = cfg; + } + cfg = irq_cfgx_free; + irq_cfgx_free = irq_cfgx_free->next; + cfg->next =NULL ; +if (cfg_pri) + cfg_pri->next = cfg; +else + irq_cfgx = cfg; + cfg->irq = irq; +printk ("found new irq_cfg for irq %d\n" , cfg->irq); + { +/* dump the results */ +struct irq_cfg *cfg; +unsigned long phys; +unsigned long bytes =sizeof (struct irq_cfg ); + +printk (KERN_DEBUG "=========================== %d\n" , irq); +printk (KERN_DEBUG "irq_cfg dump after get that for %d\n" , irq); +for_each_irq_cfg (cfg) { + phys =__pa (cfg); +printk (KERN_DEBUG "irq_cfg %d ==> [%#lx - %#lx]\n" , cfg->irq, phys, phys + bytes); + } +printk (KERN_DEBUG "===========================\n" ); + }return cfg; }
Signature · 1 line
1.5.4.5
PATCH 40/42 x86_64: make /proc/interrupts works with dyn irq_desc
loop with irq_desc list
--- arch/x86/kernel/irq_64.c | 31 ++++++++++++++++++++++++------- fs/proc/proc_misc.c | 28 ++++++++++++++++++++++++---- 2 files changed, 48 insertions(+), 11 deletions(-)
arch/x86/kernel/irq_64.c +24 -7
@@ -70,9 +70,27 @@ static inline void stack_overflow_check(struct pt_regs *regs)int show_interrupts (struct seq_file *p,void *v) { -int i = *(loff_t *) v, j; +int i, j;struct irqaction * action;unsigned long flags; +unsigned int entries; +struct irq_desc *desc; +int tail =0 ; + +#ifdef CONFIG_HAVE_SPARSE_IRQ + desc = (struct irq_desc *)v; + entries =-1U ; + i = desc->irq; +if (!desc->next) + tail =1 ; +#else + entries = nr_irqs -1 ; + i = *(loff_t *) v; +if (i == nr_irqs) + tail =1 ; +else + desc =irq_desc (i); +#endif if (i ==0 ) {seq_printf (p," " );
@@ -81,12 +99,8 @@ int show_interrupts(struct seq_file *p, void *v)seq_putc (p,'\n' ); } -if (i < nr_irqs) { +if (i <= entries) {unsigned any_count =0 ; -struct irq_desc *desc =irq_desc (i); - -if (!desc) -return 0 ;spin_lock_irqsave (&desc->lock, flags);#ifndef CONFIG_SMP
@@ -116,7 +130,9 @@ int show_interrupts(struct seq_file *p, void *v)seq_putc (p,'\n' ); skip:spin_unlock_irqrestore (&desc->lock, flags); - }else if (i == nr_irqs) { + } + +if (tail) {seq_printf (p,"NMI: " );for_each_online_cpu (j)seq_printf (p,"%10u " ,cpu_pda (j)->__nmi_count);
@@ -155,6 +171,7 @@ skip:seq_printf (p," Spurious interrupts\n" );seq_printf (p,"ERR: %10u\n" ,atomic_read (&irq_err_count)); } +return 0 ; }
fs/proc/proc_misc.c +24 -4
@@ -633,15 +633,36 @@ static const struct file_operations proc_stat_operations = {*/ static void *int_seq_start (struct seq_file *f,loff_t *pos) { +#ifdef CONFIG_HAVE_SPARSE_IRQ +struct irq_desc *desc; +int irq; +int count = *pos; + +for_each_irq_desc (irq, desc) { +if (count-- ==0 ) +return desc; + } + +return NULL ; +#else return (*pos <= nr_irqs) ? pos :NULL ; +#endif } +static void *int_seq_next (struct seq_file *f,void *v,loff_t *pos) { +#ifdef CONFIG_HAVE_SPARSE_IRQ +struct irq_desc *desc; + + desc = ((struct irq_desc *)v)->next; (*pos)++; -if (*pos > nr_irqs) -return NULL ; -return pos; + +return desc; +#else + (*pos)++; +return (*pos <= nr_irqs) ? pos :NULL ; +#endif }static void int_seq_stop (struct seq_file *f,void *v)
@@ -649,7 +670,6 @@ static void int_seq_stop(struct seq_file *f, void *v)/* Nothing to do */ } -static const struct seq_operations int_seq_ops = { .start = int_seq_start, .next = int_seq_next,
Signature · 1 line
1.5.4.5
PATCH 41/42 x86_64: remove one nr_irqs in show_stat
loop with irq_desc list
--- fs/proc/proc_misc.c | 18 ++++++++---------- 1 files changed, 8 insertions(+), 10 deletions(-)
fs/proc/proc_misc.c +8 -10
@@ -567,20 +567,18 @@ static int show_stat(struct seq_file *p, void *v) }seq_printf (p,"intr %llu" , (unsigned long long )sum); -/* sum again ? it could be updated? have another field in irq_desc?*/ -for (j =0 ; j < nr_irqs; j++) { +/* sum again ? it could be updated? */ +for_each_irq_desc (j, desc) { per_irq_sum =0 ; - desc =irq_desc (j); -if (desc) -for_each_possible_cpu (i) { -unsigned int temp; +for_each_possible_cpu (i) { +unsigned int temp; - temp =kstat_irqs_cpu (j, i); - per_irq_sum += temp; - } + temp =kstat_irqs_cpu (j, i); + per_irq_sum += temp; + } -seq_printf (p," %u" , per_irq_sum); +seq_printf (p," %u:%u" , j, per_irq_sum); } seq_printf(p,
Signature · 1 line
1.5.4.5
PATCH 42/42 x86: put irq_2_iommu pointer into irq_desc
preallocate some irq_2_iommu, and use get_one_free_irq_2_iomm to get one and link to irq_desc if needed.
--- drivers/pci/intr_remapping.c | 213 ++++++++++++++++++++++++++++++++---------- include/linux/irq.h | 4 + 2 files changed, 169 insertions(+), 48 deletions(-)
drivers/pci/intr_remapping.c +165 -48
@@ -18,41 +18,136 @@ struct irq_2_iommu {u8 irte_mask; }; -#ifdef CONFIG_HAVE_DYNA_ARRAY -static struct irq_2_iommu *irq_2_iommu; -DEFINE_DYN_ARRAY (irq_2_iommu,sizeof (struct irq_2_iommu ), nr_irqs,PAGE_SIZE ,NULL ); +#ifdef CONFIG_HAVE_SPARSE_IRQ +static struct irq_2_iommu *irq_2_iommuX; +/* fill one page ? */ +static int nr_irq_2_iommu =0x100 ; +static int irq_2_iommu_index; +DEFINE_DYN_ARRAY (irq_2_iommuX,sizeof (struct irq_2_iommu ), nr_irq_2_iommu,PAGE_SIZE ,NULL ); + +extern void *__alloc_bootmem_nopanic (unsigned long size, +unsigned long align, +unsigned long goal); + +static struct irq_2_iommu *get_one_free_irq_2_iommu (int not_used) +{ +struct irq_2_iommu *iommu; +unsigned long total_bytes; + +if (irq_2_iommu_index >= nr_irq_2_iommu) { +/* +* we run out of pre-allocate ones, allocate more +*/ +printk (KERN_DEBUG "try to get more irq_2_iommu %d\n" , nr_irq_2_iommu); + + total_bytes =sizeof (struct irq_2_iommu )*nr_irq_2_iommu; + +if (after_bootmem) + iommu =kzalloc (total_bytes,GFP_ATOMIC ); +else + iommu =__alloc_bootmem_nopanic (total_bytes,PAGE_SIZE ,0 ); + +if (!iommu) +panic ("can not get more irq_2_iommu\n" ); + + irq_2_iommuX = iommu; + irq_2_iommu_index =0 ; + } + + iommu = &irq_2_iommuX[irq_2_iommu_index]; + irq_2_iommu_index++; +return iommu; +} + +static struct irq_2_iommu *irq_2_iommu (unsigned int irq) +{ +struct irq_desc *desc; + + desc =irq_desc (irq); + +BUG_ON (!desc); + +return desc->irq_2_iommu; +} + +static struct irq_2_iommu *irq_2_iommu_with_new (unsigned int irq) +{ +struct irq_desc *desc; +struct irq_2_iommu *irq_iommu; + + desc =irq_desc (irq); + +BUG_ON (!desc); + + irq_iommu = desc->irq_2_iommu; + +if (!irq_iommu) + desc->irq_2_iommu =get_one_free_irq_2_iommu (irq); + +return desc->irq_2_iommu; +} + +#else /* !CONFIG_HAVE_SPARSE_IRQ */ + +#ifdef CONFIG_HAVE_DYN_ARRAY +static struct irq_2_iommu *irq_2_iommuX; +DEFINE_DYN_ARRAY (irq_2_iommuX,sizeof (struct irq_2_iommu ), nr_irqs,PAGE_SIZE ,NULL );#else -static struct irq_2_iommu irq_2_iommu[NR_IRQS ]; +static struct irq_2_iommu irq_2_iommuX[NR_IRQS ]; +#endif + +static struct irq_2_iommu *irq_2_iommu (unsigned int irq) +{ +if (irq <= nr_irqs) +return &irq_2_iommuX[irq]; + +return NULL ; +} +static struct irq_2_iommu *irq_2_iommu_with_new (unsigned int irq) +{ +return irq_2_iommu (irq); +}#endif static DEFINE_SPINLOCK (irq_2_ir_lock); -int irq_remapped (int irq) +static struct irq_2_iommu *valid_irq_2_iommu (unsigned int irq) { -if (irq > nr_irqs) -return 0 ; +struct irq_2_iommu *irq_iommu; + + irq_iommu =irq_2_iommu (irq); -if (!irq_2_iommu[irq].iommu) -return 0 ; +if (!irq_iommu) +return NULL ; -return 1 ; +if (!irq_iommu->iommu) +return NULL ; + +return irq_iommu; +} + +int irq_remapped (int irq) +{ +return valid_irq_2_iommu (irq) !=NULL ; }int get_irte (int irq,struct irte *entry) {int index; +struct irq_2_iommu *irq_iommu; -if (!entry || irq > nr_irqs) +if (!entry)return -1 ;spin_lock (&irq_2_ir_lock); -if (!irq_2_iommu[irq].iommu) { + irq_iommu =valid_irq_2_iommu (irq); +if (!irq_iommu) {spin_unlock (&irq_2_ir_lock);return -1 ; } - index = irq_2_iommu[irq].irte_index + irq_2_iommu[irq].sub_handle; - *entry = *(irq_2_iommu[irq].iommu->ir_table->base + index); + index = irq_iommu->irte_index + irq_iommu->sub_handle; + *entry = *(irq_iommu->iommu->ir_table->base + index);spin_unlock (&irq_2_ir_lock);return 0 ;
@@ -61,6 +156,7 @@ int get_irte(int irq, struct irte *entry)int alloc_irte (struct intel_iommu *iommu,int irq,u16 count) {struct ir_table *table = iommu->ir_table; +struct irq_2_iommu *irq_iommu;u16 index, start_index;unsigned int mask =0 ;int i;
@@ -68,6 +164,12 @@ int alloc_irte(struct intel_iommu *iommu, int irq, u16 count)if (!count)return -1 ; +#ifndef CONFIG_HAVE_SPARSE_IRQ +/* protect irq_2_iommu_with_new later */ +if (irq >= nr_irqs) +return -1 ; +#endif +/* * start the IRTE search from index 0. */
@@ -107,10 +209,11 @@ int alloc_irte(struct intel_iommu *iommu, int irq, u16 count)for (i = index; i < index + count; i++) table->base[i].present =1 ; - irq_2_iommu[irq].iommu = iommu; - irq_2_iommu[irq].irte_index = index; - irq_2_iommu[irq].sub_handle =0 ; - irq_2_iommu[irq].irte_mask = mask; + irq_iommu =irq_2_iommu_with_new (irq); + irq_iommu->iommu = iommu; + irq_iommu->irte_index = index; + irq_iommu->sub_handle =0 ; + irq_iommu->irte_mask = mask;spin_unlock (&irq_2_ir_lock);
@@ -131,31 +234,36 @@ static void qi_flush_iec(struct intel_iommu *iommu, int index, int mask)int map_irq_to_irte_handle (int irq,u16 *sub_handle) {int index; +struct irq_2_iommu *irq_iommu;spin_lock (&irq_2_ir_lock); -if (irq >= nr_irqs || !irq_2_iommu[irq].iommu) { + irq_iommu =valid_irq_2_iommu (irq); +if (!irq_iommu) {spin_unlock (&irq_2_ir_lock);return -1 ; } - *sub_handle = irq_2_iommu[irq].sub_handle; - index = irq_2_iommu[irq].irte_index; + *sub_handle = irq_iommu->sub_handle; + index = irq_iommu->irte_index;spin_unlock (&irq_2_ir_lock);return index; }int set_irte_irq (int irq,struct intel_iommu *iommu,u16 index,u16 subhandle) { +struct irq_2_iommu *irq_iommu; +spin_lock (&irq_2_ir_lock); -if (irq >= nr_irqs || irq_2_iommu[irq].iommu) { + irq_iommu =valid_irq_2_iommu (irq); +if (!irq_iommu) {spin_unlock (&irq_2_ir_lock);return -1 ; } - irq_2_iommu[irq].iommu = iommu; - irq_2_iommu[irq].irte_index = index; - irq_2_iommu[irq].sub_handle = subhandle; - irq_2_iommu[irq].irte_mask =0 ; + irq_iommu->iommu = iommu; + irq_iommu->irte_index = index; + irq_iommu->sub_handle = subhandle; + irq_iommu->irte_mask =0 ;spin_unlock (&irq_2_ir_lock);
@@ -164,16 +272,19 @@ int set_irte_irq(int irq, struct intel_iommu *iommu, u16 index, u16 subhandle)int clear_irte_irq (int irq,struct intel_iommu *iommu,u16 index) { +struct irq_2_iommu *irq_iommu; +spin_lock (&irq_2_ir_lock); -if (irq >= nr_irqs || !irq_2_iommu[irq].iommu) { + irq_iommu =valid_irq_2_iommu (irq); +if (!irq_iommu) {spin_unlock (&irq_2_ir_lock);return -1 ; } - irq_2_iommu[irq].iommu =NULL ; - irq_2_iommu[irq].irte_index =0 ; - irq_2_iommu[irq].sub_handle =0 ; - irq_2_iommu[irq].irte_mask =0 ; + irq_iommu->iommu =NULL ; + irq_iommu->irte_index =0 ; + irq_iommu->sub_handle =0 ; +irq_2_iommu (irq)->irte_mask =0 ;spin_unlock (&irq_2_ir_lock);
@@ -185,16 +296,18 @@ int modify_irte(int irq, struct irte *irte_modified)int index;struct irte *irte;struct intel_iommu *iommu; +struct irq_2_iommu *irq_iommu;spin_lock (&irq_2_ir_lock); -if (irq >= nr_irqs || !irq_2_iommu[irq].iommu) { + irq_iommu =valid_irq_2_iommu (irq); +if (!irq_iommu) {spin_unlock (&irq_2_ir_lock);return -1 ; } - iommu = irq_2_iommu[irq].iommu; + iommu = irq_iommu->iommu; - index = irq_2_iommu[irq].irte_index + irq_2_iommu[irq].sub_handle; + index = irq_iommu->irte_index + irq_iommu->sub_handle; irte = &iommu->ir_table->base[index];set_64bit ((unsigned long *)irte, irte_modified->low | (1 <<1 ));
@@ -210,18 +323,20 @@ int flush_irte(int irq) {int index;struct intel_iommu *iommu; +struct irq_2_iommu *irq_iommu;spin_lock (&irq_2_ir_lock); -if (irq >= nr_irqs || !irq_2_iommu[irq].iommu) { + irq_iommu =valid_irq_2_iommu (irq); +if (!irq_iommu) {spin_unlock (&irq_2_ir_lock);return -1 ; } - iommu = irq_2_iommu[irq].iommu; + iommu = irq_iommu->iommu; - index = irq_2_iommu[irq].irte_index + irq_2_iommu[irq].sub_handle; + index = irq_iommu->irte_index + irq_iommu->sub_handle; -qi_flush_iec (iommu, index, irq_2_iommu[irq].irte_mask); +qi_flush_iec (iommu, index, irq_iommu->irte_mask);spin_unlock (&irq_2_ir_lock);return 0 ;
@@ -253,28 +368,30 @@ int free_irte(int irq)int index, i;struct irte *irte;struct intel_iommu *iommu; +struct irq_2_iommu *irq_iommu;spin_lock (&irq_2_ir_lock); -if (irq >= nr_irqs || !irq_2_iommu[irq].iommu) { + irq_iommu =valid_irq_2_iommu (irq); +if (!irq_iommu) {spin_unlock (&irq_2_ir_lock);return -1 ; } - iommu = irq_2_iommu[irq].iommu; + iommu = irq_iommu->iommu; - index = irq_2_iommu[irq].irte_index + irq_2_iommu[irq].sub_handle; + index = irq_iommu->irte_index + irq_iommu->sub_handle; irte = &iommu->ir_table->base[index]; -if (!irq_2_iommu[irq].sub_handle) { -for (i =0 ; i < (1 << irq_2_iommu[irq].irte_mask); i++) +if (!irq_iommu->sub_handle) { +for (i =0 ; i < (1 << irq_iommu->irte_mask); i++)set_64bit ((unsigned long *)irte,0 ); -qi_flush_iec (iommu, index, irq_2_iommu[irq].irte_mask); +qi_flush_iec (iommu, index, irq_iommu->irte_mask); } - irq_2_iommu[irq].iommu =NULL ; - irq_2_iommu[irq].irte_index =0 ; - irq_2_iommu[irq].sub_handle =0 ; - irq_2_iommu[irq].irte_mask =0 ; + irq_iommu->iommu =NULL ; + irq_iommu->irte_index =0 ; + irq_iommu->sub_handle =0 ; + irq_iommu->irte_mask =0 ;spin_unlock (&irq_2_ir_lock);
include/linux/irq.h +4 -0
@@ -142,6 +142,7 @@ struct irq_chip { };struct timer_rand_state ; +struct irq_2_iommu ;/** * struct irq_desc - interrupt descriptor *
@@ -177,6 +178,9 @@ struct irq_desc {unsigned int kstat_irqs[NR_CPUS ];#endif struct timer_rand_state *timer_rand_state; +#if defined(CONFIG_INTR_REMAP ) && defined(CONFIG_HAVE_SPARSE_IRQ ) +struct irq_2_iommu *irq_2_iommu; +#endif irq_flow_handler_t handle_irq;struct irq_chip *chip;struct msi_desc *msi_desc;
Signature · 1 line
1.5.4.5
Re: [PATCH 08/42] introduce nr_irqs
In reply to Yinghai LuQuoted 1 line · Yinghai Lu
and at this point it is equal
NR_IRQS
This patch is ok, but this approach is fundamentally broken. Only 19 architectures use GENERIC_HARDIRQS
The only required interface is interrupt.h not irq.h
So you may not replace NR_IRQS with nr_irqs in anything other then genirq code and some architecture code.
Doing so will break the build on several architectures.
Eric
Re: [PATCH 08/42] introduce nr_irqs
Quoted 7 lines · Eric W. Biederman
Quoted 1 line · Yinghai Lu
and at this point it is equal
NR_IRQSThis patch is ok, but this approach is fundamentally broken. Only 19 architectures use
GENERIC_HARDIRQS
Quoted 6 lines
The only required interface is
interrupt.hnotirq.hSo you may not replace
NR_IRQSwithnr_irqsin anything other then genirq code and some architecture code.Doing so will break the build on several architectures.
some platforms will not use include/linux/irq.h and kernel/irq/handle.c ?
YH
H. Peter Anvin
reviewerRe: [PATCH 08/42] introduce nr_irqs
Quoted 7 lines · Yinghai Lu
Quoted 6 lines · Eric W. Biederman
Quoted 1 line · Yinghai Lu
and at this point it is equal
NR_IRQSThis patch is ok, but this approach is fundamentally broken. Only 19 architectures use
GENERIC_HARDIRQS
Quoted 9 lines
Quoted 6 lines
The only required interface is
interrupt.hnotirq.hSo you may not replace
NR_IRQSwithnr_irqsin anything other then genirq code and some architecture code.Doing so will break the build on several architectures.
some platforms will not use
include/linux/irq.handkernel/irq/handle.c?
Also, what's the point, if it's just a renaming?
-hpa
Re: [PATCH 08/42] introduce nr_irqs
Quoted 17 lines · H. Peter Anvin
Quoted 16 lines · Yinghai Lu
Quoted 13 lines · Eric W. Biederman
Quoted 1 line · Yinghai Lu
and at this point it is equal
NR_IRQSThis patch is ok, but this approach is fundamentally broken. Only 19 architectures use
GENERIC_HARDIRQSThe only required interface is
interrupt.hnotirq.hSo you may not replace
NR_IRQSwithnr_irqsin anything other then genirq code and some architecture code.
Quoted 6 lines
Quoted 4 lines
Quoted 1 line
Doing so will break the build on several architectures.
some platforms will not use
include/linux/irq.handkernel/irq/handle.c?Also, what's the point, if it's just a renaming?
that is the start point.nr_irqs is variable, and will be probed later. and use that number to init dyn_alloc.
YH
Re: [PATCH 08/42] introduce nr_irqs
Quoted 5 lines · Yinghai Lu
Quoted 1 line
Also, what's the point, if it's just a renaming?
that is the start point.
nr_irqsis variable, and will be probed later. and use that number to initdyn_alloc.
YH.
In my conception the code in kernel/irq.c that today does:
struct irq_desc *desc;
if (irq >= NR_IRQS)
return -EINVAL;
desc = irq_desc + irq;
Should become:
struct irq_desc *desc;
desc = irq_desc(irq);
if (!desc)
return -EINVAL;
Eric
Re: [PATCH 08/42] introduce nr_irqs
Quoted 17 lines · Eric W. Biederman
Quoted 5 lines · Yinghai Lu
Quoted 1 line
Also, what's the point, if it's just a renaming?
that is the start point.
nr_irqsis variable, and will be probed later. and use that number to initdyn_alloc.YH.
In my conception the code in
kernel/irq.cthat today does:struct
irq_desc*desc;
if (irq >=NR_IRQS)
return-EINVAL;
desc =irq_desc+ irq;
Quoted 7 lines
Should become:
struct
irq_desc*desc;
desc =irq_desc(irq);
if (!desc)
return-EINVAL;
OK.
also want to introduce dummy
struct irq_desc
{
unsigned int irq;
};
in linux/interrupt.h if GENERIC_HARDIRQS is not defined. so could have same interfaceirq_desc()
andfor_each_irq_desc(irq, desc)
YH
Re: [PATCH 08/42] introduce nr_irqs
Quoted 34 lines · Yinghai Lu
Quoted 17 lines · Eric W. Biederman
Quoted 5 lines · Yinghai Lu
Quoted 1 line
Also, what's the point, if it's just a renaming?
that is the start point.
nr_irqsis variable, and will be probed later. and use that number to initdyn_alloc.YH.
In my conception the code in
kernel/irq.cthat today does:struct
irq_desc*desc;
if (irq >=NR_IRQS)
return-EINVAL;
desc =irq_desc+ irq;Quoted 7 lines
Should become:
struct
irq_desc*desc;
desc =irq_desc(irq);
if (!desc)
return-EINVAL;OK.
also want to introduce dummy
structirq_desc{ unsigned int irq; };
Quoted 5 lines
in
linux/interrupt.hifGENERIC_HARDIRQSis not defined. so could have same interfaceirq_desc()
andfor_each_irq_desc(irq, desc)
What would use it? irq_desc doesn't even exist if GENERIC_HARDIRQS are not defined.
Far far in the future we may want to introduce an opaque type struct irq. For use with linux/interrupt.h Allowing things like irq_request(struct irq *irq, ...); For now those kinds of interfaces should be internal to the genirq code.
Eric
Re: [PATCH 08/42] introduce nr_irqs
Quoted 42 lines · Eric W. Biederman
Quoted 34 lines · Yinghai Lu
Quoted 17 lines · Eric W. Biederman
Quoted 5 lines · Yinghai Lu
Quoted 1 line
Also, what's the point, if it's just a renaming?
that is the start point.
nr_irqsis variable, and will be probed later. and use that number to initdyn_alloc.YH.
In my conception the code in
kernel/irq.cthat today does:struct
irq_desc*desc;
if (irq >=NR_IRQS)
return-EINVAL;
desc =irq_desc+ irq;Quoted 7 lines
Should become:
struct
irq_desc*desc;
desc =irq_desc(irq);
if (!desc)
return-EINVAL;OK.
also want to introduce dummy
structirq_desc{ unsigned int irq; };Quoted 5 lines
in
linux/interrupt.hifGENERIC_HARDIRQSis not defined. so could have same interfaceirq_desc()
andfor_each_irq_desc(irq, desc)
Quoted 7 lines
What would use it?
irq_descdoesn't even exist ifGENERIC_HARDIRQSare not defined.Far far in the future we may want to introduce an opaque type struct irq. For use with
linux/interrupt.hAllowing things likeirq_request(struct irq *irq, ...); For now those kinds of interfaces should be internal to the genirq code.
From: Yinghai Lu <[email protected]>
Date: Fri, 8 Aug 2008 13:56:15 -0700
Subject: [PATCH 31/42] replace loop with nr_irqs for proc/stat
so don't all irq_desc at begining to allocate all. and only call that when needed
v2: make sure arch without GENERIC_HARDIRQS works too
--- fs/proc/proc_misc.c | 50 ++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 36 insertions(+), 14 deletions(-)
fs/proc/proc_misc.c +27 -14
@@ -495,17 +495,16 @@ static const struct file_operations procstatic int show_stat (struct seq_file *p,void *v) { -int i; +int i, j;unsigned long jif;cputime64_t user, nice, system, idle, iowait, irq, softirq, steal;cputime64_t guest;u64 sum =0 ;struct timespec boottime; -unsigned int *per_irq_sum; - - per_irq_sum =kzalloc (sizeof (unsigned int )*nr_irqs,GFP_KERNEL ); -if (!per_irq_sum) -return -ENOMEM ; +unsigned int per_irq_sum; +#ifdef CONFIG_GENERIC_HARDIRQS +struct irq_desc *desc; +#endif user = nice = system = idle = iowait = irq = softirq = steal = cputime64_zero;
@@ -514,8 +513,6 @@ static int show_stat(struct seq_file *p, jif = boottime.tv_sec;for_each_possible_cpu (i) { -int j; - user =cputime64_add (user,kstat_cpu (i).cpustat.user); nice =cputime64_add (nice,kstat_cpu (i).cpustat.nice); system =cputime64_add (system,kstat_cpu (i).cpustat.system);
@@ -525,10 +522,12 @@ static int show_stat(struct seq_file *p, softirq =cputime64_add (softirq,kstat_cpu (i).cpustat.softirq); steal =cputime64_add (steal,kstat_cpu (i).cpustat.steal); guest =cputime64_add (guest,kstat_cpu (i).cpustat.guest); -for (j =0 ; j < nr_irqs; j++) { -unsigned int temp =kstat_irqs_cpu (j, i); +for_each_irq_desc (j, desc) + { +unsigned int temp; + + temp =kstat_irqs_cpu (j, i); sum += temp; - per_irq_sum[j] += temp; } sum +=arch_irq_stat_cpu (i); }
@@ -571,8 +570,23 @@ static int show_stat(struct seq_file *p, }seq_printf (p,"intr %llu" , (unsigned long long )sum); -for (i =0 ; i < nr_irqs; i++) -seq_printf (p," %u" , per_irq_sum[i]); +/* sum again ? it could be updated? */ +for_each_irq_desc (j, desc) + { + per_irq_sum =0 ; +for_each_possible_cpu (i) { +unsigned int temp; + + temp =kstat_irqs_cpu (j, i); + per_irq_sum += temp; + } + +#ifdef CONFIG_HAVE_SPARSE_IRQ +seq_printf (p," %u:%u" , j, per_irq_sum); +#else +seq_printf (p," %u" , per_irq_sum); +#endif + }seq_printf (p, "\nctxt %llu\n"
@@ -586,7 +600,6 @@ static int show_stat(struct seq_file *p,nr_running (), nr_iowait()); -kfree (per_irq_sum);return 0 ; }
include/linux/interrupt.h +5 -0
@@ -17,6 +17,11 @@extern int nr_irqs; +#ifndef CONFIG_GENERIC_HARDIRQS +#define for_each_irq_desc (irq, desc) \ + for (irq = 0; irq < nr_irqs; irq++]) +#endif +/* * These correspond to the IORESOURCE_IRQ_* defines in * linux/ioport.h to select the interrupt line behaviour. When
Re: [PATCH 08/42] introduce nr_irqs
In reply to Yinghai LuQuoted 8 lines · Yinghai Lu
Quoted 7 lines · Eric W. Biederman
Quoted 1 line · Yinghai Lu
and at this point it is equal
NR_IRQSThis patch is ok, but this approach is fundamentally broken. Only 19 architectures use
GENERIC_HARDIRQS
Quoted 8 lines
Quoted 6 lines
The only required interface is
interrupt.hnotirq.hSo you may not replace
NR_IRQSwithnr_irqsin anything other then genirq code and some architecture code.Doing so will break the build on several architectures.
some platforms will not use
include/linux/irq.handkernel/irq/handle.c?
Yes. interrupt.h is the common infrastructure.
Eric
Re: [PATCH 08/42] introduce nr_irqs
Quoted 12 lines · Eric W. Biederman
Quoted 10 lines · Yinghai Lu
Quoted 9 lines · Eric W. Biederman
Quoted 1 line · Yinghai Lu
and at this point it is equal
NR_IRQSThis patch is ok, but this approach is fundamentally broken. Only 19 architectures use
GENERIC_HARDIRQSThe only required interface is
interrupt.hnotirq.h
Quoted 9 lines
Quoted 6 lines
Quoted 4 lines
So you may not replace
NR_IRQSwithnr_irqsin anything other then genirq code and some architecture code.Doing so will break the build on several architectures.
some platforms will not use
include/linux/irq.handkernel/irq/handle.c?Yes.
interrupt.his the common infrastructure.
ok, will move to that file.
YH
Re: [PATCH 08/42] introduce nr_irqs
Quoted 1 line · Yinghai Lu
ok, will move to that file.
???? If you introduce a new concept like valid_irq that is fine.interrupt.h is the interface to drivers!
Let me say this clearly.
DO NOT CHANGE THE INTERFACE TO DEVICE DRIVERS!
Eric
Re: [PATCH 08/42] introduce nr_irqs
Quoted 12 lines · Eric W. Biederman
Quoted 1 line · Yinghai Lu
ok, will move to that file.
???? If you introduce a new concept like
valid_irqthat is fine.interrupt.his the interface to drivers!Let me say this clearly.
DO NOT CHANGE THE INTERFACE TO DEVICE DRIVERS!
please check
include/linux/interrupt.h +2 -0
@@ -15,6 +15,8 @@#include <asm/ptrace.h> #include <asm/system.h> +extern int nr_irqs; +/* * These correspond to the IORESOURCE_IRQ_* defines in * linux/ioport.h to select the interrupt line behaviour. When
arch/m68k/kernel/ints.c +2 -0
@@ -46,6 +46,8 @@#include <asm/q40ints.h> #endif +int nr_irqs =NR_IRQS ; +extern u32 auto_irqhandler_fixup[];extern u32 user_irqhandler_fixup[];extern u16 user_irqvec_fixup[];
arch/s390/kernel/irq.c +2 -0
@@ -17,6 +17,8 @@#include <linux/proc_fs.h> #include <linux/profile.h> +int nr_irqs =NR_IRQS ; +/* * show_interrupts is needed by /proc/interrupts. */
arch/sparc/kernel/irq.c +3 -0
@@ -55,6 +55,9 @@#define SMP_NOP2 #define SMP_NOP3 #endif /* SMP */ + +int nr_irqs =NR_IRQS ; +unsigned long __raw_local_irq_save (void ) {unsigned long retval;
kernel/irq/handle.c +1 -0
@@ -47,6 +47,7 @@ handle_bad_irq(unsigned int irq, struct* * Controller mappings for all interrupt sources: */ +int nr_irqs =NR_IRQS ; struct irq_desc irq_desc[NR_IRQS] __cacheline_aligned_in_smp = { [0 ...NR_IRQS -1 ] = { .status =IRQ_DISABLED ,
Re: [PATCH 01/42] 8250: Remove NR_IRQ usage
In reply to Yinghai LuQuoted 5 lines · Yinghai Lu
From: Alan Cox <[email protected]>
Works on my test box with a quick test.
From: Alan Cox <[email protected]>
You missed the bug fix...
Eric
Re: [PATCH 01/42] 8250: Remove NR_IRQ usage
Quoted 10 lines · Eric W. Biederman
Quoted 5 lines · Yinghai Lu
From: Alan Cox <[email protected]>
Works on my test box with a quick test.
From: Alan Cox <[email protected]>
You missed the bug fix...
i got old one?
YH
H. Peter Anvin
reviewerQuoted 10 lines · Yinghai Lu
Please check
dyn_arraysupport for x86
v3: split changing tonr_irqsto small patches
fix checkpatch error
reorder the patch sequence to makedyn_arraysupport go at first
so could use that with arrays other thanNR_IRQS
v4: addCONFIG_HAVE_SPARSE_IRQwith list to use condensedirq_descarray
so could use 32 init, and init more if needed.
x86 32bit: haveCONFIG_HAVE_DYN_ARRAY
x86 64bit: haveCONFIG_HAVE_DYN_ARRAYandCONFIG_HAVE_SPARSE_IRQ
So I'm still clearly missing something about this... if we need sparse IRQs in the first place (which we do), what's the point of the dyn_array?
-hpa
Quoted 13 lines · H. Peter Anvin
Quoted 11 lines · Yinghai Lu
Please check
dyn_arraysupport for x86
v3: split changing tonr_irqsto small patches
fix checkpatch error
reorder the patch sequence to makedyn_arraysupport go at first
so could use that with arrays other thanNR_IRQS
v4: addCONFIG_HAVE_SPARSE_IRQwith list to use condensedirq_descarray
so could use 32 init, and init more if needed.
x86 32bit: haveCONFIG_HAVE_DYN_ARRAY
x86 64bit: haveCONFIG_HAVE_DYN_ARRAYandCONFIG_HAVE_SPARSE_IRQ
Quoted 2 lines
So I'm still clearly missing something about this... if we need sparse IRQs in the first place (which we do), what's the point of the
dyn_array?
x86_64: support CONFIG_HAVE_SPARSE_IRQ and CONFIG_DYN_ARRAYx86_32: support CONFIG_DYN_ARRAY
some arches could use dyn_array with probing nr_irqs and it could be 32 and much less than 224.
some could have that like 512. and those arch may not need to mess up with sparse_irq at first point.
but still could get some flexibilty about that array size.
YH
H. Peter Anvin
reviewerQuoted 4 lines · Yinghai Lu
Quoted 3 lines
Quoted 1 line
So I'm still clearly missing something about this... if we need sparse IRQs in the first place (which we do), what's the point of the
dyn_array?
Quoted 9 lines
x86_64: supportCONFIG_HAVE_SPARSE_IRQandCONFIG_DYN_ARRAYx86_32: supportCONFIG_DYN_ARRAYsome arches could use
dyn_arraywith probingnr_irqsand it could be 32 and much less than 224.
some could have that like 512. and those arch may not need to mess up withsparse_irqat first point.
but still could get some flexibilty about that array size.
As an x86 maintainer, I definitely do not want x86-64 and x86-32 to diverge unless there is an extremely strong reason to.
Other architectures may speak for themselves, but why not just support sparse IRQs on x86-32 *and* -64 and skip the dyn_array variant?
-=hpa
Quoted 16 lines · H. Peter Anvin
Quoted 5 lines · Yinghai Lu
Quoted 4 lines
Quoted 1 line
So I'm still clearly missing something about this... if we need sparse IRQs
in the first place (which we do), what's the point of thedyn_array?Quoted 9 lines
x86_64: supportCONFIG_HAVE_SPARSE_IRQandCONFIG_DYN_ARRAYx86_32: supportCONFIG_DYN_ARRAYsome arches could use
dyn_arraywith probingnr_irqsand it could be 32 and much less than 224.
some could have that like 512. and those arch may not need to mess up withsparse_irqat first point.
but still could get some flexibilty about that array size.
Quoted 5 lines
As an x86 maintainer, I definitely do not want x86-64 and x86-32 to diverge unless there is an extremely strong reason to.
Other architectures may speak for themselves, but why not just support sparse IRQs on x86-32 *and* -64 and skip the
dyn_arrayvariant?
after we merged io_apic_32.c into io_apic_64.c.
also I want to kill irq balance in io_apic_32.c, but no one say anything about it.
also dyn_array could have other user in addition to nr_irqs. i will dig it out like NR_CPUS/nr_cpu_ids related array. and Mike tried to put every thing to PER_CPU instead of array, maybe some case array would be effient than that. that make dyn_array some usage.
YH
H. Peter Anvin
reviewerQuoted 11 lines · Yinghai Lu
Quoted 2 lines
Other architectures may speak for themselves, but why not just support sparse IRQs on x86-32 *and* -64 and skip the
dyn_arrayvariant?after we merged
io_apic_32.cintoio_apic_64.c.
also I want to kill irq balance inio_apic_32.c, but no one say anything about it.also
dyn_arraycould have other user in addition tonr_irqs. i will dig it out like NR_CPUS/nr_cpu_ids related array. and Mike tried to put every thing toPER_CPUinstead of array, maybe some case array would be effient than that. that makedyn_arraysome usage.
Let the potental other users worry about it at that time. I understand it's a neat feature, but that doesn't justify adding it at this time if it's not the right thing forthe job.
I really don't want to see x86-32 and x86-64 diverge more, and I really don't want to throw in additional complexity if we don't really need it.
-hpa
H. Peter Anvin
reviewerQuoted 7 lines · Yinghai Lu
based on tip/master
to do:
so dynirq_descis done, and ready to:
makecreate_irqto get irq according to bus/dev/func/vector
Hm... I tried to check this in as a separate topic branch, but it conflicts against both linus and against tip:x86/core, which are the branches we usually base topic branches on.
I really am not convinced about the whole dyn_array concept, and *especially* not having divergences between 32 and 64 bits with regards to sparse IRQs. Furthermore, there are a number of checkpatch errors for this patch series, most of which appear legit.
So again... any reason to not just have sparse IRQs and be done with it?
-hpa
Quoted 4 lines · H. Peter Anvin
Quoted 3 lines · Yinghai Lu
based on tip/master
Quoted 8 lines
Quoted 4 lines
to do:
so dynirq_descis done, and ready to:
makecreate_irqto get irq according to bus/dev/func/vectorHm... I tried to check this in as a separate topic branch, but it conflicts against both linus and against tip:x86/core, which are the branches we usually base topic branches on.
Ingo said, I only need to work on tip/master, and you guys will sort it out. Eric's NR_IRQS patch for 2.6.27 is not in tip yet. --- Andrew picked up already
maybe i need put eric's patch before alan's patch in next sending...
Quoted 5 lines
I really am not convinced about the whole
dyn_arrayconcept, and *especially* not having divergences between 32 and 64 bits with regards to sparse IRQs. Furthermore, there are a number of checkpatch errors for this patch series, most of which appear legit.
will check it. it could be just replace irq_desc[] to irq_desc()...
Quoted 2 lines
So again... any reason to not just have sparse IRQs and be done with it?
another reason: dyn_arry == static in some case, so I could make sure compiling work well between static/dyn_array with sparse_irq.
YH
Quoted 10 lines · Yinghai Lu
Quoted 9 lines · H. Peter Anvin
Quoted 7 lines · Yinghai Lu
based on tip/master
to do:
so dynirq_descis done, and ready to:
makecreate_irqto get irq according to bus/dev/func/vector
Quoted 8 lines
Quoted 3 lines
Hm... I tried to check this in as a separate topic branch, but it conflicts against both linus and against tip:x86/core, which are the branches we usually base topic branches on.
Ingo said, I only need to work on tip/master, and you guys will sort it out. Eric's
NR_IRQSpatch for 2.6.27 is not in tip yet. --- Andrew picked up alreadymaybe i need put eric's patch before alan's patch in next sending...
Yes. Let's see if we can get that regression fix in there for 2.6.27...
Eric
Quoted 11 lines · H. Peter Anvin
Quoted 7 lines · Yinghai Lu
based on tip/master
to do:
so dynirq_descis done, and ready to:
makecreate_irqto get irq according to bus/dev/func/vectorFurthermore, there are a number of checkpatch errors for this patch series, most of which appear legit.
please check the attached v6
v6: fixed checkpatch errors.., only left warning about lines > 80 chars.
put Eric's patch about NR_IRQS at first
could be applied cleanly to tip/master
Thanks
Yinghai Lu