Re: [PATCH v2 18/18] ARM: i.MX8M: fix optee of-fixup logic

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 24-01-18, Sascha Hauer wrote:
> On Tue, Jan 16, 2024 at 06:07:38PM +0100, Marco Felsch wrote:
> > The current code checks only if "/firmware/optee" exist on the builtin
> > dtb and applys the fixup if not found and if found nothing is done. If a
> > builtin dts contains the node but an external don't the fixup won't be
> > applied. Also if the external dts does have a node + the reserved memory
> > region nodes but the barebox builtin dts don't we do add additional
> > reserved memory nodes which may conflict due to different name scheme:
> > <name> vs. <name>@<addr>.
> > 
> > Move the "/firmware/optee" check into the of_optee_fixup() so the check
> > is done on the correct dtb root nodes.
> > 
> > Signed-off-by: Marco Felsch <m.felsch@xxxxxxxxxxxxxx>
> > ---
> >  arch/arm/mach-imx/imx8m.c    | 3 +--
> >  drivers/tee/optee/of_fixup.c | 6 +++++-
> >  2 files changed, 6 insertions(+), 3 deletions(-)
> > 
> > diff --git a/arch/arm/mach-imx/imx8m.c b/arch/arm/mach-imx/imx8m.c
> > index 6db16f024148..73b420b38697 100644
> > --- a/arch/arm/mach-imx/imx8m.c
> > +++ b/arch/arm/mach-imx/imx8m.c
> > @@ -68,8 +68,7 @@ static int imx8m_init(const char *cputypestr)
> >  	imx_set_reset_reason(src + IMX7_SRC_SRSR, imx7_reset_reasons);
> >  	pr_info("%s unique ID: %llx\n", cputypestr, imx8m_uid());
> >  
> > -	if (IS_ENABLED(CONFIG_PBL_OPTEE) && tzc380_is_enabled() &&
> > -	    !of_find_node_by_path_from(NULL, "/firmware/optee")) {
> > +	if (IS_ENABLED(CONFIG_PBL_OPTEE) && tzc380_is_enabled()) {
> >  		static struct of_optee_fixup_data optee_fixup_data = {
> >  			.shm_size = OPTEE_SHM_SIZE,
> >  			.method = "smc",
> > diff --git a/drivers/tee/optee/of_fixup.c b/drivers/tee/optee/of_fixup.c
> > index cdf650592e90..2ff1f01964c8 100644
> > --- a/drivers/tee/optee/of_fixup.c
> > +++ b/drivers/tee/optee/of_fixup.c
> > @@ -9,12 +9,16 @@
> >  int of_optee_fixup(struct device_node *root, void *_data)
> >  {
> >  	struct of_optee_fixup_data *fixup_data = _data;
> > +	const char *optee_of_path = "/firmware/optee";
> >  	struct resource res = {};
> >  	struct device_node *node;
> >  	u64 optee_membase;
> >  	int ret;
> >  
> > -	node = of_create_node(root, "/firmware/optee");
> > +	if (of_find_node_by_path_from(NULL, optee_of_path))
> > +		return 0;
> 
> This implements a "when the internal dts does have a OP-TEE node, then
> do not fixup the external dts". This is surely not what you meant. 

Arg..

> Should this be
> 
> 	if (of_find_node_by_path_from(root, optee_of_path))
> 		return 0;

exactly, thanks.

Regards,
  Marco

> or something else?
> 
> Sascha
> 
> -- 
> Pengutronix e.K.                           |                             |
> Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
> 31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
> Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
> 




[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux