From: Rouven Czerwinski <rouven.czerwinski@linaro.org>
To: Fabian Pflug <f.pflug@pengutronix.de>
Cc: barebox@lists.infradead.org, lst@pengutronix.de,
Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: Re: [PATCH 1/2] ARM: optee-early: drop superfluous sync_caches_for_execution
Date: Wed, 4 Jun 2025 12:00:15 +0200 [thread overview]
Message-ID: <CAK8z29Ugrzjjo9y8SbW5LLJ1aY4e1Df8Pf6S6-eDgJ3tzk-kXA@mail.gmail.com> (raw)
In-Reply-To: <20250603092044.1464440-1-f.pflug@pengutronix.de>
Hi,
On Tue, 3 Jun 2025 at 11:20, Fabian Pflug <f.pflug@pengutronix.de> wrote:
>
> We expect start_optee_early() to be called with caches disabled, so there
> is no point in calling sync_caches_for_execution inside.
>
> Therefore let's verify the assumption that caches are indeed disabled
> and drop the useless call.
>
> Co-authored-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
> Signed-off-by: Fabian Pflug <f.pflug@pengutronix.de>
> ---
> arch/arm/lib32/optee-early.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/arch/arm/lib32/optee-early.c b/arch/arm/lib32/optee-early.c
> index 735d829c99..0cda0ab163 100644
> --- a/arch/arm/lib32/optee-early.c
> +++ b/arch/arm/lib32/optee-early.c
> @@ -7,6 +7,7 @@
> */
> #include <asm/cache.h>
> #include <asm/setjmp.h>
> +#include <asm/system.h>
> #include <tee/optee.h>
> #include <debug_ll.h>
> #include <string.h>
> @@ -24,13 +25,16 @@ int start_optee_early(void *fdt, void *tee)
> if (ret < 0)
> return ret;
>
> + /* We expect this function to be called with data caches disabled */
> + if (get_cr() & CR_C)
> + return -ENXIO;
> +
I don't think returning an error here is correct, we should probably
just panic()
with a useful error message. None of the current callers of the function check
the return code, so at best the board starts without OP-TEE, at worst
it randomly
hangs because no PSCI provider can be found.
> memcpy((void *)hdr->init_load_addr_lo, tee + sizeof(*hdr), hdr->init_size);
> tee_start = (void *) hdr->init_load_addr_lo;
>
> /* We use setjmp/longjmp here because OP-TEE clobbers most registers */
> ret = setjmp(tee_buf);
> if (ret == 0) {
> - sync_caches_for_execution();
> tee_start(0, 0, fdt);
> longjmp(tee_buf, 1);
> }
> --
> 2.39.5
>
- Rouven
prev parent reply other threads:[~2025-06-04 10:01 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-03 9:20 Fabian Pflug
2025-06-03 9:20 ` [PATCH 2/2] ARM: optee-early: invalidate caches before jump to OP-TEE Fabian Pflug
2025-06-03 9:57 ` Lucas Stach
2025-06-03 10:18 ` Ahmad Fatoum
2025-06-03 14:47 ` Lucas Stach
2025-06-03 14:51 ` Ahmad Fatoum
2025-06-03 15:20 ` Lucas Stach
2025-06-04 9:57 ` Rouven Czerwinski
2025-06-04 10:00 ` Rouven Czerwinski [this message]
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=CAK8z29Ugrzjjo9y8SbW5LLJ1aY4e1Df8Pf6S6-eDgJ3tzk-kXA@mail.gmail.com \
--to=rouven.czerwinski@linaro.org \
--cc=a.fatoum@pengutronix.de \
--cc=barebox@lists.infradead.org \
--cc=f.pflug@pengutronix.de \
--cc=lst@pengutronix.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