mbox series

[0/2] firmware: arm_scmi: create scmi devices for protocols that not have of_node

Message ID 20240626-scmi-driver-v1-0-f16d777e004a@nxp.com (mailing list archive)
Headers show
Series firmware: arm_scmi: create scmi devices for protocols that not have of_node | expand

Message

Peng Fan (OSS) June 26, 2024, 6:58 a.m. UTC
Per
https://lore.kernel.org/all/20230125141113.kkbowopusikuogx6@bogus/
"
In short we shouldn't have to add a node if there are no consumers. It
was one of the topic of discussion initially when SCMI binding was added
and they exist only for the consumers otherwise we don't need it as
everything is discoverable from the interface.
"
https://lore.kernel.org/all/Y9JLUIioxFPn4BS0@e120937-lin/
If a node has its own channel, the of_node is still needed.

i.MX95 SCMI firmware not have dedicated channel for 0x12, and no need
of_node. This patchset is to support protocol 0x12 without the procotol
node in device tree.

Without of_node, still need to create the scmi devices. As of now,
it is based on an array 'protocols[]' in 'scmi_probe'. 

And no of_node, means no per protocol channel, so reuse the base
protocol channel. Need patch chan_available to support.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
Peng Fan (2):
      firmware: arm_scmi: channel unavailable if no of_node
      firmware: arm_scmi: create scmi_devices that not have of_node

 drivers/firmware/arm_scmi/driver.c  | 33 ++++++++++++++++++++++++++++++++-
 drivers/firmware/arm_scmi/mailbox.c |  2 ++
 drivers/firmware/arm_scmi/optee.c   |  3 +++
 drivers/firmware/arm_scmi/smc.c     |  7 ++++++-
 drivers/firmware/arm_scmi/virtio.c  |  3 +++
 5 files changed, 46 insertions(+), 2 deletions(-)
---
base-commit: d8003eb2eb0200352b5d63af77ec0912a52e79ad
change-id: 20240626-scmi-driver-96dc61b036a2

Best regards,

Comments

Peng Fan June 26, 2024, 8:13 a.m. UTC | #1
Please ignore this patchset, there is an build error that I push the button
earlier.

Regards,
Peng.
> Subject: [PATCH 0/2] firmware: arm_scmi: create scmi devices for
> protocols that not have of_node
> 
> Per
> https://lore.kernel.org/all/20230125141113.kkbowopusikuogx6@bog
> us/
> "
> In short we shouldn't have to add a node if there are no consumers. It
> was one of the topic of discussion initially when SCMI binding was
> added and they exist only for the consumers otherwise we don't need
> it as everything is discoverable from the interface.
> "
> https://lore.kernel.org/all/Y9JLUIioxFPn4BS0@e120937-lin/
> If a node has its own channel, the of_node is still needed.
> 
> i.MX95 SCMI firmware not have dedicated channel for 0x12, and no
> need of_node. This patchset is to support protocol 0x12 without the
> procotol node in device tree.
> 
> Without of_node, still need to create the scmi devices. As of now, it is
> based on an array 'protocols[]' in 'scmi_probe'.
> 
> And no of_node, means no per protocol channel, so reuse the base
> protocol channel. Need patch chan_available to support.
> 
> Signed-off-by: Peng Fan <peng.fan@nxp.com>
> ---
> Peng Fan (2):
>       firmware: arm_scmi: channel unavailable if no of_node
>       firmware: arm_scmi: create scmi_devices that not have of_node
> 
>  drivers/firmware/arm_scmi/driver.c  | 33
> ++++++++++++++++++++++++++++++++-
> drivers/firmware/arm_scmi/mailbox.c |  2 ++
>  drivers/firmware/arm_scmi/optee.c   |  3 +++
>  drivers/firmware/arm_scmi/smc.c     |  7 ++++++-
>  drivers/firmware/arm_scmi/virtio.c  |  3 +++
>  5 files changed, 46 insertions(+), 2 deletions(-)
> ---
> base-commit: d8003eb2eb0200352b5d63af77ec0912a52e79ad
> change-id: 20240626-scmi-driver-96dc61b036a2
> 
> Best regards,
> --
> Peng Fan <peng.fan@nxp.com>
Cristian Marussi June 26, 2024, 11:04 a.m. UTC | #2
On Wed, Jun 26, 2024 at 02:58:38PM +0800, Peng Fan (OSS) wrote:
> Per

Hi,

