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

Bedel, Alban alban.bedel at aerq.com
Tue May 17 16:20:52 CEST 2022


On Mon, 2022-05-16 at 12:00 +0200, Michael Nazzareno Trimarchi 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.

My board use an imx8m and there the SoC code already carve out the
optee memory (arch/arm/mach-imx/imx8m/soc.c dram_init_banksize()).
In that case it is enough to just add the firmware node as the memory
node created in the DTB already exclude the optee area. I expect it was
done like this to also prevent using this memory area in u-boot.

This is a first step we can later add another function to also create
the reserved memory nodes when needed.

> 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. 

The optee area might be anywhere, the size won't be enough.

Alban
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3627 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20220517/4c6bbc14/attachment.bin>


More information about the U-Boot mailing list