Skip to contentSkip to conversation

irqchip/qcom-pdc: Switch to IRQCHIP_PLATFORM_DRIVER and allow as a module

PATCH Applied John Stultz 5 participants 7 messages May 18, 2021 – Jul 20, 2021

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 irqchip/qcom-pdc: Switch to IRQCHIP_PLATFORM_DRIVER and allow as a module

From: Saravana Kannan <[email protected]>

This patch revives changes from Saravana Kannan to switch the qcom-pdc driver to use IRQCHIP_PLATFORM_DRIVER helper macros, and allows qcom-pdc driver to be loaded as a permanent module.

Earlier attempts at this ran into trouble with loading dependencies, but with Saravana's fw_devlink=on set by default now we should avoid those.

Cc Andy Gross <[email protected]>
Cc Bjorn Andersson <[email protected]>
Cc Joerg Roedel <[email protected]>
Cc Thomas Gleixner <[email protected]>
Cc Jason Cooper <[email protected]>
Cc Marc Zyngier <[email protected]>
Cc Linus Walleij <[email protected]>
Cc Maulik Shah <[email protected]>
Cc Lina Iyer <[email protected]>
Cc Saravana Kannan <[email protected]>
Cc Todd Kjos <[email protected]>
Cc Greg Kroah-Hartman <[email protected]>

[jstultz: Folded in with my changes to allow the driver to be
loadable as a permenent module]

---
 drivers/irqchip/Kconfig    | 2 +-
 drivers/irqchip/qcom-pdc.c | 8 +++++++-
 2 files changed, 8 insertions(+), 2 deletions(-)
drivers/irqchip/Kconfig +1 -1
index b90e825df7e14..d4a0b4964ccc5 100644
@@ -415,7 +415,7 @@ config GOLDFISH_PIC
          for Goldfish based virtual platforms.
 
 config QCOM_PDC
-	bool "QCOM PDC"
+	tristate "QCOM PDC"
 	depends on ARCH_QCOM
 	select IRQ_DOMAIN_HIERARCHY
 	help
drivers/irqchip/qcom-pdc.c +7 -1
index 5dc63c20b67ea..32d59202d408d 100644
@@ -11,9 +11,11 @@
 #include <linux/irqdomain.h>
 #include <linux/io.h>
 #include <linux/kernel.h>
+#include <linux/module.h>
 #include <linux/of.h>
 #include <linux/of_address.h>
 #include <linux/of_device.h>
+#include <linux/of_irq.h>
 #include <linux/soc/qcom/irq.h>
 #include <linux/spinlock.h>
 #include <linux/slab.h>
@@ -459,4 +461,8 @@ static int qcom_pdc_init(struct device_node *node, struct device_node *parent)
 	return ret;
 }
 
-IRQCHIP_DECLARE(qcom_pdc, "qcom,pdc", qcom_pdc_init);
+IRQCHIP_PLATFORM_DRIVER_BEGIN(qcom_pdc)
+IRQCHIP_MATCH("qcom,pdc", qcom_pdc_init)
+IRQCHIP_PLATFORM_DRIVER_END(qcom_pdc)
+MODULE_DESCRIPTION("Qualcomm Technologies, Inc. Power Domain Controller");
+MODULE_LICENSE("GPL v2");
Signature · 1 line
2.25.1
#1 lore raw

PATCH 2/2 firmware: QCOM_SCM: Allow qcom_scm driver to be loadable as a permenent module

Allow the qcom_scm driver to be loadable as a permenent module.

This still uses the "depends on QCOM_SCM || !QCOM_SCM" bit to ensure that drivers that call into the qcom_scm driver are also built as modules. While not ideal in some cases its the only safe way I can find to avoid build errors without having those drivers select QCOM_SCM and have to force it on (as QCOM_SCM=n can be valid for those drivers).

Reviving this now that Saravana's fw_devlink defaults to on, which should avoid loading troubles seen before.

Cc Catalin Marinas <[email protected]>
Cc Will Deacon <[email protected]>
Cc Andy Gross <[email protected]>
Cc Bjorn Andersson <[email protected]>
Cc Joerg Roedel <[email protected]>
Cc Thomas Gleixner <[email protected]>
Cc Jason Cooper <[email protected]>
Cc Marc Zyngier <[email protected]>
Cc Linus Walleij <[email protected]>
Cc Vinod Koul <[email protected]>
Cc Kalle Valo <[email protected]>
Cc Maulik Shah <[email protected]>
Cc Lina Iyer <[email protected]>
Cc Saravana Kannan <[email protected]>
Cc Todd Kjos <[email protected]>
Cc Greg Kroah-Hartman <[email protected]>

---
v3:
* Fix __arm_smccc_smc build issue reported by kernel test robot <[email protected]>
v4:
* Add "depends on QCOM_SCM || !QCOM_SCM" bit to ath10k config that requires it.
v5:
* Fix QCOM_QCM typo in Kconfig, it should be QCOM_SCM

---
 drivers/firmware/Kconfig                | 2 +-
 drivers/firmware/Makefile               | 3 ++-
 drivers/firmware/qcom_scm.c             | 4 ++++
 drivers/iommu/Kconfig                   | 2 ++
 drivers/net/wireless/ath/ath10k/Kconfig | 1 +
 5 files changed, 10 insertions(+), 2 deletions(-)
drivers/firmware/Kconfig +1 -1
index db0ea2d2d75a2..af53778edc7e2 100644
@@ -235,7 +235,7 @@ config INTEL_STRATIX10_RSU
 	  Say Y here if you want Intel RSU support.
 
 config QCOM_SCM
-	bool
+	tristate "Qcom SCM driver"
 	depends on ARM || ARM64
 	depends on HAVE_ARM_SMCCC
 	select RESET_CONTROLLER
drivers/firmware/Makefile +2 -1
index 5e013b6a3692e..523173cbff335 100644
@@ -17,7 +17,8 @@ obj-$(CONFIG_ISCSI_IBFT)	+= iscsi_ibft.o
 obj-$(CONFIG_FIRMWARE_MEMMAP)	+= memmap.o
 obj-$(CONFIG_RASPBERRYPI_FIRMWARE) += raspberrypi.o
 obj-$(CONFIG_FW_CFG_SYSFS)	+= qemu_fw_cfg.o
-obj-$(CONFIG_QCOM_SCM)		+= qcom_scm.o qcom_scm-smc.o qcom_scm-legacy.o
+obj-$(CONFIG_QCOM_SCM)		+= qcom-scm.o
+qcom-scm-objs += qcom_scm.o qcom_scm-smc.o qcom_scm-legacy.o
 obj-$(CONFIG_TI_SCI_PROTOCOL)	+= ti_sci.o
 obj-$(CONFIG_TRUSTED_FOUNDATIONS) += trusted_foundations.o
 obj-$(CONFIG_TURRIS_MOX_RWTM)	+= turris-mox-rwtm.o
drivers/firmware/qcom_scm.c +4 -0
index ee9cb545e73b9..bb9ce3f92931a 100644
@@ -1296,6 +1296,7 @@ static const struct of_device_id qcom_scm_dt_match[] = {
 	{ .compatible = "qcom,scm" },
 	{}
 };
