On Wed, Mar 12, 2025 at 11:12:35AM -0300, Fabio Estevam wrote: > Hi Vincent, > > On Mon, Mar 10, 2025 at 9:36 AM Vincent Stehlé <vincent.ste...@arm.com> wrote: > > > --- a/arch/arm/mach-imx/imx8m/soc.c > > +++ b/arch/arm/mach-imx/imx8m/soc.c > > @@ -1270,8 +1270,9 @@ static int ft_add_optee_node(void *fdt, struct > > bd_info *bd) > > } > > } > > > > + /* Locate the optee node if it exists or create it. */ > > subpath = "optee"; > > - offs = fdt_add_subnode(fdt, offs, subpath); > > + offs = fdt_find_or_add_subnode(fdt, offs, subpath); > > if (offs < 0) { > > printf("Could not create %s node.\n", subpath); > > return offs; > > This looks correct.
Hi Fabio, Thank you for the review. > > However, shouldn't we add the optee node only when CONFIG_OPTEE is selected? Peng has answered this question already, but I would like to add some more details: Currently the ft_add_optee_node() function does add the /reserved-memory and /firmware/optee nodes to the Devicetree passed to Linux when OP-TEE is detected at runtime (the information is in the rom_pointer[] array). If we skip this when CONFIG_OPTEE is not set, Linux will not even have the reserved memory information anymore and the Linux optee driver will not probe. Best regards, Vincent. > > --- a/arch/arm/mach-imx/imx8m/soc.c > +++ b/arch/arm/mach-imx/imx8m/soc.c > @@ -1235,6 +1235,9 @@ static int ft_add_optee_node(void *fdt, struct > bd_info *bd) > int offs; > int ret; > > + if (!IS_ENABLED(CONFIG_OPTEE)) > + return 0; > + > /* > * No TEE space allocated indicating no TEE running, so no > * need to add optee node in dts