Skip to contentSkip to conversation

irqchip: Add config MTK_SYSIRQ and MTK_CIRQ

PATCH In review Hanks Chen 3 participants 6 messages Jun 18, 2020 – Jul 17, 2020

Subsystems (2)
lore
Share & tools
lore

Hanks Chen

author
#0 lore raw

PATCH 1/1 irqchip: Add config MTK_SYSIRQ and MTK_CIRQ

Mediatek sysirq and cirq drivers as-is were bound together to the config of ARCH_MEDIATEK. These two drivers should be able to be configured separately. For example, on new Mediatek mobile chips such as Dimensity 820, the sysirq driver is not used since the hardware module is removed.

Add two new configs to sysirq and cirq drivers.
- config MTK_SYSIRQ for the interrupt polarity controller driver: sysirq
- config MTK_CIRQ for the low-power interrupt driver: cirq

---
 drivers/irqchip/Kconfig  |   12 ++++++++++++
 drivers/irqchip/Makefile |    3 ++-
 2 files changed, 14 insertions(+), 1 deletion(-)
drivers/irqchip/Kconfig +12 -0
index 29fead2..cc9aa18 100644
@@ -572,4 +572,16 @@ config LOONGSON_PCH_MSI
 	help
 	  Support for the Loongson PCH MSI Controller.
 
+config MTK_SYSIRQ
+	tristate "Mediatek interrupt polarity controller"
+	help
+	  Interrupt polarity controller driver to swap polarity for
+	  interrupts for Mediatek mobile chips.
+
+config MTK_CIRQ
+	bool "Mediatek low-power interrupt controller"
+	help
+	  Low-power interrupt controller driver to monitor IRQS
+	  in the sleep mode for Mediatek mobile chips.
+
 endmenu
drivers/irqchip/Makefile +2 -1
index 133f9c4..30421d2 100644
@@ -69,7 +69,8 @@ obj-$(CONFIG_BCM7120_L2_IRQ)		+= irq-bcm7120-l2.o
 obj-$(CONFIG_BRCMSTB_L2_IRQ)		+= irq-brcmstb-l2.o
 obj-$(CONFIG_KEYSTONE_IRQ)		+= irq-keystone.o
 obj-$(CONFIG_MIPS_GIC)			+= irq-mips-gic.o
-obj-$(CONFIG_ARCH_MEDIATEK)		+= irq-mtk-sysirq.o irq-mtk-cirq.o
+obj-$(CONFIG_MTK_SYSIRQ)		+= irq-mtk-sysirq.o
+obj-$(CONFIG_MTK_CIRQ)			+= irq-mtk-cirq.o
 obj-$(CONFIG_ARCH_DIGICOLOR)		+= irq-digicolor.o
 obj-$(CONFIG_RENESAS_H8300H_INTC)	+= irq-renesas-h8300h.o
 obj-$(CONFIG_RENESAS_H8S_INTC)		+= irq-renesas-h8s.o
Signature · 1 line
1.7.9.5
#1 lore raw
Quoted 22 lines · Hanks Chen

Mediatek sysirq and cirq drivers as-is were bound together to the config of ARCH_MEDIATEK. These two drivers should be able to be configured separately. For example, on new Mediatek mobile chips such as Dimensity 820, the sysirq driver is not used since the hardware module is removed.

Add two new configs to sysirq and cirq drivers.
- config MTK_SYSIRQ for the interrupt polarity controller driver:
sysirq
- config MTK_CIRQ for the low-power interrupt driver: cirq

---
 drivers/irqchip/Kconfig  |   12 ++++++++++++
 drivers/irqchip/Makefile |    3 ++-
 2 files changed, 14 insertions(+), 1 deletion(-)
drivers/irqchip/Kconfig +0 -0
index 29fead2..cc9aa18 100644

drivers/irqchip/Kconfig config LOONGSON_PCH_MSI · line 576

Quoted 5 lines
drivers/irqchip/Kconfig +2 -0
@@ -572,4 +572,16 @@ config LOONGSON_PCH_MSI
 	help
 	  Support for the Loongson PCH MSI Controller.
 
+config MTK_SYSIRQ
+	tristate "Mediatek interrupt polarity controller"

How do you expect this to work as a module?

Quoted 16 lines
drivers/irqchip/Kconfig +10 -0
+	help
+	  Interrupt polarity controller driver to swap polarity for
+	  interrupts for Mediatek mobile chips.
+
+config MTK_CIRQ
+	bool "Mediatek low-power interrupt controller"
+	help
+	  Low-power interrupt controller driver to monitor IRQS
+	  in the sleep mode for Mediatek mobile chips.
+
 endmenu
drivers/irqchip/Makefile +0 -0
index 133f9c4..30421d2 100644

drivers/irqchip/Makefile obj-$(CONFIG_BCM7120_L2_IRQ) += irq-bcm7120-l2.o · line 76

Quoted 9 lines
drivers/irqchip/Makefile +2 -1
@@ -69,7 +69,8 @@ obj-$(CONFIG_BCM7120_L2_IRQ)		+= irq-bcm7120-l2.o
 obj-$(CONFIG_BRCMSTB_L2_IRQ)		+= irq-brcmstb-l2.o
 obj-$(CONFIG_KEYSTONE_IRQ)		+= irq-keystone.o
 obj-$(CONFIG_MIPS_GIC)			+= irq-mips-gic.o
-obj-$(CONFIG_ARCH_MEDIATEK)		+= irq-mtk-sysirq.o irq-mtk-cirq.o
+obj-$(CONFIG_MTK_SYSIRQ)		+= irq-mtk-sysirq.o
+obj-$(CONFIG_MTK_CIRQ)			+= irq-mtk-cirq.o
 obj-$(CONFIG_ARCH_DIGICOLOR)		+= irq-digicolor.o
 obj-$(CONFIG_RENESAS_H8300H_INTC)	+= irq-renesas-h8300h.o
 obj-$(CONFIG_RENESAS_H8S_INTC)		+= irq-renesas-h8s.o

In general, this approach doesn't look right. As it stands, this is just breaking existing configurations

Do you really expect users to know exactly which interrupt controllers their system is going to use? This seems like the wrong assumption. If you really want to save the handful of bytes these drivers take in your image, then add the relevant dependency information in Kconfig.

        M.
Signature · 1 line
Jazz is not dead. It just smells funny...
author
#2 lore raw
Quoted 29 lines · Marc Zyngier
Quoted 28 lines · Hanks Chen

Mediatek sysirq and cirq drivers as-is were bound together to the config
of ARCH_MEDIATEK. These two drivers should be able to be configured separately. For example, on new Mediatek mobile chips such as Dimensity
820, the sysirq driver is not used since the hardware module is removed.

Add two new configs to sysirq and cirq drivers.
- config MTK_SYSIRQ for the interrupt polarity controller driver:
sysirq
- config MTK_CIRQ for the low-power interrupt driver: cirq

---
 drivers/irqchip/Kconfig  |   12 ++++++++++++
 drivers/irqchip/Makefile |    3 ++-
 2 files changed, 14 insertions(+), 1 deletion(-)
drivers/irqchip/Kconfig +0 -0
index 29fead2..cc9aa18 100644
@@ -572,4 +572,16 @@ config LOONGSON_PCH_MSI
 	help
 	  Support for the Loongson PCH MSI Controller.
 
Quoted 4 lines

drivers/irqchip/Kconfig config LOONGSON_PCH_MSI · line 576

Quoted 2 lines
drivers/irqchip/Kconfig +2 -0
+config MTK_SYSIRQ
+	tristate "Mediatek interrupt polarity controller"

How do you expect this to work as a module?

My fault, I missed some patches.I'll add them in next patches.

These should be three patches:
1. break existing configurations and create new config for them
2. Change Kconfig to be loadable as a module and ensure all platforms are executable.
3. Make the irq-mtk-sysirq driver as a loadable kernel module for GKI and flexibility.
.
Thank you for your comment

