[PATCH 2/3] imx8m: Automatically add the optee firmware node to the FDT

Michael Nazzareno Trimarchi michael at amarulasolutions.com
Wed May 18 08:31:27 CEST 2022


Hi Jens

On Mon, May 16, 2022 at 3:49 PM Jens Wiklander
<jens.wiklander at linaro.org> wrote:
>
> Hi,
>
> On Mon, May 16, 2022 at 12:00 PM Michael Nazzareno Trimarchi
> <michael at amarulasolutions.com> wrote:
> >
> > Hi Alban
> >
> > On Mon, May 16, 2022 at 10:23 AM Alban Bedel <alban.bedel at aerq.com> wrote:
> > >
> > > If optee is running add the firmware node to the FDT to allow the
> > > kernel to use a more generic device tree.
> > >
> > > Signed-off-by: Alban Bedel <alban.bedel at aerq.com>
> > > ---
> > >  arch/arm/mach-imx/imx8m/soc.c | 9 +++++++++
> > >  1 file changed, 9 insertions(+)
> > >
> > > diff --git a/arch/arm/mach-imx/imx8m/soc.c b/arch/arm/mach-imx/imx8m/soc.c
> > > index 8e23e6da326f..2a78cb6a0952 100644
> > > --- a/arch/arm/mach-imx/imx8m/soc.c
> > > +++ b/arch/arm/mach-imx/imx8m/soc.c
> > > @@ -30,6 +30,7 @@
> > >  #include <fsl_wdog.h>
> > >  #include <imx_sip.h>
> > >  #include <linux/bitops.h>
> > > +#include <tee/optee.h>
> > >
> > >  DECLARE_GLOBAL_DATA_PTR;
> > >
> > > @@ -1347,6 +1348,14 @@ usb_modify_speed:
> > >  #endif
> > >
> > >         cleanup_nodes_for_efi(blob);
> > > +
> > > +       if (rom_pointer[1]) {
> > > +               int err = optee_add_firmware_node(blob, "linaro,optee-tz",
> > > +                                                 "smc");
> > > +               if (err)
> > > +                       return err;
> > > +       }
> > > +
> > >         return 0;
> > >  }
> > >  #endif
> > > --
> >
> > Adding the node is not sufficient. I think that we need reserved
> > memory node on top of it. The nice scenario will be
> > only to define the size of such area and use always the last part of
> > the memory to reserve it. Do you know if we have some api
> > to pass information to the atf and optee?
>
> We have an ABI in OP-TEE for this, OPTEE_SMC_GET_SHM_CONFIG. This
> function wasn't intended for this, but I can't see that that should be
> a problem.

Ok, the call resolves to know the size of SHM_CONFIG but does not give
information about the memory to be reserved.

So SPL loads ATF that has hardcoded BL32_ADDR and BL32_SIZE. SPL is
running in OCRAM as ATF, so then I can call
the OPTEE_SMC_GET to know what reservation OPTEE needs. This avoid us
to create dts entry for optee only

Michael

>
> Cheers,
> Jens
>
> >
> > Michael
> > > 2.34.1
> >
> >
> >
> > --
> > Michael Nazzareno Trimarchi
> > Co-Founder & Chief Executive Officer
> > M. +39 347 913 2170
> > michael at amarulasolutions.com
> > __________________________________
> >
> > Amarula Solutions BV
> > Joop Geesinkweg 125, 1114 AB, Amsterdam, NL
> > T. +31 (0)85 111 9172
> > info at amarulasolutions.com
> > www.amarulasolutions.com



--
Michael Nazzareno Trimarchi
Co-Founder & Chief Executive Officer
M. +39 347 913 2170
michael at amarulasolutions.com
__________________________________

Amarula Solutions BV
Joop Geesinkweg 125, 1114 AB, Amsterdam, NL
T. +31 (0)85 111 9172
info at amarulasolutions.com
www.amarulasolutions.com


More information about the U-Boot mailing list