提交 b683de2b 编写于 作者: T Thomas Gleixner

genirq: Query arch for number of early descriptors

sparse irq sets up NR_IRQS_LEGACY irq descriptors and archs then go
ahead and allocate more.

Use the unused return value of arch_probe_nr_irqs() to let the
architecture return the number of early allocations. Fix up all users.
Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
Reviewed-by: NIngo Molnar <mingo@elte.hu>
上级 aa99ec0f
...@@ -157,10 +157,8 @@ void __init init_IRQ(void) ...@@ -157,10 +157,8 @@ void __init init_IRQ(void)
struct irq_desc *desc; struct irq_desc *desc;
int irq; int irq;
for (irq = 0; irq < nr_irqs; irq++) { for (irq = 0; irq < nr_irqs; irq++)
desc = irq_to_desc_alloc_node(irq, 0);
desc->status |= IRQ_NOREQUEST | IRQ_NOPROBE; desc->status |= IRQ_NOREQUEST | IRQ_NOPROBE;
}
init_arch_irq(); init_arch_irq();
} }
...@@ -169,7 +167,7 @@ void __init init_IRQ(void) ...@@ -169,7 +167,7 @@ void __init init_IRQ(void)
int __init arch_probe_nr_irqs(void) int __init arch_probe_nr_irqs(void)
{ {
nr_irqs = arch_nr_irqs ? arch_nr_irqs : NR_IRQS; nr_irqs = arch_nr_irqs ? arch_nr_irqs : NR_IRQS;
return 0; return nr_irqs;
} }
#endif #endif
......
...@@ -290,7 +290,7 @@ void __init init_IRQ(void) ...@@ -290,7 +290,7 @@ void __init init_IRQ(void)
int __init arch_probe_nr_irqs(void) int __init arch_probe_nr_irqs(void)
{ {
nr_irqs = sh_mv.mv_nr_irqs; nr_irqs = sh_mv.mv_nr_irqs;
return 0; return NR_IRQS_LEGACY;
} }
#endif #endif
......
...@@ -3880,7 +3880,7 @@ int __init arch_probe_nr_irqs(void) ...@@ -3880,7 +3880,7 @@ int __init arch_probe_nr_irqs(void)
if (nr < nr_irqs) if (nr < nr_irqs)
nr_irqs = nr; nr_irqs = nr;
return 0; return NR_IRQS_LEGACY;
} }
#endif #endif
......
...@@ -214,6 +214,10 @@ struct irq_chip { ...@@ -214,6 +214,10 @@ struct irq_chip {
*/ */
#include <asm/hw_irq.h> #include <asm/hw_irq.h>
#ifndef NR_IRQS_LEGACY
# define NR_IRQS_LEGACY 0
#endif
#ifndef ARCH_IRQ_INIT_FLAGS #ifndef ARCH_IRQ_INIT_FLAGS
# define ARCH_IRQ_INIT_FLAGS 0 # define ARCH_IRQ_INIT_FLAGS 0
#endif #endif
......
...@@ -226,16 +226,16 @@ struct irq_desc * __ref irq_to_desc_alloc_node(unsigned int irq, int node) ...@@ -226,16 +226,16 @@ struct irq_desc * __ref irq_to_desc_alloc_node(unsigned int irq, int node)
int __init early_irq_init(void) int __init early_irq_init(void)
{ {
int i, node = first_online_node; int i, initcnt, node = first_online_node;
struct irq_desc *desc; struct irq_desc *desc;
init_irq_default_affinity(); init_irq_default_affinity();
/* initialize nr_irqs based on nr_cpu_ids */ /* Let arch update nr_irqs and return the nr of preallocated irqs */
arch_probe_nr_irqs(); initcnt = arch_probe_nr_irqs();
printk(KERN_INFO "NR_IRQS:%d nr_irqs:%d\n", NR_IRQS, nr_irqs); printk(KERN_INFO "NR_IRQS:%d nr_irqs:%d %d\n", NR_IRQS, nr_irqs, initcnt);
for (i = 0; i < NR_IRQS_LEGACY; i++) { for (i = 0; i < initcnt; i++) {
desc = alloc_desc(i, node); desc = alloc_desc(i, node);
set_bit(i, allocated_irqs); set_bit(i, allocated_irqs);
irq_insert_desc(i, desc); irq_insert_desc(i, desc);
......
...@@ -886,9 +886,10 @@ int __init __weak early_irq_init(void) ...@@ -886,9 +886,10 @@ int __init __weak early_irq_init(void)
return 0; return 0;
} }
#ifdef CONFIG_GENERIC_HARDIRQS
int __init __weak arch_probe_nr_irqs(void) int __init __weak arch_probe_nr_irqs(void)
{ {
return 0; return NR_IRQS_LEGACY;
} }
int __init __weak arch_early_irq_init(void) int __init __weak arch_early_irq_init(void)
...@@ -900,3 +901,4 @@ int __weak arch_init_chip_data(struct irq_desc *desc, int node) ...@@ -900,3 +901,4 @@ int __weak arch_init_chip_data(struct irq_desc *desc, int node)
{ {
return 0; return 0;
} }
#endif
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册