U-Boot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Revert "riscv: Add a Zalrsc-only alternative for synchronization in start.S"
@ 2025-09-25 16:01 Yao Zi
  2025-09-25 16:27 ` E Shattow
  2025-09-26  7:51 ` Leo Liang
  0 siblings, 2 replies; 6+ messages in thread
From: Yao Zi @ 2025-09-25 16:01 UTC (permalink / raw)
  To: Rick Chen, Leo, Tom Rini, Chia-Wei, Wang, Simon Glass
  Cc: u-boot, Yao Zi, E Shattow

This reverts commit a681cfecb4346107212f377e2075f6eb1bdc6a2b.

It has been reported that the commit causes boot regression for SPL on
StarFive VisionFive 2 or compatible boards. Inspecting the code, I did
spot one logic error for deciding whether Zaamo or Zalrsc is used, and
it's still unclear what exactly causes the regression, let's revert it
for now.

Reported-by: E Shattow <e@freeshell.de>
Link: https://lore.kernel.org/u-boot/1871663e-b918-4351-9e9e-97f9a4c73733@freeshell.de/
Signed-off-by: Yao Zi <ziyao@disroot.org>
---

The original series causing the problem[1] contains 3 patches, and I
think it should be enough to revert the change of start.S only, since
the others touch no code, and should be relatively safe. I'll fix the
reverted change up and get it work on VisionFive 2 when I got my new
board. Sorry for the inconvenience.

[1]: https://lore.kernel.org/u-boot/20250902081932.21103-1-ziyao@disroot.org/

 arch/riscv/cpu/start.S | 26 +-------------------------
 1 file changed, 1 insertion(+), 25 deletions(-)

diff --git a/arch/riscv/cpu/start.S b/arch/riscv/cpu/start.S
index 6324ff585d4..7bafdfd390a 100644
--- a/arch/riscv/cpu/start.S
+++ b/arch/riscv/cpu/start.S
@@ -151,15 +151,8 @@ call_harts_early_init:
 	 */
 	la	t0, hart_lottery
 	li	t1, 1
-#if CONFIG_IS_ENABLED(RISCV_ISA_ZAAMO)
 	amoswap.w s2, t1, 0(t0)
 	bnez	s2, wait_for_gd_init
-#else
-	lr.w	s2, (t0)
-	bnez	s2, wait_for_gd_init
-	sc.w	s2, t1, (t0)
-	bnez	s2, wait_for_gd_init
-#endif
 #else
 	/*
 	 * FIXME: gp is set before it is initialized. If an XIP U-Boot ever
@@ -184,12 +177,7 @@ call_harts_early_init:
 #if !CONFIG_IS_ENABLED(XIP)
 #ifdef CONFIG_AVAILABLE_HARTS
 	la	t0, available_harts_lock
-#if CONFIG_IS_ENABLED(RISCV_ISA_ZAAMO)
 	amoswap.w.rl zero, zero, 0(t0)
-#else
-	fence	rw, w
-	sw	zero, 0(t0)
-#endif
 #endif
 
 wait_for_gd_init:
@@ -202,14 +190,7 @@ wait_for_gd_init:
 #ifdef CONFIG_AVAILABLE_HARTS
 	la	t0, available_harts_lock
 	li	t1, 1
-1:
-#if CONFIG_IS_ENABLED(RISCV_ISA_ZAAMO)
-	amoswap.w.aq t1, t1, 0(t0)
-#else
-	lr.w.aq	t1, 0(t0)
-	bnez	t1, 1b
-	sc.w.rl t1, t1, 0(t0)
-#endif
+1:	amoswap.w.aq t1, t1, 0(t0)
 	bnez	t1, 1b
 
 	/* register available harts in the available_harts mask */
@@ -219,12 +200,7 @@ wait_for_gd_init:
 	or	t2, t2, t1
 	SREG	t2, GD_AVAILABLE_HARTS(gp)
 
-#if CONFIG_IS_ENABLED(RISCV_ISA_ZAAMO)
 	amoswap.w.rl zero, zero, 0(t0)
-#else
-	fence	rw, w
-	sw	zero, 0(t0)
-#endif
 #endif
 
 	/*
-- 
2.50.1


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

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

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-25 16:01 [PATCH] Revert "riscv: Add a Zalrsc-only alternative for synchronization in start.S" Yao Zi
2025-09-25 16:27 ` E Shattow
2025-09-26  4:11   ` Yao Zi
2025-10-12 21:49     ` E Shattow
2025-10-13  7:06       ` [SPAM Warning!]Re: " Yao Zi
2025-09-26  7:51 ` Leo Liang

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