Merge branch 'irq-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
authorLinus Torvalds <torvalds@linux-foundation.org>
Sat, 9 May 2015 21:59:05 +0000 (14:59 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Sat, 9 May 2015 21:59:05 +0000 (14:59 -0700)
Pull irq updates from Thomas Gleixner:
 "Two patches from the irq departement:

   - a simple fix to make dummy_irq_chip usable for wakeup scenarios

   - removal of the gic arch_extn hackery.  Now that all users are
     converted we really want to get rid of the interface so people wont
     come up with new use cases"

* 'irq-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  irqchip: gic: Drop support for gic_arch_extn
  genirq: Set IRQCHIP_SKIP_SET_WAKE flag for dummy_irq_chip

1  2 
drivers/irqchip/irq-gic.c

  #include <linux/of.h>
  #include <linux/of_address.h>
  #include <linux/of_irq.h>
 +#include <linux/acpi.h>
  #include <linux/irqdomain.h>
  #include <linux/interrupt.h>
  #include <linux/percpu.h>
  #include <linux/slab.h>
  #include <linux/irqchip/chained_irq.h>
  #include <linux/irqchip/arm-gic.h>
 +#include <linux/irqchip/arm-gic-acpi.h>
  
  #include <asm/cputype.h>
  #include <asm/irq.h>
@@@ -82,19 -80,6 +82,6 @@@ static DEFINE_RAW_SPINLOCK(irq_controll
  #define NR_GIC_CPU_IF 8
  static u8 gic_cpu_map[NR_GIC_CPU_IF] __read_mostly;
  
- /*
-  * Supported arch specific GIC irq extension.
-  * Default make them NULL.
-  */
- struct irq_chip gic_arch_extn = {
-       .irq_eoi        = NULL,
-       .irq_mask       = NULL,
-       .irq_unmask     = NULL,
-       .irq_retrigger  = NULL,
-       .irq_set_type   = NULL,
-       .irq_set_wake   = NULL,
- };
  #ifndef MAX_GIC_NR
  #define MAX_GIC_NR    1
  #endif
@@@ -167,34 -152,16 +154,16 @@@ static int gic_peek_irq(struct irq_dat
  
  static void gic_mask_irq(struct irq_data *d)
  {
-       unsigned long flags;
-       raw_spin_lock_irqsave(&irq_controller_lock, flags);
        gic_poke_irq(d, GIC_DIST_ENABLE_CLEAR);
-       if (gic_arch_extn.irq_mask)
-               gic_arch_extn.irq_mask(d);
-       raw_spin_unlock_irqrestore(&irq_controller_lock, flags);
  }
  
  static void gic_unmask_irq(struct irq_data *d)
  {
-       unsigned long flags;
-       raw_spin_lock_irqsave(&irq_controller_lock, flags);
-       if (gic_arch_extn.irq_unmask)
-               gic_arch_extn.irq_unmask(d);
        gic_poke_irq(d, GIC_DIST_ENABLE_SET);
-       raw_spin_unlock_irqrestore(&irq_controller_lock, flags);
  }
  
  static void gic_eoi_irq(struct irq_data *d)
  {
-       if (gic_arch_extn.irq_eoi) {
-               raw_spin_lock(&irq_controller_lock);
-               gic_arch_extn.irq_eoi(d);
-               raw_spin_unlock(&irq_controller_lock);
-       }
        writel_relaxed(gic_irq(d), gic_cpu_base(d) + GIC_CPU_EOI);
  }
  
@@@ -251,8 -218,6 +220,6 @@@ static int gic_set_type(struct irq_dat
  {
        void __iomem *base = gic_dist_base(d);
        unsigned int gicirq = gic_irq(d);
-       unsigned long flags;
-       int ret;
  
        /* Interrupt configuration for SGIs can't be changed */
        if (gicirq < 16)
                            type != IRQ_TYPE_EDGE_RISING)
                return -EINVAL;
  
-       raw_spin_lock_irqsave(&irq_controller_lock, flags);
-       if (gic_arch_extn.irq_set_type)
-               gic_arch_extn.irq_set_type(d, type);
-       ret = gic_configure_irq(gicirq, type, base, NULL);
-       raw_spin_unlock_irqrestore(&irq_controller_lock, flags);
-       return ret;
- }
- static int gic_retrigger(struct irq_data *d)
- {
-       if (gic_arch_extn.irq_retrigger)
-               return gic_arch_extn.irq_retrigger(d);
-       /* the genirq layer expects 0 if we can't retrigger in hardware */
-       return 0;
+       return gic_configure_irq(gicirq, type, base, NULL);
  }
  
  #ifdef CONFIG_SMP
@@@ -312,21 -259,6 +261,6 @@@ static int gic_set_affinity(struct irq_
  }
  #endif
  
- #ifdef CONFIG_PM
- static int gic_set_wake(struct irq_data *d, unsigned int on)
- {
-       int ret = -ENXIO;
-       if (gic_arch_extn.irq_set_wake)
-               ret = gic_arch_extn.irq_set_wake(d, on);
-       return ret;
- }
- #else
- #define gic_set_wake  NULL
- #endif
  static void __exception_irq_entry gic_handle_irq(struct pt_regs *regs)
  {
        u32 irqstat, irqnr;
@@@ -385,11 -317,9 +319,9 @@@ static struct irq_chip gic_chip = 
        .irq_unmask             = gic_unmask_irq,
        .irq_eoi                = gic_eoi_irq,
        .irq_set_type           = gic_set_type,
-       .irq_retrigger          = gic_retrigger,
  #ifdef CONFIG_SMP
        .irq_set_affinity       = gic_set_affinity,
  #endif
-       .irq_set_wake           = gic_set_wake,
        .irq_get_irqchip_state  = gic_irq_get_irqchip_state,
        .irq_set_irqchip_state  = gic_irq_set_irqchip_state,
  };
@@@ -1055,7 -985,6 +987,6 @@@ void __init gic_init_bases(unsigned in
                set_handle_irq(gic_handle_irq);
        }
  
-       gic_chip.flags |= gic_arch_extn.flags;
        gic_dist_init(gic);
        gic_cpu_init(gic);
        gic_pm_init(gic);
@@@ -1109,105 -1038,3 +1040,105 @@@ IRQCHIP_DECLARE(msm_8660_qgic, "qcom,ms
  IRQCHIP_DECLARE(msm_qgic2, "qcom,msm-qgic2", gic_of_init);
  
  #endif
 +
 +#ifdef CONFIG_ACPI
 +static phys_addr_t dist_phy_base, cpu_phy_base __initdata;
 +
 +static int __init
 +gic_acpi_parse_madt_cpu(struct acpi_subtable_header *header,
 +                      const unsigned long end)
 +{
 +      struct acpi_madt_generic_interrupt *processor;
 +      phys_addr_t gic_cpu_base;
 +      static int cpu_base_assigned;
 +
 +      processor = (struct acpi_madt_generic_interrupt *)header;
 +
 +      if (BAD_MADT_ENTRY(processor, end))
 +              return -EINVAL;
 +
 +      /*
 +       * There is no support for non-banked GICv1/2 register in ACPI spec.
 +       * All CPU interface addresses have to be the same.
 +       */
 +      gic_cpu_base = processor->base_address;
 +      if (cpu_base_assigned && gic_cpu_base != cpu_phy_base)
 +              return -EINVAL;
 +
 +      cpu_phy_base = gic_cpu_base;
 +      cpu_base_assigned = 1;
 +      return 0;
 +}
 +
 +static int __init
 +gic_acpi_parse_madt_distributor(struct acpi_subtable_header *header,
 +                              const unsigned long end)
 +{
 +      struct acpi_madt_generic_distributor *dist;
 +
 +      dist = (struct acpi_madt_generic_distributor *)header;
 +
 +      if (BAD_MADT_ENTRY(dist, end))
 +              return -EINVAL;
 +
 +      dist_phy_base = dist->base_address;
 +      return 0;
 +}
 +
 +int __init
 +gic_v2_acpi_init(struct acpi_table_header *table)
 +{
 +      void __iomem *cpu_base, *dist_base;
 +      int count;
 +
 +      /* Collect CPU base addresses */
 +      count = acpi_parse_entries(ACPI_SIG_MADT,
 +                                 sizeof(struct acpi_table_madt),
 +                                 gic_acpi_parse_madt_cpu, table,
 +                                 ACPI_MADT_TYPE_GENERIC_INTERRUPT, 0);
 +      if (count <= 0) {
 +              pr_err("No valid GICC entries exist\n");
 +              return -EINVAL;
 +      }
 +
 +      /*
 +       * Find distributor base address. We expect one distributor entry since
 +       * ACPI 5.1 spec neither support multi-GIC instances nor GIC cascade.
 +       */
 +      count = acpi_parse_entries(ACPI_SIG_MADT,
 +                                 sizeof(struct acpi_table_madt),
 +                                 gic_acpi_parse_madt_distributor, table,
 +                                 ACPI_MADT_TYPE_GENERIC_DISTRIBUTOR, 0);
 +      if (count <= 0) {
 +              pr_err("No valid GICD entries exist\n");
 +              return -EINVAL;
 +      } else if (count > 1) {
 +              pr_err("More than one GICD entry detected\n");
 +              return -EINVAL;
 +      }
 +
 +      cpu_base = ioremap(cpu_phy_base, ACPI_GIC_CPU_IF_MEM_SIZE);
 +      if (!cpu_base) {
 +              pr_err("Unable to map GICC registers\n");
 +              return -ENOMEM;
 +      }
 +
 +      dist_base = ioremap(dist_phy_base, ACPI_GICV2_DIST_MEM_SIZE);
 +      if (!dist_base) {
 +              pr_err("Unable to map GICD registers\n");
 +              iounmap(cpu_base);
 +              return -ENOMEM;
 +      }
 +
 +      /*
 +       * Initialize zero GIC instance (no multi-GIC support). Also, set GIC
 +       * as default IRQ domain to allow for GSI registration and GSI to IRQ
 +       * number translation (see acpi_register_gsi() and acpi_gsi_to_irq()).
 +       */
 +      gic_init_bases(0, -1, dist_base, cpu_base, 0, NULL);
 +      irq_set_default_host(gic_data[0].domain);
 +
 +      acpi_irq_model = ACPI_IRQ_MODEL_GIC;
 +      return 0;
 +}
 +#endif