aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/sysdev/mpic.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/powerpc/sysdev/mpic.c')
-rw-r--r--arch/powerpc/sysdev/mpic.c43
1 files changed, 18 insertions, 25 deletions
diff --git a/arch/powerpc/sysdev/mpic.c b/arch/powerpc/sysdev/mpic.c
index 30c44e6b0413..470dc6c11d57 100644
--- a/arch/powerpc/sysdev/mpic.c
+++ b/arch/powerpc/sysdev/mpic.c
@@ -567,13 +567,11 @@ static void __init mpic_scan_ht_pics(struct mpic *mpic)
567#endif /* CONFIG_MPIC_U3_HT_IRQS */ 567#endif /* CONFIG_MPIC_U3_HT_IRQS */
568 568
569#ifdef CONFIG_SMP 569#ifdef CONFIG_SMP
570static int irq_choose_cpu(unsigned int virt_irq) 570static int irq_choose_cpu(const cpumask_t *mask)
571{ 571{
572 cpumask_t mask;
573 int cpuid; 572 int cpuid;
574 573
575 cpumask_copy(&mask, irq_desc[virt_irq].affinity); 574 if (cpumask_equal(mask, cpu_all_mask)) {
576 if (cpus_equal(mask, CPU_MASK_ALL)) {
577 static int irq_rover; 575 static int irq_rover;
578 static DEFINE_SPINLOCK(irq_rover_lock); 576 static DEFINE_SPINLOCK(irq_rover_lock);
579 unsigned long flags; 577 unsigned long flags;
@@ -594,20 +592,15 @@ static int irq_choose_cpu(unsigned int virt_irq)
594 592
595 spin_unlock_irqrestore(&irq_rover_lock, flags); 593 spin_unlock_irqrestore(&irq_rover_lock, flags);
596 } else { 594 } else {
597 cpumask_t tmp; 595 cpuid = cpumask_first_and(mask, cpu_online_mask);
598 596 if (cpuid >= nr_cpu_ids)
599 cpus_and(tmp, cpu_online_map, mask);
600
601 if (cpus_empty(tmp))
602 goto do_round_robin; 597 goto do_round_robin;
603
604 cpuid = first_cpu(tmp);
605 } 598 }
606 599
607 return get_hard_smp_processor_id(cpuid); 600 return get_hard_smp_processor_id(cpuid);
608} 601}
609#else 602#else
610static int irq_choose_cpu(unsigned int virt_irq) 603static int irq_choose_cpu(const cpumask_t *mask)
611{ 604{
612 return hard_smp_processor_id(); 605 return hard_smp_processor_id();
613} 606}
@@ -621,7 +614,7 @@ static struct mpic *mpic_find(unsigned int irq)
621 if (irq < NUM_ISA_INTERRUPTS) 614 if (irq < NUM_ISA_INTERRUPTS)
622 return NULL; 615 return NULL;
623 616
624 return irq_desc[irq].chip_data; 617 return irq_to_desc(irq)->chip_data;
625} 618}
626 619
627/* Determine if the linux irq is an IPI */ 620/* Determine if the linux irq is an IPI */
@@ -648,14 +641,14 @@ static inline u32 mpic_physmask(u32 cpumask)
648/* Get the mpic structure from the IPI number */ 641/* Get the mpic structure from the IPI number */
649static inline struct mpic * mpic_from_ipi(unsigned int ipi) 642static inline struct mpic * mpic_from_ipi(unsigned int ipi)
650{ 643{
651 return irq_desc[ipi].chip_data; 644 return irq_to_desc(ipi)->chip_data;
652} 645}
653#endif 646#endif
654 647
655/* Get the mpic structure from the irq number */ 648/* Get the mpic structure from the irq number */
656static inline struct mpic * mpic_from_irq(unsigned int irq) 649static inline struct mpic * mpic_from_irq(unsigned int irq)
657{ 650{
658 return irq_desc[irq].chip_data; 651 return irq_to_desc(irq)->chip_data;
659} 652}
660 653
661/* Send an EOI */ 654/* Send an EOI */
@@ -735,7 +728,7 @@ static void mpic_unmask_ht_irq(unsigned int irq)
735 728
736 mpic_unmask_irq(irq); 729 mpic_unmask_irq(irq);
737 730
738 if (irq_desc[irq].status & IRQ_LEVEL) 731 if (irq_to_desc(irq)->status & IRQ_LEVEL)
739 mpic_ht_end_irq(mpic, src); 732 mpic_ht_end_irq(mpic, src);
740} 733}
741 734
@@ -745,7 +738,7 @@ static unsigned int mpic_startup_ht_irq(unsigned int irq)
745 unsigned int src = mpic_irq_to_hw(irq); 738 unsigned int src = mpic_irq_to_hw(irq);
746 739
747 mpic_unmask_irq(irq); 740 mpic_unmask_irq(irq);
748 mpic_startup_ht_interrupt(mpic, src, irq_desc[irq].status); 741 mpic_startup_ht_interrupt(mpic, src, irq_to_desc(irq)->status);
749 742
750 return 0; 743 return 0;
751} 744}
@@ -755,7 +748,7 @@ static void mpic_shutdown_ht_irq(unsigned int irq)
755 struct mpic *mpic = mpic_from_irq(irq); 748 struct mpic *mpic = mpic_from_irq(irq);
756 unsigned int src = mpic_irq_to_hw(irq); 749 unsigned int src = mpic_irq_to_hw(irq);
757 750
758 mpic_shutdown_ht_interrupt(mpic, src, irq_desc[irq].status); 751 mpic_shutdown_ht_interrupt(mpic, src, irq_to_desc(irq)->status);
759 mpic_mask_irq(irq); 752 mpic_mask_irq(irq);
760} 753}
761 754
@@ -772,7 +765,7 @@ static void mpic_end_ht_irq(unsigned int irq)
772 * latched another edge interrupt coming in anyway 765 * latched another edge interrupt coming in anyway
773 */ 766 */
774 767
775 if (irq_desc[irq].status & IRQ_LEVEL) 768 if (irq_to_desc(irq)->status & IRQ_LEVEL)
776 mpic_ht_end_irq(mpic, src); 769 mpic_ht_end_irq(mpic, src);
777 mpic_eoi(mpic); 770 mpic_eoi(mpic);
778} 771}
@@ -816,7 +809,7 @@ int mpic_set_affinity(unsigned int irq, const struct cpumask *cpumask)
816 unsigned int src = mpic_irq_to_hw(irq); 809 unsigned int src = mpic_irq_to_hw(irq);
817 810
818 if (mpic->flags & MPIC_SINGLE_DEST_CPU) { 811 if (mpic->flags & MPIC_SINGLE_DEST_CPU) {
819 int cpuid = irq_choose_cpu(irq); 812 int cpuid = irq_choose_cpu(cpumask);
820 813
821 mpic_irq_write(src, MPIC_INFO(IRQ_DESTINATION), 1 << cpuid); 814 mpic_irq_write(src, MPIC_INFO(IRQ_DESTINATION), 1 << cpuid);
822 } else { 815 } else {
@@ -856,7 +849,7 @@ int mpic_set_irq_type(unsigned int virq, unsigned int flow_type)
856{ 849{
857 struct mpic *mpic = mpic_from_irq(virq); 850 struct mpic *mpic = mpic_from_irq(virq);
858 unsigned int src = mpic_irq_to_hw(virq); 851 unsigned int src = mpic_irq_to_hw(virq);
859 struct irq_desc *desc = get_irq_desc(virq); 852 struct irq_desc *desc = irq_to_desc(virq);
860 unsigned int vecpri, vold, vnew; 853 unsigned int vecpri, vold, vnew;
861 854
862 DBG("mpic: set_irq_type(mpic:@%p,virq:%d,src:0x%x,type:0x%x)\n", 855 DBG("mpic: set_irq_type(mpic:@%p,virq:%d,src:0x%x,type:0x%x)\n",
@@ -994,7 +987,7 @@ static int mpic_host_map(struct irq_host *h, unsigned int virq,
994} 987}
995 988
996static int mpic_host_xlate(struct irq_host *h, struct device_node *ct, 989static int mpic_host_xlate(struct irq_host *h, struct device_node *ct,
997 u32 *intspec, unsigned int intsize, 990 const u32 *intspec, unsigned int intsize,
998 irq_hw_number_t *out_hwirq, unsigned int *out_flags) 991 irq_hw_number_t *out_hwirq, unsigned int *out_flags)
999 992
1000{ 993{
@@ -1062,19 +1055,19 @@ struct mpic * __init mpic_alloc(struct device_node *node,
1062 mpic->name = name; 1055 mpic->name = name;
1063 1056
1064 mpic->hc_irq = mpic_irq_chip; 1057 mpic->hc_irq = mpic_irq_chip;
1065 mpic->hc_irq.typename = name; 1058 mpic->hc_irq.name = name;
1066 if (flags & MPIC_PRIMARY) 1059 if (flags & MPIC_PRIMARY)
1067 mpic->hc_irq.set_affinity = mpic_set_affinity; 1060 mpic->hc_irq.set_affinity = mpic_set_affinity;
1068#ifdef CONFIG_MPIC_U3_HT_IRQS 1061#ifdef CONFIG_MPIC_U3_HT_IRQS
1069 mpic->hc_ht_irq = mpic_irq_ht_chip; 1062 mpic->hc_ht_irq = mpic_irq_ht_chip;
1070 mpic->hc_ht_irq.typename = name; 1063 mpic->hc_ht_irq.name = name;
1071 if (flags & MPIC_PRIMARY) 1064 if (flags & MPIC_PRIMARY)
1072 mpic->hc_ht_irq.set_affinity = mpic_set_affinity; 1065 mpic->hc_ht_irq.set_affinity = mpic_set_affinity;
1073#endif /* CONFIG_MPIC_U3_HT_IRQS */ 1066#endif /* CONFIG_MPIC_U3_HT_IRQS */
1074 1067
1075#ifdef CONFIG_SMP 1068#ifdef CONFIG_SMP
1076 mpic->hc_ipi = mpic_ipi_chip; 1069 mpic->hc_ipi = mpic_ipi_chip;
1077 mpic->hc_ipi.typename = name; 1070 mpic->hc_ipi.name = name;
1078#endif /* CONFIG_SMP */ 1071#endif /* CONFIG_SMP */
1079 1072
1080 mpic->flags = flags; 1073 mpic->flags = flags;