firmware: arm_scmi: Add the raw mode co-existence support
authorCristian Marussi <cristian.marussi@arm.com>
Wed, 18 Jan 2023 12:14:25 +0000 (12:14 +0000)
committerSudeep Holla <sudeep.holla@arm.com>
Fri, 20 Jan 2023 11:41:31 +0000 (11:41 +0000)
When the raw support is enabled and configured in co-existence mode the
normal SCMI drivers are allowed to register with the SCMI core and
operate as usual alongside the raw operations.

SCMI normal and raw messages will be kept segregated from each other,
but only at the transaction level. Any further possible interference at
the protocol layer will have instead to be handled by the user to attain
reliable results while using the raw transactions.

Signed-off-by: Cristian Marussi <cristian.marussi@arm.com>
Tested-by: Florian Fainelli <f.fainelli@gmail.com>
Tested-by: Vincent Guittot <vincent.guittot@linaro.org>
Link: https://lore.kernel.org/r/20230118121426.492864-17-cristian.marussi@arm.com
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
drivers/firmware/arm_scmi/Kconfig
drivers/firmware/arm_scmi/bus.c
drivers/firmware/arm_scmi/driver.c
drivers/firmware/arm_scmi/raw_mode.c

index 3b4f9e92b1e31c067f430f1d9a643f55aaf1c91d..ea0f5083ac47f12718a137cc6f63ccec55704cdb 100644 (file)
@@ -45,6 +45,16 @@ config ARM_SCMI_RAW_MODE_SUPPORT
          order to avoid unexpected interactions with the SCMI Raw message
          flow. If unsure say N.
 
+config ARM_SCMI_RAW_MODE_SUPPORT_COEX
+       bool "Allow SCMI Raw mode coexistence with normal SCMI stack"
+       depends on ARM_SCMI_RAW_MODE_SUPPORT
+       help
+         Allow SCMI Raw transmission mode to coexist with normal SCMI stack.
+
+         This will allow regular SCMI drivers to register with the core and
+         operate normally, thing which could make an SCMI test suite using the
+         SCMI Raw mode support unreliable. If unsure, say N.
+
 config ARM_SCMI_HAVE_TRANSPORT
        bool
        help
index 8601d75f5b9bfe78d3ea17e9ecb5506c8f935bd9..68cc4b4290c109e490da5f4bbd589c082d8b2d62 100644 (file)
@@ -59,7 +59,8 @@ 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_RAW_MODE_SUPPORT)) {
+       if (IS_ENABLED(CONFIG_ARM_SCMI_RAW_MODE_SUPPORT) &&
+           !IS_ENABLED(CONFIG_ARM_SCMI_RAW_MODE_SUPPORT_COEX)) {
                pr_warn("SCMI Raw mode active. Rejecting '%s'/0x%02X\n",
                        id_table->name, id_table->protocol_id);
                return -EINVAL;
index ad4e53f0c34224aebf1d533a7a627a0234551396..282d7737cb8f510f2462d63d7df4b732ab1d26bf 100644 (file)
@@ -2616,7 +2616,6 @@ static int scmi_debugfs_raw_mode_setup(struct scmi_info *info)
        info->raw = scmi_raw_mode_init(&info->handle, info->dbg->top_dentry,
                                       info->id, info->desc,
                                       info->tx_minfo.max_msg);
-
        if (IS_ERR(info->raw)) {
                dev_err(info->dev, "Failed to initialize SCMI RAW Mode !\n");
                ret = PTR_ERR(info->raw);
@@ -2706,11 +2705,20 @@ static int scmi_probe(struct platform_device *pdev)
                        dev_warn(dev, "Failed to setup SCMI debugfs.\n");
 
                if (IS_ENABLED(CONFIG_ARM_SCMI_RAW_MODE_SUPPORT)) {
+                       bool coex =
+                             IS_ENABLED(CONFIG_ARM_SCMI_RAW_MODE_SUPPORT_COEX);
+
                        ret = scmi_debugfs_raw_mode_setup(info);
-                       if (ret)
-                               goto clear_dev_req_notifier;
+                       if (!coex) {
+                               if (ret)
+                                       goto clear_dev_req_notifier;
+
+                               /* Bail out anyway when coex enabled */
+                               return ret;
+                       }
 
-                       return 0;
+                       /* Coex enabled, carry on in any case. */
+                       dev_info(dev, "SCMI RAW Mode COEX enabled !\n");
                }
        }
 
index a33ef0eaffe5a5fdcb89d48cccaa9728e327d119..037ef9c14faef22e25eefcb75cc77ae4a8e4492d 100644 (file)
  * In order to avoid possible interferences between the SCMI Raw transactions
  * originated from a test-suite and the normal operations of the SCMI drivers,
  * when Raw mode is enabled, by default, all the regular SCMI drivers are
- * inhibited.
+ * inhibited, unless CONFIG_ARM_SCMI_RAW_MODE_SUPPORT_COEX is enabled: in this
+ * latter case the regular SCMI stack drivers will be loaded as usual and it is
+ * up to the user of this interface to take care of manually inhibiting the
+ * regular SCMI drivers in order to avoid interferences during the test runs.
  *
  * The exposed API is as follows.
  *