+MODULE_DEVICE_TABLE(of, qcom_scm_dt_match);
 
 static struct platform_driver qcom_scm_driver = {
 	.driver = {
@@ -1312,3 +1313,6 @@ static int __init qcom_scm_init(void)
 	return platform_driver_register(&qcom_scm_driver);
 }
 subsys_initcall(qcom_scm_init);
+
+MODULE_DESCRIPTION("Qualcomm Technologies, Inc. SCM driver");
+MODULE_LICENSE("GPL v2");
drivers/iommu/Kconfig +2 -0
index 1f111b399bcab..38f7b7a8e2843 100644
@@ -253,6 +253,7 @@ config SPAPR_TCE_IOMMU
 config ARM_SMMU
 	tristate "ARM Ltd. System MMU (SMMU) Support"
 	depends on ARM64 || ARM || (COMPILE_TEST && !GENERIC_ATOMIC64)
+	depends on QCOM_SCM || !QCOM_SCM #if QCOM_SCM=m this can't be =y
 	select IOMMU_API
 	select IOMMU_IO_PGTABLE_LPAE
 	select ARM_DMA_USE_IOMMU if ARM
@@ -382,6 +383,7 @@ config QCOM_IOMMU
 	# Note: iommu drivers cannot (yet?) be built as modules
 	bool "Qualcomm IOMMU Support"
 	depends on ARCH_QCOM || (COMPILE_TEST && !GENERIC_ATOMIC64)
+	depends on QCOM_SCM=y
 	select IOMMU_API
 	select IOMMU_IO_PGTABLE_LPAE
 	select ARM_DMA_USE_IOMMU
drivers/net/wireless/ath/ath10k/Kconfig +1 -0
index 40f91bc8514d8..741289e385d59 100644
@@ -44,6 +44,7 @@ config ATH10K_SNOC
 	tristate "Qualcomm ath10k SNOC support"
 	depends on ATH10K
 	depends on ARCH_QCOM || COMPILE_TEST
+	depends on QCOM_SCM || !QCOM_SCM #if QCOM_SCM=m this can't be =y
 	select QCOM_QMI_HELPERS
 	help
 	  This module adds support for integrated WCN3990 chip connected
Signature · 1 line
2.25.1
Acked-by on v1 2/2
#2 lore raw

Re: [PATCH 2/2] firmware: QCOM_SCM: Allow qcom_scm driver to be loadable as a permenent module

Quoted 27 lines · John Stultz

Allow the qcom_scm driver to be loadable as a permenent module.

This still uses the "depends on QCOM_SCM || !QCOM_SCM" bit to ensure that drivers that call into the qcom_scm driver are also built as modules. While not ideal in some cases its the only safe way I can find to avoid build errors without having those drivers select QCOM_SCM and have to force it on (as QCOM_SCM=n can be valid for those drivers).

Reviving this now that Saravana's fw_devlink defaults to on, which should avoid loading troubles seen before.

Cc Catalin Marinas <[email protected]>
Cc Will Deacon <[email protected]>
Cc Andy Gross <[email protected]>
Cc Bjorn Andersson <[email protected]>
Cc Joerg Roedel <[email protected]>
Cc Thomas Gleixner <[email protected]>
Cc Jason Cooper <[email protected]>
Cc Marc Zyngier <[email protected]>
Cc Linus Walleij <[email protected]>
Cc Vinod Koul <[email protected]>
Cc Kalle Valo <[email protected]>
Cc Maulik Shah <[email protected]>
Cc Lina Iyer <[email protected]>
Cc Saravana Kannan <[email protected]>
Cc Todd Kjos <[email protected]>
Quoted 8 lines
maintainer Acked-by on v1 2/2
#3 lore raw

Re: [PATCH 2/2] firmware: QCOM_SCM: Allow qcom_scm driver to be loadable as a permenent module

In reply to John Stultz
Quoted 51 lines · John Stultz

Allow the qcom_scm driver to be loadable as a permenent module.

This still uses the "depends on QCOM_SCM || !QCOM_SCM" bit to ensure that drivers that call into the qcom_scm driver are also built as modules. While not ideal in some cases its the only safe way I can find to avoid build errors without having those drivers select QCOM_SCM and have to force it on (as QCOM_SCM=n can be valid for those drivers).

Reviving this now that Saravana's fw_devlink defaults to on, which should avoid loading troubles seen before.

Cc Catalin Marinas <[email protected]>
Cc Will Deacon <[email protected]>
Cc Andy Gross <[email protected]>
Cc Bjorn Andersson <[email protected]>
Cc Joerg Roedel <[email protected]>
Cc Thomas Gleixner <[email protected]>
Cc Jason Cooper <[email protected]>
Cc Marc Zyngier <[email protected]>
Cc Linus Walleij <[email protected]>
Cc Vinod Koul <[email protected]>
Cc Kalle Valo <[email protected]>
Cc Maulik Shah <[email protected]>
Cc Lina Iyer <[email protected]>
Cc Saravana Kannan <[email protected]>
Cc Todd Kjos <[email protected]>
Cc Greg Kroah-Hartman <[email protected]>

---
v3:
* Fix __arm_smccc_smc build issue reported by kernel test robot <[email protected]>
v4:
* Add "depends on QCOM_SCM || !QCOM_SCM" bit to ath10k config that requires it.
v5:
* Fix QCOM_QCM typo in Kconfig, it should be QCOM_SCM

---
 drivers/firmware/Kconfig                | 2 +-
 drivers/firmware/Makefile               | 3 ++-
 drivers/firmware/qcom_scm.c             | 4 ++++
 drivers/iommu/Kconfig                   | 2 ++
 drivers/net/wireless/ath/ath10k/Kconfig | 1 +
 5 files changed, 10 insertions(+), 2 deletions(-)

[...]

Quoted 13 lines
drivers/iommu/Kconfig +1 -0
index 1f111b399bcab..38f7b7a8e2843 100644
@@ -253,6 +253,7 @@ config SPAPR_TCE_IOMMU
 config ARM_SMMU
 	tristate "ARM Ltd. System MMU (SMMU) Support"
 	depends on ARM64 || ARM || (COMPILE_TEST && !GENERIC_ATOMIC64)
+	depends on QCOM_SCM || !QCOM_SCM #if QCOM_SCM=m this can't be =y
 	select IOMMU_API
 	select IOMMU_IO_PGTABLE_LPAE
 	select ARM_DMA_USE_IOMMU if ARM

drivers/iommu/Kconfig config QCOM_IOMMU · line 389

Quoted 7 lines
drivers/iommu/Kconfig +1 -0
@@ -382,6 +383,7 @@ config QCOM_IOMMU
 	# Note: iommu drivers cannot (yet?) be built as modules
 	bool "Qualcomm IOMMU Support"
 	depends on ARCH_QCOM || (COMPILE_TEST && !GENERIC_ATOMIC64)
+	depends on QCOM_SCM=y
 	select IOMMU_API
 	select IOMMU_IO_PGTABLE_LPAE
 	select ARM_DMA_USE_IOMMU

For this part:

Will

Acked-by on v1 1/2
#4 lore raw
In reply to John Stultz
Quoted 26 lines · John Stultz

From: Saravana Kannan <[email protected]>

This patch revives changes from Saravana Kannan to switch the qcom-pdc driver to use IRQCHIP_PLATFORM_DRIVER helper macros, and allows qcom-pdc driver to be loaded as a permanent module.

Earlier attempts at this ran into trouble with loading dependencies, but with Saravana's fw_devlink=on set by default now we should avoid those.

Cc Andy Gross <[email protected]>
Cc Bjorn Andersson <[email protected]>
Cc Joerg Roedel <[email protected]>
Cc Thomas Gleixner <[email protected]>
Cc Jason Cooper <[email protected]>
Cc Marc Zyngier <[email protected]>
Cc Linus Walleij <[email protected]>
Cc Maulik Shah <[email protected]>
Cc Lina Iyer <[email protected]>
Cc Saravana Kannan <[email protected]>
Cc Todd Kjos <[email protected]>
Cc Greg Kroah-Hartman <[email protected]>
Quoted 3 lines

[jstultz: Folded in with my changes to allow the driver to be
loadable as a permenent module]

#5 lore raw
In reply to John Stultz
The following commit has been merged into the irq/irqchip-next branch of irqchip:

The following commit has been merged into the irq/irqchip-next branch of irqchip:

Commit-ID:     4acd8a4be614a6c191273f2247aff7374a92f318
Gitweb:        https://git.kernel.org/pub/scm/linux/kernel/git/maz/arm-platforms/4acd8a4be614a6c191273f2247aff7374a92f318
Author:        Saravana Kannan <[email protected]>
AuthorDate:    Tue, 18 May 2021 21:19:21 
Committer:     Marc Zyngier <[email protected]>
CommitterDate: Sun, 06 Jun 2021 13:57:41 +01:00

irqchip/qcom-pdc: Switch to IRQCHIP_PLATFORM_DRIVER and allow as a module

This patch revives changes from Saravana Kannan to switch the qcom-pdc driver to use IRQCHIP_PLATFORM_DRIVER helper macros, and allows qcom-pdc driver to be loaded as a permanent module.

Earlier attempts at this ran into trouble with loading dependencies, but with Saravana's fw_devlink=on set by default now we should avoid those.

[jstultz: Folded in with my changes to allow the driver to be
loadable as a permenent module]

---
 drivers/irqchip/Kconfig    | 2 +-
 drivers/irqchip/qcom-pdc.c | 8 +++++++-
 2 files changed, 8 insertions(+), 2 deletions(-)
drivers/irqchip/Kconfig +1 -1
index 62543a4..4d5924e 100644
@@ -415,7 +415,7 @@ config GOLDFISH_PIC
          for Goldfish based virtual platforms.
 
 config QCOM_PDC
-	bool "QCOM PDC"
+	tristate "QCOM PDC"
 	depends on ARCH_QCOM
 	select IRQ_DOMAIN_HIERARCHY
 	help
drivers/irqchip/qcom-pdc.c +7 -1
index 5dc63c2..32d5920 100644
@@ -11,9 +11,11 @@
 #include <linux/irqdomain.h>
 #include <linux/io.h>
 #include <linux/kernel.h>
+#include <linux/module.h>
 #include <linux/of.h>
 #include <linux/of_address.h>
 #include <linux/of_device.h>
+#include <linux/of_irq.h>
 #include <linux/soc/qcom/irq.h>
 #include <linux/spinlock.h>
 #include <linux/slab.h>
@@ -459,4 +461,8 @@ fail:
 	return ret;
 }
 
