[PATCH 0/4] Repeal and replace TZDRAM_ related config options

Alexandru Gagniuc mr.nuke.me at gmail.com
Tue Sep 7 19:07:05 CEST 2021


When enabling OPTEE support in the config menu, one is asked for the
TZDRAM region and OPTEE load address. It would seem that these are
very important values, not just some half-assed bollocks.

There are currently three sources of information regarding OPTEE and
its associated DRAM region:
    1) Devicetree "/reserved-memory" nodes
    2) uImage and FIT load-address and entry-point
    3) The CONFIG_s currently under scrutiny

(1) and (2) are sufficient to identify and reject OP-TEE images which
fall outside TZDRAM. Such a check might make sense in the context of
not bricking a device. But if an incompatible image was already
installed, the device is likely soft-bricked anyway and needs manual
intervention. This series doesn't implement such a check.

It is possible for (1) and (3) to be in conflict. Because the values
in (3) default to 0x0, it is very likely to happen. Such a situation
causes the "bootm" command to reject otherwise valid OP-TEE images.
Thus a perfectly tuned u-boot which doesn't also set (3) will be
non-functional with respect to OP-TEE images.

This becomes confusing, and has caused yours truly a disproportionate
amount of grief.
Fortunately, SPL can also load OP-TEE images, and does not even look
at the values in (3). It only uses (1) and (2) to determine the
appropriate values for firing up OP-TEE. It is more reliable and easy
to use than "bootm".

We are able to remove these configs without breaking anything. This
also resolves the problems with "bootm" mentioned earlier.

I hypothesize that one could re-add the removed checks from
optee_verify_image() by deriving TZDRAM information from (1) instead
of (3). I chose not to implement it because I don't see the value.



Alexandru Gagniuc (4):
  lib: optee: Avoid CONFIG_TZDRAM_* in optee_verify_bootm_image()
  lib: optee: Remove CONFIG_OPTEE_TZDRAM_BASE
  lib: optee: Remove CONFIG_OPTEE_LOAD_ADDR
  arm: imx: mx7: Move CONFIG_OPTEE_TZDRAM_SIZE from lib/optee

 arch/arm/mach-imx/mx7/Kconfig |  8 ++++++++
 configs/warp7_bl33_defconfig  |  1 -
 configs/warp7_defconfig       |  2 --
 include/configs/warp7.h       |  5 -----
 include/tee/optee.h           | 14 --------------
 lib/optee/Kconfig             | 23 -----------------------
 lib/optee/optee.c             | 21 ++++++---------------
 7 files changed, 14 insertions(+), 60 deletions(-)

-- 
2.31.1



More information about the U-Boot mailing list