[PATCH v3 0/6] imx8(m): add optee node to binman FIT image

There have been attempts to get op-tee node integrated upstream in the past [1][2]. The challenge is on how to handle the load and entry addresses where the op-tee image should be loaded to. Different SoC families and architectures have different RAM base addresses. Further the final addresses can vary from board to board (e.g. depending on populated RAM size). This approach follows the TI k3 kconfig solution. To be able to define a sensible default for the new config option, put it in the imx8m kconfig. For other imx families, the RAM start addresses are different and thus finding a common sensible default is not possible. I do not have a working Nano and quad board so I was not able to test them.
I included usage for PHYTEC boards for examples (with documentation).
[1] https://patchwork.ozlabs.org/project/uboot/patch/20230622173006.3921891-1-th... [2] https://patchwork.ozlabs.org/project/uboot/patch/ZeHDVr-Bzm935-5N@mecka.net/
--- Changes in v3: - use OPTEE_LOAD_ADDR defaults as defined in upstream tf-a - add imx8mq (untested) - move common PHYTEC imx8mm optee build doc into include file
Changes in v2 (from RFC): - Use kconfig instead of trying pure dt approach. - Add load addresses in defconfigs instead of <board>-u-boot dts.
--- Yannic Moog (6): arm: imx8m: add OP-TEE node phycore-imx8mp_defconfig: add optee load address imx8mm-phygate-tauri-l_defconfig: add optee load address phycore-imx8mm_defconfig: add optee load address doc: phytec: imx8mp: add OP-TEE documentation doc: phytec: imx8mm: add OP-TEE documentation
arch/arm/dts/imx8mm-u-boot.dtsi | 17 ++++++++++++++++- arch/arm/dts/imx8mn-u-boot.dtsi | 17 ++++++++++++++++- arch/arm/dts/imx8mp-u-boot.dtsi | 17 ++++++++++++++++- arch/arm/dts/imx8mq-u-boot.dtsi | 17 ++++++++++++++++- arch/arm/mach-imx/imx8m/Kconfig | 11 +++++++++++ board/phytec/phycore_imx8mm/MAINTAINERS | 1 + configs/imx8mm-phygate-tauri-l_defconfig | 1 + configs/phycore-imx8mm_defconfig | 1 + configs/phycore-imx8mp_defconfig | 1 + doc/board/phytec/imx8mm-optee-build.rsti | 14 ++++++++++++++ doc/board/phytec/imx8mm-phygate-tauri-l.rst | 9 ++++++++- doc/board/phytec/phycore-imx8mm.rst | 8 +++++++- doc/board/phytec/phycore-imx8mp.rst | 20 +++++++++++++++++++- 13 files changed, 127 insertions(+), 7 deletions(-) --- base-commit: 6016960ceb9d3fda591cda94df3841748fb65596 change-id: 20240903-phytec_imx8m_optee-8674ef012a36
Best regards,

