linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] firmware: arm_scmi: Give SMC transport precedence over mailbox
@ 2024-10-07 23:54 Florian Fainelli
  2024-10-08  2:14 ` Peng Fan
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Florian Fainelli @ 2024-10-07 23:54 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: Florian Fainelli, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Sudeep Holla, Cristian Marussi,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	open list,
	open list:SYSTEM CONTROL & POWER/MANAGEMENT INTERFACE,
	moderated list:SYSTEM CONTROL & POWER/MANAGEMENT INTERFACE,
	justin.chen, opendmb, kapil.hali, bcm-kernel-feedback-list,
	Arnd Bergmann

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



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* RE: [PATCH v2] firmware: arm_scmi: Give SMC transport precedence over mailbox
  2024-10-07 23:54 [PATCH v2] firmware: arm_scmi: Give SMC transport precedence over mailbox Florian Fainelli
@ 2024-10-08  2:14 ` Peng Fan
  2024-10-08 16:17   ` Florian Fainelli
  2024-10-11 13:47 ` Cristian Marussi
  2024-10-15 13:16 ` Sudeep Holla
  2 siblings, 1 reply; 5+ messages in thread
From: Peng Fan @ 2024-10-08  2:14 UTC (permalink / raw)
  To: Florian Fainelli, linux-arm-kernel@lists.infreadead.org
  Cc: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Sudeep Holla,
	Cristian Marussi,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	open list,
	open list:SYSTEM CONTROL & POWER/MANAGEMENT INTERFACE,
	moderated list:SYSTEM CONTROL & POWER/MANAGEMENT INTERFACE,
	justin.chen@broadcom.com, opendmb@gmail.com,
	kapil.hali@broadcom.com, bcm-kernel-feedback-list@broadcom.com,
	Arnd Bergmann

> Subject: [PATCH v2] firmware: arm_scmi: Give SMC transport
> precedence over mailbox
> 
> 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.

If compatible = "arm,scmi-smc", "arm,scmi", smc driver should be used.
or I missed something?

> 
> 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) +=

This seems more like a hack.

Regards,
Peng.

> 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
> 



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] firmware: arm_scmi: Give SMC transport precedence over mailbox
  2024-10-08  2:14 ` Peng Fan
@ 2024-10-08 16:17   ` Florian Fainelli
  0 siblings, 0 replies; 5+ messages in thread
From: Florian Fainelli @ 2024-10-08 16:17 UTC (permalink / raw)
  To: Peng Fan, linux-arm-kernel@lists.infreadead.org
  Cc: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Sudeep Holla,
	Cristian Marussi,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	open list,
	open list:SYSTEM CONTROL & POWER/MANAGEMENT INTERFACE,
	moderated list:SYSTEM CONTROL & POWER/MANAGEMENT INTERFACE,
	justin.chen@broadcom.com, opendmb@gmail.com,
	kapil.hali@broadcom.com, bcm-kernel-feedback-list@broadcom.com,
	Arnd Bergmann

On 10/7/24 19:14, Peng Fan wrote:
>> Subject: [PATCH v2] firmware: arm_scmi: Give SMC transport
>> precedence over mailbox
>>
>> 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.
> 
> If compatible = "arm,scmi-smc", "arm,scmi", smc driver should be used.
> or I missed something?

That seems to indicate that the commit message was not explaining the 
issue clearly enough. Let me try again. While we had a single arm_scmi 
platform device/driver, we could match the above compatible string from 
most specific to least specific, and therefore the "smc" transport would 
be used.

Once the transport drivers each got broken up and became independent, 
and depending upon the order in which they are linked into the kernel, 
we will have mailbox.o being the first module_platform_driver entry 
attempt to match "arm,scmi" because that is the only entry it has in its 
of_match table. That matching succeeds, but later down the road we will 
fail to initialize the SCMI channel due to the lack of a suitable 
mailbox driver and set of Device Tree properties.

Because there is no fallback to try another transport, we just get stuck 
here.

> 
>>
>> 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) +=
> 
> This seems more like a hack.

Yes, this is a hack, but it does not affect other platforms, and it 
helps us continue to test stable, linux-next and any kernel, therefore 
we would appreciate having this ability since we do provide testing for 
stable kernels, unlike other vendors.
-- 
Florian


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] firmware: arm_scmi: Give SMC transport precedence over mailbox
  2024-10-07 23:54 [PATCH v2] firmware: arm_scmi: Give SMC transport precedence over mailbox Florian Fainelli
  2024-10-08  2:14 ` Peng Fan
@ 2024-10-11 13:47 ` Cristian Marussi
  2024-10-15 13:16 ` Sudeep Holla
  2 siblings, 0 replies; 5+ messages in thread
From: Cristian Marussi @ 2024-10-11 13:47 UTC (permalink / raw)
  To: Florian Fainelli
  Cc: linux-arm-kernel, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Sudeep Holla, Cristian Marussi,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	open list,
	open list:SYSTEM CONTROL & POWER/MANAGEMENT INTERFACE,
	moderated list:SYSTEM CONTROL & POWER/MANAGEMENT INTERFACE,
	justin.chen, opendmb, kapil.hali, bcm-kernel-feedback-list,
	Arnd Bergmann

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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] firmware: arm_scmi: Give SMC transport precedence over mailbox
  2024-10-07 23:54 [PATCH v2] firmware: arm_scmi: Give SMC transport precedence over mailbox Florian Fainelli
  2024-10-08  2:14 ` Peng Fan
  2024-10-11 13:47 ` Cristian Marussi
@ 2024-10-15 13:16 ` Sudeep Holla
  2 siblings, 0 replies; 5+ messages in thread
From: Sudeep Holla @ 2024-10-15 13:16 UTC (permalink / raw)
  To: linux-arm-kernel, Florian Fainelli
  Cc: Sudeep Holla, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Cristian Marussi, devicetree, linux-kernel, arm-scmi,
	linux-arm-kernel, justin.chen, opendmb, kapil.hali,
	bcm-kernel-feedback-list, Arnd Bergmann

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



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-10-15 13:19 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-07 23:54 [PATCH v2] firmware: arm_scmi: Give SMC transport precedence over mailbox Florian Fainelli
2024-10-08  2:14 ` Peng Fan
2024-10-08 16:17   ` Florian Fainelli
2024-10-11 13:47 ` Cristian Marussi
2024-10-15 13:16 ` Sudeep Holla

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).