From: Lukas Auer Date: Sun, 17 Mar 2019 18:28:39 +0000 (+0100) Subject: riscv: do not rely on hart ID passed by previous boot stage X-Git-Url: http://git.dujemihanovic.xyz/login.html?a=commitdiff_plain;h=e04324025275dee6e3e9a968c8d12e98c9b47567;p=u-boot.git riscv: do not rely on hart ID passed by previous boot stage RISC-V U-Boot expects the hart ID to be passed to it via register a0 by the previous boot stage. Machine mode firmware such as BBL and OpenSBI do this when starting their payload (U-Boot) in supervisor mode. If U-Boot is running in machine mode, this task must be handled by the boot ROM. Explicitly populate register a0 with the hart ID from the mhartid CSR to avoid possible problems on RISC-V processors with a boot ROM that does not handle this task. Suggested-by: Rick Chen Signed-off-by: Lukas Auer Reviewed-by: Anup Patel Reviewed-by: Atish Patra Reviewed-by: Bin Meng Tested-by: Bin Meng Reviewed-by: Rick Chen Tested-by: Rick Chen --- diff --git a/arch/riscv/cpu/start.S b/arch/riscv/cpu/start.S index f55b8cbc37..5ac899b141 100644 --- a/arch/riscv/cpu/start.S +++ b/arch/riscv/cpu/start.S @@ -36,6 +36,10 @@ .section .text .globl _start _start: +#ifdef CONFIG_RISCV_MMODE + csrr a0, mhartid +#endif + /* save hart id and dtb pointer */ mv tp, a0 mv s1, a1