Quoted 30 lines
Quoted 17 lines
drivers/irqchip/Kconfig +10 -0
+	help
+	  Interrupt polarity controller driver to swap polarity for
+	  interrupts for Mediatek mobile chips.
+
+config MTK_CIRQ
+	bool "Mediatek low-power interrupt controller"
+	help
+	  Low-power interrupt controller driver to monitor IRQS
+	  in the sleep mode for Mediatek mobile chips.
+
 endmenu
drivers/irqchip/Makefile +0 -0
index 133f9c4..30421d2 100644

drivers/irqchip/Makefile obj-$(CONFIG_BCM7120_L2_IRQ) += irq-bcm7120-l2.o · line 76

Quoted 9 lines
drivers/irqchip/Makefile +2 -1
@@ -69,7 +69,8 @@ obj-$(CONFIG_BCM7120_L2_IRQ)		+= irq-bcm7120-l2.o
 obj-$(CONFIG_BRCMSTB_L2_IRQ)		+= irq-brcmstb-l2.o
 obj-$(CONFIG_KEYSTONE_IRQ)		+= irq-keystone.o
 obj-$(CONFIG_MIPS_GIC)			+= irq-mips-gic.o
-obj-$(CONFIG_ARCH_MEDIATEK)		+= irq-mtk-sysirq.o irq-mtk-cirq.o
+obj-$(CONFIG_MTK_SYSIRQ)		+= irq-mtk-sysirq.o
+obj-$(CONFIG_MTK_CIRQ)			+= irq-mtk-cirq.o
 obj-$(CONFIG_ARCH_DIGICOLOR)		+= irq-digicolor.o
 obj-$(CONFIG_RENESAS_H8300H_INTC)	+= irq-renesas-h8300h.o
 obj-$(CONFIG_RENESAS_H8S_INTC)		+= irq-renesas-h8s.o

In general, this approach doesn't look right. As it stands, this is just breaking existing configurations

Quoted 5 lines

Do you really expect users to know exactly which interrupt controllers their system is going to use? This seems like the wrong assumption. If you really want to save the handful of bytes these drivers take in your image, then add the relevant dependency information in Kconfig.

1. This patch will add a dependency on it in Kconfig, which ensures all platforms are executable.
2. We want to follow the Android GKI and according to the requirement of GKI(General Kernel Image), all SoC and Board Peripheral drivers are loadable kernel modules.so I need to breaking existing configurations and create new config for them.

Thank you for your comment

Quoted 1 line
         M.
author
#3 lore raw
Quoted 82 lines · Hanks Chen
Quoted 29 lines · Marc Zyngier
Quoted 28 lines · Hanks Chen

Mediatek sysirq and cirq drivers as-is were bound together to the config
of ARCH_MEDIATEK. These two drivers should be able to be configured separately. For example, on new Mediatek mobile chips such as Dimensity
820, the sysirq driver is not used since the hardware module is removed.

Add two new configs to sysirq and cirq drivers.
- config MTK_SYSIRQ for the interrupt polarity controller driver:
sysirq
- config MTK_CIRQ for the low-power interrupt driver: cirq

---
 drivers/irqchip/Kconfig  |   12 ++++++++++++
 drivers/irqchip/Makefile |    3 ++-
 2 files changed, 14 insertions(+), 1 deletion(-)
drivers/irqchip/Kconfig +0 -0
index 29fead2..cc9aa18 100644
@@ -572,4 +572,16 @@ config LOONGSON_PCH_MSI
 	help
 	  Support for the Loongson PCH MSI Controller.
 
Quoted 4 lines

drivers/irqchip/Kconfig config LOONGSON_PCH_MSI · line 576

Quoted 2 lines
drivers/irqchip/Kconfig +2 -0
+config MTK_SYSIRQ
+	tristate "Mediatek interrupt polarity controller"

How do you expect this to work as a module?

My fault, I missed some patches.I'll add them in next patches.

These should be three patches:
1. break existing configurations and create new config for them
2. Change Kconfig to be loadable as a module and ensure all platforms are executable.
3. Make the irq-mtk-sysirq driver as a loadable kernel module for GKI and flexibility.
.
Thank you for your comment

