Re: [RFC PATCH v4 12/13] irqchip: ti-sci-inta: Add support for Interrupt Aggregator driver

From: Tero Kristo
Date: Tue Jan 15 2019 - 07:39:31 EST


On 02/01/2019 14:26, Lokesh Vutla wrote:
Hi Peter,

On 02/01/19 5:19 PM, Peter Ujfalusi wrote:



On 27/12/2018 8.13, Lokesh Vutla wrote:
Texas Instruments' K3 generation SoCs has an IP Interrupt Aggregator
which is an interrupt controller that does the following:
- Converts events to interrupts that can be understood by
ÂÂ an interrupt router.
- Allows for multiplexing of events to interrupts.

Configuration of the interrupt aggregator registers can only be done by
a system co-processor and the driver needs to send a message to this
co processor over TISCI protocol.

Add support for Interrupt Aggregator driver over TISCI protocol.

Signed-off-by: Lokesh Vutla <lokeshvutla@xxxxxx>
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@xxxxxx>
---
 MAINTAINERS | 1 +
 drivers/irqchip/Kconfig | 12 +
 drivers/irqchip/Makefile | 1 +
 drivers/irqchip/irq-ti-sci-inta.c | 561 ++++++++++++++++++++++++++++++
 4 files changed, 575 insertions(+)
 create mode 100644 drivers/irqchip/irq-ti-sci-inta.c

diff --git a/MAINTAINERS b/MAINTAINERS
index aebce615151e..7d12788c844a 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -15026,6 +15026,7 @@ F:ÂÂÂ drivers/reset/reset-ti-sci.c
 F: Documentation/devicetree/bindings/interrupt-controller/ti,sci-intr.txt
 F: Documentation/devicetree/bindings/interrupt-controller/ti,sci-inta.txt
 F: drivers/irqchip/irq-ti-sci-intr.c
+F:ÂÂÂ drivers/irqchip/irq-ti-sci-inta.c
 Texas Instruments ASoC drivers
 M: Peter Ujfalusi <peter.ujfalusi@xxxxxx>
diff --git a/drivers/irqchip/Kconfig b/drivers/irqchip/Kconfig
index a8d9bed0254b..d16fd39408ad 100644
--- a/drivers/irqchip/Kconfig
+++ b/drivers/irqchip/Kconfig
@@ -417,6 +417,18 @@ config TI_SCI_INTR_IRQCHIP
ÂÂÂÂÂÂÂ If you wish to use interrupt router irq resources managed by the
ÂÂÂÂÂÂÂ TI System Controller, say Y here. Otherwise, say N.
+config TI_SCI_INTA_IRQCHIP
+ÂÂÂ bool
+ÂÂÂ depends on TI_SCI_PROTOCOL && ARCH_K3
+ÂÂÂ select IRQ_DOMAIN
+ÂÂÂ select IRQ_DOMAIN_HIERARCHY
+ÂÂÂ select K3_INTA_MSI_DOMAIN
+ÂÂÂ help
+ÂÂÂÂÂ This enables the irqchip driver support for K3 Interrupt aggregator
+ÂÂÂÂÂ over TI System Control Interface available on some new TI's SoCs.
+ÂÂÂÂÂ If you wish to use interrupt aggregator irq resources managed by the
+ÂÂÂÂÂ TI System Controller, say Y here. Otherwise, say N.
+
 endmenu
 config SIFIVE_PLIC
diff --git a/drivers/irqchip/Makefile b/drivers/irqchip/Makefile
index b4ff376a08ef..a679490a7059 100644
--- a/drivers/irqchip/Makefile
+++ b/drivers/irqchip/Makefile
@@ -95,3 +95,4 @@ obj-$(CONFIG_SIFIVE_PLIC)ÂÂÂÂÂÂÂ += irq-sifive-plic.o
 obj-$(CONFIG_IMX_IRQSTEER) += irq-imx-irqsteer.o
 obj-$(CONFIG_MADERA_IRQ) += irq-madera.o
 obj-$(CONFIG_TI_SCI_INTR_IRQCHIP) += irq-ti-sci-intr.o
