mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH v2 1/3] ARM: optee-early: drop superfluous sync_caches_for_execution
@ 2025-06-10 20:13 Ahmad Fatoum
  2025-06-10 20:13 ` [PATCH v2 2/3] ARM: Cortex-A9: invalidate caches in early lowlevel init Ahmad Fatoum
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Ahmad Fatoum @ 2025-06-10 20:13 UTC (permalink / raw)
  To: barebox; +Cc: Rouven Czerwinski, lst, fpg, Fabian Pflug, Ahmad Fatoum

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: Fabian Pflug <f.pflug@pengutronix.de>
Signed-off-by: Fabian Pflug <f.pflug@pengutronix.de>
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
v1 -> v2:
  - panic instead of retuning error code (Rouven)
---
 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 735d829c99fb..c9959b5e41b8 100644
--- a/arch/arm/lib32/optee-early.c
+++ b/arch/arm/lib32/optee-early.c
@@ -7,7 +7,9 @@
  */
 #include <asm/cache.h>
 #include <asm/setjmp.h>
+#include <asm/system.h>
 #include <tee/optee.h>
+#include <linux/bug.h>
 #include <debug_ll.h>
 #include <string.h>
 
@@ -19,6 +21,9 @@ int start_optee_early(void *fdt, void *tee)
 	struct optee_header *hdr;
 	int ret;
 
+	/* We expect this function to be called with data caches disabled */
+	BUG_ON(get_cr() & CR_C);
+
 	hdr = tee;
 	ret = optee_verify_header(hdr);
 	if (ret < 0)
@@ -30,7 +35,6 @@ int start_optee_early(void *fdt, void *tee)
 	/* 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




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-06-11  7:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-06-10 20:13 [PATCH v2 1/3] ARM: optee-early: drop superfluous sync_caches_for_execution Ahmad Fatoum
2025-06-10 20:13 ` [PATCH v2 2/3] ARM: Cortex-A9: invalidate caches in early lowlevel init Ahmad Fatoum
2025-06-10 20:13 ` [PATCH v2 3/3] ARM: i.MX6Q: drop duplicate arm_early_mmu_cache_invalidate Ahmad Fatoum
2025-06-11  7:10 ` [PATCH v2 1/3] ARM: optee-early: drop superfluous sync_caches_for_execution Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox