Merge branch irq/loongarch into irq/irqchip-next
authorMarc Zyngier <maz@kernel.org>
Wed, 20 Jul 2022 14:26:05 +0000 (15:26 +0100)
committerMarc Zyngier <maz@kernel.org>
Wed, 20 Jul 2022 14:26:05 +0000 (15:26 +0100)
* irq/loongarch:
  : .
  : Merge the long awaited IRQ support for the LoongArch architecture.
  :
  : From the cover letter:
  :
  : "Currently, LoongArch based processors (e.g. Loongson-3A5000)
  : can only work together with LS7A chipsets. The irq chips in
  : LoongArch computers include CPUINTC (CPU Core Interrupt
  : Controller), LIOINTC (Legacy I/O Interrupt Controller),
  : EIOINTC (Extended I/O Interrupt Controller), PCH-PIC (Main
  : Interrupt Controller in LS7A chipset), PCH-LPC (LPC Interrupt
  : Controller in LS7A chipset) and PCH-MSI (MSI Interrupt Controller)."
  :
  : Note that this comes with non-official, arch private ACPICA
  : definitions until the official ACPICA update is realeased.
  : .
  irqchip / ACPI: Introduce ACPI_IRQ_MODEL_LPIC for LoongArch
  irqchip: Add LoongArch CPU interrupt controller support
  irqchip: Add Loongson Extended I/O interrupt controller support
  irqchip/loongson-liointc: Add ACPI init support
  irqchip/loongson-pch-msi: Add ACPI init support
  irqchip/loongson-pch-pic: Add ACPI init support
  irqchip: Add Loongson PCH LPC controller support
  LoongArch: Prepare to support multiple pch-pic and pch-msi irqdomain
  LoongArch: Use ACPI_GENERIC_GSI for gsi handling
  genirq/generic_chip: Export irq_unmap_generic_chip
  ACPI: irq: Allow acpi_gsi_to_irq() to have an arch-specific fallback
  APCI: irq: Add support for multiple GSI domains
  LoongArch: Provisionally add ACPICA data structures

Signed-off-by: Marc Zyngier <maz@kernel.org>
1  2 
drivers/irqchip/Kconfig
drivers/irqchip/Makefile
include/linux/irq.h

diff --combined drivers/irqchip/Kconfig
index 9b22d97c46fd9ce0742b9c618aa98f184fe6433e,f53164ccdc9f8bd1c94fc03dfb955e53d9efe488..7d5b17c54a581c7b6c1affd6d5909b57b391864e
@@@ -8,7 -8,7 +8,7 @@@ config IRQCHI
  config ARM_GIC
        bool
        select IRQ_DOMAIN_HIERARCHY
 -      select GENERIC_IRQ_EFFECTIVE_AFF_MASK
 +      select GENERIC_IRQ_EFFECTIVE_AFF_MASK if SMP
  
  config ARM_GIC_PM
        bool
@@@ -34,7 -34,7 +34,7 @@@ config ARM_GIC_V
        bool
        select IRQ_DOMAIN_HIERARCHY
        select PARTITION_PERCPU
 -      select GENERIC_IRQ_EFFECTIVE_AFF_MASK
 +      select GENERIC_IRQ_EFFECTIVE_AFF_MASK if SMP
  
  config ARM_GIC_V3_ITS
        bool
@@@ -76,7 -76,7 +76,7 @@@ config ARMADA_370_XP_IR
        bool
        select GENERIC_IRQ_CHIP
        select PCI_MSI if PCI
 -      select GENERIC_IRQ_EFFECTIVE_AFF_MASK
 +      select GENERIC_IRQ_EFFECTIVE_AFF_MASK if SMP
  
  config ALPINE_MSI
        bool
@@@ -112,7 -112,7 +112,7 @@@ config BCM6345_L1_IR
        bool
        select GENERIC_IRQ_CHIP
        select IRQ_DOMAIN
 -      select GENERIC_IRQ_EFFECTIVE_AFF_MASK
 +      select GENERIC_IRQ_EFFECTIVE_AFF_MASK if SMP
  
  config BCM7038_L1_IRQ
        tristate "Broadcom STB 7038-style L1/L2 interrupt controller driver"
        default ARCH_BRCMSTB || BMIPS_GENERIC
        select GENERIC_IRQ_CHIP
        select IRQ_DOMAIN
 -      select GENERIC_IRQ_EFFECTIVE_AFF_MASK
 +      select GENERIC_IRQ_EFFECTIVE_AFF_MASK if SMP
  
  config BCM7120_L2_IRQ
        tristate "Broadcom STB 7120-style L2 interrupt controller driver"
@@@ -177,9 -177,9 +177,9 @@@ config MADERA_IR
  config IRQ_MIPS_CPU
        bool
        select GENERIC_IRQ_CHIP
 -      select GENERIC_IRQ_IPI if SYS_SUPPORTS_MULTITHREADING
 +      select GENERIC_IRQ_IPI if SMP && SYS_SUPPORTS_MULTITHREADING
        select IRQ_DOMAIN
 -      select GENERIC_IRQ_EFFECTIVE_AFF_MASK
 +      select GENERIC_IRQ_EFFECTIVE_AFF_MASK if SMP
  
  config CLPS711X_IRQCHIP
        bool
@@@ -242,14 -242,6 +242,14 @@@ config RENESAS_RZA1_IRQ
          Enable support for the Renesas RZ/A1 Interrupt Controller, to use up
          to 8 external interrupts with configurable sense select.
  
 +config RENESAS_RZG2L_IRQC
 +      bool "Renesas RZ/G2L (and alike SoC) IRQC support" if COMPILE_TEST
 +      select GENERIC_IRQ_CHIP
 +      select IRQ_DOMAIN_HIERARCHY
 +      help
 +        Enable support for the Renesas RZ/G2L (and alike SoC) Interrupt Controller
 +        for external devices.
 +
  config SL28CPLD_INTC
        bool "Kontron sl28cpld IRQ controller"
        depends on MFD_SL28CPLD=y || COMPILE_TEST
@@@ -302,7 -294,7 +302,7 @@@ config VERSATILE_FPGA_IRQ_N
  config XTENSA_MX
        bool
        select IRQ_DOMAIN
 -      select GENERIC_IRQ_EFFECTIVE_AFF_MASK
 +      select GENERIC_IRQ_EFFECTIVE_AFF_MASK if SMP
  
  config XILINX_INTC
        bool "Xilinx Interrupt Controller IP"
@@@ -330,8 -322,7 +330,8 @@@ config KEYSTONE_IR
  
  config MIPS_GIC
        bool
 -      select GENERIC_IRQ_IPI
 +      select GENERIC_IRQ_IPI if SMP
 +      select IRQ_DOMAIN_HIERARCHY
        select MIPS_CM
  
  config INGENIC_IRQ
@@@ -539,7 -530,6 +539,7 @@@ config SIFIVE_PLI
        bool "SiFive Platform-Level Interrupt Controller"
        depends on RISCV
        select IRQ_DOMAIN_HIERARCHY
 +      select GENERIC_IRQ_EFFECTIVE_AFF_MASK if SMP
        help
           This enables support for the PLIC chip found in SiFive (and
           potentially other) RISC-V systems.  The PLIC controls devices
@@@ -556,6 -546,16 +556,16 @@@ config EXYNOS_IRQ_COMBINE
          Say yes here to add support for the IRQ combiner devices embedded
          in Samsung Exynos chips.
  
+ config IRQ_LOONGARCH_CPU
+       bool
+       select GENERIC_IRQ_CHIP
+       select IRQ_DOMAIN
+       select GENERIC_IRQ_EFFECTIVE_AFF_MASK
+       help
+         Support for the LoongArch CPU Interrupt Controller. For details of
+         irq chip hierarchy on LoongArch platforms please read the document
+         Documentation/loongarch/irq-chip-model.rst.
  config LOONGSON_LIOINTC
        bool "Loongson Local I/O Interrupt Controller"
        depends on MACH_LOONGSON64
        help
          Support for the Loongson Local I/O Interrupt Controller.
  
+ config LOONGSON_EIOINTC
+       bool "Loongson Extend I/O Interrupt Controller"
+       depends on LOONGARCH
+       depends on MACH_LOONGSON64
+       default MACH_LOONGSON64
+       select IRQ_DOMAIN_HIERARCHY
+       select GENERIC_IRQ_CHIP
+       help
+         Support for the Loongson3 Extend I/O Interrupt Vector Controller.
  config LOONGSON_HTPIC
        bool "Loongson3 HyperTransport PIC Controller"
        depends on MACH_LOONGSON64 && MIPS
@@@ -584,7 -594,7 +604,7 @@@ config LOONGSON_HTVE
  
  config LOONGSON_PCH_PIC
        bool "Loongson PCH PIC Controller"
-       depends on MACH_LOONGSON64 || COMPILE_TEST
+       depends on MACH_LOONGSON64
        default MACH_LOONGSON64
        select IRQ_DOMAIN_HIERARCHY
        select IRQ_FASTEOI_HIERARCHY_HANDLERS
  
  config LOONGSON_PCH_MSI
        bool "Loongson PCH MSI Controller"
-       depends on MACH_LOONGSON64 || COMPILE_TEST
+       depends on MACH_LOONGSON64
        depends on PCI
        default MACH_LOONGSON64
        select IRQ_DOMAIN_HIERARCHY
        help
          Support for the Loongson PCH MSI Controller.
  
+ config LOONGSON_PCH_LPC
+       bool "Loongson PCH LPC Controller"
+       depends on MACH_LOONGSON64
+       default (MACH_LOONGSON64 && LOONGARCH)
+       select IRQ_DOMAIN_HIERARCHY
+       help
+         Support for the Loongson PCH LPC Controller.
  config MST_IRQ
        bool "MStar Interrupt Controller"
        depends on ARCH_MEDIATEK || ARCH_MSTARV7 || COMPILE_TEST
diff --combined drivers/irqchip/Makefile
index 04cb15b647c501b04589cafdd16e71563e1b06ef,e559007bec736017f0d5b1cf91ee9628ef8520ab..86450eb113989ca20e3145e08b59e465ac6a6049
@@@ -51,7 -51,6 +51,7 @@@ obj-$(CONFIG_RDA_INTC)                        += irq-rda-int
  obj-$(CONFIG_RENESAS_INTC_IRQPIN)     += irq-renesas-intc-irqpin.o
  obj-$(CONFIG_RENESAS_IRQC)            += irq-renesas-irqc.o
  obj-$(CONFIG_RENESAS_RZA1_IRQC)               += irq-renesas-rza1.o
 +obj-$(CONFIG_RENESAS_RZG2L_IRQC)      += irq-renesas-rzg2l.o
  obj-$(CONFIG_VERSATILE_FPGA_IRQ)      += irq-versatile-fpga.o
  obj-$(CONFIG_ARCH_NSPIRE)             += irq-zevio.o
  obj-$(CONFIG_ARCH_VT8500)             += irq-vt8500.o
@@@ -104,11 -103,14 +104,14 @@@ obj-$(CONFIG_LS1X_IRQ)                  += irq-ls1x.
  obj-$(CONFIG_TI_SCI_INTR_IRQCHIP)     += irq-ti-sci-intr.o
  obj-$(CONFIG_TI_SCI_INTA_IRQCHIP)     += irq-ti-sci-inta.o
  obj-$(CONFIG_TI_PRUSS_INTC)           += irq-pruss-intc.o
+ obj-$(CONFIG_IRQ_LOONGARCH_CPU)               += irq-loongarch-cpu.o
  obj-$(CONFIG_LOONGSON_LIOINTC)                += irq-loongson-liointc.o
+ obj-$(CONFIG_LOONGSON_EIOINTC)                += irq-loongson-eiointc.o
  obj-$(CONFIG_LOONGSON_HTPIC)          += irq-loongson-htpic.o
  obj-$(CONFIG_LOONGSON_HTVEC)          += irq-loongson-htvec.o
  obj-$(CONFIG_LOONGSON_PCH_PIC)                += irq-loongson-pch-pic.o
  obj-$(CONFIG_LOONGSON_PCH_MSI)                += irq-loongson-pch-msi.o