> https://lore.kernel.org/all/20230125141113.kkbowopusikuogx6@bogus/
> "
> In short we shouldn't have to add a node if there are no consumers. It
> was one of the topic of discussion initially when SCMI binding was added
> and they exist only for the consumers otherwise we don't need it as
> everything is discoverable from the interface.
> "
> https://lore.kernel.org/all/Y9JLUIioxFPn4BS0@e120937-lin/
> If a node has its own channel, the of_node is still needed.
> 
> i.MX95 SCMI firmware not have dedicated channel for 0x12, and no need
> of_node. This patchset is to support protocol 0x12 without the procotol
> node in device tree.
> 

With this patch you change a bit of the core logic to allow for
protocols not explicitly described in the DT to be instantiated, and you
use a static builtin array to list such protocols...so any future change
or any downstream vendor protocols that want to use this, we will have to
patch and extend such protocols[] array.

Moreover, if anyone DO want to use a per-protocol channel in the future
on some of these protocols, it will work fine with your solution on the code
side, BUT you will still have anyway a DT binding check error when you
try to add that 0x12 node to contain a channel description, right ?
... because in that case you will have re-added a (supposedly) empty
protocol node in order to containn the channels definitions and that wont
be yaml-compliant, am I right ?

IOW this solves your issue in the immediate, while adding complexity to
the core code and changing the core behaviour around protocols, but it
wont stand any future addition or different usage.

For these reasons, I still think that the cleanest solution is to just let
protocol nodes to exist even if not referenced anywhere from the DT (your
original patch to add protocol0x12 I think) simply because we allow
per-protocol channel definitions and so any empty unreferenced protocol
node could be needed in the future for this reason.

In this way we'll also keep treating protocols in an uniform way.

Just my opinion, though, I'll settle with what is finally decided
anyway.

Thank
Cristian
Peng Fan June 26, 2024, 11:50 a.m. UTC | #3
Hi Cristian,

> Subject: Re: [PATCH 0/2] firmware: arm_scmi: create scmi devices for
> protocols that not have of_node
> 
> On Wed, Jun 26, 2024 at 02:58:38PM +0800, Peng Fan (OSS) wrote:
> > Per
> 
> Hi,
> 
> >

...
> >
> > i.MX95 SCMI firmware not have dedicated channel for 0x12, and no
> need
> > of_node. This patchset is to support protocol 0x12 without the
> > procotol node in device tree.
> >
> 
> With this patch you change a bit of the core logic to allow for protocols
> not explicitly described in the DT to be instantiated, and you use a
> static builtin array to list such protocols...so any future change or any
> downstream vendor protocols that want to use this, we will have to
> patch and extend such protocols[] array.
> 
> Moreover, if anyone DO want to use a per-protocol channel in the
> future on some of these protocols, it will work fine with your solution
> on the code side, BUT you will still have anyway a DT binding check
> error when you try to add that 0x12 node to contain a channel
> description, right ?

Right.

> ... because in that case you will have re-added a (supposedly) empty
> protocol node in order to containn the channels definitions and that
> wont be yaml-compliant, am I right ?
> 
> IOW this solves your issue in the immediate, while adding complexity
> to the core code and changing the core behaviour around protocols,
> but it wont stand any future addition or different usage.
> 
> For these reasons, I still think that the cleanest solution is to just let
> protocol nodes to exist even if not referenced anywhere from the DT
> (your original patch to add protocol0x12 I think) simply because we
> allow per-protocol channel definitions and so any empty unreferenced
> protocol node could be needed in the future for this reason.

You mean this one [1], right?

I could rebase and send out it again.

> 
> In this way we'll also keep treating protocols in an uniform way.
> 
> Just my opinion, though, I'll settle with what is finally decided anyway.

From reading the previous discussion as listed in cover letter,
I thought there was an agreement that for non consumers, no per
protocol channel node, we should not add it in device tree.
But indeed binding is needed in case the channel has its own channel.

This patchset could be dropped if Sudeep and you both agree with [1]
 
[1]
https://lore.kernel.org/all/20240226130243.3820915-1-peng.fan@oss.nxp.com/

Thanks,
Peng.
> 
> Thank
> Cristian
Cristian Marussi June 26, 2024, 2:07 p.m. UTC | #4
On Wed, Jun 26, 2024 at 11:50:26AM +0000, Peng Fan wrote:
> Hi Cristian,
> 
> > Subject: Re: [PATCH 0/2] firmware: arm_scmi: create scmi devices for
> > protocols that not have of_node
> > 
> > On Wed, Jun 26, 2024 at 02:58:38PM +0800, Peng Fan (OSS) wrote:
> > > Per
> > 
> > Hi,
> > 
> > >
> 
> ...
> > >
> > > i.MX95 SCMI firmware not have dedicated channel for 0x12, and no
> > need
> > > of_node. This patchset is to support protocol 0x12 without the
> > > procotol node in device tree.
> > >
> > 
> > With this patch you change a bit of the core logic to allow for protocols
> > not explicitly described in the DT to be instantiated, and you use a
> > static builtin array to list such protocols...so any future change or any
> > downstream vendor protocols that want to use this, we will have to
> > patch and extend such protocols[] array.
> > 
> > Moreover, if anyone DO want to use a per-protocol channel in the
> > future on some of these protocols, it will work fine with your solution
> > on the code side, BUT you will still have anyway a DT binding check
> > error when you try to add that 0x12 node to contain a channel
> > description, right ?
> 
> Right.
> 
> > ... because in that case you will have re-added a (supposedly) empty
> > protocol node in order to containn the channels definitions and that
> > wont be yaml-compliant, am I right ?
> > 
> > IOW this solves your issue in the immediate, while adding complexity
> > to the core code and changing the core behaviour around protocols,
> > but it wont stand any future addition or different usage.
> > 
> > For these reasons, I still think that the cleanest solution is to just let
> > protocol nodes to exist even if not referenced anywhere from the DT
> > (your original patch to add protocol0x12 I think) simply because we
> > allow per-protocol channel definitions and so any empty unreferenced
> > protocol node could be needed in the future for this reason.
> 
> You mean this one [1], right?
> 
> I could rebase and send out it again.
> 
> > 
> > In this way we'll also keep treating protocols in an uniform way.
> > 
> > Just my opinion, though, I'll settle with what is finally decided anyway.
> 
> From reading the previous discussion as listed in cover letter,
> I thought there was an agreement that for non consumers, no per
> protocol channel node, we should not add it in device tree.
> But indeed binding is needed in case the channel has its own channel.
> 
> This patchset could be dropped if Sudeep and you both agree with [1]
>  

Yes indeed, not sure what at the end Sudeep thinks about this after
reading that thread again....that's why I specified that was just my opinion :P

Moreover, regarding this series, I wonder if, in general, allowing
protocol devices without an underlyng DT node could not be asking for
trouble in the future...in the sense that these devices are used by SCMI
drivers and can be used by them as they wish, including using them to
register with other subsytems, subsystems that can have assumnptions on
the fact the device has a valid underlying of_node... I maybe overthinking...

Anyway let's see if Sudeep prefers to go down this way I will post some
more comments on specifically how this series works..

Thanks,
Cristian
Peng Fan June 27, 2024, 2:05 a.m. UTC | #5
> Subject: Re: [PATCH 0/2] firmware: arm_scmi: create scmi devices for
> protocols that not have of_node
> 
> On Wed, Jun 26, 2024 at 02:58:38PM +0800, Peng Fan (OSS) wrote:
> > Per
> 
> Hi,
> 

...
> > rved=0 If a node has its own channel, the of_node is still needed.
> >
> > i.MX95 SCMI firmware not have dedicated channel for 0x12, and no
> need
> > of_node. This patchset is to support protocol 0x12 without the
> > procotol node in device tree.
> >
> 
> With this patch you change a bit of the core logic to allow for protocols
> not explicitly described in the DT to be instantiated, and you use a
> static builtin array to list such protocols...so any future change or any
> downstream vendor protocols that want to use this, we will have to
> patch and extend such protocols[] array.

Just recheck this again, we might address with iterate
rdev->id_table->protocol_id, just as scmi_device_create.

Regards,
Peng.

> 
> Moreover, if anyone DO want to use a per-protocol channel in the
> future on some of these protocols, it will work fine with your solution
> on the code side, BUT you will still have anyway a DT binding check
> error when you try to add that 0x12 node to contain a channel
> description, right ?
> ... because in that case you will have re-added a (supposedly) empty
> protocol node in order to containn the channels definitions and that
> wont be yaml-compliant, am I right ?
> 
> IOW this solves your issue in the immediate, while adding complexity
> to the core code and changing the core behaviour around protocols,
> but it wont stand any future addition or different usage.
> 
> For these reasons, I still think that the cleanest solution is to just let
> protocol nodes to exist even if not referenced anywhere from the DT
> (your original patch to add protocol0x12 I think) simply because we
> allow per-protocol channel definitions and so any empty unreferenced
> protocol node could be needed in the future for this reason.
> 
> In this way we'll also keep treating protocols in an uniform way.
> 
> Just my opinion, though, I'll settle with what is finally decided anyway.
> 
> Thank
> Cristian