lib: optee: Avoid CONFIG_TZDRAM_* in optee_verify_bootm_image()
authorAlexandru Gagniuc <mr.nuke.me@gmail.com>
Tue, 7 Sep 2021 17:07:06 +0000 (12:07 -0500)
committerTom Rini <trini@konsulko.com>
Tue, 5 Oct 2021 12:46:23 +0000 (08:46 -0400)
commit26fc66709c0de7732a12fd59dbce5a83eb454bae
tree1e1e7490038e9712139e68a4ba7c91bbe3c427d4
parent4f53ac2adbc0f4d3bfebee1b414870e228469989
lib: optee: Avoid CONFIG_TZDRAM_* in optee_verify_bootm_image()

The configs TZDRAM_BASE and TZDRAM_SIZE are expected to describe the
memory allocated to the OPTEE region. according to according to commit
c5a6e8bd00cc ("optee: Add optee_verify_bootm_image()"). The TZDRAM is
with some limitations, described by "/reserved-memory" nodes in the
devicetree.

Consequently TZDRAM_BASE and TZDRAM_SIZE can point to imaginary
regions which have nothing to do with actual DRAM. They are not used
to configure the hardware or set up the Trust Zone Controller (TZC)
for OP-TEE -- the devicetree values are used instead.

When a valid OP-TEE image does not fall within the region described by
these configs, u-boot will refuse to load it. In fact, it mostly
serves to cause "bootm" to reject perfectly good OP-TEE images.

Ironically, someone has to correctly configure the devicetree for
TZDRAM, then go back and enter the same information in Kconfig for
"bootm". To remedy this, do not use TZDRAM_BASE and TZDRAM_SIZE in the
verification of OPTEE images.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
include/tee/optee.h
lib/optee/optee.c