Re: [PATCH v16 09/10] arm_ffa: efi: introduce FF-A MM communication

Abdellatif El Khlifi
2023-07-27T12:37:01Z

Hi Ilias,

On Thu, Jul 27, 2023 at 02:27:21PM +0300, Ilias Apalodimas wrote:
> Hi Abdellatif,
>
> [...]
>
> > +}
> > +
> > +/**
> > + * get_mm_comms() - detect the available MM transport
> > + *
> > + * Make sure the FF-A bus is probed successfully
> > + * which means FF-A communication with secure world works and ready
> > + * for use.
> > + *
> > + * If FF-A bus is not ready, use OPTEE comms.
> > + *
> > + * Return:
> > + *
> > + * MM_COMMS_FFA or MM_COMMS_OPTEE
> > + */
> > +static enum mm_comms_select get_mm_comms(void)
> > +{
> > + struct udevice *dev;
> > + int ret;
> > +
> > + ret = uclass_first_device_err(UCLASS_FFA, &dev);
> > + if (ret) {
> > + log_err("EFI: Cannot find FF-A bus device, trying Optee comms\n");
>
> This isn't an error. If you mark it as one it will pollute the console
> every time you try to decide if it's an FFA or an SMC call to op-tee. So
> either remote this or switch it to log_debug or something. While at it,

Good point, thanks. I'll replace it with log_debug.

> any reason why we need to keep probing the ffa bus? Can't we just run this
> once during init?
>

Probing the FF-A bus is only done once. Subsequent calls to uclass_first_device_err()
will not probe again, they only return the dev.
An existing dev means FF-A bus is up and running. Failure to find a dev means either FF-A discovery failed
(e.g: FF-A no implemented in secure world), or probing failed (e.g: a setup FF-A ABI failed).

Cheers,
Abdellatif