aboutsummaryrefslogtreecommitdiff
path: root/firmware
diff options
context:
space:
mode:
authorGuo Ren <guoren@linux.alibaba.com>2023-10-19 05:27:34 -0400
committerAnup Patel <anup@brainfault.org>2023-11-16 16:19:42 +0530
commitfccdf41d32877eca0cef3789d12a197cba73c2e2 (patch)
tree34a2f44320664224f53e18de7847d0e43953ff7e /firmware
parent07f2ccd990de5f55ce7d194846fff91b6c3aedf6 (diff)
downloadopensbi-fccdf41d32877eca0cef3789d12a197cba73c2e2.zip
opensbi-fccdf41d32877eca0cef3789d12a197cba73c2e2.tar.gz
opensbi-fccdf41d32877eca0cef3789d12a197cba73c2e2.tar.bz2
firmware: fw_base.S: Fix boot hart status synchronization
It's wrong to put the fence after setting the boot status flag because all relocation operations must be finished before setting the status flag. So, this fence must be put before the setting status flag, and there is no use in putting a fence between _start_warm and setting status flag. Also, nop can't delay other harts too much, so use div instead, just like Linux cpu_relax. Current opensbi force enables “M” Standard Extension, and mul instructions have been used in the fw_base.S. After the above two fixes, the boot hart index param of the fw_dynamic_info could be guaranteed properly for all platforms. Signed-off-by: Guo Ren <guoren@linux.alibaba.com> Signed-off-by: Guo Ren <guoren@kernel.org> Reviewed-by: Anup Patel <anup@brainfault.org>
Diffstat (limited to 'firmware')
-rw-r--r--firmware/fw_base.S8
1 files changed, 4 insertions, 4 deletions
diff --git a/firmware/fw_base.S b/firmware/fw_base.S
index 42b03fe..f7763f4 100644
--- a/firmware/fw_base.S
+++ b/firmware/fw_base.S
@@ -399,8 +399,8 @@ _fdt_reloc_done:
/* mark boot hart done */
li t0, BOOT_STATUS_BOOT_HART_DONE
lla t1, _boot_status
- REG_S t0, 0(t1)
fence rw, rw
+ REG_S t0, 0(t1)
j _start_warm
/* waiting for boot hart to be done (_boot_status == 2) */
@@ -409,9 +409,9 @@ _wait_for_boot_hart:
lla t1, _boot_status
REG_L t1, 0(t1)
/* Reduce the bus traffic so that boot hart may proceed faster */
- nop
- nop
- nop
+ div t2, t2, zero
+ div t2, t2, zero
+ div t2, t2, zero
bne t0, t1, _wait_for_boot_hart
_start_warm: