Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
core: riscv: Do not restrict primary hart to hart ID 0 only
The ID of primary hart should not be restricted to zero. Thus, determining primary hart and secondart harts by zero hart ID is not feasible. We refer to RISC-V linux kernel [1] to fix this issue, by adding a "hart_lottery" variable. The first hart who enters OP-TEE will win the lottery, atomically increment this variable, and be the primary hart. Other harts enter OP-TEE later won't win the lottery, so they execute the secondary boot sequence. [1]: https://github.com/torvalds/linux/blob/v6.7/arch/riscv/kernel/head.S#L244 Signed-off-by: Alvin Chang <alvinga@andestech.com>
- Loading branch information