Re: [PATCH v8 03/10] arm_ffa: introduce Arm FF-A low-level driver

Rob Herring
2022-12-05T15:49:51Z

On Sun, Dec 4, 2022 at 1:22 PM Simon Glass <sjg@chromium.org> wrote:
>
> Hi Rob,
>
> On Tue, 29 Nov 2022 at 05:22, Rob Herring <robh@kernel.org> wrote:
> >
> > On Fri, Nov 25, 2022 at 3:18 PM Simon Glass <sjg@chromium.org> wrote:
> > >
> > > Hi Abdellatif,
> > >
> > > On Thu, 24 Nov 2022 at 06:21, Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com> wrote:
> > > >
> > > > On Tue, Nov 22, 2022 at 07:09:16PM -0700, Simon Glass wrote:
> > > > > should be called 'priov' and should beHi Abdellatif,
> > > > >
> > >
> > > [..]
> > >
> > > > > > +/**
> > > > > > + * ffa_device_get - create, bind and probe the arm_ffa device
> > > > > > + * @pdev: the address of a device pointer (to be filled when the arm_ffa bus device is created
> > > > > > + * successfully)
> > > > > > + *
> > > > > > + * This function makes sure the arm_ffa device is
> > > > > > + * created, bound to this driver, probed and ready to use.
> > > > > > + * Arm FF-A transport is implemented through a single U-Boot
> > > > > > + * device managing the FF-A bus (arm_ffa).
> > > > > > + *
> > > > > > + * Return:
> > > > > > + *
> > > > > > + * 0 on success. Otherwise, failure
> > > > > > + */
> > > > > > +int ffa_device_get(struct udevice **pdev)
> > > > > > +{
> > > > > > + int ret;
> > > > > > + struct udevice *dev = NULL;
> > > > > > +
> > > > > > + ret = device_bind(dm_root(), DM_DRIVER_GET(arm_ffa), FFA_DRV_NAME, NULL, ofnode_null(),
> > > > > > + &dev);
> > > > >
> > > > > Please add a DT binding. Even if only temporary, we need something for this.
> > > >
> > > > Thanks for the feedback. I'm happy to address all the comments.
> > > >
> > > > Regarding DT binding and FF-A discovery. We agreed with Linaro and Rob Herring
> > > > about the following:
> > > >
> > > > - DT is only for what we failed to make discoverable. For hardware, we're stuck
> > > > with it. We shouldn't repeat that for software interfaces. This approach is
> > > > already applied in the FF-A kernel driver which comes with no DT support and
> > > > discovers the bus with bus_register() API [1].
> > >
> > > This may be the UEFI view, but it is not how U-Boot works. This is not something we are 'stuck' with. It is how we define what is present on a device. This is how the PCI bus works in U-Boot. It is best practice in U-Boot to use the device tree to make this things visible and configurable. Unlike with Linux there is no other way to provide configuration needed by these devices.
> >
> > Where do you get UEFI out of this?
>
> I assume it was UEFI as there was no discussion about this in U-Boot.
> Which firmware project was consulted about this?
>
> >
> > It is the discoverability of hardware that is fixed (and we are stuck
> > with). We can't change hardware. The disoverability may be PCI
> > VID/PID, USB device descriptors, or nothing. We only use DT when those
> > are not sufficient. For a software interface, there is no reason to
> > make them non-discoverable as the interface can be fixed (at least for
> > new things like FF-A).
>
> Here I am talking about the controller itself, the top-level node in
> the device tree. For PCI this is a device tree node and it should be
> the same here. So I am not saying that the devices on the bus need to
> be in the device tree (that can be optional, but may be useful in some
> situations where it is status and known).

Sure, the PCI host bridges are not discoverable, have a bunch of
resources, and do need to be in DT. The downstream devices only do if
they have extra resources such as when a device is soldered down on a
board rather than a standard slot.

> We need something like:
>
> ff-a {
> compatible = "something";
> };
>
> I don't know what mechanism is actually used to communicate with it,
> but that will be enough to get the top-level driver started.

There's discovery of FF-A itself and then discovery of FF-A features
(e.g. partitions). Both of those are discoverable without DT. The
first is done by checking the SMCCC version, then checking for FF-A
presence and features. Putting this into DT is redundant. Worse, what
if they disagree?

> If Linux does not want to use the node, that it another thing, but I
> respectfully request that U-Boot's needs be considered more carefully.

It's not really a big deal for just one compatible. It's the next 10
firmware things Arm comes up with. Or the let's add one property at a
time binding (mis)design that happens once we have a binding.

> I'd also like to see more willingness to accommodate open-source
> software in these designs.

I'm not sure what you are asking for here. Are you talking about FF-A
and Arm firmware interfaces itself, the DT binding for it, or
something else? I'd agree on the first part. I only saw this when the
binding landed on my plate. For bindings themselves, the firehose is
there. I can't pick out what you or others care and don't care about.
I try to steer common things to the devicetree-spec list, but there's
not that many things that come up really.

Rob