Add tee node in SoC u-boot device trees. Use a kconfig entry to specify load and entry addresses for the op-tee image in the respective defconfig. Default IMX8M_OPTEE_LOAD_ADDR is supplied. To keep it simple, the same addresses are used for each SoC as are defined in upstream tf-a (BL32_BASE) [1].
[1] https://github.com/ARM-software/arm-trusted-firmware/tree/master/plat/imx/im...
Signed-off-by: Yannic Moog y.moog@phytec.de --- arch/arm/dts/imx8mm-u-boot.dtsi | 17 ++++++++++++++++- arch/arm/dts/imx8mn-u-boot.dtsi | 17 ++++++++++++++++- arch/arm/dts/imx8mp-u-boot.dtsi | 17 ++++++++++++++++- arch/arm/dts/imx8mq-u-boot.dtsi | 17 ++++++++++++++++- arch/arm/mach-imx/imx8m/Kconfig | 11 +++++++++++ 5 files changed, 75 insertions(+), 4 deletions(-)
diff --git a/arch/arm/dts/imx8mm-u-boot.dtsi b/arch/arm/dts/imx8mm-u-boot.dtsi index d31bc822532..ecc2319279e 100644 --- a/arch/arm/dts/imx8mm-u-boot.dtsi +++ b/arch/arm/dts/imx8mm-u-boot.dtsi @@ -164,6 +164,21 @@ }; #endif
+ tee: tee { + description = "OP-TEE"; + type = "tee"; + arch = "arm64"; + compression = "none"; + os = "tee"; + load = <CONFIG_IMX8M_OPTEE_LOAD_ADDR>; + entry = <CONFIG_IMX8M_OPTEE_LOAD_ADDR>; + + tee-os { + filename = "tee.bin"; + optional; + }; + }; + binman_fip: fip { arch = "arm64"; compression = "none"; @@ -192,7 +207,7 @@ fdt = "fdt-SEQ"; firmware = "uboot"; #ifndef CONFIG_ARMV8_PSCI - loadables = "atf"; + loadables = "atf", "tee"; #endif }; }; diff --git a/arch/arm/dts/imx8mn-u-boot.dtsi b/arch/arm/dts/imx8mn-u-boot.dtsi index 6d80d856365..4a4498b36b0 100644 --- a/arch/arm/dts/imx8mn-u-boot.dtsi +++ b/arch/arm/dts/imx8mn-u-boot.dtsi @@ -240,6 +240,21 @@ }; #endif
+ tee: tee { + description = "OP-TEE"; + type = "tee"; + arch = "arm64"; + compression = "none"; + os = "tee"; + load = <CONFIG_IMX8M_OPTEE_LOAD_ADDR>; + entry = <CONFIG_IMX8M_OPTEE_LOAD_ADDR>; + + tee-os { + filename = "tee.bin"; + optional; + }; + }; + binman_fip: fip { arch = "arm64"; compression = "none"; @@ -268,7 +283,7 @@ fdt = "fdt-SEQ"; firmware = "uboot"; #ifndef CONFIG_ARMV8_PSCI - loadables = "atf"; + loadables = "atf", "tee"; #endif }; }; diff --git a/arch/arm/dts/imx8mp-u-boot.dtsi b/arch/arm/dts/imx8mp-u-boot.dtsi index 56749ccacd2..9ede98a11e4 100644 --- a/arch/arm/dts/imx8mp-u-boot.dtsi +++ b/arch/arm/dts/imx8mp-u-boot.dtsi @@ -185,6 +185,21 @@ }; #endif
+ tee: tee { + description = "OP-TEE"; + type = "tee"; + arch = "arm64"; + compression = "none"; + os = "tee"; + load = <CONFIG_IMX8M_OPTEE_LOAD_ADDR>; + entry = <CONFIG_IMX8M_OPTEE_LOAD_ADDR>; + + tee-os { + filename = "tee.bin"; + optional; + }; + }; + @fdt-SEQ { description = "NAME"; type = "flat_dt"; @@ -204,7 +219,7 @@ fdt = "fdt-SEQ"; firmware = "uboot"; #ifndef CONFIG_ARMV8_PSCI - loadables = "atf"; + loadables = "atf", "tee"; #endif }; }; diff --git a/arch/arm/dts/imx8mq-u-boot.dtsi b/arch/arm/dts/imx8mq-u-boot.dtsi index d7a83a78f4d..93e2ef27f7c 100644 --- a/arch/arm/dts/imx8mq-u-boot.dtsi +++ b/arch/arm/dts/imx8mq-u-boot.dtsi @@ -144,6 +144,21 @@ }; #endif
+ tee: tee { + description = "OP-TEE"; + type = "tee"; + arch = "arm64"; + compression = "none"; + os = "tee"; + load = <CONFIG_IMX8M_OPTEE_LOAD_ADDR>; + entry = <CONFIG_IMX8M_OPTEE_LOAD_ADDR>; + + tee-os { + filename = "tee.bin"; + optional; + }; + }; + fdt { compression = "none"; description = "NAME"; @@ -164,7 +179,7 @@ fdt = "fdt"; firmware = "uboot"; #ifndef CONFIG_ARMV8_PSCI - loadables = "atf"; + loadables = "atf", "tee"; #endif }; }; diff --git a/arch/arm/mach-imx/imx8m/Kconfig b/arch/arm/mach-imx/imx8m/Kconfig index b254a50b091..8aeb1ea75f7 100644 --- a/arch/arm/mach-imx/imx8m/Kconfig +++ b/arch/arm/mach-imx/imx8m/Kconfig @@ -37,6 +37,17 @@ config SYS_HAS_ARMV8_SECURE_BASE If enabled, please also define the value for ARMV8_SECURE_BASE, for i.MX8M, it could be some address in OCRAM.
+config IMX8M_OPTEE_LOAD_ADDR + hex "Load address of OPTEE image" + default 0xbe000000 if IMX8MM + default 0xbe000000 if IMX8MN + default 0x56000000 if IMX8MP + default 0xfe000000 if IMX8MQ + help + The load and entry address for the OPTEE image. This value defaults to + the one defined in tf-a if not provided in the board defconfig file. + + choice prompt "NXP i.MX8M board select" optional

On Fri, Jan 10, 2025 at 4:35 AM Yannic Moog y.moog@phytec.de wrote:
Add tee node in SoC u-boot device trees. Use a kconfig entry to specify load and entry addresses for the op-tee image in the respective defconfig. Default IMX8M_OPTEE_LOAD_ADDR is supplied. To keep it simple, the same addresses are used for each SoC as are defined in upstream tf-a (BL32_BASE) [1].
[1] https://github.com/ARM-software/arm-trusted-firmware/tree/master/plat/imx/im...
Signed-off-by: Yannic Moog y.moog@phytec.de
arch/arm/dts/imx8mm-u-boot.dtsi | 17 ++++++++++++++++- arch/arm/dts/imx8mn-u-boot.dtsi | 17 ++++++++++++++++- arch/arm/dts/imx8mp-u-boot.dtsi | 17 ++++++++++++++++- arch/arm/dts/imx8mq-u-boot.dtsi | 17 ++++++++++++++++- arch/arm/mach-imx/imx8m/Kconfig | 11 +++++++++++ 5 files changed, 75 insertions(+), 4 deletions(-)
diff --git a/arch/arm/dts/imx8mm-u-boot.dtsi b/arch/arm/dts/imx8mm-u-boot.dtsi index d31bc822532..ecc2319279e 100644 --- a/arch/arm/dts/imx8mm-u-boot.dtsi +++ b/arch/arm/dts/imx8mm-u-boot.dtsi @@ -164,6 +164,21 @@ }; #endif
tee: tee {
description = "OP-TEE";
type = "tee";
arch = "arm64";
compression = "none";
os = "tee";
load = <CONFIG_IMX8M_OPTEE_LOAD_ADDR>;
entry = <CONFIG_IMX8M_OPTEE_LOAD_ADDR>;
tee-os {
filename = "tee.bin";
optional;
};
};
binman_fip: fip { arch = "arm64"; compression = "none";
@@ -192,7 +207,7 @@ fdt = "fdt-SEQ"; firmware = "uboot"; #ifndef CONFIG_ARMV8_PSCI
loadables = "atf";
loadables = "atf", "tee";
#endif }; }; diff --git a/arch/arm/dts/imx8mn-u-boot.dtsi b/arch/arm/dts/imx8mn-u-boot.dtsi index 6d80d856365..4a4498b36b0 100644 --- a/arch/arm/dts/imx8mn-u-boot.dtsi +++ b/arch/arm/dts/imx8mn-u-boot.dtsi @@ -240,6 +240,21 @@ }; #endif
tee: tee {
description = "OP-TEE";
type = "tee";
arch = "arm64";
compression = "none";
os = "tee";
load = <CONFIG_IMX8M_OPTEE_LOAD_ADDR>;
entry = <CONFIG_IMX8M_OPTEE_LOAD_ADDR>;
tee-os {
filename = "tee.bin";
optional;
};
};
binman_fip: fip { arch = "arm64"; compression = "none";
@@ -268,7 +283,7 @@ fdt = "fdt-SEQ"; firmware = "uboot"; #ifndef CONFIG_ARMV8_PSCI
loadables = "atf";
loadables = "atf", "tee";
#endif }; }; diff --git a/arch/arm/dts/imx8mp-u-boot.dtsi b/arch/arm/dts/imx8mp-u-boot.dtsi index 56749ccacd2..9ede98a11e4 100644 --- a/arch/arm/dts/imx8mp-u-boot.dtsi +++ b/arch/arm/dts/imx8mp-u-boot.dtsi @@ -185,6 +185,21 @@ }; #endif
tee: tee {
description = "OP-TEE";
type = "tee";
arch = "arm64";
compression = "none";
os = "tee";
load = <CONFIG_IMX8M_OPTEE_LOAD_ADDR>;
entry = <CONFIG_IMX8M_OPTEE_LOAD_ADDR>;
tee-os {
filename = "tee.bin";
optional;
};
};
@fdt-SEQ { description = "NAME"; type = "flat_dt";
@@ -204,7 +219,7 @@ fdt = "fdt-SEQ"; firmware = "uboot"; #ifndef CONFIG_ARMV8_PSCI
loadables = "atf";
loadables = "atf", "tee";
#endif }; }; diff --git a/arch/arm/dts/imx8mq-u-boot.dtsi b/arch/arm/dts/imx8mq-u-boot.dtsi index d7a83a78f4d..93e2ef27f7c 100644 --- a/arch/arm/dts/imx8mq-u-boot.dtsi +++ b/arch/arm/dts/imx8mq-u-boot.dtsi @@ -144,6 +144,21 @@ }; #endif
tee: tee {
description = "OP-TEE";
type = "tee";
arch = "arm64";
compression = "none";
os = "tee";
load = <CONFIG_IMX8M_OPTEE_LOAD_ADDR>;
entry = <CONFIG_IMX8M_OPTEE_LOAD_ADDR>;
tee-os {
filename = "tee.bin";
optional;
};
};
fdt { compression = "none"; description = "NAME";
@@ -164,7 +179,7 @@ fdt = "fdt"; firmware = "uboot"; #ifndef CONFIG_ARMV8_PSCI
loadables = "atf";
loadables = "atf", "tee";
#endif }; };
Hi Yannic,
As I mentioned before, I still don't see how this builds when tee.bin is missing because someone isn't using tee?
It looks like Fabio has merged this already to imx/master which now fails to build for imx8m*_venice boards because of it.
Fabio, did you realize that you merged this already and if so how does it work for you?
Best Regards,
Tim
diff --git a/arch/arm/mach-imx/imx8m/Kconfig b/arch/arm/mach-imx/imx8m/Kconfig index b254a50b091..8aeb1ea75f7 100644 --- a/arch/arm/mach-imx/imx8m/Kconfig +++ b/arch/arm/mach-imx/imx8m/Kconfig @@ -37,6 +37,17 @@ config SYS_HAS_ARMV8_SECURE_BASE If enabled, please also define the value for ARMV8_SECURE_BASE, for i.MX8M, it could be some address in OCRAM.
+config IMX8M_OPTEE_LOAD_ADDR
hex "Load address of OPTEE image"
default 0xbe000000 if IMX8MM
default 0xbe000000 if IMX8MN
default 0x56000000 if IMX8MP
default 0xfe000000 if IMX8MQ
help
The load and entry address for the OPTEE image. This value defaults to
the one defined in tf-a if not provided in the board defconfig file.
choice prompt "NXP i.MX8M board select" optional
-- 2.43.0

On Thu, Jan 16, 2025 at 7:45 PM Tim Harvey tharvey@gateworks.com wrote:
Hi Yannic,
As I mentioned before, I still don't see how this builds when tee.bin is missing because someone isn't using tee?
It looks like Fabio has merged this already to imx/master which now fails to build for imx8m*_venice boards because of it.
make mrproper make imx8mp_venice_defconfig make
flash.bin is still generated despite this nasty warning:
CFGS spl/u-boot-spl.cfgout BINMAN .binman_stamp Image 'image' has faked external blobs and is non-functional: tee.bin
Image 'image' is missing optional external blobs but is still functional: tee-os
/binman/section/fit/images/tee/tee-os (tee.bin): See the documentation for your board. You may need to build Open Portable Trusted Execution Environment (OP-TEE) and build with TEE=/path/to/tee.bin
Some images are invalid make: *** [Makefile:1135: .binman_stamp] Error 103
CI also did not complain.
Yes, I would welcome a patch that removes these tee messages by default.

On Thu, Jan 16, 2025 at 2:57 PM Fabio Estevam festevam@gmail.com wrote:
On Thu, Jan 16, 2025 at 7:45 PM Tim Harvey tharvey@gateworks.com wrote:
Hi Yannic,
As I mentioned before, I still don't see how this builds when tee.bin is missing because someone isn't using tee?
It looks like Fabio has merged this already to imx/master which now fails to build for imx8m*_venice boards because of it.
make mrproper make imx8mp_venice_defconfig make
flash.bin is still generated despite this nasty warning:
CFGS spl/u-boot-spl.cfgout BINMAN .binman_stamp Image 'image' has faked external blobs and is non-functional: tee.bin
Image 'image' is missing optional external blobs but is still functional: tee-os
/binman/section/fit/images/tee/tee-os (tee.bin): See the documentation for your board. You may need to build Open Portable Trusted Execution Environment (OP-TEE) and build with TEE=/path/to/tee.bin
Some images are invalid make: *** [Makefile:1135: .binman_stamp] Error 103
CI also did not complain.
I must admit I don't know much about how CI works but the make process returns an error status, but you are correct flash.bin exists.
Yes, I would welcome a patch that removes these tee messages by default.
I'm not sure I agree that they should be considered nasty warnings and removed. What if you intended tee.bin to be included but forgot to copy it here and you end up with this?
Best Regards,
Tim

On Thu, Jan 16, 2025 at 8:11 PM Tim Harvey tharvey@gateworks.com wrote:
I'm not sure I agree that they should be considered nasty warnings and removed. What if you intended tee.bin to be included but forgot to copy it here and you end up with this?
If tee is not used, we should not get warnings about missing tee.bin .
I sent a patch. Please give it a try.

Hi Tim, Fabio,
On Thu, 2025-01-16 at 14:45 -0800, Tim Harvey wrote:
On Fri, Jan 10, 2025 at 4:35 AM Yannic Moog y.moog@phytec.de wrote:
Add tee node in SoC u-boot device trees. Use a kconfig entry to specify load and entry addresses for the op-tee image in the respective defconfig. Default IMX8M_OPTEE_LOAD_ADDR is supplied. To keep it simple, the same addresses are used for each SoC as are defined in upstream tf-a (BL32_BASE) [1].
[1] https://github.com/ARM-software/arm-trusted-firmware/tree/master/plat/imx/im...
Signed-off-by: Yannic Moog y.moog@phytec.de
arch/arm/dts/imx8mm-u-boot.dtsi | 17 ++++++++++++++++- arch/arm/dts/imx8mn-u-boot.dtsi | 17 ++++++++++++++++- arch/arm/dts/imx8mp-u-boot.dtsi | 17 ++++++++++++++++- arch/arm/dts/imx8mq-u-boot.dtsi | 17 ++++++++++++++++- arch/arm/mach-imx/imx8m/Kconfig | 11 +++++++++++ 5 files changed, 75 insertions(+), 4 deletions(-)
[...]
diff --git a/arch/arm/dts/imx8mq-u-boot.dtsi b/arch/arm/dts/imx8mq-u-boot.dtsi index d7a83a78f4d..93e2ef27f7c 100644 --- a/arch/arm/dts/imx8mq-u-boot.dtsi +++ b/arch/arm/dts/imx8mq-u-boot.dtsi @@ -144,6 +144,21 @@ }; #endif
+ tee: tee { + description = "OP-TEE"; + type = "tee"; + arch = "arm64"; + compression = "none"; + os = "tee"; + load = <CONFIG_IMX8M_OPTEE_LOAD_ADDR>; + entry = <CONFIG_IMX8M_OPTEE_LOAD_ADDR>;
+ tee-os { + filename = "tee.bin"; + optional; + }; + };
fdt { compression = "none"; description = "NAME"; @@ -164,7 +179,7 @@ fdt = "fdt"; firmware = "uboot"; #ifndef CONFIG_ARMV8_PSCI - loadables = "atf"; + loadables = "atf", "tee"; #endif }; };
Hi Yannic,
As I mentioned before, I still don't see how this builds when tee.bin is missing because someone isn't using tee?
Well, because tee.bin is marked optional. In my initial series, this worked as expected. All you got was
BINMAN .binman_stamp Image 'image' is missing optional external blobs but is still functional: tee-os
Since Simon submitted [1], that behaviour changed and you got 2 messages. One error, one warning, both contradicting each other. I think this is a bug in binman and I highlighted this to Simon.
If tee is not used, we should not get warnings about missing tee.bin .
I sent a patch. Please give it a try.
I see that Fabio does not want any warnings to be emitted regardless. I would like to give some explanation why I implemented it that way and why I still think this is an adequate solution:
The OPTEE kconfig is for U-Boot driver support. To my knowledge however, this is not needed to have OP-TEE be packaged into the final image, thus I should not have to enable OP-TEE driver support to be able to package optee.
Please give me your opinion on this matter.
Yannic
[1] https://lore.kernel.org/u-boot/20241106153544.1277835-1-sjg@chromium.org/
It looks like Fabio has merged this already to imx/master which now fails to build for imx8m*_venice boards because of it.
Fabio, did you realize that you merged this already and if so how does it work for you?
Best Regards,
Tim
diff --git a/arch/arm/mach-imx/imx8m/Kconfig b/arch/arm/mach-imx/imx8m/Kconfig index b254a50b091..8aeb1ea75f7 100644 --- a/arch/arm/mach-imx/imx8m/Kconfig +++ b/arch/arm/mach-imx/imx8m/Kconfig @@ -37,6 +37,17 @@ config SYS_HAS_ARMV8_SECURE_BASE If enabled, please also define the value for ARMV8_SECURE_BASE, for i.MX8M, it could be some address in OCRAM.
+config IMX8M_OPTEE_LOAD_ADDR + hex "Load address of OPTEE image" + default 0xbe000000 if IMX8MM + default 0xbe000000 if IMX8MN + default 0x56000000 if IMX8MP + default 0xfe000000 if IMX8MQ + help + The load and entry address for the OPTEE image. This value defaults to + the one defined in tf-a if not provided in the board defconfig file.
choice prompt "NXP i.MX8M board select" optional
-- 2.43.0

The phyBOARD-Pollux expects 0x56000000 address to load optee.
Signed-off-by: Yannic Moog y.moog@phytec.de --- configs/phycore-imx8mp_defconfig | 1 + 1 file changed, 1 insertion(+)
diff --git a/configs/phycore-imx8mp_defconfig b/configs/phycore-imx8mp_defconfig index 23981826109..ba716a6875b 100644 --- a/configs/phycore-imx8mp_defconfig +++ b/configs/phycore-imx8mp_defconfig @@ -5,6 +5,7 @@ CONFIG_SYS_MALLOC_LEN=0x2000000 CONFIG_SPL_GPIO=y CONFIG_SPL_LIBCOMMON_SUPPORT=y CONFIG_SPL_LIBGENERIC_SUPPORT=y +CONFIG_IMX8M_OPTEE_LOAD_ADDR=0x56000000 CONFIG_PHYTEC_SOM_DETECTION=y CONFIG_SF_DEFAULT_SPEED=80000000 CONFIG_ENV_SIZE=0x10000

The phyGATE-Tauri-L expects 0x56000000 address to load optee.
Signed-off-by: Yannic Moog y.moog@phytec.de --- configs/imx8mm-phygate-tauri-l_defconfig | 1 + 1 file changed, 1 insertion(+)
diff --git a/configs/imx8mm-phygate-tauri-l_defconfig b/configs/imx8mm-phygate-tauri-l_defconfig index 18fffa7405e..c87062404da 100644 --- a/configs/imx8mm-phygate-tauri-l_defconfig +++ b/configs/imx8mm-phygate-tauri-l_defconfig @@ -5,6 +5,7 @@ CONFIG_SYS_MALLOC_LEN=0x2000000 CONFIG_SPL_GPIO=y CONFIG_SPL_LIBCOMMON_SUPPORT=y CONFIG_SPL_LIBGENERIC_SUPPORT=y +CONFIG_IMX8M_OPTEE_LOAD_ADDR=0x56000000 CONFIG_ENV_SIZE=0x10000 CONFIG_ENV_OFFSET=0x3C0000 CONFIG_DM_GPIO=y

The phyCORE i.MX 8M Mini expects 0x56000000 address to load optee.
Signed-off-by: Yannic Moog y.moog@phytec.de --- configs/phycore-imx8mm_defconfig | 1 + 1 file changed, 1 insertion(+)
diff --git a/configs/phycore-imx8mm_defconfig b/configs/phycore-imx8mm_defconfig index 3f4336837e9..5a3e8162799 100644 --- a/configs/phycore-imx8mm_defconfig +++ b/configs/phycore-imx8mm_defconfig @@ -5,6 +5,7 @@ CONFIG_SYS_MALLOC_LEN=0x2000000 CONFIG_SPL_GPIO=y CONFIG_SPL_LIBCOMMON_SUPPORT=y CONFIG_SPL_LIBGENERIC_SUPPORT=y +CONFIG_IMX8M_OPTEE_LOAD_ADDR=0x56000000 CONFIG_SF_DEFAULT_SPEED=80000000 CONFIG_ENV_SIZE=0x10000 CONFIG_ENV_OFFSET=0x3C0000

Add documentation for the phyBOARD-Pollux i.MX 8M Plus on OP-TEE integration. Also add missing '-' to TF-A build instruction while at it.
Signed-off-by: Yannic Moog y.moog@phytec.de --- doc/board/phytec/phycore-imx8mp.rst | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-)
diff --git a/doc/board/phytec/phycore-imx8mp.rst b/doc/board/phytec/phycore-imx8mp.rst index fda751aeffb..50be9912653 100644 --- a/doc/board/phytec/phycore-imx8mp.rst +++ b/doc/board/phytec/phycore-imx8mp.rst @@ -9,6 +9,7 @@ Quick Start -----------
- Build the ARM Trusted firmware binary +- Build the OP-TEE binary (optional) - Get ddr firmware - Build U-Boot - Boot @@ -20,10 +21,26 @@ Build the ARM Trusted firmware binary
$ git clone https://git.trustedfirmware.org/TF-A/trusted-firmware-a.git $ cd trusted-firmware-a - $ export CROSS_COMPILE=aarch64-linux-gnu + $ export CROSS_COMPILE=aarch64-linux-gnu- $ export IMX_BOOT_UART_BASE=0x30860000 + $ # with optee + $ make PLAT=imx8mp SPD=opteed bl31 + $ # without optee $ make PLAT=imx8mp bl31
+Build the OP-TEE binary (optional) +---------------------------------- + +.. code-block:: bash + + $ git clone https://github.com/OP-TEE/optee_os.git + $ cd optee_os + $ make CFG_TEE_BENCHMARK=n \ + CROSS_COMPILE=aarch64-linux-gnu- \ + O=out/arm \ + PLATFORM=imx-mx8mp_phyboard_pollux \ + CFG_TZDRAM_START=0x56000000 + Get the ddr firmware --------------------
@@ -42,6 +59,7 @@ Copy binaries .. code-block:: bash
$ cp <TF-A dir>/build/imx8mp/release/bl31.bin . + $ cp <OP-TEE dir>/out/arm/core/tee-raw.bin tee.bin $ cp firmware-imx-8.19/firmware/ddr/synopsys/lpddr4*.bin .
Build U-Boot

Add instructions on how to build and package OP-TEE for the phycore-imx8mm based boards. The build instructions are identical for phyGATE-Tauri-L and phyBOARD-Polis. Also fix missig '-' for TF-A build instructions.
Signed-off-by: Yannic Moog y.moog@phytec.de --- board/phytec/phycore_imx8mm/MAINTAINERS | 1 + doc/board/phytec/imx8mm-optee-build.rsti | 14 ++++++++++++++ doc/board/phytec/imx8mm-phygate-tauri-l.rst | 9 ++++++++- doc/board/phytec/phycore-imx8mm.rst | 8 +++++++- 4 files changed, 30 insertions(+), 2 deletions(-)
diff --git a/board/phytec/phycore_imx8mm/MAINTAINERS b/board/phytec/phycore_imx8mm/MAINTAINERS index 58c5e2d0af9..7631e1cb331 100644 --- a/board/phytec/phycore_imx8mm/MAINTAINERS +++ b/board/phytec/phycore_imx8mm/MAINTAINERS @@ -9,5 +9,6 @@ F: configs/imx8mm-phygate-tauri-l_defconfig F: configs/phycore-imx8mm_defconfig F: doc/board/phytec/imx8mm-phygate-tauri-l.rst F: doc/board/phytec/index.rst +F: doc/board/phytec/imx8mm-optee-build.rsti F: doc/board/phytec/phycore_imx8mm.rst F: include/configs/phycore_imx8mm.h diff --git a/doc/board/phytec/imx8mm-optee-build.rsti b/doc/board/phytec/imx8mm-optee-build.rsti new file mode 100644 index 00000000000..c83de5cc7cf --- /dev/null +++ b/doc/board/phytec/imx8mm-optee-build.rsti @@ -0,0 +1,14 @@ +Build the OP-TEE binary (optional) +---------------------------------- + +.. code-block:: bash + + $ git clone https://github.com/OP-TEE/optee_os.git + $ cd optee_os + $ make CFG_TEE_BENCHMARK=n \ + CROSS_COMPILE=aarch64-linux-gnu- \ + O=out/arm \ + PLATFORM=imx-mx8mmevk \ + CFG_TZDRAM_START=0x56000000 \ + CFG_DDR_SIZE=0x80000000 \ + CFG_UART_BASE=UART3_BASE diff --git a/doc/board/phytec/imx8mm-phygate-tauri-l.rst b/doc/board/phytec/imx8mm-phygate-tauri-l.rst index 28b614fd144..0d9e1024f8c 100644 --- a/doc/board/phytec/imx8mm-phygate-tauri-l.rst +++ b/doc/board/phytec/imx8mm-phygate-tauri-l.rst @@ -9,6 +9,7 @@ Quick Start -----------
- Build the ARM Trusted firmware binary +- Build the OP-TEE binary (optional) - Get ddr firmware - Build U-Boot - Boot @@ -20,10 +21,15 @@ Build the ARM Trusted firmware binary
$ git clone https://git.trustedfirmware.org/TF-A/trusted-firmware-a.git $ cd trusted-firmware-a - $ export CROSS_COMPILE=aarch64-linux-gnu + $ export CROSS_COMPILE=aarch64-linux-gnu- $ export IMX_BOOT_UART_BASE=0x30880000 + $ # with optee + $ make PLAT=imx8mm BL32_BASE=0x56000000 SPD=opteed bl31 + $ # without optee $ make PLAT=imx8mm bl31
+.. include:: imx8mm-optee-build.rsti + Get the ddr firmware --------------------
@@ -42,6 +48,7 @@ Copy binaries .. code-block:: bash
$ cp <TF-A dir>/build/imx8mm/release/bl31.bin . + $ cp <OP-TEE dir>/out/arm/core/tee-raw.bin tee.bin $ cp firmware-imx-8.23/firmware/ddr/synopsys/lpddr4*.bin .
Build U-Boot diff --git a/doc/board/phytec/phycore-imx8mm.rst b/doc/board/phytec/phycore-imx8mm.rst index e9dc2259907..08f5949e02d 100644 --- a/doc/board/phytec/phycore-imx8mm.rst +++ b/doc/board/phytec/phycore-imx8mm.rst @@ -9,6 +9,7 @@ Quick Start -----------
- Build the ARM Trusted firmware binary +- Build the OP-TEE binary (optional) - Get ddr firmware - Build U-Boot - Boot @@ -20,10 +21,15 @@ Build the ARM Trusted firmware binary
$ git clone https://git.trustedfirmware.org/TF-A/trusted-firmware-a.git $ cd trusted-firmware-a - $ export CROSS_COMPILE=aarch64-linux-gnu + $ export CROSS_COMPILE=aarch64-linux-gnu- $ export IMX_BOOT_UART_BASE=0x30880000 + $ # with optee + $ make PLAT=imx8mm BL32_BASE=0x56000000 SPD=opteed bl31 + $ # without optee $ make PLAT=imx8mm bl31
+.. include:: imx8mm-optee-build.rsti + Get the ddr firmware --------------------

On Fri, Jan 10, 2025 at 9:35 AM Yannic Moog y.moog@phytec.de wrote:
There have been attempts to get op-tee node integrated upstream in the past [1][2]. The challenge is on how to handle the load and entry addresses where the op-tee image should be loaded to. Different SoC families and architectures have different RAM base addresses. Further the final addresses can vary from board to board (e.g. depending on populated RAM size). This approach follows the TI k3 kconfig solution. To be able to define a sensible default for the new config option, put it in the imx8m kconfig. For other imx families, the RAM start addresses are different and thus finding a common sensible default is not possible. I do not have a working Nano and quad board so I was not able to test them.
I included usage for PHYTEC boards for examples (with documentation).
[1] https://patchwork.ozlabs.org/project/uboot/patch/20230622173006.3921891-1-th... [2] https://patchwork.ozlabs.org/project/uboot/patch/ZeHDVr-Bzm935-5N@mecka.net/
Changes in v3:
- use OPTEE_LOAD_ADDR defaults as defined in upstream tf-a
- add imx8mq (untested)
- move common PHYTEC imx8mm optee build doc into include file
Applied the series, thanks.
participants (4)
-
Fabio Estevam
-
Tim Harvey
-
Yannic Moog
-
Yannic Moog