All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] apalis_imx6: allocate specific region of memory to OP-TEE
@ 2019-09-02 21:21 Ricardo Salveti
  2019-09-03  3:09 ` Peng Fan
  2019-09-03 12:58 ` Max Krummenacher
  0 siblings, 2 replies; 6+ messages in thread
From: Ricardo Salveti @ 2019-09-02 21:21 UTC (permalink / raw)
  To: u-boot

OP-TEE uses the memory region defined by the maximum DRAM address minus
CONFIG_OPTEE_TZDRAM_SIZE, so subtract CONFIG_OPTEE_TZDRAM_SIZE from the
available DRAM size to avoid conflicts.

Signed-off-by: Ricardo Salveti <ricardo@foundries.io>
---
 board/toradex/apalis_imx6/apalis_imx6.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/board/toradex/apalis_imx6/apalis_imx6.c b/board/toradex/apalis_imx6/apalis_imx6.c
index 6421a22c25..fa7fcc8d46 100644
--- a/board/toradex/apalis_imx6/apalis_imx6.c
+++ b/board/toradex/apalis_imx6/apalis_imx6.c
@@ -75,6 +75,11 @@ int dram_init(void)
 	gd->ram_size = get_ram_size((void *)CONFIG_SYS_SDRAM_BASE,
 				    (ulong)imx_ddr_size());
 
+	/* Subtract the defined OPTEE runtime firmware length */
+#ifdef CONFIG_OPTEE_TZDRAM_SIZE
+	gd->ram_size -= CONFIG_OPTEE_TZDRAM_SIZE;
+#endif
+
 	return 0;
 }
 
-- 
2.23.0

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [U-Boot] [PATCH] apalis_imx6: allocate specific region of memory to OP-TEE
  2019-09-02 21:21 [U-Boot] [PATCH] apalis_imx6: allocate specific region of memory to OP-TEE Ricardo Salveti
@ 2019-09-03  3:09 ` Peng Fan
  2019-09-03 13:52   ` Ricardo Salveti
  2019-09-03 12:58 ` Max Krummenacher
  1 sibling, 1 reply; 6+ messages in thread
From: Peng Fan @ 2019-09-03  3:09 UTC (permalink / raw)
  To: u-boot

> Subject: [PATCH] apalis_imx6: allocate specific region of memory to OP-TEE
> 
> OP-TEE uses the memory region defined by the maximum DRAM address
> minus CONFIG_OPTEE_TZDRAM_SIZE, so subtract
> CONFIG_OPTEE_TZDRAM_SIZE from the available DRAM size to avoid
> conflicts.
> 
> Signed-off-by: Ricardo Salveti <ricardo@foundries.io>
> ---
>  board/toradex/apalis_imx6/apalis_imx6.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/board/toradex/apalis_imx6/apalis_imx6.c
> b/board/toradex/apalis_imx6/apalis_imx6.c
> index 6421a22c25..fa7fcc8d46 100644
> --- a/board/toradex/apalis_imx6/apalis_imx6.c
> +++ b/board/toradex/apalis_imx6/apalis_imx6.c
> @@ -75,6 +75,11 @@ int dram_init(void)
>  	gd->ram_size = get_ram_size((void *)CONFIG_SYS_SDRAM_BASE,
>  				    (ulong)imx_ddr_size());
> 
> +	/* Subtract the defined OPTEE runtime firmware length */ #ifdef
> +CONFIG_OPTEE_TZDRAM_SIZE
> +	gd->ram_size -= CONFIG_OPTEE_TZDRAM_SIZE; #endif
> +

Has OPTEE been enabled? I not see that in defconfig.

Regards,
Peng.

>  	return 0;
>  }
> 
> --
> 2.23.0

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [U-Boot] [PATCH] apalis_imx6: allocate specific region of memory to OP-TEE
  2019-09-02 21:21 [U-Boot] [PATCH] apalis_imx6: allocate specific region of memory to OP-TEE Ricardo Salveti
  2019-09-03  3:09 ` Peng Fan