Quoted 30 lines
Quoted 17 lines
drivers/irqchip/Kconfig +10 -0
+	help
+	  Interrupt polarity controller driver to swap polarity for
+	  interrupts for Mediatek mobile chips.
+
+config MTK_CIRQ
+	bool "Mediatek low-power interrupt controller"
+	help
+	  Low-power interrupt controller driver to monitor IRQS
+	  in the sleep mode for Mediatek mobile chips.
+
 endmenu
drivers/irqchip/Makefile +0 -0
index 133f9c4..30421d2 100644

drivers/irqchip/Makefile obj-$(CONFIG_BCM7120_L2_IRQ) += irq-bcm7120-l2.o · line 76

Quoted 9 lines
drivers/irqchip/Makefile +2 -1
@@ -69,7 +69,8 @@ obj-$(CONFIG_BCM7120_L2_IRQ)		+= irq-bcm7120-l2.o
 obj-$(CONFIG_BRCMSTB_L2_IRQ)		+= irq-brcmstb-l2.o
 obj-$(CONFIG_KEYSTONE_IRQ)		+= irq-keystone.o
 obj-$(CONFIG_MIPS_GIC)			+= irq-mips-gic.o
-obj-$(CONFIG_ARCH_MEDIATEK)		+= irq-mtk-sysirq.o irq-mtk-cirq.o
+obj-$(CONFIG_MTK_SYSIRQ)		+= irq-mtk-sysirq.o
+obj-$(CONFIG_MTK_CIRQ)			+= irq-mtk-cirq.o
 obj-$(CONFIG_ARCH_DIGICOLOR)		+= irq-digicolor.o
 obj-$(CONFIG_RENESAS_H8300H_INTC)	+= irq-renesas-h8300h.o
 obj-$(CONFIG_RENESAS_H8S_INTC)		+= irq-renesas-h8s.o

In general, this approach doesn't look right. As it stands, this is just breaking existing configurations

Quoted 5 lines

Do you really expect users to know exactly which interrupt controllers their system is going to use? This seems like the wrong assumption. If you really want to save the handful of bytes these drivers take in your image, then add the relevant dependency information in Kconfig.

Quoted 8 lines

1. This patch will add a dependency on it in Kconfig, which ensures all platforms are executable.
2. We want to follow the Android GKI and according to the requirement of GKI(General Kernel Image), all SoC and Board Peripheral drivers are loadable kernel modules.so I need to breaking existing configurations and create new config for them.

Thank you for your comment

Hi Marc,

I want to break the dependency between ARCH_MEDIATEK and CIRQ/SYSIRQ, because we need to follow the GKI.

Could I add the MTK_CIRQ and MTK_SYSIRQ into defconfig? (arch/arm64/config/defconfig)

It would ensures all platform are executable.

e.g.
--- a/arch/arm64/configs/defconfig
+++ b/arch/arm64/configs/defconfig

CONFIG_QCOM_PDC=y
+CONFIG_MTK_SYSIRQ=m
+CONFIG_MTK_CIRQ=y
CONFIG_RESET_QCOM_AOSS=y

drivers/irqchip/Kconfig +14 -0
@@ -572,4 +572,18 @@ config LOONGSON_PCH_MSI
        help
          Support for the Loongson PCH MSI Controller.
 
+config MTK_SYSIRQ
+       tristate "Mediatek interrupt polarity controller"
+       depends on ARCH_MEDIATEK || COMPILE_TEST
+       help
+         Interrupt polarity controller driver to swap polarity for
+         interrupts for Mediatek mobile chips.
+
+config MTK_CIRQ
+       bool "Mediatek low-power interrupt controller"
+       depends on ARCH_MEDIATEK || COMPILE_TEST
+       help
+         Low-power interrupt controller driver to monitor IRQS
+         in the sleep mode for Mediatek mobile chips.
+
 

P.S I'll make the irq-mtk-sysirq driver as a loadable kernel module for GKI

Thanks

Quoted 6 lines
Quoted 1 line
         M.

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

#4 lore raw

+ Saravana

