* [PATCH 00/42] dyn_array/nr_irqs/sparse_irq support v5
@ 2008-08-08 21:52 Yinghai Lu
2008-08-08 21:52 ` [PATCH 01/42] 8250: Remove NR_IRQ usage Yinghai Lu
` (2 more replies)
0 siblings, 3 replies; 66+ messages in thread
From: Yinghai Lu @ 2008-08-08 21:52 UTC (permalink / raw)
To: Ingo Molnar, Thomas Gleixner, H. Peter Anvin, Eric W. Biederman,
Dhaval Giani, Mike Travis, Andrew Morton
Cc: linux-kernel, Yinghai Lu
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
^ permalink raw reply [flat|nested] 66+ messages in thread
* [PATCH 01/42] 8250: Remove NR_IRQ usage
2008-08-08 21:52 [PATCH 00/42] dyn_array/nr_irqs/sparse_irq support v5 Yinghai Lu
@ 2008-08-08 21:52 ` Yinghai Lu
2008-08-08 21:52 ` [PATCH 02/42] x86: add after_bootmem for 32bit Yinghai Lu
2008-08-08 22:38 ` [PATCH 01/42] 8250: Remove NR_IRQ usage Eric W. Biederman
2008-08-08 22:01 ` [PATCH 00/42] dyn_array/nr_irqs/sparse_irq support v5 H. Peter Anvin
2008-08-08 22:19 ` H. Peter Anvin
2 siblings, 2 replies; 66+ messages in thread
From: Yinghai Lu @ 2008-08-08 21:52 UTC (permalink / raw)
To: Ingo Molnar, Thomas Gleixner, H. Peter Anvin, Eric W. Biederman,
Dhaval Giani, Mike Travis, Andrew Morton
Cc: linux-kernel, Alan Cox
From: Alan Cox <alan@redhat.com>
Works on my test box with a quick test.
From: Alan Cox <alan@redhat.com>
Signed-off-by: Alan Cox <alan@redhat.com>
---
drivers/serial/68328serial.c | 11 +-----
drivers/serial/8250.c | 73 +++++++++++++++++++++++++++++++++--------
2 files changed, 60 insertions(+), 24 deletions(-)
diff --git a/drivers/serial/68328serial.c b/drivers/serial/68328serial.c
index 381b12a..277b78d 100644
--- a/drivers/serial/68328serial.c
+++ b/drivers/serial/68328serial.c
@@ -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);
diff --git a/drivers/serial/8250.c b/drivers/serial/8250.c
index 3a4d677..71c8e68 100644
--- a/drivers/serial/8250.c
+++ b/drivers/serial/8250.c
@@ -145,11 +145,15 @@ struct uart_8250_port {
};
struct irq_info {
- spinlock_t lock;
+ struct hlist_node node;
+ int irq;
+ spinlock_t lock; /* Protects list not the hash */
struct list_head *head;
};
-static struct irq_info irq_lists[NR_IRQS];
+#define NR_IRQ_HASH 32 /* Can be adjusted later */
+static struct hlist_head irq_lists[NR_IRQ_HASH];
+static DEFINE_MUTEX(hash_mutex); /* Used to walk the hash */
/*
* Here we define the default xmit fifo size used for each type of UART.
@@ -1548,15 +1552,43 @@ static void serial_do_unlink(struct irq_info *i, struct uart_8250_port *up)
BUG_ON(i->head != &up->list);
i->head = NULL;
}
-
spin_unlock_irq(&i->lock);
+ /* List empty so throw away the hash node */
+ if (i->head == NULL) {
+ hlist_del(&i->node);
+ kfree(i);
+ }
}
static int serial_link_irq_chain(struct uart_8250_port *up)
{
- struct irq_info *i = irq_lists + up->port.irq;
+ struct hlist_head *h;
+ struct hlist_node *n;
+ struct irq_info *i;
int ret, irq_flags = up->port.flags & UPF_SHARE_IRQ ? IRQF_SHARED : 0;
+ mutex_lock(&hash_mutex);
+
+ h = &irq_lists[up->port.irq % NR_IRQ_HASH];
+
+ hlist_for_each(n, h) {
+ i = hlist_entry(n, struct irq_info, node);
+ if (i->irq == up->port.irq)
+ break;
+ }
+
+ if (n == NULL) {
+ i = kzalloc(sizeof(struct irq_info), GFP_KERNEL);
+ if (i == NULL) {
+ mutex_unlock(&hash_mutex);
+ return -ENOMEM;
+ }
+ spin_lock_init(&i->lock);
+ i->irq = up->port.irq;
+ hlist_add_head(&i->node, h);
+ }
+ mutex_unlock(&hash_mutex);
+
spin_lock_irq(&i->lock);
if (i->head) {
@@ -1580,14 +1612,28 @@ static int serial_link_irq_chain(struct uart_8250_port *up)
static void serial_unlink_irq_chain(struct uart_8250_port *up)
{
- struct irq_info *i = irq_lists + up->port.irq;
+ struct irq_info *i;
+ struct hlist_node *n;
+ struct hlist_head *h;
- BUG_ON(i->head == NULL);
+ mutex_lock(&hash_mutex);
- if (list_empty(i->head))
+ h = &irq_lists[up->port.irq % NR_IRQ_HASH];
+
+ hlist_for_each(n, h) {
+ i = hlist_entry(n, struct irq_info, node);
+ if (i->irq == up->port.irq)
+ break;
+ }
+
+ BUG_ON(n == NULL);
+ BUG_ON(i->head == NULL);
+
+ if (list_empty(i->head)) {
free_irq(up->port.irq, i);
-
+ }
serial_do_unlink(i, up);
+ mutex_unlock(&hash_mutex);
}
/* Base timer interval for polling */
@@ -2955,7 +3001,7 @@ EXPORT_SYMBOL(serial8250_unregister_port);
static int __init serial8250_init(void)
{
- int ret, i;
+ int ret;
if (nr_uarts > UART_NR)
nr_uarts = UART_NR;
@@ -2964,9 +3010,6 @@ static int __init serial8250_init(void)
"%d ports, IRQ sharing %sabled\n", nr_uarts,
share_irqs ? "en" : "dis");
- for (i = 0; i < NR_IRQS; i++)
- spin_lock_init(&irq_lists[i].lock);
-
ret = uart_register_driver(&serial8250_reg);
if (ret)
goto out;
@@ -2989,11 +3032,11 @@ static int __init serial8250_init(void)
goto out;
platform_device_del(serial8250_isa_devs);
- put_dev:
+put_dev:
platform_device_put(serial8250_isa_devs);
- unreg_uart_drv:
+unreg_uart_drv:
uart_unregister_driver(&serial8250_reg);
- out:
+out:
return ret;
}
--
1.5.4.5
^ permalink raw reply related [flat|nested] 66+ messages in thread
* [PATCH 02/42] x86: add after_bootmem for 32bit
2008-08-08 21:52 ` [PATCH 01/42] 8250: Remove NR_IRQ usage Yinghai Lu
@ 2008-08-08 21:52 ` Yinghai Lu
2008-08-08 21:52 ` [PATCH 03/42] x86: remove irq_vectors_limits Yinghai Lu
2008-08-08 22:38 ` [PATCH 01/42] 8250: Remove NR_IRQ usage Eric W. Biederman
1 sibling, 1 reply; 66+ messages in thread
From: Yinghai Lu @ 2008-08-08 21:52 UTC (permalink / raw)
To: Ingo Molnar, Thomas Gleixner, H. Peter Anvin, Eric W. Biederman,
Dhaval Giani, Mike Travis, Andrew Morton
Cc: linux-kernel, Yinghai Lu
to prepare to use dyn_array support etc.
Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
---
arch/x86/mm/init_32.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/arch/x86/mm/init_32.c b/arch/x86/mm/init_32.c
index 4974e97..b5c1751 100644
--- a/arch/x86/mm/init_32.c
+++ b/arch/x86/mm/init_32.c
@@ -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;
--
1.5.4.5
^ permalink raw reply related [flat|nested] 66+ messages in thread
* [PATCH 03/42] x86: remove irq_vectors_limits
2008-08-08 21:52 ` [PATCH 02/42] x86: add after_bootmem for 32bit Yinghai Lu
@ 2008-08-08 21:52 ` Yinghai Lu
2008-08-08 21:52 ` [PATCH 04/42] add dyn_array support Yinghai Lu
0 siblings, 1 reply; 66+ messages in thread
From: Yinghai Lu @ 2008-08-08 21:52 UTC (permalink / raw)
To: Ingo Molnar, Thomas Gleixner, H. Peter Anvin, Eric W. Biederman,
Dhaval Giani, Mike Travis, Andrew Morton
Cc: linux-kernel, Yinghai Lu
no user
Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
---
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
diff --git a/include/asm-x86/mach-generic/irq_vectors_limits.h b/include/asm-x86/mach-generic/irq_vectors_limits.h
deleted file mode 100644
index f7870e1..0000000
--- a/include/asm-x86/mach-generic/irq_vectors_limits.h
+++ /dev/null
@@ -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 */
diff --git a/include/asm-x86/summit/irq_vectors_limits.h b/include/asm-x86/summit/irq_vectors_limits.h
deleted file mode 100644
index 890ce3f..0000000
--- a/include/asm-x86/summit/irq_vectors_limits.h
+++ /dev/null
@@ -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 */
--
1.5.4.5
^ permalink raw reply related [flat|nested] 66+ messages in thread
* [PATCH 04/42] add dyn_array support
2008-08-08 21:52 ` [PATCH 03/42] x86: remove irq_vectors_limits Yinghai Lu
@ 2008-08-08 21:52 ` Yinghai Lu
2008-08-08 21:52 ` [PATCH 05/42] add per_cpu_dyn_array support Yinghai Lu
0 siblings, 1 reply; 66+ messages in thread
From: Yinghai Lu @ 2008-08-08 21:52 UTC (permalink / raw)
To: Ingo Molnar, Thomas Gleixner, H. Peter Anvin, Eric W. Biederman,
Dhaval Giani, Mike Travis, Andrew Morton
Cc: linux-kernel, Yinghai Lu
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()
Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
---
include/asm-generic/vmlinux.lds.h | 7 +++++++
include/linux/init.h | 23 +++++++++++++++++++++++
init/main.c | 24 ++++++++++++++++++++++++
3 files changed, 54 insertions(+), 0 deletions(-)
diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
index a44ec7a..1c3daac 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -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) = .; \
diff --git a/include/linux/init.h b/include/linux/init.h
index 915c5b9..c31cd94 100644
--- a/include/linux/init.h
+++ b/include/linux/init.h
@@ -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__ */
/**
diff --git a/init/main.c b/init/main.c
index 3f8fa37..a53f1cf 100644
--- a/init/main.c
+++ b/init/main.c
@@ -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();
--
1.5.4.5
^ permalink raw reply related [flat|nested] 66+ messages in thread
* [PATCH 05/42] add per_cpu_dyn_array support
2008-08-08 21:52 ` [PATCH 04/42] add dyn_array support Yinghai Lu
@ 2008-08-08 21:52 ` Yinghai Lu
2008-08-08 21:52 ` [PATCH 06/42] x86: alloc dyn_array all alltogether Yinghai Lu
0 siblings, 1 reply; 66+ messages in thread
From: Yinghai Lu @ 2008-08-08 21:52 UTC (permalink / raw)
To: Ingo Molnar, Thomas Gleixner, H. Peter Anvin, Eric W. Biederman,
Dhaval Giani, Mike Travis, Andrew Morton
Cc: linux-kernel, Yinghai Lu
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
Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
---
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(-)
diff --git a/arch/x86/kernel/setup_percpu.c b/arch/x86/kernel/setup_percpu.c
index 0e67f72..13ba7a8 100644
--- a/arch/x86/kernel/setup_percpu.c
+++ b/arch/x86/kernel/setup_percpu.c
@@ -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",
diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
index 1c3daac..e76244a 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -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) { \
diff --git a/include/linux/init.h b/include/linux/init.h
index c31cd94..9fbe61b 100644
--- a/include/linux/init.h
+++ b/include/linux/init.h
@@ -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__ */
/**
diff --git a/init/main.c b/init/main.c
index a53f1cf..18478d3 100644
--- a/init/main.c
+++ b/init/main.c
@@ -394,17 +394,19 @@ EXPORT_SYMBOL(__per_cpu_offset);
static void __init setup_per_cpu_areas(void)
{
- unsigned long size, i;
+ unsigned long size, i, old_size;
char *ptr;
unsigned long nr_possible_cpus = num_possible_cpus();
/* Copy section for each CPU (we discard the original) */
- size = ALIGN(PERCPU_ENOUGH_ROOM, PAGE_SIZE);
+ old_size = PERCPU_ENOUGH_ROOM;
+ size = ALIGN(old_size + per_cpu_dyn_array_size(), PAGE_SIZE);
ptr = alloc_bootmem_pages(size * nr_possible_cpus);
for_each_possible_cpu(i) {
__per_cpu_offset[i] = ptr - __per_cpu_start;
memcpy(ptr, __per_cpu_start, __per_cpu_end - __per_cpu_start);
+ per_cpu_alloc_dyn_array(cpu, ptr + old_size);
ptr += size;
}
}
@@ -562,6 +564,63 @@ void pre_alloc_dyn_array(void)
#endif
}
+unsigned long per_cpu_dyn_array_size(void)
+{
+ unsigned long total_size = 0;
+#ifdef CONFIG_HAVE_DYN_ARRAY
+ unsigned long size;
+ struct dyn_array **daa;
+
+ for (daa = __per_cpu_dyn_array_start ; daa < __per_cpu_dyn_array_end; daa++) {
+ struct dyn_array *da = *daa;
+
+ size = da->size * (*da->nr);
+ print_fn_descriptor_symbol("per_cpu_dyna_array %s ", da->name);
+ printk(KERN_CONT "size:%#lx nr:%d align:%#lx\n",
+ da->size, *da->nr, da->align);
+ total_size += roundup(size, da->align);
+ }
+ if (total_size)
+ printk(KERN_DEBUG "per_cpu_dyna_array total_size: %#lx\n",
+ total_size);
+#endif
+ return total_size;
+}
+
+void per_cpu_alloc_dyn_array(int cpu, char *ptr)
+{
+#ifdef CONFIG_HAVE_DYN_ARRAY
+ unsigned long size, phys;
+ struct dyn_array **daa;
+ unsigned long addr;
+ void **array;
+
+ phys = virt_to_phys(ptr);
+
+ for (daa = __per_cpu_dyn_array_start ; daa < __per_cpu_dyn_array_end; daa++) {
+ struct dyn_array *da = *daa;
+
+ size = da->size * (*da->nr);
+ print_fn_descriptor_symbol("per_cpu_dyna_array %s ", da->name);
+ printk(KERN_CONT "size:%#lx nr:%d align:%#lx",
+ da->size, *da->nr, da->align);
+
+ phys = roundup(phys, da->align);
+ addr = (unsigned long)da->name;
+ addr += per_cpu_offset(cpu);
+ array = (void **)addr;
+ *array = phys_to_virt(phys);
+ *da->name = *array; /* so init_work could use it directly */
+ printk(KERN_CONT " %p ==> [%#lx - %#lx]\n", array, phys, phys + size);
+ phys += size;
+
+ if (da->init_work) {
+ da->init_work(da);
+ }
+ }
+#endif
+}
+
asmlinkage void __init start_kernel(void)
{
char * command_line;
--
1.5.4.5
^ permalink raw reply related [flat|nested] 66+ messages in thread
* [PATCH 06/42] x86: alloc dyn_array all alltogether
2008-08-08 21:52 ` [PATCH 05/42] add per_cpu_dyn_array support Yinghai Lu
@ 2008-08-08 21:52 ` Yinghai Lu
2008-08-08 21:52 ` [PATCH 07/42] x86: enable dyn_array support Yinghai Lu
0 siblings, 1 reply; 66+ messages in thread
From: Yinghai Lu @ 2008-08-08 21:52 UTC (permalink / raw)
To: Ingo Molnar, Thomas Gleixner, H. Peter Anvin, Eric W. Biederman,
Dhaval Giani, Mike Travis, Andrew Morton
Cc: linux-kernel, Yinghai Lu
so could spare some memory with small alignment in bootmem
also tighten the alignment checking..., and make print out less debug info
Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
---
arch/x86/kernel/setup_percpu.c | 16 +++++++---
include/linux/init.h | 2 +-
init/main.c | 65 ++++++++++++++++++++++++++++++---------
3 files changed, 62 insertions(+), 21 deletions(-)
diff --git a/arch/x86/kernel/setup_percpu.c b/arch/x86/kernel/setup_percpu.c
index 13ba7a8..2b7dab6 100644
--- a/arch/x86/kernel/setup_percpu.c
+++ b/arch/x86/kernel/setup_percpu.c
@@ -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));
diff --git a/include/linux/init.h b/include/linux/init.h
index 9fbe61b..2e42af8 100644
--- a/include/linux/init.h
+++ b/include/linux/init.h
@@ -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__ */
diff --git a/init/main.c b/init/main.c
index 18478d3..3454b4a 100644
--- a/init/main.c
+++ b/init/main.c
@@ -397,10 +397,14 @@ static void __init setup_per_cpu_areas(void)
unsigned long size, i, old_size;
char *ptr;
unsigned long nr_possible_cpus = num_possible_cpus();
+ unsigned long align = 1;
+ unsigned da_size;
/* Copy section for each CPU (we discard the original) */
old_size = PERCPU_ENOUGH_ROOM;
- size = ALIGN(old_size + per_cpu_dyn_array_size(), PAGE_SIZE);
+ da_size = per_cpu_dyn_array_size(&align);
+ align = max_t(unsigned long, PAGE_SIZE, align);
+ size = ALIGN(old_size + da_size, align);
ptr = alloc_bootmem_pages(size * nr_possible_cpus);
for_each_possible_cpu(i) {
@@ -544,45 +548,78 @@ void __init __weak thread_info_cache_init(void)
void pre_alloc_dyn_array(void)
{
#ifdef CONFIG_HAVE_DYN_ARRAY
- unsigned long size, phys = 0;
+ unsigned long total_size = 0, size, phys;
+ unsigned long max_align = 1;
struct dyn_array **daa;
+ char *ptr;
+ /* get the total size at first */
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",
+ print_fn_descriptor_symbol("dyn_array %s ", da->name);
+ printk(KERN_CONT "size:%#lx nr:%d align:%#lx\n",
da->size, *da->nr, da->align);
- *da->name = __alloc_bootmem(size, da->align, phys);
- phys = virt_to_phys(*da->name);
+ total_size += roundup(size, da->align);
+ if (da->align > max_align)
+ max_align = da->align;
+ }
+ if (total_size)
+ printk(KERN_DEBUG "dyn_array total_size: %#lx\n",
+ total_size);
+ else
+ return;
+
+ /* allocate them all together */
+ max_align = max_t(unsigned long, max_align, PAGE_SIZE);
+ ptr = __alloc_bootmem_nopanic(total_size, max_align, 0);
+ if (!ptr)
+ panic("Can not alloc dyn_alloc\n");
+
+ phys = virt_to_phys(ptr);
+ for (daa = __dyn_array_start ; daa < __dyn_array_end; daa++) {
+ struct dyn_array *da = *daa;
+
+ size = da->size * (*da->nr);
+ print_fn_descriptor_symbol("dyn_array %s ", da->name);
+
+ phys = roundup(phys, da->align);
+ *da->name = phys_to_virt(phys);
printk(KERN_CONT " ==> [%#lx - %#lx]\n", phys, phys + size);
+ phys += size;
+
if (da->init_work)
da->init_work(da);
}
#endif
}
-unsigned long per_cpu_dyn_array_size(void)
+unsigned long per_cpu_dyn_array_size(unsigned long *align)
{
unsigned long total_size = 0;
#ifdef CONFIG_HAVE_DYN_ARRAY
unsigned long size;
struct dyn_array **daa;
+ unsigned max_align = 1;
for (daa = __per_cpu_dyn_array_start ; daa < __per_cpu_dyn_array_end; daa++) {
struct dyn_array *da = *daa;
size = da->size * (*da->nr);
- print_fn_descriptor_symbol("per_cpu_dyna_array %s ", da->name);
+ print_fn_descriptor_symbol("per_cpu_dyn_array %s ", da->name);
printk(KERN_CONT "size:%#lx nr:%d align:%#lx\n",
da->size, *da->nr, da->align);
total_size += roundup(size, da->align);
+ if (da->align > max_align)
+ max_align = da->align;
}
- if (total_size)
- printk(KERN_DEBUG "per_cpu_dyna_array total_size: %#lx\n",
+ if (total_size) {
+ printk(KERN_DEBUG "per_cpu_dyn_array total_size: %#lx\n",
total_size);
+ *align = max_align;
+ }
#endif
return total_size;
}
@@ -596,14 +633,11 @@ void per_cpu_alloc_dyn_array(int cpu, char *ptr)
void **array;
phys = virt_to_phys(ptr);
-
for (daa = __per_cpu_dyn_array_start ; daa < __per_cpu_dyn_array_end; daa++) {
struct dyn_array *da = *daa;
size = da->size * (*da->nr);
- print_fn_descriptor_symbol("per_cpu_dyna_array %s ", da->name);
- printk(KERN_CONT "size:%#lx nr:%d align:%#lx",
- da->size, *da->nr, da->align);
+ print_fn_descriptor_symbol("per_cpu_dyn_array %s ", da->name);
phys = roundup(phys, da->align);
addr = (unsigned long)da->name;
@@ -611,7 +645,8 @@ void per_cpu_alloc_dyn_array(int cpu, char *ptr)
array = (void **)addr;
*array = phys_to_virt(phys);
*da->name = *array; /* so init_work could use it directly */
- printk(KERN_CONT " %p ==> [%#lx - %#lx]\n", array, phys, phys + size);
+ printk(KERN_CONT " ==> [%#lx - %#lx]\n", phys, phys + size);
+
phys += size;
if (da->init_work) {
--
1.5.4.5
^ permalink raw reply related [flat|nested] 66+ messages in thread
* [PATCH 07/42] x86: enable dyn_array support
2008-08-08 21:52 ` [PATCH 06/42] x86: alloc dyn_array all alltogether Yinghai Lu
@ 2008-08-08 21:52 ` Yinghai Lu
2008-08-08 21:52 ` [PATCH 08/42] introduce nr_irqs Yinghai Lu
0 siblings, 1 reply; 66+ messages in thread
From: Yinghai Lu @ 2008-08-08 21:52 UTC (permalink / raw)
To: Ingo Molnar, Thomas Gleixner, H. Peter Anvin, Eric W. Biederman,
Dhaval Giani, Mike Travis, Andrew Morton
Cc: linux-kernel, Yinghai Lu
Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
---
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(-)
diff --git a/arch/Kconfig b/arch/Kconfig
index 0267bab..c1f9feb 100644
--- a/arch/Kconfig
+++ b/arch/Kconfig
@@ -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
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index bd30e8b..d30b101 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -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
diff --git a/arch/x86/kernel/vmlinux_32.lds.S b/arch/x86/kernel/vmlinux_32.lds.S
index 248a575..20b835a 100644
--- a/arch/x86/kernel/vmlinux_32.lds.S
+++ b/arch/x86/kernel/vmlinux_32.lds.S
@@ -145,6 +145,7 @@ SECTIONS
*(.x86cpuvendor.init)
__x86cpuvendor_end = .;
}
+ DYN_ARRAY_INIT(8)
SECURITY_INIT
. = ALIGN(4);
.altinstructions : AT(ADDR(.altinstructions) - LOAD_OFFSET) {
diff --git a/arch/x86/kernel/vmlinux_64.lds.S b/arch/x86/kernel/vmlinux_64.lds.S
index 63e5c1a..5b9cc10 100644
--- a/arch/x86/kernel/vmlinux_64.lds.S
+++ b/arch/x86/kernel/vmlinux_64.lds.S
@@ -174,6 +174,9 @@ SECTIONS
*(.x86cpuvendor.init)
}
__x86cpuvendor_end = .;
+
+ DYN_ARRAY_INIT(8)
+
SECURITY_INIT
. = ALIGN(8);
--
1.5.4.5
^ permalink raw reply related [flat|nested] 66+ messages in thread
* [PATCH 08/42] introduce nr_irqs
2008-08-08 21:52 ` [PATCH 07/42] x86: enable dyn_array support Yinghai Lu
@ 2008-08-08 21:52 ` Yinghai Lu
2008-08-08 21:52 ` [PATCH 09/42] x86: using nr_irqs Yinghai Lu
2008-08-09 1:00 ` [PATCH 08/42] introduce nr_irqs Eric W. Biederman
0 siblings, 2 replies; 66+ messages in thread
From: Yinghai Lu @ 2008-08-08 21:52 UTC (permalink / raw)
To: Ingo Molnar, Thomas Gleixner, H. Peter Anvin, Eric W. Biederman,
Dhaval Giani, Mike Travis, Andrew Morton
Cc: linux-kernel, Yinghai Lu
and at this point it is equal NR_IRQS
Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
---
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(-)
diff --git a/include/linux/irq.h b/include/linux/irq.h
index 1d73d1a..bd69d90 100644
--- a/include/linux/irq.h
+++ b/include/linux/irq.h
@@ -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);
diff --git a/kernel/irq/autoprobe.c b/kernel/irq/autoprobe.c
index 533068c..c689e98 100644
--- a/kernel/irq/autoprobe.c
+++ b/kernel/irq/autoprobe.c
@@ -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;
diff --git a/kernel/irq/chip.c b/kernel/irq/chip.c
index 3cd441e..20a9307 100644
--- a/kernel/irq/chip.c
+++ b/kernel/irq/chip.c
@@ -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;
diff --git a/kernel/irq/handle.c b/kernel/irq/handle.c
index f4c8a03..e9d022c 100644
--- a/kernel/irq/handle.c
+++ b/kernel/irq/handle.c
@@ -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);
}
diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c
index 22d10d3..3bd67c8 100644
--- a/kernel/irq/manage.c
+++ b/kernel/irq/manage.c
@@ -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;
diff --git a/kernel/irq/proc.c b/kernel/irq/proc.c
index 6c6d35d..74d7922 100644
--- a/kernel/irq/proc.c
+++ b/kernel/irq/proc.c
@@ -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);
}
diff --git a/kernel/irq/resend.c b/kernel/irq/resend.c
index a804679..cba8aa5 100644
--- a/kernel/irq/resend.c
+++ b/kernel/irq/resend.c
@@ -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();
diff --git a/kernel/irq/spurious.c b/kernel/irq/spurious.c
index 19fe9d6..e26ca1e 100644
--- a/kernel/irq/spurious.c
+++ b/kernel/irq/spurious.c
@@ -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;
--
1.5.4.5
^ permalink raw reply related [flat|nested] 66+ messages in thread
* [PATCH 09/42] x86: using nr_irqs
2008-08-08 21:52 ` [PATCH 08/42] introduce nr_irqs Yinghai Lu
@ 2008-08-08 21:52 ` Yinghai Lu
2008-08-08 21:52 ` [PATCH 10/42] drivers/char to use nr_irqs Yinghai Lu
2008-08-09 1:00 ` [PATCH 08/42] introduce nr_irqs Eric W. Biederman
1 sibling, 1 reply; 66+ messages in thread
From: Yinghai Lu @ 2008-08-08 21:52 UTC (permalink / raw)
To: Ingo Molnar, Thomas Gleixner, H. Peter Anvin, Eric W. Biederman,
Dhaval Giani, Mike Travis, Andrew Morton
Cc: linux-kernel, Yinghai Lu
also add first_free_entry and pin_map_size
Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
---
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(-)
diff --git a/arch/x86/kernel/io_apic_32.c b/arch/x86/kernel/io_apic_32.c
index 7f0d88c..d5953ff 100644
--- a/arch/x86/kernel/io_apic_32.c
+++ b/arch/x86/kernel/io_apic_32.c
@@ -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)
diff --git a/arch/x86/kernel/io_apic_64.c b/arch/x86/kernel/io_apic_64.c
index 8800743..456f2e7 100644
--- a/arch/x86/kernel/io_apic_64.c
+++ b/arch/x86/kernel/io_apic_64.c
@@ -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)
diff --git a/arch/x86/kernel/irq_32.c b/arch/x86/kernel/irq_32.c
index 1cf8c1f..0cff2f4 100644
--- a/arch/x86/kernel/irq_32.c
+++ b/arch/x86/kernel/irq_32.c
@@ -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;
diff --git a/arch/x86/kernel/irq_64.c b/arch/x86/kernel/irq_64.c
index 1f78b23..de94c60 100644
--- a/arch/x86/kernel/irq_64.c
+++ b/arch/x86/kernel/irq_64.c
@@ -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;
diff --git a/arch/x86/kernel/irqinit_32.c b/arch/x86/kernel/irqinit_32.c
index d669142..b13d932 100644
--- a/arch/x86/kernel/irqinit_32.c
+++ b/arch/x86/kernel/irqinit_32.c
@@ -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))
diff --git a/arch/x86/kernel/irqinit_64.c b/arch/x86/kernel/irqinit_64.c
index 1f26fd9..48674e6 100644
--- a/arch/x86/kernel/irqinit_64.c
+++ b/arch/x86/kernel/irqinit_64.c
@@ -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;
diff --git a/include/asm-x86/irq.h b/include/asm-x86/irq.h
index 1e5f290..2a130c4 100644
--- a/include/asm-x86/irq.h
+++ b/include/asm-x86/irq.h
@@ -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);
--
1.5.4.5
^ permalink raw reply related [flat|nested] 66+ messages in thread
* [PATCH 10/42] drivers/char to use nr_irqs
2008-08-08 21:52 ` [PATCH 09/42] x86: using nr_irqs Yinghai Lu
@ 2008-08-08 21:52 ` Yinghai Lu
2008-08-08 21:52 ` [PATCH 11/42] drivers/net " Yinghai Lu
0 siblings, 1 reply; 66+ messages in thread
From: Yinghai Lu @ 2008-08-08 21:52 UTC (permalink / raw)
To: Ingo Molnar, Thomas Gleixner, H. Peter Anvin, Eric W. Biederman,
Dhaval Giani, Mike Travis, Andrew Morton
Cc: linux-kernel, Yinghai Lu
Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
---
drivers/char/hpet.c | 2 +-
drivers/char/random.c | 4 ++--
drivers/char/vr41xx_giu.c | 2 +-
3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/char/hpet.c b/drivers/char/hpet.c
index 2908a0e..8d562ae 100644
--- a/drivers/char/hpet.c
+++ b/drivers/char/hpet.c
@@ -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;
}
diff --git a/drivers/char/random.c b/drivers/char/random.c
index e0d0e37..fdbdcfc 100644
--- a/drivers/char/random.c
+++ b/drivers/char/random.c
@@ -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;
/*
diff --git a/drivers/char/vr41xx_giu.c b/drivers/char/vr41xx_giu.c
index ffe9b4e..54c8372 100644
--- a/drivers/char/vr41xx_giu.c
+++ b/drivers/char/vr41xx_giu.c
@@ -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);
--
1.5.4.5
^ permalink raw reply related [flat|nested] 66+ messages in thread
* [PATCH 11/42] drivers/net to use nr_irqs
2008-08-08 21:52 ` [PATCH 10/42] drivers/char to use nr_irqs Yinghai Lu
@ 2008-08-08 21:52 ` Yinghai Lu
2008-08-08 21:52 ` [PATCH 12/42] drivers intr remapping " Yinghai Lu
0 siblings, 1 reply; 66+ messages in thread
From: Yinghai Lu @ 2008-08-08 21:52 UTC (permalink / raw)
To: Ingo Molnar, Thomas Gleixner, H. Peter Anvin, Eric W. Biederman,
Dhaval Giani, Mike Travis, Andrew Morton
Cc: linux-kernel, Yinghai Lu
Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
---
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(-)
diff --git a/drivers/net/3c59x.c b/drivers/net/3c59x.c
index 8db4e6b..7449a1c 100644
--- a/drivers/net/3c59x.c
+++ b/drivers/net/3c59x.c
@@ -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);
diff --git a/drivers/net/hamradio/baycom_ser_fdx.c b/drivers/net/hamradio/baycom_ser_fdx.c
index 17ac697..b6a816e 100644
--- a/drivers/net/hamradio/baycom_ser_fdx.c
+++ b/drivers/net/hamradio/baycom_ser_fdx.c
@@ -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) {
diff --git a/drivers/net/hamradio/scc.c b/drivers/net/hamradio/scc.c
index 45ae9d1..c17e39b 100644
--- a/drivers/net/hamradio/scc.c
+++ b/drivers/net/hamradio/scc.c
@@ -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();
diff --git a/drivers/net/wan/sbni.c b/drivers/net/wan/sbni.c
index e59255a..8bd13b8 100644
--- a/drivers/net/wan/sbni.c
+++ b/drivers/net/wan/sbni.c
@@ -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"
--
1.5.4.5
^ permalink raw reply related [flat|nested] 66+ messages in thread
* [PATCH 12/42] drivers intr remapping to use nr_irqs
2008-08-08 21:52 ` [PATCH 11/42] drivers/net " Yinghai Lu
@ 2008-08-08 21:52 ` Yinghai Lu
2008-08-08 21:52 ` [PATCH 13/42] drivers/pcmcia " Yinghai Lu
0 siblings, 1 reply; 66+ messages in thread
From: Yinghai Lu @ 2008-08-08 21:52 UTC (permalink / raw)
To: Ingo Molnar, Thomas Gleixner, H. Peter Anvin, Eric W. Biederman,
Dhaval Giani, Mike Travis, Andrew Morton
Cc: linux-kernel, Yinghai Lu
Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
---
drivers/pci/intr_remapping.c | 16 ++++++++--------
1 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/drivers/pci/intr_remapping.c b/drivers/pci/intr_remapping.c
index bb642cc..980566e 100644
--- a/drivers/pci/intr_remapping.c
+++ b/drivers/pci/intr_remapping.c
@@ -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;
}
--
1.5.4.5
^ permalink raw reply related [flat|nested] 66+ messages in thread
* [PATCH 13/42] drivers/pcmcia to use nr_irqs
2008-08-08 21:52 ` [PATCH 12/42] drivers intr remapping " Yinghai Lu
@ 2008-08-08 21:52 ` Yinghai Lu
2008-08-08 21:52 ` [PATCH 14/42] drivers/rtc " Yinghai Lu
0 siblings, 1 reply; 66+ messages in thread
From: Yinghai Lu @ 2008-08-08 21:52 UTC (permalink / raw)
To: Ingo Molnar, Thomas Gleixner, H. Peter Anvin, Eric W. Biederman,
Dhaval Giani, Mike Travis, Andrew Morton
Cc: linux-kernel, Yinghai Lu
Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
---
drivers/pcmcia/at91_cf.c | 2 +-
drivers/pcmcia/vrc4171_card.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/pcmcia/at91_cf.c b/drivers/pcmcia/at91_cf.c
index 6849685..194c8ba 100644
--- a/drivers/pcmcia/at91_cf.c
+++ b/drivers/pcmcia/at91_cf.c
@@ -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)
diff --git a/drivers/pcmcia/vrc4171_card.c b/drivers/pcmcia/vrc4171_card.c
index eee2f1c..b2c4124 100644
--- a/drivers/pcmcia/vrc4171_card.c
+++ b/drivers/pcmcia/vrc4171_card.c
@@ -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 != ',')
--
1.5.4.5
^ permalink raw reply related [flat|nested] 66+ messages in thread
* [PATCH 14/42] drivers/rtc to use nr_irqs
2008-08-08 21:52 ` [PATCH 13/42] drivers/pcmcia " Yinghai Lu
@ 2008-08-08 21:52 ` Yinghai Lu
2008-08-08 21:52 ` [PATCH 15/42] drivers/scsi " Yinghai Lu
0 siblings, 1 reply; 66+ messages in thread
From: Yinghai Lu @ 2008-08-08 21:52 UTC (permalink / raw)
To: Ingo Molnar, Thomas Gleixner, H. Peter Anvin, Eric W. Biederman,
Dhaval Giani, Mike Travis, Andrew Morton
Cc: linux-kernel, Yinghai Lu
Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
---
drivers/rtc/rtc-vr41xx.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/rtc/rtc-vr41xx.c b/drivers/rtc/rtc-vr41xx.c
index 884b635..834dcc6 100644
--- a/drivers/rtc/rtc-vr41xx.c
+++ b/drivers/rtc/rtc-vr41xx.c
@@ -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,
--
1.5.4.5
^ permalink raw reply related [flat|nested] 66+ messages in thread
* [PATCH 15/42] drivers/scsi to use nr_irqs
2008-08-08 21:52 ` [PATCH 14/42] drivers/rtc " Yinghai Lu
@ 2008-08-08 21:52 ` Yinghai Lu
2008-08-08 21:52 ` [PATCH 16/42] drivers/serial " Yinghai Lu
0 siblings, 1 reply; 66+ messages in thread
From: Yinghai Lu @ 2008-08-08 21:52 UTC (permalink / raw)
To: Ingo Molnar, Thomas Gleixner, H. Peter Anvin, Eric W. Biederman,
Dhaval Giani, Mike Travis, Andrew Morton
Cc: linux-kernel, Yinghai Lu
Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
---
drivers/scsi/aha152x.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/scsi/aha152x.c b/drivers/scsi/aha152x.c
index b5a868d..1e5478a 100644
--- a/drivers/scsi/aha152x.c
+++ b/drivers/scsi/aha152x.c
@@ -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
--
1.5.4.5
^ permalink raw reply related [flat|nested] 66+ messages in thread
* [PATCH 16/42] drivers/serial to use nr_irqs
2008-08-08 21:52 ` [PATCH 15/42] drivers/scsi " Yinghai Lu
@ 2008-08-08 21:52 ` Yinghai Lu
2008-08-08 21:52 ` [PATCH 17/42] drivers proc " Yinghai Lu
0 siblings, 1 reply; 66+ messages in thread
From: Yinghai Lu @ 2008-08-08 21:52 UTC (permalink / raw)
To: Ingo Molnar, Thomas Gleixner, H. Peter Anvin, Eric W. Biederman,
Dhaval Giani, Mike Travis, Andrew Morton
Cc: linux-kernel, Yinghai Lu
Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
---
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(-)
diff --git a/drivers/serial/8250.c b/drivers/serial/8250.c
index 71c8e68..f8f1015 100644
--- a/drivers/serial/8250.c
+++ b/drivers/serial/8250.c
@@ -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)
diff --git a/drivers/serial/amba-pl010.c b/drivers/serial/amba-pl010.c
index 90b56c2..7156268 100644
--- a/drivers/serial/amba-pl010.c
+++ b/drivers/serial/amba-pl010.c
@@ -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;
diff --git a/drivers/serial/amba-pl011.c b/drivers/serial/amba-pl011.c
index 9d08f27..b718004 100644
--- a/drivers/serial/amba-pl011.c
+++ b/drivers/serial/amba-pl011.c
@@ -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;
diff --git a/drivers/serial/cpm_uart/cpm_uart_core.c b/drivers/serial/cpm_uart/cpm_uart_core.c
index a4f8692..b09fdc2 100644
--- a/drivers/serial/cpm_uart/cpm_uart_core.c
+++ b/drivers/serial/cpm_uart/cpm_uart_core.c
@@ -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;
diff --git a/drivers/serial/m32r_sio.c b/drivers/serial/m32r_sio.c
index 23d0305..611c97a 100644
--- a/drivers/serial/m32r_sio.c
+++ b/drivers/serial/m32r_sio.c
@@ -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);
diff --git a/drivers/serial/serial_core.c b/drivers/serial/serial_core.c
index f977c98..effd0bd 100644
--- a/drivers/serial/serial_core.c
+++ b/drivers/serial/serial_core.c
@@ -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;
diff --git a/drivers/serial/serial_lh7a40x.c b/drivers/serial/serial_lh7a40x.c
index cb49a5a..61dc8b3 100644
--- a/drivers/serial/serial_lh7a40x.c
+++ b/drivers/serial/serial_lh7a40x.c
@@ -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;
diff --git a/drivers/serial/sh-sci.c b/drivers/serial/sh-sci.c
index 3df2aae..667b4b8 100644
--- a/drivers/serial/sh-sci.c
+++ b/drivers/serial/sh-sci.c
@@ -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.. */
diff --git a/drivers/serial/ucc_uart.c b/drivers/serial/ucc_uart.c
index 5c5d18d..503f0b9 100644
--- a/drivers/serial/ucc_uart.c
+++ b/drivers/serial/ucc_uart.c
@@ -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)
--
1.5.4.5
^ permalink raw reply related [flat|nested] 66+ messages in thread
* [PATCH 17/42] drivers proc to use nr_irqs
2008-08-08 21:52 ` [PATCH 16/42] drivers/serial " Yinghai Lu
@ 2008-08-08 21:52 ` Yinghai Lu
2008-08-08 21:52 ` [PATCH 18/42] drivers xen events " Yinghai Lu
0 siblings, 1 reply; 66+ messages in thread
From: Yinghai Lu @ 2008-08-08 21:52 UTC (permalink / raw)
To: Ingo Molnar, Thomas Gleixner, H. Peter Anvin, Eric W. Biederman,
Dhaval Giani, Mike Travis, Andrew Morton
Cc: linux-kernel, Yinghai Lu
Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
---
fs/proc/proc_misc.c | 10 +++++-----
1 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/fs/proc/proc_misc.c b/fs/proc/proc_misc.c
index ded9698..1968251 100644
--- a/fs/proc/proc_misc.c
+++ b/fs/proc/proc_misc.c
@@ -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;
}
--
1.5.4.5
^ permalink raw reply related [flat|nested] 66+ messages in thread
* [PATCH 18/42] drivers xen events to use nr_irqs
2008-08-08 21:52 ` [PATCH 17/42] drivers proc " Yinghai Lu
@ 2008-08-08 21:52 ` Yinghai Lu
2008-08-08 21:52 ` [PATCH 19/42] make irq_timer_state to use dyn_array Yinghai Lu
0 siblings, 1 reply; 66+ messages in thread
From: Yinghai Lu @ 2008-08-08 21:52 UTC (permalink / raw)
To: Ingo Molnar, Thomas Gleixner, H. Peter Anvin, Eric W. Biederman,
Dhaval Giani, Mike Travis, Andrew Morton
Cc: linux-kernel, Yinghai Lu
Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
---
drivers/xen/events.c | 12 ++++++------
1 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/xen/events.c b/drivers/xen/events.c
index a083703..8e329c2 100644
--- a/drivers/xen/events.c
+++ b/drivers/xen/events.c
@@ -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());
--
1.5.4.5
^ permalink raw reply related [flat|nested] 66+ messages in thread
* [PATCH 19/42] make irq_timer_state to use dyn_array
2008-08-08 21:52 ` [PATCH 18/42] drivers xen events " Yinghai Lu
@ 2008-08-08 21:52 ` Yinghai Lu
2008-08-08 21:52 ` [PATCH 20/42] make irq2_iommu " Yinghai Lu
0 siblings, 1 reply; 66+ messages in thread
From: Yinghai Lu @ 2008-08-08 21:52 UTC (permalink / raw)
To: Ingo Molnar, Thomas Gleixner, H. Peter Anvin, Eric W. Biederman,
Dhaval Giani, Mike Travis, Andrew Morton
Cc: linux-kernel, Yinghai Lu
Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
---
drivers/char/random.c | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/drivers/char/random.c b/drivers/char/random.c
index fdbdcfc..872669e 100644
--- a/drivers/char/random.c
+++ b/drivers/char/random.c
@@ -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
--
1.5.4.5
^ permalink raw reply related [flat|nested] 66+ messages in thread
* [PATCH 20/42] make irq2_iommu to use dyn_array
2008-08-08 21:52 ` [PATCH 19/42] make irq_timer_state to use dyn_array Yinghai Lu
@ 2008-08-08 21:52 ` Yinghai Lu
2008-08-08 21:52 ` [PATCH 21/42] make irq_desc " Yinghai Lu
0 siblings, 1 reply; 66+ messages in thread
From: Yinghai Lu @ 2008-08-08 21:52 UTC (permalink / raw)
To: Ingo Molnar, Thomas Gleixner, H. Peter Anvin, Eric W. Biederman,
Dhaval Giani, Mike Travis, Andrew Morton
Cc: linux-kernel, Yinghai Lu
Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
---
drivers/pci/intr_remapping.c | 11 +++++++++--
1 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/drivers/pci/intr_remapping.c b/drivers/pci/intr_remapping.c
index 980566e..a7302d5 100644
--- a/drivers/pci/intr_remapping.c
+++ b/drivers/pci/intr_remapping.c
@@ -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);
--
1.5.4.5
^ permalink raw reply related [flat|nested] 66+ messages in thread
* [PATCH 21/42] make irq_desc to use dyn_array
2008-08-08 21:52 ` [PATCH 20/42] make irq2_iommu " Yinghai Lu
@ 2008-08-08 21:52 ` Yinghai Lu
2008-08-08 21:52 ` [PATCH 22/42] irq: make irqs in kernel stat use per_cpu_dyn_array Yinghai Lu
0 siblings, 1 reply; 66+ messages in thread
From: Yinghai Lu @ 2008-08-08 21:52 UTC (permalink / raw)
To: Ingo Molnar, Thomas Gleixner, H. Peter Anvin, Eric W. Biederman,
Dhaval Giani, Mike Travis, Andrew Morton
Cc: linux-kernel, Yinghai Lu
Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
---
include/linux/irq.h | 4 ++++
kernel/irq/handle.c | 31 +++++++++++++++++++++++++++++++
2 files changed, 35 insertions(+), 0 deletions(-)
diff --git a/include/linux/irq.h b/include/linux/irq.h
index bd69d90..c22e870 100644
--- a/include/linux/irq.h
+++ b/include/linux/irq.h
@@ -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:
diff --git a/kernel/irq/handle.c b/kernel/irq/handle.c
index e9d022c..e94eeca 100644
--- a/kernel/irq/handle.c
+++ b/kernel/irq/handle.c
@@ -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?
--
1.5.4.5
^ permalink raw reply related [flat|nested] 66+ messages in thread
* [PATCH 22/42] irq: make irqs in kernel stat use per_cpu_dyn_array
2008-08-08 21:52 ` [PATCH 21/42] make irq_desc " Yinghai Lu
@ 2008-08-08 21:52 ` Yinghai Lu
2008-08-08 21:52 ` [PATCH 23/42] x86: use dyn_array in io_apic_xx.c Yinghai Lu
0 siblings, 1 reply; 66+ messages in thread
From: Yinghai Lu @ 2008-08-08 21:52 UTC (permalink / raw)
To: Ingo Molnar, Thomas Gleixner, H. Peter Anvin, Eric W. Biederman,
Dhaval Giani, Mike Travis, Andrew Morton
Cc: linux-kernel, Yinghai Lu
Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
---
include/linux/kernel_stat.h | 4 ++++
kernel/sched.c | 5 ++++-
2 files changed, 8 insertions(+), 1 deletions(-)
diff --git a/include/linux/kernel_stat.h b/include/linux/kernel_stat.h
index cf9f40a..fe1f7fe 100644
--- a/include/linux/kernel_stat.h
+++ b/include/linux/kernel_stat.h
@@ -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);
diff --git a/kernel/sched.c b/kernel/sched.c
index 55cb4ce..21c0839 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -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.
--
1.5.4.5
^ permalink raw reply related [flat|nested] 66+ messages in thread
* [PATCH 23/42] x86: use dyn_array in io_apic_xx.c
2008-08-08 21:52 ` [PATCH 22/42] irq: make irqs in kernel stat use per_cpu_dyn_array Yinghai Lu
@ 2008-08-08 21:52 ` Yinghai Lu
2008-08-08 21:52 ` [PATCH 24/42] x86: get mp_irqs from madt Yinghai Lu
0 siblings, 1 reply; 66+ messages in thread
From: Yinghai Lu @ 2008-08-08 21:52 UTC (permalink / raw)
To: Ingo Molnar, Thomas Gleixner, H. Peter Anvin, Eric W. Biederman,
Dhaval Giani, Mike Travis, Andrew Morton
Cc: linux-kernel, Yinghai Lu
Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
---
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(-)
diff --git a/arch/x86/kernel/io_apic_32.c b/arch/x86/kernel/io_apic_32.c
index d5953ff..a0ce64c 100644
--- a/arch/x86/kernel/io_apic_32.c
+++ b/arch/x86/kernel/io_apic_32.c
@@ -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];
diff --git a/arch/x86/kernel/io_apic_64.c b/arch/x86/kernel/io_apic_64.c
index 456f2e7..9bcb6c2 100644
--- a/arch/x86/kernel/io_apic_64.c
+++ b/arch/x86/kernel/io_apic_64.c
@@ -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;
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
index 60e8de1..39c5106 100644
--- a/arch/x86/kernel/setup.c
+++ b/arch/x86/kernel/setup.c
@@ -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();
--
1.5.4.5
^ permalink raw reply related [flat|nested] 66+ messages in thread
* [PATCH 24/42] x86: get mp_irqs from madt
2008-08-08 21:52 ` [PATCH 23/42] x86: use dyn_array in io_apic_xx.c Yinghai Lu
@ 2008-08-08 21:52 ` Yinghai Lu
2008-08-08 21:52 ` [PATCH 25/42] x86: remove nr_irq_vectors Yinghai Lu
0 siblings, 1 reply; 66+ messages in thread
From: Yinghai Lu @ 2008-08-08 21:52 UTC (permalink / raw)
To: Ingo Molnar, Thomas Gleixner, H. Peter Anvin, Eric W. Biederman,
Dhaval Giani, Mike Travis, Andrew Morton
Cc: linux-kernel, Yinghai Lu
Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
---
arch/x86/kernel/acpi/boot.c | 30 ++++++++++++++++++++++++++++--
include/asm-x86/mpspec.h | 1 +
2 files changed, 29 insertions(+), 2 deletions(-)
diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c
index 27ef365..443cb30 100644
--- a/arch/x86/kernel/acpi/boot.c
+++ b/arch/x86/kernel/acpi/boot.c
@@ -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 */
diff --git a/include/asm-x86/mpspec.h b/include/asm-x86/mpspec.h
index 118da36..5daa0f4 100644
--- a/include/asm-x86/mpspec.h
+++ b/include/asm-x86/mpspec.h
@@ -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);
--
1.5.4.5
^ permalink raw reply related [flat|nested] 66+ messages in thread
* [PATCH 25/42] x86: remove nr_irq_vectors
2008-08-08 21:52 ` [PATCH 24/42] x86: get mp_irqs from madt Yinghai Lu
@ 2008-08-08 21:52 ` Yinghai Lu
2008-08-08 21:52 ` [PATCH 26/42] x86_64: use irq_desc() together with dyn_array Yinghai Lu
0 siblings, 1 reply; 66+ messages in thread
From: Yinghai Lu @ 2008-08-08 21:52 UTC (permalink / raw)
To: Ingo Molnar, Thomas Gleixner, H. Peter Anvin, Eric W. Biederman,
Dhaval Giani, Mike Travis, Andrew Morton
Cc: linux-kernel, Yinghai Lu
Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
---
include/asm-x86/irq_vectors.h | 2 --
1 files changed, 0 insertions(+), 2 deletions(-)
diff --git a/include/asm-x86/irq_vectors.h b/include/asm-x86/irq_vectors.h
index 0817a19..821ff99 100644
--- a/include/asm-x86/irq_vectors.h
+++ b/include/asm-x86/irq_vectors.h
@@ -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
--
1.5.4.5
^ permalink raw reply related [flat|nested] 66+ messages in thread
* [PATCH 26/42] x86_64: use irq_desc() together with dyn_array
2008-08-08 21:52 ` [PATCH 25/42] x86: remove nr_irq_vectors Yinghai Lu
@ 2008-08-08 21:52 ` Yinghai Lu
2008-08-08 21:52 ` [PATCH 27/42] x86: add irq_cfg in io_apic_64.c Yinghai Lu
0 siblings, 1 reply; 66+ messages in thread
From: Yinghai Lu @ 2008-08-08 21:52 UTC (permalink / raw)
To: Ingo Molnar, Thomas Gleixner, H. Peter Anvin, Eric W. Biederman,
Dhaval Giani, Mike Travis, Andrew Morton
Cc: linux-kernel, Yinghai Lu
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()
Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
---
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(-)
diff --git a/arch/Kconfig b/arch/Kconfig
index c1f9feb..b367622 100644
--- a/arch/Kconfig
+++ b/arch/Kconfig
@@ -105,3 +105,7 @@ config HAVE_CLK
config HAVE_DYN_ARRAY
def_bool n
+
+config HAVE_SPARSE_IRQ
+ def_bool n
+
diff --git a/arch/alpha/kernel/irq.c b/arch/alpha/kernel/irq.c
index c626a82..85d7173 100644
--- a/arch/alpha/kernel/irq.c
+++ b/arch/alpha/kernel/irq.c
@@ -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: ");
diff --git a/arch/alpha/kernel/irq_alpha.c b/arch/alpha/kernel/irq_alpha.c
index e16aeb6..feddec7 100644
--- a/arch/alpha/kernel/irq_alpha.c
+++ b/arch/alpha/kernel/irq_alpha.c
@@ -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);
}
diff --git a/arch/alpha/kernel/irq_i8259.c b/arch/alpha/kernel/irq_i8259.c
index 9405bee..39ba6f6 100644
--- a/arch/alpha/kernel/irq_i8259.c
+++ b/arch/alpha/kernel/irq_i8259.c
@@ -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);
diff --git a/arch/alpha/kernel/irq_pyxis.c b/arch/alpha/kernel/irq_pyxis.c
index d53edbc..8fa2440 100644
--- a/arch/alpha/kernel/irq_pyxis.c
+++ b/arch/alpha/kernel/irq_pyxis.c
@@ -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);
diff --git a/arch/alpha/kernel/irq_srm.c b/arch/alpha/kernel/irq_srm.c
index 3221201..bceac72 100644
--- a/arch/alpha/kernel/irq_srm.c
+++ b/arch/alpha/kernel/irq_srm.c
@@ -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;
}
}
diff --git a/arch/alpha/kernel/sys_alcor.c b/arch/alpha/kernel/sys_alcor.c
index e53a1e1..31dab12 100644
--- a/arch/alpha/kernel/sys_alcor.c
+++ b/arch/alpha/kernel/sys_alcor.c
@@ -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;
diff --git a/arch/alpha/kernel/sys_cabriolet.c b/arch/alpha/kernel/sys_cabriolet.c
index ace475c..71c25d5 100644
--- a/arch/alpha/kernel/sys_cabriolet.c
+++ b/arch/alpha/kernel/sys_cabriolet.c
@@ -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;
}
}
diff --git a/arch/alpha/kernel/sys_dp264.c b/arch/alpha/kernel/sys_dp264.c
index c71b0fd..5cbd892 100644
--- a/arch/alpha/kernel/sys_dp264.c
+++ b/arch/alpha/kernel/sys_dp264.c
@@ -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;
}
}
diff --git a/arch/alpha/kernel/sys_eb64p.c b/arch/alpha/kernel/sys_eb64p.c
index 9c5a306..ca0b1ce 100644
--- a/arch/alpha/kernel/sys_eb64p.c
+++ b/arch/alpha/kernel/sys_eb64p.c
@@ -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();
diff --git a/arch/alpha/kernel/sys_eiger.c b/arch/alpha/kernel/sys_eiger.c
index 7ef3b6f..48fc15c 100644
--- a/arch/alpha/kernel/sys_eiger.c
+++ b/arch/alpha/kernel/sys_eiger.c
@@ -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;
}
}
diff --git a/arch/alpha/kernel/sys_jensen.c b/arch/alpha/kernel/sys_jensen.c
index 2c3de97..1dda32e 100644
--- a/arch/alpha/kernel/sys_jensen.c
+++ b/arch/alpha/kernel/sys_jensen.c
@@ -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();
}
diff --git a/arch/alpha/kernel/sys_marvel.c b/arch/alpha/kernel/sys_marvel.c
index 828449c..ce0eb28 100644
--- a/arch/alpha/kernel/sys_marvel.c
+++ b/arch/alpha/kernel/sys_marvel.c
@@ -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. */
diff --git a/arch/alpha/kernel/sys_mikasa.c b/arch/alpha/kernel/sys_mikasa.c
index 8d3e942..8499125 100644
--- a/arch/alpha/kernel/sys_mikasa.c
+++ b/arch/alpha/kernel/sys_mikasa.c
@@ -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();
diff --git a/arch/alpha/kernel/sys_noritake.c b/arch/alpha/kernel/sys_noritake.c
index eb2a1d6..e4d975a 100644
--- a/arch/alpha/kernel/sys_noritake.c
+++ b/arch/alpha/kernel/sys_noritake.c
@@ -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();
diff --git a/arch/alpha/kernel/sys_rawhide.c b/arch/alpha/kernel/sys_rawhide.c
index 672cb2d..26b044c 100644
--- a/arch/alpha/kernel/sys_rawhide.c
+++ b/arch/alpha/kernel/sys_rawhide.c
@@ -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();
diff --git a/arch/alpha/kernel/sys_rx164.c b/arch/alpha/kernel/sys_rx164.c
index ce1faa6..1956d74 100644
--- a/arch/alpha/kernel/sys_rx164.c
+++ b/arch/alpha/kernel/sys_rx164.c
@@ -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();
diff --git a/arch/alpha/kernel/sys_sable.c b/arch/alpha/kernel/sys_sable.c
index 99a7f19..5873ca1 100644
--- a/arch/alpha/kernel/sys_sable.c
+++ b/arch/alpha/kernel/sys_sable.c
@@ -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();
diff --git a/arch/alpha/kernel/sys_takara.c b/arch/alpha/kernel/sys_takara.c
index 9bd9a31..9601b52 100644
--- a/arch/alpha/kernel/sys_takara.c
+++ b/arch/alpha/kernel/sys_takara.c
@@ -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();
diff --git a/arch/alpha/kernel/sys_titan.c b/arch/alpha/kernel/sys_titan.c
index 52c91cc..9ee1a50 100644
--- a/arch/alpha/kernel/sys_titan.c
+++ b/arch/alpha/kernel/sys_titan.c
@@ -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;
}
}
diff --git a/arch/alpha/kernel/sys_wildfire.c b/arch/alpha/kernel/sys_wildfire.c
index 42c3eed..bdfbd41 100644
--- a/arch/alpha/kernel/sys_wildfire.c
+++ b/arch/alpha/kernel/sys_wildfire.c
@@ -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);
diff --git a/arch/arm/common/gic.c b/arch/arm/common/gic.c
index 0c89bd3..cf75345 100644
--- a/arch/arm/common/gic.c
+++ b/arch/arm/common/gic.c
@@ -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);
diff --git a/arch/arm/kernel/irq.c b/arch/arm/kernel/irq.c
index 11dcd52..a542c8d 100644
--- a/arch/arm/kernel/irq.c
+++ b/arch/arm/kernel/irq.c
@@ -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;
diff --git a/arch/arm/mach-at91/gpio.c b/arch/arm/mach-at91/gpio.c
index ee4964a..66db024 100644
--- a/arch/arm/mach-at91/gpio.c
+++ b/arch/arm/mach-at91/gpio.c
@@ -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
diff --git a/arch/arm/mach-davinci/gpio.c b/arch/arm/mach-davinci/gpio.c
index 9c67886..0eb53dc 100644
--- a/arch/arm/mach-davinci/gpio.c
+++ b/arch/arm/mach-davinci/gpio.c
@@ -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;
diff --git a/arch/arm/mach-ep93xx/core.c b/arch/arm/mach-ep93xx/core.c
index 5fed576..43fbb85 100644
--- a/arch/arm/mach-ep93xx/core.c
+++ b/arch/arm/mach-ep93xx/core.c
@@ -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;
diff --git a/arch/arm/mach-orion5x/irq.c b/arch/arm/mach-orion5x/irq.c
index 9ae3f6d..9c087ad 100644
--- a/arch/arm/mach-orion5x/irq.c
+++ b/arch/arm/mach-orion5x/irq.c
@@ -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:
diff --git a/arch/arm/mach-sa1100/h3600.c b/arch/arm/mach-sa1100/h3600.c
index b34ff42..08ace7e 100644
--- a/arch/arm/mach-sa1100/h3600.c
+++ b/arch/arm/mach-sa1100/h3600.c
@@ -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
diff --git a/arch/arm/plat-mxc/gpio.c b/arch/arm/plat-mxc/gpio.c
index 318b268..17f8734 100644
--- a/arch/arm/plat-mxc/gpio.c
+++ b/arch/arm/plat-mxc/gpio.c
@@ -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);
}
}
diff --git a/arch/arm/plat-omap/gpio.c b/arch/arm/plat-omap/gpio.c
index 63e0943..4e4ec0b 100644
--- a/arch/arm/plat-omap/gpio.c
+++ b/arch/arm/plat-omap/gpio.c
@@ -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;
diff --git a/arch/arm/plat-orion/irq.c b/arch/arm/plat-orion/irq.c
index fe66a18..01007f8 100644
--- a/arch/arm/plat-orion/irq.c
+++ b/arch/arm/plat-orion/irq.c
@@ -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);
}
}
diff --git a/arch/avr32/kernel/irq.c b/arch/avr32/kernel/irq.c
index a8e767d..28d5d03 100644
--- a/arch/avr32/kernel/irq.c
+++ b/arch/avr32/kernel/irq.c
@@ -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;
diff --git a/arch/avr32/mach-at32ap/extint.c b/arch/avr32/mach-at32ap/extint.c
index c36a6d5..a98eb7a 100644
--- a/arch/avr32/mach-at32ap/extint.c
+++ b/arch/avr32/mach-at32ap/extint.c
@@ -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);
diff --git a/arch/avr32/mach-at32ap/pio.c b/arch/avr32/mach-at32ap/pio.c
index 296294f..79bb503 100644
--- a/arch/avr32/mach-at32ap/pio.c
+++ b/arch/avr32/mach-at32ap/pio.c
@@ -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);
diff --git a/arch/blackfin/kernel/irqchip.c b/arch/blackfin/kernel/irqchip.c
index 07402f5..62b6caf 100644
--- a/arch/blackfin/kernel/irqchip.c
+++ b/arch/blackfin/kernel/irqchip.c
@@ -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);
}
diff --git a/arch/blackfin/kernel/traps.c b/arch/blackfin/kernel/traps.c
index ad922ab..28501eb 100644
--- a/arch/blackfin/kernel/traps.c
+++ b/arch/blackfin/kernel/traps.c
@@ -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);
}
}
diff --git a/arch/blackfin/mach-bf527/boards/cm_bf527.c b/arch/blackfin/mach-bf527/boards/cm_bf527.c
index 0b26ae2..08ad8ad 100644
--- a/arch/blackfin/mach-bf527/boards/cm_bf527.c
+++ b/arch/blackfin/mach-bf527/boards/cm_bf527.c
@@ -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;
}
diff --git a/arch/blackfin/mach-bf527/boards/ezkit.c b/arch/blackfin/mach-bf527/boards/ezkit.c
index 689b69c..66e770d 100644
--- a/arch/blackfin/mach-bf527/boards/ezkit.c
+++ b/arch/blackfin/mach-bf527/boards/ezkit.c
@@ -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;
}
diff --git a/arch/blackfin/mach-bf533/boards/cm_bf533.c b/arch/blackfin/mach-bf533/boards/cm_bf533.c
index ed2b0b8..49b02ec 100644
--- a/arch/blackfin/mach-bf533/boards/cm_bf533.c
+++ b/arch/blackfin/mach-bf533/boards/cm_bf533.c
@@ -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;
}
diff --git a/arch/blackfin/mach-bf533/boards/ezkit.c b/arch/blackfin/mach-bf533/boards/ezkit.c
index 079389c..0b9c3a6 100644
--- a/arch/blackfin/mach-bf533/boards/ezkit.c
+++ b/arch/blackfin/mach-bf533/boards/ezkit.c
@@ -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;
}
diff --git a/arch/blackfin/mach-bf533/boards/stamp.c b/arch/blackfin/mach-bf533/boards/stamp.c
index 13ae495..1bb6d18 100644
--- a/arch/blackfin/mach-bf533/boards/stamp.c
+++ b/arch/blackfin/mach-bf533/boards/stamp.c
@@ -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;
}
diff --git a/arch/blackfin/mach-bf537/boards/cm_bf537.c b/arch/blackfin/mach-bf537/boards/cm_bf537.c
index 73f2142..999af68 100644
--- a/arch/blackfin/mach-bf537/boards/cm_bf537.c
+++ b/arch/blackfin/mach-bf537/boards/cm_bf537.c
@@ -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;
}
diff --git a/arch/blackfin/mach-bf537/boards/generic_board.c b/arch/blackfin/mach-bf537/boards/generic_board.c
index 01b63e2..6f57f09 100644
--- a/arch/blackfin/mach-bf537/boards/generic_board.c
+++ b/arch/blackfin/mach-bf537/boards/generic_board.c
@@ -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;
}
diff --git a/arch/blackfin/mach-bf537/boards/stamp.c b/arch/blackfin/mach-bf537/boards/stamp.c
index 6dbc76f..555b68f 100644
--- a/arch/blackfin/mach-bf537/boards/stamp.c
+++ b/arch/blackfin/mach-bf537/boards/stamp.c
@@ -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;
diff --git a/arch/blackfin/mach-bf561/boards/cm_bf561.c b/arch/blackfin/mach-bf561/boards/cm_bf561.c
index 466ef59..54ce4cc 100644
--- a/arch/blackfin/mach-bf561/boards/cm_bf561.c
+++ b/arch/blackfin/mach-bf561/boards/cm_bf561.c
@@ -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;
}
diff --git a/arch/blackfin/mach-bf561/boards/ezkit.c b/arch/blackfin/mach-bf561/boards/ezkit.c
index bc6fede..8cdc0ad 100644
--- a/arch/blackfin/mach-bf561/boards/ezkit.c
+++ b/arch/blackfin/mach-bf561/boards/ezkit.c
@@ -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;
}
diff --git a/arch/cris/arch-v10/kernel/irq.c b/arch/cris/arch-v10/kernel/irq.c
index 65ed803..a5e6e8c 100644
--- a/arch/cris/arch-v10/kernel/irq.c
+++ b/arch/cris/arch-v10/kernel/irq.c
@@ -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]);
}
diff --git a/arch/cris/arch-v32/kernel/irq.c b/arch/cris/arch-v32/kernel/irq.c
index 173c141..5b45bac 100644
--- a/arch/cris/arch-v32/kernel/irq.c
+++ b/arch/cris/arch-v32/kernel/irq.c
@@ -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);
diff --git a/arch/cris/kernel/irq.c b/arch/cris/kernel/irq.c
index 2dfac8c..b280e0a 100644
--- a/arch/cris/kernel/irq.c
+++ b/arch/cris/kernel/irq.c
@@ -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;
}
diff --git a/arch/frv/kernel/irq.c b/arch/frv/kernel/irq.c
index 73abae7..4770219 100644
--- a/arch/frv/kernel/irq.c
+++ b/arch/frv/kernel/irq.c
@@ -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));
}
diff --git a/arch/h8300/kernel/irq.c b/arch/h8300/kernel/irq.c
index ef4f004..6c2e213 100644
--- a/arch/h8300/kernel/irq.c
+++ b/arch/h8300/kernel/irq.c
@@ -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;
}
diff --git a/arch/ia64/kernel/iosapic.c b/arch/ia64/kernel/iosapic.c
index 3bc2fa6..d373290 100644
--- a/arch/ia64/kernel/iosapic.c
+++ b/arch/ia64/kernel/iosapic.c
@@ -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;
diff --git a/arch/ia64/kernel/irq.c b/arch/ia64/kernel/irq.c
index 7fd18f5..b9290c6 100644
--- a/arch/ia64/kernel/irq.c
+++ b/arch/ia64/kernel/irq.c
@@ -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
diff --git a/arch/ia64/kernel/msi_ia64.c b/arch/ia64/kernel/msi_ia64.c
index 60c6ef6..8199eb2 100644
--- a/arch/ia64/kernel/msi_ia64.c
+++ b/arch/ia64/kernel/msi_ia64.c
@@ -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 */
diff --git a/arch/ia64/sn/kernel/irq.c b/arch/ia64/sn/kernel/irq.c
index 96c31b4..98d4d83 100644
--- a/arch/ia64/sn/kernel/irq.c
+++ b/arch/ia64/sn/kernel/irq.c
@@ -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);
}
diff --git a/arch/ia64/sn/kernel/msi_sn.c b/arch/ia64/sn/kernel/msi_sn.c
index 83f190f..51f66d8 100644
--- a/arch/ia64/sn/kernel/msi_sn.c
+++ b/arch/ia64/sn/kernel/msi_sn.c
@@ -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 */
diff --git a/arch/m32r/kernel/irq.c b/arch/m32r/kernel/irq.c
index d0c5b0b..d9c2a00 100644
--- a/arch/m32r/kernel/irq.c
+++ b/arch/m32r/kernel/irq.c
@@ -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));
diff --git a/arch/m32r/platforms/m32104ut/setup.c b/arch/m32r/platforms/m32104ut/setup.c
index 98138b4..b923269 100644
--- a/arch/m32r/platforms/m32104ut/setup.c
+++ b/arch/m32r/platforms/m32104ut/setup.c
@@ -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 */
diff --git a/arch/m32r/platforms/m32700ut/setup.c b/arch/m32r/platforms/m32700ut/setup.c
index 77b0ae9..c82e44d 100644
--- a/arch/m32r/platforms/m32700ut/setup.c
+++ b/arch/m32r/platforms/m32700ut/setup.c
@@ -297,103 +297,117 @@ static struct hw_interrupt_type m32700ut_lcdpld_irq_type =
void __init init_IRQ(void)
{
+ struct irq_desc *desc;
+
#if defined(CONFIG_SMC91X)
/* INT#0: LAN controller on M32700UT-LAN (SMC91C111)*/
- irq_desc[M32700UT_LAN_IRQ_LAN].status = IRQ_DISABLED;
- irq_desc[M32700UT_LAN_IRQ_LAN].chip = &m32700ut_lanpld_irq_type;
- irq_desc[M32700UT_LAN_IRQ_LAN].action = 0;
- irq_desc[M32700UT_LAN_IRQ_LAN].depth = 1; /* disable nested irq */
+ desc = irq_desc(M32700UT_LAN_IRQ_LAN);
+ desc->status = IRQ_DISABLED;
+ desc->chip = &m32700ut_lanpld_irq_type;
+ desc->action = 0;
+ desc->depth = 1; /* disable nested irq */
lanpld_icu_data[irq2lanpldirq(M32700UT_LAN_IRQ_LAN)].icucr = PLD_ICUCR_IEN|PLD_ICUCR_ISMOD02; /* "H" edge sense */
disable_m32700ut_lanpld_irq(M32700UT_LAN_IRQ_LAN);
#endif /* CONFIG_SMC91X */
/* MFT2 : system timer */
- irq_desc[M32R_IRQ_MFT2].status = IRQ_DISABLED;
- irq_desc[M32R_IRQ_MFT2].chip = &m32700ut_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 = &m32700ut_irq_type;
+ desc->action = 0;
+ desc->depth = 1;
icu_data[M32R_IRQ_MFT2].icucr = M32R_ICUCR_IEN;
disable_m32700ut_irq(M32R_IRQ_MFT2);
/* SIO0 : receive */
- irq_desc[M32R_IRQ_SIO0_R].status = IRQ_DISABLED;
- irq_desc[M32R_IRQ_SIO0_R].chip = &m32700ut_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 = &m32700ut_irq_type;
+ desc->action = 0;
+ desc->depth = 1;
icu_data[M32R_IRQ_SIO0_R].icucr = 0;
disable_m32700ut_irq(M32R_IRQ_SIO0_R);
/* SIO0 : send */
- irq_desc[M32R_IRQ_SIO0_S].status = IRQ_DISABLED;
- irq_desc[M32R_IRQ_SIO0_S].chip = &m32700ut_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 = &m32700ut_irq_type;
+ desc->action = 0;
+ desc->depth = 1;
icu_data[M32R_IRQ_SIO0_S].icucr = 0;
disable_m32700ut_irq(M32R_IRQ_SIO0_S);
/* SIO1 : receive */
- irq_desc[M32R_IRQ_SIO1_R].status = IRQ_DISABLED;
- irq_desc[M32R_IRQ_SIO1_R].chip = &m32700ut_irq_type;
- irq_desc[M32R_IRQ_SIO1_R].action = 0;
- irq_desc[M32R_IRQ_SIO1_R].depth = 1;
+ desc = irq_desc(M32R_IRQ_SIO1_R);
+ desc->status = IRQ_DISABLED;
+ desc->chip = &m32700ut_irq_type;
+ desc->action = 0;
+ desc->depth = 1;
icu_data[M32R_IRQ_SIO1_R].icucr = 0;
disable_m32700ut_irq(M32R_IRQ_SIO1_R);
/* SIO1 : send */
- irq_desc[M32R_IRQ_SIO1_S].status = IRQ_DISABLED;
- irq_desc[M32R_IRQ_SIO1_S].chip = &m32700ut_irq_type;
- irq_desc[M32R_IRQ_SIO1_S].action = 0;
- irq_desc[M32R_IRQ_SIO1_S].depth = 1;
+ desc = irq_desc(M32R_IRQ_SIO1_S);
+ desc->status = IRQ_DISABLED;
+ desc->chip = &m32700ut_irq_type;
+ desc->action = 0;
+ desc->depth = 1;
icu_data[M32R_IRQ_SIO1_S].icucr = 0;
disable_m32700ut_irq(M32R_IRQ_SIO1_S);
/* DMA1 : */
- irq_desc[M32R_IRQ_DMA1].status = IRQ_DISABLED;
- irq_desc[M32R_IRQ_DMA1].chip = &m32700ut_irq_type;
- irq_desc[M32R_IRQ_DMA1].action = 0;
- irq_desc[M32R_IRQ_DMA1].depth = 1;
+ desc = irq_desc(M32R_IRQ_DMA1)
+ desc->status = IRQ_DISABLED;
+ desc->chip = &m32700ut_irq_type;
+ desc->action = 0;
+ desc->depth = 1;
icu_data[M32R_IRQ_DMA1].icucr = 0;
disable_m32700ut_irq(M32R_IRQ_DMA1);
#ifdef CONFIG_SERIAL_M32R_PLDSIO
/* INT#1: SIO0 Receive on PLD */
- irq_desc[PLD_IRQ_SIO0_RCV].status = IRQ_DISABLED;
- irq_desc[PLD_IRQ_SIO0_RCV].chip = &m32700ut_pld_irq_type;
- irq_desc[PLD_IRQ_SIO0_RCV].action = 0;
- irq_desc[PLD_IRQ_SIO0_RCV].depth = 1; /* disable nested irq */
+ desc = irq_desc(PLD_IRQ_SIO0_RCV);
+ desc->status = IRQ_DISABLED;
+ desc->chip = &m32700ut_pld_irq_type;
+ desc->action = 0;
+ desc->depth = 1; /* disable nested irq */
pld_icu_data[irq2pldirq(PLD_IRQ_SIO0_RCV)].icucr = PLD_ICUCR_IEN|PLD_ICUCR_ISMOD03;
disable_m32700ut_pld_irq(PLD_IRQ_SIO0_RCV);
/* INT#1: SIO0 Send on PLD */
- irq_desc[PLD_IRQ_SIO0_SND].status = IRQ_DISABLED;
- irq_desc[PLD_IRQ_SIO0_SND].chip = &m32700ut_pld_irq_type;
- irq_desc[PLD_IRQ_SIO0_SND].action = 0;
- irq_desc[PLD_IRQ_SIO0_SND].depth = 1; /* disable nested irq */
+ desc = irq_desc(PLD_IRQ_SIO0_SND);
+ desc->status = IRQ_DISABLED;
+ desc->chip = &m32700ut_pld_irq_type;
+ desc->action = 0;
+ desc->depth = 1; /* disable nested irq */
pld_icu_data[irq2pldirq(PLD_IRQ_SIO0_SND)].icucr = PLD_ICUCR_IEN|PLD_ICUCR_ISMOD03;
disable_m32700ut_pld_irq(PLD_IRQ_SIO0_SND);
#endif /* CONFIG_SERIAL_M32R_PLDSIO */
/* INT#1: CFC IREQ on PLD */
- irq_desc[PLD_IRQ_CFIREQ].status = IRQ_DISABLED;
- irq_desc[PLD_IRQ_CFIREQ].chip = &m32700ut_pld_irq_type;
- irq_desc[PLD_IRQ_CFIREQ].action = 0;
- irq_desc[PLD_IRQ_CFIREQ].depth = 1; /* disable nested irq */
+ desc = irq_desc(PLD_IRQ_CFIREQ);
+ desc->status = IRQ_DISABLED;
+ desc->hip = &m32700ut_pld_irq_type;
+ desc->ction = 0;
+ desc->epth = 1; /* disable nested irq */
pld_icu_data[irq2pldirq(PLD_IRQ_CFIREQ)].icucr = PLD_ICUCR_IEN|PLD_ICUCR_ISMOD01; /* 'L' level sense */
disable_m32700ut_pld_irq(PLD_IRQ_CFIREQ);
/* INT#1: CFC Insert on PLD */
- irq_desc[PLD_IRQ_CFC_INSERT].status = IRQ_DISABLED;
- irq_desc[PLD_IRQ_CFC_INSERT].chip = &m32700ut_pld_irq_type;
- irq_desc[PLD_IRQ_CFC_INSERT].action = 0;
- irq_desc[PLD_IRQ_CFC_INSERT].depth = 1; /* disable nested irq */
+ desc = irq_desc(PLD_IRQ_CFC_INSERT);
+ desc->status = IRQ_DISABLED;
+ desc->chip = &m32700ut_pld_irq_type;
+ desc->action = 0;
+ desc->depth = 1; /* disable nested irq */
pld_icu_data[irq2pldirq(PLD_IRQ_CFC_INSERT)].icucr = PLD_ICUCR_IEN|PLD_ICUCR_ISMOD00; /* 'L' edge sense */
disable_m32700ut_pld_irq(PLD_IRQ_CFC_INSERT);
/* INT#1: CFC Eject on PLD */
- irq_desc[PLD_IRQ_CFC_EJECT].status = IRQ_DISABLED;
- irq_desc[PLD_IRQ_CFC_EJECT].chip = &m32700ut_pld_irq_type;
- irq_desc[PLD_IRQ_CFC_EJECT].action = 0;
- irq_desc[PLD_IRQ_CFC_EJECT].depth = 1; /* disable nested irq */
+ desc = irq_desc(PLD_IRQ_CFC_EJECT);
+ desc->status = IRQ_DISABLED;
+ desc->chip = &m32700ut_pld_irq_type;
+ desc->action = 0;
+ desc->depth = 1; /* disable nested irq */
pld_icu_data[irq2pldirq(PLD_IRQ_CFC_EJECT)].icucr = PLD_ICUCR_IEN|PLD_ICUCR_ISMOD02; /* 'H' edge sense */
disable_m32700ut_pld_irq(PLD_IRQ_CFC_EJECT);
@@ -413,13 +427,13 @@ void __init init_IRQ(void)
#if defined(CONFIG_USB)
outw(USBCR_OTGS, USBCR); /* USBCR: non-OTG */
-
- irq_desc[M32700UT_LCD_IRQ_USB_INT1].status = IRQ_DISABLED;
- irq_desc[M32700UT_LCD_IRQ_USB_INT1].chip = &m32700ut_lcdpld_irq_type;
- irq_desc[M32700UT_LCD_IRQ_USB_INT1].action = 0;
- irq_desc[M32700UT_LCD_IRQ_USB_INT1].depth = 1;
- lcdpld_icu_data[irq2lcdpldirq(M32700UT_LCD_IRQ_USB_INT1)].icucr = PLD_ICUCR_IEN|PLD_ICUCR_ISMOD01; /* "L" level sense */
- disable_m32700ut_lcdpld_irq(M32700UT_LCD_IRQ_USB_INT1);
+ desc = irq_desc(M32700UT_LCD_IRQ_USB_INT1);
+ desc->status = IRQ_DISABLED;
+ desc->chip = &m32700ut_lcdpld_irq_type;
+ desc->action = 0;
+ desc->depth = 1;
+ lcdpld_icu_data[irq2lcdpldirq(M32700UT_LCD_IRQ_USB_INT1)].icucr = PLD_ICUCR_IEN|PLD_ICUCR_ISMOD01; /* "L" level sense */
+ disable_m32700ut_lcdpld_irq(M32700UT_LCD_IRQ_USB_INT1);
#endif
/*
* INT2# is used for BAT, USB, AUDIO
@@ -432,10 +446,11 @@ void __init init_IRQ(void)
/*
* INT3# is used for AR
*/
- irq_desc[M32R_IRQ_INT3].status = IRQ_DISABLED;
- irq_desc[M32R_IRQ_INT3].chip = &m32700ut_irq_type;
- irq_desc[M32R_IRQ_INT3].action = 0;
- irq_desc[M32R_IRQ_INT3].depth = 1;
+ desc = irq_desc(M32R_IRQ_INT3);
+ desc->status = IRQ_DISABLED;
+ desc->chip = &m32700ut_irq_type;
+ desc->action = 0;
+ desc->depth = 1;
icu_data[M32R_IRQ_INT3].icucr = M32R_ICUCR_IEN|M32R_ICUCR_ISMOD10;
disable_m32700ut_irq(M32R_IRQ_INT3);
#endif /* CONFIG_VIDEO_M32R_AR */
diff --git a/arch/m32r/platforms/mappi/setup.c b/arch/m32r/platforms/mappi/setup.c
index 3ec087f..5912218 100644
--- a/arch/m32r/platforms/mappi/setup.c
+++ b/arch/m32r/platforms/mappi/setup.c
@@ -45,7 +45,7 @@ static void mask_and_ack_mappi(unsigned int irq)
static void end_mappi_irq(unsigned int irq)
{
- if (!(irq_desc[irq].status & (IRQ_DISABLED | IRQ_INPROGRESS)))
+ if (!(irq_desc(irq)->status & (IRQ_DISABLED | IRQ_INPROGRESS)))
enable_mappi_irq(irq);
}
@@ -77,6 +77,8 @@ static struct hw_interrupt_type mappi_irq_type =
void __init init_IRQ(void)
{
static int once = 0;
+ struct irq_desc *desc;
+ unsigned irq;
if (once)
return;
@@ -85,70 +87,86 @@ void __init init_IRQ(void)
#ifdef CONFIG_NE2000
/* INT0 : LAN controller (RTL8019AS) */
- irq_desc[M32R_IRQ_INT0].status = IRQ_DISABLED;
- irq_desc[M32R_IRQ_INT0].chip = &mappi_irq_type;
- irq_desc[M32R_IRQ_INT0].action = NULL;
- irq_desc[M32R_IRQ_INT0].depth = 1;
+ irq = M32R_IRQ_INT0;
+ desc = irq_desc(irq);
+ desc->status = IRQ_DISABLED;
+ desc->chip = &mappi_irq_type;
+ desc->action = NULL;
+ desc->depth = 1;
icu_data[M32R_IRQ_INT0].icucr = M32R_ICUCR_IEN|M32R_ICUCR_ISMOD11;
disable_mappi_irq(M32R_IRQ_INT0);
#endif /* CONFIG_M32R_NE2000 */
/* MFT2 : system timer */
- irq_desc[M32R_IRQ_MFT2].status = IRQ_DISABLED;
- irq_desc[M32R_IRQ_MFT2].chip = &mappi_irq_type;
- irq_desc[M32R_IRQ_MFT2].action = NULL;
- irq_desc[M32R_IRQ_MFT2].depth = 1;
+ irq = M32R_IRQ_MFT2;
+ desc = irq_desc(irq);
+ desc->status = IRQ_DISABLED;
+ desc->chip = &mappi_irq_type;
+ desc->action = NULL;
+ desc->depth = 1;
icu_data[M32R_IRQ_MFT2].icucr = M32R_ICUCR_IEN;
disable_mappi_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 = &mappi_irq_type;
- irq_desc[M32R_IRQ_SIO0_R].action = NULL;
- irq_desc[M32R_IRQ_SIO0_R].depth = 1;
+ irq = M32R_IRQ_SIO0_R;
+ desc = irq_desc(irq);
+ desc->status = IRQ_DISABLED;
+ desc->chip = &mappi_irq_type;
+ desc->action = NULL;
+ desc->depth = 1;
icu_data[M32R_IRQ_SIO0_R].icucr = 0;
disable_mappi_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 = &mappi_irq_type;
- irq_desc[M32R_IRQ_SIO0_S].action = NULL;
- irq_desc[M32R_IRQ_SIO0_S].depth = 1;
+ irq = M32R_IRQ_SIO0_S;
+ desc = irq_desc(irq);
+ desc->status = IRQ_DISABLED;
+ desc->chip = &mappi_irq_type;
+ desc->action = NULL;
+ desc->depth = 1;
icu_data[M32R_IRQ_SIO0_S].icucr = 0;
disable_mappi_irq(M32R_IRQ_SIO0_S);
/* SIO1_R : uart receive data */
- irq_desc[M32R_IRQ_SIO1_R].status = IRQ_DISABLED;
- irq_desc[M32R_IRQ_SIO1_R].chip = &mappi_irq_type;
- irq_desc[M32R_IRQ_SIO1_R].action = NULL;
- irq_desc[M32R_IRQ_SIO1_R].depth = 1;
+ irq = M32R_IRQ_SIO1_R;
+ desc = irq_desc(irq);
+ desc->status = IRQ_DISABLED;
+ desc->chip = &mappi_irq_type;
+ desc->action = NULL;
+ desc->depth = 1;
icu_data[M32R_IRQ_SIO1_R].icucr = 0;
disable_mappi_irq(M32R_IRQ_SIO1_R);
/* SIO1_S : uart send data */
- irq_desc[M32R_IRQ_SIO1_S].status = IRQ_DISABLED;
- irq_desc[M32R_IRQ_SIO1_S].chip = &mappi_irq_type;
- irq_desc[M32R_IRQ_SIO1_S].action = NULL;
- irq_desc[M32R_IRQ_SIO1_S].depth = 1;
+ irq = M32R_IRQ_SIO1_S;
+ desc = irq_desc(irq);
+ desc->status = IRQ_DISABLED;
+ desc->chip = &mappi_irq_type;
+ desc->action = NULL;
+ desc->depth = 1;
icu_data[M32R_IRQ_SIO1_S].icucr = 0;
disable_mappi_irq(M32R_IRQ_SIO1_S);
#endif /* CONFIG_SERIAL_M32R_SIO */
#if defined(CONFIG_M32R_PCC)
/* INT1 : pccard0 interrupt */
- irq_desc[M32R_IRQ_INT1].status = IRQ_DISABLED;
- irq_desc[M32R_IRQ_INT1].chip = &mappi_irq_type;
- irq_desc[M32R_IRQ_INT1].action = NULL;
- irq_desc[M32R_IRQ_INT1].depth = 1;
+ irq = M32R_IRQ_INT1;
+ desc = irq_desc(irq);
+ desc->status = IRQ_DISABLED;
+ desc->chip = &mappi_irq_type;
+ desc->action = NULL;
+ desc->depth = 1;
icu_data[M32R_IRQ_INT1].icucr = M32R_ICUCR_IEN | M32R_ICUCR_ISMOD00;
disable_mappi_irq(M32R_IRQ_INT1);
/* INT2 : pccard1 interrupt */
- irq_desc[M32R_IRQ_INT2].status = IRQ_DISABLED;
- irq_desc[M32R_IRQ_INT2].chip = &mappi_irq_type;
- irq_desc[M32R_IRQ_INT2].action = NULL;
- irq_desc[M32R_IRQ_INT2].depth = 1;
+ irq = M32R_IRQ_INT2;
+ desc = irq_desc(irq);
+ desc->status = IRQ_DISABLED;
+ desc->chip = &mappi_irq_type;
+ desc->action = NULL;
+ desc->depth = 1;
icu_data[M32R_IRQ_INT2].icucr = M32R_ICUCR_IEN | M32R_ICUCR_ISMOD00;
disable_mappi_irq(M32R_IRQ_INT2);
#endif /* CONFIG_M32RPCC */
diff --git a/arch/m32r/platforms/mappi2/setup.c b/arch/m32r/platforms/mappi2/setup.c
index d87969c..0018ef6 100644
--- a/arch/m32r/platforms/mappi2/setup.c
+++ b/arch/m32r/platforms/mappi2/setup.c
@@ -83,89 +83,112 @@ static struct hw_interrupt_type mappi2_irq_type =
void __init init_IRQ(void)
{
+ struct irq_desc *desc;
+ unsigned int i;
#if defined(CONFIG_SMC91X)
/* INT0 : LAN controller (SMC91111) */
- irq_desc[M32R_IRQ_INT0].status = IRQ_DISABLED;
- irq_desc[M32R_IRQ_INT0].chip = &mappi2_irq_type;
- irq_desc[M32R_IRQ_INT0].action = 0;
- irq_desc[M32R_IRQ_INT0].depth = 1;
+
+ irq = M32R_IRQ_INT0;
+ desc = irq_desc(irq);
+ desc->status = IRQ_DISABLED;
+ desc->chip = &mappi2_irq_type;
+ desc->action = 0;
+ desc->depth = 1;
icu_data[M32R_IRQ_INT0].icucr = M32R_ICUCR_IEN|M32R_ICUCR_ISMOD10;
disable_mappi2_irq(M32R_IRQ_INT0);
#endif /* CONFIG_SMC91X */
/* MFT2 : system timer */
- irq_desc[M32R_IRQ_MFT2].status = IRQ_DISABLED;
- irq_desc[M32R_IRQ_MFT2].chip = &mappi2_irq_type;
- irq_desc[M32R_IRQ_MFT2].action = 0;
- irq_desc[M32R_IRQ_MFT2].depth = 1;
+ irq = M32R_IRQ_MFT2;
+ desc = irq_desc(irq);
+ desc->status = IRQ_DISABLED;
+ desc->chip = &mappi2_irq_type;
+ desc->action = 0;
+ desc->depth = 1;
icu_data[M32R_IRQ_MFT2].icucr = M32R_ICUCR_IEN;
disable_mappi2_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 = &mappi2_irq_type;
- irq_desc[M32R_IRQ_SIO0_R].action = 0;
- irq_desc[M32R_IRQ_SIO0_R].depth = 1;
+ irq = M32R_IRQ_SIO0_R;
+ desc = irq_desc(irq);
+ desc->status = IRQ_DISABLED;
+ desc->chip = &mappi2_irq_type;
+ desc->action = 0;
+ desc->depth = 1;
icu_data[M32R_IRQ_SIO0_R].icucr = 0;
disable_mappi2_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 = &mappi2_irq_type;
- irq_desc[M32R_IRQ_SIO0_S].action = 0;
- irq_desc[M32R_IRQ_SIO0_S].depth = 1;
+ irq = M32R_IRQ_SIO0_S;
+ desc = irq_desc(irq);
+ desc->status = IRQ_DISABLED;
+ desc->chip = &mappi2_irq_type;
+ desc->action = 0;
+ desc->depth = 1;
icu_data[M32R_IRQ_SIO0_S].icucr = 0;
disable_mappi2_irq(M32R_IRQ_SIO0_S);
/* SIO1_R : uart receive data */
- irq_desc[M32R_IRQ_SIO1_R].status = IRQ_DISABLED;
- irq_desc[M32R_IRQ_SIO1_R].chip = &mappi2_irq_type;
- irq_desc[M32R_IRQ_SIO1_R].action = 0;
- irq_desc[M32R_IRQ_SIO1_R].depth = 1;
+ irq = M32R_IRQ_SIO1_R;
+ desc = irq_desc(irq);
+ desc->status = IRQ_DISABLED;
+ desc->chip = &mappi2_irq_type;
+ desc->action = 0;
+ desc->depth = 1;
icu_data[M32R_IRQ_SIO1_R].icucr = 0;
disable_mappi2_irq(M32R_IRQ_SIO1_R);
/* SIO1_S : uart send data */
- irq_desc[M32R_IRQ_SIO1_S].status = IRQ_DISABLED;
- irq_desc[M32R_IRQ_SIO1_S].chip = &mappi2_irq_type;
- irq_desc[M32R_IRQ_SIO1_S].action = 0;
- irq_desc[M32R_IRQ_SIO1_S].depth = 1;
+ irq = M32R_IRQ_SIO1_S;
+ desc = irq_desc(irq);
+ desc->status = IRQ_DISABLED;
+ desc->chip = &mappi2_irq_type;
+ desc->action = 0;
+ desc->depth = 1;
icu_data[M32R_IRQ_SIO1_S].icucr = 0;
disable_mappi2_irq(M32R_IRQ_SIO1_S);
#endif /* CONFIG_M32R_USE_DBG_CONSOLE */
#if defined(CONFIG_USB)
/* INT1 : USB Host controller interrupt */
- irq_desc[M32R_IRQ_INT1].status = IRQ_DISABLED;
- irq_desc[M32R_IRQ_INT1].chip = &mappi2_irq_type;
- irq_desc[M32R_IRQ_INT1].action = 0;
- irq_desc[M32R_IRQ_INT1].depth = 1;
+ irq = M32R_IRQ_INT1;
+ desc = irq_desc(irq);
+ desc->status = IRQ_DISABLED;
+ desc->chip = &mappi2_irq_type;
+ desc->action = 0;
+ desc->depth = 1;
icu_data[M32R_IRQ_INT1].icucr = M32R_ICUCR_ISMOD01;
disable_mappi2_irq(M32R_IRQ_INT1);
#endif /* CONFIG_USB */
/* ICUCR40: CFC IREQ */
- irq_desc[PLD_IRQ_CFIREQ].status = IRQ_DISABLED;
- irq_desc[PLD_IRQ_CFIREQ].chip = &mappi2_irq_type;
- irq_desc[PLD_IRQ_CFIREQ].action = 0;
- irq_desc[PLD_IRQ_CFIREQ].depth = 1; /* disable nested irq */
+ irq_desc PLD_IRQ_CFIREQ;
+ desc = irq_desc(irq);
+ desc->status = IRQ_DISABLED;
+ desc->chip = &mappi2_irq_type;
+ desc->action = 0;
+ desc->depth = 1;
icu_data[PLD_IRQ_CFIREQ].icucr = M32R_ICUCR_IEN|M32R_ICUCR_ISMOD01;
disable_mappi2_irq(PLD_IRQ_CFIREQ);
#if defined(CONFIG_M32R_CFC)
/* ICUCR41: CFC Insert */
- irq_desc[PLD_IRQ_CFC_INSERT].status = IRQ_DISABLED;
- irq_desc[PLD_IRQ_CFC_INSERT].chip = &mappi2_irq_type;
- irq_desc[PLD_IRQ_CFC_INSERT].action = 0;
- irq_desc[PLD_IRQ_CFC_INSERT].depth = 1; /* disable nested irq */
+ irq = PLD_IRQ_CFC_INSERT;
+ desc = irq_desc(irq);
+ desc->status = IRQ_DISABLED;
+ desc->chip = &mappi2_irq_type;
+ desc->action = 0;
+ desc->depth = 1;
icu_data[PLD_IRQ_CFC_INSERT].icucr = M32R_ICUCR_IEN|M32R_ICUCR_ISMOD00;
disable_mappi2_irq(PLD_IRQ_CFC_INSERT);
/* ICUCR42: CFC Eject */
- irq_desc[PLD_IRQ_CFC_EJECT].status = IRQ_DISABLED;
- irq_desc[PLD_IRQ_CFC_EJECT].chip = &mappi2_irq_type;
- irq_desc[PLD_IRQ_CFC_EJECT].action = 0;
- irq_desc[PLD_IRQ_CFC_EJECT].depth = 1; /* disable nested irq */
+ irq = PLD_IRQ_CFC_EJECT;
+ desc = irq_desc(irq);
+ desc->status = IRQ_DISABLED;
+ desc->chip = &mappi2_irq_type;
+ desc->action = 0;
+ desc->depth = 1;
icu_data[PLD_IRQ_CFC_EJECT].icucr = M32R_ICUCR_IEN|M32R_ICUCR_ISMOD10;
disable_mappi2_irq(PLD_IRQ_CFC_EJECT);
#endif /* CONFIG_MAPPI2_CFC */
diff --git a/arch/m32r/platforms/mappi3/setup.c b/arch/m32r/platforms/mappi3/setup.c
index 785b4bd..80e1f5f 100644
--- a/arch/m32r/platforms/mappi3/setup.c
+++ b/arch/m32r/platforms/mappi3/setup.c
@@ -83,91 +83,114 @@ static struct hw_interrupt_type mappi3_irq_type =
void __init init_IRQ(void)
{
+ struct irq_desc *desc;
+ unsigned int irq;
+
#if defined(CONFIG_SMC91X)
/* INT0 : LAN controller (SMC91111) */
- irq_desc[M32R_IRQ_INT0].status = IRQ_DISABLED;
- irq_desc[M32R_IRQ_INT0].chip = &mappi3_irq_type;
- irq_desc[M32R_IRQ_INT0].action = 0;
- irq_desc[M32R_IRQ_INT0].depth = 1;
+ irq = M32R_IRQ_INT0;
+ desc = irq_desc(irq);
+ desc->status = IRQ_DISABLED;
+ desc->chip = &mappi3_irq_type;
+ desc->action = 0;
+ desc->depth = 1;
icu_data[M32R_IRQ_INT0].icucr = M32R_ICUCR_IEN|M32R_ICUCR_ISMOD10;
disable_mappi3_irq(M32R_IRQ_INT0);
#endif /* CONFIG_SMC91X */
/* MFT2 : system timer */
- irq_desc[M32R_IRQ_MFT2].status = IRQ_DISABLED;
- irq_desc[M32R_IRQ_MFT2].chip = &mappi3_irq_type;
- irq_desc[M32R_IRQ_MFT2].action = 0;
- irq_desc[M32R_IRQ_MFT2].depth = 1;
+ irq = M32R_IRQ_MFT2;
+ desc = irq_desc(irq);
+ desc->status = IRQ_DISABLED;
+ desc->chip = &mappi3_irq_type;
+ desc->action = 0;
+ desc->depth = 1;
icu_data[M32R_IRQ_MFT2].icucr = M32R_ICUCR_IEN;
disable_mappi3_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 = &mappi3_irq_type;
- irq_desc[M32R_IRQ_SIO0_R].action = 0;
- irq_desc[M32R_IRQ_SIO0_R].depth = 1;
+ irq = M32R_IRQ_SIO0_R;
+ desc = irq_desc(irq);
+ desc->status = IRQ_DISABLED;
+ desc->chip = &mappi3_irq_type;
+ desc->action = 0;
+ desc->depth = 1;
icu_data[M32R_IRQ_SIO0_R].icucr = 0;
disable_mappi3_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 = &mappi3_irq_type;
- irq_desc[M32R_IRQ_SIO0_S].action = 0;
- irq_desc[M32R_IRQ_SIO0_S].depth = 1;
+ irq = M32R_IRQ_SIO0_S;
+ desc = irq_desc(irq);
+ desc->status = IRQ_DISABLED;
+ desc->chip = &mappi3_irq_type;
+ desc->action = 0;
+ desc->depth = 1;
icu_data[M32R_IRQ_SIO0_S].icucr = 0;
disable_mappi3_irq(M32R_IRQ_SIO0_S);
/* SIO1_R : uart receive data */
- irq_desc[M32R_IRQ_SIO1_R].status = IRQ_DISABLED;
- irq_desc[M32R_IRQ_SIO1_R].chip = &mappi3_irq_type;
- irq_desc[M32R_IRQ_SIO1_R].action = 0;
- irq_desc[M32R_IRQ_SIO1_R].depth = 1;
+ irq = M32R_IRQ_SIO1_R;
+ desc = irq_desc(irq);
+ desc->status = IRQ_DISABLED;
+ desc->chip = &mappi3_irq_type;
+ desc->action = 0;
+ desc->depth = 1;
icu_data[M32R_IRQ_SIO1_R].icucr = 0;
disable_mappi3_irq(M32R_IRQ_SIO1_R);
/* SIO1_S : uart send data */
- irq_desc[M32R_IRQ_SIO1_S].status = IRQ_DISABLED;
- irq_desc[M32R_IRQ_SIO1_S].chip = &mappi3_irq_type;
- irq_desc[M32R_IRQ_SIO1_S].action = 0;
- irq_desc[M32R_IRQ_SIO1_S].depth = 1;
+ irq = M32R_IRQ_SIO1_S;
+ desc = irq_desc(irq);
+ desc->status = IRQ_DISABLED;
+ desc->chip = &mappi3_irq_type;
+ desc->action = 0;
+ desc->depth = 1;
icu_data[M32R_IRQ_SIO1_S].icucr = 0;
disable_mappi3_irq(M32R_IRQ_SIO1_S);
#endif /* CONFIG_M32R_USE_DBG_CONSOLE */
#if defined(CONFIG_USB)
/* INT1 : USB Host controller interrupt */
- irq_desc[M32R_IRQ_INT1].status = IRQ_DISABLED;
- irq_desc[M32R_IRQ_INT1].chip = &mappi3_irq_type;
- irq_desc[M32R_IRQ_INT1].action = 0;
- irq_desc[M32R_IRQ_INT1].depth = 1;
+ irq = M32R_IRQ_INT1;
+ desc = irq_desc(irq);
+ desc->status = IRQ_DISABLED;
+ desc->chip = &mappi3_irq_type;
+ desc->action = 0;
+ desc->depth = 1;
icu_data[M32R_IRQ_INT1].icucr = M32R_ICUCR_ISMOD01;
disable_mappi3_irq(M32R_IRQ_INT1);
#endif /* CONFIG_USB */
/* CFC IREQ */
- irq_desc[PLD_IRQ_CFIREQ].status = IRQ_DISABLED;
- irq_desc[PLD_IRQ_CFIREQ].chip = &mappi3_irq_type;
- irq_desc[PLD_IRQ_CFIREQ].action = 0;
- irq_desc[PLD_IRQ_CFIREQ].depth = 1; /* disable nested irq */
+ irq = PLD_IRQ_CFIREQ;
+ desc = irq_desc(irq);
+ desc->status = IRQ_DISABLED;
+ desc->chip = &mappi3_irq_type;
+ desc->action = 0;
+ desc->depth = 1;
icu_data[PLD_IRQ_CFIREQ].icucr = M32R_ICUCR_IEN|M32R_ICUCR_ISMOD01;
disable_mappi3_irq(PLD_IRQ_CFIREQ);
#if defined(CONFIG_M32R_CFC)
/* ICUCR41: CFC Insert & eject */
- irq_desc[PLD_IRQ_CFC_INSERT].status = IRQ_DISABLED;
- irq_desc[PLD_IRQ_CFC_INSERT].chip = &mappi3_irq_type;
- irq_desc[PLD_IRQ_CFC_INSERT].action = 0;
- irq_desc[PLD_IRQ_CFC_INSERT].depth = 1; /* disable nested irq */
+ irq = PLD_IRQ_CFC_INSERT;
+ desc = irq_desc(irq);
+ desc->status = IRQ_DISABLED;
+ desc->chip = &mappi3_irq_type;
+ desc->action = 0;
+ desc->depth = 1;
icu_data[PLD_IRQ_CFC_INSERT].icucr = M32R_ICUCR_IEN|M32R_ICUCR_ISMOD00;
disable_mappi3_irq(PLD_IRQ_CFC_INSERT);
#endif /* CONFIG_M32R_CFC */
/* IDE IREQ */
- irq_desc[PLD_IRQ_IDEIREQ].status = IRQ_DISABLED;
- irq_desc[PLD_IRQ_IDEIREQ].chip = &mappi3_irq_type;
- irq_desc[PLD_IRQ_IDEIREQ].action = 0;
- irq_desc[PLD_IRQ_IDEIREQ].depth = 1; /* disable nested irq */
+ irq = PLD_IRQ_IDEIREQ;
+ desc = irq_desc(irq);
+ desc->status = IRQ_DISABLED;
+ desc->chip = &mappi3_irq_type;
+ desc->action = 0;
+ desc->depth = 1;
icu_data[PLD_IRQ_IDEIREQ].icucr = M32R_ICUCR_IEN|M32R_ICUCR_ISMOD10;
disable_mappi3_irq(PLD_IRQ_IDEIREQ);
diff --git a/arch/m32r/platforms/oaks32r/setup.c b/arch/m32r/platforms/oaks32r/setup.c
index 6faa5db..4fd7f0f 100644
--- a/arch/m32r/platforms/oaks32r/setup.c
+++ b/arch/m32r/platforms/oaks32r/setup.c
@@ -75,6 +75,8 @@ static struct hw_interrupt_type oaks32r_irq_type =
void __init init_IRQ(void)
{
static int once = 0;
+ struct irq_desc *desc;
+ unsigned int irq;
if (once)
return;
@@ -83,52 +85,64 @@ void __init init_IRQ(void)
#ifdef CONFIG_NE2000
/* INT3 : LAN controller (RTL8019AS) */
- irq_desc[M32R_IRQ_INT3].status = IRQ_DISABLED;
- irq_desc[M32R_IRQ_INT3].chip = &oaks32r_irq_type;
- irq_desc[M32R_IRQ_INT3].action = 0;
- irq_desc[M32R_IRQ_INT3].depth = 1;
+ irq = M32R_IRQ_INT3;
+ desc = irq_desc(irq);
+ desc->status = IRQ_DISABLED;
+ desc->chip = &oaks32r_irq_type;
+ desc->action = 0;
+ desc->depth = 1;
icu_data[M32R_IRQ_INT3].icucr = M32R_ICUCR_IEN|M32R_ICUCR_ISMOD10;
disable_oaks32r_irq(M32R_IRQ_INT3);
#endif /* CONFIG_M32R_NE2000 */
/* MFT2 : system timer */
- irq_desc[M32R_IRQ_MFT2].status = IRQ_DISABLED;
- irq_desc[M32R_IRQ_MFT2].chip = &oaks32r_irq_type;
- irq_desc[M32R_IRQ_MFT2].action = 0;
- irq_desc[M32R_IRQ_MFT2].depth = 1;
+ irq = M32R_IRQ_MFT2;
+ desc = irq_desc(irq);
+ desc->status = IRQ_DISABLED;
+ desc->chip = &oaks32r_irq_type;
+ desc->action = 0;
+ desc->depth = 1;
icu_data[M32R_IRQ_MFT2].icucr = M32R_ICUCR_IEN;
disable_oaks32r_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 = &oaks32r_irq_type;
- irq_desc[M32R_IRQ_SIO0_R].action = 0;
- irq_desc[M32R_IRQ_SIO0_R].depth = 1;
+ irq = M32R_IRQ_SIO0_R;
+ desc = irq_desc(irq);
+ desc->status = IRQ_DISABLED;
+ desc->chip = &oaks32r_irq_type;
+ desc->action = 0;
+ desc->depth = 1;
icu_data[M32R_IRQ_SIO0_R].icucr = 0;
disable_oaks32r_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 = &oaks32r_irq_type;
- irq_desc[M32R_IRQ_SIO0_S].action = 0;
- irq_desc[M32R_IRQ_SIO0_S].depth = 1;
+ irq = M32R_IRQ_SIO0_S;
+ desc = irq_desc(irq);
+ desc->status = IRQ_DISABLED;
+ desc->chip = &oaks32r_irq_type;
+ desc->action = 0;
+ desc->depth = 1;
icu_data[M32R_IRQ_SIO0_S].icucr = 0;
disable_oaks32r_irq(M32R_IRQ_SIO0_S);
/* SIO1_R : uart receive data */
- irq_desc[M32R_IRQ_SIO1_R].status = IRQ_DISABLED;
- irq_desc[M32R_IRQ_SIO1_R].chip = &oaks32r_irq_type;
- irq_desc[M32R_IRQ_SIO1_R].action = 0;
- irq_desc[M32R_IRQ_SIO1_R].depth = 1;
+ irq = M32R_IRQ_SIO1_R;
+ desc = irq_desc(irq);
+ desc->status = IRQ_DISABLED;
+ desc->chip = &oaks32r_irq_type;
+ desc->action = 0;
+ desc->depth = 1;
icu_data[M32R_IRQ_SIO1_R].icucr = 0;
disable_oaks32r_irq(M32R_IRQ_SIO1_R);
/* SIO1_S : uart send data */
- irq_desc[M32R_IRQ_SIO1_S].status = IRQ_DISABLED;
- irq_desc[M32R_IRQ_SIO1_S].chip = &oaks32r_irq_type;
- irq_desc[M32R_IRQ_SIO1_S].action = 0;
- irq_desc[M32R_IRQ_SIO1_S].depth = 1;
+ irq = M32R_IRQ_SIO1_S;
+ desc = irq_desc(irq);
+ desc->status = IRQ_DISABLED;
+ desc->chip = &oaks32r_irq_type;
+ desc->action = 0;
+ desc->depth = 1;
icu_data[M32R_IRQ_SIO1_S].icucr = 0;
disable_oaks32r_irq(M32R_IRQ_SIO1_S);
#endif /* CONFIG_SERIAL_M32R_SIO */
diff --git a/arch/m32r/platforms/opsput/setup.c b/arch/m32r/platforms/opsput/setup.c
index fab13fd..fc51ee8 100644
--- a/arch/m32r/platforms/opsput/setup.c
+++ b/arch/m32r/platforms/opsput/setup.c
@@ -298,103 +298,130 @@ static struct hw_interrupt_type opsput_lcdpld_irq_type =
void __init init_IRQ(void)
{
+ struct irq_desc *desc;
+ unsigned int irq;
+
#if defined(CONFIG_SMC91X)
/* INT#0: LAN controller on OPSPUT-LAN (SMC91C111)*/
- irq_desc[OPSPUT_LAN_IRQ_LAN].status = IRQ_DISABLED;
- irq_desc[OPSPUT_LAN_IRQ_LAN].chip = &opsput_lanpld_irq_type;
- irq_desc[OPSPUT_LAN_IRQ_LAN].action = 0;
- irq_desc[OPSPUT_LAN_IRQ_LAN].depth = 1; /* disable nested irq */
+ irq = OPSPUT_LAN_IRQ_LAN;
+ desc = irq_desc(irq);
+ desc->status = IRQ_DISABLED;
+ desc->chip = &opsput_lanpld_irq_type;
+ desc->action = 0;
+ desc->depth = 1; /* disable nested irq */
lanpld_icu_data[irq2lanpldirq(OPSPUT_LAN_IRQ_LAN)].icucr = PLD_ICUCR_IEN|PLD_ICUCR_ISMOD02; /* "H" edge sense */
disable_opsput_lanpld_irq(OPSPUT_LAN_IRQ_LAN);
#endif /* CONFIG_SMC91X */
/* MFT2 : system timer */
- irq_desc[M32R_IRQ_MFT2].status = IRQ_DISABLED;
- irq_desc[M32R_IRQ_MFT2].chip = &opsput_irq_type;
- irq_desc[M32R_IRQ_MFT2].action = 0;
- irq_desc[M32R_IRQ_MFT2].depth = 1;
+ irq = M32R_IRQ_MFT2;
+ desc = irq_desc(irq);
+ desc->status = IRQ_DISABLED;
+ desc->chip = &opsput_lanpld_irq_type;
+ desc->action = 0;
+ desc->depth = 1; /* disable nested irq */
icu_data[M32R_IRQ_MFT2].icucr = M32R_ICUCR_IEN;
disable_opsput_irq(M32R_IRQ_MFT2);
/* SIO0 : receive */
- irq_desc[M32R_IRQ_SIO0_R].status = IRQ_DISABLED;
- irq_desc[M32R_IRQ_SIO0_R].chip = &opsput_irq_type;
- irq_desc[M32R_IRQ_SIO0_R].action = 0;
- irq_desc[M32R_IRQ_SIO0_R].depth = 1;
+ irq = M32R_IRQ_SIO0_R;
+ desc = irq_desc(irq);
+ desc->status = IRQ_DISABLED;
+ desc->chip = &opsput_lanpld_irq_type;
+ desc->action = 0;
+ desc->depth = 1; /* disable nested irq */
icu_data[M32R_IRQ_SIO0_R].icucr = 0;
disable_opsput_irq(M32R_IRQ_SIO0_R);
/* SIO0 : send */
- irq_desc[M32R_IRQ_SIO0_S].status = IRQ_DISABLED;
- irq_desc[M32R_IRQ_SIO0_S].chip = &opsput_irq_type;
- irq_desc[M32R_IRQ_SIO0_S].action = 0;
- irq_desc[M32R_IRQ_SIO0_S].depth = 1;
+ irq = M32R_IRQ_SIO0_S;
+ desc = irq_desc(irq);
+ desc->status = IRQ_DISABLED;
+ desc->chip = &opsput_lanpld_irq_type;
+ desc->action = 0;
+ desc->depth = 1; /* disable nested irq */
icu_data[M32R_IRQ_SIO0_S].icucr = 0;
disable_opsput_irq(M32R_IRQ_SIO0_S);
/* SIO1 : receive */
- irq_desc[M32R_IRQ_SIO1_R].status = IRQ_DISABLED;
- irq_desc[M32R_IRQ_SIO1_R].chip = &opsput_irq_type;
- irq_desc[M32R_IRQ_SIO1_R].action = 0;
- irq_desc[M32R_IRQ_SIO1_R].depth = 1;
+ irq = M32R_IRQ_SIO1_R;
+ desc = irq_desc(irq);
+ desc->status = IRQ_DISABLED;
+ desc->chip = &opsput_lanpld_irq_type;
+ desc->action = 0;
+ desc->depth = 1; /* disable nested irq */
icu_data[M32R_IRQ_SIO1_R].icucr = 0;
disable_opsput_irq(M32R_IRQ_SIO1_R);
/* SIO1 : send */
- irq_desc[M32R_IRQ_SIO1_S].status = IRQ_DISABLED;
- irq_desc[M32R_IRQ_SIO1_S].chip = &opsput_irq_type;
- irq_desc[M32R_IRQ_SIO1_S].action = 0;
- irq_desc[M32R_IRQ_SIO1_S].depth = 1;
+ irq = M32R_IRQ_SIO1_S;
+ desc = irq_desc(irq);
+ desc->status = IRQ_DISABLED;
+ desc->chip = &opsput_lanpld_irq_type;
+ desc->action = 0;
+ desc->depth = 1; /* disable nested irq */
icu_data[M32R_IRQ_SIO1_S].icucr = 0;
disable_opsput_irq(M32R_IRQ_SIO1_S);
/* DMA1 : */
- irq_desc[M32R_IRQ_DMA1].status = IRQ_DISABLED;
- irq_desc[M32R_IRQ_DMA1].chip = &opsput_irq_type;
- irq_desc[M32R_IRQ_DMA1].action = 0;
- irq_desc[M32R_IRQ_DMA1].depth = 1;
+ irq = M32R_IRQ_DMA1;
+ desc = irq_desc(irq);
+ desc->status = IRQ_DISABLED;
+ desc->chip = &opsput_lanpld_irq_type;
+ desc->action = 0;
+ desc->depth = 1; /* disable nested irq */
icu_data[M32R_IRQ_DMA1].icucr = 0;
disable_opsput_irq(M32R_IRQ_DMA1);
#ifdef CONFIG_SERIAL_M32R_PLDSIO
/* INT#1: SIO0 Receive on PLD */
- irq_desc[PLD_IRQ_SIO0_RCV].status = IRQ_DISABLED;
- irq_desc[PLD_IRQ_SIO0_RCV].chip = &opsput_pld_irq_type;
- irq_desc[PLD_IRQ_SIO0_RCV].action = 0;
- irq_desc[PLD_IRQ_SIO0_RCV].depth = 1; /* disable nested irq */
+ irq = PLD_IRQ_SIO0_RCV;
+ desc = irq_desc(irq);
+ desc->status = IRQ_DISABLED;
+ desc->chip = &opsput_lanpld_irq_type;
+ desc->action = 0;
+ desc->depth = 1; /* disable nested irq */
pld_icu_data[irq2pldirq(PLD_IRQ_SIO0_RCV)].icucr = PLD_ICUCR_IEN|PLD_ICUCR_ISMOD03;
disable_opsput_pld_irq(PLD_IRQ_SIO0_RCV);
/* INT#1: SIO0 Send on PLD */
- irq_desc[PLD_IRQ_SIO0_SND].status = IRQ_DISABLED;
- irq_desc[PLD_IRQ_SIO0_SND].chip = &opsput_pld_irq_type;
- irq_desc[PLD_IRQ_SIO0_SND].action = 0;
- irq_desc[PLD_IRQ_SIO0_SND].depth = 1; /* disable nested irq */
+ irq = PLD_IRQ_SIO0_SND;
+ desc = irq_desc(irq);
+ desc->status = IRQ_DISABLED;
+ desc->chip = &opsput_lanpld_irq_type;
+ desc->action = 0;
+ desc->depth = 1; /* disable nested irq */
pld_icu_data[irq2pldirq(PLD_IRQ_SIO0_SND)].icucr = PLD_ICUCR_IEN|PLD_ICUCR_ISMOD03;
disable_opsput_pld_irq(PLD_IRQ_SIO0_SND);
#endif /* CONFIG_SERIAL_M32R_PLDSIO */
/* INT#1: CFC IREQ on PLD */
- irq_desc[PLD_IRQ_CFIREQ].status = IRQ_DISABLED;
- irq_desc[PLD_IRQ_CFIREQ].chip = &opsput_pld_irq_type;
- irq_desc[PLD_IRQ_CFIREQ].action = 0;
- irq_desc[PLD_IRQ_CFIREQ].depth = 1; /* disable nested irq */
+ irq = PLD_IRQ_CFIREQ;
+ desc = irq_desc(irq);
+ desc->status = IRQ_DISABLED;
+ desc->chip = &opsput_lanpld_irq_type;
+ desc->action = 0;
+ desc->depth = 1; /* disable nested irq */
pld_icu_data[irq2pldirq(PLD_IRQ_CFIREQ)].icucr = PLD_ICUCR_IEN|PLD_ICUCR_ISMOD01; /* 'L' level sense */
disable_opsput_pld_irq(PLD_IRQ_CFIREQ);
/* INT#1: CFC Insert on PLD */
- irq_desc[PLD_IRQ_CFC_INSERT].status = IRQ_DISABLED;
- irq_desc[PLD_IRQ_CFC_INSERT].chip = &opsput_pld_irq_type;
- irq_desc[PLD_IRQ_CFC_INSERT].action = 0;
- irq_desc[PLD_IRQ_CFC_INSERT].depth = 1; /* disable nested irq */
+ irq = PLD_IRQ_CFC_INSERT;
+ desc = irq_desc(irq);
+ desc->status = IRQ_DISABLED;
+ desc->chip = &opsput_lanpld_irq_type;
+ desc->action = 0;
+ desc->depth = 1; /* disable nested irq */
pld_icu_data[irq2pldirq(PLD_IRQ_CFC_INSERT)].icucr = PLD_ICUCR_IEN|PLD_ICUCR_ISMOD00; /* 'L' edge sense */
disable_opsput_pld_irq(PLD_IRQ_CFC_INSERT);
/* INT#1: CFC Eject on PLD */
- irq_desc[PLD_IRQ_CFC_EJECT].status = IRQ_DISABLED;
- irq_desc[PLD_IRQ_CFC_EJECT].chip = &opsput_pld_irq_type;
- irq_desc[PLD_IRQ_CFC_EJECT].action = 0;
- irq_desc[PLD_IRQ_CFC_EJECT].depth = 1; /* disable nested irq */
+ irq = PLD_IRQ_CFC_EJECT;
+ desc = irq_desc(irq);
+ desc->status = IRQ_DISABLED;
+ desc->chip = &opsput_lanpld_irq_type;
+ desc->action = 0;
+ desc->depth = 1; /* disable nested irq */
pld_icu_data[irq2pldirq(PLD_IRQ_CFC_EJECT)].icucr = PLD_ICUCR_IEN|PLD_ICUCR_ISMOD02; /* 'H' edge sense */
disable_opsput_pld_irq(PLD_IRQ_CFC_EJECT);
@@ -409,18 +436,20 @@ void __init init_IRQ(void)
* INT1# is used for UART, MMC, CF Controller in FPGA.
* We enable it here.
*/
- icu_data[M32R_IRQ_INT1].icucr = M32R_ICUCR_IEN|M32R_ICUCR_ISMOD11;
+ icr_data[M32R_IRQ_INT1].icucr = M32R_ICUCR_IEN|M32R_ICUCR_ISMOD11;
enable_opsput_irq(M32R_IRQ_INT1);
#if defined(CONFIG_USB)
outw(USBCR_OTGS, USBCR); /* USBCR: non-OTG */
- irq_desc[OPSPUT_LCD_IRQ_USB_INT1].status = IRQ_DISABLED;
- irq_desc[OPSPUT_LCD_IRQ_USB_INT1].chip = &opsput_lcdpld_irq_type;
- irq_desc[OPSPUT_LCD_IRQ_USB_INT1].action = 0;
- irq_desc[OPSPUT_LCD_IRQ_USB_INT1].depth = 1;
- lcdpld_icu_data[irq2lcdpldirq(OPSPUT_LCD_IRQ_USB_INT1)].icucr = PLD_ICUCR_IEN|PLD_ICUCR_ISMOD01; /* "L" level sense */
- disable_opsput_lcdpld_irq(OPSPUT_LCD_IRQ_USB_INT1);
+ irq = OPSPUT_LCD_IRQ_USB_INT1;
+ desc = irq_desc(irq);
+ desc->status = IRQ_DISABLED;
+ desc->chip = &opsput_lanpld_irq_type;
+ desc->action = 0;
+ desc->depth = 1; /* disable nested irq */
+ lcdpld_icu_data[irq2lcdpldirq(OPSPUT_LCD_IRQ_USB_INT1)].icucr = PLD_ICUCR_IEN|PLD_ICUCR_ISMOD01; /* "L" level sense */
+ disable_opsput_lcdpld_irq(OPSPUT_LCD_IRQ_USB_INT1);
#endif
/*
* INT2# is used for BAT, USB, AUDIO
@@ -433,10 +462,12 @@ void __init init_IRQ(void)
/*
* INT3# is used for AR
*/
- irq_desc[M32R_IRQ_INT3].status = IRQ_DISABLED;
- irq_desc[M32R_IRQ_INT3].chip = &opsput_irq_type;
- irq_desc[M32R_IRQ_INT3].action = 0;
- irq_desc[M32R_IRQ_INT3].depth = 1;
+ irq = M32R_IRQ_INT3;
+ desc = irq_desc(irq);
+ desc->status = IRQ_DISABLED;
+ desc->chip = &opsput_lanpld_irq_type;
+ desc->action = 0;
+ desc->depth = 1; /* disable nested irq */
icu_data[M32R_IRQ_INT3].icucr = M32R_ICUCR_IEN|M32R_ICUCR_ISMOD10;
disable_opsput_irq(M32R_IRQ_INT3);
#endif /* CONFIG_VIDEO_M32R_AR */
diff --git a/arch/m32r/platforms/usrv/setup.c b/arch/m32r/platforms/usrv/setup.c
index 89588d6..5eb0e7b 100644
--- a/arch/m32r/platforms/usrv/setup.c
+++ b/arch/m32r/platforms/usrv/setup.c
@@ -149,6 +149,8 @@ void __init init_IRQ(void)
{
static int once = 0;
int i;
+ struct irq_desc *desc;
+ unsigned int irq;
if (once)
return;
@@ -156,53 +158,65 @@ void __init init_IRQ(void)
once++;
/* MFT2 : system timer */
- irq_desc[M32R_IRQ_MFT2].status = IRQ_DISABLED;
- irq_desc[M32R_IRQ_MFT2].chip = &mappi_irq_type;
- irq_desc[M32R_IRQ_MFT2].action = 0;
- irq_desc[M32R_IRQ_MFT2].depth = 1;
+ irq = M32R_IRQ_MFT2;
+ desc = irq_desc(irq);
+ desc->status = IRQ_DISABLED;
+ desc->chip = &mappi_irq_type;
+ desc->action = 0;
+ desc->depth = 1;
icu_data[M32R_IRQ_MFT2].icucr = M32R_ICUCR_IEN;
disable_mappi_irq(M32R_IRQ_MFT2);
#if defined(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 = &mappi_irq_type;
- irq_desc[M32R_IRQ_SIO0_R].action = 0;
- irq_desc[M32R_IRQ_SIO0_R].depth = 1;
+ irq = M32R_IRQ_SIO0_R;
+ desc = irq_desc(irq);
+ desc->status = IRQ_DISABLED;
+ desc->chip = &mappi_irq_type;
+ desc->action = 0;
+ desc->depth = 1;
icu_data[M32R_IRQ_SIO0_R].icucr = 0;
disable_mappi_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 = &mappi_irq_type;
- irq_desc[M32R_IRQ_SIO0_S].action = 0;
- irq_desc[M32R_IRQ_SIO0_S].depth = 1;
+ irq = M32R_IRQ_SIO0_S;
+ desc = irq_desc(irq);
+ desc->status = IRQ_DISABLED;
+ desc->chip = &mappi_irq_type;
+ desc->action = 0;
+ desc->depth = 1;
icu_data[M32R_IRQ_SIO0_S].icucr = 0;
disable_mappi_irq(M32R_IRQ_SIO0_S);
/* SIO1_R : uart receive data */
- irq_desc[M32R_IRQ_SIO1_R].status = IRQ_DISABLED;
- irq_desc[M32R_IRQ_SIO1_R].chip = &mappi_irq_type;
- irq_desc[M32R_IRQ_SIO1_R].action = 0;
- irq_desc[M32R_IRQ_SIO1_R].depth = 1;
+ irq = M32R_IRQ_SIO1_R;
+ desc = irq_desc(irq);
+ desc->status = IRQ_DISABLED;
+ desc->chip = &mappi_irq_type;
+ desc->action = 0;
+ desc->depth = 1;
icu_data[M32R_IRQ_SIO1_R].icucr = 0;
disable_mappi_irq(M32R_IRQ_SIO1_R);
/* SIO1_S : uart send data */
- irq_desc[M32R_IRQ_SIO1_S].status = IRQ_DISABLED;
- irq_desc[M32R_IRQ_SIO1_S].chip = &mappi_irq_type;
- irq_desc[M32R_IRQ_SIO1_S].action = 0;
- irq_desc[M32R_IRQ_SIO1_S].depth = 1;
+ irq = M32R_IRQ_SIO1_S;
+ desc = irq_desc(irq);
+ desc->status = IRQ_DISABLED;
+ desc->chip = &mappi_irq_type;
+ desc->action = 0;
+ desc->depth = 1;
icu_data[M32R_IRQ_SIO1_S].icucr = 0;
disable_mappi_irq(M32R_IRQ_SIO1_S);
#endif /* CONFIG_SERIAL_M32R_SIO */
/* INT#67-#71: CFC#0 IREQ on PLD */
for (i = 0 ; i < CONFIG_M32R_CFC_NUM ; i++ ) {
- irq_desc[PLD_IRQ_CF0 + i].status = IRQ_DISABLED;
- irq_desc[PLD_IRQ_CF0 + i].chip = &m32700ut_pld_irq_type;
- irq_desc[PLD_IRQ_CF0 + i].action = 0;
- irq_desc[PLD_IRQ_CF0 + i].depth = 1; /* disable nested irq */
+ irq = PLD_IRQ_CF0 + i;
+ desc = irq_desc(irq);
+ desc->status = IRQ_DISABLED;
+ desc->chip = &m32700ut_pld_irq_type;
+ desc->action = 0;
+ desc->depth = 1;
pld_icu_data[irq2pldirq(PLD_IRQ_CF0 + i)].icucr
= PLD_ICUCR_ISMOD01; /* 'L' level sense */
disable_m32700ut_pld_irq(PLD_IRQ_CF0 + i);
@@ -210,19 +224,23 @@ void __init init_IRQ(void)
#if defined(CONFIG_SERIAL_8250) || defined(CONFIG_SERIAL_8250_MODULE)
/* INT#76: 16552D#0 IREQ on PLD */
- irq_desc[PLD_IRQ_UART0].status = IRQ_DISABLED;
- irq_desc[PLD_IRQ_UART0].chip = &m32700ut_pld_irq_type;
- irq_desc[PLD_IRQ_UART0].action = 0;
- irq_desc[PLD_IRQ_UART0].depth = 1; /* disable nested irq */
+ irq = PLD_IRQ_UART0;
+ desc = irq_desc(irq);
+ desc->status = IRQ_DISABLED;
+ desc->chip = &m32700ut_pld_irq_type;
+ desc->action = 0;
+ desc->depth = 1;
pld_icu_data[irq2pldirq(PLD_IRQ_UART0)].icucr
= PLD_ICUCR_ISMOD03; /* 'H' level sense */
disable_m32700ut_pld_irq(PLD_IRQ_UART0);
/* INT#77: 16552D#1 IREQ on PLD */
- irq_desc[PLD_IRQ_UART1].status = IRQ_DISABLED;
- irq_desc[PLD_IRQ_UART1].chip = &m32700ut_pld_irq_type;
- irq_desc[PLD_IRQ_UART1].action = 0;
- irq_desc[PLD_IRQ_UART1].depth = 1; /* disable nested irq */
+ irq = PLD_IRQ_UART1;
+ desc = irq_desc(irq);
+ desc->status = IRQ_DISABLED;
+ desc->chip = &m32700ut_pld_irq_type;
+ desc->action = 0;
+ desc->depth = 1;
pld_icu_data[irq2pldirq(PLD_IRQ_UART1)].icucr
= PLD_ICUCR_ISMOD03; /* 'H' level sense */
disable_m32700ut_pld_irq(PLD_IRQ_UART1);
@@ -230,10 +248,12 @@ void __init init_IRQ(void)
#if defined(CONFIG_IDC_AK4524) || defined(CONFIG_IDC_AK4524_MODULE)
/* INT#80: AK4524 IREQ on PLD */
- irq_desc[PLD_IRQ_SNDINT].status = IRQ_DISABLED;
- irq_desc[PLD_IRQ_SNDINT].chip = &m32700ut_pld_irq_type;
- irq_desc[PLD_IRQ_SNDINT].action = 0;
- irq_desc[PLD_IRQ_SNDINT].depth = 1; /* disable nested irq */
+ irq = PLD_IRQ_SNDINT;
+ desc = irq_desc(irq);
+ desc->status = IRQ_DISABLED;
+ desc->chip = &m32700ut_pld_irq_type;
+ desc->action = 0;
+ desc->depth = 1;
pld_icu_data[irq2pldirq(PLD_IRQ_SNDINT)].icucr
= PLD_ICUCR_ISMOD01; /* 'L' level sense */
disable_m32700ut_pld_irq(PLD_IRQ_SNDINT);
diff --git a/arch/m68knommu/kernel/irq.c b/arch/m68knommu/kernel/irq.c
index bba1bb4..e3d7dcb 100644
--- a/arch/m68knommu/kernel/irq.c
+++ b/arch/m68knommu/kernel/irq.c
@@ -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)
diff --git a/arch/mips/au1000/common/irq.c b/arch/mips/au1000/common/irq.c
index 40c6cec..da34f64 100644
--- a/arch/mips/au1000/common/irq.c
+++ b/arch/mips/au1000/common/irq.c
@@ -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)
diff --git a/arch/mips/dec/ioasic-irq.c b/arch/mips/dec/ioasic-irq.c
index 3acb133..f063cb0 100644
--- a/arch/mips/dec/ioasic-irq.c
+++ b/arch/mips/dec/ioasic-irq.c
@@ -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);
}
diff --git a/arch/mips/emma2rh/markeins/irq_markeins.c b/arch/mips/emma2rh/markeins/irq_markeins.c
index fba5c15..ddf4917 100644
--- a/arch/mips/emma2rh/markeins/irq_markeins.c
+++ b/arch/mips/emma2rh/markeins/irq_markeins.c
@@ -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);
}
diff --git a/arch/mips/kernel/irq-gic.c b/arch/mips/kernel/irq-gic.c
index f0a4bb1..9d5080a 100644
--- a/arch/mips/kernel/irq-gic.c
+++ b/arch/mips/kernel/irq-gic.c
@@ -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);
}
diff --git a/arch/mips/kernel/irq-msc01.c b/arch/mips/kernel/irq-msc01.c
index 963c16d..dc581aa 100644
--- a/arch/mips/kernel/irq-msc01.c
+++ b/arch/mips/kernel/irq-msc01.c
@@ -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);
}
diff --git a/arch/mips/kernel/irq.c b/arch/mips/kernel/irq.c
index 6045b9a..3c2e8f0 100644
--- a/arch/mips/kernel/irq.c
+++ b/arch/mips/kernel/irq.c
@@ -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));
diff --git a/arch/mips/kernel/smtc.c b/arch/mips/kernel/smtc.c
index a516286..f19708b 100644
--- a/arch/mips/kernel/smtc.c
+++ b/arch/mips/kernel/smtc.c
@@ -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
diff --git a/arch/mips/mti-malta/malta-smtc.c b/arch/mips/mti-malta/malta-smtc.c
index 5ea705e..972d045 100644
--- a/arch/mips/mti-malta/malta-smtc.c
+++ b/arch/mips/mti-malta/malta-smtc.c
@@ -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))
/*
diff --git a/arch/mips/sgi-ip32/ip32-irq.c b/arch/mips/sgi-ip32/ip32-irq.c
index 0d6b666..fbedd1c 100644
--- a/arch/mips/sgi-ip32/ip32-irq.c
+++ b/arch/mips/sgi-ip32/ip32-irq.c
@@ -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);
}
diff --git a/arch/mips/sibyte/bcm1480/irq.c b/arch/mips/sibyte/bcm1480/irq.c
index db372a0..4f802d1 100644
--- a/arch/mips/sibyte/bcm1480/irq.c
+++ b/arch/mips/sibyte/bcm1480/irq.c
@@ -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);
}
}
diff --git a/arch/mips/sibyte/sb1250/irq.c b/arch/mips/sibyte/sb1250/irq.c
index eac9065..fd4d58c 100644
--- a/arch/mips/sibyte/sb1250/irq.c
+++ b/arch/mips/sibyte/sb1250/irq.c
@@ -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);
}
}
diff --git a/arch/mips/sni/a20r.c b/arch/mips/sni/a20r.c
index 3f8cf5e..33018ce 100644
--- a/arch/mips/sni/a20r.c
+++ b/arch/mips/sni/a20r.c
@@ -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);
}
diff --git a/arch/mips/sni/pcimt.c b/arch/mips/sni/pcimt.c
index 834650f..4689198 100644
--- a/arch/mips/sni/pcimt.c
+++ b/arch/mips/sni/pcimt.c
@@ -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);
}
diff --git a/arch/mips/sni/pcit.c b/arch/mips/sni/pcit.c
index e5f12cf..7b000fa 100644
--- a/arch/mips/sni/pcit.c
+++ b/arch/mips/sni/pcit.c
@@ -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);
}
diff --git a/arch/mips/sni/rm200.c b/arch/mips/sni/rm200.c
index 5310aa7..8490c97 100644
--- a/arch/mips/sni/rm200.c
+++ b/arch/mips/sni/rm200.c
@@ -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);
}
diff --git a/arch/mn10300/kernel/irq.c b/arch/mn10300/kernel/irq.c
index 761c434..38c218c 100644
--- a/arch/mn10300/kernel/irq.c
+++ b/arch/mn10300/kernel/irq.c
@@ -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 */
diff --git a/arch/parisc/kernel/irq.c b/arch/parisc/kernel/irq.c
index 23ef950..e8a3883 100644
--- a/arch/parisc/kernel/irq.c
+++ b/arch/parisc/kernel/irq.c
@@ -120,7 +120,7 @@ int cpu_check_affinity(unsigned int irq, cpumask_t *dest)
if (CHECK_IRQ_PER_CPU(irq)) {
/* Bad linux design decision. The mask has already
* been set; we must reset it */
- irq_desc[irq].affinity = CPU_MASK_ALL;
+ irq_desc(irq)->affinity = CPU_MASK_ALL;
return -EINVAL;
}
@@ -136,7 +136,7 @@ static void cpu_set_affinity_irq(unsigned int irq, cpumask_t dest)
if (cpu_check_affinity(irq, &dest))
return;
- irq_desc[irq].affinity = dest;
+ irq_desc(irq)->affinity = dest;
}
#endif
@@ -175,9 +175,10 @@ int show_interrupts(struct seq_file *p, void *v)
if (i < NR_IRQS) {
struct irqaction *action;
+ struct irq_desc *desc = irq_desc(i);
- spin_lock_irqsave(&irq_desc[i].lock, flags);
- action = irq_desc[i].action;
+ spin_lock_irqsave(&desc->lock, flags);
+ action = desc->action;
if (!action)
goto skip;
seq_printf(p, "%3d: ", i);
@@ -188,7 +189,7 @@ int show_interrupts(struct seq_file *p, void *v)
seq_printf(p, "%10u ", kstat_irqs(i));
#endif
- seq_printf(p, " %14s", irq_desc[i].chip->typename);
+ seq_printf(p, " %14s", desc->chip->typename);
#ifndef PARISC_IRQ_CR16_COUNTS
seq_printf(p, " %s", action->name);
@@ -220,7 +221,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;
@@ -238,14 +239,16 @@ int show_interrupts(struct seq_file *p, void *v)
int cpu_claim_irq(unsigned int irq, struct irq_chip *type, void *data)
{
- if (irq_desc[irq].action)
+ struct irq_desc *desc = irq_desc(irq);
+
+ if (desc->action)
return -EBUSY;
- if (irq_desc[irq].chip != &cpu_interrupt_type)
+ if (desc->chip != &cpu_interrupt_type)
return -EBUSY;
if (type) {
- irq_desc[irq].chip = type;
- irq_desc[irq].chip_data = data;
+ desc->chip = type;
+ desc->chip_data = data;
cpu_interrupt_type.enable(irq);
}
return 0;
@@ -295,7 +298,7 @@ int txn_alloc_irq(unsigned int bits_wide)
unsigned long txn_affinity_addr(unsigned int irq, int cpu)
{
#ifdef CONFIG_SMP
- irq_desc[irq].affinity = cpumask_of_cpu(cpu);
+ irq_desc(irq)->affinity = cpumask_of_cpu(cpu);
#endif
return cpu_data[cpu].txn_addr;
@@ -339,6 +342,7 @@ void do_cpu_irq_mask(struct pt_regs *regs)
int irq, cpu = smp_processor_id();
#ifdef CONFIG_SMP
cpumask_t dest;
+ struct irq_desc *desc;
#endif
old_regs = set_irq_regs(regs);
@@ -351,8 +355,9 @@ void do_cpu_irq_mask(struct pt_regs *regs)
irq = eirr_to_irq(eirr_val);
#ifdef CONFIG_SMP
- dest = irq_desc[irq].affinity;
- if (CHECK_IRQ_PER_CPU(irq_desc[irq].status) &&
+ desc = irq_desc(irq);
+ dest = desc->affinity;
+ if (CHECK_IRQ_PER_CPU(desc->status) &&
!cpu_isset(smp_processor_id(), dest)) {
int cpu = first_cpu(dest);
@@ -393,14 +398,14 @@ static void claim_cpu_irqs(void)
{
int i;
for (i = CPU_IRQ_BASE; i <= CPU_IRQ_MAX; i++) {
- irq_desc[i].chip = &cpu_interrupt_type;
+ irq_desc(i)->chip = &cpu_interrupt_type;
}
- irq_desc[TIMER_IRQ].action = &timer_action;
- irq_desc[TIMER_IRQ].status = IRQ_PER_CPU;
+ irq_desc(TIMER_IRQ)->action = &timer_action;
+ irq_desc(TIMER_IRQ)->status = IRQ_PER_CPU;
#ifdef CONFIG_SMP
- irq_desc[IPI_IRQ].action = &ipi_action;
- irq_desc[IPI_IRQ].status = IRQ_PER_CPU;
+ irq_desc(IPI_IRQ)->action = &ipi_action;
+ irq_desc(IPI_IRQ)->status = IRQ_PER_CPU;
#endif
}
diff --git a/arch/powerpc/kernel/irq.c b/arch/powerpc/kernel/irq.c
index 6ac8612..0e14f8c 100644
--- a/arch/powerpc/kernel/irq.c
+++ b/arch/powerpc/kernel/irq.c
@@ -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);
}
diff --git a/arch/powerpc/platforms/powermac/pic.c b/arch/powerpc/platforms/powermac/pic.c
index 6d149ae..c29963d 100644
--- a/arch/powerpc/platforms/powermac/pic.c
+++ b/arch/powerpc/platforms/powermac/pic.c
@@ -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);
diff --git a/arch/powerpc/platforms/pseries/xics.c b/arch/powerpc/platforms/pseries/xics.c
index 0fc830f..29c359a 100644
--- a/arch/powerpc/platforms/pseries/xics.c
+++ b/arch/powerpc/platforms/pseries/xics.c
@@ -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);
diff --git a/arch/powerpc/sysdev/cpm2_pic.c b/arch/powerpc/sysdev/cpm2_pic.c
index b16ca3e..f5bc534 100644
--- a/arch/powerpc/sysdev/cpm2_pic.c
+++ b/arch/powerpc/sysdev/cpm2_pic.c
@@ -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];
diff --git a/arch/powerpc/sysdev/mpic.c b/arch/powerpc/sysdev/mpic.c
index 8e3478c..79e6c10 100644
--- a/arch/powerpc/sysdev/mpic.c
+++ b/arch/powerpc/sysdev/mpic.c
@@ -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++)
diff --git a/arch/powerpc/sysdev/qe_lib/qe_ic.c b/arch/powerpc/sysdev/qe_lib/qe_ic.c
index 63cdf98..4dc97c3 100644
--- a/arch/powerpc/sysdev/qe_lib/qe_ic.c
+++ b/arch/powerpc/sysdev/qe_lib/qe_ic.c
@@ -189,7 +189,7 @@ static inline void qe_ic_write(volatile __be32 __iomem * base, unsigned int reg
static 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)
diff --git a/arch/sh/boards/cayman/irq.c b/arch/sh/boards/cayman/irq.c
index 30ec7be..44c8794 100644
--- a/arch/sh/boards/cayman/irq.c
+++ b/arch/sh/boards/cayman/irq.c
@@ -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 */
diff --git a/arch/sh/boards/dreamcast/irq.c b/arch/sh/boards/dreamcast/irq.c
index 9d0673a..39674d4 100644
--- a/arch/sh/boards/dreamcast/irq.c
+++ b/arch/sh/boards/dreamcast/irq.c
@@ -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);
}
diff --git a/arch/sh/boards/dreamcast/setup.c b/arch/sh/boards/dreamcast/setup.c
index 2581c8c..0eaf30d 100644
--- a/arch/sh/boards/dreamcast/setup.c
+++ b/arch/sh/boards/dreamcast/setup.c
@@ -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;
diff --git a/arch/sh/boards/renesas/systemh/irq.c b/arch/sh/boards/renesas/systemh/irq.c
index 0ba2fe6..dcdbf9f 100644
--- a/arch/sh/boards/renesas/systemh/irq.c
+++ b/arch/sh/boards/renesas/systemh/irq.c
@@ -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);
}
diff --git a/arch/sh/boards/se/7206/irq.c b/arch/sh/boards/se/7206/irq.c
index 9d5bfc7..1da14a0 100644
--- a/arch/sh/boards/se/7206/irq.c
+++ b/arch/sh/boards/se/7206/irq.c
@@ -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);
diff --git a/arch/sh/boards/superh/microdev/irq.c b/arch/sh/boards/superh/microdev/irq.c
index 4d33507..779ccbb 100644
--- a/arch/sh/boards/superh/microdev/irq.c
+++ b/arch/sh/boards/superh/microdev/irq.c
@@ -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);
}
diff --git a/arch/sh/cchips/hd6446x/hd64461.c b/arch/sh/cchips/hd6446x/hd64461.c
index f1a4a07..c441959 100644
--- a/arch/sh/cchips/hd6446x/hd64461.c
+++ b/arch/sh/cchips/hd6446x/hd64461.c
@@ -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);
diff --git a/arch/sh/cchips/hd6446x/hd64465/setup.c b/arch/sh/cchips/hd6446x/hd64465/setup.c
index 9b8820c..0175183 100644
--- a/arch/sh/cchips/hd6446x/hd64465/setup.c
+++ b/arch/sh/cchips/hd6446x/hd64465/setup.c
@@ -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);
diff --git a/arch/sh/kernel/cpu/irq/imask.c b/arch/sh/kernel/cpu/irq/imask.c
index 301b505..bc56477 100644
--- a/arch/sh/kernel/cpu/irq/imask.c
+++ b/arch/sh/kernel/cpu/irq/imask.c
@@ -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);
}
diff --git a/arch/sh/kernel/cpu/irq/intc-sh5.c b/arch/sh/kernel/cpu/irq/intc-sh5.c
index 79baa47..87fbefa 100644
--- a/arch/sh/kernel/cpu/irq/intc-sh5.c
+++ b/arch/sh/kernel/cpu/irq/intc-sh5.c
@@ -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 */
diff --git a/arch/sh/kernel/irq.c b/arch/sh/kernel/irq.c
index a2a99e4..290befa 100644
--- a/arch/sh/kernel/irq.c
+++ b/arch/sh/kernel/irq.c
@@ -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));
diff --git a/arch/sparc64/kernel/irq.c b/arch/sparc64/kernel/irq.c
index c481673..bbed41c 100644
--- a/arch/sparc64/kernel/irq.c
+++ b/arch/sparc64/kernel/irq.c
@@ -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;
if (!action)
goto skip;
seq_printf(p, "%3d: ",i);
@@ -187,7 +189,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, " %9s", irq_desc[i].chip->typename);
+ seq_printf(p, " %9s", desc->chip->typename);
seq_printf(p, " %s", action->name);
for (action=action->next; action; action = action->next)
@@ -195,7 +197,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;
}
@@ -247,7 +249,7 @@ struct irq_handler_data {
#ifdef CONFIG_SMP
static int irq_choose_cpu(unsigned int virt_irq)
{
- cpumask_t mask = irq_desc[virt_irq].affinity;
+ cpumask_t mask = irq_desc(virt_irq)->affinity;
int cpuid;
if (cpus_equal(mask, CPU_MASK_ALL)) {
@@ -730,15 +732,16 @@ void fixup_irqs(void)
for (irq = 0; irq < NR_IRQS; irq++) {
unsigned long flags;
-
- spin_lock_irqsave(&irq_desc[irq].lock, flags);
- if (irq_desc[irq].action &&
- !(irq_desc[irq].status & IRQ_PER_CPU)) {
- if (irq_desc[irq].chip->set_affinity)
- irq_desc[irq].chip->set_affinity(irq,
- irq_desc[irq].affinity);
+ struct irq_desc *desc = irq_desc(irq);
+
+ spin_lock_irqsave(&desc->lock, flags);
+ if (desc->action &&
+ !(desc->status & IRQ_PER_CPU)) {
+ if (desc->chip->set_affinity)
+ desc->chip->set_affinity(irq,
+ desc->affinity);
}
- spin_unlock_irqrestore(&irq_desc[irq].lock, flags);
+ spin_unlock_irqrestore(&desc->lock, flags);
}
}
#endif
@@ -967,5 +970,5 @@ void __init init_IRQ(void)
: "i" (PSTATE_IE)
: "g1");
- irq_desc[0].action = &timer_irq_action;
+ irq_desc(0)->action = &timer_irq_action;
}
diff --git a/arch/um/kernel/irq.c b/arch/um/kernel/irq.c
index 3d7aad0..2a37d33 100644
--- a/arch/um/kernel/irq.c
+++ b/arch/um/kernel/irq.c
@@ -33,8 +33,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);
@@ -44,7 +46,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)
@@ -52,7 +54,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');
@@ -388,17 +390,20 @@ static struct hw_interrupt_type SIGVTALRM_irq_type = {
void __init init_IRQ(void)
{
int i;
+ struct irq_desc *desc;
- irq_desc[TIMER_IRQ].status = IRQ_DISABLED;
- irq_desc[TIMER_IRQ].action = NULL;
- irq_desc[TIMER_IRQ].depth = 1;
- irq_desc[TIMER_IRQ].chip = &SIGVTALRM_irq_type;
+ desc = irq_desc(TIMER_IRQ);
+ desc->status = IRQ_DISABLED;
+ desc->action = NULL;
+ desc->depth = 1;
+ desc->chip = &SIGVTALRM_irq_type;
enable_irq(TIMER_IRQ);
for (i = 1; i < NR_IRQS; i++) {
- irq_desc[i].status = IRQ_DISABLED;
- irq_desc[i].action = NULL;
- irq_desc[i].depth = 1;
- irq_desc[i].chip = &normal_irq_type;
+ desc = irq_desc(i);
+ desc->status = IRQ_DISABLED;
+ desc->action = NULL;
+ desc->depth = 1;
+ desc->chip = &normal_irq_type;
enable_irq(i);
}
}
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index d30b101..0d3fb7d 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -34,6 +34,7 @@ config X86
select HAVE_GENERIC_DMA_COHERENT if X86_32
select HAVE_EFFICIENT_UNALIGNED_ACCESS
select HAVE_DYN_ARRAY
+ select HAVE_SPARSE_IRQ if X86_64
config ARCH_DEFCONFIG
string
diff --git a/arch/x86/kernel/io_apic_32.c b/arch/x86/kernel/io_apic_32.c
index a0ce64c..942983c 100644
--- a/arch/x86/kernel/io_apic_32.c
+++ b/arch/x86/kernel/io_apic_32.c
@@ -345,6 +345,7 @@ static void set_ioapic_affinity_irq(unsigned int irq, cpumask_t cpumask)
struct irq_pin_list *entry = irq_2_pin + irq;
unsigned int apicid_value;
cpumask_t tmp;
+ struct irq_desc *desc;
cpus_and(tmp, cpumask, cpu_online_map);
if (cpus_empty(tmp))
@@ -365,7 +366,8 @@ static void set_ioapic_affinity_irq(unsigned int irq, cpumask_t cpumask)
break;
entry = irq_2_pin + entry->next;
}
- irq_desc[irq].affinity = cpumask;
+ desc = irq_desc(irq);
+ desc->affinity = cpumask;
spin_unlock_irqrestore(&ioapic_lock, flags);
}
@@ -475,10 +477,12 @@ static inline void balance_irq(int cpu, int irq)
static inline void rotate_irqs_among_cpus(unsigned long useful_load_threshold)
{
int i, j;
+ struct irq_desc *desc;
for_each_online_cpu(i) {
for (j = 0; j < nr_irqs; j++) {
- if (!irq_desc[j].action)
+ desc = irq_desc(j);
+ if (!desc->action)
continue;
/* Is it a significant load ? */
if (IRQ_DELTA(CPU_TO_PACKAGEINDEX(i), j) <
@@ -505,6 +509,7 @@ static void do_irq_balance(void)
unsigned long tmp_cpu_irq;
unsigned long imbalance = 0;
cpumask_t allowed_mask, target_cpu_mask, tmp;
+ struct irq_desc *desc;
for_each_possible_cpu(i) {
int package_index;
@@ -515,7 +520,8 @@ static void do_irq_balance(void)
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))
+ desc = irq_desc(j);
+ if (!desc->action || irq_balancing_disabled(j))
continue;
if (package_index == i)
IRQ_DELTA(package_index, j) = 0;
@@ -609,7 +615,8 @@ tryanotherirq:
selected_irq = -1;
for (j = 0; j < nr_irqs; j++) {
/* Is this an active IRQ? */
- if (!irq_desc[j].action)
+ desc = irq_desc(j);
+ if (!desc->action)
continue;
if (imbalance <= IRQ_DELTA(max_loaded, j))
continue;
@@ -682,10 +689,12 @@ static int balanced_irq(void *unused)
int i;
unsigned long prev_balance_time = jiffies;
long time_remaining = balanced_irq_interval;
+ struct irq_desc *desc;
/* push everything to CPU 0 to give us a starting point. */
for (i = 0 ; i < nr_irqs ; i++) {
- irq_desc[i].pending_mask = cpumask_of_cpu(0);
+ desc = irq_desc(i);
+ desc->pending_mask = cpumask_of_cpu(0);
set_pending_irq(i, cpumask_of_cpu(0));
}
@@ -1258,13 +1267,16 @@ static struct irq_chip ioapic_chip;
static void ioapic_register_intr(int irq, int vector, unsigned long trigger)
{
+ struct irq_desc *desc;
+
+ desc = irq_desc(irq);
if ((trigger == IOAPIC_AUTO && IO_APIC_irq_trigger(irq)) ||
trigger == IOAPIC_LEVEL) {
- irq_desc[irq].status |= IRQ_LEVEL;
+ desc->status |= IRQ_LEVEL;
set_irq_chip_and_handler_name(irq, &ioapic_chip,
handle_fasteoi_irq, "fasteoi");
} else {
- irq_desc[irq].status &= ~IRQ_LEVEL;
+ desc->status &= ~IRQ_LEVEL;
set_irq_chip_and_handler_name(irq, &ioapic_chip,
handle_edge_irq, "edge");
}
@@ -2031,6 +2043,7 @@ static struct irq_chip ioapic_chip __read_mostly = {
static inline void init_IO_APIC_traps(void)
{
int irq;
+ struct irq_desc *desc;
/*
* NOTE! The local APIC isn't very good at handling
@@ -2052,9 +2065,11 @@ static inline void init_IO_APIC_traps(void)
*/
if (irq < 16)
make_8259A_irq(irq);
- else
+ else {
+ desc = irq_desc(irq);
/* Strange. Oh, well.. */
- irq_desc[irq].chip = &no_irq_chip;
+ desc->chip = &no_irq_chip;
+ }
}
}
}
@@ -2093,7 +2108,10 @@ static struct irq_chip lapic_chip __read_mostly = {
static void lapic_register_intr(int irq, int vector)
{
- irq_desc[irq].status &= ~IRQ_LEVEL;
+ struct irq_desc *desc;
+
+ desc = irq_desc(irq);
+ desc->status &= ~IRQ_LEVEL;
set_irq_chip_and_handler_name(irq, &lapic_chip, handle_edge_irq,
"edge");
set_intr_gate(vector, interrupt[irq]);
@@ -2560,6 +2578,7 @@ static void set_msi_irq_affinity(unsigned int irq, cpumask_t mask)
unsigned int dest;
cpumask_t tmp;
int vector;
+ struct irq_desc *desc;
cpus_and(tmp, mask, cpu_online_map);
if (cpus_empty(tmp))
@@ -2579,7 +2598,8 @@ static void set_msi_irq_affinity(unsigned int irq, cpumask_t mask)
msg.address_lo |= MSI_ADDR_DEST_ID(dest);
write_msi_msg(irq, &msg);
- irq_desc[irq].affinity = mask;
+ desc = irq_desc(irq);
+ desc->affinity = mask;
}
#endif /* CONFIG_SMP */
@@ -2653,6 +2673,7 @@ static void set_ht_irq_affinity(unsigned int irq, cpumask_t mask)
{
unsigned int dest;
cpumask_t tmp;
+ struct irq_desc *desc;
cpus_and(tmp, mask, cpu_online_map);
if (cpus_empty(tmp))
@@ -2663,7 +2684,8 @@ static void set_ht_irq_affinity(unsigned int irq, cpumask_t mask)
dest = cpu_mask_to_apicid(mask);
target_ht_irq(irq, dest);
- irq_desc[irq].affinity = mask;
+ desc = irq_desc(irq);
+ desc->affinity = mask;
}
#endif
diff --git a/arch/x86/kernel/io_apic_64.c b/arch/x86/kernel/io_apic_64.c
index 9bcb6c2..9dbd189 100644
--- a/arch/x86/kernel/io_apic_64.c
+++ b/arch/x86/kernel/io_apic_64.c
@@ -345,6 +345,7 @@ static void set_ioapic_affinity_irq(unsigned int irq, cpumask_t mask)
unsigned long flags;
unsigned int dest;
cpumask_t tmp;
+ struct irq_desc *desc;
cpus_and(tmp, mask, cpu_online_map);
if (cpus_empty(tmp))
@@ -361,9 +362,10 @@ static void set_ioapic_affinity_irq(unsigned int irq, cpumask_t mask)
*/
dest = SET_APIC_LOGICAL_ID(dest);
+ desc = irq_desc(irq);
spin_lock_irqsave(&ioapic_lock, flags);
__target_IO_APIC_irq(irq, dest, cfg->vector);
- irq_desc[irq].affinity = mask;
+ desc->affinity = mask;
spin_unlock_irqrestore(&ioapic_lock, flags);
}
#endif
@@ -928,14 +930,17 @@ static struct irq_chip ir_ioapic_chip;
static void ioapic_register_intr(int irq, unsigned long trigger)
{
+ struct irq_desc *desc;
+
+ desc = irq_desc(irq);
if (trigger)
- irq_desc[irq].status |= IRQ_LEVEL;
+ desc->status |= IRQ_LEVEL;
else
- irq_desc[irq].status &= ~IRQ_LEVEL;
+ desc->status &= ~IRQ_LEVEL;
#ifdef CONFIG_INTR_REMAP
if (irq_remapped(irq)) {
- irq_desc[irq].status |= IRQ_MOVE_PCNTXT;
+ desc->status |= IRQ_MOVE_PCNTXT;
if (trigger)
set_irq_chip_and_handler_name(irq, &ir_ioapic_chip,
handle_fasteoi_irq,
@@ -1593,10 +1598,10 @@ 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_desc *desc = irq_desc + irq;
+ struct irq_desc *desc;
cpumask_t tmp, cleanup_mask;
struct irte irte;
- int modify_ioapic_rte = desc->status & IRQ_LEVEL;
+ int modify_ioapic_rte;
unsigned int dest;
unsigned long flags;
@@ -1613,6 +1618,8 @@ static void migrate_ioapic_irq(int irq, cpumask_t mask)
cpus_and(tmp, cfg->domain, mask);
dest = cpu_mask_to_apicid(tmp);
+ desc = irq_desc(irq);
+ modify_ioapic_rte = desc->status & IRQ_LEVEL;
if (modify_ioapic_rte) {
spin_lock_irqsave(&ioapic_lock, flags);
__target_IO_APIC_irq(irq, dest, cfg->vector);
@@ -1634,12 +1641,13 @@ static void migrate_ioapic_irq(int irq, cpumask_t mask)
cfg->move_in_progress = 0;
}
- irq_desc[irq].affinity = mask;
+ desc->affinity = mask;
}
static int migrate_irq_remapped_level(int irq)
{
int ret = -1;
+ struct irq_desc *desc = irq_desc(irq);
mask_IO_APIC_irq(irq);
@@ -1655,11 +1663,11 @@ static int migrate_irq_remapped_level(int irq)
}
/* everthing is clear. we have right of way */
- migrate_ioapic_irq(irq, irq_desc[irq].pending_mask);
+ migrate_ioapic_irq(irq, desc->pending_mask);
ret = 0;
- irq_desc[irq].status &= ~IRQ_MOVE_PENDING;
- cpus_clear(irq_desc[irq].pending_mask);
+ desc->status &= ~IRQ_MOVE_PENDING;
+ cpus_clear(desc->pending_mask);
unmask:
unmask_IO_APIC_irq(irq);
@@ -1671,7 +1679,7 @@ static void ir_irq_migration(struct work_struct *work)
int irq;
for (irq = 0; irq < nr_irqs; irq++) {
- struct irq_desc *desc = irq_desc + irq;
+ struct irq_desc *desc = irq_desc(irq);
if (desc->status & IRQ_MOVE_PENDING) {
unsigned long flags;
@@ -1683,8 +1691,7 @@ static void ir_irq_migration(struct work_struct *work)
continue;
}
- desc->chip->set_affinity(irq,
- irq_desc[irq].pending_mask);
+ desc->chip->set_affinity(irq, desc->pending_mask);
spin_unlock_irqrestore(&desc->lock, flags);
}
}
@@ -1695,9 +1702,11 @@ static void ir_irq_migration(struct work_struct *work)
*/
static void set_ir_ioapic_affinity_irq(unsigned int irq, cpumask_t mask)
{
- if (irq_desc[irq].status & IRQ_LEVEL) {
- irq_desc[irq].status |= IRQ_MOVE_PENDING;
- irq_desc[irq].pending_mask = mask;
+ struct irq_desc *desc = irq_desc(irq);
+
+ if (desc->status & IRQ_LEVEL) {
+ desc->status |= IRQ_MOVE_PENDING;
+ desc->pending_mask = mask;
migrate_irq_remapped_level(irq);
return;
}
@@ -1722,7 +1731,7 @@ asmlinkage void smp_irq_move_cleanup_interrupt(void)
if (irq >= nr_irqs)
continue;
- desc = irq_desc + irq;
+ desc = irq_desc(irq);
cfg = irq_cfg + irq;
spin_lock(&desc->lock);
if (!cfg->move_cleanup_count)
@@ -1788,7 +1797,7 @@ static void ack_apic_level(unsigned int irq)
irq_complete_move(irq);
#ifdef CONFIG_GENERIC_PENDING_IRQ
/* If we are moving the irq we need to mask it */
- if (unlikely(irq_desc[irq].status & IRQ_MOVE_PENDING)) {
+ if (unlikely(irq_desc(irq)->status & IRQ_MOVE_PENDING)) {
do_unmask_irq = 1;
mask_IO_APIC_irq(irq);
}
@@ -1865,6 +1874,7 @@ static struct irq_chip ir_ioapic_chip __read_mostly = {
static inline void init_IO_APIC_traps(void)
{
int irq;
+ struct irq_desc *desc;
/*
* NOTE! The local APIC isn't very good at handling
@@ -1886,9 +1896,11 @@ static inline void init_IO_APIC_traps(void)
*/
if (irq < 16)
make_8259A_irq(irq);
- else
+ else {
+ desc = irq_desc(irq);
/* Strange. Oh, well.. */
- irq_desc[irq].chip = &no_irq_chip;
+ desc->chip = &no_irq_chip;
+ }
}
}
}
@@ -1923,7 +1935,10 @@ static struct irq_chip lapic_chip __read_mostly = {
static void lapic_register_intr(int irq)
{
- irq_desc[irq].status &= ~IRQ_LEVEL;
+ struct irq_desc *desc;
+
+ desc = irq_desc(irq);
+ desc->status &= ~IRQ_LEVEL;
set_irq_chip_and_handler_name(irq, &lapic_chip, handle_edge_irq,
"edge");
}
@@ -2399,6 +2414,7 @@ static void set_msi_irq_affinity(unsigned int irq, cpumask_t mask)
struct msi_msg msg;
unsigned int dest;
cpumask_t tmp;
+ struct irq_desc *desc;
cpus_and(tmp, mask, cpu_online_map);
if (cpus_empty(tmp))
@@ -2418,7 +2434,8 @@ static void set_msi_irq_affinity(unsigned int irq, cpumask_t mask)
msg.address_lo |= MSI_ADDR_DEST_ID(dest);
write_msi_msg(irq, &msg);
- irq_desc[irq].affinity = mask;
+ desc = irq_desc(irq);
+ desc->affinity = mask;
}
#ifdef CONFIG_INTR_REMAP
@@ -2432,6 +2449,7 @@ static void ir_set_msi_irq_affinity(unsigned int irq, cpumask_t mask)
unsigned int dest;
cpumask_t tmp, cleanup_mask;
struct irte irte;
+ struct irq_desc *desc;
cpus_and(tmp, mask, cpu_online_map);
if (cpus_empty(tmp))
@@ -2466,7 +2484,8 @@ static void ir_set_msi_irq_affinity(unsigned int irq, cpumask_t mask)
cfg->move_in_progress = 0;
}
- irq_desc[irq].affinity = mask;
+ desc = irq_desc(irq);
+ desc->affinity = mask;
}
#endif
#endif /* CONFIG_SMP */
@@ -2540,7 +2559,7 @@ static int setup_msi_irq(struct pci_dev *dev, struct msi_desc *desc, int irq)
#ifdef CONFIG_INTR_REMAP
if (irq_remapped(irq)) {
- struct irq_desc *desc = irq_desc + irq;
+ struct irq_desc *desc = irq_desc(irq);
/*
* irq migration in process context
*/
@@ -2652,6 +2671,7 @@ static void dmar_msi_set_affinity(unsigned int irq, cpumask_t mask)
struct msi_msg msg;
unsigned int dest;
cpumask_t tmp;
+ struct irq_desc *desc;
cpus_and(tmp, mask, cpu_online_map);
if (cpus_empty(tmp))
@@ -2671,7 +2691,8 @@ static void dmar_msi_set_affinity(unsigned int irq, cpumask_t mask)
msg.address_lo |= MSI_ADDR_DEST_ID(dest);
dmar_msi_write(irq, &msg);
- irq_desc[irq].affinity = mask;
+ desc = irq_desc(irq);
+ desc->affinity = mask;
}
#endif /* CONFIG_SMP */
@@ -2728,6 +2749,7 @@ static void set_ht_irq_affinity(unsigned int irq, cpumask_t mask)
struct irq_cfg *cfg = irq_cfg + irq;
unsigned int dest;
cpumask_t tmp;
+ struct irq_desc *desc;
cpus_and(tmp, mask, cpu_online_map);
if (cpus_empty(tmp))
@@ -2740,7 +2762,8 @@ static void set_ht_irq_affinity(unsigned int irq, cpumask_t mask)
dest = cpu_mask_to_apicid(tmp);
target_ht_irq(irq, dest, cfg->vector);
- irq_desc[irq].affinity = mask;
+ desc = irq_desc(irq);
+ desc->affinity = mask;
}
#endif
diff --git a/arch/x86/kernel/irq_32.c b/arch/x86/kernel/irq_32.c
index 0cff2f4..c6750fe 100644
--- a/arch/x86/kernel/irq_32.c
+++ b/arch/x86/kernel/irq_32.c
@@ -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 = irq_desc(irq);
if (unlikely((unsigned)irq >= nr_irqs)) {
printk(KERN_EMERG "%s: cannot handle IRQ %d\n",
@@ -273,15 +273,16 @@ int show_interrupts(struct seq_file *p, void *v)
if (i < nr_irqs) {
unsigned any_count = 0;
+ struct irq_desc *desc = irq_desc(i);
- spin_lock_irqsave(&irq_desc[i].lock, flags);
+ spin_lock_irqsave(&desc->lock, flags);
#ifndef CONFIG_SMP
any_count = kstat_irqs(i);
#else
for_each_online_cpu(j)
any_count |= kstat_cpu(j).irqs[i];
#endif
- action = irq_desc[i].action;
+ action = desc->action;
if (!action && !any_count)
goto skip;
seq_printf(p, "%3d: ",i);
@@ -291,8 +292,8 @@ 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, " %8s", irq_desc[i].chip->name);
- seq_printf(p, "-%-8s", irq_desc[i].name);
+ seq_printf(p, " %8s", desc->chip->name);
+ seq_printf(p, "-%-8s", desc->name);
if (action) {
seq_printf(p, " %s", action->name);
@@ -302,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);
+ spin_unlock_irqrestore(&desc->lock, flags);
} else if (i == nr_irqs) {
seq_printf(p, "NMI: ");
for_each_online_cpu(j)
@@ -398,17 +399,20 @@ void fixup_irqs(cpumask_t map)
for (irq = 0; irq < nr_irqs; irq++) {
cpumask_t mask;
+ struct irq_desc *desc;
+
if (irq == 2)
continue;
- cpus_and(mask, irq_desc[irq].affinity, map);
+ desc = irq_desc(irq);
+ 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);
}
diff --git a/arch/x86/kernel/irq_64.c b/arch/x86/kernel/irq_64.c
index de94c60..5e0a938 100644
--- a/arch/x86/kernel/irq_64.c
+++ b/arch/x86/kernel/irq_64.c
@@ -83,15 +83,16 @@ int show_interrupts(struct seq_file *p, void *v)
if (i < nr_irqs) {
unsigned any_count = 0;
+ struct irq_desc *desc = irq_desc(i);
- spin_lock_irqsave(&irq_desc[i].lock, flags);
+ spin_lock_irqsave(&desc->lock, flags);
#ifndef CONFIG_SMP
any_count = kstat_irqs(i);
#else
for_each_online_cpu(j)
any_count |= kstat_cpu(j).irqs[i];
#endif
- action = irq_desc[i].action;
+ action = desc->action;
if (!action && !any_count)
goto skip;
seq_printf(p, "%3d: ",i);
@@ -101,8 +102,8 @@ 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, " %8s", irq_desc[i].chip->name);
- seq_printf(p, "-%-8s", irq_desc[i].name);
+ seq_printf(p, " %8s", desc->chip->name);
+ seq_printf(p, "-%-8s", desc->name);
if (action) {
seq_printf(p, " %s", action->name);
@@ -111,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);
+ spin_unlock_irqrestore(&desc->lock, flags);
} else if (i == nr_irqs) {
seq_printf(p, "NMI: ");
for_each_online_cpu(j)
@@ -228,37 +229,39 @@ void fixup_irqs(cpumask_t map)
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(&irq_desc[irq].lock);
+ spin_lock(&desc->lock);
if (!irq_has_action(irq) ||
- cpus_equal(irq_desc[irq].affinity, map)) {
- spin_unlock(&irq_desc[irq].lock);
+ cpus_equal(desc->affinity, map)) {
+ spin_unlock(&desc->lock);
continue;
}
- cpus_and(mask, irq_desc[irq].affinity, map);
+ cpus_and(mask, desc->affinity, map);
if (cpus_empty(mask)) {
break_affinity = 1;
mask = map;
}
- if (irq_desc[irq].chip->mask)
- irq_desc[irq].chip->mask(irq);
+ if (desc->chip->mask)
+ desc->chip->mask(irq);
- if (irq_desc[irq].chip->set_affinity)
- irq_desc[irq].chip->set_affinity(irq, mask);
+ if (desc->chip->set_affinity)
+ desc->chip->set_affinity(irq, mask);
else if (!(warned++))
set_affinity = 0;
- if (irq_desc[irq].chip->unmask)
- irq_desc[irq].chip->unmask(irq);
+ if (desc->chip->unmask)
+ desc->chip->unmask(irq);
- spin_unlock(&irq_desc[irq].lock);
+ spin_unlock(&desc->lock);
if (break_affinity && set_affinity)
printk("Broke affinity for irq %i\n", irq);
diff --git a/arch/x86/kernel/irqinit_64.c b/arch/x86/kernel/irqinit_64.c
index 48674e6..583db8b 100644
--- a/arch/x86/kernel/irqinit_64.c
+++ b/arch/x86/kernel/irqinit_64.c
@@ -143,9 +143,11 @@ static void __init init_ISA_irqs (void)
init_8259A(0);
for (i = 0; i < nr_irqs; i++) {
- irq_desc[i].status = IRQ_DISABLED;
- irq_desc[i].action = NULL;
- irq_desc[i].depth = 1;
+ struct irq_desc *desc = irq_desc(i);
+
+ desc->status = IRQ_DISABLED;
+ desc->action = NULL;
+ desc->depth = 1;
if (i < 16) {
/*
@@ -157,7 +159,7 @@ static void __init init_ISA_irqs (void)
/*
* 'high' PCI IRQs filled in on demand
*/
- irq_desc[i].chip = &no_irq_chip;
+ desc->chip = &no_irq_chip;
}
}
}
diff --git a/arch/x86/kernel/visws_quirks.c b/arch/x86/kernel/visws_quirks.c
index 3059eb4..6fa3128 100644
--- a/arch/x86/kernel/visws_quirks.c
+++ b/arch/x86/kernel/visws_quirks.c
@@ -486,10 +486,11 @@ static void disable_cobalt_irq(unsigned int irq)
static unsigned int startup_cobalt_irq(unsigned int irq)
{
unsigned long flags;
+ struct irq_desc *desc = irq_desc(irq);
spin_lock_irqsave(&cobalt_lock, flags);
- if ((irq_desc[irq].status & (IRQ_DISABLED | IRQ_INPROGRESS | IRQ_WAITING)))
- irq_desc[irq].status &= ~(IRQ_DISABLED | IRQ_INPROGRESS | IRQ_WAITING);
+ if ((desc->status & (IRQ_DISABLED | IRQ_INPROGRESS | IRQ_WAITING)))
+ desc->status &= ~(IRQ_DISABLED | IRQ_INPROGRESS | IRQ_WAITING);
enable_cobalt_irq(irq);
spin_unlock_irqrestore(&cobalt_lock, flags);
return 0;
@@ -508,9 +509,10 @@ static void ack_cobalt_irq(unsigned int irq)
static void end_cobalt_irq(unsigned int irq)
{
unsigned long flags;
+ struct irq_desc *desc = irq_desc(irq);
spin_lock_irqsave(&cobalt_lock, flags);
- if (!(irq_desc[irq].status & (IRQ_DISABLED | IRQ_INPROGRESS)))
+ if (!(desc->status & (IRQ_DISABLED | IRQ_INPROGRESS)))
enable_cobalt_irq(irq);
spin_unlock_irqrestore(&cobalt_lock, flags);
}
@@ -628,7 +630,7 @@ static irqreturn_t piix4_master_intr(int irq, void *dev_id)
spin_unlock_irqrestore(&i8259A_lock, flags);
- desc = irq_desc + realirq;
+ desc = irq_desc(realirq);
/*
* handle this 'virtual interrupt' as a Cobalt one now.
@@ -664,27 +666,29 @@ void init_VISWS_APIC_irqs(void)
int i;
for (i = 0; i < CO_IRQ_APIC0 + CO_APIC_LAST + 1; i++) {
- irq_desc[i].status = IRQ_DISABLED;
- irq_desc[i].action = 0;
- irq_desc[i].depth = 1;
+ struct irq_desc *desc = irq_desc(i);
+
+ desc->status = IRQ_DISABLED;
+ desc->action = 0;
+ desc->depth = 1;
if (i == 0) {
- irq_desc[i].chip = &cobalt_irq_type;
+ desc->chip = &cobalt_irq_type;
}
else if (i == CO_IRQ_IDE0) {
- irq_desc[i].chip = &cobalt_irq_type;
+ desc->chip = &cobalt_irq_type;
}
else if (i == CO_IRQ_IDE1) {
- irq_desc[i].chip = &cobalt_irq_type;
+ desc->chip = &cobalt_irq_type;
}
else if (i == CO_IRQ_8259) {
- irq_desc[i].chip = &piix4_master_irq_type;
+ desc->chip = &piix4_master_irq_type;
}
else if (i < CO_IRQ_APIC0) {
- irq_desc[i].chip = &piix4_virtual_irq_type;
+ desc->chip = &piix4_virtual_irq_type;
}
else if (IS_CO_APIC(i)) {
- irq_desc[i].chip = &cobalt_irq_type;
+ desc->chip = &cobalt_irq_type;
}
}
diff --git a/arch/x86/mach-voyager/voyager_smp.c b/arch/x86/mach-voyager/voyager_smp.c
index ee0fba0..10840fd 100644
--- a/arch/x86/mach-voyager/voyager_smp.c
+++ b/arch/x86/mach-voyager/voyager_smp.c
@@ -1481,7 +1481,7 @@ static void disable_local_vic_irq(unsigned int irq)
* the interrupt off to another CPU */
static void before_handle_vic_irq(unsigned int irq)
{
- irq_desc_t *desc = irq_desc + irq;
+ irq_desc_t *desc = irq_desc(irq);
__u8 cpu = smp_processor_id();
_raw_spin_lock(&vic_irq_lock);
@@ -1516,7 +1516,7 @@ static void before_handle_vic_irq(unsigned int irq)
/* Finish the VIC interrupt: basically mask */
static void after_handle_vic_irq(unsigned int irq)
{
- irq_desc_t *desc = irq_desc + irq;
+ irq_desc_t *desc = irq_desc(irq);
_raw_spin_lock(&vic_irq_lock);
{
diff --git a/arch/xtensa/kernel/irq.c b/arch/xtensa/kernel/irq.c
index c9ea73b..6f26802 100644
--- a/arch/xtensa/kernel/irq.c
+++ b/arch/xtensa/kernel/irq.c
@@ -90,8 +90,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);
@@ -101,7 +103,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)
@@ -109,7 +111,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, "NMI: ");
for_each_online_cpu(j)
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index 8d29405..8157734 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -1058,7 +1058,7 @@ static void gpiolib_dbg_show(struct seq_file *s, struct gpio_chip *chip)
if (!is_out) {
int irq = gpio_to_irq(gpio);
- struct irq_desc *desc = irq_desc + irq;
+ struct irq_desc *desc = irq_desc(irq);
/* This races with request_irq(), set_irq_type(),
* and set_irq_wake() ... but those are "rare".
diff --git a/drivers/mfd/asic3.c b/drivers/mfd/asic3.c
index c6408a6..f612337 100644
--- a/drivers/mfd/asic3.c
+++ b/drivers/mfd/asic3.c
@@ -124,7 +124,7 @@ static void asic3_irq_demux(unsigned int irq, struct irq_desc *desc)
irqnr = asic->irq_base +
(ASIC3_GPIOS_PER_BANK * bank)
+ i;
- desc = irq_desc + irqnr;
+ desc = irq_desc(irqnr);
desc->handle_irq(irqnr, desc);
if (asic->irq_bothedge[bank] & bit)
asic3_irq_flip_edge(asic, base,
@@ -137,7 +137,7 @@ static void asic3_irq_demux(unsigned int irq, struct irq_desc *desc)
for (i = ASIC3_NUM_GPIOS; i < ASIC3_NR_IRQS; i++) {
/* They start at bit 4 and go up */
if (status & (1 << (i - ASIC3_NUM_GPIOS + 4))) {
- desc = irq_desc + asic->irq_base + i;
+ desc = irq_desc(asic->irq_base + i);
desc->handle_irq(asic->irq_base + i,
desc);
}
diff --git a/drivers/mfd/htc-egpio.c b/drivers/mfd/htc-egpio.c
index 6be4317..88f99a4 100644
--- a/drivers/mfd/htc-egpio.c
+++ b/drivers/mfd/htc-egpio.c
@@ -112,7 +112,7 @@ static void egpio_handler(unsigned int irq, struct irq_desc *desc)
/* Run irq handler */
pr_debug("got IRQ %d\n", irqpin);
irq = ei->irq_start + irqpin;
- desc = &irq_desc[irq];
+ desc = irq_desc(irq);
desc->handle_irq(irq, desc);
}
}
diff --git a/drivers/parisc/dino.c b/drivers/parisc/dino.c
index fd56128..6bba8e9 100644
--- a/drivers/parisc/dino.c
+++ b/drivers/parisc/dino.c
@@ -298,7 +298,8 @@ struct pci_port_ops dino_port_ops = {
static void dino_disable_irq(unsigned int irq)
{
- struct dino_device *dino_dev = irq_desc[irq].chip_data;
+ struct irq_desc *desc = irq_desc(irq);
+ struct dino_device *dino_dev = desc->chip_data;
int local_irq = gsc_find_local_irq(irq, dino_dev->global_irq, DINO_LOCAL_IRQS);
DBG(KERN_WARNING "%s(0x%p, %d)\n", __func__, dino_dev, irq);
@@ -310,7 +311,8 @@ static void dino_disable_irq(unsigned int irq)
static void dino_enable_irq(unsigned int irq)
{
- struct dino_device *dino_dev = irq_desc[irq].chip_data;
+ struct irq_desc *desc = irq_desc(irq);
+ struct dino_device *dino_dev = desc->chip_data;
int local_irq = gsc_find_local_irq(irq, dino_dev->global_irq, DINO_LOCAL_IRQS);
u32 tmp;
diff --git a/drivers/parisc/eisa.c b/drivers/parisc/eisa.c
index 771cef5..feb67d4 100644
--- a/drivers/parisc/eisa.c
+++ b/drivers/parisc/eisa.c
@@ -346,10 +346,10 @@ static int __init eisa_probe(struct parisc_device *dev)
}
/* Reserve IRQ2 */
- irq_desc[2].action = &irq2_action;
+ irq_desc(2)->action = &irq2_action;
for (i = 0; i < 16; i++) {
- irq_desc[i].chip = &eisa_interrupt_type;
+ irq_desc(i)->chip = &eisa_interrupt_type;
}
EISA_bus = 1;
diff --git a/drivers/parisc/gsc.c b/drivers/parisc/gsc.c
index f7d088b..f714f6a 100644
--- a/drivers/parisc/gsc.c
+++ b/drivers/parisc/gsc.c
@@ -108,7 +108,8 @@ int gsc_find_local_irq(unsigned int irq, int *global_irqs, int limit)
static void gsc_asic_disable_irq(unsigned int irq)
{
- struct gsc_asic *irq_dev = irq_desc[irq].chip_data;
+ struct irq_desc *desc = irq_desc(irq);
+ struct gsc_asic *irq_dev = desc->chip_data;
int local_irq = gsc_find_local_irq(irq, irq_dev->global_irq, 32);
u32 imr;
@@ -123,7 +124,8 @@ static void gsc_asic_disable_irq(unsigned int irq)
static void gsc_asic_enable_irq(unsigned int irq)
{
- struct gsc_asic *irq_dev = irq_desc[irq].chip_data;
+ struct irq_desc *desc = irq_desc(irq);
+ struct gsc_asic *irq_dev = desc->chip_data;
int local_irq = gsc_find_local_irq(irq, irq_dev->global_irq, 32);
u32 imr;
@@ -159,12 +161,14 @@ static struct hw_interrupt_type gsc_asic_interrupt_type = {
int gsc_assign_irq(struct hw_interrupt_type *type, void *data)
{
static int irq = GSC_IRQ_BASE;
+ struct irq_desc *desc;
if (irq > GSC_IRQ_MAX)
return NO_IRQ;
- irq_desc[irq].chip = type;
- irq_desc[irq].chip_data = data;
+ desc = irq_desc(irq);
+ desc->chip = type;
+ desc->chip_data = data;
return irq++;
}
diff --git a/drivers/parisc/iosapic.c b/drivers/parisc/iosapic.c
index 6fb3f79..8928823 100644
--- a/drivers/parisc/iosapic.c
+++ b/drivers/parisc/iosapic.c
@@ -619,7 +619,9 @@ iosapic_set_irt_data( struct vector_info *vi, u32 *dp0, u32 *dp1)
static struct vector_info *iosapic_get_vector(unsigned int irq)
{
- return irq_desc[irq].chip_data;
+ struct irq_desc *desc = irq_desc(irq);
+
+ return desc->chip_data;
}
static void iosapic_disable_irq(unsigned int irq)
diff --git a/drivers/parisc/superio.c b/drivers/parisc/superio.c
index 1e8d2d1..67e552d 100644
--- a/drivers/parisc/superio.c
+++ b/drivers/parisc/superio.c
@@ -363,7 +363,9 @@ int superio_fixup_irq(struct pci_dev *pcidev)
#endif
for (i = 0; i < 16; i++) {
- irq_desc[i].chip = &superio_interrupt_type;
+ struct irq_desc *desc = irq_desc(i);
+
+ desc->chip = &superio_interrupt_type;
}
/*
diff --git a/drivers/pcmcia/hd64465_ss.c b/drivers/pcmcia/hd64465_ss.c
index fb2bc1f..b4c9fab 100644
--- a/drivers/pcmcia/hd64465_ss.c
+++ b/drivers/pcmcia/hd64465_ss.c
@@ -234,15 +234,18 @@ static struct hw_interrupt_type hd64465_ss_irq_type = {
*/
static void hs_map_irq(hs_socket_t *sp, unsigned int irq)
{
+ struct irq_desc *desc;
+
DPRINTK("hs_map_irq(sock=%d irq=%d)\n", sp->number, irq);
if (irq >= HS_NUM_MAPPED_IRQS)
return;
+ desc = irq_desc(irq);
hs_mapped_irq[irq].sock = sp;
/* insert ourselves as the irq controller */
- hs_mapped_irq[irq].old_handler = irq_desc[irq].chip;
- irq_desc[irq].chip = &hd64465_ss_irq_type;
+ hs_mapped_irq[irq].old_handler = desc->chip;
+ desc->chip = &hd64465_ss_irq_type;
}
@@ -251,13 +254,16 @@ static void hs_map_irq(hs_socket_t *sp, unsigned int irq)
*/
static void hs_unmap_irq(hs_socket_t *sp, unsigned int irq)
{
+ struct irq_desc *desc;
+
DPRINTK("hs_unmap_irq(sock=%d irq=%d)\n", sp->number, irq);
if (irq >= HS_NUM_MAPPED_IRQS)
return;
+ desc = irq_desc(irq);
/* restore the original irq controller */
- irq_desc[irq].chip = hs_mapped_irq[irq].old_handler;
+ desc->chip = hs_mapped_irq[irq].old_handler;
}
/*============================================================*/
diff --git a/drivers/xen/events.c b/drivers/xen/events.c
index 8e329c2..430bd90 100644
--- a/drivers/xen/events.c
+++ b/drivers/xen/events.c
@@ -125,7 +125,7 @@ static void bind_evtchn_to_cpu(unsigned int chn, unsigned int cpu)
BUG_ON(irq == -1);
#ifdef CONFIG_SMP
- irq_desc[irq].affinity = cpumask_of_cpu(cpu);
+ irq_desc(irq)->affinity = cpumask_of_cpu(cpu);
#endif
__clear_bit(chn, cpu_evtchn_mask[cpu_evtchn[chn]]);
@@ -139,8 +139,10 @@ 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++)
- irq_desc[i].affinity = cpumask_of_cpu(0);
+ for (i = 0; i < nr_irqs; i++) {
+ struct irq_desc *desc = irq_desc(i);
+ desc->affinity = cpumask_of_cpu(0);
+ }
#endif
memset(cpu_evtchn, 0, sizeof(cpu_evtchn));
diff --git a/include/asm-ia64/hw_irq.h b/include/asm-ia64/hw_irq.h
index 5c99cbc..a38c34b 100644
--- a/include/asm-ia64/hw_irq.h
+++ b/include/asm-ia64/hw_irq.h
@@ -146,7 +146,7 @@ static inline void ia64_native_resend_irq(unsigned int vector)
* Default implementations for the irq-descriptor API:
*/
-extern irq_desc_t irq_desc[NR_IRQS];
+extern irq_desc_t irq_descX[NR_IRQS];
#ifndef CONFIG_IA64_GENERIC
static inline ia64_vector __ia64_irq_to_vector(int irq)
diff --git a/include/asm-mips/irq.h b/include/asm-mips/irq.h
index a58f0ee..f24b207 100644
--- a/include/asm-mips/irq.h
+++ b/include/asm-mips/irq.h
@@ -65,7 +65,7 @@ extern void smtc_forward_irq(unsigned int irq);
*/
#define IRQ_AFFINITY_HOOK(irq) \
do { \
- if (!cpu_isset(smp_processor_id(), irq_desc[irq].affinity)) { \
+ if (!cpu_isset(smp_processor_id(), irq_desc(irq)->affinity)) { \
smtc_forward_irq(irq); \
irq_exit(); \
return; \
diff --git a/include/asm-powerpc/irq.h b/include/asm-powerpc/irq.h
index 1ef8e30..8fd0df1 100644
--- a/include/asm-powerpc/irq.h
+++ b/include/asm-powerpc/irq.h
@@ -17,7 +17,7 @@
#include <asm/atomic.h>
-#define get_irq_desc(irq) (&irq_desc[(irq)])
+#define get_irq_desc(irq) (irq_desc(irq))
/* Define a way to iterate across irqs. */
#define for_each_irq(i) \
diff --git a/include/linux/irq.h b/include/linux/irq.h
index c22e870..4172140 100644
--- a/include/linux/irq.h
+++ b/include/linux/irq.h
@@ -154,6 +154,10 @@ struct irq_chip {
* @name: flow handler name for /proc/interrupts output
*/
struct irq_desc {
+ unsigned int irq;
+#ifdef CONFIG_HAVE_SPARSE_IRQ
+ struct irq_desc *next;
+#endif
irq_flow_handler_t handle_irq;
struct irq_chip *chip;
struct msi_desc *msi_desc;
@@ -181,10 +185,10 @@ 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];
+extern struct irq_desc *irq_desc(unsigned int 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];
#endif
/*
@@ -251,7 +255,10 @@ extern int no_irq_affinity;
static inline int irq_balancing_disabled(unsigned int irq)
{
- return irq_desc[irq].status & IRQ_NO_BALANCING_MASK;
+ struct irq_desc *desc;
+
+ desc = irq_desc(irq);
+ return desc->status & IRQ_NO_BALANCING_MASK;
}
/* Handle irq action chains: */
@@ -283,7 +290,7 @@ extern unsigned int __do_IRQ(unsigned int irq);
*/
static inline void generic_handle_irq(unsigned int irq)
{
- struct irq_desc *desc = irq_desc + irq;
+ struct irq_desc *desc = irq_desc(irq);
#ifdef CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ
desc->handle_irq(irq, desc);
@@ -327,7 +334,10 @@ __set_irq_handler(unsigned int irq, irq_flow_handler_t handle, int is_chained,
static inline void __set_irq_handler_unlocked(int irq,
irq_flow_handler_t handler)
{
- irq_desc[irq].handle_irq = handler;
+ struct irq_desc *desc;
+
+ desc = irq_desc(irq);
+ desc->handle_irq = handler;
}
/*
@@ -361,7 +371,7 @@ extern void destroy_irq(unsigned int irq);
/* Test to see if a driver has successfully requested an irq */
static inline int irq_has_action(unsigned int irq)
{
- struct irq_desc *desc = irq_desc + irq;
+ struct irq_desc *desc = irq_desc(irq);
return desc->action != NULL;
}
@@ -376,10 +386,10 @@ extern int set_irq_chip_data(unsigned int irq, void *data);
extern int set_irq_type(unsigned int irq, unsigned int type);
extern int set_irq_msi(unsigned int irq, struct msi_desc *entry);
-#define get_irq_chip(irq) (irq_desc[irq].chip)
-#define get_irq_chip_data(irq) (irq_desc[irq].chip_data)
-#define get_irq_data(irq) (irq_desc[irq].handler_data)
-#define get_irq_msi(irq) (irq_desc[irq].msi_desc)
+#define get_irq_chip(irq) (irq_desc(irq)->chip)
+#define get_irq_chip_data(irq) (irq_desc(irq)->chip_data)
+#define get_irq_data(irq) (irq_desc(irq)->handler_data)
+#define get_irq_msi(irq) (irq_desc(irq)->msi_desc)
#endif /* CONFIG_GENERIC_HARDIRQS */
diff --git a/kernel/irq/autoprobe.c b/kernel/irq/autoprobe.c
index c689e98..24e1a39 100644
--- a/kernel/irq/autoprobe.c
+++ b/kernel/irq/autoprobe.c
@@ -39,7 +39,7 @@ unsigned long probe_irq_on(void)
* flush such a longstanding irq before considering it as spurious.
*/
for (i = nr_irqs-1; i > 0; i--) {
- desc = irq_desc + i;
+ desc = irq_desc(i);
spin_lock_irq(&desc->lock);
if (!desc->action && !(desc->status & IRQ_NOPROBE)) {
@@ -69,7 +69,7 @@ unsigned long probe_irq_on(void)
* happened in the previous stage, it may have masked itself)
*/
for (i = nr_irqs-1; i > 0; i--) {
- desc = irq_desc + i;
+ desc = irq_desc(i);
spin_lock_irq(&desc->lock);
if (!desc->action && !(desc->status & IRQ_NOPROBE)) {
@@ -92,7 +92,7 @@ unsigned long probe_irq_on(void)
for (i = 0; i < nr_irqs; i++) {
unsigned int status;
- desc = irq_desc + i;
+ desc = irq_desc(i);
spin_lock_irq(&desc->lock);
status = desc->status;
@@ -131,7 +131,7 @@ unsigned int probe_irq_mask(unsigned long val)
mask = 0;
for (i = 0; i < nr_irqs; i++) {
- struct irq_desc *desc = irq_desc + i;
+ struct irq_desc *desc = irq_desc(i);
unsigned int status;
spin_lock_irq(&desc->lock);
@@ -174,7 +174,7 @@ int probe_irq_off(unsigned long val)
int i, irq_found = 0, nr_irqs = 0;
for (i = 0; i < nr_irqs; i++) {
- struct irq_desc *desc = irq_desc + i;
+ struct irq_desc *desc = irq_desc(i);
unsigned int status;
spin_lock_irq(&desc->lock);
diff --git a/kernel/irq/chip.c b/kernel/irq/chip.c
index 20a9307..b79337a 100644
--- a/kernel/irq/chip.c
+++ b/kernel/irq/chip.c
@@ -33,7 +33,7 @@ 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;
+ desc = irq_desc(irq);
spin_lock_irqsave(&desc->lock, flags);
desc->status = IRQ_DISABLED;
desc->chip = &no_irq_chip;
@@ -65,7 +65,7 @@ void dynamic_irq_cleanup(unsigned int irq)
return;
}
- desc = irq_desc + irq;
+ desc = irq_desc(irq);
spin_lock_irqsave(&desc->lock, flags);
if (desc->action) {
spin_unlock_irqrestore(&desc->lock, flags);
@@ -100,7 +100,7 @@ int set_irq_chip(unsigned int irq, struct irq_chip *chip)
if (!chip)
chip = &no_irq_chip;
- desc = irq_desc + irq;
+ desc = irq_desc(irq);
spin_lock_irqsave(&desc->lock, flags);
irq_chip_set_defaults(chip);
desc->chip = chip;
@@ -126,7 +126,7 @@ int set_irq_type(unsigned int irq, unsigned int type)
return -ENODEV;
}
- desc = irq_desc + irq;
+ desc = irq_desc(irq);
if (desc->chip->set_type) {
spin_lock_irqsave(&desc->lock, flags);
ret = desc->chip->set_type(irq, type);
@@ -154,7 +154,7 @@ int set_irq_data(unsigned int irq, void *data)
return -EINVAL;
}
- desc = irq_desc + irq;
+ desc = irq_desc(irq);
spin_lock_irqsave(&desc->lock, flags);
desc->handler_data = data;
spin_unlock_irqrestore(&desc->lock, flags);
@@ -179,7 +179,7 @@ int set_irq_msi(unsigned int irq, struct msi_desc *entry)
"Trying to install msi data for IRQ%d\n", irq);
return -EINVAL;
}
- desc = irq_desc + irq;
+ desc = irq_desc(irq);
spin_lock_irqsave(&desc->lock, flags);
desc->msi_desc = entry;
if (entry)
@@ -197,9 +197,10 @@ int set_irq_msi(unsigned int irq, struct msi_desc *entry)
*/
int set_irq_chip_data(unsigned int irq, void *data)
{
- struct irq_desc *desc = irq_desc + irq;
+ struct irq_desc *desc;
unsigned long flags;
+ desc = irq_desc(irq);
if (irq >= nr_irqs || !desc->chip) {
printk(KERN_ERR "BUG: bad set_irq_chip_data(IRQ#%d)\n", irq);
return -EINVAL;
@@ -218,8 +219,9 @@ EXPORT_SYMBOL(set_irq_chip_data);
*/
static void default_enable(unsigned int irq)
{
- struct irq_desc *desc = irq_desc + irq;
+ struct irq_desc *desc;
+ desc = irq_desc(irq);
desc->chip->unmask(irq);
desc->status &= ~IRQ_MASKED;
}
@@ -236,7 +238,10 @@ static void default_disable(unsigned int irq)
*/
static unsigned int default_startup(unsigned int irq)
{
- irq_desc[irq].chip->enable(irq);
+ struct irq_desc *desc;
+
+ desc = irq_desc(irq);
+ desc->chip->enable(irq);
return 0;
}
@@ -246,8 +251,9 @@ static unsigned int default_startup(unsigned int irq)
*/
static void default_shutdown(unsigned int irq)
{
- struct irq_desc *desc = irq_desc + irq;
+ struct irq_desc *desc;
+ desc = irq_desc(irq);
desc->chip->mask(irq);
desc->status |= IRQ_MASKED;
}
@@ -550,7 +556,7 @@ __set_irq_handler(unsigned int irq, irq_flow_handler_t handle, int is_chained,
return;
}
- desc = irq_desc + irq;
+ desc = irq_desc(irq);
if (!handle)
handle = handle_bad_irq;
@@ -615,7 +621,7 @@ void __init set_irq_noprobe(unsigned int irq)
return;
}
- desc = irq_desc + irq;
+ desc = irq_desc(irq);
spin_lock_irqsave(&desc->lock, flags);
desc->status |= IRQ_NOPROBE;
@@ -633,7 +639,7 @@ void __init set_irq_probe(unsigned int irq)
return;
}
- desc = irq_desc + irq;
+ desc = irq_desc(irq);
spin_lock_irqsave(&desc->lock, flags);
desc->status &= ~IRQ_NOPROBE;
diff --git a/kernel/irq/handle.c b/kernel/irq/handle.c
index e94eeca..d75c272 100644
--- a/kernel/irq/handle.c
+++ b/kernel/irq/handle.c
@@ -18,6 +18,14 @@
#include "internals.h"
+#ifdef CONFIG_TRACE_IRQFLAGS
+
+/*
+ * lockdep: we want to handle all irq_desc locks as a single lock-class:
+ */
+static struct lock_class_key irq_desc_lock_class;
+#endif
+
/**
* handle_bad_irq - handle spurious and unhandled irqs
* @irq: the interrupt number
@@ -50,7 +58,8 @@ handle_bad_irq(unsigned int irq, struct irq_desc *desc)
int nr_irqs = NR_IRQS;
#ifdef CONFIG_HAVE_DYN_ARRAY
-static struct irq_desc irq_desc_init __initdata = {
+static struct irq_desc irq_desc_init = {
+ .irq = -1U,
.status = IRQ_DISABLED,
.chip = &no_irq_chip,
.handle_irq = handle_bad_irq,
@@ -61,6 +70,27 @@ static struct irq_desc irq_desc_init __initdata = {
#endif
};
+
+static void init_one_irq_desc(struct irq_desc *desc)
+{
+ memcpy(desc, &irq_desc_init, sizeof(struct irq_desc));
+#ifdef CONFIG_TRACE_IRQFLAGS
+ lockdep_set_class(&desc->lock, &irq_desc_lock_class);
+#endif
+}
+
+#ifdef CONFIG_HAVE_SPARSE_IRQ
+static int nr_irq_desc = 32;
+
+static int __init parse_nr_irq_desc(char *arg)
+{
+ if (arg)
+ nr_irq_desc = simple_strtoul(arg, NULL, 0);
+ return 0;
+}
+
+early_param("nr_irq_desc", parse_nr_irq_desc);
+
static void __init init_work(void *data)
{
struct dyn_array *da = data;
@@ -70,26 +100,108 @@ static void __init init_work(void *data)
desc = *da->name;
for (i = 0; i < *da->nr; i++)
- memcpy(&desc[i], &irq_desc_init, sizeof(struct irq_desc));
+ init_one_irq_desc(&desc[i]);
+
+ for (i = 1; i < *da->nr; i++)
+ desc[i-1].next = &desc[i];
}
-struct irq_desc *irq_desc;
-DEFINE_DYN_ARRAY(irq_desc, sizeof(struct irq_desc), nr_irqs, PAGE_SIZE, init_work);
+static struct irq_desc *irq_descX;
+DEFINE_DYN_ARRAY(irq_descX, sizeof(struct irq_desc), nr_irq_desc, PAGE_SIZE, init_work);
+
+extern int after_bootmem;
+extern void *__alloc_bootmem_nopanic(unsigned long size,
+ unsigned long align,
+ unsigned long goal);
+struct irq_desc *irq_desc(unsigned int irq)
+{
+ struct irq_desc *desc, *desc_pri;
+ int i;
+ int count = 0;
+
+ BUG_ON(irq == -1U);
+
+ desc_pri = desc = &irq_descX[0];
+ while (desc) {
+ if (desc->irq == irq)
+ return desc;
+
+ if (desc->irq == -1U) {
+ desc->irq = irq;
+ return desc;
+ }
+ desc_pri = desc;
+ desc = desc->next;
+ count++;
+ }
+
+ /*
+ * we run out of pre-allocate ones, allocate more
+ */
+ printk(KERN_DEBUG "try to get more irq_desc %d\n", nr_irq_desc);
+
+ if (after_bootmem)
+ desc = kzalloc(sizeof(struct irq_desc)*nr_irq_desc, GFP_ATOMIC);
+ else
+ desc = __alloc_bootmem_nopanic(sizeof(struct irq_desc)*nr_irq_desc, PAGE_SIZE, 0);
+
+ if (!desc)
+ panic("please boot with nr_irq_desc= %d\n", count * 2);
+
+ for (i = 0; i < nr_irq_desc; i++)
+ init_one_irq_desc(&desc[i]);
+
+ for (i = 1; i < nr_irq_desc; i++)
+ desc[i-1].next = &desc[i];
+
+ desc->irq = irq;
+ desc_pri->next = desc;
+
+ return desc;
+}
+#else
+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++)
+ init_one_irq_desc(&desc[i]);
+
+}
+static struct irq_desc *irq_descX;
+DEFINE_DYN_ARRAY(irq_descX, sizeof(struct irq_desc), nr_irqs, PAGE_SIZE, init_work);
+
+#endif
#else
-struct irq_desc irq_desc[NR_IRQS] __cacheline_aligned_in_smp = {
+struct irq_desc irq_descX[NR_IRQS] __cacheline_aligned_in_smp = {
[0 ... NR_IRQS-1] = {
.status = IRQ_DISABLED,
.chip = &no_irq_chip,
.handle_irq = handle_bad_irq,
.depth = 1,
- .lock = __SPIN_LOCK_UNLOCKED(irq_desc->lock),
+ .lock = __SPIN_LOCK_UNLOCKED(irq_descX->lock),
#ifdef CONFIG_SMP
.affinity = CPU_MASK_ALL
#endif
}
};
+
+#endif
+
+#ifndef CONFIG_HAVE_SPARSE_IRQ
+struct irq_desc *irq_desc(unsigned int irq)
+{
+ if (irq < nr_irqs)
+ return &irq_descX[irq];
+
+ return NULL;
+}
#endif
/*
@@ -98,7 +210,10 @@ struct irq_desc irq_desc[NR_IRQS] __cacheline_aligned_in_smp = {
*/
static void ack_bad(unsigned int irq)
{
- print_irq_desc(irq, irq_desc + irq);
+ struct irq_desc *desc;
+
+ desc = irq_desc(irq);
+ print_irq_desc(irq, desc);
ack_bad_irq(irq);
}
@@ -195,7 +310,7 @@ irqreturn_t handle_IRQ_event(unsigned int irq, struct irqaction *action)
*/
unsigned int __do_IRQ(unsigned int irq)
{
- struct irq_desc *desc = irq_desc + irq;
+ struct irq_desc *desc = irq_desc(irq);
struct irqaction *action;
unsigned int status;
@@ -286,19 +401,16 @@ out:
}
#endif
-#ifdef CONFIG_TRACE_IRQFLAGS
-
-/*
- * lockdep: we want to handle all irq_desc locks as a single lock-class:
- */
-static struct lock_class_key irq_desc_lock_class;
+#ifdef CONFIG_TRACE_IRQFLAGS
void early_init_irq_lock_class(void)
{
+#ifndef CONFIG_HAVE_DYN_ARRAY
int i;
for (i = 0; i < nr_irqs; i++)
- lockdep_set_class(&irq_desc[i].lock, &irq_desc_lock_class);
+ lockdep_set_class(&irq_descX[i].lock, &irq_desc_lock_class);
+#endif
}
-
#endif
+
diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c
index 3bd67c8..4a31fc8 100644
--- a/kernel/irq/manage.c
+++ b/kernel/irq/manage.c
@@ -31,7 +31,7 @@ cpumask_t irq_default_affinity = CPU_MASK_ALL;
*/
void synchronize_irq(unsigned int irq)
{
- struct irq_desc *desc = irq_desc + irq;
+ struct irq_desc *desc = irq_desc(irq);
unsigned int status;
if (irq >= nr_irqs)
@@ -64,7 +64,7 @@ EXPORT_SYMBOL(synchronize_irq);
*/
int irq_can_set_affinity(unsigned int irq)
{
- struct irq_desc *desc = irq_desc + irq;
+ struct irq_desc *desc = irq_desc(irq);
if (CHECK_IRQ_PER_CPU(desc->status) || !desc->chip ||
!desc->chip->set_affinity)
@@ -81,7 +81,7 @@ int irq_can_set_affinity(unsigned int irq)
*/
int irq_set_affinity(unsigned int irq, cpumask_t cpumask)
{
- struct irq_desc *desc = irq_desc + irq;
+ struct irq_desc *desc = irq_desc(irq);
if (!desc->chip->set_affinity)
return -EINVAL;
@@ -111,14 +111,16 @@ int irq_set_affinity(unsigned int irq, cpumask_t cpumask)
int irq_select_affinity(unsigned int irq)
{
cpumask_t mask;
+ struct irq_desc *desc;
if (!irq_can_set_affinity(irq))
return 0;
cpus_and(mask, cpu_online_map, irq_default_affinity);
- irq_desc[irq].affinity = mask;
- irq_desc[irq].chip->set_affinity(irq, mask);
+ desc = irq_desc(irq);
+ desc->affinity = mask;
+ desc->chip->set_affinity(irq, mask);
set_balance_irq_affinity(irq, mask);
return 0;
@@ -140,7 +142,7 @@ 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 = irq_desc(irq);
unsigned long flags;
if (irq >= nr_irqs)
@@ -169,7 +171,7 @@ EXPORT_SYMBOL(disable_irq_nosync);
*/
void disable_irq(unsigned int irq)
{
- struct irq_desc *desc = irq_desc + irq;
+ struct irq_desc *desc = irq_desc(irq);
if (irq >= nr_irqs)
return;
@@ -211,7 +213,7 @@ 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 = irq_desc(irq);
unsigned long flags;
if (irq >= nr_irqs)
@@ -225,7 +227,7 @@ EXPORT_SYMBOL(enable_irq);
int set_irq_wake_real(unsigned int irq, unsigned int on)
{
- struct irq_desc *desc = irq_desc + irq;
+ struct irq_desc *desc = irq_desc(irq);
int ret = -ENXIO;
if (desc->chip->set_wake)
@@ -248,7 +250,7 @@ int set_irq_wake_real(unsigned int irq, unsigned int on)
*/
int set_irq_wake(unsigned int irq, unsigned int on)
{
- struct irq_desc *desc = irq_desc + irq;
+ struct irq_desc *desc = irq_desc(irq);
unsigned long flags;
int ret = 0;
@@ -288,12 +290,13 @@ EXPORT_SYMBOL(set_irq_wake);
*/
int can_request_irq(unsigned int irq, unsigned long irqflags)
{
+ struct irq_desc *desc = irq_desc(irq);
struct irqaction *action;
- if (irq >= nr_irqs || irq_desc[irq].status & IRQ_NOREQUEST)
+ if (irq >= nr_irqs || desc->status & IRQ_NOREQUEST)
return 0;
- action = irq_desc[irq].action;
+ action =desc->action;
if (action)
if (irqflags & action->flags & IRQF_SHARED)
action = NULL;
@@ -342,7 +345,7 @@ 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 = irq_desc(irq);
struct irqaction *old, **p;
const char *old_name = NULL;
unsigned long flags;
@@ -506,7 +509,7 @@ void free_irq(unsigned int irq, void *dev_id)
if (irq >= nr_irqs)
return;
- desc = irq_desc + irq;
+ desc = irq_desc(irq);
spin_lock_irqsave(&desc->lock, flags);
p = &desc->action;
for (;;) {
@@ -602,6 +605,7 @@ int request_irq(unsigned int irq, irq_handler_t handler,
{
struct irqaction *action;
int retval;
+ struct irq_desc *desc;
#ifdef CONFIG_LOCKDEP
/*
@@ -619,7 +623,8 @@ int request_irq(unsigned int irq, irq_handler_t handler,
return -EINVAL;
if (irq >= nr_irqs)
return -EINVAL;
- if (irq_desc[irq].status & IRQ_NOREQUEST)
+ desc = irq_desc(irq);
+ if (desc->status & IRQ_NOREQUEST)
return -EINVAL;
if (!handler)
return -EINVAL;
diff --git a/kernel/irq/migration.c b/kernel/irq/migration.c
index 77b7acc..62a447c 100644
--- a/kernel/irq/migration.c
+++ b/kernel/irq/migration.c
@@ -3,18 +3,18 @@
void set_pending_irq(unsigned int irq, cpumask_t mask)
{
- struct irq_desc *desc = irq_desc + irq;
+ struct irq_desc *desc = irq_desc(irq);
unsigned long flags;
spin_lock_irqsave(&desc->lock, flags);
desc->status |= IRQ_MOVE_PENDING;
- irq_desc[irq].pending_mask = mask;
+ desc->pending_mask = mask;
spin_unlock_irqrestore(&desc->lock, flags);
}
void move_masked_irq(int irq)
{
- struct irq_desc *desc = irq_desc + irq;
+ struct irq_desc *desc = irq_desc(irq);
cpumask_t tmp;
if (likely(!(desc->status & IRQ_MOVE_PENDING)))
@@ -30,7 +30,7 @@ void move_masked_irq(int irq)
desc->status &= ~IRQ_MOVE_PENDING;
- if (unlikely(cpus_empty(irq_desc[irq].pending_mask)))
+ if (unlikely(cpus_empty(desc->pending_mask)))
return;
if (!desc->chip->set_affinity)
@@ -38,7 +38,7 @@ void move_masked_irq(int irq)
assert_spin_locked(&desc->lock);
- cpus_and(tmp, irq_desc[irq].pending_mask, cpu_online_map);
+ cpus_and(tmp, desc->pending_mask, cpu_online_map);
/*
* If there was a valid mask to work with, please
@@ -55,12 +55,12 @@ void move_masked_irq(int irq)
if (likely(!cpus_empty(tmp))) {
desc->chip->set_affinity(irq,tmp);
}
- cpus_clear(irq_desc[irq].pending_mask);
+ cpus_clear(desc->pending_mask);
}
void move_native_irq(int irq)
{
- struct irq_desc *desc = irq_desc + irq;
+ struct irq_desc *desc = irq_desc(irq);
if (likely(!(desc->status & IRQ_MOVE_PENDING)))
return;
diff --git a/kernel/irq/proc.c b/kernel/irq/proc.c
index 74d7922..ffb6000 100644
--- a/kernel/irq/proc.c
+++ b/kernel/irq/proc.c
@@ -19,7 +19,7 @@ static struct proc_dir_entry *root_irq_dir;
static int irq_affinity_read_proc(char *page, char **start, off_t off,
int count, int *eof, void *data)
{
- struct irq_desc *desc = irq_desc + (long)data;
+ struct irq_desc *desc = irq_desc((long)data);
cpumask_t *mask = &desc->affinity;
int len;
@@ -45,8 +45,9 @@ static int irq_affinity_write_proc(struct file *file, const char __user *buffer,
{
unsigned int irq = (int)(long)data, full_count = count, err;
cpumask_t new_value;
+ struct irq_desc *desc = irq_desc(irq);
- if (!irq_desc[irq].chip->set_affinity || no_irq_affinity ||
+ if (!desc->chip->set_affinity || no_irq_affinity ||
irq_balancing_disabled(irq))
return -EIO;
@@ -112,20 +113,20 @@ static int default_affinity_write(struct file *file, const char __user *buffer,
static int irq_spurious_read(char *page, char **start, off_t off,
int count, int *eof, void *data)
{
- struct irq_desc *d = &irq_desc[(long) data];
+ struct irq_desc *desc = irq_desc((long) data);
return sprintf(page, "count %u\n"
"unhandled %u\n"
"last_unhandled %u ms\n",
- d->irq_count,
- d->irqs_unhandled,
- jiffies_to_msecs(d->last_unhandled));
+ desc->irq_count,
+ desc->irqs_unhandled,
+ jiffies_to_msecs(desc->last_unhandled));
}
#define MAX_NAMELEN 128
static int name_unique(unsigned int irq, struct irqaction *new_action)
{
- struct irq_desc *desc = irq_desc + irq;
+ struct irq_desc *desc = irq_desc(irq);
struct irqaction *action;
unsigned long flags;
int ret = 1;
@@ -145,8 +146,9 @@ static int name_unique(unsigned int irq, struct irqaction *new_action)
void register_handler_proc(unsigned int irq, struct irqaction *action)
{
char name [MAX_NAMELEN];
+ struct irq_desc *desc = irq_desc(irq);
- if (!irq_desc[irq].dir || action->dir || !action->name ||
+ if (!desc->dir || action->dir || !action->name ||
!name_unique(irq, action))
return;
@@ -154,7 +156,7 @@ void register_handler_proc(unsigned int irq, struct irqaction *action)
snprintf(name, MAX_NAMELEN, "%s", action->name);
/* create /proc/irq/1234/handler/ */
- action->dir = proc_mkdir(name, irq_desc[irq].dir);
+ action->dir = proc_mkdir(name, desc->dir);
}
#undef MAX_NAMELEN
@@ -165,22 +167,22 @@ void register_irq_proc(unsigned int irq)
{
char name [MAX_NAMELEN];
struct proc_dir_entry *entry;
+ struct irq_desc *desc = irq_desc(irq);
if (!root_irq_dir ||
- (irq_desc[irq].chip == &no_irq_chip) ||
- irq_desc[irq].dir)
+ (desc->chip == &no_irq_chip) || desc->dir)
return;
memset(name, 0, MAX_NAMELEN);
sprintf(name, "%d", irq);
/* create /proc/irq/1234 */
- irq_desc[irq].dir = proc_mkdir(name, root_irq_dir);
+ desc->dir = proc_mkdir(name, root_irq_dir);
#ifdef CONFIG_SMP
{
/* create /proc/irq/<irq>/smp_affinity */
- entry = create_proc_entry("smp_affinity", 0600, irq_desc[irq].dir);
+ entry = create_proc_entry("smp_affinity", 0600, desc->dir);
if (entry) {
entry->data = (void *)(long)irq;
@@ -190,7 +192,7 @@ void register_irq_proc(unsigned int irq)
}
#endif
- entry = create_proc_entry("spurious", 0444, irq_desc[irq].dir);
+ entry = create_proc_entry("spurious", 0444, desc->dir);
if (entry) {
entry->data = (void *)(long)irq;
entry->read_proc = irq_spurious_read;
@@ -201,8 +203,10 @@ void register_irq_proc(unsigned int irq)
void unregister_handler_proc(unsigned int irq, struct irqaction *action)
{
- if (action->dir)
- remove_proc_entry(action->dir->name, irq_desc[irq].dir);
+ if (action->dir) {
+ struct irq_desc *desc = irq_desc(irq);
+ remove_proc_entry(action->dir->name, desc->dir);
+ }
}
void register_default_affinity_proc(void)
diff --git a/kernel/irq/resend.c b/kernel/irq/resend.c
index cba8aa5..7ecabac 100644
--- a/kernel/irq/resend.c
+++ b/kernel/irq/resend.c
@@ -36,7 +36,7 @@ static void resend_irqs(unsigned long arg)
while (!bitmap_empty(irqs_resend, nr_irqs)) {
irq = find_first_bit(irqs_resend, nr_irqs);
clear_bit(irq, irqs_resend);
- desc = irq_desc + irq;
+ desc = irq_desc(irq);
local_irq_disable();
desc->handle_irq(irq, desc);
local_irq_enable();
diff --git a/kernel/irq/spurious.c b/kernel/irq/spurious.c
index e26ca1e..b9d5098 100644
--- a/kernel/irq/spurious.c
+++ b/kernel/irq/spurious.c
@@ -92,11 +92,12 @@ static int misrouted_irq(int irq)
int ok = 0;
for (i = 1; i < nr_irqs; i++) {
- struct irq_desc *desc = irq_desc + i;
+ struct irq_desc *desc;
if (i == irq) /* Already tried */
continue;
+ desc = irq_desc(i);
if (try_one_irq(i, desc))
ok = 1;
}
@@ -108,7 +109,7 @@ static void poll_spurious_irqs(unsigned long dummy)
{
int i;
for (i = 1; i < nr_irqs; i++) {
- struct irq_desc *desc = irq_desc + i;
+ struct irq_desc *desc = irq_desc(i);
unsigned int status;
/* Racy but it doesn't matter */
--
1.5.4.5
^ permalink raw reply related [flat|nested] 66+ messages in thread
* [PATCH 27/42] x86: add irq_cfg in io_apic_64.c
2008-08-08 21:52 ` [PATCH 26/42] x86_64: use irq_desc() together with dyn_array Yinghai Lu
@ 2008-08-08 21:52 ` Yinghai Lu
2008-08-08 21:52 ` [PATCH 28/42] x86: put irq_2_pin pointer into irq_cfg Yinghai Lu
0 siblings, 1 reply; 66+ messages in thread
From: Yinghai Lu @ 2008-08-08 21:52 UTC (permalink / raw)
To: Ingo Molnar, Thomas Gleixner, H. Peter Anvin, Eric W. Biederman,
Dhaval Giani, Mike Travis, Andrew Morton
Cc: linux-kernel, Yinghai Lu
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()
Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
---
arch/x86/kernel/io_apic_64.c | 182 ++++++++++++++++++++++++++++++++---------
1 files changed, 142 insertions(+), 40 deletions(-)
diff --git a/arch/x86/kernel/io_apic_64.c b/arch/x86/kernel/io_apic_64.c
index 9dbd189..1f70684 100644
--- a/arch/x86/kernel/io_apic_64.c
+++ b/arch/x86/kernel/io_apic_64.c
@@ -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_ms
if (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));
--
1.5.4.5
^ permalink raw reply related [flat|nested] 66+ messages in thread
* [PATCH 28/42] x86: put irq_2_pin pointer into irq_cfg
2008-08-08 21:52 ` [PATCH 27/42] x86: add irq_cfg in io_apic_64.c Yinghai Lu
@ 2008-08-08 21:52 ` Yinghai Lu
2008-08-08 21:52 ` [PATCH 29/42] x86: put timer_rand_state pointer into irq_desc Yinghai Lu
0 siblings, 1 reply; 66+ messages in thread
From: Yinghai Lu @ 2008-08-08 21:52 UTC (permalink / raw)
To: Ingo Molnar, Thomas Gleixner, H. Peter Anvin, Eric W. Biederman,
Dhaval Giani, Mike Travis, Andrew Morton
Cc: linux-kernel, Yinghai Lu
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.
Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
---
arch/x86/kernel/io_apic_64.c | 162 +++++++++++++++++++++++++++++++-----------
1 files changed, 121 insertions(+), 41 deletions(-)
diff --git a/arch/x86/kernel/io_apic_64.c b/arch/x86/kernel/io_apic_64.c
index 1f70684..c1941b7 100644
--- a/arch/x86/kernel/io_apic_64.c
+++ b/arch/x86/kernel/io_apic_64.c
@@ -58,10 +58,11 @@
#define __apicdebuginit(type) static type __init
struct 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):
*/
--
1.5.4.5
^ permalink raw reply related [flat|nested] 66+ messages in thread
* [PATCH 29/42] x86: put timer_rand_state pointer into irq_desc
2008-08-08 21:52 ` [PATCH 28/42] x86: put irq_2_pin pointer into irq_cfg Yinghai Lu
@ 2008-08-08 21:52 ` Yinghai Lu
2008-08-08 21:52 ` [PATCH 30/42] x86: move kstat_irqs from kstat to irq_desc Yinghai Lu
0 siblings, 1 reply; 66+ messages in thread
From: Yinghai Lu @ 2008-08-08 21:52 UTC (permalink / raw)
To: Ingo Molnar, Thomas Gleixner, H. Peter Anvin, Eric W. Biederman,
Dhaval Giani, Mike Travis, Andrew Morton
Cc: linux-kernel, Yinghai Lu
so could remove timer_rand_state pointer array
Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
---
drivers/char/random.c | 31 ++++++++++++++++++++-----------
include/linux/irq.h | 2 ++
2 files changed, 22 insertions(+), 11 deletions(-)
diff --git a/drivers/char/random.c b/drivers/char/random.c
index 872669e..d683576 100644
--- a/drivers/char/random.c
+++ b/drivers/char/random.c
@@ -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
diff --git a/include/linux/irq.h b/include/linux/irq.h
index 4172140..ed2a79e 100644
--- a/include/linux/irq.h
+++ b/include/linux/irq.h
@@ -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;
--
1.5.4.5
^ permalink raw reply related [flat|nested] 66+ messages in thread
* [PATCH 30/42] x86: move kstat_irqs from kstat to irq_desc
2008-08-08 21:52 ` [PATCH 29/42] x86: put timer_rand_state pointer into irq_desc Yinghai Lu
@ 2008-08-08 21:52 ` Yinghai Lu
2008-08-08 21:52 ` [PATCH 31/42] replace loop with nr_irqs with for_each_irq_desc Yinghai Lu
0 siblings, 1 reply; 66+ messages in thread
From: Yinghai Lu @ 2008-08-08 21:52 UTC (permalink / raw)
To: Ingo Molnar, Thomas Gleixner, H. Peter Anvin, Eric W. Biederman,
Dhaval Giani, Mike Travis, Andrew Morton
Cc: linux-kernel, Yinghai Lu
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.
Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
---
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(-)
diff --git a/arch/alpha/kernel/irq.c b/arch/alpha/kernel/irq.c
index 85d7173..10b9ebc 100644
--- a/arch/alpha/kernel/irq.c
+++ b/arch/alpha/kernel/irq.c
@@ -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",
diff --git a/arch/alpha/kernel/irq_alpha.c b/arch/alpha/kernel/irq_alpha.c
index feddec7..060ad37 100644
--- a/arch/alpha/kernel/irq_alpha.c
+++ b/arch/alpha/kernel/irq_alpha.c
@@ -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);
}
diff --git a/arch/arm/kernel/irq.c b/arch/arm/kernel/irq.c
index a542c8d..d4a74e7 100644
--- a/arch/arm/kernel/irq.c
+++ b/arch/arm/kernel/irq.c
@@ -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)
diff --git a/arch/arm/mach-ns9xxx/irq.c b/arch/arm/mach-ns9xxx/irq.c
index ca85d24..1b9c272 100644
--- a/arch/arm/mach-ns9xxx/irq.c
+++ b/arch/arm/mach-ns9xxx/irq.c
@@ -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)))
diff --git a/arch/avr32/kernel/irq.c b/arch/avr32/kernel/irq.c
index 28d5d03..b75a957 100644
--- a/arch/avr32/kernel/irq.c
+++ b/arch/avr32/kernel/irq.c
@@ -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)
diff --git a/arch/cris/kernel/irq.c b/arch/cris/kernel/irq.c
index b280e0a..55598b1 100644
--- a/arch/cris/kernel/irq.c
+++ b/arch/cris/kernel/irq.c
@@ -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);
diff --git a/arch/frv/kernel/irq.c b/arch/frv/kernel/irq.c
index 4770219..1bdb600 100644
--- a/arch/frv/kernel/irq.c
+++ b/arch/frv/kernel/irq.c
@@ -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;
diff --git a/arch/h8300/kernel/irq.c b/arch/h8300/kernel/irq.c
index 6c2e213..65bb8b8 100644
--- a/arch/h8300/kernel/irq.c
+++ b/arch/h8300/kernel/irq.c
@@ -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);
diff --git a/arch/ia64/kernel/irq.c b/arch/ia64/kernel/irq.c
index b9290c6..f0dda1c 100644
--- a/arch/ia64/kernel/irq.c
+++ b/arch/ia64/kernel/irq.c
@@ -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);
diff --git a/arch/ia64/kernel/irq_ia64.c b/arch/ia64/kernel/irq_ia64.c
index 28d3d48..fa28483 100644
--- a/arch/ia64/kernel/irq_ia64.c
+++ b/arch/ia64/kernel/irq_ia64.c
@@ -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);
diff --git a/arch/m32r/kernel/irq.c b/arch/m32r/kernel/irq.c
index d9c2a00..753709d 100644
--- a/arch/m32r/kernel/irq.c
+++ b/arch/m32r/kernel/irq.c
@@ -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);
diff --git a/arch/m68k/kernel/ints.c b/arch/m68k/kernel/ints.c
index ded7dd2..669ab97 100644
--- a/arch/m68k/kernel/ints.c
+++ b/arch/m68k/kernel/ints.c
@@ -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");
diff --git a/arch/m68k/sun3/sun3ints.c b/arch/m68k/sun3/sun3ints.c
index 7364cd6..cf4f3e8 100644
--- a/arch/m68k/sun3/sun3ints.c
+++ b/arch/m68k/sun3/sun3ints.c
@@ -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;
}
diff --git a/arch/mips/kernel/irq.c b/arch/mips/kernel/irq.c
index 3c2e8f0..6c27486 100644
--- a/arch/mips/kernel/irq.c
+++ b/arch/mips/kernel/irq.c
@@ -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);
diff --git a/arch/mips/sgi-ip22/ip22-int.c b/arch/mips/sgi-ip22/ip22-int.c
index f6d9bf4..e3bf905 100644
--- a/arch/mips/sgi-ip22/ip22-int.c
+++ b/arch/mips/sgi-ip22/ip22-int.c
@@ -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();
}
diff --git a/arch/mips/sgi-ip22/ip22-time.c b/arch/mips/sgi-ip22/ip22-time.c
index 10e5054..0669426 100644
--- a/arch/mips/sgi-ip22/ip22-time.c
+++ b/arch/mips/sgi-ip22/ip22-time.c
@@ -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();
diff --git a/arch/mips/sibyte/bcm1480/smp.c b/arch/mips/sibyte/bcm1480/smp.c
index bd9eeb4..028759c 100644
--- a/arch/mips/sibyte/bcm1480/smp.c
+++ b/arch/mips/sibyte/bcm1480/smp.c
@@ -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;
diff --git a/arch/mips/sibyte/sb1250/irq.c b/arch/mips/sibyte/sb1250/irq.c
index fd4d58c..30a59fb 100644
--- a/arch/mips/sibyte/sb1250/irq.c
+++ b/arch/mips/sibyte/sb1250/irq.c
@@ -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);
diff --git a/arch/mips/sibyte/sb1250/smp.c b/arch/mips/sibyte/sb1250/smp.c
index 0734b93..40449f7 100644
--- a/arch/mips/sibyte/sb1250/smp.c
+++ b/arch/mips/sibyte/sb1250/smp.c
@@ -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;
diff --git a/arch/mn10300/kernel/irq.c b/arch/mn10300/kernel/irq.c
index 38c218c..888d2b3 100644
--- a/arch/mn10300/kernel/irq.c
+++ b/arch/mn10300/kernel/irq.c
@@ -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);
diff --git a/arch/parisc/kernel/irq.c b/arch/parisc/kernel/irq.c
index e8a3883..a9e5581 100644
--- a/arch/parisc/kernel/irq.c
+++ b/arch/parisc/kernel/irq.c
@@ -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
diff --git a/arch/powerpc/kernel/irq.c b/arch/powerpc/kernel/irq.c
index 0e14f8c..4ffd5d9 100644
--- a/arch/powerpc/kernel/irq.c
+++ b/arch/powerpc/kernel/irq.c
@@ -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 */
diff --git a/arch/powerpc/platforms/cell/interrupt.c b/arch/powerpc/platforms/cell/interrupt.c
index 2d5bb22..490b619 100644
--- a/arch/powerpc/platforms/cell/interrupt.c
+++ b/arch/powerpc/platforms/cell/interrupt.c
@@ -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;
diff --git a/arch/s390/kernel/irq.c b/arch/s390/kernel/irq.c
index e7c5bfb..3d40087 100644
--- a/arch/s390/kernel/irq.c
+++ b/arch/s390/kernel/irq.c
@@ -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');
diff --git a/arch/s390/kernel/s390_ext.c b/arch/s390/kernel/s390_ext.c
index e019b41..e868194 100644
--- a/arch/s390/kernel/s390_ext.c
+++ b/arch/s390/kernel/s390_ext.c
@@ -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))
diff --git a/arch/sh/kernel/irq.c b/arch/sh/kernel/irq.c
index 290befa..5f81932 100644
--- a/arch/sh/kernel/irq.c
+++ b/arch/sh/kernel/irq.c
@@ -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);
diff --git a/arch/sparc/kernel/irq.c b/arch/sparc/kernel/irq.c
index 93e1d1c..3d803ea 100644
--- a/arch/sparc/kernel/irq.c
+++ b/arch/sparc/kernel/irq.c
@@ -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);
diff --git a/arch/sparc/kernel/sun4d_irq.c b/arch/sparc/kernel/sun4d_irq.c
index 1290b59..9c09e2d 100644
--- a/arch/sparc/kernel/sun4d_irq.c
+++ b/arch/sparc/kernel/sun4d_irq.c
@@ -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)
diff --git a/arch/sparc64/kernel/irq.c b/arch/sparc64/kernel/irq.c
index bbed41c..8956e18 100644
--- a/arch/sparc64/kernel/irq.c
+++ b/arch/sparc64/kernel/irq.c
@@ -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);
diff --git a/arch/sparc64/kernel/time.c b/arch/sparc64/kernel/time.c
index a0c6a97..1cd35ba 100644
--- a/arch/sparc64/kernel/time.c
+++ b/arch/sparc64/kernel/time.c
@@ -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
diff --git a/arch/um/kernel/irq.c b/arch/um/kernel/irq.c
index 2a37d33..aed625c 100644
--- a/arch/um/kernel/irq.c
+++ b/arch/um/kernel/irq.c
@@ -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);
diff --git a/arch/x86/kernel/io_apic_32.c b/arch/x86/kernel/io_apic_32.c
index 942983c..cb18dbb 100644
--- a/arch/x86/kernel/io_apic_32.c
+++ b/arch/x86/kernel/io_apic_32.c
@@ -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);
diff --git a/arch/x86/kernel/irq_32.c b/arch/x86/kernel/irq_32.c
index c6750fe..8ff73e7 100644
--- a/arch/x86/kernel/irq_32.c
+++ b/arch/x86/kernel/irq_32.c
@@ -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);
diff --git a/arch/x86/kernel/irq_64.c b/arch/x86/kernel/irq_64.c
index 5e0a938..61fe896 100644
--- a/arch/x86/kernel/irq_64.c
+++ b/arch/x86/kernel/irq_64.c
@@ -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);
diff --git a/arch/x86/kernel/visws_quirks.c b/arch/x86/kernel/visws_quirks.c
index 6fa3128..c9f2010 100644
--- a/arch/x86/kernel/visws_quirks.c
+++ b/arch/x86/kernel/visws_quirks.c
@@ -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);
diff --git a/arch/xtensa/kernel/irq.c b/arch/xtensa/kernel/irq.c
index 6f26802..a662aa2 100644
--- a/arch/xtensa/kernel/irq.c
+++ b/arch/xtensa/kernel/irq.c
@@ -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);
diff --git a/drivers/s390/cio/cio.c b/drivers/s390/cio/cio.c
index 33bff8f..6e09719 100644
--- a/drivers/s390/cio/cio.c
+++ b/drivers/s390/cio/cio.c
@@ -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
*/
diff --git a/fs/proc/proc_misc.c b/fs/proc/proc_misc.c
index 1968251..aeb0a40 100644
--- a/fs/proc/proc_misc.c
+++ b/fs/proc/proc_misc.c
@@ -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;
}
diff --git a/include/linux/irq.h b/include/linux/irq.h
index ed2a79e..f802abd 100644
--- a/include/linux/irq.h
+++ b/include/linux/irq.h
@@ -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:
diff --git a/include/linux/kernel_stat.h b/include/linux/kernel_stat.h
index fe1f7fe..8d8e84b 100644
--- a/include/linux/kernel_stat.h
+++ b/include/linux/kernel_stat.h
@@ -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;
}
diff --git a/kernel/irq/chip.c b/kernel/irq/chip.c
index b79337a..9b8ea26 100644
--- a/kernel/irq/chip.c
+++ b/kernel/irq/chip.c
@@ -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);
diff --git a/kernel/irq/handle.c b/kernel/irq/handle.c
index d75c272..1f23f78 100644
--- a/kernel/irq/handle.c
+++ b/kernel/irq/handle.c
@@ -37,7 +37,7 @@ void
handle_bad_irq(unsigned int irq, struct irq_desc *desc)
{
print_irq_desc(irq, desc);
- kstat_this_cpu.irqs[irq]++;
+ kstat_irqs_this_cpu(desc)++;
ack_bad_irq(irq);
}
@@ -79,17 +79,38 @@ static void init_one_irq_desc(struct irq_desc *desc)
#endif
}
-#ifdef CONFIG_HAVE_SPARSE_IRQ
-static int nr_irq_desc = 32;
+extern int after_bootmem;
+extern void *__alloc_bootmem_nopanic(unsigned long size,
+ unsigned long align,
+ unsigned long goal);
-static int __init parse_nr_irq_desc(char *arg)
+static void init_kstat_irqs(struct irq_desc *desc, int nr_desc, int nr)
{
- if (arg)
- nr_irq_desc = simple_strtoul(arg, NULL, 0);
- return 0;
+ unsigned long bytes, total_bytes;
+ char *ptr;
+ int i;
+ unsigned long phys;
+
+ /* Compute how many bytes we need per irq and allocate them */
+ bytes = nr * sizeof(unsigned int);
+ total_bytes = bytes * nr_desc;
+ if (after_bootmem)
+ ptr = kzalloc(total_bytes, GFP_ATOMIC);
+ else
+ ptr = __alloc_bootmem_nopanic(total_bytes, PAGE_SIZE, 0);
+
+ if (!ptr)
+ panic(" can not allocate kstat_irqs\n");
+
+ phys = __pa(ptr);
+ printk(KERN_DEBUG "kstat_irqs ==> [%#lx - %#lx]\n", phys, phys + total_bytes);
+
+ for (i = 0; i < nr_desc; i++) {
+ desc[i].kstat_irqs = (unsigned int *)ptr;
+ ptr += bytes;
+ }
}
-early_param("nr_irq_desc", parse_nr_irq_desc);
static void __init init_work(void *data)
{
@@ -99,25 +120,44 @@ static void __init init_work(void *data)
desc = *da->name;
- for (i = 0; i < *da->nr; i++)
+ for (i = 0; i < *da->nr; i++) {
init_one_irq_desc(&desc[i]);
+#ifndef CONFIG_HAVE_SPARSE_IRQ
+ desc[i].irq = i;
+#endif
+ }
+#ifdef CONFIG_HAVE_SPARSE_IRQ
for (i = 1; i < *da->nr; i++)
desc[i-1].next = &desc[i];
+#endif
+
+ /* init kstat_irqs, nr_cpu_ids is ready already */
+ init_kstat_irqs(desc, *da->nr, nr_cpu_ids);
}
+#ifdef CONFIG_HAVE_SPARSE_IRQ
+static int nr_irq_desc = 32;
+
+static int __init parse_nr_irq_desc(char *arg)
+{
+ if (arg)
+ nr_irq_desc = simple_strtoul(arg, NULL, 0);
+ return 0;
+}
+
+early_param("nr_irq_desc", parse_nr_irq_desc);
+
static struct irq_desc *irq_descX;
DEFINE_DYN_ARRAY(irq_descX, sizeof(struct irq_desc), nr_irq_desc, PAGE_SIZE, init_work);
-extern int after_bootmem;
-extern void *__alloc_bootmem_nopanic(unsigned long size,
- unsigned long align,
- unsigned long goal);
struct irq_desc *irq_desc(unsigned int irq)
{
struct irq_desc *desc, *desc_pri;
int i;
int count = 0;
+ unsigned long phys;
+ unsigned long total_bytes;
BUG_ON(irq == -1U);
@@ -140,38 +180,34 @@ struct irq_desc *irq_desc(unsigned int irq)
*/
printk(KERN_DEBUG "try to get more irq_desc %d\n", nr_irq_desc);
+ total_bytes = sizeof(struct irq_desc) * nr_irq_desc;
if (after_bootmem)
- desc = kzalloc(sizeof(struct irq_desc)*nr_irq_desc, GFP_ATOMIC);
+ desc = kzalloc(total_bytes, GFP_ATOMIC);
else
- desc = __alloc_bootmem_nopanic(sizeof(struct irq_desc)*nr_irq_desc, PAGE_SIZE, 0);
+ desc = __alloc_bootmem_nopanic(total_bytes, PAGE_SIZE, 0);
if (!desc)
panic("please boot with nr_irq_desc= %d\n", count * 2);
+ phys = __pa(desc);
+ printk(KERN_DEBUG "irq_desc ==> [%#lx - %#lx]\n", phys, phys + total_bytes);
+
for (i = 0; i < nr_irq_desc; i++)
init_one_irq_desc(&desc[i]);
for (i = 1; i < nr_irq_desc; i++)
desc[i-1].next = &desc[i];
+ /* init kstat_irqs, nr_cpu_ids is ready already */
+ init_kstat_irqs(desc, nr_irq_desc, nr_cpu_ids);
+
desc->irq = irq;
desc_pri->next = desc;
return desc;
}
#else
-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++)
- init_one_irq_desc(&desc[i]);
-
-}
static struct irq_desc *irq_descX;
DEFINE_DYN_ARRAY(irq_descX, sizeof(struct irq_desc), nr_irqs, PAGE_SIZE, init_work);
@@ -314,7 +350,7 @@ unsigned int __do_IRQ(unsigned int irq)
struct irqaction *action;
unsigned int status;
- kstat_this_cpu.irqs[irq]++;
+ kstat_irqs_this_cpu(desc)++;
if (CHECK_IRQ_PER_CPU(desc->status)) {
irqreturn_t action_ret;
@@ -414,3 +450,10 @@ void early_init_irq_lock_class(void)
}
#endif
+unsigned int kstat_irqs_cpu(unsigned int irq, int cpu)
+{
+ struct irq_desc *desc = irq_desc(irq);
+ return desc->kstat_irqs[cpu];
+}
+EXPORT_SYMBOL(kstat_irqs_cpu);
+
diff --git a/kernel/sched.c b/kernel/sched.c
index 21c0839..55cb4ce 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -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
--
1.5.4.5
^ permalink raw reply related [flat|nested] 66+ messages in thread
* [PATCH 31/42] replace loop with nr_irqs with for_each_irq_desc
2008-08-08 21:52 ` [PATCH 30/42] x86: move kstat_irqs from kstat to irq_desc Yinghai Lu
@ 2008-08-08 21:52 ` Yinghai Lu
2008-08-08 21:52 ` [PATCH 32/42] replace loop with nr_irqs with for_each_irq_icfg Yinghai Lu
0 siblings, 1 reply; 66+ messages in thread
From: Yinghai Lu @ 2008-08-08 21:52 UTC (permalink / raw)
To: Ingo Molnar, Thomas Gleixner, H. Peter Anvin, Eric W. Biederman,
Dhaval Giani, Mike Travis, Andrew Morton
Cc: linux-kernel, Yinghai Lu
so don't all irq_desc at begining to allocate all.
and only call that when needed
Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
---
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(-)
diff --git a/arch/x86/kernel/io_apic_64.c b/arch/x86/kernel/io_apic_64.c
index c1941b7..784a882 100644
--- a/arch/x86/kernel/io_apic_64.c
+++ b/arch/x86/kernel/io_apic_64.c
@@ -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;
diff --git a/arch/x86/kernel/irq_64.c b/arch/x86/kernel/irq_64.c
index 61fe896..f79b68b 100644
--- a/arch/x86/kernel/irq_64.c
+++ b/arch/x86/kernel/irq_64.c
@@ -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);
diff --git a/arch/x86/kernel/irqinit_64.c b/arch/x86/kernel/irqinit_64.c
index 583db8b..4c55edf 100644
--- a/arch/x86/kernel/irqinit_64.c
+++ b/arch/x86/kernel/irqinit_64.c
@@ -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;
- }
}
}
diff --git a/fs/proc/proc_misc.c b/fs/proc/proc_misc.c
index aeb0a40..32de344 100644
--- a/fs/proc/proc_misc.c
+++ b/fs/proc/proc_misc.c
@@ -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;
}
diff --git a/include/linux/irq.h b/include/linux/irq.h
index f802abd..a712287 100644
--- a/include/linux/irq.h
+++ b/include/linux/irq.h
@@ -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()])
diff --git a/kernel/irq/handle.c b/kernel/irq/handle.c
index 1f23f78..e2cfbb6 100644
--- a/kernel/irq/handle.c
+++ b/kernel/irq/handle.c
@@ -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
/*
diff --git a/kernel/irq/internals.h b/kernel/irq/internals.h
index 08a849a..605e88c 100644
--- a/kernel/irq/internals.h
+++ b/kernel/irq/internals.h
@@ -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,
diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c
index 4a31fc8..2bbe43e 100644
--- a/kernel/irq/manage.c
+++ b/kernel/irq/manage.c
@@ -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);
diff --git a/kernel/irq/proc.c b/kernel/irq/proc.c
index ffb6000..32dd7b9 100644
--- a/kernel/irq/proc.c
+++ b/kernel/irq/proc.c
@@ -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);
}
--
1.5.4.5
^ permalink raw reply related [flat|nested] 66+ messages in thread
* [PATCH 32/42] replace loop with nr_irqs with for_each_irq_icfg
2008-08-08 21:52 ` [PATCH 31/42] replace loop with nr_irqs with for_each_irq_desc Yinghai Lu
@ 2008-08-08 21:52 ` Yinghai Lu
2008-08-08 21:52 ` [PATCH 33/42] remove >= nr_irqs checking with config_have_sparse_irq Yinghai Lu
0 siblings, 1 reply; 66+ messages in thread
From: Yinghai Lu @ 2008-08-08 21:52 UTC (permalink / raw)
To: Ingo Molnar, Thomas Gleixner, H. Peter Anvin, Eric W. Biederman,
Dhaval Giani, Mike Travis, Andrew Morton
Cc: linux-kernel, Yinghai Lu
so don't all irq_cfg at begining to allocate all.
and only call that when needed
Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
---
arch/x86/kernel/io_apic_64.c | 24 ++++++++++++------------
1 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/arch/x86/kernel/io_apic_64.c b/arch/x86/kernel/io_apic_64.c
index 784a882..1d1a70d 100644
--- a/arch/x86/kernel/io_apic_64.c
+++ b/arch/x86/kernel/io_apic_64.c
@@ -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,
--
1.5.4.5
^ permalink raw reply related [flat|nested] 66+ messages in thread
* [PATCH 33/42] remove >= nr_irqs checking with config_have_sparse_irq
2008-08-08 21:52 ` [PATCH 32/42] replace loop with nr_irqs with for_each_irq_icfg Yinghai Lu
@ 2008-08-08 21:52 ` Yinghai Lu
2008-08-08 21:52 ` [PATCH 34/42] x86_64: add irq_desc in function in paramater Yinghai Lu
0 siblings, 1 reply; 66+ messages in thread
From: Yinghai Lu @ 2008-08-08 21:52 UTC (permalink / raw)
To: Ingo Molnar, Thomas Gleixner, H. Peter Anvin, Eric W. Biederman,
Dhaval Giani, Mike Travis, Andrew Morton
Cc: linux-kernel, Yinghai Lu
v2: fix checking about result irq_cfg_without_new, so could use msi again
Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
---
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(-)
diff --git a/arch/x86/kernel/io_apic_64.c b/arch/x86/kernel/io_apic_64.c
index 1d1a70d..36d6387 100644
--- a/arch/x86/kernel/io_apic_64.c
+++ b/arch/x86/kernel/io_apic_64.c
@@ -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);
diff --git a/arch/x86/kernel/irq_64.c b/arch/x86/kernel/irq_64.c
index f79b68b..b94faa1 100644
--- a/arch/x86/kernel/irq_64.c
+++ b/arch/x86/kernel/irq_64.c
@@ -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)
diff --git a/drivers/char/random.c b/drivers/char/random.c
index d683576..128a28a 100644
--- a/drivers/char/random.c
+++ b/drivers/char/random.c
@@ -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;
diff --git a/fs/proc/proc_misc.c b/fs/proc/proc_misc.c
index 32de344..e16c20a 100644
--- a/fs/proc/proc_misc.c
+++ b/fs/proc/proc_misc.c
@@ -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;
}
diff --git a/kernel/irq/chip.c b/kernel/irq/chip.c
index 9b8ea26..fed5ce7 100644
--- a/kernel/irq/chip.c
+++ b/kernel/irq/chip.c
@@ -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);
diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c
index 2bbe43e..ad7294c 100644
--- a/kernel/irq/manage.c
+++ b/kernel/irq/manage.c
@@ -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;
--
1.5.4.5
^ permalink raw reply related [flat|nested] 66+ messages in thread
* [PATCH 34/42] x86_64: add irq_desc in function in paramater
2008-08-08 21:52 ` [PATCH 33/42] remove >= nr_irqs checking with config_have_sparse_irq Yinghai Lu
@ 2008-08-08 21:52 ` Yinghai Lu
2008-08-08 21:52 ` [PATCH 35/42] x86: check with without_new in show_interrupts Yinghai Lu
0 siblings, 1 reply; 66+ messages in thread
From: Yinghai Lu @ 2008-08-08 21:52 UTC (permalink / raw)
To: Ingo Molnar, Thomas Gleixner, H. Peter Anvin, Eric W. Biederman,
Dhaval Giani, Mike Travis, Andrew Morton
Cc: linux-kernel, Yinghai Lu
So could remove some duplicated calling to irq_desc
Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
---
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(-)
diff --git a/arch/x86/kernel/io_apic_32.c b/arch/x86/kernel/io_apic_32.c
index cb18dbb..7cb3411 100644
--- a/arch/x86/kernel/io_apic_32.c
+++ b/arch/x86/kernel/io_apic_32.c
@@ -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
diff --git a/arch/x86/kernel/io_apic_64.c b/arch/x86/kernel/io_apic_64.c
index 36d6387..fc1c6ba 100644
--- a/arch/x86/kernel/io_apic_64.c
+++ b/arch/x86/kernel/io_apic_64.c
@@ -505,13 +505,12 @@ 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)
+static void set_ioapic_affinity_irq(unsigned int irq, struct irq_desc *desc, cpumask_t mask)
{
struct irq_cfg *cfg = irq_cfg(irq);
unsigned long flags;
unsigned int dest;
cpumask_t tmp;
- struct irq_desc *desc;
cpus_and(tmp, mask, cpu_online_map);
if (cpus_empty(tmp))
@@ -528,7 +527,6 @@ static void set_ioapic_affinity_irq(unsigned int irq, cpumask_t mask)
*/
dest = SET_APIC_LOGICAL_ID(dest);
- desc = irq_desc(irq);
spin_lock_irqsave(&ioapic_lock, flags);
__target_IO_APIC_irq(irq, dest, cfg->vector);
desc->affinity = mask;
@@ -1874,7 +1872,7 @@ static void ir_irq_migration(struct work_struct *work)
continue;
}
- desc->chip->set_affinity(irq, desc->pending_mask);
+ desc->chip->set_affinity(irq, desc, desc->pending_mask);
spin_unlock_irqrestore(&desc->lock, flags);
}
}
@@ -1883,10 +1881,8 @@ static void ir_irq_migration(struct work_struct *work)
/*
* Migrates the IRQ destination in the process context.
*/
-static void set_ir_ioapic_affinity_irq(unsigned int irq, cpumask_t mask)
+static void set_ir_ioapic_affinity_irq(unsigned int irq, struct irq_desc *desc, cpumask_t mask)
{
- struct irq_desc *desc = irq_desc(irq);
-
if (desc->status & IRQ_LEVEL) {
desc->status |= IRQ_MOVE_PENDING;
desc->pending_mask = mask;
@@ -1953,32 +1949,32 @@ static void irq_complete_move(unsigned int irq)
static inline void irq_complete_move(unsigned int irq) {}
#endif
#ifdef CONFIG_INTR_REMAP
-static void ack_x2apic_level(unsigned int irq)
+static void ack_x2apic_level(unsigned int irq, struct irq_desc *desc)
{
ack_x2APIC_irq();
}
-static void ack_x2apic_edge(unsigned int irq)
+static void ack_x2apic_edge(unsigned int irq, struct irq_desc *desc)
{
ack_x2APIC_irq();
}
#endif
-static void ack_apic_edge(unsigned int irq)
+static void ack_apic_edge(unsigned int irq, struct irq_desc *desc)
{
irq_complete_move(irq);
- move_native_irq(irq);
+ move_native_irq(irq, desc);
ack_APIC_irq();
}
-static void ack_apic_level(unsigned int irq)
+static void ack_apic_level(unsigned int irq, struct irq_desc *desc)
{
int do_unmask_irq = 0;
irq_complete_move(irq);
#ifdef CONFIG_GENERIC_PENDING_IRQ
/* If we are moving the irq we need to mask it */
- if (unlikely(irq_desc(irq)->status & IRQ_MOVE_PENDING)) {
+ if (unlikely(desc->status & IRQ_MOVE_PENDING)) {
do_unmask_irq = 1;
mask_IO_APIC_irq(irq);
}
@@ -2019,7 +2015,7 @@ static void ack_apic_level(unsigned int irq)
* and you can go talk to the chipset vendor about it.
*/
if (!io_apic_level_ack_pending(irq))
- move_masked_irq(irq);
+ move_masked_irq(irq, desc);
unmask_IO_APIC_irq(irq);
}
}
@@ -2104,7 +2100,7 @@ static void mask_lapic_irq(unsigned int irq)
apic_write(APIC_LVT0, v | APIC_LVT_MASKED);
}
-static void ack_lapic_irq (unsigned int irq)
+static void ack_lapic_irq (unsigned int irq, struct irq_desc *desc)
{
ack_APIC_irq();
}
@@ -2594,13 +2590,12 @@ 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)
+static void set_msi_irq_affinity(unsigned int irq, struct irq_desc *desc, cpumask_t mask)
{
struct irq_cfg *cfg;
struct msi_msg msg;
unsigned int dest;
cpumask_t tmp;
- struct irq_desc *desc;
cpus_and(tmp, mask, cpu_online_map);
if (cpus_empty(tmp))
@@ -2621,7 +2616,6 @@ static void set_msi_irq_affinity(unsigned int irq, cpumask_t mask)
msg.address_lo |= MSI_ADDR_DEST_ID(dest);
write_msi_msg(irq, &msg);
- desc = irq_desc(irq);
desc->affinity = mask;
}
@@ -2630,13 +2624,12 @@ static void set_msi_irq_affinity(unsigned int irq, cpumask_t mask)
* Migrate the MSI irq to another cpumask. This migration is
* done in the process context using interrupt-remapping hardware.
*/
-static void ir_set_msi_irq_affinity(unsigned int irq, cpumask_t mask)
+static void ir_set_msi_irq_affinity(unsigned int irq, struct irq_desc *desc, cpumask_t mask)
{
struct irq_cfg *cfg;
unsigned int dest;
cpumask_t tmp, cleanup_mask;
struct irte irte;
- struct irq_desc *desc;
cpus_and(tmp, mask, cpu_online_map);
if (cpus_empty(tmp))
@@ -2672,7 +2665,6 @@ static void ir_set_msi_irq_affinity(unsigned int irq, cpumask_t mask)
cfg->move_in_progress = 0;
}
- desc = irq_desc(irq);
desc->affinity = mask;
}
#endif
@@ -2853,13 +2845,12 @@ void arch_teardown_msi_irq(unsigned int irq)
#ifdef CONFIG_DMAR
#ifdef CONFIG_SMP
-static void dmar_msi_set_affinity(unsigned int irq, cpumask_t mask)
+static void dmar_msi_set_affinity(unsigned int irq, struct irq_desc *desc, cpumask_t mask)
{
struct irq_cfg *cfg;
struct msi_msg msg;
unsigned int dest;
cpumask_t tmp;
- struct irq_desc *desc;
cpus_and(tmp, mask, cpu_online_map);
if (cpus_empty(tmp))
@@ -2880,7 +2871,6 @@ static void dmar_msi_set_affinity(unsigned int irq, cpumask_t mask)
msg.address_lo |= MSI_ADDR_DEST_ID(dest);
dmar_msi_write(irq, &msg);
- desc = irq_desc(irq);
desc->affinity = mask;
}
#endif /* CONFIG_SMP */
@@ -2933,12 +2923,11 @@ static void target_ht_irq(unsigned int irq, unsigned int dest, u8 vector)
write_ht_irq_msg(irq, &msg);
}
-static void set_ht_irq_affinity(unsigned int irq, cpumask_t mask)
+static void set_ht_irq_affinity(unsigned int irq, struct irq_desc *desc, cpumask_t mask)
{
struct irq_cfg *cfg;
unsigned int dest;
cpumask_t tmp;
- struct irq_desc *desc;
cpus_and(tmp, mask, cpu_online_map);
if (cpus_empty(tmp))
@@ -2952,7 +2941,6 @@ static void set_ht_irq_affinity(unsigned int irq, cpumask_t mask)
dest = cpu_mask_to_apicid(tmp);
target_ht_irq(irq, dest, cfg->vector);
- desc = irq_desc(irq);
desc->affinity = mask;
}
#endif
@@ -3080,6 +3068,7 @@ void __init setup_ioapic_dest(void)
{
int pin, ioapic, irq, irq_entry;
struct irq_cfg *cfg;
+ struct irq_desc *desc;
if (skip_ioapic_setup == 1)
return;
@@ -3091,6 +3080,8 @@ 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.
@@ -3102,10 +3093,10 @@ void __init setup_ioapic_dest(void)
irq_polarity(irq_entry));
#ifdef CONFIG_INTR_REMAP
else if (intr_remapping_enabled)
- set_ir_ioapic_affinity_irq(irq, TARGET_CPUS);
+ set_ir_ioapic_affinity_irq(irq, desc, TARGET_CPUS);
#endif
else
- set_ioapic_affinity_irq(irq, TARGET_CPUS);
+ set_ioapic_affinity_irq(irq, desc, TARGET_CPUS);
}
}
diff --git a/arch/x86/kernel/irq_32.c b/arch/x86/kernel/irq_32.c
index 8ff73e7..7d93253 100644
--- a/arch/x86/kernel/irq_32.c
+++ b/arch/x86/kernel/irq_32.c
@@ -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();
diff --git a/arch/x86/kernel/irq_64.c b/arch/x86/kernel/irq_64.c
index b94faa1..007e4a2 100644
--- a/arch/x86/kernel/irq_64.c
+++ b/arch/x86/kernel/irq_64.c
@@ -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;
diff --git a/drivers/mfd/tc6393xb.c b/drivers/mfd/tc6393xb.c
index f4fd797..9ae9ec8 100644
--- a/drivers/mfd/tc6393xb.c
+++ b/drivers/mfd/tc6393xb.c
@@ -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);
+ }
}
}
diff --git a/drivers/parisc/dino.c b/drivers/parisc/dino.c
index 6bba8e9..7ae81e1 100644
--- a/drivers/parisc/dino.c
+++ b/drivers/parisc/dino.c
@@ -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);
diff --git a/drivers/parisc/eisa.c b/drivers/parisc/eisa.c
index feb67d4..67142ee 100644
--- a/drivers/parisc/eisa.c
+++ b/drivers/parisc/eisa.c
@@ -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 */
diff --git a/drivers/parisc/gsc.c b/drivers/parisc/gsc.c
index f714f6a..3e1b6e5 100644
--- a/drivers/parisc/gsc.c
+++ b/drivers/parisc/gsc.c
@@ -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);
diff --git a/drivers/parisc/superio.c b/drivers/parisc/superio.c
index 67e552d..51749eb 100644
--- a/drivers/parisc/superio.c
+++ b/drivers/parisc/superio.c
@@ -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.
diff --git a/include/linux/irq.h b/include/linux/irq.h
index a712287..d04182a 100644
--- a/include/linux/irq.h
+++ b/include/linux/irq.h
@@ -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
}
diff --git a/init/main.c b/init/main.c
index 3454b4a..a0ecfdf 100644
--- a/init/main.c
+++ b/init/main.c
@@ -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
}
diff --git a/kernel/irq/chip.c b/kernel/irq/chip.c
index fed5ce7..dcac270 100644
--- a/kernel/irq/chip.c
+++ b/kernel/irq/chip.c
@@ -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
diff --git a/kernel/irq/handle.c b/kernel/irq/handle.c
index e2cfbb6..e9b54a5 100644
--- a/kernel/irq/handle.c
+++ b/kernel/irq/handle.c
@@ -196,6 +196,21 @@ struct irq_desc *irq_desc(unsigned int irq)
* we run out of pre-allocate ones, allocate more
*/
printk(KERN_DEBUG "try to get more irq_desc %d\n", nr_irq_desc);
+ {
+ /* double check if some one mess up the list */
+ struct irq_desc *desc;
+ int count = 0;
+
+ desc = &irq_descX[0];
+ while (desc) {
+ printk("found irq_desc for irq %d\n", desc->irq);
+ if (desc->next)
+ printk("found irq_desc for irq %d and next will be irq %d\n", desc->irq, desc->next->irq);
+ desc = desc->next;
+ count++;
+ }
+ printk("all preallocted %d\n", count);
+ }
total_bytes = sizeof(struct irq_desc) * nr_irq_desc;
if (after_bootmem)
@@ -220,6 +235,21 @@ 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);
+ }
return desc;
}
@@ -265,6 +295,13 @@ struct irq_desc *irq_desc_without_new(unsigned int irq)
* What should we do if we get a hw irq event on an illegal vector?
* Each architecture has to answer this themself.
*/
+#ifdef CONFIG_HAVE_SPARSE_IRQ
+static void ack_bad(unsigned int irq, struct irq_desc *desc)
+{
+ print_irq_desc(irq, desc);
+ ack_bad_irq(irq);
+}
+#else
static void ack_bad(unsigned int irq)
{
struct irq_desc *desc;
@@ -273,6 +310,7 @@ static void ack_bad(unsigned int irq)
print_irq_desc(irq, desc);
ack_bad_irq(irq);
}
+#endif
/*
* NOP functions
@@ -281,6 +319,12 @@ static void noop(unsigned int irq)
{
}
+#ifdef CONFIG_HAVE_SPARSE_IRQ
+static void noop_desc(unsigned int irq, struct irq_desc *desc)
+{
+}
+#endif
+
static unsigned int noop_ret(unsigned int irq)
{
return 0;
@@ -309,7 +353,11 @@ struct irq_chip dummy_irq_chip = {
.shutdown = noop,
.enable = noop,
.disable = noop,
+#ifdef CONFIG_HAVE_SPARSE_IRQ
+ .ack = noop_desc,
+#else
.ack = noop,
+#endif
.mask = noop,
.unmask = noop,
.end = noop,
@@ -365,9 +413,8 @@ irqreturn_t handle_IRQ_event(unsigned int irq, struct irqaction *action)
* This is the original x86 implementation which is used for every
* interrupt type.
*/
-unsigned int __do_IRQ(unsigned int irq)
+unsigned int __do_IRQ(unsigned int irq, struct irq_desc *desc)
{
- struct irq_desc *desc = irq_desc(irq);
struct irqaction *action;
unsigned int status;
@@ -378,8 +425,13 @@ unsigned int __do_IRQ(unsigned int irq)
/*
* No locking required for CPU-local interrupts:
*/
- if (desc->chip->ack)
+ if (desc->chip->ack) {
+#ifdef CONFIG_HAVE_SPARSE_IRQ
+ desc->chip->ack(irq, desc);
+#else
desc->chip->ack(irq);
+#endif
+ }
if (likely(!(desc->status & IRQ_DISABLED))) {
action_ret = handle_IRQ_event(irq, desc->action);
if (!noirqdebug)
@@ -390,8 +442,13 @@ unsigned int __do_IRQ(unsigned int irq)
}
spin_lock(&desc->lock);
- if (desc->chip->ack)
+ if (desc->chip->ack) {
+#ifdef CONFIG_HAVE_SPARSE_IRQ
+ desc->chip->ack(irq, desc);
+#else
desc->chip->ack(irq);
+#endif
+ }
/*
* REPLAY is when Linux resends an IRQ that was dropped earlier
* WAITING is used by probe to mark irqs that are being tested
diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c
index ad7294c..e4db607 100644
--- a/kernel/irq/manage.c
+++ b/kernel/irq/manage.c
@@ -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;
diff --git a/kernel/irq/migration.c b/kernel/irq/migration.c
index 62a447c..ea1bda1 100644
--- a/kernel/irq/migration.c
+++ b/kernel/irq/migration.c
@@ -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);
}
--
1.5.4.5
^ permalink raw reply related [flat|nested] 66+ messages in thread
* [PATCH 35/42] x86: check with without_new in show_interrupts
2008-08-08 21:52 ` [PATCH 34/42] x86_64: add irq_desc in function in paramater Yinghai Lu
@ 2008-08-08 21:52 ` Yinghai Lu
2008-08-08 21:52 ` [PATCH 36/42] x86_64: introduce irq_cfg_with_new Yinghai Lu
0 siblings, 1 reply; 66+ messages in thread
From: Yinghai Lu @ 2008-08-08 21:52 UTC (permalink / raw)
To: Ingo Molnar, Thomas Gleixner, H. Peter Anvin, Eric W. Biederman,
Dhaval Giani, Mike Travis, Andrew Morton
Cc: linux-kernel, Yinghai Lu
so don't get new one that we don't need
Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
---
arch/x86/kernel/irq_64.c | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/arch/x86/kernel/irq_64.c b/arch/x86/kernel/irq_64.c
index 007e4a2..42b2c12 100644
--- a/arch/x86/kernel/irq_64.c
+++ b/arch/x86/kernel/irq_64.c
@@ -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
--
1.5.4.5
^ permalink raw reply related [flat|nested] 66+ messages in thread
* [PATCH 36/42] x86_64: introduce irq_cfg_with_new
2008-08-08 21:52 ` [PATCH 35/42] x86: check with without_new in show_interrupts Yinghai Lu
@ 2008-08-08 21:52 ` Yinghai Lu
2008-08-08 21:52 ` [PATCH 37/42] x86_64: introduce irq_desc_with_new Yinghai Lu
0 siblings, 1 reply; 66+ messages in thread
From: Yinghai Lu @ 2008-08-08 21:52 UTC (permalink / raw)
To: Ingo Molnar, Thomas Gleixner, H. Peter Anvin, Eric W. Biederman,
Dhaval Giani, Mike Travis, Andrew Morton
Cc: linux-kernel, Yinghai Lu
So could only call that one time, when we call add_irq_2_pin
Singed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
---
arch/x86/kernel/io_apic_64.c | 16 +++++++++++-----
1 files changed, 11 insertions(+), 5 deletions(-)
diff --git a/arch/x86/kernel/io_apic_64.c b/arch/x86/kernel/io_apic_64.c
index fc1c6ba..1466e4b 100644
--- a/arch/x86/kernel/io_apic_64.c
+++ b/arch/x86/kernel/io_apic_64.c
@@ -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;
--
1.5.4.5
^ permalink raw reply related [flat|nested] 66+ messages in thread
* [PATCH 37/42] x86_64: introduce irq_desc_with_new
2008-08-08 21:52 ` [PATCH 36/42] x86_64: introduce irq_cfg_with_new Yinghai Lu
@ 2008-08-08 21:52 ` Yinghai Lu
2008-08-08 21:52 ` [PATCH 38/42] seperate irq_descX with irq_descX_free Yinghai Lu
0 siblings, 1 reply; 66+ messages in thread
From: Yinghai Lu @ 2008-08-08 21:52 UTC (permalink / raw)
To: Ingo Molnar, Thomas Gleixner, H. Peter Anvin, Eric W. Biederman,
Dhaval Giani, Mike Travis, Andrew Morton
Cc: linux-kernel, Yinghai Lu
So could only call that one time
Singed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
---
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(-)
diff --git a/arch/x86/kernel/io_apic_64.c b/arch/x86/kernel/io_apic_64.c
index 1466e4b..f8baf58 100644
--- a/arch/x86/kernel/io_apic_64.c
+++ b/arch/x86/kernel/io_apic_64.c
@@ -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
diff --git a/arch/x86/kernel/irq_64.c b/arch/x86/kernel/irq_64.c
index 42b2c12..7db6843 100644
--- a/arch/x86/kernel/irq_64.c
+++ b/arch/x86/kernel/irq_64.c
@@ -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 {
diff --git a/arch/x86/kernel/irqinit_64.c b/arch/x86/kernel/irqinit_64.c
index 4c55edf..45fca9d 100644
--- a/arch/x86/kernel/irqinit_64.c
+++ b/arch/x86/kernel/irqinit_64.c
@@ -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;
diff --git a/fs/proc/proc_misc.c b/fs/proc/proc_misc.c
index e16c20a..c9ee1f7 100644
--- a/fs/proc/proc_misc.c
+++ b/fs/proc/proc_misc.c
@@ -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) {
diff --git a/include/linux/irq.h b/include/linux/irq.h
index d04182a..0d9578e 100644
--- a/include/linux/irq.h
+++ b/include/linux/irq.h
@@ -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
diff --git a/kernel/irq/chip.c b/kernel/irq/chip.c
index dcac270..bfd02f7 100644
--- a/kernel/irq/chip.c
+++ b/kernel/irq/chip.c
@@ -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;
diff --git a/kernel/irq/handle.c b/kernel/irq/handle.c
index e9b54a5..194d815 100644
--- a/kernel/irq/handle.c
+++ b/kernel/irq/handle.c
@@ -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);
}
--
1.5.4.5
^ permalink raw reply related [flat|nested] 66+ messages in thread
* [PATCH 38/42] seperate irq_descX with irq_descX_free
2008-08-08 21:52 ` [PATCH 37/42] x86_64: introduce irq_desc_with_new Yinghai Lu
@ 2008-08-08 21:52 ` Yinghai Lu
2008-08-08 21:52 ` [PATCH 39/42] x86_64: sperate irq_cfgx with irq_cfgx_free Yinghai Lu
0 siblings, 1 reply; 66+ messages in thread
From: Yinghai Lu @ 2008-08-08 21:52 UTC (permalink / raw)
To: Ingo Molnar, Thomas Gleixner, H. Peter Anvin, Eric W. Biederman,
Dhaval Giani, Mike Travis, Andrew Morton
Cc: linux-kernel, Yinghai Lu
so later don't need compare with -1U
Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
---
include/linux/irq.h | 2 +-
kernel/irq/handle.c | 113 ++++++++++++++++++++++++++------------------------
2 files changed, 60 insertions(+), 55 deletions(-)
diff --git a/include/linux/irq.h b/include/linux/irq.h
index 0d9578e..d130119 100644
--- a/include/linux/irq.h
+++ b/include/linux/irq.h
@@ -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
diff --git a/kernel/irq/handle.c b/kernel/irq/handle.c
index 194d815..0f5ea0c 100644
--- a/kernel/irq/handle.c
+++ b/kernel/irq/handle.c
@@ -111,6 +111,11 @@ static void init_kstat_irqs(struct irq_desc *desc, int nr_desc, int nr)
}
}
+#ifdef CONFIG_HAVE_SPARSE_IRQ
+static struct irq_desc *irq_descX_free;
+struct irq_desc *irq_descX;
+#endif
+
static void __init init_work(void *data)
{
struct dyn_array *da = data;
@@ -126,13 +131,16 @@ static void __init init_work(void *data)
#endif
}
+ /* init kstat_irqs, nr_cpu_ids is ready already */
+ init_kstat_irqs(desc, *da->nr, nr_cpu_ids);
+
#ifdef CONFIG_HAVE_SPARSE_IRQ
for (i = 1; i < *da->nr; i++)
desc[i-1].next = &desc[i];
-#endif
- /* init kstat_irqs, nr_cpu_ids is ready already */
- init_kstat_irqs(desc, *da->nr, nr_cpu_ids);
+ irq_descX_free = irq_descX;
+ irq_descX = NULL;
+#endif
}
#ifdef CONFIG_HAVE_SPARSE_IRQ
@@ -147,23 +155,17 @@ static int __init parse_nr_irq_desc(char *arg)
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(unsigned int irq)
{
struct irq_desc *desc;
- BUG_ON(irq == -1U);
-
- desc = &irq_descX[0];
+ desc = irq_descX;
while (desc) {
if (desc->irq == irq)
return desc;
- if (desc->irq == -1U)
- return NULL;
-
desc = desc->next;
}
return NULL;
@@ -173,21 +175,12 @@ struct irq_desc *irq_desc_with_new(unsigned int irq)
struct irq_desc *desc, *desc_pri;
int i;
int count = 0;
- unsigned long phys;
- unsigned long total_bytes;
-
- BUG_ON(irq == -1U);
- desc_pri = desc = &irq_descX[0];
+ desc_pri = desc = irq_descX;
while (desc) {
if (desc->irq == irq)
return desc;
- if (desc->irq == -1U) {
- desc->irq = irq;
- printk("found new irq_desc for irq %d\n", desc->irq);
- return desc;
- }
desc_pri = desc;
desc = desc->next;
count++;
@@ -196,48 +189,60 @@ struct irq_desc *irq_desc_with_new(unsigned int irq)
/*
* we run out of pre-allocate ones, allocate more
*/
- printk(KERN_DEBUG "try to get more irq_desc %d\n", nr_irq_desc);
- {
- /* double check if some one mess up the list */
- struct irq_desc *desc;
- int count = 0;
-
- desc = &irq_descX[0];
- while (desc) {
- printk("found irq_desc for irq %d\n", desc->irq);
- if (desc->next)
- printk("found irq_desc for irq %d and next will be irq %d\n", desc->irq, desc->next->irq);
- desc = desc->next;
- count++;
- }
- printk("all preallocted %d\n", count);
- }
+ if (!irq_descX_free) {
+ unsigned long phys;
+ unsigned long total_bytes;
- total_bytes = sizeof(struct irq_desc) * nr_irq_desc;
- if (after_bootmem)
- desc = kzalloc(total_bytes, GFP_ATOMIC);
- else
- desc = __alloc_bootmem_nopanic(total_bytes, PAGE_SIZE, 0);
+ printk(KERN_DEBUG "try to get more irq_desc %d\n", nr_irq_desc);
- if (!desc)
- panic("please boot with nr_irq_desc= %d\n", count * 2);
+ total_bytes = sizeof(struct irq_desc) * nr_irq_desc;
+ if (after_bootmem)
+ desc = kzalloc(total_bytes, GFP_ATOMIC);
+ else
+ desc = __alloc_bootmem_nopanic(total_bytes, PAGE_SIZE, 0);
- phys = __pa(desc);
- printk(KERN_DEBUG "irq_desc ==> [%#lx - %#lx]\n", phys, phys + total_bytes);
+ if (!desc)
+ panic("please boot with nr_irq_desc= %d\n", count * 2);
- for (i = 0; i < nr_irq_desc; i++)
- init_one_irq_desc(&desc[i]);
+ phys = __pa(desc);
+ printk(KERN_DEBUG "irq_desc ==> [%#lx - %#lx]\n", phys, phys + total_bytes);
- for (i = 1; i < nr_irq_desc; i++)
- desc[i-1].next = &desc[i];
+ for (i = 0; i < nr_irq_desc; i++)
+ init_one_irq_desc(&desc[i]);
- /* init kstat_irqs, nr_cpu_ids is ready already */
- init_kstat_irqs(desc, nr_irq_desc, nr_cpu_ids);
+ for (i = 1; i < nr_irq_desc; i++)
+ desc[i-1].next = &desc[i];
- desc->irq = irq;
- desc_pri->next = desc;
- printk("1 found new irq_desc for irq %d and pri will be irq %d\n", desc->irq, desc_pri->irq);
+ /* init kstat_irqs, nr_cpu_ids is ready already */
+ init_kstat_irqs(desc, nr_irq_desc, nr_cpu_ids);
+
+ irq_descX_free = desc;
+ }
+ desc = irq_descX_free;
+ irq_descX_free = irq_descX_free->next;
+ desc->next = NULL;
+ if (desc_pri)
+ desc_pri->next = desc;
+ else
+ irq_descX = desc;
+ desc->irq = irq;
+ printk("found new irq_desc for irq %d\n", desc->irq);
+ {
+ /* dump the results */
+ struct irq_desc *desc;
+ unsigned long phys;
+ unsigned long bytes = sizeof(struct irq_desc);
+ unsigned int irqx;
+
+ printk(KERN_DEBUG "=========================== %d\n", irq);
+ printk(KERN_DEBUG "irq_desc dump after get that for %d\n", irq);
+ for_each_irq_desc(irqx, desc) {
+ phys = __pa(desc);
+ printk(KERN_DEBUG "irq_desc %d ==> [%#lx - %#lx]\n", irqx, phys, phys + bytes);
+ }
+ printk(KERN_DEBUG "===========================\n");
+ }
return desc;
}
#else
--
1.5.4.5
^ permalink raw reply related [flat|nested] 66+ messages in thread
* [PATCH 39/42] x86_64: sperate irq_cfgx with irq_cfgx_free
2008-08-08 21:52 ` [PATCH 38/42] seperate irq_descX with irq_descX_free Yinghai Lu
@ 2008-08-08 21:52 ` Yinghai Lu
2008-08-08 21:52 ` [PATCH 40/42] x86_64: make /proc/interrupts works with dyn irq_desc Yinghai Lu
0 siblings, 1 reply; 66+ messages in thread
From: Yinghai Lu @ 2008-08-08 21:52 UTC (permalink / raw)
To: Ingo Molnar, Thomas Gleixner, H. Peter Anvin, Eric W. Biederman,
Dhaval Giani, Mike Travis, Andrew Morton
Cc: linux-kernel, Yinghai Lu
so later don't need compare with -1U
Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
---
arch/x86/kernel/io_apic_64.c | 90 ++++++++++++++++++++++++++---------------
1 files changed, 57 insertions(+), 33 deletions(-)
diff --git a/arch/x86/kernel/io_apic_64.c b/arch/x86/kernel/io_apic_64.c
index f8baf58..305ccb5 100644
--- a/arch/x86/kernel/io_apic_64.c
+++ b/arch/x86/kernel/io_apic_64.c
@@ -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;
}
--
1.5.4.5
^ permalink raw reply related [flat|nested] 66+ messages in thread
* [PATCH 40/42] x86_64: make /proc/interrupts works with dyn irq_desc
2008-08-08 21:52 ` [PATCH 39/42] x86_64: sperate irq_cfgx with irq_cfgx_free Yinghai Lu
@ 2008-08-08 21:52 ` Yinghai Lu
2008-08-08 21:52 ` [PATCH 41/42] x86_64: remove one nr_irqs in show_stat Yinghai Lu
0 siblings, 1 reply; 66+ messages in thread
From: Yinghai Lu @ 2008-08-08 21:52 UTC (permalink / raw)
To: Ingo Molnar, Thomas Gleixner, H. Peter Anvin, Eric W. Biederman,
Dhaval Giani, Mike Travis, Andrew Morton
Cc: linux-kernel, Yinghai Lu
loop with irq_desc list
Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
---
arch/x86/kernel/irq_64.c | 31 ++++++++++++++++++++++++-------
fs/proc/proc_misc.c | 28 ++++++++++++++++++++++++----
2 files changed, 48 insertions(+), 11 deletions(-)
diff --git a/arch/x86/kernel/irq_64.c b/arch/x86/kernel/irq_64.c
index 7db6843..ef96ce7 100644
--- a/arch/x86/kernel/irq_64.c
+++ b/arch/x86/kernel/irq_64.c
@@ -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;
}
diff --git a/fs/proc/proc_misc.c b/fs/proc/proc_misc.c
index c9ee1f7..15901c7 100644
--- a/fs/proc/proc_misc.c
+++ b/fs/proc/proc_misc.c
@@ -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,
--
1.5.4.5
^ permalink raw reply related [flat|nested] 66+ messages in thread
* [PATCH 41/42] x86_64: remove one nr_irqs in show_stat
2008-08-08 21:52 ` [PATCH 40/42] x86_64: make /proc/interrupts works with dyn irq_desc Yinghai Lu
@ 2008-08-08 21:52 ` Yinghai Lu
2008-08-08 21:52 ` [PATCH 42/42] x86: put irq_2_iommu pointer into irq_desc Yinghai Lu
0 siblings, 1 reply; 66+ messages in thread
From: Yinghai Lu @ 2008-08-08 21:52 UTC (permalink / raw)
To: Ingo Molnar, Thomas Gleixner, H. Peter Anvin, Eric W. Biederman,
Dhaval Giani, Mike Travis, Andrew Morton
Cc: linux-kernel, Yinghai Lu
loop with irq_desc list
Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
---
fs/proc/proc_misc.c | 18 ++++++++----------
1 files changed, 8 insertions(+), 10 deletions(-)
diff --git a/fs/proc/proc_misc.c b/fs/proc/proc_misc.c
index 15901c7..c001d1a 100644
--- a/fs/proc/proc_misc.c
+++ b/fs/proc/proc_misc.c
@@ -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,
--
1.5.4.5
^ permalink raw reply related [flat|nested] 66+ messages in thread
* [PATCH 42/42] x86: put irq_2_iommu pointer into irq_desc
2008-08-08 21:52 ` [PATCH 41/42] x86_64: remove one nr_irqs in show_stat Yinghai Lu
@ 2008-08-08 21:52 ` Yinghai Lu
0 siblings, 0 replies; 66+ messages in thread
From: Yinghai Lu @ 2008-08-08 21:52 UTC (permalink / raw)
To: Ingo Molnar, Thomas Gleixner, H. Peter Anvin, Eric W. Biederman,
Dhaval Giani, Mike Travis, Andrew Morton
Cc: linux-kernel, Yinghai Lu
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(-)
diff --git a/drivers/pci/intr_remapping.c b/drivers/pci/intr_remapping.c
index a7302d5..78896b3 100644
--- a/drivers/pci/intr_remapping.c
+++ b/drivers/pci/intr_remapping.c
@@ -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);
diff --git a/include/linux/irq.h b/include/linux/irq.h
index d130119..2d57a2d 100644
--- a/include/linux/irq.h
+++ b/include/linux/irq.h
@@ -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;
--
1.5.4.5
^ permalink raw reply related [flat|nested] 66+ messages in thread
* Re: [PATCH 00/42] dyn_array/nr_irqs/sparse_irq support v5
2008-08-08 21:52 [PATCH 00/42] dyn_array/nr_irqs/sparse_irq support v5 Yinghai Lu
2008-08-08 21:52 ` [PATCH 01/42] 8250: Remove NR_IRQ usage Yinghai Lu
@ 2008-08-08 22:01 ` H. Peter Anvin
2008-08-08 22:14 ` Yinghai Lu
2008-08-08 22:19 ` H. Peter Anvin
2 siblings, 1 reply; 66+ messages in thread
From: H. Peter Anvin @ 2008-08-08 22:01 UTC (permalink / raw)
To: Yinghai Lu
Cc: Ingo Molnar, Thomas Gleixner, Eric W. Biederman, Dhaval Giani,
Mike Travis, Andrew Morton, linux-kernel
Yinghai Lu wrote:
> 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
>
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
^ permalink raw reply [flat|nested] 66+ messages in thread
* Re: [PATCH 00/42] dyn_array/nr_irqs/sparse_irq support v5
2008-08-08 22:01 ` [PATCH 00/42] dyn_array/nr_irqs/sparse_irq support v5 H. Peter Anvin
@ 2008-08-08 22:14 ` Yinghai Lu
2008-08-08 22:25 ` H. Peter Anvin
0 siblings, 1 reply; 66+ messages in thread
From: Yinghai Lu @ 2008-08-08 22:14 UTC (permalink / raw)
To: H. Peter Anvin
Cc: Ingo Molnar, Thomas Gleixner, Eric W. Biederman, Dhaval Giani,
Mike Travis, Andrew Morton, linux-kernel
On Fri, Aug 8, 2008 at 3:01 PM, H. Peter Anvin <hpa@zytor.com> wrote:
> Yinghai Lu wrote:
>>
>> 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
>>
>
> 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_ARRAY
x86_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
^ permalink raw reply [flat|nested] 66+ messages in thread
* Re: [PATCH 00/42] dyn_array/nr_irqs/sparse_irq support v5
2008-08-08 21:52 [PATCH 00/42] dyn_array/nr_irqs/sparse_irq support v5 Yinghai Lu
2008-08-08 21:52 ` [PATCH 01/42] 8250: Remove NR_IRQ usage Yinghai Lu
2008-08-08 22:01 ` [PATCH 00/42] dyn_array/nr_irqs/sparse_irq support v5 H. Peter Anvin
@ 2008-08-08 22:19 ` H. Peter Anvin
2008-08-08 22:26 ` Yinghai Lu
2008-08-09 0:34 ` Yinghai Lu
2 siblings, 2 replies; 66+ messages in thread
From: H. Peter Anvin @ 2008-08-08 22:19 UTC (permalink / raw)
To: Yinghai Lu
Cc: Ingo Molnar, Thomas Gleixner, Eric W. Biederman, Dhaval Giani,
Mike Travis, Andrew Morton, linux-kernel
Yinghai Lu wrote:
>
> 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
>
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
^ permalink raw reply [flat|nested] 66+ messages in thread
* Re: [PATCH 00/42] dyn_array/nr_irqs/sparse_irq support v5
2008-08-08 22:14 ` Yinghai Lu
@ 2008-08-08 22:25 ` H. Peter Anvin
2008-08-08 22:30 ` Yinghai Lu
0 siblings, 1 reply; 66+ messages in thread
From: H. Peter Anvin @ 2008-08-08 22:25 UTC (permalink / raw)
To: Yinghai Lu
Cc: Ingo Molnar, Thomas Gleixner, Eric W. Biederman, Dhaval Giani,
Mike Travis, Andrew Morton, linux-kernel
Yinghai Lu wrote:
>>>
>> 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_ARRAY
> x86_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.
>
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
^ permalink raw reply [flat|nested] 66+ messages in thread
* Re: [PATCH 00/42] dyn_array/nr_irqs/sparse_irq support v5
2008-08-08 22:19 ` H. Peter Anvin
@ 2008-08-08 22:26 ` Yinghai Lu
2008-08-08 23:40 ` Eric W. Biederman
2008-08-09 0:34 ` Yinghai Lu
1 sibling, 1 reply; 66+ messages in thread
From: Yinghai Lu @ 2008-08-08 22:26 UTC (permalink / raw)
To: H. Peter Anvin
Cc: Ingo Molnar, Thomas Gleixner, Eric W. Biederman, Dhaval Giani,
Mike Travis, Andrew Morton, linux-kernel
On Fri, Aug 8, 2008 at 3:19 PM, H. Peter Anvin <hpa@zytor.com> wrote:
> Yinghai Lu wrote:
>>
>> 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
>>
>
> 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_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...
>
> 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.
will check it. it could be just replace irq_desc[] to irq_desc()...
>
> 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
^ permalink raw reply [flat|nested] 66+ messages in thread
* Re: [PATCH 00/42] dyn_array/nr_irqs/sparse_irq support v5
2008-08-08 22:25 ` H. Peter Anvin
@ 2008-08-08 22:30 ` Yinghai Lu
2008-08-08 22:33 ` H. Peter Anvin
0 siblings, 1 reply; 66+ messages in thread
From: Yinghai Lu @ 2008-08-08 22:30 UTC (permalink / raw)
To: H. Peter Anvin
Cc: Ingo Molnar, Thomas Gleixner, Eric W. Biederman, Dhaval Giani,
Mike Travis, Andrew Morton, linux-kernel
On Fri, Aug 8, 2008 at 3:25 PM, H. Peter Anvin <hpa@zytor.com> wrote:
> Yinghai Lu wrote:
>>>>
>>> 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_ARRAY
>> x86_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.
>>
>
> 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?
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
^ permalink raw reply [flat|nested] 66+ messages in thread
* Re: [PATCH 00/42] dyn_array/nr_irqs/sparse_irq support v5
2008-08-08 22:30 ` Yinghai Lu
@ 2008-08-08 22:33 ` H. Peter Anvin
0 siblings, 0 replies; 66+ messages in thread
From: H. Peter Anvin @ 2008-08-08 22:33 UTC (permalink / raw)
To: Yinghai Lu
Cc: Ingo Molnar, Thomas Gleixner, Eric W. Biederman, Dhaval Giani,
Mike Travis, Andrew Morton, linux-kernel
Yinghai Lu wrote:
>> Other architectures may speak for themselves, but why not just support
>> sparse IRQs on x86-32 *and* -64 and skip the dyn_array variant?
>
> 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.
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
^ permalink raw reply [flat|nested] 66+ messages in thread
* Re: [PATCH 01/42] 8250: Remove NR_IRQ usage
2008-08-08 21:52 ` [PATCH 01/42] 8250: Remove NR_IRQ usage Yinghai Lu
2008-08-08 21:52 ` [PATCH 02/42] x86: add after_bootmem for 32bit Yinghai Lu
@ 2008-08-08 22:38 ` Eric W. Biederman
2008-08-08 23:07 ` Yinghai Lu
1 sibling, 1 reply; 66+ messages in thread
From: Eric W. Biederman @ 2008-08-08 22:38 UTC (permalink / raw)
To: Yinghai Lu
Cc: Ingo Molnar, Thomas Gleixner, H. Peter Anvin, Eric W. Biederman,
Dhaval Giani, Mike Travis, Andrew Morton, linux-kernel, Alan Cox
Yinghai Lu <yhlu.kernel@gmail.com> writes:
> From: Alan Cox <alan@redhat.com>
>
> Works on my test box with a quick test.
>
> From: Alan Cox <alan@redhat.com>
You missed the bug fix...
Eric
^ permalink raw reply [flat|nested] 66+ messages in thread
* Re: [PATCH 01/42] 8250: Remove NR_IRQ usage
2008-08-08 22:38 ` [PATCH 01/42] 8250: Remove NR_IRQ usage Eric W. Biederman
@ 2008-08-08 23:07 ` Yinghai Lu
0 siblings, 0 replies; 66+ messages in thread
From: Yinghai Lu @ 2008-08-08 23:07 UTC (permalink / raw)
To: Eric W. Biederman
Cc: Ingo Molnar, Thomas Gleixner, H. Peter Anvin, Dhaval Giani,
Mike Travis, Andrew Morton, linux-kernel, Alan Cox
On Fri, Aug 8, 2008 at 3:38 PM, Eric W. Biederman <ebiederm@xmission.com> wrote:
> Yinghai Lu <yhlu.kernel@gmail.com> writes:
>
>> From: Alan Cox <alan@redhat.com>
>>
>> Works on my test box with a quick test.
>>
>> From: Alan Cox <alan@redhat.com>
>
> You missed the bug fix...
>
i got old one?
YH
^ permalink raw reply [flat|nested] 66+ messages in thread
* Re: [PATCH 00/42] dyn_array/nr_irqs/sparse_irq support v5
2008-08-08 22:26 ` Yinghai Lu
@ 2008-08-08 23:40 ` Eric W. Biederman
0 siblings, 0 replies; 66+ messages in thread
From: Eric W. Biederman @ 2008-08-08 23:40 UTC (permalink / raw)
To: Yinghai Lu
Cc: H. Peter Anvin, Ingo Molnar, Thomas Gleixner, Dhaval Giani,
Mike Travis, Andrew Morton, linux-kernel
"Yinghai Lu" <yhlu.kernel@gmail.com> writes:
> On Fri, Aug 8, 2008 at 3:19 PM, H. Peter Anvin <hpa@zytor.com> wrote:
>> Yinghai Lu wrote:
>>>
>>> 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
>>>
>>
>> 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_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...
Yes. Let's see if we can get that regression fix in there for 2.6.27...
Eric
^ permalink raw reply [flat|nested] 66+ messages in thread
* Re: [PATCH 00/42] dyn_array/nr_irqs/sparse_irq support v5
2008-08-08 22:19 ` H. Peter Anvin
2008-08-08 22:26 ` Yinghai Lu
@ 2008-08-09 0:34 ` Yinghai Lu
1 sibling, 0 replies; 66+ messages in thread
From: Yinghai Lu @ 2008-08-09 0:34 UTC (permalink / raw)
To: H. Peter Anvin
Cc: Ingo Molnar, Thomas Gleixner, Eric W. Biederman, Dhaval Giani,
Mike Travis, Andrew Morton, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 558 bytes --]
On Fri, Aug 8, 2008 at 3:19 PM, H. Peter Anvin <hpa@zytor.com> wrote:
> Yinghai Lu wrote:
>>
>> 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
>>
>
> Furthermore, 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
[-- Attachment #2: patches_dyn_array_nr_irqs_sparse_irq_v6.tar.bz2 --]
[-- Type: application/x-bzip2, Size: 57996 bytes --]
^ permalink raw reply [flat|nested] 66+ messages in thread
* Re: [PATCH 08/42] introduce nr_irqs
2008-08-08 21:52 ` [PATCH 08/42] introduce nr_irqs Yinghai Lu
2008-08-08 21:52 ` [PATCH 09/42] x86: using nr_irqs Yinghai Lu
@ 2008-08-09 1:00 ` Eric W. Biederman
2008-08-09 1:38 ` Yinghai Lu
1 sibling, 1 reply; 66+ messages in thread
From: Eric W. Biederman @ 2008-08-09 1:00 UTC (permalink / raw)
To: Yinghai Lu
Cc: Ingo Molnar, Thomas Gleixner, H. Peter Anvin, Dhaval Giani,
Mike Travis, Andrew Morton, linux-kernel
Yinghai Lu <yhlu.kernel@gmail.com> writes:
> 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
^ permalink raw reply [flat|nested] 66+ messages in thread
* Re: [PATCH 08/42] introduce nr_irqs
2008-08-09 1:00 ` [PATCH 08/42] introduce nr_irqs Eric W. Biederman
@ 2008-08-09 1:38 ` Yinghai Lu
2008-08-09 1:59 ` H. Peter Anvin
2008-08-09 6:07 ` Eric W. Biederman
0 siblings, 2 replies; 66+ messages in thread
From: Yinghai Lu @ 2008-08-09 1:38 UTC (permalink / raw)
To: Eric W. Biederman
Cc: Ingo Molnar, Thomas Gleixner, H. Peter Anvin, Dhaval Giani,
Mike Travis, Andrew Morton, linux-kernel
On Fri, Aug 8, 2008 at 6:00 PM, Eric W. Biederman <ebiederm@xmission.com> wrote:
> Yinghai Lu <yhlu.kernel@gmail.com> writes:
>
>> 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.
some platforms will not use include/linux/irq.h and kernel/irq/handle.c ?
YH
^ permalink raw reply [flat|nested] 66+ messages in thread
* Re: [PATCH 08/42] introduce nr_irqs
2008-08-09 1:38 ` Yinghai Lu
@ 2008-08-09 1:59 ` H. Peter Anvin
2008-08-09 7:30 ` Yinghai Lu
2008-08-09 6:07 ` Eric W. Biederman
1 sibling, 1 reply; 66+ messages in thread
From: H. Peter Anvin @ 2008-08-09 1:59 UTC (permalink / raw)
To: Yinghai Lu
Cc: Eric W. Biederman, Ingo Molnar, Thomas Gleixner, Dhaval Giani,
Mike Travis, Andrew Morton, linux-kernel
Yinghai Lu wrote:
> On Fri, Aug 8, 2008 at 6:00 PM, Eric W. Biederman <ebiederm@xmission.com> wrote:
>> Yinghai Lu <yhlu.kernel@gmail.com> writes:
>>
>>> 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.
>
> some platforms will not use include/linux/irq.h and kernel/irq/handle.c ?
>
Also, what's the point, if it's just a renaming?
-hpa
^ permalink raw reply [flat|nested] 66+ messages in thread
* Re: [PATCH 08/42] introduce nr_irqs
2008-08-09 1:38 ` Yinghai Lu
2008-08-09 1:59 ` H. Peter Anvin
@ 2008-08-09 6:07 ` Eric W. Biederman
2008-08-09 7:30 ` Yinghai Lu
1 sibling, 1 reply; 66+ messages in thread
From: Eric W. Biederman @ 2008-08-09 6:07 UTC (permalink / raw)
To: Yinghai Lu
Cc: Ingo Molnar, Thomas Gleixner, H. Peter Anvin, Dhaval Giani,
Mike Travis, Andrew Morton, linux-kernel
"Yinghai Lu" <yhlu.kernel@gmail.com> writes:
> On Fri, Aug 8, 2008 at 6:00 PM, Eric W. Biederman <ebiederm@xmission.com> wrote:
>> Yinghai Lu <yhlu.kernel@gmail.com> writes:
>>
>>> 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.
>
> some platforms will not use include/linux/irq.h and kernel/irq/handle.c ?
Yes. interrupt.h is the common infrastructure.
Eric
^ permalink raw reply [flat|nested] 66+ messages in thread
* Re: [PATCH 08/42] introduce nr_irqs
2008-08-09 1:59 ` H. Peter Anvin
@ 2008-08-09 7:30 ` Yinghai Lu
2008-08-09 16:02 ` Eric W. Biederman
0 siblings, 1 reply; 66+ messages in thread
From: Yinghai Lu @ 2008-08-09 7:30 UTC (permalink / raw)
To: H. Peter Anvin
Cc: Eric W. Biederman, Ingo Molnar, Thomas Gleixner, Dhaval Giani,
Mike Travis, Andrew Morton, linux-kernel
On Fri, Aug 8, 2008 at 6:59 PM, H. Peter Anvin <hpa@zytor.com> wrote:
> Yinghai Lu wrote:
>>
>> On Fri, Aug 8, 2008 at 6:00 PM, Eric W. Biederman <ebiederm@xmission.com>
>> wrote:
>>>
>>> Yinghai Lu <yhlu.kernel@gmail.com> writes:
>>>
>>>> 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.
>>
>> some platforms will not use include/linux/irq.h and kernel/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
^ permalink raw reply [flat|nested] 66+ messages in thread
* Re: [PATCH 08/42] introduce nr_irqs
2008-08-09 6:07 ` Eric W. Biederman
@ 2008-08-09 7:30 ` Yinghai Lu
2008-08-09 15:46 ` Eric W. Biederman
0 siblings, 1 reply; 66+ messages in thread
From: Yinghai Lu @ 2008-08-09 7:30 UTC (permalink / raw)
To: Eric W. Biederman
Cc: Ingo Molnar, Thomas Gleixner, H. Peter Anvin, Dhaval Giani,
Mike Travis, Andrew Morton, linux-kernel
On Fri, Aug 8, 2008 at 11:07 PM, Eric W. Biederman
<ebiederm@xmission.com> wrote:
> "Yinghai Lu" <yhlu.kernel@gmail.com> writes:
>
>> On Fri, Aug 8, 2008 at 6:00 PM, Eric W. Biederman <ebiederm@xmission.com> wrote:
>>> Yinghai Lu <yhlu.kernel@gmail.com> writes:
>>>
>>>> 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.
>>
>> some platforms will not use include/linux/irq.h and kernel/irq/handle.c ?
>
> Yes. interrupt.h is the common infrastructure.
>
ok, will move to that file.
YH
^ permalink raw reply [flat|nested] 66+ messages in thread
* Re: [PATCH 08/42] introduce nr_irqs
2008-08-09 7:30 ` Yinghai Lu
@ 2008-08-09 15:46 ` Eric W. Biederman
2008-08-09 21:37 ` Yinghai Lu
0 siblings, 1 reply; 66+ messages in thread
From: Eric W. Biederman @ 2008-08-09 15:46 UTC (permalink / raw)
To: Yinghai Lu
Cc: Ingo Molnar, Thomas Gleixner, H. Peter Anvin, Dhaval Giani,
Mike Travis, Andrew Morton, linux-kernel
"Yinghai Lu" <yhlu.kernel@gmail.com> writes:
> 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
^ permalink raw reply [flat|nested] 66+ messages in thread
* Re: [PATCH 08/42] introduce nr_irqs
2008-08-09 7:30 ` Yinghai Lu
@ 2008-08-09 16:02 ` Eric W. Biederman
2008-08-09 21:21 ` Yinghai Lu
0 siblings, 1 reply; 66+ messages in thread
From: Eric W. Biederman @ 2008-08-09 16:02 UTC (permalink / raw)
To: Yinghai Lu
Cc: H. Peter Anvin, Ingo Molnar, Thomas Gleixner, Dhaval Giani,
Mike Travis, Andrew Morton, linux-kernel
"Yinghai Lu" <yhlu.kernel@gmail.com> writes:
>> 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.
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
^ permalink raw reply [flat|nested] 66+ messages in thread
* Re: [PATCH 08/42] introduce nr_irqs
2008-08-09 16:02 ` Eric W. Biederman
@ 2008-08-09 21:21 ` Yinghai Lu
2008-08-09 21:38 ` Eric W. Biederman
0 siblings, 1 reply; 66+ messages in thread
From: Yinghai Lu @ 2008-08-09 21:21 UTC (permalink / raw)
To: Eric W. Biederman
Cc: H. Peter Anvin, Ingo Molnar, Thomas Gleixner, Dhaval Giani,
Mike Travis, Andrew Morton, linux-kernel
On Sat, Aug 9, 2008 at 9:02 AM, Eric W. Biederman <ebiederm@xmission.com> wrote:
> "Yinghai Lu" <yhlu.kernel@gmail.com> writes:
>
>>> 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.
>
> 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;
>
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 interface
irq_desc()
and
for_each_irq_desc(irq, desc)
YH
^ permalink raw reply [flat|nested] 66+ messages in thread
* Re: [PATCH 08/42] introduce nr_irqs
2008-08-09 15:46 ` Eric W. Biederman
@ 2008-08-09 21:37 ` Yinghai Lu
0 siblings, 0 replies; 66+ messages in thread
From: Yinghai Lu @ 2008-08-09 21:37 UTC (permalink / raw)
To: Eric W. Biederman
Cc: Ingo Molnar, Thomas Gleixner, H. Peter Anvin, Dhaval Giani,
Mike Travis, Andrew Morton, linux-kernel
On Sat, Aug 9, 2008 at 8:46 AM, Eric W. Biederman <ebiederm@xmission.com> wrote:
> "Yinghai Lu" <yhlu.kernel@gmail.com> writes:
>
>
>> 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!
>
please check
Index: linux-2.6/include/linux/interrupt.h
===================================================================
--- linux-2.6.orig/include/linux/interrupt.h
+++ linux-2.6/include/linux/interrupt.h
@@ -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
Index: linux-2.6/arch/m68k/kernel/ints.c
===================================================================
--- linux-2.6.orig/arch/m68k/kernel/ints.c
+++ linux-2.6/arch/m68k/kernel/ints.c
@@ -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[];
Index: linux-2.6/arch/s390/kernel/irq.c
===================================================================
--- linux-2.6.orig/arch/s390/kernel/irq.c
+++ linux-2.6/arch/s390/kernel/irq.c
@@ -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.
*/
Index: linux-2.6/arch/sparc/kernel/irq.c
===================================================================
--- linux-2.6.orig/arch/sparc/kernel/irq.c
+++ linux-2.6/arch/sparc/kernel/irq.c
@@ -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;
Index: linux-2.6/kernel/irq/handle.c
===================================================================
--- linux-2.6.orig/kernel/irq/handle.c
+++ linux-2.6/kernel/irq/handle.c
@@ -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,
^ permalink raw reply [flat|nested] 66+ messages in thread
* Re: [PATCH 08/42] introduce nr_irqs
2008-08-09 21:21 ` Yinghai Lu
@ 2008-08-09 21:38 ` Eric W. Biederman
2008-08-09 22:35 ` Yinghai Lu
0 siblings, 1 reply; 66+ messages in thread
From: Eric W. Biederman @ 2008-08-09 21:38 UTC (permalink / raw)
To: Yinghai Lu
Cc: H. Peter Anvin, Ingo Molnar, Thomas Gleixner, Dhaval Giani,
Mike Travis, Andrew Morton, linux-kernel
"Yinghai Lu" <yhlu.kernel@gmail.com> writes:
> On Sat, Aug 9, 2008 at 9:02 AM, Eric W. Biederman <ebiederm@xmission.com> wrote:
>> "Yinghai Lu" <yhlu.kernel@gmail.com> writes:
>>
>>>> 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.
>>
>> 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;
>>
>
> 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 interface
> irq_desc()
> and
> for_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
^ permalink raw reply [flat|nested] 66+ messages in thread
* Re: [PATCH 08/42] introduce nr_irqs
2008-08-09 21:38 ` Eric W. Biederman
@ 2008-08-09 22:35 ` Yinghai Lu
0 siblings, 0 replies; 66+ messages in thread
From: Yinghai Lu @ 2008-08-09 22:35 UTC (permalink / raw)
To: Eric W. Biederman
Cc: H. Peter Anvin, Ingo Molnar, Thomas Gleixner, Dhaval Giani,
Mike Travis, Andrew Morton, linux-kernel
On Sat, Aug 9, 2008 at 2:38 PM, Eric W. Biederman <ebiederm@xmission.com> wrote:
> "Yinghai Lu" <yhlu.kernel@gmail.com> writes:
>
>> On Sat, Aug 9, 2008 at 9:02 AM, Eric W. Biederman <ebiederm@xmission.com> wrote:
>>> "Yinghai Lu" <yhlu.kernel@gmail.com> writes:
>>>
>>>>> 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.
>>>
>>> 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;
>>>
>>
>> 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 interface
>> irq_desc()
>> and
>> for_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.
From: Yinghai Lu <yhlu.kernel@gmail.com>
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
Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
---
fs/proc/proc_misc.c | 50 ++++++++++++++++++++++++++++++++++++--------------
1 file changed, 36 insertions(+), 14 deletions(-)
Index: linux-2.6/fs/proc/proc_misc.c
===================================================================
--- linux-2.6.orig/fs/proc/proc_misc.c
+++ linux-2.6/fs/proc/proc_misc.c
@@ -495,17 +495,16 @@ static const struct file_operations proc
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;
-
- 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;
}
Index: linux-2.6/include/linux/interrupt.h
===================================================================
--- linux-2.6.orig/include/linux/interrupt.h
+++ linux-2.6/include/linux/interrupt.h
@@ -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
^ permalink raw reply [flat|nested] 66+ messages in thread
end of thread, other threads:[~2008-08-09 22:36 UTC | newest]
Thread overview: 66+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-08-08 21:52 [PATCH 00/42] dyn_array/nr_irqs/sparse_irq support v5 Yinghai Lu
2008-08-08 21:52 ` [PATCH 01/42] 8250: Remove NR_IRQ usage Yinghai Lu
2008-08-08 21:52 ` [PATCH 02/42] x86: add after_bootmem for 32bit Yinghai Lu
2008-08-08 21:52 ` [PATCH 03/42] x86: remove irq_vectors_limits Yinghai Lu
2008-08-08 21:52 ` [PATCH 04/42] add dyn_array support Yinghai Lu
2008-08-08 21:52 ` [PATCH 05/42] add per_cpu_dyn_array support Yinghai Lu
2008-08-08 21:52 ` [PATCH 06/42] x86: alloc dyn_array all alltogether Yinghai Lu
2008-08-08 21:52 ` [PATCH 07/42] x86: enable dyn_array support Yinghai Lu
2008-08-08 21:52 ` [PATCH 08/42] introduce nr_irqs Yinghai Lu
2008-08-08 21:52 ` [PATCH 09/42] x86: using nr_irqs Yinghai Lu
2008-08-08 21:52 ` [PATCH 10/42] drivers/char to use nr_irqs Yinghai Lu
2008-08-08 21:52 ` [PATCH 11/42] drivers/net " Yinghai Lu
2008-08-08 21:52 ` [PATCH 12/42] drivers intr remapping " Yinghai Lu
2008-08-08 21:52 ` [PATCH 13/42] drivers/pcmcia " Yinghai Lu
2008-08-08 21:52 ` [PATCH 14/42] drivers/rtc " Yinghai Lu
2008-08-08 21:52 ` [PATCH 15/42] drivers/scsi " Yinghai Lu
2008-08-08 21:52 ` [PATCH 16/42] drivers/serial " Yinghai Lu
2008-08-08 21:52 ` [PATCH 17/42] drivers proc " Yinghai Lu
2008-08-08 21:52 ` [PATCH 18/42] drivers xen events " Yinghai Lu
2008-08-08 21:52 ` [PATCH 19/42] make irq_timer_state to use dyn_array Yinghai Lu
2008-08-08 21:52 ` [PATCH 20/42] make irq2_iommu " Yinghai Lu
2008-08-08 21:52 ` [PATCH 21/42] make irq_desc " Yinghai Lu
2008-08-08 21:52 ` [PATCH 22/42] irq: make irqs in kernel stat use per_cpu_dyn_array Yinghai Lu
2008-08-08 21:52 ` [PATCH 23/42] x86: use dyn_array in io_apic_xx.c Yinghai Lu
2008-08-08 21:52 ` [PATCH 24/42] x86: get mp_irqs from madt Yinghai Lu
2008-08-08 21:52 ` [PATCH 25/42] x86: remove nr_irq_vectors Yinghai Lu
2008-08-08 21:52 ` [PATCH 26/42] x86_64: use irq_desc() together with dyn_array Yinghai Lu
2008-08-08 21:52 ` [PATCH 27/42] x86: add irq_cfg in io_apic_64.c Yinghai Lu
2008-08-08 21:52 ` [PATCH 28/42] x86: put irq_2_pin pointer into irq_cfg Yinghai Lu
2008-08-08 21:52 ` [PATCH 29/42] x86: put timer_rand_state pointer into irq_desc Yinghai Lu
2008-08-08 21:52 ` [PATCH 30/42] x86: move kstat_irqs from kstat to irq_desc Yinghai Lu
2008-08-08 21:52 ` [PATCH 31/42] replace loop with nr_irqs with for_each_irq_desc Yinghai Lu
2008-08-08 21:52 ` [PATCH 32/42] replace loop with nr_irqs with for_each_irq_icfg Yinghai Lu
2008-08-08 21:52 ` [PATCH 33/42] remove >= nr_irqs checking with config_have_sparse_irq Yinghai Lu
2008-08-08 21:52 ` [PATCH 34/42] x86_64: add irq_desc in function in paramater Yinghai Lu
2008-08-08 21:52 ` [PATCH 35/42] x86: check with without_new in show_interrupts Yinghai Lu
2008-08-08 21:52 ` [PATCH 36/42] x86_64: introduce irq_cfg_with_new Yinghai Lu
2008-08-08 21:52 ` [PATCH 37/42] x86_64: introduce irq_desc_with_new Yinghai Lu
2008-08-08 21:52 ` [PATCH 38/42] seperate irq_descX with irq_descX_free Yinghai Lu
2008-08-08 21:52 ` [PATCH 39/42] x86_64: sperate irq_cfgx with irq_cfgx_free Yinghai Lu
2008-08-08 21:52 ` [PATCH 40/42] x86_64: make /proc/interrupts works with dyn irq_desc Yinghai Lu
2008-08-08 21:52 ` [PATCH 41/42] x86_64: remove one nr_irqs in show_stat Yinghai Lu
2008-08-08 21:52 ` [PATCH 42/42] x86: put irq_2_iommu pointer into irq_desc Yinghai Lu
2008-08-09 1:00 ` [PATCH 08/42] introduce nr_irqs Eric W. Biederman
2008-08-09 1:38 ` Yinghai Lu
2008-08-09 1:59 ` H. Peter Anvin
2008-08-09 7:30 ` Yinghai Lu
2008-08-09 16:02 ` Eric W. Biederman
2008-08-09 21:21 ` Yinghai Lu
2008-08-09 21:38 ` Eric W. Biederman
2008-08-09 22:35 ` Yinghai Lu
2008-08-09 6:07 ` Eric W. Biederman
2008-08-09 7:30 ` Yinghai Lu
2008-08-09 15:46 ` Eric W. Biederman
2008-08-09 21:37 ` Yinghai Lu
2008-08-08 22:38 ` [PATCH 01/42] 8250: Remove NR_IRQ usage Eric W. Biederman
2008-08-08 23:07 ` Yinghai Lu
2008-08-08 22:01 ` [PATCH 00/42] dyn_array/nr_irqs/sparse_irq support v5 H. Peter Anvin
2008-08-08 22:14 ` Yinghai Lu
2008-08-08 22:25 ` H. Peter Anvin
2008-08-08 22:30 ` Yinghai Lu
2008-08-08 22:33 ` H. Peter Anvin
2008-08-08 22:19 ` H. Peter Anvin
2008-08-08 22:26 ` Yinghai Lu
2008-08-08 23:40 ` Eric W. Biederman
2008-08-09 0:34 ` Yinghai Lu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox