Skip to contentSkip to conversation

mailbox: qcom: Support building QCOM IPCC driver as module

PATCH In review Huang Yiwei 2 participants 3 messages Oct 21, 2020 – Oct 23, 2020

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

PATCH 1/1 mailbox: qcom: Support building QCOM IPCC driver as module

Change CONFIG_QCOM_IPCC to tristate and add exit function to support module build for QCOM IPCC driver.

---
 drivers/mailbox/Kconfig     | 2 +-
 drivers/mailbox/qcom-ipcc.c | 6 ++++++
 2 files changed, 7 insertions(+), 1 deletion(-)
drivers/mailbox/Kconfig +1 -1
index 05b1009..78f3006 100644
@@ -245,7 +245,7 @@ config SPRD_MBOX
 	  you want to build the Spreatrum mailbox controller driver.
 
 config QCOM_IPCC
-	bool "Qualcomm Technologies, Inc. IPCC driver"
+	tristate "Qualcomm Technologies, Inc. IPCC driver"
 	depends on ARCH_QCOM || COMPILE_TEST
 	help
 	  Qualcomm Technologies, Inc. Inter-Processor Communication Controller
drivers/mailbox/qcom-ipcc.c +6 -0
index 2d13c72..1ed9a87 100644
@@ -280,6 +280,12 @@ static int __init qcom_ipcc_init(void)
 }
 arch_initcall(qcom_ipcc_init);
 
+static __exit void qcom_ipcc_exit(void)
+{
+	platform_driver_unregister(&qcom_ipcc_driver);
+}
+module_exit(qcom_ipcc_exit);
+
 MODULE_AUTHOR("Venkata Narendra Kumar Gutta <[email protected]>");
 MODULE_AUTHOR("Manivannan Sadhasivam <[email protected]>");
 MODULE_DESCRIPTION("Qualcomm Technologies, Inc. IPCC driver");
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project
#1 lore raw

Hi,

Please CC the driver maintainer(s) for relevant patches. For this driver, I've been listed as the maintainer in the MAINTAINERS file.

Quoted 3 lines · Huang Yiwei

Change CONFIG_QCOM_IPCC to tristate and add exit function to support module build for QCOM IPCC driver.

This is not going to work, sorry! There was a reason to make this driver built-in in the first place. This driver registers itself as an irqchip and provides interrupts to be consumed by the client drivers. So if we want to unload the driver, then we should make sure to dispose all irqs consumed by the client drivers and that's not possible currently. If you look into other irqchip drivers, they're all made as built-in.

Thanks,
Mani

Quoted 40 lines
---
 drivers/mailbox/Kconfig     | 2 +-
 drivers/mailbox/qcom-ipcc.c | 6 ++++++
 2 files changed, 7 insertions(+), 1 deletion(-)
drivers/mailbox/Kconfig +1 -1
index 05b1009..78f3006 100644
@@ -245,7 +245,7 @@ config SPRD_MBOX
 	  you want to build the Spreatrum mailbox controller driver.
 
 config QCOM_IPCC
-	bool "Qualcomm Technologies, Inc. IPCC driver"
+	tristate "Qualcomm Technologies, Inc. IPCC driver"
 	depends on ARCH_QCOM || COMPILE_TEST
 	help
 	  Qualcomm Technologies, Inc. Inter-Processor Communication Controller
drivers/mailbox/qcom-ipcc.c +6 -0
index 2d13c72..1ed9a87 100644
@@ -280,6 +280,12 @@ static int __init qcom_ipcc_init(void)
 }
 arch_initcall(qcom_ipcc_init);
 
+static __exit void qcom_ipcc_exit(void)
+{
+	platform_driver_unregister(&qcom_ipcc_driver);
+}
+module_exit(qcom_ipcc_exit);
+
 MODULE_AUTHOR("Venkata Narendra Kumar Gutta <[email protected]>");
 MODULE_AUTHOR("Manivannan Sadhasivam <[email protected]>");
 MODULE_DESCRIPTION("Qualcomm Technologies, Inc. IPCC driver");
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project
#2 lore raw
Quoted 17 lines · Manivannan Sadhasivam

Hi,

Please CC the driver maintainer(s) for relevant patches. For this driver, I've been listed as the maintainer in the MAINTAINERS file.

Quoted 3 lines · Huang Yiwei

Change CONFIG_QCOM_IPCC to tristate and add exit function to support module build for QCOM IPCC driver.

This is not going to work, sorry! There was a reason to make this driver built-in in the first place. This driver registers itself as an irqchip and provides interrupts to be consumed by the client drivers. So if we want to unload the driver, then we should make sure to dispose all irqs consumed by the client drivers and that's not possible currently. If you look into other irqchip drivers, they're all made as built-in.

Quoted 3 lines

Thanks,
Mani

Hi,

We need the module build of IPCC to meet the need of Android GKI, which requires all vendor drivers to be modules.
After discussion, we think there are three ways to achieve the goal:
1. Remove the exit function, just change the Kconfig to make it a module cannot be unloaded.
2. Add more checks to ensure the module can be unloaded safely. If user try to unload when it is in use, return busy.
3. If unable to change the Kconfig, we will have to ask google to make this driver built-in. This can be difficult because other vendors don't need this driver.
We understood that mostly irqchip driver is builtin and not easy for unload. So we prefer the first way, that's the easiest and most reasonable way.

Thanks,
Yiwei

Quoted 43 lines
Quoted 43 lines
---
 drivers/mailbox/Kconfig     | 2 +-
 drivers/mailbox/qcom-ipcc.c | 6 ++++++
 2 files changed, 7 insertions(+), 1 deletion(-)
drivers/mailbox/Kconfig +1 -1
index 05b1009..78f3006 100644
@@ -245,7 +245,7 @@ config SPRD_MBOX
 	  you want to build the Spreatrum mailbox controller driver.
 
 config QCOM_IPCC
-	bool "Qualcomm Technologies, Inc. IPCC driver"
+	tristate "Qualcomm Technologies, Inc. IPCC driver"
 	depends on ARCH_QCOM || COMPILE_TEST
 	help
 	  Qualcomm Technologies, Inc. Inter-Processor Communication 

Controller

drivers/mailbox/qcom-ipcc.c +6 -0
index 2d13c72..1ed9a87 100644
@@ -280,6 +280,12 @@ static int __init qcom_ipcc_init(void)
 }
 arch_initcall(qcom_ipcc_init);
 
+static __exit void qcom_ipcc_exit(void)
+{
+	platform_driver_unregister(&qcom_ipcc_driver);
+}
+module_exit(qcom_ipcc_exit);
+
 MODULE_AUTHOR("Venkata Narendra Kumar Gutta 
 <[email protected]>");
 MODULE_AUTHOR("Manivannan Sadhasivam 

<[email protected]>");
MODULE_DESCRIPTION("Qualcomm Technologies, Inc. IPCC driver");
--
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project