All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] board: ea: mx7ulp_com: allocate specific region of memory to OP-TEE
@ 2021-08-25 13:22 Oleksandr Suvorov
  2021-08-25 13:46 ` Tom Rini
  2021-08-25 13:50 ` Fabio Estevam
  0 siblings, 2 replies; 5+ messages in thread
From: Oleksandr Suvorov @ 2021-08-25 13:22 UTC (permalink / raw)
  To: u-boot; +Cc: Ricardo Salveti, Simon Glass

From: Ricardo Salveti <ricardo@foundries.io>

On the iMX7ULP uCOM board, 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.

Note the OPTEE boot process itself subtracts the DRAM region it
lives in from the memory map passed to Linux.

Signed-off-by: Ricardo Salveti <ricardo@foundries.io>
---

 board/ea/mx7ulp_com/mx7ulp_com.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/board/ea/mx7ulp_com/mx7ulp_com.c b/board/ea/mx7ulp_com/mx7ulp_com.c
index 5b2d444366..7fce75ade9 100644
--- a/board/ea/mx7ulp_com/mx7ulp_com.c
+++ b/board/ea/mx7ulp_com/mx7ulp_com.c
@@ -20,6 +20,10 @@ int dram_init(void)
 {
 	gd->ram_size = imx_ddr_size();
 
+#ifdef CONFIG_OPTEE_TZDRAM_SIZE
+	gd->ram_size -= CONFIG_OPTEE_TZDRAM_SIZE;
+#endif
+
 	return 0;
 }
 
-- 
2.31.1


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

* Re: [PATCH] board: ea: mx7ulp_com: allocate specific region of memory to OP-TEE
  2021-08-25 13:22 [PATCH] board: ea: mx7ulp_com: allocate specific region of memory to OP-TEE Oleksandr Suvorov
@ 2021-08-25 13:46 ` Tom Rini
  2021-08-25 15:35   ` Oleksandr Suvorov
  2021-08-25 13:50 ` Fabio Estevam
  1 sibling, 1 reply; 5+ messages in thread
From: Tom Rini @ 2021-08-25 13:46 UTC (permalink / raw)
  To: Oleksandr Suvorov, Stefano Babic; +Cc: u-boot, Ricardo Salveti, Simon Glass

[-- Attachment #1: Type: text/plain, Size: 829 bytes --]

On Wed, Aug 25, 2021 at 04:22:55PM +0300, Oleksandr Suvorov wrote:

> From: Ricardo Salveti <ricardo@foundries.io>
> 
> On the iMX7ULP uCOM board, 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.
> 
> Note the OPTEE boot process itself subtracts the DRAM region it
> lives in from the memory map passed to Linux.

Is this something true of all OP-TEE?  All OP-TEE on ARMv7?  All OP-TEE
on i.MX7?  I'm asking since currently this hook is done the exact same
way on a few other i.MX7 boards, and nowhere else.  That says to me we
should probably move this hook up somewhere, perhaps to imx_ddr_size()
and poke the boards that aren't using that today to use it.

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

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

* Re: [PATCH] board: ea: mx7ulp_com: allocate specific region of memory to OP-TEE
  2021-08-25 13:22 [PATCH] board: ea: mx7ulp_com: allocate specific region of memory to OP-TEE Oleksandr Suvorov
  2021-08-25 13:46 ` Tom Rini
@ 2021-08-25 13:50 ` Fabio Estevam
  1 sibling, 0 replies; 5+ messages in thread
From: Fabio Estevam @ 2021-08-25 13:50 UTC (permalink / raw)
  To: Oleksandr Suvorov; +Cc: U-Boot-Denx, Ricardo Salveti, Simon Glass

Hi Oleksandr,

On Wed, Aug 25, 2021 at 10:37 AM Oleksandr Suvorov
<oleksandr.suvorov@foundries.io> wrote:
>
> From: Ricardo Salveti <ricardo@foundries.io>
>
> On the iMX7ULP uCOM board, 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.
>
> Note the OPTEE boot process itself subtracts the DRAM region it
> lives in from the memory map passed to Linux.
>
> Signed-off-by: Ricardo Salveti <ricardo@foundries.io>

You missed adding your own Signed-off-by here.

With this fixed:

Reviewed-by: Fabio Estevam <festevam@gmail.com>

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

* Re: [PATCH] board: ea: mx7ulp_com: allocate specific region of memory to OP-TEE
  2021-08-25 13:46 ` Tom Rini
