WIP FPC-III support
[linux/fpc-iii.git] / arch / riscv / kernel / cpu_ops_spinwait.c
blobb2c957bb68c1fd87d35a03dc759806569109a032
1 // SPDX-License-Identifier: GPL-2.0-only
2 /*
3 * Copyright (c) 2020 Western Digital Corporation or its affiliates.
4 */
6 #include <linux/errno.h>
7 #include <linux/of.h>
8 #include <linux/string.h>
9 #include <asm/cpu_ops.h>
10 #include <asm/sbi.h>
11 #include <asm/smp.h>
13 const struct cpu_operations cpu_ops_spinwait;
15 static int spinwait_cpu_prepare(unsigned int cpuid)
17 if (!cpu_ops_spinwait.cpu_start) {
18 pr_err("cpu start method not defined for CPU [%d]\n", cpuid);
19 return -ENODEV;
21 return 0;
24 static int spinwait_cpu_start(unsigned int cpuid, struct task_struct *tidle)
27 * In this protocol, all cpus boot on their own accord. _start
28 * selects the first cpu to boot the kernel and causes the remainder
29 * of the cpus to spin in a loop waiting for their stack pointer to be
30 * setup by that main cpu. Writing to bootdata
31 * (i.e __cpu_up_stack_pointer) signals to the spinning cpus that they
32 * can continue the boot process.
34 cpu_update_secondary_bootdata(cpuid, tidle);
36 return 0;
39 const struct cpu_operations cpu_ops_spinwait = {
40 .name = "spinwait",
41 .cpu_prepare = spinwait_cpu_prepare,
42 .cpu_start = spinwait_cpu_start,