RISC-V: Avoid using per cpu array for ordered booting
authorAtish Patra <atishp@rivosinc.com>
Mon, 30 May 2022 04:33:31 +0000 (12:33 +0800)
committermason.huo <mason.huo@starfivetech.com>
Thu, 27 Oct 2022 05:54:44 +0000 (13:54 +0800)
commitf10ae751930efcc553d74fb80054dfb63ed899ff
tree4fbeca53ca23558f7986babaac663c01bd7d99fa
parent957aad3596b52296124b5b3c6d4eb87f340d1f47
RISC-V: Avoid using per cpu array for ordered booting

Currently both order booting and spinwait approach uses a per cpu
array to update stack & task pointer. This approach will not work for the
following cases.
1. If NR_CPUs are configured to be less than highest hart id.
2. A platform has sparse hartid.

This issue can be fixed for ordered booting as the booting cpu brings up
one cpu at a time using SBI HSM extension which has opaque parameter
that is unused until now.

Introduce a common secondary boot data structure that can store the stack
and task pointer. Secondary harts will use this data while booting up
to setup the sp & tp.

Reviewed-by: Anup Patel <anup@brainfault.org>
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
From 9a2451f1866344d38b4a1dc20396e3a03954fcd7
Resolved merge conflict.

Signed-off-by: <jeeheng.sia@starfivetech.com>
Signed-off-by: minda.chen <minda.chen@starfivetech.com>
arch/riscv/include/asm/cpu_ops_sbi.h [new file with mode: 0644]
arch/riscv/kernel/asm-offsets.c
arch/riscv/kernel/cpu_ops_sbi.c
arch/riscv/kernel/head.S