@ 2019-09-03 12:58 ` Max Krummenacher
  1 sibling, 0 replies; 6+ messages in thread
From: Max Krummenacher @ 2019-09-03 12:58 UTC (permalink / raw)
  To: u-boot

On Mon, 2019-09-02 at 18:21 -0300, Ricardo Salveti wrote:
> OP-TEE uses the memory region defined by the maximum DRAM address minus
> CONFIG_OPTEE_TZDRAM_SIZE, so subtract CONFIG_OPTEE_TZDRAM_SIZE from the
> available DRAM size to avoid conflicts.
> 
> Signed-off-by: Ricardo Salveti <ricardo@foundries.io>
> ---
>  board/toradex/apalis_imx6/apalis_imx6.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/board/toradex/apalis_imx6/apalis_imx6.c b/board/toradex/apalis_imx6/apalis_imx6.c
> index 6421a22c25..fa7fcc8d46 100644
> --- a/board/toradex/apalis_imx6/apalis_imx6.c
> +++ b/board/toradex/apalis_imx6/apalis_imx6.c
> @@ -75,6 +75,11 @@ int dram_init(void)
>  	gd->ram_size = get_ram_size((void *)CONFIG_SYS_SDRAM_BASE,
>  				    (ulong)imx_ddr_size());
>  
> +	/* Subtract the defined OPTEE runtime firmware length */
> +#ifdef CONFIG_OPTEE_TZDRAM_SIZE
> +	gd->ram_size -= CONFIG_OPTEE_TZDRAM_SIZE;
> +#endif
> +
>  	return 0;
>  }
> 

>  
Acked-by: Max Krummenacher <max.krummenacher@toradex.com>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [U-Boot] [PATCH] apalis_imx6: allocate specific region of memory to OP-TEE
  2019-09-03  3:09 ` Peng Fan
@ 2019-09-03 13:52   ` Ricardo Salveti
  2019-09-03 14:34     ` Igor Opaniuk
  0 siblings, 1 reply; 6+ messages in thread
From: Ricardo Salveti @ 2019-09-03 13:52 UTC (permalink / raw)
  To: u-boot

On Tue, Sep 3, 2019 at 12:09 AM Peng Fan <peng.fan@nxp.com> wrote:
>
> > Subject: [PATCH] apalis_imx6: allocate specific region of memory to OP-TEE
> >
> > OP-TEE uses the memory region defined by the maximum DRAM address
> > minus CONFIG_OPTEE_TZDRAM_SIZE, so subtract
> > CONFIG_OPTEE_TZDRAM_SIZE from the available DRAM size to avoid
> > conflicts.
> >
> > Signed-off-by: Ricardo Salveti <ricardo@foundries.io>
> > ---
> >  board/toradex/apalis_imx6/apalis_imx6.c | 5 +++++
> >  1 file changed, 5 insertions(+)
> >
> > diff --git a/board/toradex/apalis_imx6/apalis_imx6.c
> > b/board/toradex/apalis_imx6/apalis_imx6.c
> > index 6421a22c25..fa7fcc8d46 100644
> > --- a/board/toradex/apalis_imx6/apalis_imx6.c
> > +++ b/board/toradex/apalis_imx6/apalis_imx6.c
> > @@ -75,6 +75,11 @@ int dram_init(void)
> >       gd->ram_size = get_ram_size((void *)CONFIG_SYS_SDRAM_BASE,
> >                                   (ulong)imx_ddr_size());
> >
> > +     /* Subtract the defined OPTEE runtime firmware length */ #ifdef
> > +CONFIG_OPTEE_TZDRAM_SIZE
> > +     gd->ram_size -= CONFIG_OPTEE_TZDRAM_SIZE; #endif
> > +
>
> Has OPTEE been enabled? I not see that in defconfig.

Not yet enable by default, this is just to make it compatible with OP-TEE.

Should we have it enabled by default at apalis_imx6_defconfig? I could
also send another patch to add a new config that has secure boot and
OP-TEE enabled by default, as done with a few other imx targets.

Thanks,
-- 
Ricardo Salveti

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [U-Boot] [PATCH] apalis_imx6: allocate specific region of memory to OP-TEE
  2019-09-03 13:52   ` Ricardo Salveti
@ 2019-09-03 14:34     ` Igor Opaniuk
  2019-09-03 14:48       ` Ricardo Salveti
  0 siblings, 1 reply; 6+ messages in thread
From: Igor Opaniuk @ 2019-09-03 14:34 UTC (permalink / raw)
  To: u-boot

Hi Ricardo,

On Tue, Sep 3, 2019 at 4:53 PM Ricardo Salveti <ricardo@foundries.io> wrote:
>
> On Tue, Sep 3, 2019 at 12:09 AM Peng Fan <peng.fan@nxp.com> wrote:
> >
> > > Subject: [PATCH] apalis_imx6: allocate specific region of memory to OP-TEE
> > >
> > > OP-TEE uses the memory region defined by the maximum DRAM address
> > > minus CONFIG_OPTEE_TZDRAM_SIZE, so subtract
> > > CONFIG_OPTEE_TZDRAM_SIZE from the available DRAM size to avoid
> > > conflicts.
> > >
> > > Signed-off-by: Ricardo Salveti <ricardo@foundries.io>
> > > ---
> > >  board/toradex/apalis_imx6/apalis_imx6.c | 5 +++++
> > >  1 file changed, 5 insertions(+)
> > >
> > > diff --git a/board/toradex/apalis_imx6/apalis_imx6.c
> > > b/board/toradex/apalis_imx6/apalis_imx6.c
> > > index 6421a22c25..fa7fcc8d46 100644
> > > --- a/board/toradex/apalis_imx6/apalis_imx6.c
> > > +++ b/board/toradex/apalis_imx6/apalis_imx6.c
> > > @@ -75,6 +75,11 @@ int dram_init(void)
> > >       gd->ram_size = get_ram_size((void *)CONFIG_SYS_SDRAM_BASE,
> > >                                   (ulong)imx_ddr_size());
> > >
> > > +     /* Subtract the defined OPTEE runtime firmware length */ #ifdef
> > > +CONFIG_OPTEE_TZDRAM_SIZE
> > > +     gd->ram_size -= CONFIG_OPTEE_TZDRAM_SIZE; #endif
> > > +
> >
> > Has OPTEE been enabled? I not see that in defconfig.
>
> Not yet enable by default, this is just to make it compatible with OP-TEE.
>
> Should we have it enabled by default at apalis_imx6_defconfig? I could
> also send another patch to add a new config that has secure boot and
> OP-TEE enabled by default, as done with a few other imx targets.

IMHO, idea with a new config makes sense, as besides CONFIG_BOOTM_OPTEE=y
we should also add CONFIG_ARMV7_BOOT_SEC_DEFAULT=y  and provide
appropriate CONFIG_BOOTCOMMAND to boot TEE blob (although we're currently
in the middle of transition to distroboot usage by default, where we
can handle all this
in a boot script instead).

>
> Thanks,
> --
> Ricardo Salveti
> _______________________________________________
> U-Boot mailing list
> U-Boot at lists.denx.de
> https://lists.denx.de/listinfo/u-boot

Thanks

-- 
Best regards - Freundliche Grüsse - Meilleures salutations

Igor Opaniuk

mailto: igor.opaniuk at gmail.com
skype: igor.opanyuk
+380 (93) 836 40 67
http://ua.linkedin.com/in/iopaniuk

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [U-Boot] [PATCH] apalis_imx6: allocate specific region of memory to OP-TEE
  2019-09-03 14:34     ` Igor Opaniuk
