[PATCH 0/2] Fix OP-TEE support

Hello,
This series fixes OP-TEE support on all imx9 boards by starting the ELE RNG and adding the optional tee.bin binary to the ATF container.
Thanks,
Mathieu
Mathieu Othacehe (2): imx9: Fix OP-TEE support tools: imx9_image: Reword warning message.
arch/arm/mach-imx/imx9/container.cfg | 3 ++- board/freescale/imx93_evk/spl.c | 7 +++++++ board/phytec/phycore_imx93/spl.c | 7 +++++++ board/variscite/imx93_var_som/spl.c | 6 ++++++ tools/imx9_image.sh | 2 +- 5 files changed, 23 insertions(+), 2 deletions(-)

This fixes OP-TEE support by:
- Adding tee.bin to container.cfg - Starting ELE RNG in SPL
Signed-off-by: Mathieu Othacehe othacehe@gnu.org --- arch/arm/mach-imx/imx9/container.cfg | 3 ++- board/freescale/imx93_evk/spl.c | 7 +++++++ board/phytec/phycore_imx93/spl.c | 7 +++++++ board/variscite/imx93_var_som/spl.c | 6 ++++++ 4 files changed, 22 insertions(+), 1 deletion(-)
diff --git a/arch/arm/mach-imx/imx9/container.cfg b/arch/arm/mach-imx/imx9/container.cfg index f268bc9eb2c..72fe791eae6 100644 --- a/arch/arm/mach-imx/imx9/container.cfg +++ b/arch/arm/mach-imx/imx9/container.cfg @@ -7,4 +7,5 @@ BOOT_FROM SD 0x400 SOC_TYPE IMX9 CONTAINER IMAGE A55 bl31.bin 0x204E0000 -IMAGE A55 u-boot.bin CONFIG_TEXT_BASE \ No newline at end of file +IMAGE A55 u-boot.bin CONFIG_TEXT_BASE +IMAGE A55 tee.bin 0x96000000 \ No newline at end of file diff --git a/board/freescale/imx93_evk/spl.c b/board/freescale/imx93_evk/spl.c index a98ed69db88..2fd5559195e 100644 --- a/board/freescale/imx93_evk/spl.c +++ b/board/freescale/imx93_evk/spl.c @@ -20,6 +20,7 @@ #include <asm/mach-imx/boot_mode.h> #include <asm/mach-imx/mxc_i2c.h> #include <asm/arch-mx7ulp/gpio.h> +#include <asm/mach-imx/ele_api.h> #include <asm/mach-imx/syscounter.h> #include <asm/sections.h> #include <dm/uclass.h> @@ -43,6 +44,12 @@ int spl_board_boot_device(enum boot_device boot_dev_spl)
void spl_board_init(void) { + int ret; + + ret = ele_start_rng(); + if (ret) + printf("Fail to start RNG: %d\n", ret); + puts("Normal Boot\n"); }
diff --git a/board/phytec/phycore_imx93/spl.c b/board/phytec/phycore_imx93/spl.c index dabc5316f33..16303fc187a 100644 --- a/board/phytec/phycore_imx93/spl.c +++ b/board/phytec/phycore_imx93/spl.c @@ -11,6 +11,7 @@ #include <asm/arch/sys_proto.h> #include <asm/arch/trdc.h> #include <asm/mach-imx/boot_mode.h> +#include <asm/mach-imx/ele_api.h> #include <asm/sections.h> #include <hang.h> #include <init.h> @@ -34,6 +35,12 @@ int spl_board_boot_device(enum boot_device boot_dev_spl)
void spl_board_init(void) { + int ret; + + ret = ele_start_rng(); + if (ret) + printf("Fail to start RNG: %d\n", ret); + puts("Normal Boot\n"); }
diff --git a/board/variscite/imx93_var_som/spl.c b/board/variscite/imx93_var_som/spl.c index e6db4eb562b..36e17219d63 100644 --- a/board/variscite/imx93_var_som/spl.c +++ b/board/variscite/imx93_var_som/spl.c @@ -20,6 +20,7 @@ #include <asm/mach-imx/mxc_i2c.h> #include <asm/arch-mx7ulp/gpio.h> #include <asm/sections.h> +#include <asm/mach-imx/ele_api.h> #include <asm/mach-imx/syscounter.h> #include <dm/uclass.h> #include <dm/device.h> @@ -47,9 +48,14 @@ int spl_board_boot_device(enum boot_device boot_dev_spl) void spl_board_init(void) { struct var_eeprom *ep = VAR_EEPROM_DATA; + int ret;
puts("Normal Boot\n");
+ ret = ele_start_rng(); + if (ret) + printf("Fail to start RNG: %d\n", ret); + /* Copy EEPROM contents to DRAM */ memcpy(ep, &eeprom, sizeof(*ep)); }

If the optional `tee.bin` OP-TEE binary is missing, the image will still be functional. Adapt the warning message accordingly.
Signed-off-by: Mathieu Othacehe othacehe@gnu.org --- tools/imx9_image.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/imx9_image.sh b/tools/imx9_image.sh index 88dfcfe606c..ca78a57a19a 100755 --- a/tools/imx9_image.sh +++ b/tools/imx9_image.sh @@ -19,7 +19,7 @@ for f in $blobs; do fi
if [ ! -f $tmp ]; then - echo "WARNING '$tmp' not found, resulting binary is not-functional" >&2 + echo "WARNING '$tmp' not found, resulting binary may be not-functional" >&2
# Comment-out the lines for un-existing files. This way, # mkimage can keep working. This allows CI tests to pass even

On Mon, Feb 26, 2024 at 2:37 PM Mathieu Othacehe othacehe@gnu.org wrote:
Hello,
This series fixes OP-TEE support on all imx9 boards by starting the ELE RNG and adding the optional tee.bin binary to the ATF container.
Thanks,
Mathieu
Mathieu Othacehe (2): imx9: Fix OP-TEE support tools: imx9_image: Reword warning message.
Applied all, thanks.
participants (2)
-
Fabio Estevam
-
Mathieu Othacehe