-IRQCHIP_DECLARE(qcom_pdc, "qcom,pdc", qcom_pdc_init);
+IRQCHIP_PLATFORM_DRIVER_BEGIN(qcom_pdc)
+IRQCHIP_MATCH("qcom,pdc", qcom_pdc_init)
+IRQCHIP_PLATFORM_DRIVER_END(qcom_pdc)
+MODULE_DESCRIPTION("Qualcomm Technologies, Inc. Power Domain Controller");
+MODULE_LICENSE("GPL v2");
#6 lore raw
In reply to John Stultz
This series was applied to qcom/linux.git (refs/heads/for-next):

Hello:

This series was applied to qcom/linux.git (refs/heads/for-next):

Quoted 11 lines · On Tue, 18 May 2021 21:19:21 +0000 you wrote:

From: Saravana Kannan <[email protected]>

This patch revives changes from Saravana Kannan to switch the qcom-pdc driver to use IRQCHIP_PLATFORM_DRIVER helper macros, and allows qcom-pdc driver to be loaded as a permanent module.

Earlier attempts at this ran into trouble with loading dependencies, but with Saravana's fw_devlink=on set by default now we should avoid those.

[...]

Here is the summary with links:
- [1/2] irqchip/qcom-pdc: Switch to IRQCHIP_PLATFORM_DRIVER and allow as a module

    https://git.kernel.org/qcom/c/4acd8a4be614
  - [2/2] firmware: QCOM_SCM: Allow qcom_scm driver to be loadable as a permenent module
    https://git.kernel.org/qcom/c/b42000e4b874

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html