[RFC PATCH 16/16] [DEBUG]: firmware: arm_scmi: Add Kconfig to allow SCMI Testing driver coexistence

Cristian Marussi cristian.marussi at arm.com
Sun Feb 27 12:56:08 PST 2022


firmware: arm_scmi: Add Kconfig to allow SCMI Testing driver coexistence

Signed-off-by: Cristian Marussi <cristian.marussi at arm.com>
---
 drivers/firmware/arm_scmi/Kconfig  |  6 ++++++
 drivers/firmware/arm_scmi/driver.c | 15 ++++++++-------
 2 files changed, 14 insertions(+), 7 deletions(-)

diff --git a/drivers/firmware/arm_scmi/Kconfig b/drivers/firmware/arm_scmi/Kconfig
index a3726074c89e..c3fc608d5373 100644
--- a/drivers/firmware/arm_scmi/Kconfig
+++ b/drivers/firmware/arm_scmi/Kconfig
@@ -160,4 +160,10 @@ config ARM_SCMI_TEST_DRIVER
 	  This driver can also be built as a module.  If so, the module
 	  will be called scmi_test_driver.
 
+config ARM_SCMI_TEST_DRIVER_COEXISTENCE
+	bool "Allow Coexistence of SCMI standard drivers and test driver"
+	depends on ARM_SCMI_TEST_DRIVER
+	help
+	  This enables coexistence for concurrent SCMI drievrs and testing driver.
+
 endmenu
diff --git a/drivers/firmware/arm_scmi/driver.c b/drivers/firmware/arm_scmi/driver.c
index 8c4706b24368..ff692c458a0b 100644
--- a/drivers/firmware/arm_scmi/driver.c
+++ b/drivers/firmware/arm_scmi/driver.c
@@ -1782,14 +1782,15 @@ static int scmi_protocol_device_request(const struct scmi_device_id *id_table)
 	pr_debug("Requesting SCMI device (%s) for protocol %x\n",
 		 id_table->name, id_table->protocol_id);
 
-#if IS_ENABLED(CONFIG_ARM_SCMI_TEST_DRIVER)
-	/* Reject non-testing SCMI drivers */
-	if (strncmp(id_table->name, "__scmi_test", strlen("__scmi_test"))) {
-		pr_warn("SCMI Test driver loaded. Rejecting '%s'/0x%X\n",
-			id_table->name, id_table->protocol_id);
-		return -EINVAL;
+	if (IS_ENABLED(CONFIG_ARM_SCMI_TEST_DRIVER) &&
+	    !IS_ENABLED(CONFIG_ARM_SCMI_TEST_DRIVER_COEXISTENCE)) {
+		/* Reject non-testing SCMI drivers */
+		if (strncmp(id_table->name, "__scmi_test", strlen("__scmi_test"))) {
+			pr_warn("SCMI Test driver loaded. Rejecting driver: '%s'/0x%X\n",
+				id_table->name, id_table->protocol_id);
+			return -EBUSY;
+		}
 	}
-#endif
 
 	/*
 	 * Search for the matching protocol rdev list and then search
-- 
2.17.1




More information about the linux-arm-kernel mailing list