Re: [PATCH 1/2] dt-bindings: firmware: arm,scmi: Support mailboxes unidirectional channels

From: Cristian Marussi
Date: Mon Mar 27 2023 - 11:27:51 EST


On Mon, Mar 27, 2023 at 04:42:12PM +0200, Krzysztof Kozlowski wrote:
> On 27/03/2023 16:03, Cristian Marussi wrote:
> > SCMI defines two kinds of communication channels between the agent and the
> > platform: one bidirectional 'a2p' channel used by the agent to send SCMI
> > commands and synchronously receive the related replies, and an optional
> > 'p2a' unidirectional channel used to asynchronously receive delayed
> > responses and notifications emitted from the platform.
> >
> > When configuring an SCMI transport based on mailboxes, the current binding
> > supports only mailboxes providing bidirectional channels: in such a case
> > one mailbox channel can be easily assigned to each SCMI channel as above
> > described.
> >
> > In case, instead, to have to deal with mailboxes providing only distinct
> > unidirectional channels, it becomes necessary to extend the binding in
> > order to be able to bind 2 distinct unidirectional mailbox channels to the
> > same SCMI 'a2p' channel.
> >
> > Bidirectional and unidirectional channels support for the SCMI mailbox
> > transport can coexist by carefully considering the effective combination
> > of defined 'mboxes' and 'shmem' descriptors.
> >
> > Cc: Rob Herring <robh+dt@xxxxxxxxxx>
> > Cc: Krzysztof Kozlowski <krzysztof.kozlowski+dt@xxxxxxxxxx>
> > Cc: devicetree@xxxxxxxxxxxxxxx
>

Hi Krzysztof,

thanks for having a look.

> Please drop the autogenerated scripts/get_maintainer.pl CC-entries from
> commit msg. There is no single need to store automated output of
> get_maintainers.pl in the git log. It can be easily re-created at any
> given time, thus its presence in the git history is redundant and
> obfuscates the log.
>
> If you need it for your own patch management purposes, keep it under ---.
>

Ok. I use to add those Cc to trigger git-sendmail to add proper CCs but
in this case indeed I copied you on all the series anyway. I'll drop it.

>
> > Signed-off-by: Cristian Marussi <cristian.marussi@xxxxxxx>
> > ---
> > .../bindings/firmware/arm,scmi.yaml | 42 +++++++++++++++++--
> > 1 file changed, 38 insertions(+), 4 deletions(-)
> >
> > diff --git a/Documentation/devicetree/bindings/firmware/arm,scmi.yaml b/Documentation/devicetree/bindings/firmware/arm,scmi.yaml
> > index 2f7c51c75e85..9a7dc30e386f 100644
> > --- a/Documentation/devicetree/bindings/firmware/arm,scmi.yaml
> > +++ b/Documentation/devicetree/bindings/firmware/arm,scmi.yaml
> > @@ -63,10 +63,24 @@ properties:
> > mboxes:
> > description:
> > List of phandle and mailbox channel specifiers. It should contain
> > - exactly one or two mailboxes, one for transmitting messages("tx")
> > - and another optional for receiving the notifications("rx") if supported.
> > + exactly one, two or three mailboxes; the first one or two for transmitting
> > + messages ("tx") and another optional ("rx") for receiving notifications
> > + and delayed responses, if supported by the platform.
> > + The number of mailboxes needed for transmitting messages depends on the
> > + type of channels exposed by the specific underlying mailbox controller;
> > + one single channel descriptor is enough if such channel is bidirectional,
> > + while two channel descriptors are needed to represent the SCMI ("tx")
> > + channel if the underlying mailbox channels are of unidirectional type.
> > + The effective combination in numbers of mboxes and shmem descriptors let
> > + the SCMI subsystem determine unambiguosly which type of SCMI channels are
> > + made available by the underlying mailbox controller and how to use them.
> > + 1 mbox / 1 shmem => SCMI TX over 1 mailbox bidirectional channel
> > + 2 mbox / 2 shmem => SCMI TX and RX over 2 mailbox bidirectional channels
> > + 2 mbox / 1 shmem => SCMI TX over 2 mailbox unidirectional channels
> > + 3 mbox / 2 shmem => SCMI TX and RX over 3 mailbox unidirectional channels
> > + Any other combination of mboxes and shmem is invalid.
> > minItems: 1
> > - maxItems: 2
> > + maxItems: 3
>
> Missing update to mbox-names.
>
Ah .. missed that since mbox-names is not marked as a required property
in this binding. I'll add in V2.

> >
> > shmem:
> > description:
> > @@ -234,7 +248,7 @@ $defs:
> >
> > mboxes:
> > minItems: 1
> > - maxItems: 2
> > + maxItems: 3
>
> The same. How is it supposed to work? tx rx and that's it?
>

The logic is that SCMI transport can determine which type of channels
(bidir vs unidir) you are using by looking at how many mboxes and how
many shmem are defined as detailed in the description above.
(not using mbox-names refs because was never marked as required so it
would break backward compatibility starting to use that)

I'll add a fix in V2 to fit mbox-names into this logic too.

> >
> > shmem:
> > minItems: 1
> > @@ -393,6 +407,26 @@ examples:
> > };
> > };
> >
> > + - |
> > + firmware {
> > + scmi {
> > + compatible = "arm,scmi";
> > + mboxes = <&mhu_U_tx 0 0>, <&mhu_U_rx 0 0>;
> > + shmem = <&cpu_scp_lpri0>;
> > +
> > + #address-cells = <1>;
> > + #size-cells = <0>;
>
> I don't think adding one more example with difference in only one piece
> is needed here.
>

Mmm, I thought was sensible to add this example, given that a mailbox
transport configuration for a mailbox exposing unidrectional channels is
quite different from the usual bidirectional channel config already
present in the pre-existent example.

I'll add mbox-names into this example and see if I can change your
mind...or I can then finally drop it.

Thanks,
Cristian