@@ -52,13 +52,15 @@ static DEFINE_PER_CPU_READ_MOSTLY(unsigned long[GIC_MAX_LONGS], pcpu_masks);
52
52
53
53
static DEFINE_SPINLOCK (gic_lock );
54
54
static struct irq_domain * gic_irq_domain ;
55
- static struct irq_domain * gic_ipi_domain ;
56
55
static int gic_shared_intrs ;
57
56
static unsigned int gic_cpu_pin ;
58
57
static unsigned int timer_cpu_pin ;
59
58
static struct irq_chip gic_level_irq_controller , gic_edge_irq_controller ;
59
+
60
+ #ifdef CONFIG_GENERIC_IRQ_IPI
60
61
static DECLARE_BITMAP (ipi_resrv , GIC_MAX_INTRS ) ;
61
62
static DECLARE_BITMAP (ipi_available , GIC_MAX_INTRS ) ;
63
+ #endif /* CONFIG_GENERIC_IRQ_IPI */
62
64
63
65
static struct gic_all_vpes_chip_data {
64
66
u32 map ;
@@ -472,9 +474,11 @@ static int gic_irq_domain_map(struct irq_domain *d, unsigned int virq,
472
474
u32 map ;
473
475
474
476
if (hwirq >= GIC_SHARED_HWIRQ_BASE ) {
477
+ #ifdef CONFIG_GENERIC_IRQ_IPI
475
478
/* verify that shared irqs don't conflict with an IPI irq */
476
479
if (test_bit (GIC_HWIRQ_TO_SHARED (hwirq ), ipi_resrv ))
477
480
return - EBUSY ;
481
+ #endif /* CONFIG_GENERIC_IRQ_IPI */
478
482
479
483
err = irq_domain_set_hwirq_and_chip (d , virq , hwirq ,
480
484
& gic_level_irq_controller ,
@@ -567,6 +571,8 @@ static const struct irq_domain_ops gic_irq_domain_ops = {
567
571
.map = gic_irq_domain_map ,
568
572
};
569
573
574
+ #ifdef CONFIG_GENERIC_IRQ_IPI
575
+
570
576
static int gic_ipi_domain_xlate (struct irq_domain * d , struct device_node * ctrlr ,
571
577
const u32 * intspec , unsigned int intsize ,
572
578
irq_hw_number_t * out_hwirq ,
@@ -670,6 +676,48 @@ static const struct irq_domain_ops gic_ipi_domain_ops = {
670
676
.match = gic_ipi_domain_match ,
671
677
};
672
678
679
+ static int gic_register_ipi_domain (struct device_node * node )
680
+ {
681
+ struct irq_domain * gic_ipi_domain ;
682
+ unsigned int v [2 ], num_ipis ;
683
+
684
+ gic_ipi_domain = irq_domain_add_hierarchy (gic_irq_domain ,
685
+ IRQ_DOMAIN_FLAG_IPI_PER_CPU ,
686
+ GIC_NUM_LOCAL_INTRS + gic_shared_intrs ,
687
+ node , & gic_ipi_domain_ops , NULL );
688
+ if (!gic_ipi_domain ) {
689
+ pr_err ("Failed to add IPI domain" );
690
+ return - ENXIO ;
691
+ }
692
+
693
+ irq_domain_update_bus_token (gic_ipi_domain , DOMAIN_BUS_IPI );
694
+
695
+ if (node &&
696
+ !of_property_read_u32_array (node , "mti,reserved-ipi-vectors" , v , 2 )) {
697
+ bitmap_set (ipi_resrv , v [0 ], v [1 ]);
698
+ } else {
699
+ /*
700
+ * Reserve 2 interrupts per possible CPU/VP for use as IPIs,
701
+ * meeting the requirements of arch/mips SMP.
702
+ */
703
+ num_ipis = 2 * num_possible_cpus ();
704
+ bitmap_set (ipi_resrv , gic_shared_intrs - num_ipis , num_ipis );
705
+ }
706
+
707
+ bitmap_copy (ipi_available , ipi_resrv , GIC_MAX_INTRS );
708
+
709
+ return 0 ;
710
+ }
711
+
712
+ #else /* !CONFIG_GENERIC_IRQ_IPI */
713
+
714
+ static inline int gic_register_ipi_domain (struct device_node * node )
715
+ {
716
+ return 0 ;
717
+ }
718
+
719
+ #endif /* !CONFIG_GENERIC_IRQ_IPI */
720
+
673
721
static int gic_cpu_startup (unsigned int cpu )
674
722
{
675
723
/* Enable or disable EIC */
@@ -688,11 +736,12 @@ static int gic_cpu_startup(unsigned int cpu)
688
736
static int __init gic_of_init (struct device_node * node ,
689
737
struct device_node * parent )
690
738
{
691
- unsigned int cpu_vec , i , gicconfig , v [ 2 ], num_ipis ;
739
+ unsigned int cpu_vec , i , gicconfig ;
692
740
unsigned long reserved ;
693
741
phys_addr_t gic_base ;
694
742
struct resource res ;
695
743
size_t gic_len ;
744
+ int ret ;
696
745
697
746
/* Find the first available CPU vector. */
698
747
i = 0 ;
@@ -780,30 +829,9 @@ static int __init gic_of_init(struct device_node *node,
780
829
return - ENXIO ;
781
830
}
782
831
783
- gic_ipi_domain = irq_domain_add_hierarchy (gic_irq_domain ,
784
- IRQ_DOMAIN_FLAG_IPI_PER_CPU ,
785
- GIC_NUM_LOCAL_INTRS + gic_shared_intrs ,
786
- node , & gic_ipi_domain_ops , NULL );
787
- if (!gic_ipi_domain ) {
788
- pr_err ("Failed to add IPI domain" );
789
- return - ENXIO ;
790
- }
791
-
792
- irq_domain_update_bus_token (gic_ipi_domain , DOMAIN_BUS_IPI );
793
-
794
- if (node &&
795
- !of_property_read_u32_array (node , "mti,reserved-ipi-vectors" , v , 2 )) {
796
- bitmap_set (ipi_resrv , v [0 ], v [1 ]);
797
- } else {
798
- /*
799
- * Reserve 2 interrupts per possible CPU/VP for use as IPIs,
800
- * meeting the requirements of arch/mips SMP.
801
- */
802
- num_ipis = 2 * num_possible_cpus ();
803
- bitmap_set (ipi_resrv , gic_shared_intrs - num_ipis , num_ipis );
804
- }
805
-
806
- bitmap_copy (ipi_available , ipi_resrv , GIC_MAX_INTRS );
832
+ ret = gic_register_ipi_domain (node );
833
+ if (ret )
834
+ return ret ;
807
835
808
836
board_bind_eic_interrupt = & gic_bind_eic_interrupt ;
809
837
0 commit comments