@ 2021-08-25 15:35   ` Oleksandr Suvorov
  2021-08-25 15:39     ` Tom Rini
  0 siblings, 1 reply; 5+ messages in thread
From: Oleksandr Suvorov @ 2021-08-25 15:35 UTC (permalink / raw)
  To: Tom Rini; +Cc: Stefano Babic, u-boot, Ricardo Salveti, Simon Glass

Hi Tom,


On Wed, Aug 25, 2021 at 4:46 PM Tom Rini <trini@konsulko.com> wrote:
>
> On Wed, Aug 25, 2021 at 04:22:55PM +0300, Oleksandr Suvorov wrote:
>
> > From: Ricardo Salveti <ricardo@foundries.io>
> >
> > On the iMX7ULP uCOM board, 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.
> >
> > Note the OPTEE boot process itself subtracts the DRAM region it
> > lives in from the memory map passed to Linux.
>
> Is this something true of all OP-TEE?  All OP-TEE on ARMv7?  All OP-TEE
> on i.MX7?  I'm asking since currently this hook is done the exact same
> way on a few other i.MX7 boards, and nowhere else.  That says to me we
> should probably move this hook up somewhere, perhaps to imx_ddr_size()
> and poke the boards that aren't using that today to use it.

Shortly, no. There are different solutions for different boards and
they seem not
vendor-specific. Say, solutions for both stm32mp1 and zynqmp boards use fdt's
reserve memory section to avoid conflicts with the OP-TEE memory region.
We're thinking about providing a generic solution, but it will take
some time and
can't be done right now.

>
> --
> Tom


--
Best regards,

Oleksandr Suvorov
Software Engineer
W: www.foundries.io

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

* Re: [PATCH] board: ea: mx7ulp_com: allocate specific region of memory to OP-TEE
  2021-08-25 15:35   ` Oleksandr Suvorov
@ 2021-08-25 15:39     ` Tom Rini
  0 siblings, 0 replies; 5+ messages in thread
From: Tom Rini @ 2021-08-25 15:39 UTC (permalink / raw)
  To: Oleksandr Suvorov; +Cc: Stefano Babic, u-boot, Ricardo Salveti, Simon Glass

[-- Attachment #1: Type: text/plain, Size: 1513 bytes --]

On Wed, Aug 25, 2021 at 06:35:05PM +0300, Oleksandr Suvorov wrote:
> Hi Tom,
> 
> 
> On Wed, Aug 25, 2021 at 4:46 PM Tom Rini <trini@konsulko.com> wrote:
> >
> > On Wed, Aug 25, 2021 at 04:22:55PM +0300, Oleksandr Suvorov wrote:
> >
> > > From: Ricardo Salveti <ricardo@foundries.io>
> > >
> > > On the iMX7ULP uCOM board, 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.
> > >
> > > Note the OPTEE boot process itself subtracts the DRAM region it
> > > lives in from the memory map passed to Linux.
> >
> > Is this something true of all OP-TEE?  All OP-TEE on ARMv7?  All OP-TEE
> > on i.MX7?  I'm asking since currently this hook is done the exact same
> > way on a few other i.MX7 boards, and nowhere else.  That says to me we
> > should probably move this hook up somewhere, perhaps to imx_ddr_size()
> > and poke the boards that aren't using that today to use it.
> 
> Shortly, no. There are different solutions for different boards and
> they seem not
> vendor-specific. Say, solutions for both stm32mp1 and zynqmp boards use fdt's
> reserve memory section to avoid conflicts with the OP-TEE memory region.
> We're thinking about providing a generic solution, but it will take
> some time and
> can't be done right now.

So it's board-specific up at the OP-TEE level?  OK, sigh.  This is fine
then.  Thanks.

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

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

end of thread, other threads:[~2021-08-25 15:39 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-25 13:22 [PATCH] board: ea: mx7ulp_com: allocate specific region of memory to OP-TEE Oleksandr Suvorov
2021-08-25 13:46 ` Tom Rini
2021-08-25 15:35   ` Oleksandr Suvorov
2021-08-25 15:39     ` Tom Rini
2021-08-25 13:50 ` Fabio Estevam

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.