]> git.baikalelectronics.ru Git - kernel.git/commit
riscv: force __cpu_up_ variables to put in data section
authorZong Li <zong.li@sifive.com>
Mon, 4 May 2020 03:54:48 +0000 (11:54 +0800)
committerPalmer Dabbelt <palmerdabbelt@google.com>
Mon, 4 May 2020 22:03:25 +0000 (15:03 -0700)
commitdcd28180ee4f24e0e4a30f600244928953e3222f
tree14a979e264fa9a578cad08df88de54c2c257ffda
parent9cbb6e3ddc65073f446cc00df141398a0489d69e
riscv: force __cpu_up_ variables to put in data section

Put __cpu_up_stack_pointer and __cpu_up_task_pointer in data section.
Currently, these two variables are put in bss section, there is a
potential risk that secondary harts get the uninitialized value before
main hart finishing the bss clearing. In this case, all secondary
harts would pass the waiting loop and enable the MMU before main hart
set up the page table.

This issue happens on random booting of multiple harts, which means
it will manifest for BBL and OpenSBI v0.6 (or older version). In OpenSBI
v0.7 (or higher version), we have HSM extension so all the secondary harts
are brought-up by Linux kernel in an orderly fashion. This means we don't
need this change for OpenSBI v0.7 (or higher version).

Signed-off-by: Zong Li <zong.li@sifive.com>
Reviewed-by: Greentime Hu <greentime.hu@sifive.com>
Reviewed-by: Anup Patel <anup@brainfault.org>
Reviewed-by: Atish Patra <atish.patra@wdc.com>
Signed-off-by: Palmer Dabbelt <palmerdabbelt@google.com>
arch/riscv/kernel/cpu_ops.c