Skip to contentSkip to conversation

Tidy up some dangling OP-TEE gotchas

PATCH New Bryan O'Donoghue 3 participants 8 messages Apr 24, 2019 – Apr 30, 2019

lore
Share & tools
lore
#0 lore raw

cover Tidy up some dangling OP-TEE gotchas

Rober P Day rightly pointed out that some odd OP-TEE specific defines were appearing in his defconfig, despite not having CONFIG_OPTEE=y set in his defconfig.

Looking into this with a small bit of restructure we can fix this corner case.

- Make sure OP-TEE CONFIG options only appear when you are compiling for OPTEE
- Fix WaRP7 BL33 so that the low-level init skipping routines can tolerate the afore mentioned change.
- Update MAINTAINERS with my own details so that questions pertaining to lib/optee comes my way.

Bryan O'Donoghue (4):
optee: Make TZDRAM config options contingent on CONFIG_OPTEE
warp7: include: configs: Skip low-level init if BOOTM_OPTEE false
warp7: configs: bl33: Tidy up OPTEE defines
MAINTAINERS: Update lib/optee with my details

 MAINTAINERS                  | 5 +++++
 configs/warp7_bl33_defconfig | 4 +++-
 include/configs/warp7.h      | 4 +---
 lib/optee/Kconfig            | 2 ++
 4 files changed, 11 insertions(+), 4 deletions(-)
Signature · 1 line
2.20.1
#1 lore raw

PATCH 1/4 optee: Make TZDRAM config options contingent on CONFIG_OPTEE

Commit c7b3a7ee5351 ("optee: adjust dependencies and default values for dram") makes the TZDRAM defines for OPTEE show up for all configs as a side-effect. While not harmful its not what we really want.

This patch makes the following defines contingent on CONFIG_OPTEE=y

CONFIG_OPTEE_TZDRAM_BASE
CONFIG_OPTEE_TZDRAM_SIZE

Rightly, if you don't have CONFIG_OPTEE=y you don't care about the above two defines.

---
 lib/optee/Kconfig | 2 ++
 1 file changed, 2 insertions(+)
lib/optee/Kconfig +2 -0
index 3773d89c31..c398f9b953 100644
@@ -17,6 +17,7 @@ config OPTEE_LOAD_ADDR
 config OPTEE_TZDRAM_SIZE
 	hex "Amount of Trust-Zone RAM for the OPTEE image"
 	default 0x0000000
+	depends on OPTEE
 	help
 	  The size of pre-allocated Trust Zone DRAM to allocate for the OPTEE
 	  runtime.
@@ -24,6 +25,7 @@ config OPTEE_TZDRAM_SIZE
 config OPTEE_TZDRAM_BASE
 	hex "Base address of Trust-Zone RAM for the OPTEE image"
 	default 0x00000000
+	depends on OPTEE
 	help
 	  The base address of pre-allocated Trust Zone DRAM for
 	  the OPTEE runtime.
Signature · 1 line
2.20.1
#2 lore raw

PATCH 2/4 warp7: include: configs: Skip low-level init if BOOTM_OPTEE false

In reply to Bryan O'Donoghue

Commit c7b3a7ee5351 ("optee: adjust dependencies and default values for dram") wants to skip low-level init of i.MX7 hardware in the case where OP-TEE has already run and u-boot is being run as BL33 in normal world.

Currently we check for both #ifdef CONFIG_OPTEE_TZDRAM_SIZE and #ifndef CONFIG_OPTEE to determine if lowlevel init should be skipped, however, in order to ensure non-OPTEE users never see OPTEE related defines we cannot rely on this method.

Fortunately we can use CONFIG_BOOTM_OPTEE for the same purpose. CONFIG_BOOTM_OPTEE is only relevant if you want u-boot to load OP-TEE not if u-boot has already been loaded by OP-TEE.

Cc Fabio Estevam <[email protected]>
Cc Breno Lima <[email protected]>
Cc Rui Miguel Silva <[email protected]>
---
 include/configs/warp7.h | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
include/configs/warp7.h +1 -3
index 043f2861b6..458cb8fe10 100644
@@ -18,11 +18,9 @@
  * launched by OPTEE, because of that we shall skip all the low level
  * initialization since it was already done by ATF or OPTEE
  */
-#ifdef CONFIG_OPTEE_TZDRAM_SIZE
-#ifndef CONFIG_OPTEE
+#ifndef CONFIG_BOOTM_OPTEE
 #define CONFIG_SKIP_LOWLEVEL_INIT
 #endif
-#endif
 
 #define CONFIG_MXC_UART_BASE		UART1_IPS_BASE_ADDR
 
Signature · 1 line
2.20.1
#3 lore raw

PATCH 3/4 warp7: configs: bl33: Tidy up OPTEE defines

In reply to Bryan O'Donoghue

When booting in BL33 mode i.e. with u-boot loaded by OP-TEE we get the following print-out.

Board: WARP7 in secure mode OPTEE DRAM 0xa0000000-0xa0000000

This is incorrect the right range is 0x9e000000-0xa0000000. This patch fixes the defines on the warp7_bl33_defconfig file to tidy up the output.

---
 configs/warp7_bl33_defconfig | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
configs/warp7_bl33_defconfig +3 -1
index 6eaf152bac..8cc622fe47 100644
@@ -50,4 +50,6 @@ CONFIG_USB_GADGET_DOWNLOAD=y
 CONFIG_USB_ETHER=y
 CONFIG_USB_ETH_CDC=y
 CONFIG_USBNET_HOST_ADDR="de:ad:be:af:00:00"
-CONFIG_OPTEE_TZDRAM_SIZE=0x2000000
+CONFIG_OPTEE=y
+CONFIG_OPTEE_TZDRAM_BASE=0x9e000000
+CONFIG_OPTEE_TZDRAM_SIZE=0x02000000
Signature · 1 line
2.20.1
#4 lore raw

PATCH 4/4 MAINTAINERS: Update lib/optee with my details

In reply to Bryan O'Donoghue

Commit 32ce6179fb99 ("optee: Add lib entries for sharing OPTEE code across ports") adds code into lib/optee but neglects to update MAINTAINERS to make me buggable for questions and maintenance.

---
 MAINTAINERS | 5 +++++
 1 file changed, 5 insertions(+)
MAINTAINERS +5 -0
index aa4b3bc650..16ea180fe2 100644
@@ -754,6 +754,11 @@ F:	drivers/tee/
 F:	include/tee.h
 F:	include/tee/
 
+TEE-lib
+M:	Bryan O'Donoghue <[email protected]>
+S:	Maintained
+F:	lib/optee
+
 UBI
 M:	Kyungmin Park <[email protected]>
 M:	Heiko Schocher <[email protected]>
Signature · 1 line
2.20.1
#5 lore raw

cover Tidy up some dangling OP-TEE gotchas

In reply to Bryan O'Donoghue
Quoted 3 lines · Bryan O'Donoghue

Rober P Day rightly pointed out that some odd OP-TEE specific defines were appearing in his defconfig, despite not having CONFIG_OPTEE=y set in his defconfig.

Ping,

Robert, Rui, Fabio - do you guys want changes here ?

---
bod

#6 lore raw

cover Tidy up some dangling OP-TEE gotchas

Hi Bryan,

Quoted 8 lines · Bryan O'Donoghue
Quoted 3 lines · Bryan O'Donoghue

Rober P Day rightly pointed out that some odd OP-TEE specific defines were appearing in his defconfig, despite not having CONFIG_OPTEE=y set in his defconfig.

Ping,

Robert, Rui, Fabio - do you guys want changes here ?

Regarding OPTEE, patches 1/4 and 2/4:

---
Cheers,
Rui

#7 lore raw

cover Tidy up some dangling OP-TEE gotchas

In reply to Bryan O'Donoghue
Quoted 11 lines · Bryan O'Donoghue
Quoted 3 lines · Bryan O'Donoghue

Rober P Day rightly pointed out that some odd OP-TEE specific defines were appearing in his defconfig, despite not having CONFIG_OPTEE=y set in his defconfig.

Ping,

Robert, Rui, Fabio - do you guys want changes here ?

Looks good to me.