Skip to contentSkip to conversation

apalis_imx6: allocate specific region of memory to OP-TEE

PATCH New Ricardo Salveti 4 participants 6 messages Sep 2, 2019 – Sep 3, 2019 Arm i.MX and Layerscape

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

---
 board/toradex/apalis_imx6/apalis_imx6.c | 5 +++++
 1 file changed, 5 insertions(+)
board/toradex/apalis_imx6/apalis_imx6.c +5 -0
index 6421a22c25..fa7fcc8d46 100644
@@ -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;
 }
 
Signature · 1 line
2.23.0
#1 lore raw

PATCH 1/1 apalis_imx6: allocate specific region of memory to OP-TEE

Quoted 18 lines

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.

---
 board/toradex/apalis_imx6/apalis_imx6.c | 5 +++++
 1 file changed, 5 insertions(+)
board/toradex/apalis_imx6/apalis_imx6.c +0 -0
index 6421a22c25..fa7fcc8d46 100644

board/toradex/apalis_imx6/apalis_imx6.c int dram_init(void) · line 81

Quoted 7 lines
board/toradex/apalis_imx6/apalis_imx6.c +4 -0
@@ -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.

Quoted 5 lines
board/toradex/apalis_imx6/apalis_imx6.c +0 -1
 	return 0;
 }
 
--

2.23.0

#2 lore raw

PATCH 1/1 apalis_imx6: allocate specific region of memory to OP-TEE

Quoted 22 lines · Peng Fan
Quoted 22 lines

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.

---
 board/toradex/apalis_imx6/apalis_imx6.c | 5 +++++
 1 file changed, 5 insertions(+)
board/toradex/apalis_imx6/apalis_imx6.c +0 -0
index 6421a22c25..fa7fcc8d46 100644
@@ -75,6 +75,11 @@ int dram_init(void)
      gd->ram_size = get_ram_size((void *)CONFIG_SYS_SDRAM_BASE,
                                  (ulong)imx_ddr_size());
 
Quoted 6 lines

board/toradex/apalis_imx6/apalis_imx6.c int dram_init(void) · line 81

Quoted 4 lines
board/toradex/apalis_imx6/apalis_imx6.c +4 -0
+     /* 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,

Signature · 1 line
Ricardo Salveti
#3 lore raw

PATCH 1/1 apalis_imx6: allocate specific region of memory to OP-TEE

Hi Ricardo,

Quoted 31 lines · Ricardo Salveti
Quoted 22 lines · Peng Fan
Quoted 22 lines

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.

---
 board/toradex/apalis_imx6/apalis_imx6.c | 5 +++++
 1 file changed, 5 insertions(+)
board/toradex/apalis_imx6/apalis_imx6.c +0 -0
index 6421a22c25..fa7fcc8d46 100644
@@ -75,6 +75,11 @@ int dram_init(void)
      gd->ram_size = get_ram_size((void *)CONFIG_SYS_SDRAM_BASE,
                                  (ulong)imx_ddr_size());
 
Quoted 6 lines

board/toradex/apalis_imx6/apalis_imx6.c int dram_init(void) · line 81

Quoted 4 lines
board/toradex/apalis_imx6/apalis_imx6.c +4 -0
+     /* 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.

Quoted 5 lines

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

Quoted 8 lines

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

Thanks

Signature · 8 lines
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
#4 lore raw

PATCH 1/1 apalis_imx6: allocate specific region of memory to OP-TEE

Quoted 40 lines · Igor Opaniuk

Hi Ricardo,

Quoted 31 lines · Ricardo Salveti
Quoted 22 lines · Peng Fan
Quoted 22 lines

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.

---
 board/toradex/apalis_imx6/apalis_imx6.c | 5 +++++
 1 file changed, 5 insertions(+)
board/toradex/apalis_imx6/apalis_imx6.c +0 -0
index 6421a22c25..fa7fcc8d46 100644
@@ -75,6 +75,11 @@ int dram_init(void)
      gd->ram_size = get_ram_size((void *)CONFIG_SYS_SDRAM_BASE,
                                  (ulong)imx_ddr_size());
 
Quoted 6 lines

board/toradex/apalis_imx6/apalis_imx6.c int dram_init(void) · line 81

Quoted 4 lines
board/toradex/apalis_imx6/apalis_imx6.c +4 -0
+     /* 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.

Quoted 5 lines

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.

Quoted 6 lines

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

#5 lore raw

PATCH 1/1 apalis_imx6: allocate specific region of memory to OP-TEE

In reply to Ricardo Salveti
Quoted 17 lines · Ricardo Salveti

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.

---
 board/toradex/apalis_imx6/apalis_imx6.c | 5 +++++
 1 file changed, 5 insertions(+)
board/toradex/apalis_imx6/apalis_imx6.c +0 -0
index 6421a22c25..fa7fcc8d46 100644
@@ -75,6 +75,11 @@ int dram_init(void)
 	gd->ram_size = get_ram_size((void *)CONFIG_SYS_SDRAM_BASE,

board/toradex/apalis_imx6/apalis_imx6.c int dram_init(void) · line 85

Quoted 10 lines
board/toradex/apalis_imx6/apalis_imx6.c +5 -0
 				    (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;
 }