xref: /linux/arch/riscv/include/asm/cpu_ops.h (revision e91c37f1)
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3  * Copyright (c) 2020 Western Digital Corporation or its affiliates.
4  * Based on arch/arm64/include/asm/cpu_ops.h
5  */
6 #ifndef __ASM_CPU_OPS_H
7 #define __ASM_CPU_OPS_H
8 
9 #include <linux/init.h>
10 #include <linux/sched.h>
11 #include <linux/threads.h>
12 
13 /**
14  * struct cpu_operations - Callback operations for hotplugging CPUs.
15  *
16  * @cpu_start:		Boots a cpu into the kernel.
17  * @cpu_stop:		Makes a cpu leave the kernel. Must not fail. Called from
18  *			the cpu being stopped.
19  * @cpu_is_stopped:	Ensures a cpu has left the kernel. Called from another
20  *			cpu.
21  */
22 struct cpu_operations {
23 	int		(*cpu_start)(unsigned int cpu,
24 				     struct task_struct *tidle);
25 #ifdef CONFIG_HOTPLUG_CPU
26 	void		(*cpu_stop)(void);
27 	int		(*cpu_is_stopped)(unsigned int cpu);
28 #endif
29 };
30 
31 extern const struct cpu_operations cpu_ops_spinwait;
32 extern const struct cpu_operations *cpu_ops;
33 void __init cpu_set_ops(void);
34 
35 #endif /* ifndef __ASM_CPU_OPS_H */
36