1 // SPDX-License-Identifier: GPL-2.0-only
3 * Copyright (c) 2020 Western Digital Corporation or its affiliates.
6 #include <linux/errno.h>
8 #include <linux/string.h>
9 #include <asm/cpu_ops.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);
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);
39 const struct cpu_operations cpu_ops_spinwait = {
41 .cpu_prepare = spinwait_cpu_prepare,
42 .cpu_start = spinwait_cpu_start,