forked from Mirrors/opensbi
firmware: Introduce relocation lottery
Instead of forcing HART0 to do the relocation and scratch init work, we should have an atomic lottery to decide which HART does the relocation and scratch init. This way any HART can be boot/main HART. Signed-off-by: Anup Patel <anup.patel@wdc.com> Reviewed-by: Atish Patra <atish.patra@wdc.com>
This commit is contained in:
@@ -46,12 +46,11 @@
|
|||||||
.globl _start
|
.globl _start
|
||||||
.globl _start_warm
|
.globl _start_warm
|
||||||
_start:
|
_start:
|
||||||
/*
|
/* Jump to relocation wait loop if we don't get relocation lottery */
|
||||||
* Jump to warm-boot if this is not the first core booting,
|
la a6, _relocate_lottery
|
||||||
* that is, for mhartid != 0
|
li a7, 1
|
||||||
*/
|
amoadd.w a6, a7, (a6)
|
||||||
csrr a6, CSR_MHARTID
|
bnez a6, _wait_relocate_copy_done
|
||||||
blt zero, a6, _wait_relocate_copy_done
|
|
||||||
|
|
||||||
/* Save load address */
|
/* Save load address */
|
||||||
la t0, _load_start
|
la t0, _load_start
|
||||||
@@ -75,6 +74,8 @@ _relocate:
|
|||||||
blt t2, t0, _relocate_copy_to_upper
|
blt t2, t0, _relocate_copy_to_upper
|
||||||
_relocate_copy_to_lower:
|
_relocate_copy_to_lower:
|
||||||
ble t1, t2, _relocate_copy_to_lower_loop
|
ble t1, t2, _relocate_copy_to_lower_loop
|
||||||
|
la t3, _relocate_lottery
|
||||||
|
BRANGE t2, t1, t3, _start_hang
|
||||||
la t3, _boot_status
|
la t3, _boot_status
|
||||||
BRANGE t2, t1, t3, _start_hang
|
BRANGE t2, t1, t3, _start_hang
|
||||||
la t3, _relocate
|
la t3, _relocate
|
||||||
@@ -91,6 +92,8 @@ _relocate_copy_to_lower_loop:
|
|||||||
jr t4
|
jr t4
|
||||||
_relocate_copy_to_upper:
|
_relocate_copy_to_upper:
|
||||||
ble t3, t0, _relocate_copy_to_upper_loop
|
ble t3, t0, _relocate_copy_to_upper_loop
|
||||||
|
la t2, _relocate_lottery
|
||||||
|
BRANGE t0, t3, t2, _start_hang
|
||||||
la t2, _boot_status
|
la t2, _boot_status
|
||||||
BRANGE t0, t3, t2, _start_hang
|
BRANGE t0, t3, t2, _start_hang
|
||||||
la t2, _relocate
|
la t2, _relocate
|
||||||
@@ -381,6 +384,8 @@ _start_warm:
|
|||||||
j _start_hang
|
j _start_hang
|
||||||
|
|
||||||
.align 3
|
.align 3
|
||||||
|
_relocate_lottery:
|
||||||
|
RISCV_PTR 0
|
||||||
_boot_status:
|
_boot_status:
|
||||||
RISCV_PTR 0
|
RISCV_PTR 0
|
||||||
_load_start:
|
_load_start:
|
||||||
|
Reference in New Issue
Block a user