History

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

Pull irq updates from Thomas Gleixner: "The usual boring updates from the interrupt subsystem: - Infrastructure to allow building irqchip drivers as modules - Consolidation of irqchip ACPI probing - Removal of the EOI-preflow interrupt handler which was required for SPARC support and became obsolete after SPARC was converted to use sparse interrupts. - Cleanups, fixes and improvements all over the place" * tag 'irq-core-2020-08-04' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (51 commits) irqchip/loongson-pch-pic: Fix the misused irq flow handler irqchip/loongson-htvec: Support 8 groups of HT vectors irqchip/loongson-liointc: Fix misuse of gc->mask_cache dt-bindings: interrupt-controller: Update Loongson HTVEC description irqchip/imx-intmux: Fix irqdata regs save in imx_intmux_runtime_suspend() irqchip/imx-intmux: Implement intmux runtime power management irqchip/gic-v4.1: Use GFP_ATOMIC flag in allocate_vpe_l1_table() irqchip: Fix IRQCHIP_PLATFORM_DRIVER_* compilation by including module.h irqchip/stm32-exti: Map direct event to irq parent irqchip/mtk-cirq: Convert to a platform driver irqchip/mtk-sysirq: Convert to a platform driver irqchip/qcom-pdc: Switch to using IRQCHIP_PLATFORM_DRIVER helper macros irqchip: Add IRQCHIP_PLATFORM_DRIVER_BEGIN/END and IRQCHIP_MATCH helper macros irqchip: irq-bcm2836.h: drop a duplicated word irqchip/gic-v4.1: Ensure accessing the correct RD when writing INVALLR irqchip/irq-bcm7038-l1: Guard uses of cpu_logical_map irqchip/gic-v3: Remove unused register definition irqchip/qcom-pdc: Allow QCOM_PDC to be loadable as a permanent module genirq: Export irq_chip_retrigger_hierarchy and irq_chip_set_vcpu_affinity_parent irqdomain: Export irq_domain_update_bus_token ...

Linus Torvalds committed 6 years ago

Commit f8b036a2 parents 2ed90db 3d5128c36 files · +346 −244Browse files

Unified · Split

36 files
  1. Documentation/devicetree/bindings/interrupt-controller/brcm,l2-intc.txt +4 −1
  2. Documentation/devicetree/bindings/interrupt-controller/loongson,htvec.yaml +2 −2
  3. arch/sparc/Kconfig +0 −1
  4. drivers/irqchip/Kconfig +1 −2
  5. drivers/irqchip/irq-ativic32.c +1 −1
  6. drivers/irqchip/irq-atmel-aic5.c +7 −1
  7. drivers/irqchip/irq-bcm7038-l1.c +11 −0
  8. drivers/irqchip/irq-bcm7120-l2.c +5 −3
  9. drivers/irqchip/irq-brcmstb-l2.c +5 −0
  10. drivers/irqchip/irq-gic-v3-its.c +9 −5
  11. drivers/irqchip/irq-gic-v3.c +1 −1
  12. drivers/irqchip/irq-gic.c +1 −1
  13. drivers/irqchip/irq-imx-intmux.c +66 −4
  14. drivers/irqchip/irq-loongson-htpic.c +2 −4
  15. drivers/irqchip/irq-loongson-htvec.c +18 −14
  16. drivers/irqchip/irq-loongson-liointc.c +6 −5
  17. drivers/irqchip/irq-loongson-pch-msi.c +1 −6
  18. drivers/irqchip/irq-loongson-pch-pic.c +13 −17
  19. drivers/irqchip/irq-mips-gic.c +5 −5
  20. drivers/irqchip/irq-mtk-cirq.c +3 −1
  21. drivers/irqchip/irq-mtk-sysirq.c +7 −5
  22. drivers/irqchip/irq-stm32-exti.c +87 −79
  23. drivers/irqchip/irq-ti-sci-inta.c +2 −4
  24. drivers/irqchip/irq-vic.c +4 −22
  25. drivers/irqchip/irqchip.c +29 −0
  26. drivers/irqchip/qcom-pdc.c +7 −1
  27. include/linux/acpi.h +17 −6
  28. include/linux/irqchip.h +27 −2
  29. include/linux/irqchip/arm-gic-v3.h +0 −4
  30. include/linux/irqchip/arm-vic.h +0 −11
  31. include/linux/irqchip/irq-bcm2836.h +1 −1
  32. include/linux/irqdesc.h +0 −15
  33. include/linux/irqhandler.h +0 −1
  34. kernel/irq/Kconfig +0 −4
  35. kernel/irq/chip.c +2 −14
  36. kernel/irq/irqdomain.c +2 −1
Documentation/devicetree/bindings/interrupt-controller/brcm,l2-intc.txt+4−1
@@ -2,7 +2,10 @@ Broadcom Generic Level 2 Interrupt Controller · 1 unmodified line
22
33 Required properties:
44
5−- compatible: should be "brcm,l2-intc" for latched interrupt controllers
5+- compatible: should be one of:
6+ "brcm,hif-spi-l2-intc" or
7+ "brcm,upg-aux-aon-l2-intc" or
8+ "brcm,l2-intc" for latched interrupt controllers
69 should be "brcm,bcm7271-l2-intc" for level interrupt controllers
710 - reg: specifies the base physical address and size of the registers
811 - interrupt-controller: identifies the node as an interrupt controller
Documentation/devicetree/bindings/interrupt-controller/loongson,htvec.yaml+2−2
@@ -22,8 +22,8 @@ properties: · 21 unmodified lines
2222
2323 interrupts:
2424 minItems: 1
25− maxItems: 4
26− description: Four parent interrupts that receive chained interrupts.
25+ maxItems: 8
26+ description: Eight parent interrupts that receive chained interrupts.
2727
2828 interrupt-controller: true
2929
arch/sparc/Kconfig+0−1
@@ -81,7 +81,6 @@ config SPARC64 · 80 unmodified lines
8181 select RTC_DRV_STARFIRE
8282 select HAVE_PERF_EVENTS
8383 select PERF_USE_VMALLOC
84− select IRQ_PREFLOW_FASTEOI
8584 select ARCH_HAVE_NMI_SAFE_CMPXCHG
8685 select HAVE_C_RECORDMCOUNT
8786 select HAVE_ARCH_AUDITSYSCALL
drivers/irqchip/Kconfig+1−2
@@ -425,7 +425,7 @@ config GOLDFISH_PIC · 424 unmodified lines
425425 for Goldfish based virtual platforms.
426426
427427 config QCOM_PDC
428− bool "QCOM PDC"
428+ tristate "QCOM PDC"
429429 depends on ARCH_QCOM
430430 select IRQ_DOMAIN_HIERARCHY
431431 help
@@ -541,7 +541,6 @@ config LOONGSON_HTPIC · 109 unmodified lines
541541 default y
542542 select IRQ_DOMAIN
543543 select GENERIC_IRQ_CHIP
544− select I8259
545544 help
546545 Support for the Loongson-3 HyperTransport PIC Controller.
547546
drivers/irqchip/irq-ativic32.c+1−1
@@ -92,7 +92,7 @@ static int ativic32_irq_domain_map(struct irq_domain *id, unsigned int virq, · 91 unmodified lines
9292 return 0;
9393 }
9494
95−static struct irq_domain_ops ativic32_ops = {
95+static const struct irq_domain_ops ativic32_ops = {
9696 .map = ativic32_irq_domain_map,
9797 .xlate = irq_domain_xlate_onecell
9898 };
drivers/irqchip/irq-atmel-aic5.c+7−1
@@ -310,10 +310,16 @@ static void __init sama5d3_aic_irq_fixup(void) · 309 unmodified lines
310310 aic_common_rtc_irq_fixup();
311311 }
312312
313+static void __init sam9x60_aic_irq_fixup(void)
314+{
315+ aic_common_rtc_irq_fixup();
316+ aic_common_rtt_irq_fixup();
317+}
318+
313319 static const struct of_device_id aic5_irq_fixups[] __initconst = {
314320 { .compatible = "atmel,sama5d3", .data = sama5d3_aic_irq_fixup },
315321 { .compatible = "atmel,sama5d4", .data = sama5d3_aic_irq_fixup },
316− { .compatible = "microchip,sam9x60", .data = sama5d3_aic_irq_fixup },
322+ { .compatible = "microchip,sam9x60", .data = sam9x60_aic_irq_fixup },
317323 { /* sentinel */ },
318324 };
319325
drivers/irqchip/irq-bcm7038-l1.c+11−0
@@ -28,6 +28,9 @@ · 27 unmodified lines
2828 #include <linux/irqchip.h>
2929 #include <linux/irqchip/chained_irq.h>
3030 #include <linux/syscore_ops.h>
31+#ifdef CONFIG_ARM
32+#include <asm/smp_plat.h>
33+#endif
3134
3235 #define IRQS_PER_WORD 32
3336 #define REG_BYTES_PER_IRQ_WORD (sizeof(u32) * 4)
@@ -327,7 +330,11 @@ static int bcm7038_l1_suspend(void) · 293 unmodified lines
327330 u32 val;
328331
329332 /* Wakeup interrupt should only come from the boot cpu */
333+#ifdef CONFIG_SMP
330334 boot_cpu = cpu_logical_map(0);
335+#else
336+ boot_cpu = 0;
337+#endif
331338
332339 list_for_each_entry(intc, &bcm7038_l1_intcs_list, list) {
333340 for (word = 0; word < intc->n_words; word++) {
@@ -347,7 +354,11 @@ static void bcm7038_l1_resume(void) · 13 unmodified lines
347354 struct bcm7038_l1_chip *intc;
348355 int boot_cpu, word;
349356
357+#ifdef CONFIG_SMP
350358 boot_cpu = cpu_logical_map(0);
359+#else
360+ boot_cpu = 0;
361+#endif
351362
352363 list_for_each_entry(intc, &bcm7038_l1_intcs_list, list) {
353364 for (word = 0; word < intc->n_words; word++) {
drivers/irqchip/irq-bcm7120-l2.c+5−3
@@ -143,6 +143,9 @@ static int bcm7120_l2_intc_init_one(struct device_node *dn, · 142 unmodified lines
143143
144144 irq_set_chained_handler_and_data(parent_irq,
145145 bcm7120_l2_intc_irq_handle, l1_data);
146+ if (data->can_wake)
147+ enable_irq_wake(parent_irq);
148+
146149 return 0;
147150 }
148151
@@ -247,6 +250,8 @@ static int __init bcm7120_l2_intc_probe(struct device_node *dn, · 98 unmodified lines
247250 if (ret < 0)
248251 goto out_free_l1_data;
249252
253+ data->can_wake = of_property_read_bool(dn, "brcm,irq-can-wake");
254+
250255 for (irq = 0; irq < data->num_parent_irqs; irq++) {
251256 ret = bcm7120_l2_intc_init_one(dn, data, irq, valid_mask);
252257 if (ret)
@@ -274,9 +279,6 @@ static int __init bcm7120_l2_intc_probe(struct device_node *dn, · 21 unmodified lines
274279 goto out_free_domain;
275280 }
276281
277− if (of_property_read_bool(dn, "brcm,irq-can-wake"))
278− data->can_wake = true;
279−
280282 for (idx = 0; idx < data->n_words; idx++) {
281283 irq = idx * IRQS_PER_WORD;
282284 gc = irq_get_domain_generic_chip(data->domain, irq);
drivers/irqchip/irq-brcmstb-l2.c+5−0
@@ -254,6 +254,7 @@ static int __init brcmstb_l2_intc_of_init(struct device_node *np, · 253 unmodified lines
254254 */
255255 data->gc->wake_enabled = 0xffffffff;
256256 ct->chip.irq_set_wake = irq_gc_set_wake;
257+ enable_irq_wake(parent_irq);
257258 }
258259
259260 pr_info("registered L2 intc (%pOF, parent irq: %d)\n", np, parent_irq);
@@ -275,6 +276,10 @@ static int __init brcmstb_l2_edge_intc_of_init(struct device_node *np, · 15 unmodified lines
275276 return brcmstb_l2_intc_of_init(np, parent, &l2_edge_intc_init);
276277 }
277278 IRQCHIP_DECLARE(brcmstb_l2_intc, "brcm,l2-intc", brcmstb_l2_edge_intc_of_init);
279+IRQCHIP_DECLARE(brcmstb_hif_spi_l2_intc, "brcm,hif-spi-l2-intc",
280+ brcmstb_l2_edge_intc_of_init);
281+IRQCHIP_DECLARE(brcmstb_upg_aux_aon_l2_intc, "brcm,upg-aux-aon-l2-intc",
282+ brcmstb_l2_edge_intc_of_init);
278283
279284 static int __init brcmstb_l2_lvl_intc_of_init(struct device_node *np,
280285 struct device_node *parent)
drivers/irqchip/irq-gic-v3-its.c+9−5
@@ -2814,7 +2814,7 @@ static int allocate_vpe_l1_table(void) · 2813 unmodified lines
28142814 if (val & GICR_VPROPBASER_4_1_VALID)
28152815 goto out;
28162816
2817− gic_data_rdist()->vpe_table_mask = kzalloc(sizeof(cpumask_t), GFP_KERNEL);
2817+ gic_data_rdist()->vpe_table_mask = kzalloc(sizeof(cpumask_t), GFP_ATOMIC);
28182818 if (!gic_data_rdist()->vpe_table_mask)
28192819 return -ENOMEM;
28202820
@@ -2881,7 +2881,7 @@ static int allocate_vpe_l1_table(void) · 60 unmodified lines
28812881
28822882 pr_debug("np = %d, npg = %lld, psz = %d, epp = %d, esz = %d\n",
28832883 np, npg, psz, epp, esz);
2884− page = alloc_pages(GFP_KERNEL | __GFP_ZERO, get_order(np * PAGE_SIZE));
2884+ page = alloc_pages(GFP_ATOMIC | __GFP_ZERO, get_order(np * PAGE_SIZE));
28852885 if (!page)
28862886 return -ENOMEM;
28872887
@@ -4090,18 +4090,22 @@ static void its_vpe_4_1_deschedule(struct its_vpe *vpe, · 1202 unmodified lines
40904090 static void its_vpe_4_1_invall(struct its_vpe *vpe)
40914091 {
40924092 void __iomem *rdbase;
4093+ unsigned long flags;
40934094 u64 val;
4095+ int cpu;
40944096
40954097 val = GICR_INVALLR_V;
40964098 val |= FIELD_PREP(GICR_INVALLR_VPEID, vpe->vpe_id);
40974099
40984100 /* Target the redistributor this vPE is currently known on */
4099− raw_spin_lock(&gic_data_rdist_cpu(vpe->col_idx)->rd_lock);
4100− rdbase = per_cpu_ptr(gic_rdists->rdist, vpe->col_idx)->rd_base;
4101+ cpu = vpe_to_cpuid_lock(vpe, &flags);
4102+ raw_spin_lock(&gic_data_rdist_cpu(cpu)->rd_lock);
4103+ rdbase = per_cpu_ptr(gic_rdists->rdist, cpu)->rd_base;
41014104 gic_write_lpir(val, rdbase + GICR_INVALLR);
41024105
41034106 wait_for_syncr(rdbase);
4104− raw_spin_unlock(&gic_data_rdist_cpu(vpe->col_idx)->rd_lock);
4107+ raw_spin_unlock(&gic_data_rdist_cpu(cpu)->rd_lock);
4108+ vpe_to_cpuid_unlock(vpe, flags);
41054109 }
41064110
41074111 static int its_vpe_4_1_set_vcpu_affinity(struct irq_data *d, void *vcpu_info)
drivers/irqchip/irq-gic-v3.c+1−1
@@ -2116,7 +2116,7 @@ static void __init gic_acpi_setup_kvm_info(void) · 2115 unmodified lines
21162116 }
21172117
21182118 static int __init
2119−gic_acpi_init(struct acpi_subtable_header *header, const unsigned long end)
2119+gic_acpi_init(union acpi_subtable_headers *header, const unsigned long end)
21202120 {
21212121 struct acpi_madt_generic_distributor *dist;
21222122 struct fwnode_handle *domain_handle;
drivers/irqchip/irq-gic.c+1−1
@@ -1584,7 +1584,7 @@ static void __init gic_acpi_setup_kvm_info(void) · 1583 unmodified lines
15841584 gic_set_kvm_info(&gic_v2_kvm_info);
15851585 }
15861586
1587−static int __init gic_v2_acpi_init(struct acpi_subtable_header *header,
1587+static int __init gic_v2_acpi_init(union acpi_subtable_headers *header,
15881588 const unsigned long end)
15891589 {
15901590 struct acpi_madt_generic_distributor *dist;
drivers/irqchip/irq-imx-intmux.c+66−4
@@ -53,6 +53,7 @@ · 52 unmodified lines
5353 #include <linux/of_irq.h>
5454 #include <linux/of_platform.h>
5555 #include <linux/spinlock.h>
56+#include <linux/pm_runtime.h>
5657
5758 #define CHANIER(n) (0x10 + (0x40 * n))
5859 #define CHANIPR(n) (0x20 + (0x40 * n))
@@ -60,6 +61,8 @@ · 1 unmodified line
6061 #define CHAN_MAX_NUM 0x8
6162
6263 struct intmux_irqchip_data {
64+ struct irq_chip chip;
65+ u32 saved_reg;
6366 int chanidx;
6467 int irq;
6568 struct irq_domain *domain;
@@ -120,8 +123,10 @@ static struct irq_chip imx_intmux_irq_chip = { · 54 unmodified lines
120123 static int imx_intmux_irq_map(struct irq_domain *h, unsigned int irq,
121124 irq_hw_number_t hwirq)
122125 {
123− irq_set_chip_data(irq, h->host_data);
124− irq_set_chip_and_handler(irq, &imx_intmux_irq_chip, handle_level_irq);
126+ struct intmux_irqchip_data *data = h->host_data;
127+
128+ irq_set_chip_data(irq, data);
129+ irq_set_chip_and_handler(irq, &data->chip, handle_level_irq);
125130
126131 return 0;
127132 }
@@ -210,8 +215,7 @@ static int imx_intmux_probe(struct platform_device *pdev) · 82 unmodified lines
210215 return -EINVAL;
211216 }
212217
213− data = devm_kzalloc(&pdev->dev, sizeof(*data) +
214− channum * sizeof(data->irqchip_data[0]), GFP_KERNEL);
218+ data = devm_kzalloc(&pdev->dev, struct_size(data, irqchip_data, channum), GFP_KERNEL);
215219 if (!data)
216220 return -ENOMEM;
217221
@@ -232,6 +236,10 @@ static int imx_intmux_probe(struct platform_device *pdev) · 14 unmodified lines
232236 data->channum = channum;
233237 raw_spin_lock_init(&data->lock);
234238
239+ pm_runtime_get_noresume(&pdev->dev);
240+ pm_runtime_set_active(&pdev->dev);
241+ pm_runtime_enable(&pdev->dev);
242+
235243 ret = clk_prepare_enable(data->ipg_clk);
236244 if (ret) {
237245 dev_err(&pdev->dev, "failed to enable ipg clk: %d\n", ret);
@@ -239,6 +247,8 @@ static int imx_intmux_probe(struct platform_device *pdev) · 1 unmodified line
239247 }
240248
241249 for (i = 0; i < channum; i++) {
250+ data->irqchip_data[i].chip = imx_intmux_irq_chip;
251+ data->irqchip_data[i].chip.parent_device = &pdev->dev;
242252 data->irqchip_data[i].chanidx = i;
243253
244254 data->irqchip_data[i].irq = irq_of_parse_and_map(np, i);
@@ -267,6 +277,12 @@ static int imx_intmux_probe(struct platform_device *pdev) · 22 unmodified lines
267277
268278 platform_set_drvdata(pdev, data);
269279
280+ /*
281+ * Let pm_runtime_put() disable clock.
282+ * If CONFIG_PM is not enabled, the clock will stay powered.
283+ */
284+ pm_runtime_put(&pdev->dev);
285+
270286 return 0;
271287 out:
272288 clk_disable_unprepare(data->ipg_clk);
@@ -288,11 +304,56 @@ static int imx_intmux_remove(struct platform_device *pdev) · 15 unmodified lines
288304 irq_domain_remove(data->irqchip_data[i].domain);
289305 }
290306
307+ pm_runtime_disable(&pdev->dev);
308+
309+ return 0;
310+}
311+
312+#ifdef CONFIG_PM
313+static int imx_intmux_runtime_suspend(struct device *dev)
314+{
315+ struct intmux_data *data = dev_get_drvdata(dev);
316+ struct intmux_irqchip_data *irqchip_data;
317+ int i;
318+
319+ for (i = 0; i < data->channum; i++) {
320+ irqchip_data = &data->irqchip_data[i];
321+ irqchip_data->saved_reg = readl_relaxed(data->regs + CHANIER(i));
322+ }
323+
291324 clk_disable_unprepare(data->ipg_clk);
292325
293326 return 0;
294327 }
295328
329+static int imx_intmux_runtime_resume(struct device *dev)
330+{
331+ struct intmux_data *data = dev_get_drvdata(dev);
332+ struct intmux_irqchip_data *irqchip_data;
333+ int ret, i;
334+
335+ ret = clk_prepare_enable(data->ipg_clk);
336+ if (ret) {
337+ dev_err(dev, "failed to enable ipg clk: %d\n", ret);
338+ return ret;
339+ }
340+
341+ for (i = 0; i < data->channum; i++) {
342+ irqchip_data = &data->irqchip_data[i];
343+ writel_relaxed(irqchip_data->saved_reg, data->regs + CHANIER(i));
344+ }
345+
346+ return 0;
347+}
348+#endif
349+
350+static const struct dev_pm_ops imx_intmux_pm_ops = {
351+ SET_NOIRQ_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend,
352+ pm_runtime_force_resume)
353+ SET_RUNTIME_PM_OPS(imx_intmux_runtime_suspend,
354+ imx_intmux_runtime_resume, NULL)
355+};
356+
296357 static const struct of_device_id imx_intmux_id[] = {
297358 { .compatible = "fsl,imx-intmux", },
298359 { /* sentinel */ },
@@ -302,6 +363,7 @@ static struct platform_driver imx_intmux_driver = { · 3 unmodified lines
302363 .driver = {
303364 .name = "imx-intmux",
304365 .of_match_table = imx_intmux_id,
366+ .pm = &imx_intmux_pm_ops,
305367 },
306368 .probe = imx_intmux_probe,
307369 .remove = imx_intmux_remove,
drivers/irqchip/irq-loongson-htpic.c+2−4
@@ -93,10 +93,8 @@ int __init htpic_of_init(struct device_node *node, struct device_node *parent) · 92 unmodified lines
9393 }
9494
9595 htpic = kzalloc(sizeof(*htpic), GFP_KERNEL);
96− if (!htpic) {
97− err = -ENOMEM;
98− goto out_free;
99− }
96+ if (!htpic)
97+ return -ENOMEM;
10098
10199 htpic->base = of_iomap(node, 0);
102100 if (!htpic->base) {
drivers/irqchip/irq-loongson-htvec.c+18−14
@@ -19,15 +19,14 @@ · 18 unmodified lines
1919
2020 /* Registers */
2121 #define HTVEC_EN_OFF 0x20
22−#define HTVEC_MAX_PARENT_IRQ 4
22+#define HTVEC_MAX_PARENT_IRQ 8
2323
2424 #define VEC_COUNT_PER_REG 32
25−#define VEC_REG_COUNT 4
26−#define VEC_COUNT (VEC_COUNT_PER_REG * VEC_REG_COUNT)
2725 #define VEC_REG_IDX(irq_id) ((irq_id) / VEC_COUNT_PER_REG)
2826 #define VEC_REG_BIT(irq_id) ((irq_id) % VEC_COUNT_PER_REG)
2927
3028 struct htvec {
29+ int num_parents;
3130 void __iomem *base;
3231 struct irq_domain *htvec_domain;
3332 raw_spinlock_t htvec_lock;
@@ -43,7 +42,7 @@ static void htvec_irq_dispatch(struct irq_desc *desc) · 9 unmodified lines
4342
4443 chained_irq_enter(chip, desc);
4544
46− for (i = 0; i < VEC_REG_COUNT; i++) {
45+ for (i = 0; i < priv->num_parents; i++) {
4746 pending = readl(priv->base + 4 * i);
4847 while (pending) {
4948 int bit = __ffs(pending);
@@ -109,11 +108,14 @@ static struct irq_chip htvec_irq_chip = { · 59 unmodified lines
109108 static int htvec_domain_alloc(struct irq_domain *domain, unsigned int virq,
110109 unsigned int nr_irqs, void *arg)
111110 {
111+ int ret;
112112 unsigned long hwirq;
113113 unsigned int type, i;
114114 struct htvec *priv = domain->host_data;
115115
116− irq_domain_translate_onecell(domain, arg, &hwirq, &type);
116+ ret = irq_domain_translate_onecell(domain, arg, &hwirq, &type);
117+ if (ret)
118+ return ret;
117119
118120 for (i = 0; i < nr_irqs; i++) {
119121 irq_domain_set_info(domain, virq + i, hwirq + i, &htvec_irq_chip,
@@ -147,7 +149,7 @@ static void htvec_reset(struct htvec *priv) · 27 unmodified lines
147149 u32 idx;
148150
149151 /* Clear IRQ cause registers, mask all interrupts */
150− for (idx = 0; idx < VEC_REG_COUNT; idx++) {
152+ for (idx = 0; idx < priv->num_parents; idx++) {
151153 writel_relaxed(0x0, priv->base + HTVEC_EN_OFF + 4 * idx);
152154 writel_relaxed(0xFFFFFFFF, priv->base);
153155 }
@@ -157,7 +159,7 @@ static int htvec_of_init(struct device_node *node, · 3 unmodified lines
157159 struct device_node *parent)
158160 {
159161 struct htvec *priv;
160− int err, parent_irq[4], num_parents = 0, i;
162+ int err, parent_irq[8], i;
161163
162164 priv = kzalloc(sizeof(*priv), GFP_KERNEL);
163165 if (!priv)
@@ -176,33 +178,35 @@ static int htvec_of_init(struct device_node *node, · 12 unmodified lines
176178 if (parent_irq[i] <= 0)
177179 break;
178180
179− num_parents++;
181+ priv->num_parents++;
180182 }
181183
182− if (!num_parents) {
184+ if (!priv->num_parents) {
183185 pr_err("Failed to get parent irqs\n");
184186 err = -ENODEV;
185187 goto iounmap_base;
186188 }
187189
188190 priv->htvec_domain = irq_domain_create_linear(of_node_to_fwnode(node),
189− VEC_COUNT,
190− &htvec_domain_ops,
191− priv);
191+ (VEC_COUNT_PER_REG * priv->num_parents),
192+ &htvec_domain_ops, priv);
192193 if (!priv->htvec_domain) {
193194 pr_err("Failed to create IRQ domain\n");
194195 err = -ENOMEM;
195− goto iounmap_base;
196+ goto irq_dispose;
196197 }
197198
198199 htvec_reset(priv);
199200
200− for (i = 0; i < num_parents; i++)
201+ for (i = 0; i < priv->num_parents; i++)
201202 irq_set_chained_handler_and_data(parent_irq[i],
202203 htvec_irq_dispatch, priv);
203204
204205 return 0;
205206
207+irq_dispose:
208+ for (; i > 0; i--)
209+ irq_dispose_mapping(parent_irq[i - 1]);
206210 iounmap_base:
207211 iounmap(priv->base);
208212 free_priv:
drivers/irqchip/irq-loongson-liointc.c+6−5
@@ -60,7 +60,7 @@ static void liointc_chained_handle_irq(struct irq_desc *desc) · 59 unmodified lines
6060 if (!pending) {
6161 /* Always blame LPC IRQ if we have that bug */
6262 if (handler->priv->has_lpc_irq_errata &&
63− (handler->parent_int_map & ~gc->mask_cache &
63+ (handler->parent_int_map & gc->mask_cache &
6464 BIT(LIOINTC_ERRATA_IRQ)))
6565 pending = BIT(LIOINTC_ERRATA_IRQ);
6666 else
@@ -114,6 +114,7 @@ static int liointc_set_type(struct irq_data *data, unsigned int type) · 47 unmodified lines
114114 liointc_set_bit(gc, LIOINTC_REG_INTC_POL, mask, false);
115115 break;
116116 default:
117+ irq_gc_unlock_irqrestore(gc, flags);
117118 return -EINVAL;
118119 }
119120 irq_gc_unlock_irqrestore(gc, flags);
@@ -131,11 +132,11 @@ static void liointc_resume(struct irq_chip_generic *gc) · 11 unmodified lines
131132 irq_gc_lock_irqsave(gc, flags);
132133 /* Disable all at first */
133134 writel(0xffffffff, gc->reg_base + LIOINTC_REG_INTC_DISABLE);
134− /* Revert map cache */
135+ /* Restore map cache */
135136 for (i = 0; i < LIOINTC_CHIP_IRQ; i++)
136137 writeb(priv->map_cache[i], gc->reg_base + i);
137− /* Revert mask cache */
138− writel(~gc->mask_cache, gc->reg_base + LIOINTC_REG_INTC_ENABLE);
138+ /* Restore mask cache */
139+ writel(gc->mask_cache, gc->reg_base + LIOINTC_REG_INTC_ENABLE);
139140 irq_gc_unlock_irqrestore(gc, flags);
140141 }
141142
@@ -243,7 +244,7 @@ int __init liointc_of_init(struct device_node *node, · 101 unmodified lines
243244 ct->chip.irq_mask_ack = irq_gc_mask_disable_reg;
244245 ct->chip.irq_set_type = liointc_set_type;
245246
246− gc->mask_cache = 0xffffffff;
247+ gc->mask_cache = 0;
247248 priv->gc = gc;
248249
249250 for (i = 0; i < LIOINTC_NUM_PARENT; i++) {
drivers/irqchip/irq-loongson-pch-msi.c+1−6
@@ -100,17 +100,12 @@ static int pch_msi_parent_domain_alloc(struct irq_domain *domain, · 99 unmodified lines
100100 unsigned int virq, int hwirq)
101101 {
102102 struct irq_fwspec fwspec;
103− int ret;
104103
105104 fwspec.fwnode = domain->parent->fwnode;
106105 fwspec.param_count = 1;
107106 fwspec.param[0] = hwirq;
108107
109− ret = irq_domain_alloc_irqs_parent(domain, virq, 1, &fwspec);
110− if (ret)
111− return ret;
112−
113− return 0;
108+ return irq_domain_alloc_irqs_parent(domain, virq, 1, &fwspec);
114109 }
115110
116111 static int pch_msi_middle_domain_alloc(struct irq_domain *domain,
drivers/irqchip/irq-loongson-pch-pic.c+13−17
@@ -64,15 +64,6 @@ static void pch_pic_bitclr(struct pch_pic *priv, int offset, int bit) · 63 unmodified lines
6464 raw_spin_unlock(&priv->pic_lock);
6565 }
6666
67−static void pch_pic_eoi_irq(struct irq_data *d)
68−{
69− u32 idx = PIC_REG_IDX(d->hwirq);
70− struct pch_pic *priv = irq_data_get_irq_chip_data(d);
71−
72− writel(BIT(PIC_REG_BIT(d->hwirq)),
73− priv->base + PCH_PIC_CLR + idx * 4);
74−}
75−
7667 static void pch_pic_mask_irq(struct irq_data *d)
7768 {
7869 struct pch_pic *priv = irq_data_get_irq_chip_data(d);
@@ -85,6 +76,9 @@ static void pch_pic_unmask_irq(struct irq_data *d) · 6 unmodified lines
8576 {
8677 struct pch_pic *priv = irq_data_get_irq_chip_data(d);
8778
79+ writel(BIT(PIC_REG_BIT(d->hwirq)),
80+ priv->base + PCH_PIC_CLR + PIC_REG_IDX(d->hwirq) * 4);
81+
8882 irq_chip_unmask_parent(d);
8983 pch_pic_bitclr(priv, PCH_PIC_MASK, d->hwirq);
9084 }
@@ -124,7 +118,6 @@ static struct irq_chip pch_pic_irq_chip = { · 33 unmodified lines
124118 .irq_mask = pch_pic_mask_irq,
125119 .irq_unmask = pch_pic_unmask_irq,
126120 .irq_ack = irq_chip_ack_parent,
127− .irq_eoi = pch_pic_eoi_irq,
128121 .irq_set_affinity = irq_chip_set_affinity_parent,
129122 .irq_set_type = pch_pic_set_type,
130123 };
@@ -135,22 +128,25 @@ static int pch_pic_alloc(struct irq_domain *domain, unsigned int virq, · 4 unmodified lines
135128 int err;
136129 unsigned int type;
137130 unsigned long hwirq;
138− struct irq_fwspec fwspec;
131+ struct irq_fwspec *fwspec = arg;
132+ struct irq_fwspec parent_fwspec;
139133 struct pch_pic *priv = domain->host_data;
140134
141− irq_domain_translate_twocell(domain, arg, &hwirq, &type);
135+ err = irq_domain_translate_twocell(domain, fwspec, &hwirq, &type);
136+ if (err)
137+ return err;
142138
143− fwspec.fwnode = domain->parent->fwnode;
144− fwspec.param_count = 1;
145− fwspec.param[0] = hwirq + priv->ht_vec_base;
139+ parent_fwspec.fwnode = domain->parent->fwnode;
140+ parent_fwspec.param_count = 1;
141+ parent_fwspec.param[0] = hwirq + priv->ht_vec_base;
146142
147− err = irq_domain_alloc_irqs_parent(domain, virq, 1, &fwspec);
143+ err = irq_domain_alloc_irqs_parent(domain, virq, 1, &parent_fwspec);
148144 if (err)
149145 return err;
150146
151147 irq_domain_set_info(domain, virq, hwirq,
152148 &pch_pic_irq_chip, priv,
153− handle_fasteoi_ack_irq, NULL, NULL);
149+ handle_level_irq, NULL, NULL);
154150 irq_set_probe(virq);
155151
156152 return 0;
drivers/irqchip/irq-mips-gic.c+5−5
@@ -46,7 +46,7 @@ · 45 unmodified lines
4646
4747 void __iomem *mips_gic_base;
4848
49−DEFINE_PER_CPU_READ_MOSTLY(unsigned long[GIC_MAX_LONGS], pcpu_masks);
49+static DEFINE_PER_CPU_READ_MOSTLY(unsigned long[GIC_MAX_LONGS], pcpu_masks);
5050
5151 static DEFINE_SPINLOCK(gic_lock);
5252 static struct irq_domain *gic_irq_domain;
@@ -617,8 +617,8 @@ error: · 564 unmodified lines
617617 return ret;
618618 }
619619
620−void gic_ipi_domain_free(struct irq_domain *d, unsigned int virq,
621− unsigned int nr_irqs)
620+static void gic_ipi_domain_free(struct irq_domain *d, unsigned int virq,
621+ unsigned int nr_irqs)
622622 {
623623 irq_hw_number_t base_hwirq;
624624 struct irq_data *data;
@@ -631,8 +631,8 @@ void gic_ipi_domain_free(struct irq_domain *d, unsigned int virq, · 6 unmodified lines
631631 bitmap_set(ipi_available, base_hwirq, nr_irqs);
632632 }
633633
634−int gic_ipi_domain_match(struct irq_domain *d, struct device_node *node,
635− enum irq_domain_bus_token bus_token)
634+static int gic_ipi_domain_match(struct irq_domain *d, struct device_node *node,
635+ enum irq_domain_bus_token bus_token)
636636 {
637637 bool is_ipi;
638638
drivers/irqchip/irq-mtk-cirq.c+3−1
@@ -295,4 +295,6 @@ out_free: · 294 unmodified lines
295295 return ret;
296296 }
297297
298−IRQCHIP_DECLARE(mtk_cirq, "mediatek,mtk-cirq", mtk_cirq_of_init);
298+IRQCHIP_PLATFORM_DRIVER_BEGIN(mtk_cirq)
299+IRQCHIP_MATCH("mediatek,mtk-cirq", mtk_cirq_of_init)
300+IRQCHIP_PLATFORM_DRIVER_END(mtk_cirq)
drivers/irqchip/irq-mtk-sysirq.c+7−5
@@ -15,7 +15,7 @@ · 14 unmodified lines
1515 #include <linux/spinlock.h>
1616
1717 struct mtk_sysirq_chip_data {
18− spinlock_t lock;
18+ raw_spinlock_t lock;
1919 u32 nr_intpol_bases;
2020 void __iomem **intpol_bases;
2121 u32 *intpol_words;
@@ -37,7 +37,7 @@ static int mtk_sysirq_set_type(struct irq_data *data, unsigned int type) · 15 unmodified lines
3737 reg_index = chip_data->which_word[hwirq];
3838 offset = hwirq & 0x1f;
3939
40− spin_lock_irqsave(&chip_data->lock, flags);
40+ raw_spin_lock_irqsave(&chip_data->lock, flags);
4141 value = readl_relaxed(base + reg_index * 4);
4242 if (type == IRQ_TYPE_LEVEL_LOW || type == IRQ_TYPE_EDGE_FALLING) {
4343 if (type == IRQ_TYPE_LEVEL_LOW)
@@ -53,7 +53,7 @@ static int mtk_sysirq_set_type(struct irq_data *data, unsigned int type) · 9 unmodified lines
5353
5454 data = data->parent_data;
5555 ret = data->chip->irq_set_type(data, type);
56− spin_unlock_irqrestore(&chip_data->lock, flags);
56+ raw_spin_unlock_irqrestore(&chip_data->lock, flags);
5757 return ret;
5858 }
5959
@@ -212,7 +212,7 @@ static int __init mtk_sysirq_of_init(struct device_node *node, · 152 unmodified lines
212212 ret = -ENOMEM;
213213 goto out_free_which_word;
214214 }
215− spin_lock_init(&chip_data->lock);
215+ raw_spin_lock_init(&chip_data->lock);
216216
217217 return 0;
218218
@@ -231,4 +231,6 @@ out_free_chip: · 12 unmodified lines
231231 kfree(chip_data);
232232 return ret;
233233 }
234−IRQCHIP_DECLARE(mtk_sysirq, "mediatek,mt6577-sysirq", mtk_sysirq_of_init);
234+IRQCHIP_PLATFORM_DRIVER_BEGIN(mtk_sysirq)
235+IRQCHIP_MATCH("mediatek,mt6577-sysirq", mtk_sysirq_of_init)
236+IRQCHIP_PLATFORM_DRIVER_END(mtk_sysirq)
drivers/irqchip/irq-stm32-exti.c+87−79
@@ -25,7 +25,6 @@ · 24 unmodified lines
2525 #define IRQS_PER_BANK 32
2626
2727 #define HWSPNLCK_TIMEOUT 1000 /* usec */
28−#define HWSPNLCK_RETRY_DELAY 100 /* usec */
2928
3029 struct stm32_exti_bank {
3130 u32 imr_ofst;
@@ -42,6 +41,7 @@ struct stm32_exti_bank { · 10 unmodified lines
4241 struct stm32_desc_irq {
4342 u32 exti;
4443 u32 irq_parent;
44+ struct irq_chip *chip;
4545 };
4646
4747 struct stm32_exti_drv_data {
@@ -166,27 +166,41 @@ static const struct stm32_exti_bank *stm32mp1_exti_banks[] = { · 118 unmodified lines
166166 &stm32mp1_exti_b3,
167167 };
168168
169+static struct irq_chip stm32_exti_h_chip;
170+static struct irq_chip stm32_exti_h_chip_direct;
171+
169172 static const struct stm32_desc_irq stm32mp1_desc_irq[] = {
170− { .exti = 0, .irq_parent = 6 },
171− { .exti = 1, .irq_parent = 7 },
172− { .exti = 2, .irq_parent = 8 },
173− { .exti = 3, .irq_parent = 9 },
174− { .exti = 4, .irq_parent = 10 },
175− { .exti = 5, .irq_parent = 23 },
176− { .exti = 6, .irq_parent = 64 },
177− { .exti = 7, .irq_parent = 65 },
178− { .exti = 8, .irq_parent = 66 },
179− { .exti = 9, .irq_parent = 67 },
180− { .exti = 10, .irq_parent = 40 },
181− { .exti = 11, .irq_parent = 42 },
182− { .exti = 12, .irq_parent = 76 },
183− { .exti = 13, .irq_parent = 77 },
184− { .exti = 14, .irq_parent = 121 },
185− { .exti = 15, .irq_parent = 127 },
186− { .exti = 16, .irq_parent = 1 },
187− { .exti = 65, .irq_parent = 144 },
188− { .exti = 68, .irq_parent = 143 },
189− { .exti = 73, .irq_parent = 129 },
173+ { .exti = 0, .irq_parent = 6, .chip = &stm32_exti_h_chip },
174+ { .exti = 1, .irq_parent = 7, .chip = &stm32_exti_h_chip },
175+ { .exti = 2, .irq_parent = 8, .chip = &stm32_exti_h_chip },
176+ { .exti = 3, .irq_parent = 9, .chip = &stm32_exti_h_chip },
177+ { .exti = 4, .irq_parent = 10, .chip = &stm32_exti_h_chip },
178+ { .exti = 5, .irq_parent = 23, .chip = &stm32_exti_h_chip },
179+ { .exti = 6, .irq_parent = 64, .chip = &stm32_exti_h_chip },
180+ { .exti = 7, .irq_parent = 65, .chip = &stm32_exti_h_chip },
181+ { .exti = 8, .irq_parent = 66, .chip = &stm32_exti_h_chip },
182+ { .exti = 9, .irq_parent = 67, .chip = &stm32_exti_h_chip },
183+ { .exti = 10, .irq_parent = 40, .chip = &stm32_exti_h_chip },
184+ { .exti = 11, .irq_parent = 42, .chip = &stm32_exti_h_chip },
185+ { .exti = 12, .irq_parent = 76, .chip = &stm32_exti_h_chip },
186+ { .exti = 13, .irq_parent = 77, .chip = &stm32_exti_h_chip },
187+ { .exti = 14, .irq_parent = 121, .chip = &stm32_exti_h_chip },
188+ { .exti = 15, .irq_parent = 127, .chip = &stm32_exti_h_chip },
189+ { .exti = 16, .irq_parent = 1, .chip = &stm32_exti_h_chip },
190+ { .exti = 19, .irq_parent = 3, .chip = &stm32_exti_h_chip_direct },
191+ { .exti = 21, .irq_parent = 31, .chip = &stm32_exti_h_chip_direct },
192+ { .exti = 22, .irq_parent = 33, .chip = &stm32_exti_h_chip_direct },
193+ { .exti = 23, .irq_parent = 72, .chip = &stm32_exti_h_chip_direct },
194+ { .exti = 24, .irq_parent = 95, .chip = &stm32_exti_h_chip_direct },
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 },
201+ { .exti = 68, .irq_parent = 143, .chip = &stm32_exti_h_chip },
202+ { .exti = 70, .irq_parent = 62, .chip = &stm32_exti_h_chip_direct },
203+ { .exti = 73, .irq_parent = 129, .chip = &stm32_exti_h_chip },
190204 };
191205
192206 static const struct stm32_exti_drv_data stm32mp1_drv_data = {
@@ -196,22 +210,23 @@ static const struct stm32_exti_drv_data stm32mp1_drv_data = { · 3 unmodified lines
196210 .irq_nr = ARRAY_SIZE(stm32mp1_desc_irq),
197211 };
198212
199−static int stm32_exti_to_irq(const struct stm32_exti_drv_data *drv_data,
200− irq_hw_number_t hwirq)
213+static const struct
214+stm32_desc_irq *stm32_exti_get_desc(const struct stm32_exti_drv_data *drv_data,
215+ irq_hw_number_t hwirq)
201216 {
202− const struct stm32_desc_irq *desc_irq;
217+ const struct stm32_desc_irq *desc = NULL;
203218 int i;
204219
205220 if (!drv_data->desc_irqs)
206− return -EINVAL;
221+ return NULL;
207222
208223 for (i = 0; i < drv_data->irq_nr; i++) {
209− desc_irq = &drv_data->desc_irqs[i];
210− if (desc_irq->exti == hwirq)
211− return desc_irq->irq_parent;
224+ desc = &drv_data->desc_irqs[i];
225+ if (desc->exti == hwirq)
226+ break;
212227 }
213228
214− return -EINVAL;
229+ return desc;
215230 }
216231
217232 static unsigned long stm32_exti_pending(struct irq_chip_generic *gc)
@@ -277,55 +292,24 @@ static int stm32_exti_set_type(struct irq_data *d, · 59 unmodified lines
277292 return 0;
278293 }
279294
280−static int stm32_exti_hwspin_lock(struct stm32_exti_chip_data *chip_data)
281−{
282− int ret, timeout = 0;
283−
284− if (!chip_data->host_data->hwlock)
285− return 0;
286−
287− /*
288− * Use the x_raw API since we are under spin_lock protection.
289− * Do not use the x_timeout API because we are under irq_disable
290− * mode (see __setup_irq())
291− */
292− do {
293− ret = hwspin_trylock_raw(chip_data->host_data->hwlock);
294− if (!ret)
295− return 0;
296−
297− udelay(HWSPNLCK_RETRY_DELAY);
298− timeout += HWSPNLCK_RETRY_DELAY;
299− } while (timeout < HWSPNLCK_TIMEOUT);
300−
301− if (ret == -EBUSY)
302− ret = -ETIMEDOUT;
303−
304− if (ret)
305− pr_err("%s can't get hwspinlock (%d)\n", __func__, ret);
306−
307− return ret;
308−}
309−
310−static void stm32_exti_hwspin_unlock(struct stm32_exti_chip_data *chip_data)
311−{
312− if (chip_data->host_data->hwlock)
313− hwspin_unlock_raw(chip_data->host_data->hwlock);
314−}
315−
316295 static int stm32_irq_set_type(struct irq_data *d, unsigned int type)
317296 {
318297 struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d);
319298 struct stm32_exti_chip_data *chip_data = gc->private;
320299 const struct stm32_exti_bank *stm32_bank = chip_data->reg_bank;
300+ struct hwspinlock *hwlock = chip_data->host_data->hwlock;
321301 u32 rtsr, ftsr;
322302 int err;
323303
324304 irq_gc_lock(gc);
325305
326− err = stm32_exti_hwspin_lock(chip_data);
327− if (err)
328− goto unlock;
306+ if (hwlock) {
307+ err = hwspin_lock_timeout_in_atomic(hwlock, HWSPNLCK_TIMEOUT);
308+ if (err) {
309+ pr_err("%s can't get hwspinlock (%d)\n", __func__, err);
310+ goto unlock;
311+ }
312+ }
329313
330314 rtsr = irq_reg_readl(gc, stm32_bank->rtsr_ofst);
331315 ftsr = irq_reg_readl(gc, stm32_bank->ftsr_ofst);
@@ -338,7 +322,8 @@ static int stm32_irq_set_type(struct irq_data *d, unsigned int type) · 6 unmodified lines
338322 irq_reg_writel(gc, ftsr, stm32_bank->ftsr_ofst);
339323
340324 unspinlock:
341− stm32_exti_hwspin_unlock(chip_data);
325+ if (hwlock)
326+ hwspin_unlock_in_atomic(hwlock);
342327 unlock:
343328 irq_gc_unlock(gc);
344329
@@ -504,15 +489,20 @@ static int stm32_exti_h_set_type(struct irq_data *d, unsigned int type) · 159 unmodified lines
504489 {
505490 struct stm32_exti_chip_data *chip_data = irq_data_get_irq_chip_data(d);
506491 const struct stm32_exti_bank *stm32_bank = chip_data->reg_bank;
492+ struct hwspinlock *hwlock = chip_data->host_data->hwlock;
507493 void __iomem *base = chip_data->host_data->base;
508494 u32 rtsr, ftsr;
509495 int err;
510496
511497 raw_spin_lock(&chip_data->rlock);
512498
513− err = stm32_exti_hwspin_lock(chip_data);
514− if (err)
515− goto unlock;
499+ if (hwlock) {
500+ err = hwspin_lock_timeout_in_atomic(hwlock, HWSPNLCK_TIMEOUT);
501+ if (err) {
502+ pr_err("%s can't get hwspinlock (%d)\n", __func__, err);
503+ goto unlock;
504+ }
505+ }
516506
517507 rtsr = readl_relaxed(base + stm32_bank->rtsr_ofst);
518508 ftsr = readl_relaxed(base + stm32_bank->ftsr_ofst);
@@ -525,7 +515,8 @@ static int stm32_exti_h_set_type(struct irq_data *d, unsigned int type) · 6 unmodified lines
525515 writel_relaxed(ftsr, base + stm32_bank->ftsr_ofst);
526516
527517 unspinlock:
528− stm32_exti_hwspin_unlock(chip_data);
518+ if (hwlock)
519+ hwspin_unlock_in_atomic(hwlock);
529520 unlock:
530521 raw_spin_unlock(&chip_data->rlock);
531522
@@ -628,30 +619,47 @@ static struct irq_chip stm32_exti_h_chip = { · 96 unmodified lines
628619 .irq_set_affinity = IS_ENABLED(CONFIG_SMP) ? stm32_exti_h_set_affinity : NULL,
629620 };
630621
622+static struct irq_chip stm32_exti_h_chip_direct = {
623+ .name = "stm32-exti-h-direct",
624+ .irq_eoi = irq_chip_eoi_parent,
625+ .irq_ack = irq_chip_ack_parent,
626+ .irq_mask = irq_chip_mask_parent,
627+ .irq_unmask = irq_chip_unmask_parent,
628+ .irq_retrigger = irq_chip_retrigger_hierarchy,
629+ .irq_set_type = irq_chip_set_type_parent,
630+ .irq_set_wake = stm32_exti_h_set_wake,
631+ .flags = IRQCHIP_MASK_ON_SUSPEND,
632+ .irq_set_affinity = IS_ENABLED(CONFIG_SMP) ? irq_chip_set_affinity_parent : NULL,
633+};
634+
631635 static int stm32_exti_h_domain_alloc(struct irq_domain *dm,
632636 unsigned int virq,
633637 unsigned int nr_irqs, void *data)
634638 {
635639 struct stm32_exti_host_data *host_data = dm->host_data;
636640 struct stm32_exti_chip_data *chip_data;
641+ const struct stm32_desc_irq *desc;
637642 struct irq_fwspec *fwspec = data;
638643 struct irq_fwspec p_fwspec;
639644 irq_hw_number_t hwirq;
640− int p_irq, bank;
645+ int bank;
641646
642647 hwirq = fwspec->param[0];
643648 bank = hwirq / IRQS_PER_BANK;
644649 chip_data = &host_data->chips_data[bank];
645650
646− irq_domain_set_hwirq_and_chip(dm, virq, hwirq,
647− &stm32_exti_h_chip, chip_data);
648651
649− p_irq = stm32_exti_to_irq(host_data->drv_data, hwirq);
650− if (p_irq >= 0) {
652+ desc = stm32_exti_get_desc(host_data->drv_data, hwirq);
653+ if (!desc)
654+ return -EINVAL;
655+
656+ irq_domain_set_hwirq_and_chip(dm, virq, hwirq, desc->chip,
657+ chip_data);
658+ if (desc->irq_parent) {
651659 p_fwspec.fwnode = dm->parent->fwnode;
652660 p_fwspec.param_count = 3;
653661 p_fwspec.param[0] = GIC_SPI;
654− p_fwspec.param[1] = p_irq;
662+ p_fwspec.param[1] = desc->irq_parent;
655663 p_fwspec.param[2] = IRQ_TYPE_LEVEL_HIGH;
656664
657665 return irq_domain_alloc_irqs_parent(dm, virq, 1, &p_fwspec);
drivers/irqchip/irq-ti-sci-inta.c+2−4
@@ -433,8 +433,6 @@ static int ti_sci_inta_set_type(struct irq_data *data, unsigned int type) · 432 unmodified lines
433433 default:
434434 return -EINVAL;
435435 }
436−
437− return -EINVAL;
438436 }
439437
440438 static struct irq_chip ti_sci_inta_irq_chip = {
@@ -572,7 +570,7 @@ static int ti_sci_inta_irq_domain_probe(struct platform_device *pdev) · 131 unmodified lines
572570 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
573571 inta->base = devm_ioremap_resource(dev, res);
574572 if (IS_ERR(inta->base))
575− return -ENODEV;
573+ return PTR_ERR(inta->base);
576574
577575 domain = irq_domain_add_linear(dev_of_node(dev),
578576 ti_sci_get_num_resources(inta->vint),
@@ -612,6 +610,6 @@ static struct platform_driver ti_sci_inta_irq_domain_driver = { · 33 unmodified lines
612610 };
613611 module_platform_driver(ti_sci_inta_irq_domain_driver);
614612
615−MODULE_AUTHOR("Lokesh Vutla <lokeshvutla@ticom>");
613+MODULE_AUTHOR("Lokesh Vutla <lokeshvutla@ti.com>");
616614 MODULE_DESCRIPTION("K3 Interrupt Aggregator driver over TI SCI protocol");
617615 MODULE_LICENSE("GPL v2");
drivers/irqchip/irq-vic.c+4−22
@@ -27,7 +27,10 @@ · 26 unmodified lines
2727
2828 #define VIC_IRQ_STATUS 0x00
2929 #define VIC_FIQ_STATUS 0x04
30+#define VIC_RAW_STATUS 0x08
3031 #define VIC_INT_SELECT 0x0c /* 1 = FIQ, 0 = IRQ */
32+#define VIC_INT_ENABLE 0x10 /* 1 = enable, 0 = disable */
33+#define VIC_INT_ENABLE_CLEAR 0x14
3134 #define VIC_INT_SOFT 0x18
3235 #define VIC_INT_SOFT_CLEAR 0x1c
3336 #define VIC_PROTECT 0x20
@@ -428,7 +431,7 @@ static void __init vic_init_st(void __iomem *base, unsigned int irq_start, · 394 unmodified lines
428431 vic_register(base, 0, irq_start, vic_sources, 0, node);
429432 }
430433
431−void __init __vic_init(void __iomem *base, int parent_irq, int irq_start,
434+static void __init __vic_init(void __iomem *base, int parent_irq, int irq_start,
432435 u32 vic_sources, u32 resume_sources,
433436 struct device_node *node)
434437 {
@@ -481,27 +484,6 @@ void __init vic_init(void __iomem *base, unsigned int irq_start, · 46 unmodified lines
481484 __vic_init(base, 0, irq_start, vic_sources, resume_sources, NULL);
482485 }
483486
484−/**
485− * vic_init_cascaded() - initialise a cascaded vectored interrupt controller
486− * @base: iomem base address
487− * @parent_irq: the parent IRQ we're cascaded off
488− * @vic_sources: bitmask of interrupt sources to allow
489− * @resume_sources: bitmask of interrupt sources to allow for resume
490− *
491− * This returns the base for the new interrupts or negative on error.
492− */
493−int __init vic_init_cascaded(void __iomem *base, unsigned int parent_irq,
494− u32 vic_sources, u32 resume_sources)
495−{
496− struct vic_device *v;
497−
498− v = &vic_devices[vic_id];
499− __vic_init(base, parent_irq, 0, vic_sources, resume_sources, NULL);
500− /* Return out acquired base */
501− return v->irq;
502−}
503−EXPORT_SYMBOL_GPL(vic_init_cascaded);
504−
505487 #ifdef CONFIG_OF
506488 static int __init vic_of_init(struct device_node *node,
507489 struct device_node *parent)
drivers/irqchip/irqchip.c+29−0
@@ -10,8 +10,10 @@ · 9 unmodified lines
1010
1111 #include <linux/acpi.h>
1212 #include <linux/init.h>
13+#include <linux/of_device.h>
1314 #include <linux/of_irq.h>
1415 #include <linux/irqchip.h>
16+#include <linux/platform_device.h>
1517
1618 /*
1719 * This special of_device_id is the sentinel at the end of the
@@ -29,3 +31,30 @@ void __init irqchip_init(void) · 11 unmodified lines
2931 of_irq_init(__irqchip_of_table);
3032 acpi_probe_device_table(irqchip);
3133 }
34+
35+int platform_irqchip_probe(struct platform_device *pdev)
36+{
37+ struct device_node *np = pdev->dev.of_node;
38+ struct device_node *par_np = of_irq_find_parent(np);
39+ of_irq_init_cb_t irq_init_cb = of_device_get_match_data(&pdev->dev);
40+
41+ if (!irq_init_cb)
42+ return -EINVAL;
43+
44+ if (par_np == np)
45+ par_np = NULL;
46+
47+ /*
48+ * If there's a parent interrupt controller and none of the parent irq
49+ * domains have been registered, that means the parent interrupt
50+ * controller has not been initialized yet. it's not time for this
51+ * interrupt controller to initialize. So, defer probe of this
52+ * interrupt controller. The actual initialization callback of this
53+ * interrupt controller can check for specific domains as necessary.
54+ */
55+ if (par_np && !irq_find_matching_host(np, DOMAIN_BUS_ANY))
56+ return -EPROBE_DEFER;
57+
58+ return irq_init_cb(np, par_np);
59+}
60+EXPORT_SYMBOL_GPL(platform_irqchip_probe);
drivers/irqchip/qcom-pdc.c+7−1
@@ -11,9 +11,11 @@ · 10 unmodified lines
1111 #include <linux/irqdomain.h>
1212 #include <linux/io.h>
1313 #include <linux/kernel.h>
14+#include <linux/module.h>
1415 #include <linux/of.h>
1516 #include <linux/of_address.h>
1617 #include <linux/of_device.h>
18+#include <linux/of_irq.h>
1719 #include <linux/soc/qcom/irq.h>
1820 #include <linux/spinlock.h>
1921 #include <linux/slab.h>
@@ -430,4 +432,8 @@ fail: · 410 unmodified lines
430432 return ret;
431433 }
432434
433−IRQCHIP_DECLARE(qcom_pdc, "qcom,pdc", qcom_pdc_init);
435+IRQCHIP_PLATFORM_DRIVER_BEGIN(qcom_pdc)
436+IRQCHIP_MATCH("qcom,pdc", qcom_pdc_init)
437+IRQCHIP_PLATFORM_DRIVER_END(qcom_pdc)
438+MODULE_DESCRIPTION("Qualcomm Technologies, Inc. Power Domain Controller");
439+MODULE_LICENSE("GPL v2");
include/linux/acpi.h+17−6
@@ -1150,16 +1150,27 @@ struct acpi_probe_entry { · 1149 unmodified lines
11501150 kernel_ulong_t driver_data;
11511151 };
11521152
1153−#define ACPI_DECLARE_PROBE_ENTRY(table, name, table_id, subtable, valid, data, fn) \
1153+#define ACPI_DECLARE_PROBE_ENTRY(table, name, table_id, subtable, \
1154+ valid, data, fn) \
11541155 static const struct acpi_probe_entry __acpi_probe_##name \
1155− __used __section(__##table##_acpi_probe_table) \
1156− = { \
1156+ __used __section(__##table##_acpi_probe_table) = { \
11571157 .id = table_id, \
11581158 .type = subtable, \
11591159 .subtable_valid = valid, \
1160− .probe_table = (acpi_tbl_table_handler)fn, \
1161− .driver_data = data, \
1162− }
1160+ .probe_table = fn, \
1161+ .driver_data = data, \
1162+ }
1163+
1164+#define ACPI_DECLARE_SUBTABLE_PROBE_ENTRY(table, name, table_id, \
1165+ subtable, valid, data, fn) \
1166+ static const struct acpi_probe_entry __acpi_probe_##name \
1167+ __used __section(__##table##_acpi_probe_table) = { \
1168+ .id = table_id, \
1169+ .type = subtable, \
1170+ .subtable_valid = valid, \
1171+ .probe_subtbl = fn, \
1172+ .driver_data = data, \
1173+ }
11631174
11641175 #define ACPI_PROBE_TABLE(name) __##name##_acpi_probe_table
11651176 #define ACPI_PROBE_TABLE_END(name) __##name##_acpi_probe_table_end
include/linux/irqchip.h+27−2
@@ -12,7 +12,9 @@ · 11 unmodified lines
1212 #define _LINUX_IRQCHIP_H
1313
1414 #include <linux/acpi.h>
15+#include <linux/module.h>
1516 #include <linux/of.h>
17+#include <linux/platform_device.h>
1618
1719 /*
1820 * This macro must be used by the different irqchip drivers to declare
@@ -26,6 +28,28 @@ · 7 unmodified lines
2628 */
2729 #define IRQCHIP_DECLARE(name, compat, fn) OF_DECLARE_2(irqchip, name, compat, fn)
2830
31+extern int platform_irqchip_probe(struct platform_device *pdev);
32+
33+#define IRQCHIP_PLATFORM_DRIVER_BEGIN(drv_name) \
34+static const struct of_device_id drv_name##_irqchip_match_table[] = {
35+
36+#define IRQCHIP_MATCH(compat, fn) { .compatible = compat, .data = fn },
37+
38+#define IRQCHIP_PLATFORM_DRIVER_END(drv_name) \
39+ {}, \
40+}; \
41+MODULE_DEVICE_TABLE(of, drv_name##_irqchip_match_table); \
42+static struct platform_driver drv_name##_driver = { \
43+ .probe = platform_irqchip_probe, \
44+ .driver = { \
45+ .name = #drv_name, \
46+ .owner = THIS_MODULE, \
47+ .of_match_table = drv_name##_irqchip_match_table, \
48+ .suppress_bind_attrs = true, \
49+ }, \
50+}; \
51+builtin_platform_driver(drv_name##_driver)
52+
2953 /*
3054 * This macro must be used by the different irqchip drivers to declare
3155 * the association between their version and their initialization function.
@@ -39,8 +63,9 @@ · 7 unmodified lines
3963 * @fn: initialization function
4064 */
4165 #define IRQCHIP_ACPI_DECLARE(name, subtable, validate, data, fn) \
42− ACPI_DECLARE_PROBE_ENTRY(irqchip, name, ACPI_SIG_MADT, \
43− subtable, validate, data, fn)
66+ ACPI_DECLARE_SUBTABLE_PROBE_ENTRY(irqchip, name, \
67+ ACPI_SIG_MADT, subtable, \
68+ validate, data, fn)
4469
4570 #ifdef CONFIG_IRQCHIP
4671 void irqchip_init(void);
include/linux/irqchip/arm-gic-v3.h+0−4
@@ -19,7 +19,6 @@ · 18 unmodified lines
1919 #define GICD_CLRSPI_NSR 0x0048
2020 #define GICD_SETSPI_SR 0x0050
2121 #define GICD_CLRSPI_SR 0x0058
22−#define GICD_SEIR 0x0068
2322 #define GICD_IGROUPR 0x0080
2423 #define GICD_ISENABLER 0x0100
2524 #define GICD_ICENABLER 0x0180
@@ -119,14 +118,11 @@ · 93 unmodified lines
119118 #define GICR_WAKER 0x0014
120119 #define GICR_SETLPIR 0x0040
121120 #define GICR_CLRLPIR 0x0048
122−#define GICR_SEIR GICD_SEIR
123121 #define GICR_PROPBASER 0x0070
124122 #define GICR_PENDBASER 0x0078
125123 #define GICR_INVLPIR 0x00A0
126124 #define GICR_INVALLR 0x00B0
127125 #define GICR_SYNCR 0x00C0
128−#define GICR_MOVLPIR 0x0100
129−#define GICR_MOVALLR 0x0110
130126 #define GICR_IDREGS GICD_IDREGS
131127 #define GICR_PIDR2 GICD_PIDR2
132128
include/linux/irqchip/arm-vic.h+0−11
@@ -9,17 +9,6 @@ · 8 unmodified lines
99
1010 #include <linux/types.h>
1111
12−#define VIC_RAW_STATUS 0x08
13−#define VIC_INT_ENABLE 0x10 /* 1 = enable, 0 = disable */
14−#define VIC_INT_ENABLE_CLEAR 0x14
15−
16−struct device_node;
17−struct pt_regs;
18−
19−void __vic_init(void __iomem *base, int parent_irq, int irq_start,
20− u32 vic_sources, u32 resume_sources, struct device_node *node);
2112 void vic_init(void __iomem *base, unsigned int irq_start, u32 vic_sources, u32 resume_sources);
22−int vic_init_cascaded(void __iomem *base, unsigned int parent_irq,
23− u32 vic_sources, u32 resume_sources);
2413
2514 #endif
include/linux/irqchip/irq-bcm2836.h+1−1
@@ -30,7 +30,7 @@ · 29 unmodified lines
3030 */
3131 #define LOCAL_MAILBOX_INT_CONTROL0 0x050
3232 /*
33− * The CPU's interrupt status register. Bits are defined by the the
33+ * The CPU's interrupt status register. Bits are defined by the
3434 * LOCAL_IRQ_* bits below.
3535 */
3636 #define LOCAL_IRQ_PENDING0 0x060
include/linux/irqdesc.h+0−15
@@ -22,7 +22,6 @@ struct pt_regs; · 21 unmodified lines
2222 * @irq_common_data: per irq and chip data passed down to chip functions
2323 * @kstat_irqs: irq stats per cpu
2424 * @handle_irq: highlevel irq-events handler
25− * @preflow_handler: handler called before the flow handler (currently used by sparc)
2625 * @action: the irq action chain
2726 * @status_use_accessors: status information
2827 * @core_internal_state__do_not_mess_with_it: core internal status information
@@ -58,9 +57,6 @@ struct irq_desc { · 29 unmodified lines
5857 struct irq_data irq_data;
5958 unsigned int __percpu *kstat_irqs;
6059 irq_flow_handler_t handle_irq;
61−#ifdef CONFIG_IRQ_PREFLOW_FASTEOI
62− irq_preflow_handler_t preflow_handler;
63−#endif
6460 struct irqaction *action; /* IRQ action list */
6561 unsigned int status_use_accessors;
6662 unsigned int core_internal_state__do_not_mess_with_it;
@@ -268,15 +264,4 @@ irq_set_lockdep_class(unsigned int irq, struct lock_class_key *lock_class, · 201 unmodified lines
268264 }
269265 }
270266
271−#ifdef CONFIG_IRQ_PREFLOW_FASTEOI
272−static inline void
273−__irq_set_preflow_handler(unsigned int irq, irq_preflow_handler_t handler)
274−{
275− struct irq_desc *desc;
276−
277− desc = irq_to_desc(irq);
278− desc->preflow_handler = handler;
279−}
280−#endif
281−
282267 #endif
include/linux/irqhandler.h+0−1
@@ -10,6 +10,5 @@ · 9 unmodified lines
1010 struct irq_desc;
1111 struct irq_data;
1212 typedef void (*irq_flow_handler_t)(struct irq_desc *desc);
13−typedef void (*irq_preflow_handler_t)(struct irq_data *data);
1413
1514 #endif
kernel/irq/Kconfig+0−4
@@ -51,10 +51,6 @@ config GENERIC_IRQ_INJECTION · 50 unmodified lines
5151 config HARDIRQS_SW_RESEND
5252 bool
5353
54−# Preflow handler support for fasteoi (sparc64)
55−config IRQ_PREFLOW_FASTEOI
56− bool
57−
5854 # Edge style eoi based handler (cell)
5955 config IRQ_EDGE_EOI_HANDLER
6056 bool
kernel/irq/chip.c+2−14
@@ -656,16 +656,6 @@ out_unlock: · 655 unmodified lines
656656 }
657657 EXPORT_SYMBOL_GPL(handle_level_irq);
658658
659−#ifdef CONFIG_IRQ_PREFLOW_FASTEOI
660−static inline void preflow_handler(struct irq_desc *desc)
661−{
662− if (desc->preflow_handler)
663− desc->preflow_handler(&desc->irq_data);
664−}
665−#else
666−static inline void preflow_handler(struct irq_desc *desc) { }
667−#endif
668−
669659 static void cond_unmask_eoi_irq(struct irq_desc *desc, struct irq_chip *chip)
670660 {
671661 if (!(desc->istate & IRQS_ONESHOT)) {
@@ -721,7 +711,6 @@ void handle_fasteoi_irq(struct irq_desc *desc) · 49 unmodified lines
721711 if (desc->istate & IRQS_ONESHOT)
722712 mask_irq(desc);
723713
724− preflow_handler(desc);
725714 handle_irq_event(desc);
726715
727716 cond_unmask_eoi_irq(desc, chip);
@@ -1231,7 +1220,6 @@ void handle_fasteoi_ack_irq(struct irq_desc *desc) · 503 unmodified lines
12311220 /* Start handling the irq */
12321221 desc->irq_data.chip->irq_ack(&desc->irq_data);
12331222
1234− preflow_handler(desc);
12351223 handle_irq_event(desc);
12361224
12371225 cond_unmask_eoi_irq(desc, chip);
@@ -1281,7 +1269,6 @@ void handle_fasteoi_mask_irq(struct irq_desc *desc) · 43 unmodified lines
12811269 if (desc->istate & IRQS_ONESHOT)
12821270 mask_irq(desc);
12831271
1284− preflow_handler(desc);
12851272 handle_irq_event(desc);
12861273
12871274 cond_unmask_eoi_irq(desc, chip);
@@ -1478,6 +1465,7 @@ int irq_chip_retrigger_hierarchy(struct irq_data *data) · 190 unmodified lines
14781465
14791466 return 0;
14801467 }
1468+EXPORT_SYMBOL_GPL(irq_chip_retrigger_hierarchy);
14811469
14821470 /**
14831471 * irq_chip_set_vcpu_affinity_parent - Set vcpu affinity on the parent interrupt
@@ -1492,7 +1480,7 @@ int irq_chip_set_vcpu_affinity_parent(struct irq_data *data, void *vcpu_info) · 8 unmodified lines
14921480
14931481 return -ENOSYS;
14941482 }
1495−
1483+EXPORT_SYMBOL_GPL(irq_chip_set_vcpu_affinity_parent);
14961484 /**
14971485 * irq_chip_set_wake_parent - Set/reset wake-up on the parent interrupt
14981486 * @data: Pointer to interrupt specific data
kernel/irq/irqdomain.c+2−1
@@ -142,7 +142,7 @@ struct irq_domain *__irq_domain_add(struct fwnode_handle *fwnode, int size, · 141 unmodified lines
142142 if (!domain)
143143 return NULL;
144144
145− if (fwnode && is_fwnode_irqchip(fwnode)) {
145+ if (is_fwnode_irqchip(fwnode)) {
146146 fwid = container_of(fwnode, struct irqchip_fwid, fwnode);
147147
148148 switch (fwid->type) {
@@ -281,6 +281,7 @@ void irq_domain_update_bus_token(struct irq_domain *domain, · 132 unmodified lines
281281
282282 mutex_unlock(&irq_domain_mutex);
283283 }
284+EXPORT_SYMBOL_GPL(irq_domain_update_bus_token);
284285
285286 /**
286287 * irq_domain_add_simple() - Register an irq_domain and optionally map a range of irqs

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t