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
374
374
This config allows kernel to use SBI v0.1 APIs. This will be
375
375
deprecated in future once legacy M-mode software are no longer in use.
376
376
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
+
377
391
config KEXEC
378
392
bool "Kexec system call"
379
393
select KEXEC_CORE
Original file line number Diff line number Diff line change @@ -43,7 +43,8 @@ obj-$(CONFIG_FPU) += fpu.o
43
43
obj-$(CONFIG_SMP) += smpboot.o
44
44
obj-$(CONFIG_SMP) += smp.o
45
45
obj-$(CONFIG_SMP) += cpu_ops.o
46
- obj-$(CONFIG_SMP) += cpu_ops_spinwait.o
46
+
47
+ obj-$(CONFIG_RISCV_BOOT_SPINWAIT) += cpu_ops_spinwait.o
47
48
obj-$(CONFIG_MODULES) += module.o
48
49
obj-$(CONFIG_MODULE_SECTIONS) += module-sections.o
49
50
Original file line number Diff line number Diff line change 15
15
const struct cpu_operations * cpu_ops [NR_CPUS ] __ro_after_init ;
16
16
17
17
extern const struct cpu_operations cpu_ops_sbi ;
18
+ #ifdef CONFIG_RISCV_BOOT_SPINWAIT
18
19
extern 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
19
27
20
28
void __init cpu_set_ops (int cpuid )
21
29
{
Original file line number Diff line number Diff line change @@ -259,7 +259,7 @@ pmp_done:
259
259
li t0, SR_FS
260
260
csrc CSR_STATUS, t0
261
261
262
- #ifdef CONFIG_SMP
262
+ #ifdef CONFIG_RISCV_BOOT_SPINWAIT
263
263
li t0, CONFIG_NR_CPUS
264
264
blt a0, t0, .Lgood_cores
265
265
tail .Lsecondary_park
@@ -285,7 +285,7 @@ pmp_done:
285
285
beq t0, t1, .Lsecondary_start
286
286
287
287
#endif /* CONFIG_XIP */
288
- #endif /* CONFIG_SMP */
288
+ #endif /* CONFIG_RISCV_BOOT_SPINWAIT */
289
289
290
290
#ifdef CONFIG_XIP_KERNEL
291
291
la sp, _end + THREAD_SIZE
@@ -344,7 +344,7 @@ clear_bss_done:
344
344
call soc_early_init
345
345
tail start_kernel
346
346
347
- #ifdef CONFIG_SMP
347
+ #if CONFIG_RISCV_BOOT_SPINWAIT
348
348
.Lsecondary_start:
349
349
/* Set trap vector to spin forever to help debug */
350
350
la a3, .Lsecondary_park
@@ -371,7 +371,7 @@ clear_bss_done:
371
371
fence
372
372
373
373
tail .Lsecondary_start_common
374
- #endif
374
+ #endif /* CONFIG_RISCV_BOOT_SPINWAIT */
375
375
376
376
END(_start_kernel)
377
377
Original file line number Diff line number Diff line change @@ -16,7 +16,9 @@ asmlinkage void __init setup_vm(uintptr_t dtb_pa);
16
16
asmlinkage void __init __copy_data (void );
17
17
#endif
18
18
19
+ #ifdef CONFIG_RISCV_BOOT_SPINWAIT
19
20
extern void * __cpu_spinwait_stack_pointer [];
20
21
extern void * __cpu_spinwait_task_pointer [];
22
+ #endif
21
23
22
24
#endif /* __ASM_HEAD_H */
You can’t perform that action at this time.
0 commit comments