On 2020-06-23 07:36, Hanks Chen wrote:

[...]

Quoted 4 lines

Hi Marc,

I want to break the dependency between ARCH_MEDIATEK and CIRQ/SYSIRQ, because we need to follow the GKI.

This isn't what GKI mandates. GKI requires that the SoC code is compiled as modules, not that it is dissociated from its platform (which would be completely pointless).

Quoted 2 lines

Could I add the MTK_CIRQ and MTK_SYSIRQ into defconfig? (arch/arm64/config/defconfig)

I don't deal with defconfig at all. That's a patch for the arm-soc people.

Quoted 34 lines

It would ensures all platform are executable.

e.g.

arch/arm64/configs/defconfig +2 -0
 
 CONFIG_QCOM_PDC=y
+CONFIG_MTK_SYSIRQ=m
+CONFIG_MTK_CIRQ=y
 CONFIG_RESET_QCOM_AOSS=y
drivers/irqchip/Kconfig +14 -0
@@ -572,4 +572,18 @@ config LOONGSON_PCH_MSI
        help
          Support for the Loongson PCH MSI Controller.
 
+config MTK_SYSIRQ
+       tristate "Mediatek interrupt polarity controller"
+       depends on ARCH_MEDIATEK || COMPILE_TEST
+       help
+         Interrupt polarity controller driver to swap polarity for
+         interrupts for Mediatek mobile chips.
+
+config MTK_CIRQ
+       bool "Mediatek low-power interrupt controller"
+       depends on ARCH_MEDIATEK || COMPILE_TEST
+       help
+         Low-power interrupt controller driver to monitor IRQS
+         in the sleep mode for Mediatek mobile chips.
+
 
Quoted 2 lines

P.S I'll make the irq-mtk-sysirq driver as a loadable kernel module for GKI

You might as well turn both drivers into modules. Saravana was working on a set of patches to ease this transition.

Thanks,

        M.
Signature · 1 line
Jazz is not dead. It just smells funny...
#5 lore raw
Quoted 56 lines · Marc Zyngier

+ Saravana

On 2020-06-23 07:36, Hanks Chen wrote:

[...]

Quoted 4 lines

Hi Marc,

I want to break the dependency between ARCH_MEDIATEK and CIRQ/SYSIRQ, because we need to follow the GKI.

This isn't what GKI mandates. GKI requires that the SoC code is compiled as modules, not that it is dissociated from its platform (which would be completely pointless).

Quoted 2 lines

Could I add the MTK_CIRQ and MTK_SYSIRQ into defconfig? (arch/arm64/config/defconfig)

I don't deal with defconfig at all. That's a patch for the arm-soc people.

Quoted 34 lines

It would ensures all platform are executable.

e.g.

arch/arm64/configs/defconfig +2 -0
 
 CONFIG_QCOM_PDC=y
+CONFIG_MTK_SYSIRQ=m
+CONFIG_MTK_CIRQ=y
 CONFIG_RESET_QCOM_AOSS=y
drivers/irqchip/Kconfig +14 -0
@@ -572,4 +572,18 @@ config LOONGSON_PCH_MSI
        help
          Support for the Loongson PCH MSI Controller.
 
+config MTK_SYSIRQ
+       tristate "Mediatek interrupt polarity controller"
+       depends on ARCH_MEDIATEK || COMPILE_TEST
+       help
+         Interrupt polarity controller driver to swap polarity for
+         interrupts for Mediatek mobile chips.
+
+config MTK_CIRQ
+       bool "Mediatek low-power interrupt controller"
+       depends on ARCH_MEDIATEK || COMPILE_TEST
+       help
+         Low-power interrupt controller driver to monitor IRQS
+         in the sleep mode for Mediatek mobile chips.
+
 
Quoted 5 lines
Quoted 2 lines

P.S I'll make the irq-mtk-sysirq driver as a loadable kernel module for GKI

You might as well turn both drivers into modules. Saravana was working on a set of patches to ease this transition.

Sent out v2 of that patch now.
https://lore.kernel.org/lkml/[email protected]/T/#u

-Saravana