[PATCH v2] firmware: arm_scmi: Give SMC transport precedence over mailbox

Florian Fainelli posted 1 patch 1 month, 2 weeks ago
drivers/firmware/arm_scmi/transports/Makefile | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
[PATCH v2] firmware: arm_scmi: Give SMC transport precedence over mailbox
Posted by Florian Fainelli 1 month, 2 weeks ago
Broadcom STB platforms have for historical reasons included both
"arm,scmi-smc" and "arm,scmi" in their SCMI Device Tree node compatible
string, in that order.

After the commit cited in the Fixes tag and with a kernel configuration
that enables both the SMC and the Mailbox transports, we would probe
the mailbox transport, but fail to complete since we would not have a
mailbox driver available. With each SCMI transport being a platform
driver with its own set of compatible strings to match, rather than an
unique platform driver entry point, we no longer match from most
specific to least specific. There is also no simple way for the mailbox
driver to return -ENODEV and let another platform driver attempt
probing. This leads to a platform with no SCMI provider, therefore all
drivers depending upon SCMI resources are put on deferred probe forever.

By keeping the SMC transport objects linked first, we can let the
platform driver match the compatible string and probe successfully with
no adverse effects on platforms using the mailbox transport.

Fixes: b53515fa177c ("firmware: arm_scmi: Make MBOX transport a standalone driver")
Signed-off-by: Florian Fainelli <florian.fainelli@broadcom.com>
---
Changes in v2:

- removed downstream Change-Id
- s/SCMI/SMC in the second paragraph
- added details about what changed and how that affects the probing

 drivers/firmware/arm_scmi/transports/Makefile | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/firmware/arm_scmi/transports/Makefile b/drivers/firmware/arm_scmi/transports/Makefile
index 362a406f08e6..3ba3d3bee151 100644
--- a/drivers/firmware/arm_scmi/transports/Makefile
+++ b/drivers/firmware/arm_scmi/transports/Makefile
@@ -1,8 +1,10 @@
 # SPDX-License-Identifier: GPL-2.0-only
-scmi_transport_mailbox-objs := mailbox.o
-obj-$(CONFIG_ARM_SCMI_TRANSPORT_MAILBOX) += scmi_transport_mailbox.o
+# Keep before scmi_transport_mailbox.o to allow precedence
+# while matching the compatible.
 scmi_transport_smc-objs := smc.o
 obj-$(CONFIG_ARM_SCMI_TRANSPORT_SMC) += scmi_transport_smc.o
+scmi_transport_mailbox-objs := mailbox.o
+obj-$(CONFIG_ARM_SCMI_TRANSPORT_MAILBOX) += scmi_transport_mailbox.o
 scmi_transport_optee-objs := optee.o
 obj-$(CONFIG_ARM_SCMI_TRANSPORT_OPTEE) += scmi_transport_optee.o
 scmi_transport_virtio-objs := virtio.o
-- 
2.34.1
Re: [PATCH v2] firmware: arm_scmi: Give SMC transport precedence over mailbox
Posted by Sudeep Holla 1 month, 1 week ago
On Mon, 07 Oct 2024 16:54:13 -0700, Florian Fainelli wrote:
> Broadcom STB platforms have for historical reasons included both
> "arm,scmi-smc" and "arm,scmi" in their SCMI Device Tree node compatible
> string, in that order.
> 
> After the commit cited in the Fixes tag and with a kernel configuration
> that enables both the SMC and the Mailbox transports, we would probe
> the mailbox transport, but fail to complete since we would not have a
> mailbox driver available. With each SCMI transport being a platform
> driver with its own set of compatible strings to match, rather than an
> unique platform driver entry point, we no longer match from most
> specific to least specific. There is also no simple way for the mailbox
> driver to return -ENODEV and let another platform driver attempt
> probing. This leads to a platform with no SCMI provider, therefore all
> drivers depending upon SCMI resources are put on deferred probe forever.
> 
> [...]

Applied to sudeep.holla/linux (for-next/scmi/fixes), thanks!

[1/1] firmware: arm_scmi: Give SMC transport precedence over mailbox
      https://git.kernel.org/sudeep.holla/c/db8f0b808886
--
Regards,
Sudeep
Re: [PATCH v2] firmware: arm_scmi: Give SMC transport precedence over mailbox
Posted by Cristian Marussi 1 month, 2 weeks ago
On Mon, Oct 07, 2024 at 04:54:13PM -0700, Florian Fainelli wrote:
> Broadcom STB platforms have for historical reasons included both
> "arm,scmi-smc" and "arm,scmi" in their SCMI Device Tree node compatible
> string, in that order.
> 
> After the commit cited in the Fixes tag and with a kernel configuration
> that enables both the SMC and the Mailbox transports, we would probe
> the mailbox transport, but fail to complete since we would not have a
> mailbox driver available. With each SCMI transport being a platform
> driver with its own set of compatible strings to match, rather than an
> unique platform driver entry point, we no longer match from most
> specific to least specific. There is also no simple way for the mailbox
> driver to return -ENODEV and let another platform driver attempt
> probing. This leads to a platform with no SCMI provider, therefore all
> drivers depending upon SCMI resources are put on deferred probe forever.
> 
> By keeping the SMC transport objects linked first, we can let the
> platform driver match the compatible string and probe successfully with
> no adverse effects on platforms using the mailbox transport.
> 
> Fixes: b53515fa177c ("firmware: arm_scmi: Make MBOX transport a standalone driver")
> Signed-off-by: Florian Fainelli <florian.fainelli@broadcom.com>

I was hoping to find some way to avoid this workaround....
...but I failed :P ... so

LGTM.
Reviewed-by: Cristian Marussi <cristian.marussi@arm.com>

Thanks,
Cristian