imx8m optee load address?
Tim Harvey
tharvey at gateworks.com
Fri Jun 16 03:56:59 CEST 2023
Greetings,
I've seen several IMX8M boards include a firmware/optee node in the
U-Boot dt (git grep optee arch/arm/dts/imx8m*.dtsi) yet but none that
I see configure binman to actually add the binary in the u-boot.dtsi,
do anything to keep U-Boot from accessing the OPTEE memory, or
document how to configure and build OPTEE for imx8m. I would like to
add such support but I find it odd that OPTEE needs to be built
differently depending on the dram size.
Prior to switching to binman (v2021.10)
arch/arm/mach-imx/mkimage_fit_atf.sh [1] would include tee.bin in the
FIT image if it was found in the current directory and it was expected
that you provide a proper TEE_LOAD_ADDR via the env (commit
a9eed6e1b8d8 ("imx: imx8m: introduce script to generate fit image").
According to the IMX OPTEE documentation [2] the size and location of
OPTEE is hard coded (CFG_TZDRAM_START and CFG_TZDRAM_SIZE) but looking
at the imx-optee source [3] this is calculated based off of
CFG_DDR_SIZE (which you can provide via env at build time or just
provide CFG_TZDRAM_START and CFG_TZDRAM_SIZE via env directly).
This results in the OPTEE location of 0x7e000000 for 1GiB systems,
0xbe000000 for 2GiB systems, and 0x13e000000 for 4GiB systems for
example. This dependence on dram size causes a couple of issues:
- OPTEE location depends on build-time configuration and several
boards have run-time identification of their memory size
- for 4GiB systems the address 0x13e000000 crosses the 32bit address
boundary and U-Boot hangs
Is there any reason OPTEE can't be located wherever you want and not
depend on dram size? I've tried to set it to 0x7e000000 (for a 1GiB
board) on a 4GiB board and U-Boot hangs near the DRAM banner which is
likely due to get_ram_size() stepping on OPTEE's memory range but then
I'm not clear why that doesn't occur when OPTEE is located at the top
of dram on a 1GiB and 2GiB system. How would I go about adding a
carevout for this?
Best Regards,
Tim
[1] https://elixir.bootlin.com/u-boot/v2021.10/source/arch/arm/mach-imx/mkimage_fit_atf.sh
[2] https://www.nxp.com/docs/en/user-guide/IMX_PORTING_GUIDE.pdf
[3] https://github.com/nxp-imx/imx-optee-os
More information about the U-Boot
mailing list