public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: "Alex G." <mr.nuke.me@gmail.com>
To: Patrick DELAUNAY <patrick.delaunay@foss.st.com>,
	Etienne Carriere <etienne.carriere@linaro.org>
Cc: "U-Boot Mailing List" <u-boot@lists.denx.de>,
	"Andre Przywara" <andre.przywara@arm.com>,
	"Bin Meng" <bmeng.cn@gmail.com>,
	"Bryan O'Donoghue" <bryan.odonoghue@linaro.org>,
	"Christian Gmeiner" <christian.gmeiner@gmail.com>,
	"Heinrich Schuchardt" <xypron.glpk@gmx.de>,
	"Jens Wiklander" <jens.wiklander@linaro.org>,
	"Kever Yang" <kever.yang@rock-chips.com>,
	"Masahisa Kojima" <masahisa.kojima@linaro.org>,
	"Michael Walle" <michael@walle.cc>,
	"Michal Simek" <michal.simek@xilinx.com>,
	"Ovidiu Panait" <ovidiu.panait@windriver.com>,
	"Pali Rohár" <pali@kernel.org>,
	"Philipp Tomsich" <philipp.tomsich@vrull.eu>,
	"Philippe Reynes" <philippe.reynes@softathome.com>,
	"Roger Pau Monné" <royger@freebsd.org>,
	"Samuel Holland" <samuel@sholland.org>,
	"Sean Anderson" <seanga2@gmail.com>,
	"Simon Glass" <sjg@chromium.org>, "Stefan Roese" <sr@denx.de>,
	"Steffen Jaeckel" <jaeckel-floss@eyet-services.de>,
	"Tero Kristo" <t-kristo@ti.com>,
	"U-Boot STM32" <uboot-stm32@st-md-mailman.stormreply.com>
Subject: Re: [PATCH 1/2] lib: optee: remove the duplicate CONFIG_OPTEE
Date: Mon, 6 Sep 2021 17:39:56 -0500	[thread overview]
Message-ID: <d730a496-60a9-150b-549a-e2c74d6e44d1@gmail.com> (raw)
In-Reply-To: <ca6ac42b-3337-5d48-756b-eaafa1266d60@foss.st.com>



On 9/6/21 11:53 AM, Patrick DELAUNAY wrote:
>>
>>> In fact, the SPL boot path for OP-TEE doesn't use this function. That's
>>> intentional.
>>>
>>> Here's what I suggest:
>>>     - Remove OPTEE_TZDRAM_BASE and _SIZE
>> There is some legacy here, board/warp7and board/technexion/pico-imx7d.
> 
> 
> it is not possible, it is used for U-Boot proper on other platforms
> 
> board/warp7/warp7.c:38:        gd->ram_size -= CONFIG_OPTEE_TZDRAM_SIZE;
> board/warp7/warp7.c:122:    optee_start = optee_end - CONFIG_OPTEE_TZDRAM_SIZE;
> board/technexion/pico-imx7d/pico-imx7d.c:56: gd->ram_size -= CONFIG_OPTEE_TZDRAM_SIZE;
> include/configs/mx7_common.h:52:#if (CONFIG_OPTEE_TZDRAM_SIZE != 0)

I have an idea how to work around that.


> And for me this configuration (size of memory used by OPTEE) is more a 
> system configuration
> depending of the OP-TEE firmware used than a Device Tree configuration 
> at SPL level
> 
> PS: for the TF-A case it is done in a secure FW configuration file => in 
> the FIP
>        this information is no hardcoded information in BL2
>      in SPL, the load address / entry point it is already provided by 
> FIT for OPTEE image
> 
>       (=> optee_image_get_load_addr / optee_image_get_entry_point)
>       no need to have this information in DT (optee base address)
> 
> tools/default_image.c:119
> 
>      if (params->os == IH_OS_TEE) {
>          addr = optee_image_get_load_addr(hdr);
>          ep = optee_image_get_entry_point(hdr);
> 
>      }

The OPTEE entry point is available:
1) in both FIT and uImage files.
2) As the optee reserved-memory node in DT
3) Via CONFIG_OPTEE_TZDRAM_BASE

On the one hand, (1) and (2) together could hint that the OPTEE image is 
incompatible with the board, so they are not completely redundant.
On the other hand, there is no point in (3) given that the information 
could be obtained in at least two other ways.


> 
>      for CONFIG_OPTEE_TZDRAM_SIZE, I think that can be also found by 
> parsing the OP-TEE header
> 
> => see : init_mem_usage
> 
>      the OPTEE should be access to this memory .....
>      and it can change the firewall configuration is it is necessary
>      for the shared memory for example
> 
> 
> => no need to update first stage boot loader = SPL (with the risk to 
> brick the device)
>       when only OP-TEE firmware change

I see your point. It's a packaging issue, which we could solve with FIT, 
but not with uImage. Though, how often does an OP-TEE update change the 
TZDRAM location?


>>>     - Remove optee_verify_bootm_image()
> 
> but it is used in
> 
> common/bootm_os.c:491:    ret = 
> optee_verify_boot_image(images->os.image_start,

Yes. It only checks if the OP-TEE image fits within some hardcoded, and 
potentially wrong, boundaries. Which is contrary to your arguments from 
a few paragraphs ago. Just don't call optee_verify_boot_image in bootm_os.c.

Alex

  reply	other threads:[~2021-09-06 22:40 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-02  9:56 [PATCH 1/2] lib: optee: remove the duplicate CONFIG_OPTEE Patrick Delaunay
2021-09-02  9:56 ` [PATCH 2/2] tee: add a stub for tee_find_device Patrick Delaunay
2021-09-03 10:08   ` Etienne Carriere
2021-09-13 19:10   ` Jens Wiklander
2021-10-05 22:01   ` Tom Rini
2021-09-03 16:43 ` [PATCH 1/2] lib: optee: remove the duplicate CONFIG_OPTEE Alex G.
2021-09-04  8:31   ` Etienne Carriere
2021-09-06 16:53     ` Patrick DELAUNAY
2021-09-06 22:39       ` Alex G. [this message]
2021-09-07 18:46         ` Alex G.
2021-10-05 22:01 ` Tom Rini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d730a496-60a9-150b-549a-e2c74d6e44d1@gmail.com \
    --to=mr.nuke.me@gmail.com \
    --cc=andre.przywara@arm.com \
    --cc=bmeng.cn@gmail.com \
    --cc=bryan.odonoghue@linaro.org \
    --cc=christian.gmeiner@gmail.com \
    --cc=etienne.carriere@linaro.org \
    --cc=jaeckel-floss@eyet-services.de \
    --cc=jens.wiklander@linaro.org \
    --cc=kever.yang@rock-chips.com \
    --cc=masahisa.kojima@linaro.org \
    --cc=michael@walle.cc \
    --cc=michal.simek@xilinx.com \
    --cc=ovidiu.panait@windriver.com \
    --cc=pali@kernel.org \
    --cc=patrick.delaunay@foss.st.com \
    --cc=philipp.tomsich@vrull.eu \
    --cc=philippe.reynes@softathome.com \
    --cc=royger@freebsd.org \
    --cc=samuel@sholland.org \
    --cc=seanga2@gmail.com \
    --cc=sjg@chromium.org \
    --cc=sr@denx.de \
    --cc=t-kristo@ti.com \
    --cc=u-boot@lists.denx.de \
    --cc=uboot-stm32@st-md-mailman.stormreply.com \
    --cc=xypron.glpk@gmx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox