From: Ilias Apalodimas <ilias.apalodimas@linaro.org>
To: Simon Glass <sjg@chromium.org>
Cc: U-Boot Mailing List <u-boot@lists.denx.de>,
Etienne Carriere <etienne.carriere@linaro.org>,
Jens Wiklander <jens.wiklander@linaro.org>,
Patrick Delaunay <patrick.delaunay@foss.st.com>
Subject: Re: [PATCH v4] tee: optee: rework TA bus scanning code
Date: Wed, 7 Sep 2022 00:23:03 +0300 [thread overview]
Message-ID: <Yxe6N22ZPkCPBg64@hades> (raw)
In-Reply-To: <CAPnjgZ03WAk5eHBBdhANRJ4W6WgH7D55+6Wph4vzQ8qwcq=oRA@mail.gmail.com>
Hi Simon,
On Tue, Sep 06, 2022 at 03:18:28PM -0600, Simon Glass wrote:
> Hi,
>
> On Tue, 6 Sept 2022 at 03:37, Ilias Apalodimas
> <ilias.apalodimas@linaro.org> wrote:
> >
> > Late versions of OP-TEE support a pseudo bus. TAs that behave as
> > hardware blocks (e.g TPM, RNG etc) present themselves on a bus which we can
> > scan. Unfortunately U-Boot doesn't support that yet. It's worth noting
> > that we already have a workaround for RNG. The details are in
> > commit 70812bb83da6 ("tee: optee: bind rng optee driver")
> >
> > So let's add a list of devices based on U-Boot Kconfig options that we will
> > scan until we properly implement the tee-bus functionality.
> >
> > While at it change the behaviour of the tee core itself wrt to device
> > binding. If some device binding fails, print a warning instead of
> > disabling OP-TEE.
> >
> > Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
> > Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
> > Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org>
> > ---
> > Changes since v3:
> > - Use NULL instead of a child ptr on device_bind_driver(), since it's not
> > really needed
> > - Changed the style of the optee_bus_probe[] definition to
> > {.drv_name = xxx, .dev_name = yyy }
> >
> > Changes since v2:
> > - Fixed typo on driver name ftpm-tee -> ftpm_tee
> >
> > Changes since v1:
> > - remove a macro and use ARRAY_SIZE directly
> > drivers/tee/optee/core.c | 24 +++++++++++++++++++-----
> > 1 file changed, 19 insertions(+), 5 deletions(-)
> >
> > diff --git a/drivers/tee/optee/core.c b/drivers/tee/optee/core.c
> > index a89d62aaf0b3..c201a4635e6b 100644
> > --- a/drivers/tee/optee/core.c
> > +++ b/drivers/tee/optee/core.c
> > @@ -31,6 +31,18 @@ struct optee_pdata {
> > optee_invoke_fn *invoke_fn;
> > };
> >
> > +static const struct {
> > + const char *drv_name;
> > + const char *dev_name;
> > +} optee_bus_probe[] = {
> > +#ifdef CONFIG_RNG_OPTEE
> > + { .drv_name = "optee-rng", .dev_name = "optee-rng" },
> > +#endif
> > +#ifdef CONFIG_TPM2_FTPM_TEE
> > + { .drv_name = "ftpm_tee", .dev_name = "ftpm_tee" },
> > +#endif
> > +};
> > +
> > struct rpc_param {
> > u32 a0;
> > u32 a1;
> > @@ -642,8 +654,7 @@ static int optee_probe(struct udevice *dev)
> > {
> > struct optee_pdata *pdata = dev_get_plat(dev);
> > u32 sec_caps;
> > - struct udevice *child;
> > - int ret;
> > + int ret, i;
> >
> > if (!is_optee_api(pdata->invoke_fn)) {
> > dev_err(dev, "OP-TEE api uid mismatch\n");
> > @@ -672,10 +683,13 @@ static int optee_probe(struct udevice *dev)
> > * in U-Boot, the discovery of TA on the TEE bus is not supported:
> > * only bind the drivers associated to the supported OP-TEE TA
> > */
> > - if (IS_ENABLED(CONFIG_RNG_OPTEE)) {
> > - ret = device_bind_driver(dev, "optee-rng", "optee-rng", &child);
> > +
> > + for (i = 0; i < ARRAY_SIZE(optee_bus_probe); i++) {
> > + ret = device_bind_driver(dev, optee_bus_probe[i].drv_name,
> > + optee_bus_probe[i].dev_name, NULL);
> > if (ret)
> > - return ret;
> > + dev_warn(dev, "Failed to bind device %s\n",
> > + optee_bus_probe[i].dev_name);
>
> Please add device tree nodes for these and all this code can go away.
That's the exact opposite of what the commit message describes. OP-TEE
supports a scannable bus ifor TAs that behave like hardware blocks and
doesn't need a DT entry. Since it's really the TAs compilation decision
to support that or not having them as a DT node is not always the right
choice.
Thanks
/Ilias
>
> Regards,
> Simon
next prev parent reply other threads:[~2022-09-06 21:23 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-06 9:37 [PATCH v4] tee: optee: rework TA bus scanning code Ilias Apalodimas
2022-09-06 13:37 ` Patrick DELAUNAY
2022-09-06 21:18 ` Simon Glass
2022-09-06 21:23 ` Ilias Apalodimas [this message]
2022-09-07 21:10 ` Simon Glass
2022-09-07 21:31 ` Ilias Apalodimas
2022-09-12 18:31 ` Simon Glass
2022-09-16 20:18 ` Ilias Apalodimas
[not found] <1ab0ea00-57c9-389c-ff0d-86defabba09e@foss.st.com>
2022-09-19 14:49 ` Patrick DELAUNAY
2022-09-22 8:51 ` Etienne Carriere
2022-09-22 10:14 ` Sumit Garg
2022-09-23 5:46 ` Etienne Carriere
2022-09-26 7:06 ` Sumit Garg
2022-09-28 7:55 ` Etienne Carriere
2022-09-22 11:27 ` Simon Glass
2022-09-22 16:06 ` Etienne Carriere
2022-09-22 18:15 ` Patrick DELAUNAY
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=Yxe6N22ZPkCPBg64@hades \
--to=ilias.apalodimas@linaro.org \
--cc=etienne.carriere@linaro.org \
--cc=jens.wiklander@linaro.org \
--cc=patrick.delaunay@foss.st.com \
--cc=sjg@chromium.org \
--cc=u-boot@lists.denx.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.