+ obj-$(CONFIG_LOONGSON_PCH_LPC)                += irq-loongson-pch-lpc.o
  obj-$(CONFIG_MST_IRQ)                 += irq-mst-intc.o
  obj-$(CONFIG_SL28CPLD_INTC)           += irq-sl28cpld.o
  obj-$(CONFIG_MACH_REALTEK_RTL)                += irq-realtek-rtl.o
diff --combined include/linux/irq.h
index 996e22744edd02e1ea03d04d086f3522e96696b7,83a4574308fa8e01d6464e168286b17eea77dd19..c3eb89606c2b17c01a930211080038eb5db7f157
@@@ -151,9 -151,7 +151,9 @@@ struct irq_common_data 
  #endif
        void                    *handler_data;
        struct msi_desc         *msi_desc;
 +#ifdef CONFIG_SMP
        cpumask_var_t           affinity;
 +#endif
  #ifdef CONFIG_GENERIC_IRQ_EFFECTIVE_AFF_MASK
        cpumask_var_t           effective_affinity;
  #endif
@@@ -881,34 -879,21 +881,34 @@@ static inline int irq_data_get_node(str
        return irq_common_data_get_node(d->common);
  }
  
 -static inline struct cpumask *irq_get_affinity_mask(int irq)
 +static inline
 +const struct cpumask *irq_data_get_affinity_mask(struct irq_data *d)
  {
 -      struct irq_data *d = irq_get_irq_data(irq);
 +#ifdef CONFIG_SMP
 +      return d->common->affinity;
 +#else
 +      return cpumask_of(0);
 +#endif
 +}
  
 -      return d ? d->common->affinity : NULL;
 +static inline void irq_data_update_affinity(struct irq_data *d,
 +                                          const struct cpumask *m)
 +{
 +#ifdef CONFIG_SMP
 +      cpumask_copy(d->common->affinity, m);
 +#endif
  }
  
 -static inline struct cpumask *irq_data_get_affinity_mask(struct irq_data *d)
 +static inline const struct cpumask *irq_get_affinity_mask(int irq)
  {
 -      return d->common->affinity;
 +      struct irq_data *d = irq_get_irq_data(irq);
 +
 +      return d ? irq_data_get_affinity_mask(d) : NULL;
  }
  
  #ifdef CONFIG_GENERIC_IRQ_EFFECTIVE_AFF_MASK
  static inline
 -struct cpumask *irq_data_get_effective_affinity_mask(struct irq_data *d)
 +const struct cpumask *irq_data_get_effective_affinity_mask(struct irq_data *d)
  {
        return d->common->effective_affinity;
  }
@@@ -923,14 -908,13 +923,14 @@@ static inline void irq_data_update_effe
  {
  }
  static inline
 -struct cpumask *irq_data_get_effective_affinity_mask(struct irq_data *d)
 +const struct cpumask *irq_data_get_effective_affinity_mask(struct irq_data *d)
  {
 -      return d->common->affinity;
 +      return irq_data_get_affinity_mask(d);
  }
  #endif
  
 -static inline struct cpumask *irq_get_effective_affinity_mask(unsigned int irq)
 +static inline
 +const struct cpumask *irq_get_effective_affinity_mask(unsigned int irq)
  {
        struct irq_data *d = irq_get_irq_data(irq);
  
@@@ -1137,6 -1121,7 +1137,7 @@@ int irq_gc_set_wake(struct irq_data *d
  /* Setup functions for irq_chip_generic */
  int irq_map_generic_chip(struct irq_domain *d, unsigned int virq,
                         irq_hw_number_t hw_irq);
+ void irq_unmap_generic_chip(struct irq_domain *d, unsigned int virq);
  struct irq_chip_generic *
  irq_alloc_generic_chip(const char *name, int nr_ct, unsigned int irq_base,
                       void __iomem *reg_base, irq_flow_handler_t handler);