@ 2019-09-03 14:48       ` Ricardo Salveti
  0 siblings, 0 replies; 6+ messages in thread
From: Ricardo Salveti @ 2019-09-03 14:48 UTC (permalink / raw)
  To: u-boot

On Tue, Sep 3, 2019 at 11:34 AM Igor Opaniuk <igor.opaniuk@gmail.com> wrote:
> Hi Ricardo,
>
> On Tue, Sep 3, 2019 at 4:53 PM Ricardo Salveti <ricardo@foundries.io> wrote:
> >
> > On Tue, Sep 3, 2019 at 12:09 AM Peng Fan <peng.fan@nxp.com> wrote:
> > >
> > > > Subject: [PATCH] apalis_imx6: allocate specific region of memory to OP-TEE
> > > >
> > > > OP-TEE uses the memory region defined by the maximum DRAM address
> > > > minus CONFIG_OPTEE_TZDRAM_SIZE, so subtract
> > > > CONFIG_OPTEE_TZDRAM_SIZE from the available DRAM size to avoid
> > > > conflicts.
> > > >
> > > > Signed-off-by: Ricardo Salveti <ricardo@foundries.io>
> > > > ---
> > > >  board/toradex/apalis_imx6/apalis_imx6.c | 5 +++++
> > > >  1 file changed, 5 insertions(+)
> > > >
> > > > diff --git a/board/toradex/apalis_imx6/apalis_imx6.c
> > > > b/board/toradex/apalis_imx6/apalis_imx6.c
> > > > index 6421a22c25..fa7fcc8d46 100644
> > > > --- a/board/toradex/apalis_imx6/apalis_imx6.c
> > > > +++ b/board/toradex/apalis_imx6/apalis_imx6.c
> > > > @@ -75,6 +75,11 @@ int dram_init(void)
> > > >       gd->ram_size = get_ram_size((void *)CONFIG_SYS_SDRAM_BASE,
> > > >                                   (ulong)imx_ddr_size());
> > > >
> > > > +     /* Subtract the defined OPTEE runtime firmware length */ #ifdef
> > > > +CONFIG_OPTEE_TZDRAM_SIZE
> > > > +     gd->ram_size -= CONFIG_OPTEE_TZDRAM_SIZE; #endif
> > > > +
> > >
> > > Has OPTEE been enabled? I not see that in defconfig.
> >
> > Not yet enable by default, this is just to make it compatible with OP-TEE.
> >
> > Should we have it enabled by default at apalis_imx6_defconfig? I could
> > also send another patch to add a new config that has secure boot and
> > OP-TEE enabled by default, as done with a few other imx targets.
>
> IMHO, idea with a new config makes sense, as besides CONFIG_BOOTM_OPTEE=y
> we should also add CONFIG_ARMV7_BOOT_SEC_DEFAULT=y  and provide
> appropriate CONFIG_BOOTCOMMAND to boot TEE blob (although we're currently
> in the middle of transition to distroboot usage by default, where we
> can handle all this
> in a boot script instead).

The flow I'm currently using is a bit different, using SPL FIT and
loading OP-TEE from SPL itself (in order to load secure world earlier
in the boot chain), which then loads U-Boot in normal world. That way
we don't actually need to change the default bootcommand logic, as
most of the heavy work is done by SPL instead of u-boot.

Once some of the needed patches land (e.g. supporting larger SPL on
iMX6DQ) I will propose a new config with this setup, so we can all
review it.

Cheers,

--
Ricardo Salveti

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2019-09-03 14:48 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-02 21:21 [U-Boot] [PATCH] apalis_imx6: allocate specific region of memory to OP-TEE Ricardo Salveti
2019-09-03  3:09 ` Peng Fan
2019-09-03 13:52   ` Ricardo Salveti
2019-09-03 14:34     ` Igor Opaniuk
2019-09-03 14:48       ` Ricardo Salveti
2019-09-03 12:58 ` Max Krummenacher

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.