+obj-$(CONFIG_TI_SCI_INTA_IRQCHIP)ÂÂÂ += irq-ti-sci-inta.o
diff --git a/drivers/irqchip/irq-ti-sci-inta.c b/drivers/irqchip/irq-ti-sci-inta.c
new file mode 100644
index 000000000000..78bfc83a079a
--- /dev/null
+++ b/drivers/irqchip/irq-ti-sci-inta.c
@@ -0,0 +1,561 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Texas Instruments' K3 Interrupt Aggregator irqchip driver
+ *
+ * Copyright (C) 2018 Texas Instruments Incorporated - http://www.ti.com/
+ *ÂÂÂ Lokesh Vutla <lokeshvutla@xxxxxx>
+ */
+
+#include <linux/err.h>
+#include <linux/io.h>
+#include <linux/msi.h>
+#include <linux/irqchip.h>
+#include <linux/of_platform.h>
+#include <linux/of_address.h>
+#include <linux/of_irq.h>
+#include <linux/module.h>
+#include <linux/moduleparam.h>
+#include <linux/irqdomain.h>

To fix this:

drivers/irqchip/irq-ti-sci-inta.c: In function âinta_msi_irq_handlerâ:
drivers/irqchip/irq-ti-sci-inta.c:308:8: error: âIRQF_TRIGGER_HIGHâ undeclared (first use in this function); did you mean âIRQD_TRIGGER_MASKâ?
ÂÂÂÂÂÂÂÂ IRQF_TRIGGER_HIGH)
ÂÂÂÂÂÂÂÂ ^~~~~~~~~~~~~~~~~
ÂÂÂÂÂÂÂÂ IRQD_TRIGGER_MASK
drivers/irqchip/irq-ti-sci-inta.c:308:8: note: each undeclared identifier is reported only once for each function it appears in
drivers/irqchip/irq-ti-sci-inta.c: In function âti_sci_inta_alloc_parent_irqâ:
drivers/irqchip/irq-ti-sci-inta.c:360:27: error: âIRQF_TRIGGER_HIGHâ undeclared (first use in this function); did you mean âIRQD_TRIGGER_MASKâ?
ÂÂ parent_fwspec.param[2] = IRQF_TRIGGER_HIGH;
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ ^~~~~~~~~~~~~~~~~
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ IRQD_TRIGGER_MASK
make[3]: *** [scripts/Makefile.build:276: drivers/irqchip/irq-ti-sci-inta.o] Error 1

Add this:
#include <linux/interrupt.h>

I did not see any such build error during my testing as shown below. But agree about the report. Will fix it in next version

â linux git:(nex-master) v8make defconfig
 HOSTCC scripts/basic/fixdep
 HOSTCC scripts/kconfig/conf.o
 HOSTCC scripts/kconfig/confdata.o
 HOSTCC scripts/kconfig/expr.o
 HOSTCC scripts/kconfig/symbol.o
 HOSTCC scripts/kconfig/preprocess.o
 LEX scripts/kconfig/zconf.lex.c
 YACC scripts/kconfig/zconf.tab.h
 HOSTCC scripts/kconfig/zconf.lex.o
 YACC scripts/kconfig/zconf.tab.c
 HOSTCC scripts/kconfig/zconf.tab.o
v8Â HOSTLDÂ scripts/kconfig/conf
*** Default configuration is based on 'defconfig'
make #
# configuration written to .config
#
I%
 â linux git:(nex-master) v8make Image dtbs -j4 -s
arch/arm64/boot/dts/rockchip/rk3399-gru-bob.dts:25.9-29.5: Warning (graph_port): /edp-panel/ports: graph port node name should be 'port'
arch/arm64/boot/dts/rockchip/rk3399-gru-kevin.dts:46.9-50.5: Warning (graph_port): /edp-panel/ports: graph port node name should be 'port'
arch/arm64/boot/dts/rockchip/rk3399-sapphire-excavator.dts:94.9-98.5: Warning (graph_port): /edp-panel/ports: graph port node name should be 'port'
<stdin>:1339:2: warning: #warning syscall open_tree not implemented [-Wcpp]
<stdin>:1342:2: warning: #warning syscall move_mount not implemented [-Wcpp]
<stdin>:1345:2: warning: #warning syscall fsopen not implemented [-Wcpp]
<stdin>:1348:2: warning: #warning syscall fsconfig not implemented [-Wcpp]
<stdin>:1351:2: warning: #warning syscall fsmount not implemented [-Wcpp]
<stdin>:1354:2: warning: #warning syscall fspick not implemented [-Wcpp]
â linux git:(nex-master)

Thanks and regards,
Lokesh

The mentioned failure only happens with a specific .config. Not sure what is the actual Kconfig that masks the failure though, but anyway it looks like interrupt.h gets included via some indirect path with arm64 defconfig making it pass.

-Tero
--
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki