]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
powerpc/mpic: Remove MPIC_BROKEN_FRR_NIRQS and duplicate irq_count
authorKyle Moffett <Kyle.D.Moffett@boeing.com>
Thu, 22 Dec 2011 10:19:12 +0000 (10:19 +0000)
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>
Wed, 22 Feb 2012 23:49:59 +0000 (10:49 +1100)
The mpic->irq_count variable is only used as a software error-checking
limit to determine whether or not an IRQ number is valid.  In board code
which does not manually specify an IRQ count to mpic_alloc(), i.e. 0, it
is automatically detected from the number of ISUs and the ISU size.

In practice, all hardware ends up with irq_count == num_sources, so all
of the runtime checks on mpic->irq_count should just check the value of
mpic->num_sources instead.

When platform hardware does not correctly report the number of IRQs,
which only happens on the MPC85xx/MPC86xx, the MPIC_BROKEN_FRR_NIRQS
flag is used to override the detected value of num_sources with the
manual irq_count parameter.  Since there's no need to manually specify
the number of IRQs except in this case, the extra flag can be eliminated
and the test changed to "irq_count != 0".

Signed-off-by: Kyle Moffett <Kyle.D.Moffett@boeing.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
18 files changed:
arch/powerpc/include/asm/mpic.h
arch/powerpc/platforms/85xx/corenet_ds.c
arch/powerpc/platforms/85xx/mpc8536_ds.c
arch/powerpc/platforms/85xx/mpc85xx_ds.c
arch/powerpc/platforms/85xx/mpc85xx_mds.c
arch/powerpc/platforms/85xx/mpc85xx_rdb.c
arch/powerpc/platforms/85xx/p1010rdb.c
arch/powerpc/platforms/85xx/p1022_ds.c
arch/powerpc/platforms/85xx/p1023_rds.c
arch/powerpc/platforms/85xx/xes_mpc85xx.c
arch/powerpc/platforms/86xx/pic.c
arch/powerpc/platforms/embedded6xx/holly.c
arch/powerpc/platforms/embedded6xx/linkstation.c
arch/powerpc/platforms/embedded6xx/mpc7448_hpc2.c
arch/powerpc/platforms/embedded6xx/storcenter.c
arch/powerpc/platforms/pseries/setup.c
arch/powerpc/sysdev/mpic.c
arch/powerpc/sysdev/mpic_msi.c

index 67b4d98372368fb6e107a874a3c9d6b0315e94d0..2ebac31d1bbdeb5eb728a624d101b4aba4f1a5f1 100644 (file)
@@ -273,7 +273,6 @@ struct mpic
        unsigned int            isu_size;
        unsigned int            isu_shift;
        unsigned int            isu_mask;
-       unsigned int            irq_count;
        /* Number of sources */
        unsigned int            num_sources;
        /* default senses array */
@@ -363,8 +362,6 @@ struct mpic
 #define MPIC_ENABLE_MCK                        0x00000200
 /* Disable bias among target selection, spread interrupts evenly */
 #define MPIC_NO_BIAS                   0x00000400
-/* Ignore NIRQS as reported by FRR */
-#define MPIC_BROKEN_FRR_NIRQS          0x00000800
 /* Destination only supports a single CPU at a time */
 #define MPIC_SINGLE_DEST_CPU           0x00001000
 /* Enable CoreInt delivery of interrupts */
index 07e3e6c47371f0759f2cb6dd4d640c262ac31155..768479b986d47bba04bfaa6c6a8edd87f5ab8ca9 100644 (file)
@@ -36,8 +36,7 @@
 void __init corenet_ds_pic_init(void)
 {
        struct mpic *mpic;
-       unsigned int flags = MPIC_BIG_ENDIAN |
-                               MPIC_BROKEN_FRR_NIRQS | MPIC_SINGLE_DEST_CPU;
+       unsigned int flags = MPIC_BIG_ENDIAN | MPIC_SINGLE_DEST_CPU;
 
        if (ppc_md.get_irq == mpic_get_coreint_irq)
                flags |= MPIC_ENABLE_COREINT;
index cf266826682e72ea7ce9dd0c3e8bf5bdf8128f67..d5373e0c0f7d7daf91b34ed28e11bfa3c8b69ec3 100644 (file)
@@ -38,7 +38,7 @@ void __init mpc8536_ds_pic_init(void)
 {
        struct mpic *mpic = mpic_alloc(NULL, 0,
                          MPIC_WANTS_RESET |
-                         MPIC_BIG_ENDIAN | MPIC_BROKEN_FRR_NIRQS,
+                         MPIC_BIG_ENDIAN,
                        0, 256, " OpenPIC  ");
        BUG_ON(mpic == NULL);
        mpic_init(mpic);
index eefbb91e1d61cdb5883b5af8c3a5968c93d57de5..528b9a09e149a6406d28042985afce96eeed3be2 100644 (file)
@@ -72,13 +72,13 @@ void __init mpc85xx_ds_pic_init(void)
 
        if (of_flat_dt_is_compatible(root, "fsl,MPC8572DS-CAMP")) {
                mpic = mpic_alloc(NULL, 0,
-                       MPIC_BIG_ENDIAN | MPIC_BROKEN_FRR_NIRQS |
+                       MPIC_BIG_ENDIAN |
                        MPIC_SINGLE_DEST_CPU,
                        0, 256, " OpenPIC  ");
        } else {
                mpic = mpic_alloc(NULL, 0,
                          MPIC_WANTS_RESET |
-                         MPIC_BIG_ENDIAN | MPIC_BROKEN_FRR_NIRQS |
+                         MPIC_BIG_ENDIAN |
                          MPIC_SINGLE_DEST_CPU,
                        0, 256, " OpenPIC  ");
        }
index 1d15a0cd2c82dd2110f27e835ede3cefd30f2bbb..a0cb7707c5b24097b83db7ea410e5b23cb0fd0d5 100644 (file)
@@ -436,7 +436,7 @@ static void __init mpc85xx_mds_pic_init(void)
 {
        struct mpic *mpic = mpic_alloc(NULL, 0,
                        MPIC_WANTS_RESET | MPIC_BIG_ENDIAN |
-                       MPIC_BROKEN_FRR_NIRQS | MPIC_SINGLE_DEST_CPU,
+                       MPIC_SINGLE_DEST_CPU,
                        0, 256, " OpenPIC  ");
        BUG_ON(mpic == NULL);
 
index ccf520e890bee2f209182cf6df3f0b240d0864f9..a23f6f30993c3a6184f3284b660079276cdb1d3c 100644 (file)
@@ -49,13 +49,13 @@ void __init mpc85xx_rdb_pic_init(void)
 
        if (of_flat_dt_is_compatible(root, "fsl,MPC85XXRDB-CAMP")) {
                mpic = mpic_alloc(NULL, 0,
-                       MPIC_BIG_ENDIAN | MPIC_BROKEN_FRR_NIRQS |
+                       MPIC_BIG_ENDIAN |
                        MPIC_SINGLE_DEST_CPU,
                        0, 256, " OpenPIC  ");
        } else {
                mpic = mpic_alloc(NULL, 0,
                  MPIC_WANTS_RESET |
-                 MPIC_BIG_ENDIAN | MPIC_BROKEN_FRR_NIRQS |
+                 MPIC_BIG_ENDIAN |
                  MPIC_SINGLE_DEST_CPU,
                  0, 256, " OpenPIC  ");
        }
index 538bc3f57e9d9cc3b5119d0c8a12fafe68763bb7..8650773c839024336448e21b554c778d9170dc75 100644 (file)
@@ -34,7 +34,7 @@ void __init p1010_rdb_pic_init(void)
 {
        struct mpic *mpic = mpic_alloc(NULL, 0,
          MPIC_WANTS_RESET | MPIC_BIG_ENDIAN |
-         MPIC_BROKEN_FRR_NIRQS | MPIC_SINGLE_DEST_CPU,
+         MPIC_SINGLE_DEST_CPU,
          0, 256, " OpenPIC  ");
 
        BUG_ON(mpic == NULL);
index b0984ada3f83c41db76a56f3adbbd7779af6d7c1..28266ab619db095bcf590b30a1ed85fb1643b498 100644 (file)
@@ -244,7 +244,7 @@ void __init p1022_ds_pic_init(void)
 {
        struct mpic *mpic = mpic_alloc(NULL, 0,
                MPIC_WANTS_RESET |
-               MPIC_BIG_ENDIAN | MPIC_BROKEN_FRR_NIRQS |
+               MPIC_BIG_ENDIAN |
                MPIC_SINGLE_DEST_CPU,
                0, 256, " OpenPIC  ");
        BUG_ON(mpic == NULL);
index d951e7027bb65ef65e4b374ccc05a72866f75522..b1cd6a28901f6b5f5292340de8b99b001112b50a 100644 (file)
@@ -95,7 +95,7 @@ static void __init mpc85xx_rds_pic_init(void)
 {
        struct mpic *mpic = mpic_alloc(NULL, 0,
                MPIC_WANTS_RESET | MPIC_BIG_ENDIAN |
-               MPIC_BROKEN_FRR_NIRQS | MPIC_SINGLE_DEST_CPU,
+               MPIC_SINGLE_DEST_CPU,
                0, 256, " OpenPIC  ");
 
        BUG_ON(mpic == NULL);
index 3a69f8b77de6f549729832fb6ed3703aa9cfc477..1ab4e026006d729b59dcc7edb1806955f66e013f 100644 (file)
@@ -45,7 +45,7 @@ void __init xes_mpc85xx_pic_init(void)
 {
        struct mpic *mpic = mpic_alloc(NULL, 0,
                          MPIC_WANTS_RESET |
-                         MPIC_BIG_ENDIAN | MPIC_BROKEN_FRR_NIRQS,
+                         MPIC_BIG_ENDIAN,
                        0, 256, " OpenPIC  ");
        BUG_ON(mpic == NULL);
        mpic_init(mpic);
index 52bbfa031531583da870458a2c41207459cd36a1..27959d63a0799aeb9095deeff08997a3235c9bc0 100644 (file)
@@ -39,7 +39,7 @@ void __init mpc86xx_init_irq(void)
 
        struct mpic *mpic = mpic_alloc(NULL, 0,
                        MPIC_WANTS_RESET | MPIC_BIG_ENDIAN |
-                       MPIC_BROKEN_FRR_NIRQS | MPIC_SINGLE_DEST_CPU,
+                       MPIC_SINGLE_DEST_CPU,
                        0, 256, " MPIC     ");
        BUG_ON(mpic == NULL);
 
index 9cfcf20c05608009176ac419a614050cd5145198..d7727de85d57a414b78889f28730ed5cacb31704 100644 (file)
@@ -157,8 +157,7 @@ static void __init holly_init_IRQ(void)
        mpic = mpic_alloc(NULL, 0,
                        MPIC_BIG_ENDIAN | MPIC_WANTS_RESET |
                        MPIC_SPV_EOI | MPIC_NO_PTHROU_DIS | MPIC_REGSET_TSI108,
-                       24,
-                       NR_IRQS-4, /* num_sources used */
+                       24, 0,
                        "Tsi108_PIC");
 
        BUG_ON(mpic == NULL);
index bcfad92c9cecbd43f0385303a593ff89fa563df4..9479f4ebe1bcb163a5342dc8429443fd3c3cbd37 100644 (file)
@@ -83,7 +83,7 @@ static void __init linkstation_init_IRQ(void)
        struct mpic *mpic;
 
        mpic = mpic_alloc(NULL, 0, MPIC_WANTS_RESET,
-                       4, 32, " EPIC     ");
+                       4, 0, " EPIC     ");
        BUG_ON(mpic == NULL);
 
        /* PCI IRQs */
index f3350d786f5b7177120189bf75a58b28e6ede5b1..90acb5449163b7124e5a8c20ada12465fd59c82a 100644 (file)
@@ -111,8 +111,7 @@ static void __init mpc7448_hpc2_init_IRQ(void)
        mpic = mpic_alloc(NULL, 0,
                        MPIC_BIG_ENDIAN | MPIC_WANTS_RESET |
                        MPIC_SPV_EOI | MPIC_NO_PTHROU_DIS | MPIC_REGSET_TSI108,
-                       24,
-                       NR_IRQS-4, /* num_sources used */
+                       24, 0,
                        "Tsi108_PIC");
 
        BUG_ON(mpic == NULL);
index afa6388349653ccf85eebbb6a4b391efc5d067a4..451dce4edccd55cdcf5ef7219dac1b0570cbef3b 100644 (file)
@@ -85,7 +85,7 @@ static void __init storcenter_init_IRQ(void)
        struct mpic *mpic;
 
        mpic = mpic_alloc(NULL, 0, MPIC_WANTS_RESET,
-                       16, 32, " OpenPIC  ");
+                       16, 0, " OpenPIC  ");
        BUG_ON(mpic == NULL);
 
        /*
index f79f1278dfca84ad03ac28d1c23fe542da34d2a4..6d0a5dfbb9fc0d172bae7efe1f9ca144cc27e770 100644 (file)
@@ -190,9 +190,7 @@ static void __init pseries_mpic_init_IRQ(void)
        BUG_ON(openpic_addr == 0);
 
        /* Setup the openpic driver */
-       mpic = mpic_alloc(pSeries_mpic_node, openpic_addr, 0,
-                         16, 250, /* isu size, irq count */
-                         " MPIC     ");
+       mpic = mpic_alloc(pSeries_mpic_node, openpic_addr, 0, 16, 0, " MPIC     ");
        BUG_ON(mpic == NULL);
 
        /* Add ISUs */
index c297a524f7612c90557ed9b701d672a09f5f2823..cbffeb742d669ecf0a888ecfceddc317b6e7f24e 100644 (file)
@@ -873,7 +873,7 @@ int mpic_set_irq_type(struct irq_data *d, unsigned int flow_type)
        DBG("mpic: set_irq_type(mpic:@%p,virq:%d,src:0x%x,type:0x%x)\n",
            mpic, d->irq, src, flow_type);
 
-       if (src >= mpic->irq_count)
+       if (src >= mpic->num_sources)
                return -EINVAL;
 
        if (flow_type == IRQ_TYPE_NONE)
@@ -909,7 +909,7 @@ void mpic_set_vector(unsigned int virq, unsigned int vector)
        DBG("mpic: set_vector(mpic:@%p,virq:%d,src:%d,vector:0x%x)\n",
            mpic, virq, src, vector);
 
-       if (src >= mpic->irq_count)
+       if (src >= mpic->num_sources)
                return;
 
        vecpri = mpic_irq_read(src, MPIC_INFO(IRQ_VECTOR_PRI));
@@ -926,7 +926,7 @@ void mpic_set_destination(unsigned int virq, unsigned int cpuid)
        DBG("mpic: set_destination(mpic:@%p,virq:%d,src:%d,cpuid:0x%x)\n",
            mpic, virq, src, cpuid);
 
-       if (src >= mpic->irq_count)
+       if (src >= mpic->num_sources)
                return;
 
        mpic_irq_write(src, MPIC_INFO(IRQ_DESTINATION), 1 << cpuid);
@@ -1006,7 +1006,7 @@ static int mpic_host_map(struct irq_host *h, unsigned int virq,
                return 0;
        }
 
-       if (hw >= mpic->irq_count)
+       if (hw >= mpic->num_sources)
                return -EINVAL;
 
        mpic_msi_reserve_hwirq(mpic, hw);
@@ -1221,7 +1221,6 @@ struct mpic * __init mpic_alloc(struct device_node *node,
        mpic->hc_tm.name = name;
 
        mpic->isu_size = isu_size;
-       mpic->irq_count = irq_count;
        mpic->num_sources = 0; /* so far */
 
        if (mpic->flags & MPIC_LARGE_VECTORS)
@@ -1314,8 +1313,8 @@ struct mpic * __init mpic_alloc(struct device_node *node,
         */
        greg_feature = mpic_read(mpic->gregs, MPIC_INFO(GREG_FEATURE_0));
        if (isu_size == 0) {
-               if (mpic->flags & MPIC_BROKEN_FRR_NIRQS)
-                       mpic->num_sources = mpic->irq_count;
+               if (irq_count)
+                       mpic->num_sources = irq_count;
                else
                        mpic->num_sources =
                                ((greg_feature & MPIC_GREG_FEATURE_LAST_SRC_MASK)
@@ -1450,10 +1449,6 @@ void __init mpic_init(struct mpic *mpic)
                               (mpic->ipi_vecs[0] + i));
        }
 
-       /* Initialize interrupt sources */
-       if (mpic->irq_count == 0)
-               mpic->irq_count = mpic->num_sources;
-
        /* Do the HT PIC fixups on U3 broken mpic */
        DBG("MPIC flags: %x\n", mpic->flags);
        if ((mpic->flags & MPIC_U3_HT_IRQS) && !(mpic->flags & MPIC_SECONDARY)) {
index 0f67cd79d48185f0bf962da4a33884db6e17ce7c..cfe394716f6829a4327f3a36e6fbac0b28f716f8 100644 (file)
@@ -54,7 +54,7 @@ static int mpic_msi_reserve_u3_hwirqs(struct mpic *mpic)
        for (i = 100; i < 105; i++)
                msi_bitmap_reserve_hwirq(&mpic->msi_bitmap, i);
 
-       for (i = 124; i < mpic->irq_count; i++)
+       for (i = 124; i < mpic->num_sources; i++)
                msi_bitmap_reserve_hwirq(&mpic->msi_bitmap, i);
 
 
@@ -83,7 +83,7 @@ int mpic_msi_init_allocator(struct mpic *mpic)
 {
        int rc;
 
-       rc = msi_bitmap_alloc(&mpic->msi_bitmap, mpic->irq_count,
+       rc = msi_bitmap_alloc(&mpic->msi_bitmap, mpic->num_sources,
                              mpic->irqhost->of_node);
        if (rc)
                return rc;