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 32 | | vint | bit | | 0 |.....|63| vintx | 33 33 | +--------------+ +------------+ | 34 34 | | 35 + | Unmap | 36 + | +--------------+ | 37 + Unmapped events ---->| | umapidx |-------------------------> Globalevents 38 + | +--------------+ | 39 + | | 35 40 +-----------------------------------------+ 36 41 37 42 Configuration of these Intmap registers that maps global events to vint is ··· 74 69 "parent's input irq" specifies the base for parent irq 75 70 - description: | 76 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 77 78 78 required: 79 79 - compatible
+1 -2
drivers/irqchip/Kconfig
··· 180 180 select GENERIC_IRQ_CHIP 181 181 select GENERIC_IRQ_IPI if SYS_SUPPORTS_MULTITHREADING 182 182 select IRQ_DOMAIN 183 - select IRQ_DOMAIN_HIERARCHY if GENERIC_IRQ_IPI 184 183 select GENERIC_IRQ_EFFECTIVE_AFF_MASK 185 184 186 185 config CLPS711X_IRQCHIP ··· 314 315 config MIPS_GIC 315 316 bool 316 317 select GENERIC_IRQ_IPI 317 - select IRQ_DOMAIN_HIERARCHY 318 318 select MIPS_CM 319 319 320 320 config INGENIC_IRQ ··· 589 591 590 592 config MST_IRQ 591 593 bool "MStar Interrupt Controller" 594 + depends on ARCH_MEDIATEK || ARCH_MSTARV7 || COMPILE_TEST 592 595 default ARCH_MEDIATEK 593 596 select IRQ_DOMAIN 594 597 select IRQ_DOMAIN_HIERARCHY
+1 -1
drivers/irqchip/irq-bcm2836.c
··· 244 244 245 245 #define BITS_PER_MBOX 32 246 246 247 - static void bcm2836_arm_irqchip_smp_init(void) 247 + static void __init bcm2836_arm_irqchip_smp_init(void) 248 248 { 249 249 struct irq_fwspec ipi_fwspec = { 250 250 .fwnode = intc.domain->fwnode,
+2 -2
drivers/irqchip/irq-mst-intc.c
··· 154 154 .free = irq_domain_free_irqs_common, 155 155 }; 156 156 157 - int __init 158 - mst_intc_of_init(struct device_node *dn, struct device_node *parent) 157 + static int __init mst_intc_of_init(struct device_node *dn, 158 + struct device_node *parent) 159 159 { 160 160 struct irq_domain *domain, *domain_parent; 161 161 struct mst_intc_chip_data *cd;
+3 -5
drivers/irqchip/irq-renesas-intc-irqpin.c
··· 71 71 }; 72 72 73 73 struct intc_irqpin_config { 74 - unsigned int irlm_bit; 75 - unsigned needs_irlm:1; 74 + int irlm_bit; /* -1 if non-existent */ 76 75 }; 77 76 78 77 static unsigned long intc_irqpin_read32(void __iomem *iomem) ··· 348 349 349 350 static const struct intc_irqpin_config intc_irqpin_irlm_r8a777x = { 350 351 .irlm_bit = 23, /* ICR0.IRLM0 */ 351 - .needs_irlm = 1, 352 352 }; 353 353 354 354 static const struct intc_irqpin_config intc_irqpin_rmobile = { 355 - .needs_irlm = 0, 355 + .irlm_bit = -1, 356 356 }; 357 357 358 358 static const struct of_device_id intc_irqpin_dt_ids[] = { ··· 468 470 } 469 471 470 472 /* configure "individual IRQ mode" where needed */ 471 - if (config && config->needs_irlm) { 473 + if (config && config->irlm_bit >= 0) { 472 474 if (io[INTC_IRQPIN_REG_IRLM]) 473 475 intc_irqpin_read_modify_write(p, INTC_IRQPIN_REG_IRLM, 474 476 config->irlm_bit, 1, 1);
+5 -5
drivers/irqchip/irq-sifive-plic.c
··· 99 99 struct irq_data *d, int enable) 100 100 { 101 101 int cpu; 102 - struct plic_priv *priv = irq_get_chip_data(d->irq); 102 + struct plic_priv *priv = irq_data_get_irq_chip_data(d); 103 103 104 104 writel(enable, priv->regs + PRIORITY_BASE + d->hwirq * PRIORITY_PER_ID); 105 105 for_each_cpu(cpu, mask) { ··· 115 115 { 116 116 struct cpumask amask; 117 117 unsigned int cpu; 118 - struct plic_priv *priv = irq_get_chip_data(d->irq); 118 + struct plic_priv *priv = irq_data_get_irq_chip_data(d); 119 119 120 120 cpumask_and(&amask, &priv->lmask, cpu_online_mask); 121 121 cpu = cpumask_any_and(irq_data_get_affinity_mask(d), ··· 127 127 128 128 static void plic_irq_mask(struct irq_data *d) 129 129 { 130 - struct plic_priv *priv = irq_get_chip_data(d->irq); 130 + struct plic_priv *priv = irq_data_get_irq_chip_data(d); 131 131 132 132 plic_irq_toggle(&priv->lmask, d, 0); 133 133 } ··· 138 138 { 139 139 unsigned int cpu; 140 140 struct cpumask amask; 141 - struct plic_priv *priv = irq_get_chip_data(d->irq); 141 + struct plic_priv *priv = irq_data_get_irq_chip_data(d); 142 142 143 143 cpumask_and(&amask, &priv->lmask, mask_val); 144 144 ··· 151 151 return -EINVAL; 152 152 153 153 plic_irq_toggle(&priv->lmask, d, 0); 154 - plic_irq_toggle(cpumask_of(cpu), d, 1); 154 + plic_irq_toggle(cpumask_of(cpu), d, !irqd_irq_masked(d)); 155 155 156 156 irq_data_update_effective_affinity(d, cpumask_of(cpu)); 157 157
+4
drivers/irqchip/irq-stm32-exti.c
··· 195 195 { .exti = 25, .irq_parent = 107, .chip = &stm32_exti_h_chip_direct }, 196 196 { .exti = 30, .irq_parent = 52, .chip = &stm32_exti_h_chip_direct }, 197 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 }, 198 202 { .exti = 54, .irq_parent = 135, .chip = &stm32_exti_h_chip_direct }, 199 203 { .exti = 61, .irq_parent = 100, .chip = &stm32_exti_h_chip_direct }, 200 204 { .exti = 65, .irq_parent = 144, .chip = &stm32_exti_h_chip },
+80 -3
drivers/irqchip/irq-ti-sci-inta.c
··· 85 85 * @base: Base address of the memory mapped IO registers 86 86 * @pdev: Pointer to platform device. 87 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. 88 99 */ 89 100 struct ti_sci_inta_irq_domain { 90 101 const struct ti_sci_handle *sci; ··· 107 96 void __iomem *base; 108 97 struct platform_device *pdev; 109 98 u32 ti_sci_id; 99 + 100 + int unmapped_cnt; 101 + u16 *unmapped_dev_ids; 110 102 }; 111 103 112 104 #define to_vint_desc(e, i) container_of(e, struct ti_sci_inta_vint_desc, \ 113 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 + } 114 129 115 130 /** 116 131 * ti_sci_inta_irq_handler() - Chained IRQ handler for the vint irqs ··· 288 251 u16 dev_id, dev_index; 289 252 int err; 290 253 291 - dev_id = HWIRQ_TO_DEVID(hwirq); 254 + dev_id = ti_sci_inta_get_dev_id(inta, hwirq); 292 255 dev_index = HWIRQ_TO_IRQID(hwirq); 293 256 294 257 event_desc = &vint_desc->events[free_bit]; ··· 389 352 { 390 353 struct ti_sci_inta_vint_desc *vint_desc; 391 354 struct ti_sci_inta_irq_domain *inta; 355 + u16 dev_id; 392 356 393 357 vint_desc = to_vint_desc(event_desc, event_desc->vint_bit); 394 358 inta = vint_desc->domain->host_data; 359 + dev_id = ti_sci_inta_get_dev_id(inta, hwirq); 395 360 /* free event irq */ 396 361 mutex_lock(&inta->vint_mutex); 397 362 inta->sci->ops.rm_irq_ops.free_event_map(inta->sci, 398 - HWIRQ_TO_DEVID(hwirq), 399 - HWIRQ_TO_IRQID(hwirq), 363 + dev_id, HWIRQ_TO_IRQID(hwirq), 400 364 inta->ti_sci_id, 401 365 vint_desc->vint_id, 402 366 event_desc->global_event, ··· 612 574 .chip = &ti_sci_inta_msi_irq_chip, 613 575 }; 614 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 + 615 612 static int ti_sci_inta_irq_domain_probe(struct platform_device *pdev) 616 613 { 617 614 struct irq_domain *parent_domain, *domain, *msi_domain; ··· 701 628 inta->base = devm_ioremap_resource(dev, res); 702 629 if (IS_ERR(inta->base)) 703 630 return PTR_ERR(inta->base); 631 + 632 + ret = ti_sci_inta_get_unmapped_sources(inta); 633 + if (ret) 634 + return ret; 704 635 705 636 domain = irq_domain_add_linear(dev_of_node(dev), 706 637 ti_sci_get_num_resources(inta->vint),
+1
kernel/irq/Kconfig
··· 82 82 # Generic IRQ IPI support 83 83 config GENERIC_IRQ_IPI 84 84 bool 85 + select IRQ_DOMAIN_HIERARCHY 85 86 86 87 # Generic MSI interrupt support 87 88 config GENERIC_MSI_IRQ