Merge tag 'irq-urgent-2020-11-08' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull irq fixes from Thomas Gleixner:
"A set of fixes for interrupt chip drivers:

- Fix the fallout of the IPI as interrupt conversion in Kconfig and
the BCM2836 interrupt chip driver

- Fixes for interrupt affinity setting and the handling of
hierarchical irq domains in the SiFive PLIC driver

- Make the unmapped event handling in the TI SCI driver work
correctly

- A few minor fixes and cleanups in various chip drivers and Kconfig"

* tag 'irq-urgent-2020-11-08' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
dt-bindings: irqchip: ti, sci-inta: Fix diagram indentation for unmapped events
irqchip/ti-sci-inta: Add support for unmapped event handling
dt-bindings: irqchip: ti, sci-inta: Update for unmapped event handling
irqchip/renesas-intc-irqpin: Merge irlm_bit and needs_irlm
irqchip/sifive-plic: Fix chip_data access within a hierarchy
irqchip/sifive-plic: Fix broken irq_set_affinity() callback
irqchip/stm32-exti: Add all LP timer exti direct events support
irqchip/bcm2836: Fix missing __init annotation
irqchip/mips: Drop selection of IRQ_DOMAIN_HIERARCHY
irqchip/mst: Make mst_intc_of_init static
irqchip/mst: MST_IRQ should depend on ARCH_MEDIATEK or ARCH_MSTARV7
genirq: Let GENERIC_IRQ_IPI select IRQ_DOMAIN_HIERARCHY

+107 -18
+10
Documentation/devicetree/bindings/interrupt-controller/ti,sci-inta.yaml
··· 32 | | vint | bit | | 0 |.....|63| vintx | 33 | +--------------+ +------------+ | 34 | | 35 +-----------------------------------------+ 36 37 Configuration of these Intmap registers that maps global events to vint is ··· 74 "parent's input irq" specifies the base for parent irq 75 - description: | 76 "limit" specifies the limit for translation 77 78 required: 79 - compatible
··· 32 | | vint | bit | | 0 |.....|63| vintx | 33 | +--------------+ +------------+ | 34 | | 35 + | Unmap | 36 + | +--------------+ | 37 + Unmapped events ---->| | umapidx |-------------------------> Globalevents 38 + | +--------------+ | 39 + | | 40 +-----------------------------------------+ 41 42 Configuration of these Intmap registers that maps global events to vint is ··· 69 "parent's input irq" specifies the base for parent irq 70 - description: | 71 "limit" specifies the limit for translation 72 + 73 + ti,unmapped-event-sources: 74 + $ref: /schemas/types.yaml#definitions/phandle-array 75 + description: 76 + Array of phandles to DMA controllers where the unmapped events originate. 77 78 required: 79 - compatible
+1 -2
drivers/irqchip/Kconfig
··· 180 select GENERIC_IRQ_CHIP 181 select GENERIC_IRQ_IPI if SYS_SUPPORTS_MULTITHREADING 182 select IRQ_DOMAIN 183 - select IRQ_DOMAIN_HIERARCHY if GENERIC_IRQ_IPI 184 select GENERIC_IRQ_EFFECTIVE_AFF_MASK 185 186 config CLPS711X_IRQCHIP ··· 314 config MIPS_GIC 315 bool 316 select GENERIC_IRQ_IPI 317 - select IRQ_DOMAIN_HIERARCHY 318 select MIPS_CM 319 320 config INGENIC_IRQ ··· 589 590 config MST_IRQ 591 bool "MStar Interrupt Controller" 592 default ARCH_MEDIATEK 593 select IRQ_DOMAIN 594 select IRQ_DOMAIN_HIERARCHY
··· 180 select GENERIC_IRQ_CHIP 181 select GENERIC_IRQ_IPI if SYS_SUPPORTS_MULTITHREADING 182 select IRQ_DOMAIN 183 select GENERIC_IRQ_EFFECTIVE_AFF_MASK 184 185 config CLPS711X_IRQCHIP ··· 315 config MIPS_GIC 316 bool 317 select GENERIC_IRQ_IPI 318 select MIPS_CM 319 320 config INGENIC_IRQ ··· 591 592 config MST_IRQ 593 bool "MStar Interrupt Controller" 594 + depends on ARCH_MEDIATEK || ARCH_MSTARV7 || COMPILE_TEST 595 default ARCH_MEDIATEK 596 select IRQ_DOMAIN 597 select IRQ_DOMAIN_HIERARCHY
+1 -1
drivers/irqchip/irq-bcm2836.c
··· 244 245 #define BITS_PER_MBOX 32 246 247 - static void bcm2836_arm_irqchip_smp_init(void) 248 { 249 struct irq_fwspec ipi_fwspec = { 250 .fwnode = intc.domain->fwnode,
··· 244 245 #define BITS_PER_MBOX 32 246 247 + static void __init bcm2836_arm_irqchip_smp_init(void) 248 { 249 struct irq_fwspec ipi_fwspec = { 250 .fwnode = intc.domain->fwnode,
+2 -2
drivers/irqchip/irq-mst-intc.c
··· 154 .free = irq_domain_free_irqs_common, 155 }; 156 157 - int __init 158 - mst_intc_of_init(struct device_node *dn, struct device_node *parent) 159 { 160 struct irq_domain *domain, *domain_parent; 161 struct mst_intc_chip_data *cd;
··· 154 .free = irq_domain_free_irqs_common, 155 }; 156 157 + static int __init mst_intc_of_init(struct device_node *dn, 158 + struct device_node *parent) 159 { 160 struct irq_domain *domain, *domain_parent; 161 struct mst_intc_chip_data *cd;
+3 -5
drivers/irqchip/irq-renesas-intc-irqpin.c
··· 71 }; 72 73 struct intc_irqpin_config { 74 - unsigned int irlm_bit; 75 - unsigned needs_irlm:1; 76 }; 77 78 static unsigned long intc_irqpin_read32(void __iomem *iomem) ··· 348 349 static const struct intc_irqpin_config intc_irqpin_irlm_r8a777x = { 350 .irlm_bit = 23, /* ICR0.IRLM0 */ 351 - .needs_irlm = 1, 352 }; 353 354 static const struct intc_irqpin_config intc_irqpin_rmobile = { 355 - .needs_irlm = 0, 356 }; 357 358 static const struct of_device_id intc_irqpin_dt_ids[] = { ··· 468 } 469 470 /* configure "individual IRQ mode" where needed */ 471 - if (config && config->needs_irlm) { 472 if (io[INTC_IRQPIN_REG_IRLM]) 473 intc_irqpin_read_modify_write(p, INTC_IRQPIN_REG_IRLM, 474 config->irlm_bit, 1, 1);
··· 71 }; 72 73 struct intc_irqpin_config { 74 + int irlm_bit; /* -1 if non-existent */ 75 }; 76 77 static unsigned long intc_irqpin_read32(void __iomem *iomem) ··· 349 350 static const struct intc_irqpin_config intc_irqpin_irlm_r8a777x = { 351 .irlm_bit = 23, /* ICR0.IRLM0 */ 352 }; 353 354 static const struct intc_irqpin_config intc_irqpin_rmobile = { 355 + .irlm_bit = -1, 356 }; 357 358 static const struct of_device_id intc_irqpin_dt_ids[] = { ··· 470 } 471 472 /* configure "individual IRQ mode" where needed */ 473 + if (config && config->irlm_bit >= 0) { 474 if (io[INTC_IRQPIN_REG_IRLM]) 475 intc_irqpin_read_modify_write(p, INTC_IRQPIN_REG_IRLM, 476 config->irlm_bit, 1, 1);
+5 -5
drivers/irqchip/irq-sifive-plic.c
··· 99 struct irq_data *d, int enable) 100 { 101 int cpu; 102 - struct plic_priv *priv = irq_get_chip_data(d->irq); 103 104 writel(enable, priv->regs + PRIORITY_BASE + d->hwirq * PRIORITY_PER_ID); 105 for_each_cpu(cpu, mask) { ··· 115 { 116 struct cpumask amask; 117 unsigned int cpu; 118 - struct plic_priv *priv = irq_get_chip_data(d->irq); 119 120 cpumask_and(&amask, &priv->lmask, cpu_online_mask); 121 cpu = cpumask_any_and(irq_data_get_affinity_mask(d), ··· 127 128 static void plic_irq_mask(struct irq_data *d) 129 { 130 - struct plic_priv *priv = irq_get_chip_data(d->irq); 131 132 plic_irq_toggle(&priv->lmask, d, 0); 133 } ··· 138 { 139 unsigned int cpu; 140 struct cpumask amask; 141 - struct plic_priv *priv = irq_get_chip_data(d->irq); 142 143 cpumask_and(&amask, &priv->lmask, mask_val); 144 ··· 151 return -EINVAL; 152 153 plic_irq_toggle(&priv->lmask, d, 0); 154 - plic_irq_toggle(cpumask_of(cpu), d, 1); 155 156 irq_data_update_effective_affinity(d, cpumask_of(cpu)); 157
··· 99 struct irq_data *d, int enable) 100 { 101 int cpu; 102 + struct plic_priv *priv = irq_data_get_irq_chip_data(d); 103 104 writel(enable, priv->regs + PRIORITY_BASE + d->hwirq * PRIORITY_PER_ID); 105 for_each_cpu(cpu, mask) { ··· 115 { 116 struct cpumask amask; 117 unsigned int cpu; 118 + struct plic_priv *priv = irq_data_get_irq_chip_data(d); 119 120 cpumask_and(&amask, &priv->lmask, cpu_online_mask); 121 cpu = cpumask_any_and(irq_data_get_affinity_mask(d), ··· 127 128 static void plic_irq_mask(struct irq_data *d) 129 { 130 + struct plic_priv *priv = irq_data_get_irq_chip_data(d); 131 132 plic_irq_toggle(&priv->lmask, d, 0); 133 } ··· 138 { 139 unsigned int cpu; 140 struct cpumask amask; 141 + struct plic_priv *priv = irq_data_get_irq_chip_data(d); 142 143 cpumask_and(&amask, &priv->lmask, mask_val); 144 ··· 151 return -EINVAL; 152 153 plic_irq_toggle(&priv->lmask, d, 0); 154 + plic_irq_toggle(cpumask_of(cpu), d, !irqd_irq_masked(d)); 155 156 irq_data_update_effective_affinity(d, cpumask_of(cpu)); 157
+4
drivers/irqchip/irq-stm32-exti.c
··· 195 { .exti = 25, .irq_parent = 107, .chip = &stm32_exti_h_chip_direct }, 196 { .exti = 30, .irq_parent = 52, .chip = &stm32_exti_h_chip_direct }, 197 { .exti = 47, .irq_parent = 93, .chip = &stm32_exti_h_chip_direct }, 198 { .exti = 54, .irq_parent = 135, .chip = &stm32_exti_h_chip_direct }, 199 { .exti = 61, .irq_parent = 100, .chip = &stm32_exti_h_chip_direct }, 200 { .exti = 65, .irq_parent = 144, .chip = &stm32_exti_h_chip },
··· 195 { .exti = 25, .irq_parent = 107, .chip = &stm32_exti_h_chip_direct }, 196 { .exti = 30, .irq_parent = 52, .chip = &stm32_exti_h_chip_direct }, 197 { .exti = 47, .irq_parent = 93, .chip = &stm32_exti_h_chip_direct }, 198 + { .exti = 48, .irq_parent = 138, .chip = &stm32_exti_h_chip_direct }, 199 + { .exti = 50, .irq_parent = 139, .chip = &stm32_exti_h_chip_direct }, 200 + { .exti = 52, .irq_parent = 140, .chip = &stm32_exti_h_chip_direct }, 201 + { .exti = 53, .irq_parent = 141, .chip = &stm32_exti_h_chip_direct }, 202 { .exti = 54, .irq_parent = 135, .chip = &stm32_exti_h_chip_direct }, 203 { .exti = 61, .irq_parent = 100, .chip = &stm32_exti_h_chip_direct }, 204 { .exti = 65, .irq_parent = 144, .chip = &stm32_exti_h_chip },
+80 -3
drivers/irqchip/irq-ti-sci-inta.c
··· 85 * @base: Base address of the memory mapped IO registers 86 * @pdev: Pointer to platform device. 87 * @ti_sci_id: TI-SCI device identifier 88 */ 89 struct ti_sci_inta_irq_domain { 90 const struct ti_sci_handle *sci; ··· 107 void __iomem *base; 108 struct platform_device *pdev; 109 u32 ti_sci_id; 110 }; 111 112 #define to_vint_desc(e, i) container_of(e, struct ti_sci_inta_vint_desc, \ 113 events[i]) 114 115 /** 116 * ti_sci_inta_irq_handler() - Chained IRQ handler for the vint irqs ··· 288 u16 dev_id, dev_index; 289 int err; 290 291 - dev_id = HWIRQ_TO_DEVID(hwirq); 292 dev_index = HWIRQ_TO_IRQID(hwirq); 293 294 event_desc = &vint_desc->events[free_bit]; ··· 389 { 390 struct ti_sci_inta_vint_desc *vint_desc; 391 struct ti_sci_inta_irq_domain *inta; 392 393 vint_desc = to_vint_desc(event_desc, event_desc->vint_bit); 394 inta = vint_desc->domain->host_data; 395 /* free event irq */ 396 mutex_lock(&inta->vint_mutex); 397 inta->sci->ops.rm_irq_ops.free_event_map(inta->sci, 398 - HWIRQ_TO_DEVID(hwirq), 399 - HWIRQ_TO_IRQID(hwirq), 400 inta->ti_sci_id, 401 vint_desc->vint_id, 402 event_desc->global_event, ··· 612 .chip = &ti_sci_inta_msi_irq_chip, 613 }; 614 615 static int ti_sci_inta_irq_domain_probe(struct platform_device *pdev) 616 { 617 struct irq_domain *parent_domain, *domain, *msi_domain; ··· 701 inta->base = devm_ioremap_resource(dev, res); 702 if (IS_ERR(inta->base)) 703 return PTR_ERR(inta->base); 704 705 domain = irq_domain_add_linear(dev_of_node(dev), 706 ti_sci_get_num_resources(inta->vint),
··· 85 * @base: Base address of the memory mapped IO registers 86 * @pdev: Pointer to platform device. 87 * @ti_sci_id: TI-SCI device identifier 88 + * @unmapped_cnt: Number of @unmapped_dev_ids entries 89 + * @unmapped_dev_ids: Pointer to an array of TI-SCI device identifiers of 90 + * unmapped event sources. 91 + * Unmapped Events are not part of the Global Event Map and 92 + * they are converted to Global event within INTA to be 93 + * received by the same INTA to generate an interrupt. 94 + * In case an interrupt request comes for a device which is 95 + * generating Unmapped Event, we must use the INTA's TI-SCI 96 + * device identifier in place of the source device 97 + * identifier to let sysfw know where it has to program the 98 + * Global Event number. 99 */ 100 struct ti_sci_inta_irq_domain { 101 const struct ti_sci_handle *sci; ··· 96 void __iomem *base; 97 struct platform_device *pdev; 98 u32 ti_sci_id; 99 + 100 + int unmapped_cnt; 101 + u16 *unmapped_dev_ids; 102 }; 103 104 #define to_vint_desc(e, i) container_of(e, struct ti_sci_inta_vint_desc, \ 105 events[i]) 106 + 107 + static u16 ti_sci_inta_get_dev_id(struct ti_sci_inta_irq_domain *inta, u32 hwirq) 108 + { 109 + u16 dev_id = HWIRQ_TO_DEVID(hwirq); 110 + int i; 111 + 112 + if (inta->unmapped_cnt == 0) 113 + return dev_id; 114 + 115 + /* 116 + * For devices sending Unmapped Events we must use the INTA's TI-SCI 117 + * device identifier number to be able to convert it to a Global Event 118 + * and map it to an interrupt. 119 + */ 120 + for (i = 0; i < inta->unmapped_cnt; i++) { 121 + if (dev_id == inta->unmapped_dev_ids[i]) { 122 + dev_id = inta->ti_sci_id; 123 + break; 124 + } 125 + } 126 + 127 + return dev_id; 128 + } 129 130 /** 131 * ti_sci_inta_irq_handler() - Chained IRQ handler for the vint irqs ··· 251 u16 dev_id, dev_index; 252 int err; 253 254 + dev_id = ti_sci_inta_get_dev_id(inta, hwirq); 255 dev_index = HWIRQ_TO_IRQID(hwirq); 256 257 event_desc = &vint_desc->events[free_bit]; ··· 352 { 353 struct ti_sci_inta_vint_desc *vint_desc; 354 struct ti_sci_inta_irq_domain *inta; 355 + u16 dev_id; 356 357 vint_desc = to_vint_desc(event_desc, event_desc->vint_bit); 358 inta = vint_desc->domain->host_data; 359 + dev_id = ti_sci_inta_get_dev_id(inta, hwirq); 360 /* free event irq */ 361 mutex_lock(&inta->vint_mutex); 362 inta->sci->ops.rm_irq_ops.free_event_map(inta->sci, 363 + dev_id, HWIRQ_TO_IRQID(hwirq), 364 inta->ti_sci_id, 365 vint_desc->vint_id, 366 event_desc->global_event, ··· 574 .chip = &ti_sci_inta_msi_irq_chip, 575 }; 576 577 + static int ti_sci_inta_get_unmapped_sources(struct ti_sci_inta_irq_domain *inta) 578 + { 579 + struct device *dev = &inta->pdev->dev; 580 + struct device_node *node = dev_of_node(dev); 581 + struct of_phandle_iterator it; 582 + int count, err, ret, i; 583 + 584 + count = of_count_phandle_with_args(node, "ti,unmapped-event-sources", NULL); 585 + if (count <= 0) 586 + return 0; 587 + 588 + inta->unmapped_dev_ids = devm_kcalloc(dev, count, 589 + sizeof(*inta->unmapped_dev_ids), 590 + GFP_KERNEL); 591 + if (!inta->unmapped_dev_ids) 592 + return -ENOMEM; 593 + 594 + i = 0; 595 + of_for_each_phandle(&it, err, node, "ti,unmapped-event-sources", NULL, 0) { 596 + u32 dev_id; 597 + 598 + ret = of_property_read_u32(it.node, "ti,sci-dev-id", &dev_id); 599 + if (ret) { 600 + dev_err(dev, "ti,sci-dev-id read failure for %pOFf\n", it.node); 601 + of_node_put(it.node); 602 + return ret; 603 + } 604 + inta->unmapped_dev_ids[i++] = dev_id; 605 + } 606 + 607 + inta->unmapped_cnt = count; 608 + 609 + return 0; 610 + } 611 + 612 static int ti_sci_inta_irq_domain_probe(struct platform_device *pdev) 613 { 614 struct irq_domain *parent_domain, *domain, *msi_domain; ··· 628 inta->base = devm_ioremap_resource(dev, res); 629 if (IS_ERR(inta->base)) 630 return PTR_ERR(inta->base); 631 + 632 + ret = ti_sci_inta_get_unmapped_sources(inta); 633 + if (ret) 634 + return ret; 635 636 domain = irq_domain_add_linear(dev_of_node(dev), 637 ti_sci_get_num_resources(inta->vint),
+1
kernel/irq/Kconfig
··· 82 # Generic IRQ IPI support 83 config GENERIC_IRQ_IPI 84 bool 85 86 # Generic MSI interrupt support 87 config GENERIC_MSI_IRQ
··· 82 # Generic IRQ IPI support 83 config GENERIC_IRQ_IPI 84 bool 85 + select IRQ_DOMAIN_HIERARCHY 86 87 # Generic MSI interrupt support 88 config GENERIC_MSI_IRQ