Allow for qcom-pdc, pinctrl-msm and qcom-scm drivers to be loadable as modules
Subsystems (9)
cover Allow for qcom-pdc, pinctrl-msm and qcom-scm drivers to be loadable as modules
This patch series provides exports and config tweaks to allow the qcom-pdc, pinctrl-msm and qcom-scm drivers to be able to be configured as permement modules (particularlly useful for the Android Generic Kernel Image efforts).
Feedback would be appreciated!
thanks
-john
John Stultz (5):
irq: irqdomain: Export irq_domain_update_bus_token
irq: irqchip: Export irq_chip_retrigger_hierarchy and
irq_chip_set_vcpu_affinity_parent
irqchip: Allow QCOM_PDC to be loadable as a perment module
pinctrl: qcom: Allow pinctrl-msm code to be loadable as a module
firmware: QCOM_SCM: Allow qcom_scm driver to be loadable as a
permenent module
drivers/firmware/Kconfig | 2 +- drivers/firmware/Makefile | 3 ++- drivers/firmware/qcom_scm.c | 4 ++++ drivers/iommu/Kconfig | 2 ++ drivers/irqchip/Kconfig | 2 +- drivers/irqchip/qcom-pdc.c | 30 ++++++++++++++++++++++++++++++ drivers/pinctrl/qcom/Kconfig | 2 +- drivers/pinctrl/qcom/pinctrl-msm.c | 3 +++ kernel/irq/chip.c | 3 ++- kernel/irq/irqdomain.c | 1 + 10 files changed, 47 insertions(+), 5 deletions(-)
Signature · 6 lines
2.17.1 _______________________________________________ iommu mailing list [email protected] https://lists.linuxfoundation.org/mailman/listinfo/iommu
RFC PATCH 1/5 irq: irqdomain: Export irq_domain_update_bus_token
Add export for irq_domain_update_bus_token() so that we can allow drivers like the qcom-pdc driver to be loadable as a module.
--- kernel/irq/irqdomain.c | 1 + 1 file changed, 1 insertion(+)
kernel/irq/irqdomain.c +1 -0
@@ -281,6 +281,7 @@ void irq_domain_update_bus_token(struct irq_domain *domain,mutex_unlock (&irq_domain_mutex); } +EXPORT_SYMBOL_GPL (irq_domain_update_bus_token);/** * irq_domain_add_simple() - Register an irq_domain and optionally map a range of irqs
Signature · 1 line
2.17.1
RFC PATCH 2/5 irq: irqchip: Export irq_chip_retrigger_hierarchy and irq_chip_set_vcpu_affinity_parent
In reply to John StultzAdd EXPORT_SYMBOL_GPL entries for irq_chip_retrigger_hierarchy() and irq_chip_set_vcpu_affinity_parent() so that we can allow drivers like the qcom-pdc driver to be loadable as a module.
--- kernel/irq/chip.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
kernel/irq/chip.c +2 -1
@@ -1478,6 +1478,7 @@ int irq_chip_retrigger_hierarchy(struct irq_data *data)return 0 ; } +EXPORT_SYMBOL_GPL (irq_chip_retrigger_hierarchy);/** * irq_chip_set_vcpu_affinity_parent - Set vcpu affinity on the parent interrupt
@@ -1492,7 +1493,7 @@ int irq_chip_set_vcpu_affinity_parent(struct irq_data *data, void *vcpu_info)return -ENOSYS ; } - +EXPORT_SYMBOL_GPL (irq_chip_set_vcpu_affinity_parent);/** * irq_chip_set_wake_parent - Set/reset wake-up on the parent interrupt * @data: Pointer to interrupt specific data
Signature · 1 line
2.17.1
RFC PATCH 3/5 irqchip: Allow QCOM_PDC to be loadable as a perment module
In reply to John StultzAllows qcom-pdc driver to be loaded as a permenent module
Also, due to the fact that IRQCHIP_DECLARE becomes a no-op when building as a module, we have to add the platform driver hooks explicitly.
Thanks to Saravana for his help on pointing out the IRQCHIP_DECLARE issue and guidance on a solution.
--- drivers/irqchip/Kconfig | 2 +- drivers/irqchip/qcom-pdc.c | 30 ++++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-)
drivers/irqchip/Kconfig +1 -1
@@ -425,7 +425,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 +30 -0
@@ -11,7 +11,9 @@#include <linux/irqdomain.h> #include <linux/io.h> #include <linux/kernel.h> +#include <linux/module.h> #include <linux/of.h> +#include <linux/of_irq.h> #include <linux/of_address.h> #include <linux/of_device.h> #include <linux/soc/qcom/irq.h>
@@ -430,4 +432,32 @@ static int qcom_pdc_init(struct device_node *node, struct device_node *parent)return ret; } +#ifdef MODULE +static int qcom_pdc_probe (struct platform_device *pdev) +{ +struct device_node *np = pdev->dev.of_node; +struct device_node *parent =of_irq_find_parent (np); + +return qcom_pdc_init (np, parent); +} + +static const struct of_device_id qcom_pdc_match_table[] = { + { .compatible ="qcom,pdc" }, + {} +}; +MODULE_DEVICE_TABLE (of, qcom_pdc_match_table); + +static struct platform_driver qcom_pdc_driver = { + .probe = qcom_pdc_probe, + .driver = { + .name ="qcom-pdc" , + .of_match_table = qcom_pdc_match_table, + }, +}; +module_platform_driver (qcom_pdc_driver); +#else IRQCHIP_DECLARE (qcom_pdc,"qcom,pdc" , qcom_pdc_init); +#endif + +MODULE_DESCRIPTION ("Qualcomm Technologies, Inc. Power Domain Controller" ); +MODULE_LICENSE ("GPL v2" );
Signature · 6 lines
2.17.1 _______________________________________________ iommu mailing list [email protected] https://lists.linuxfoundation.org/mailman/listinfo/iommu
RFC PATCH 4/5 pinctrl: qcom: Allow pinctrl-msm code to be loadable as a module
In reply to John StultzTweaks to allow pinctrl-msm code to be loadable as a module. This is needed in order to support having the qcom-scm driver, which pinctrl-msm calls into, configured as a module.
--- drivers/pinctrl/qcom/Kconfig | 2 +- drivers/pinctrl/qcom/pinctrl-msm.c | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-)
drivers/pinctrl/qcom/Kconfig +1 -1
@@ -2,7 +2,7 @@ if (ARCH_QCOM || COMPILE_TEST) config PINCTRL_MSM - bool + tristate select PINMUX select PINCONF select GENERIC_PINCONF
drivers/pinctrl/qcom/pinctrl-msm.c +3 -0
@@ -1355,3 +1355,6 @@ int msm_pinctrl_remove(struct platform_device *pdev) }EXPORT_SYMBOL (msm_pinctrl_remove); +MODULE_DESCRIPTION ("Qualcomm Technologies, Inc. pinctrl-msm driver" ); +MODULE_LICENSE ("GPL v2" ); +
Signature · 6 lines
2.17.1 _______________________________________________ iommu mailing list [email protected] https://lists.linuxfoundation.org/mailman/listinfo/iommu
RFC PATCH 5/5 firmware: QCOM_SCM: Allow qcom_scm driver to be loadable as a permenent module
In reply to John StultzAllow the qcom_scm driver to be loadable as a permenent module.
--- drivers/firmware/Kconfig | 2 +- drivers/firmware/Makefile | 3 ++- drivers/firmware/qcom_scm.c | 4 ++++ drivers/iommu/Kconfig | 2 ++ 4 files changed, 9 insertions(+), 2 deletions(-)
drivers/firmware/Kconfig +1 -1
@@ -236,7 +236,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 select RESET_CONTROLLER
drivers/firmware/Makefile +2 -1
@@ -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
@@ -1155,6 +1155,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 = {
@@ -1170,3 +1171,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
@@ -381,6 +381,7 @@ config SPAPR_TCE_IOMMU config ARM_SMMU tristate "ARM Ltd. System MMU (SMMU) Support" depends on (ARM64 || ARM || (COMPILE_TEST && !GENERIC_ATOMIC64)) && MMU + 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
@@ -500,6 +501,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
Signature · 1 line
2.17.1
Re: [RFC][PATCH 5/5] firmware: QCOM_SCM: Allow qcom_scm driver to be loadable as a permenent module
Hi John,
+Will for the SMMU part.
Quoted 81 lines · John Stultz
Allow the
qcom_scmdriver to be loadable as a permenent module.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 Lina Iyer <[email protected]>Cc Saravana Kannan <[email protected]>Cc Todd Kjos <[email protected]>Cc Greg Kroah-Hartman <[email protected]>Signed-off-by John Stultz <[email protected]>--- drivers/firmware/Kconfig | 2 +- drivers/firmware/Makefile | 3 ++- drivers/firmware/qcom_scm.c | 4 ++++ drivers/iommu/Kconfig | 2 ++ 4 files changed, 9 insertions(+), 2 deletions(-)drivers/firmware/Kconfig +1
-1@@ -236,7 +236,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 select RESET_CONTROLLERdrivers/firmware/Makefile +2
-1@@ -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.odrivers/firmware/qcom_scm.c +1
-0@@ -1155,6 +1155,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 = {drivers/firmware/qcom_scm.c +3
-0.driver = {@@ -1170,3 +1171,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 +0
-0@@ -381,6 +381,7 @@ config SPAPR_TCE_IOMMU config ARM_SMMU tristate "ARM Ltd. System MMU (SMMU) Support" depends on (ARM64 || ARM || (COMPILE_TEST && !GENERIC_ATOMIC64)) &&MMU
drivers/iommu/Kconfig config SPAPR_TCE_IOMMU · line 384
Quoted 1 line
drivers/iommu/Kconfig +1
-0+ depends on QCOM_SCM || !QCOM_SCM #if QCOM_SCM=m this can't be =y
This looks a bit ugly. Could you explain why we need this at the SMMU level? I'd have expected the dependency to flow the other way around...
drivers/iommu/Kconfig config QCOM_IOMMU · line 507
Quoted 11 lines
drivers/iommu/Kconfig +1
-0select IOMMU_API select IOMMU_IO_PGTABLE_LPAE select ARM_DMA_USE_IOMMU if ARM@@ -500,6 +501,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
Thanks,
M.
Signature · 1 line
Jazz is not dead. It just smells funny...
Re: [RFC][PATCH 3/5] irqchip: Allow QCOM_PDC to be loadable as a perment module
In reply to John StultzHi,
Quoted 1 line · John Stultz
Allows qcom-pdc driver to be loaded as a permenent module
typo: permanent
Quoted 45 lines
Also, due to the fact that
IRQCHIP_DECLAREbecomes a no-op when building as a module, we have to add the platform driver hooks explicitly.Thanks to Saravana for his help on pointing out the
IRQCHIP_DECLAREissue and guidance on a solution.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 Lina Iyer <[email protected]>Cc Saravana Kannan <[email protected]>Cc Todd Kjos <[email protected]>Cc Greg Kroah-Hartman <[email protected]>Signed-off-by John Stultz <[email protected]>--- drivers/irqchip/Kconfig | 2 +- drivers/irqchip/qcom-pdc.c | 30 ++++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-)drivers/irqchip/Kconfig +1
-1@@ -425,7 +425,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 helpdrivers/irqchip/qcom-pdc.c +0
-0
drivers/irqchip/qcom-pdc.c line 16
Quoted 6 lines
drivers/irqchip/qcom-pdc.c +2
-0@@ -11,7 +11,9 @@#include <linux/irqdomain.h> #include <linux/io.h> #include <linux/kernel.h> +#include <linux/module.h> #include <linux/of.h> +#include <linux/of_irq.h>
please move this include in order after of_device.h
Quoted 17 lines
drivers/irqchip/qcom-pdc.c +10
-0#include <linux/of_address.h> #include <linux/of_device.h> #include <linux/soc/qcom/irq.h> @@ -430,4 +432,32 @@ static int qcom_pdc_init(struct device_node *node, struct device_node *parent)return ret; } +#ifdef MODULE +static int qcom_pdc_probe (struct platform_device *pdev) +{ +struct device_node *np = pdev->dev.of_node; +struct device_node *parent =of_irq_find_parent (np); + +return qcom_pdc_init (np, parent); +} + +static const struct of_device_id qcom_pdc_match_table[] = {
drivers/irqchip/qcom-pdc.c static int qcom_pdc_init(struct device_node *node, struct device_node *parent) · line 454
Quoted 10 lines
drivers/irqchip/qcom-pdc.c +10
-0+ { .compatible = "qcom,pdc" }, + {} +}; +MODULE_DEVICE_TABLE (of, qcom_pdc_match_table); + +static struct platform_driver qcom_pdc_driver = { + .probe = qcom_pdc_probe, + .driver = { + .name ="qcom-pdc" , + .of_match_table = qcom_pdc_match_table,
can you please set .suppress_bind_attrs = true,
This is to prevent bind/unbind using sysfs. Once irqchip driver module is loaded, it shouldn't get unbind at runtime.
Thanks,
Maulik
Quoted 9 lines
drivers/irqchip/qcom-pdc.c +8
-0+ }, +}; +module_platform_driver (qcom_pdc_driver); +#else IRQCHIP_DECLARE (qcom_pdc,"qcom,pdc" , qcom_pdc_init); +#endif + +MODULE_DESCRIPTION ("Qualcomm Technologies, Inc. Power Domain Controller" ); +MODULE_LICENSE ("GPL v2" );
Signature · 1 line
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
Re: [RFC][PATCH 3/5] irqchip: Allow QCOM_PDC to be loadable as a perment module
Quoted 87 lines · Maulik Shah
Hi,
Quoted 1 line · John Stultz
Allows qcom-pdc driver to be loaded as a permenent module
typo: permanent
Quoted 44 lines
Also, due to the fact that
IRQCHIP_DECLAREbecomes a no-op when building as a module, we have to add the platform driver hooks explicitly.Thanks to Saravana for his help on pointing out the
IRQCHIP_DECLAREissue and guidance on a solution.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 Lina Iyer <[email protected]>Cc Saravana Kannan <[email protected]>Cc Todd Kjos <[email protected]>Cc Greg Kroah-Hartman <[email protected]>Signed-off-by John Stultz <[email protected]>--- drivers/irqchip/Kconfig | 2 +- drivers/irqchip/qcom-pdc.c | 30 ++++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-)drivers/irqchip/Kconfig +1
-1@@ -425,7 +425,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 helpdrivers/irqchip/qcom-pdc.c +0
-0drivers/irqchip/qcom-pdc.c line 16
Quoted 6 lines
drivers/irqchip/qcom-pdc.c +2
-0@@ -11,7 +11,9 @@#include <linux/irqdomain.h> #include <linux/io.h> #include <linux/kernel.h> +#include <linux/module.h> #include <linux/of.h> +#include <linux/of_irq.h> please move this include in order after
of_device.hQuoted 16 lines
drivers/irqchip/qcom-pdc.c +10
-0#include <linux/of_address.h> #include <linux/of_device.h> #include <linux/soc/qcom/irq.h> @@ -430,4 +432,32 @@ static int qcom_pdc_init(struct device_node *node, struct device_node *parent)return ret; } +#ifdef MODULE +static int qcom_pdc_probe (struct platform_device *pdev) +{ +struct device_node *np = pdev->dev.of_node; +struct device_node *parent =of_irq_find_parent (np); + +return qcom_pdc_init (np, parent); +} + +static const struct of_device_id qcom_pdc_match_table[] = {drivers/irqchip/qcom-pdc.c static int qcom_pdc_init(struct device_node *node, struct device_node *parent) · line 453
Quoted 10 lines
drivers/irqchip/qcom-pdc.c +10
-0+ { .compatible = "qcom,pdc" }, + {} +}; +MODULE_DEVICE_TABLE (of, qcom_pdc_match_table); + +static struct platform_driver qcom_pdc_driver = { + .probe = qcom_pdc_probe, + .driver = { + .name ="qcom-pdc" , + .of_match_table = qcom_pdc_match_table,can you please set .suppress_bind_attrs = true,
Quoted 2 lines
This is to prevent bind/unbind using sysfs. Once irqchip driver module is loaded, it shouldn't get unbind at runtime.
That is a good point. We probably should do that to RPMH RSC driver as well.
Quoted 15 lines
Thanks,
MaulikQuoted 9 lines
drivers/irqchip/qcom-pdc.c +8
-0+ }, +}; +module_platform_driver (qcom_pdc_driver); +#else IRQCHIP_DECLARE (qcom_pdc,"qcom,pdc" , qcom_pdc_init); +#endif + +MODULE_DESCRIPTION ("Qualcomm Technologies, Inc. Power Domain Controller" ); +MODULE_LICENSE ("GPL v2" );Signature · 1 line
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
Re: [RFC][PATCH 5/5] firmware: QCOM_SCM: Allow qcom_scm driver to be loadable as a permenent module
In reply to Marc ZyngierQuoted 14 lines · Marc Zyngier
Quoted 10 lines · John Stultz
drivers/iommu/Kconfig +0
-0@@ -381,6 +381,7 @@ config SPAPR_TCE_IOMMU config ARM_SMMU tristate "ARM Ltd. System MMU (SMMU) Support" depends on (ARM64 || ARM || (COMPILE_TEST && !GENERIC_ATOMIC64)) &&MMU
+ depends onQCOM_SCM|| !QCOM_SCM #if QCOM_SCM=m this can't be =yThis looks a bit ugly. Could you explain why we need this at the SMMU level? I'd have expected the dependency to flow the other way around...
Yea, so the arm-smmu-qcom.c file calls directly into the qcom-scm code via qcom_scm_qsmmu500_wait_safe_toggle()
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/iommu/arm-smmu-qcom.c?h=v5.8-rc1#n44
So if ARM_SMMU=y and QCOM_SCM=m we get:drivers/iommu/arm-smmu-qcom.o: In function `qcom_smmu500_reset':
arm-smmu-qcom.c:(.text+0xb4): undefined reference to `qcom_scm_qsmmu500_wait_safe_toggle'
Do you have a suggestion for an alternative approach?
thanks
-john
Re: [RFC][PATCH 3/5] irqchip: Allow QCOM_PDC to be loadable as a perment module
In reply to Maulik ShahQuoted 90 lines · Maulik Shah
Hi,
Quoted 1 line · John Stultz
Allows qcom-pdc driver to be loaded as a permenent module
typo: permanent
Quoted 45 lines
Also, due to the fact that
IRQCHIP_DECLAREbecomes a no-op when building as a module, we have to add the platform driver hooks explicitly.Thanks to Saravana for his help on pointing out the
IRQCHIP_DECLAREissue and guidance on a solution.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 Lina Iyer <[email protected]>Cc Saravana Kannan <[email protected]>Cc Todd Kjos <[email protected]>Cc Greg Kroah-Hartman <[email protected]>Signed-off-by John Stultz <[email protected]>--- drivers/irqchip/Kconfig | 2 +- drivers/irqchip/qcom-pdc.c | 30 ++++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-)drivers/irqchip/Kconfig +1
-1@@ -425,7 +425,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 helpdrivers/irqchip/qcom-pdc.c +0
-0drivers/irqchip/qcom-pdc.c line 16
Quoted 6 lines
drivers/irqchip/qcom-pdc.c +2
-0@@ -11,7 +11,9 @@#include <linux/irqdomain.h> #include <linux/io.h> #include <linux/kernel.h> +#include <linux/module.h> #include <linux/of.h> +#include <linux/of_irq.h> please move this include in order after
of_device.hQuoted 17 lines
drivers/irqchip/qcom-pdc.c +10
-0#include <linux/of_address.h> #include <linux/of_device.h> #include <linux/soc/qcom/irq.h> @@ -430,4 +432,32 @@ static int qcom_pdc_init(struct device_node *node, struct device_node *parent)return ret; } +#ifdef MODULE +static int qcom_pdc_probe (struct platform_device *pdev) +{ +struct device_node *np = pdev->dev.of_node; +struct device_node *parent =of_irq_find_parent (np); + +return qcom_pdc_init (np, parent); +} + +static const struct of_device_id qcom_pdc_match_table[] = {drivers/irqchip/qcom-pdc.c static int qcom_pdc_init(struct device_node *node, struct device_node *parent) · line 454
Quoted 10 lines
drivers/irqchip/qcom-pdc.c +10
-0+ { .compatible = "qcom,pdc" }, + {} +}; +MODULE_DEVICE_TABLE (of, qcom_pdc_match_table); + +static struct platform_driver qcom_pdc_driver = { + .probe = qcom_pdc_probe, + .driver = { + .name ="qcom-pdc" , + .of_match_table = qcom_pdc_match_table,can you please set .suppress_bind_attrs = true,
Quoted 2 lines
This is to prevent bind/unbind using sysfs. Once irqchip driver module is loaded, it shouldn't get unbind at runtime.
Thanks, I really appreciate the review! I've made these changes on my side and they'll be included in v2.
thanks
-john
Re: [RFC][PATCH 4/5] pinctrl: qcom: Allow pinctrl-msm code to be loadable as a module
In reply to John StultzQuoted 4 lines · John Stultz
Tweaks to allow pinctrl-msm code to be loadable as a module. This is needed in order to support having the qcom-scm driver, which pinctrl-msm calls into, configured as a module.
Quoted 15 lines
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 Lina Iyer <[email protected]>Cc Saravana Kannan <[email protected]>Cc Todd Kjos <[email protected]>Cc Greg Kroah-Hartman <[email protected]>Signed-off-by John Stultz <[email protected]>
Unless there are dependencies on the irqchip patches I can apply this if Bjorn is OK with it.
Yours,
Linus Walleij
_______________________________________________
iommu mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/iommu
Re: [RFC][PATCH 4/5] pinctrl: qcom: Allow pinctrl-msm code to be loadable as a module
In reply to John StultzQuoted 4 lines · John Stultz
Tweaks to allow pinctrl-msm code to be loadable as a module. This is needed in order to support having the qcom-scm driver, which pinctrl-msm calls into, configured as a module.
This means that we need a "depends on QCOM_SCM || QCOM_SCM=n" on all entries in the Kconfig that selects PINCTRL_MSM, or switch PINCTRL_MSM to be user selectable and make all the others depend on it.
Quoted 38 lines
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 Lina Iyer <[email protected]>Cc Saravana Kannan <[email protected]>Cc Todd Kjos <[email protected]>Cc Greg Kroah-Hartman <[email protected]>Signed-off-by John Stultz <[email protected]>--- drivers/pinctrl/qcom/Kconfig | 2 +- drivers/pinctrl/qcom/pinctrl-msm.c | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-)drivers/pinctrl/qcom/Kconfig +1
-1@@ -2,7 +2,7 @@ if (ARCH_QCOM || COMPILE_TEST) config PINCTRL_MSM - bool + tristate select PINMUX select PINCONF select GENERIC_PINCONFdrivers/pinctrl/qcom/pinctrl-msm.c +0
-0
drivers/pinctrl/qcom/pinctrl-msm.c int msm_pinctrl_remove(struct platform_device *pdev) · line 1358
Quoted 4 lines
drivers/pinctrl/qcom/pinctrl-msm.c +1
-0@@ -1355,3 +1355,6 @@ int msm_pinctrl_remove(struct platform_device *pdev) }EXPORT_SYMBOL (msm_pinctrl_remove); +MODULE_DESCRIPTION ("Qualcomm Technologies, Inc. pinctrl-msm driver" );
It's the "Qualcomm Technologies, Inc. TLMM driver"
drivers/pinctrl/qcom/pinctrl-msm.c int msm_pinctrl_remove(struct platform_device *pdev) · line 1360
Quoted 2 lines
drivers/pinctrl/qcom/pinctrl-msm.c +2
-0+MODULE_LICENSE ("GPL v2" ); +
Please don't retain my empty line at the end of this file :)
Regards,
Bjorn
Quoted 3 lines
Signature · 1 line
2.17.1
Re: [RFC][PATCH 4/5] pinctrl: qcom: Allow pinctrl-msm code to be loadable as a module
Quoted 11 lines · Bjorn Andersson
Quoted 4 lines · John Stultz
Tweaks to allow pinctrl-msm code to be loadable as a module. This is needed in order to support having the qcom-scm driver, which pinctrl-msm calls into, configured as a module.
This means that we need a "depends on
QCOM_SCM|| QCOM_SCM=n" on all entries in theKconfigthat selectsPINCTRL_MSM, or switchPINCTRL_MSMto be user selectable and make all the others depend on it.
Oh, good point! I already had to fix that in a different tree, but forgot to move the fix over to my upstreaming tree.
Quoted 9 lines
Quoted 2 lines
+MODULE_DESCRIPTION("Qualcomm Technologies, Inc. pinctrl-msm driver");
It's the "Qualcomm Technologies, Inc. TLMM driver"
drivers/pinctrl/qcom/pinctrl-msm.c int msm_pinctrl_remove(struct platform_device *pdev) · line 1360
Quoted 2 lines
drivers/pinctrl/qcom/pinctrl-msm.c +2
-0+MODULE_LICENSE ("GPL v2" ); +Please don't retain my empty line at the end of this file :)
Done and done. Thanks so much for the review!
-john
_______________________________________________
iommu mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/iommu
Will Deacon
maintainerRe: [RFC][PATCH 5/5] firmware: QCOM_SCM: Allow qcom_scm driver to be loadable as a permenent module
In reply to John StultzQuoted 20 lines · John Stultz
Quoted 14 lines · Marc Zyngier
Quoted 10 lines · John Stultz
drivers/iommu/Kconfig +0
-0@@ -381,6 +381,7 @@ config SPAPR_TCE_IOMMU config ARM_SMMU tristate "ARM Ltd. System MMU (SMMU) Support" depends on (ARM64 || ARM || (COMPILE_TEST && !GENERIC_ATOMIC64)) &&MMU
+ depends onQCOM_SCM|| !QCOM_SCM #if QCOM_SCM=m this can't be =yThis looks a bit ugly. Could you explain why we need this at the SMMU level? I'd have expected the dependency to flow the other way around...
Yea, so the
arm-smmu-qcom.cfile calls directly into the qcom-scm code viaqcom_scm_qsmmu500_wait_safe_toggle()
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/iommu/arm-smmu-qcom.c?h=v5.8-rc1#n44
Quoted 6 lines
So if ARM_SMMU=y and QCOM_SCM=m we get:
drivers/iommu/arm-smmu-qcom.o: In function `qcom_smmu500_reset':
arm-smmu-qcom.c:(.text+0xb4): undefined reference to `qcom_scm_qsmmu500_wait_safe_toggle'Do you have a suggestion for an alternative approach?
Can you use symbol_get() or something like that? How are module dependencies handled by other drivers?
Will
Re: [RFC][PATCH 5/5] firmware: QCOM_SCM: Allow qcom_scm driver to be loadable as a permenent module
Quoted 26 lines · Will Deacon
Quoted 25 lines · John Stultz
Quoted 14 lines · Marc Zyngier
Quoted 10 lines · John Stultz
drivers/iommu/Kconfig +0
-0@@ -381,6 +381,7 @@ config SPAPR_TCE_IOMMU config ARM_SMMU tristate "ARM Ltd. System MMU (SMMU) Support" depends on (ARM64 || ARM || (COMPILE_TEST && !GENERIC_ATOMIC64)) &&MMU
+ depends onQCOM_SCM|| !QCOM_SCM #if QCOM_SCM=m this can't be =yThis looks a bit ugly. Could you explain why we need this at the SMMU level? I'd have expected the dependency to flow the other way around...
Yea, so the
arm-smmu-qcom.cfile calls directly into the qcom-scm code viaqcom_scm_qsmmu500_wait_safe_toggle()
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/iommu/arm-smmu-qcom.c?h=v5.8-rc1#n44So if ARM_SMMU=y and QCOM_SCM=m we get:
drivers/iommu/arm-smmu-qcom.o: In function `qcom_smmu500_reset':
arm-smmu-qcom.c:(.text+0xb4): undefined reference to `qcom_scm_qsmmu500_wait_safe_toggle'
Quoted 4 lines
Quoted 1 line
Do you have a suggestion for an alternative approach?
Can you use
symbol_get()or something like that? How are module dependencies handled by other drivers?
So drivers deal with this by making rules in Kconfig which will prohibit this case. QCOM_SCM depends on ARM_SMMU with the caveat that if ARM_SMMU is a module, QCOM_SCM cant be inbuilt.
This can be done by adding below line in Kconfig for QCOM_SCM:
depends on ARM_SMMU || !ARM_SMMU
This is quite prevalent is drivers to ensure dependency like this
Thanks
Signature · 1 line
~Vinod