From: "Alex G." <mr.nuke.me@gmail.com>
To: Patrick Delaunay <patrick.delaunay@foss.st.com>, u-boot@lists.denx.de
Cc: etienne.carriere@linaro.org,
"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: Fri, 3 Sep 2021 11:43:03 -0500 [thread overview]
Message-ID: <569089c3-8936-2a47-930e-218805064413@gmail.com> (raw)
In-Reply-To: <20210902115512.1.I1c6536da7609f8240549cccae2708e075dc9fcf3@changeid>
Hi Patrick
On 9/2/21 4:56 AM, Patrick Delaunay wrote:
> The configuration CONFIG_OPTEE is defined 2 times:
> 1- in lib/optee/Kconfig for support of OPTEE images loaded by bootm command
> 2- in drivers/tee/optee/Kconfig for support of OP-TEE driver.
>
> It is abnormal to have the same CONFIG define for 2 purpose;
> and it is difficult to managed correctly their dependencies.
>
> Moreover CONFIG_SPL_OPTEE is defined in common/spl/Kconfig
> to manage OPTEE image load in SPL.
>
> This definition causes an issue with the macro CONFIG_IS_ENABLED(OPTEE)
> to test the availability of the OP-TEE driver.
>
> This patch cleans the configuration dependency with:
> - CONFIG_OPTEE_IMAGE (renamed) => support of OP-TEE image in U-Boot
> - CONFIG_SPL_OPTEE_IMAGE (renamed) => support of OP-TEE image in SPL
> - CONFIG_OPTEE (same) => support of OP-TEE driver in U-Boot
> - CONFIG_OPTEE_LIB (new) => support of OP-TEE library
>
> After this patch, the macro have the correct behavior:
> - CONFIG_IS_ENABLED(OPTEE_IMAGE) => Load of OP-TEE image is supported
> - CONFIG_IS_ENABLED(OPTEE) => OP-TEE driver is supported
It seems a little odd to have both OPTEE_LIB and OPTEE_IMAGE, since they
are both used together to support booting with OP-TEE. What also seems
odd is that "OP-TEE driver in U-Boot" does not depend on "OP-TEE library".
Introducing OPTEE_LIB then, makes sense to me, provided that OPTEE
depends on OPTEE_LIB, but I'm not sure about OPTEE_IMAGE.
> diff --git a/lib/optee/optee.c b/lib/optee/optee.c
> index 672690dc53..5676785cb5 100644
> --- a/lib/optee/optee.c
> +++ b/lib/optee/optee.c
> @@ -20,6 +20,7 @@
> "\n\theader lo=0x%08x hi=0x%08x size=0x%08lx arch=0x%08x" \
> "\n\tuimage params 0x%08lx-0x%08lx\n"
>
> +#if defined(CONFIG_OPTEE_IMAGE)
> int optee_verify_image(struct optee_header *hdr, unsigned long tzdram_start,
> unsigned long tzdram_len, unsigned long image_len)
> {
> @@ -70,6 +71,7 @@ error:
>
> return ret;
> }
> +#endif
One the idea of having CONFIGs is to include/exclude code via
obj-$(CONFIG_FOO)+=code.c. This prevents the proliferation of #ifdefs.
It's fairly counterintuitive to have a CONFIG_OPTEE_IMAGE in a file
controlled by CONFIG_OPTEE_LIB.
Going to optee_verify_image() itself. It essentially checks against
OPTEE_TZDRAM_(BASE/SIZE). But those are a derived from devicetree, not
Kconfig. So it seems the motivation behing optee_verify_bootm_image() is
flawed. Also the error message is not very helpful.
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
- Remove optee_verify_bootm_image()
- No need for CONFIG_OPTEE_IMAGE
Alex
next prev parent reply other threads:[~2021-09-03 16:43 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 ` Alex G. [this message]
2021-09-04 8:31 ` [PATCH 1/2] lib: optee: remove the duplicate CONFIG_OPTEE Etienne Carriere
2021-09-06 16:53 ` Patrick DELAUNAY
2021-09-06 22:39 ` Alex G.
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=569089c3-8936-2a47-930e-218805064413@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.