aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/kernel/irq.c
diff options
context:
space:
mode:
authorMichael Ellerman <michael@ellerman.id.au>2009-10-13 15:45:03 -0400
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2009-10-30 02:21:31 -0400
commitcd015707176820b86d07b5dffdecfefdd539a497 (patch)
treec71a90d99a1dee4d5a24f883230c201c43cd8c0d /arch/powerpc/kernel/irq.c
parent750ab112919220a1d14491ae210b689bcb7d6d66 (diff)
powerpc: Enable sparse irq_descs on powerpc
Defining CONFIG_SPARSE_IRQ enables generic code that gets rid of the static irq_desc array, and replaces it with an array of pointers to irq_descs. It also allows node local allocation of irq_descs, however we currently don't have the information available to do that, so we just allocate them on all on node 0. Signed-off-by: Michael Ellerman <michael@ellerman.id.au> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc/kernel/irq.c')
-rw-r--r--arch/powerpc/kernel/irq.c40
1 files changed, 33 insertions, 7 deletions
diff --git a/arch/powerpc/kernel/irq.c b/arch/powerpc/kernel/irq.c
index 63e27d5c52d..eba53923630 100644
--- a/arch/powerpc/kernel/irq.c
+++ b/arch/powerpc/kernel/irq.c
@@ -85,7 +85,10 @@ extern int tau_interrupts(int);
85#endif /* CONFIG_PPC32 */ 85#endif /* CONFIG_PPC32 */
86 86
87#ifdef CONFIG_PPC64 87#ifdef CONFIG_PPC64
88
89#ifndef CONFIG_SPARSE_IRQ
88EXPORT_SYMBOL(irq_desc); 90EXPORT_SYMBOL(irq_desc);
91#endif
89 92
90int distribute_irqs = 1; 93int distribute_irqs = 1;
91 94
@@ -613,8 +616,16 @@ void irq_set_virq_count(unsigned int count)
613static int irq_setup_virq(struct irq_host *host, unsigned int virq, 616static int irq_setup_virq(struct irq_host *host, unsigned int virq,
614 irq_hw_number_t hwirq) 617 irq_hw_number_t hwirq)
615{ 618{
619 struct irq_desc *desc;
620
621 desc = irq_to_desc_alloc_node(virq, 0);
622 if (!desc) {
623 pr_debug("irq: -> allocating desc failed\n");
624 goto error;
625 }
626
616 /* Clear IRQ_NOREQUEST flag */ 627 /* Clear IRQ_NOREQUEST flag */
617 irq_to_desc(virq)->status &= ~IRQ_NOREQUEST; 628 desc->status &= ~IRQ_NOREQUEST;
618 629
619 /* map it */ 630 /* map it */
620 smp_wmb(); 631 smp_wmb();
@@ -623,11 +634,14 @@ static int irq_setup_virq(struct irq_host *host, unsigned int virq,
623 634
624 if (host->ops->map(host, virq, hwirq)) { 635 if (host->ops->map(host, virq, hwirq)) {
625 pr_debug("irq: -> mapping failed, freeing\n"); 636 pr_debug("irq: -> mapping failed, freeing\n");
626 irq_free_virt(virq, 1); 637 goto error;
627 return -1;
628 } 638 }
629 639
630 return 0; 640 return 0;
641
642error:
643 irq_free_virt(virq, 1);
644 return -1;
631} 645}
632 646
633unsigned int irq_create_direct_mapping(struct irq_host *host) 647unsigned int irq_create_direct_mapping(struct irq_host *host)
@@ -1008,12 +1022,24 @@ void irq_free_virt(unsigned int virq, unsigned int count)
1008 spin_unlock_irqrestore(&irq_big_lock, flags); 1022 spin_unlock_irqrestore(&irq_big_lock, flags);
1009} 1023}
1010 1024
1011void irq_early_init(void) 1025int arch_early_irq_init(void)
1012{ 1026{
1013 unsigned int i; 1027 struct irq_desc *desc;
1028 int i;
1014 1029
1015 for (i = 0; i < NR_IRQS; i++) 1030 for (i = 0; i < NR_IRQS; i++) {
1016 irq_to_desc(i)->status |= IRQ_NOREQUEST; 1031 desc = irq_to_desc(i);
1032 if (desc)
1033 desc->status |= IRQ_NOREQUEST;
1034 }
1035
1036 return 0;
1037}
1038
1039int arch_init_chip_data(struct irq_desc *desc, int node)
1040{
1041 desc->status |= IRQ_NOREQUEST;
1042 return 0;
1017} 1043}
1018 1044
1019/* We need to create the radix trees late */ 1045/* We need to create the radix trees late */