File tree Expand file tree Collapse file tree 5 files changed +30
-5
lines changed Expand file tree Collapse file tree 5 files changed +30
-5
lines changed Original file line number Diff line number Diff line change @@ -374,6 +374,20 @@ config RISCV_SBI_V01
374374 This config allows kernel to use SBI v0.1 APIs. This will be
375375 deprecated in future once legacy M-mode software are no longer in use.
376376
377+ config RISCV_BOOT_SPINWAIT
378+ bool "Spinwait booting method"
379+ depends on SMP
380+ default y
381+ help
382+ This enables support for booting Linux via spinwait method. In the
383+ spinwait method, all cores randomly jump to Linux. One of the cores
384+ gets chosen via lottery and all other keep spinning on a percpu
385+ variable. This method cannot support CPU hotplug and sparse hartid
386+ scheme. It should be only enabled for M-mode Linux or platforms relying
387+ on older firmware without SBI HSM extension. All other platforms should
388+ rely on ordered booting via SBI HSM extension which gets chosen
389+ dynamically at runtime if the firmware supports it.
390+
377391config KEXEC
378392 bool "Kexec system call"
379393 select KEXEC_CORE
Original file line number Diff line number Diff line change @@ -43,7 +43,8 @@ obj-$(CONFIG_FPU) += fpu.o
4343obj-$(CONFIG_SMP) += smpboot.o
4444obj-$(CONFIG_SMP) += smp.o
4545obj-$(CONFIG_SMP) += cpu_ops.o
46- obj-$(CONFIG_SMP) += cpu_ops_spinwait.o
46+
47+ obj-$(CONFIG_RISCV_BOOT_SPINWAIT) += cpu_ops_spinwait.o
4748obj-$(CONFIG_MODULES) += module.o
4849obj-$(CONFIG_MODULE_SECTIONS) += module-sections.o
4950
Original file line number Diff line number Diff line change 1515const struct cpu_operations * cpu_ops [NR_CPUS ] __ro_after_init ;
1616
1717extern const struct cpu_operations cpu_ops_sbi ;
18+ #ifdef CONFIG_RISCV_BOOT_SPINWAIT
1819extern const struct cpu_operations cpu_ops_spinwait ;
20+ #else
21+ const struct cpu_operations cpu_ops_spinwait = {
22+ .name = "" ,
23+ .cpu_prepare = NULL ,
24+ .cpu_start = NULL ,
25+ };
26+ #endif
1927
2028void __init cpu_set_ops (int cpuid )
2129{
Original file line number Diff line number Diff line change @@ -259,7 +259,7 @@ pmp_done:
259259 li t0, SR_FS
260260 csrc CSR_STATUS, t0
261261
262- #ifdef CONFIG_SMP
262+ #ifdef CONFIG_RISCV_BOOT_SPINWAIT
263263 li t0, CONFIG_NR_CPUS
264264 blt a0, t0, .Lgood_cores
265265 tail .Lsecondary_park
@@ -285,7 +285,7 @@ pmp_done:
285285 beq t0, t1, .Lsecondary_start
286286
287287#endif /* CONFIG_XIP */
288- #endif /* CONFIG_SMP */
288+ #endif /* CONFIG_RISCV_BOOT_SPINWAIT */
289289
290290#ifdef CONFIG_XIP_KERNEL
291291 la sp, _end + THREAD_SIZE
@@ -344,7 +344,7 @@ clear_bss_done:
344344 call soc_early_init
345345 tail start_kernel
346346
347- #ifdef CONFIG_SMP
347+ #if CONFIG_RISCV_BOOT_SPINWAIT
348348.Lsecondary_start:
349349 /* Set trap vector to spin forever to help debug */
350350 la a3, .Lsecondary_park
@@ -371,7 +371,7 @@ clear_bss_done:
371371 fence
372372
373373 tail .Lsecondary_start_common
374- #endif
374+ #endif /* CONFIG_RISCV_BOOT_SPINWAIT */
375375
376376END(_start_kernel)
377377
Original file line number Diff line number Diff line change @@ -16,7 +16,9 @@ asmlinkage void __init setup_vm(uintptr_t dtb_pa);
1616asmlinkage void __init __copy_data (void );
1717#endif
1818
19+ #ifdef CONFIG_RISCV_BOOT_SPINWAIT
1920extern void * __cpu_spinwait_stack_pointer [];
2021extern void * __cpu_spinwait_task_pointer [];
22+ #endif
2123
2224#endif /* __ASM_HEAD_H */
You can’t perform that action at this time.
0 commit comments