Re: [RFC] dt-bindings: firmware: scmi: Introduce compatible string

Peng Fan
2025-02-27T02:02:09Z

On Wed, Feb 26, 2025 at 10:09:45AM -0600, Rob Herring wrote:
>On Wed, Feb 26, 2025 at 05:44:56PM +0800, Peng Fan (OSS) wrote:
>> From: Peng Fan <peng.fan@nxp.com>
>>
>> Add compatible string for the protocols by adding new nodes
>> The current nodename pattern is "protocol@[0-9a-f]+$", the new node
>> name will be "scmi-[a-z\-]+$".
>> With compatible string and new nodename, cpufreq and devfreq could be
>> separated into two nodes. And fwdevlink could correctly link suppliers
>> and consumers.
>> With compatible string, and driver updated.
>> - Differnet vendor drivers with same SCMI protocol ID could be built in
>> without concerning vendor A's driver got probed when using vendor B's
>> SoC
>> - NXP scmi pinctrl and ARM scmi pinctrl could be both built in, without
>> concerning arm scmi platform takes nxp scmi pinctrl node as supplier.
>
>How are you going to handle DTs which aren't updated and still don't
>have compatible strings? Seems like that would be messy if not
>impossible.

The goal is to support 'reg' based protocol node and compatible based
protocol node both. I could not promise what the end would be, but things
will be tried to make clean.

>
>>
>> Signed-off-by: Peng Fan <peng.fan@nxp.com>
>> ---
>>
>> RFC:
>> This may sounds like that adding compatible to resovle linux driver issue.
>> Yes indeed. current scmi framework limitation makes it not work well with
>> fwdevlink, wrong suppliers maybe linked to consumers.
>> I have tried various's method to not introduce compatible, but rejected by
>> fwdevlink maintainer or scmi maintainer
>> There was a long discussion in [1][2][3].
>> [1] https://lore.kernel.org/arm-scmi/20240729070325.2065286-1-peng.fan@oss.nxp.com/
>> [2] https://lore.kernel.org/arm-scmi/20241225-scmi-fwdevlink-v1-0-e9a3a5341362@nxp.com/T/#mdd17c4b9b11af9fae0d5b6ec2e13756c2c6f977d
>> [3] https://lore.kernel.org/arm-scmi/20250120-scmi-fwdevlink-v2-0-3af2fa37dbac@nxp.com/
>>
>> The binding changes are posted out to see whether DT maintainer's view on
>> whether introduce compatible string is welcomed or not.
>> I not include driver changes, because this is just to see whether people
>> are happy with this or not.
>>
>> Quote Sudeep's reply"
>> I am not blocking you. What I mentioned is I don't agree that DT can be used
>> to resolve this issue, but I don't have time or alternate solution ATM. So
>> if you propose DT based solution and the maintainers agree for the proposed
>> bindings I will take a look and help you to make that work. But I will raise
>> any objections I may have if the proposal has issues mainly around the
>> compatibility and ease of maintenance.
>> "
>
>This all looks to me like SCMI has failed to provide common interfaces.

What kind common interfaces from your view?

>
>I'm indifferent. If everyone involved thinks adding compatibles will
>solve whatever the issues are, then it's going to be fine with me
>(other than the issue above). It doesn't seem like you have that, so I
>don't know that I'd keep going down this path.

There is no way to build correct supplier and consumer using fw_devlink with
current scmi reg based protocol node.

To build correct fw_devlink supplier and consumer, need provide
more nodes, not one node for multiple devices.

As fw_devlink maintainer said in
https://lore.kernel.org/arm-scmi/CAGETcx8m48cy-EzP6_uoGN7KWsQw=CfZWQ-hNUzz_7LZ0voG8A@mail.gmail.com/:
I also pasted at end.

"
The problem isn't so much that fw_devlink doesn't want to support
multiple devices getting instantiated from one DT node. The problem is
that there's no way to know which of the multiple devices is the real
supplier just by looking at the information in devicetree/firmware
(the fw in fw_devlink). And keep in mind that one of the main
requirements of fw_devlink is to work before any driver is loaded and
not depend on drivers for correctness of the dependency information
because it needs to work on a fully modular kernel too. So, fw_devlink
just picks the first device that's instantiated from a DT node.

I really hate folks creating multiple devices from one DT node. One IP
block can support multiple things, there's no need to instantiate
multiple devices for it. The same driver could have just as easily
registered with multiple frameworks. So, ideally I'd want us to fix
this issue in the SCMI framework code. In the case where the same SCMI
node is creating two devices, can they both probe successfully? If
yes, why are we not using a child node or a separate node for this
second device? If it's always one or the other, why are we creating
two devices? Can you please point to specific upstream DT examples for
me to get a better handle on what's going on?

Btw, there is the deferred_probe_timeout command line option that can
be used so that fw_devlink stops enforcing dependencies where there
are no supplier drivers for a device after a timeout. It's not ideal,
but it's something to unblock you.

The best fw_devlink could do is just not enforce any dependencies if
there is more than one device instantiated for a given supplier DT
node.
"

Thanks,
Peng
>
>Rob