Skip to content

Commit d6d5161

Browse files
zongboxpalmer-dabbelt
authored andcommitted
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 <[email protected]> Reviewed-by: Greentime Hu <[email protected]> Reviewed-by: Anup Patel <[email protected]> Reviewed-by: Atish Patra <[email protected]> Signed-off-by: Palmer Dabbelt <[email protected]>
1 parent 0a9f2a6 commit d6d5161

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

arch/riscv/kernel/cpu_ops.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515

1616
const struct cpu_operations *cpu_ops[NR_CPUS] __ro_after_init;
1717

18-
void *__cpu_up_stack_pointer[NR_CPUS];
19-
void *__cpu_up_task_pointer[NR_CPUS];
18+
void *__cpu_up_stack_pointer[NR_CPUS] __section(.data);
19+
void *__cpu_up_task_pointer[NR_CPUS] __section(.data);
2020

2121
extern const struct cpu_operations cpu_ops_sbi;
2222
extern const struct cpu_operations cpu_ops_spinwait;

0 commit comments

Comments
 (0)