12875fe05SAtish Patra /* SPDX-License-Identifier: GPL-2.0-only */ 22875fe05SAtish Patra /* 32875fe05SAtish Patra * Copyright (c) 2020 Western Digital Corporation or its affiliates. 42875fe05SAtish Patra * Based on arch/arm64/include/asm/cpu_ops.h 52875fe05SAtish Patra */ 62875fe05SAtish Patra #ifndef __ASM_CPU_OPS_H 72875fe05SAtish Patra #define __ASM_CPU_OPS_H 82875fe05SAtish Patra 92875fe05SAtish Patra #include <linux/init.h> 102875fe05SAtish Patra #include <linux/sched.h> 112875fe05SAtish Patra #include <linux/threads.h> 122875fe05SAtish Patra 132875fe05SAtish Patra /** 142875fe05SAtish Patra * struct cpu_operations - Callback operations for hotplugging CPUs. 152875fe05SAtish Patra * 162875fe05SAtish Patra * @name: Name of the boot protocol. 172875fe05SAtish Patra * @cpu_prepare: Early one-time preparation step for a cpu. If there 182875fe05SAtish Patra * is a mechanism for doing so, tests whether it is 192875fe05SAtish Patra * possible to boot the given HART. 202875fe05SAtish Patra * @cpu_start: Boots a cpu into the kernel. 21f1e58583SAtish Patra * @cpu_disable: Prepares a cpu to die. May fail for some 22f1e58583SAtish Patra * mechanism-specific reason, which will cause the hot 23f1e58583SAtish Patra * unplug to be aborted. Called from the cpu to be killed. 24f1e58583SAtish Patra * @cpu_stop: Makes a cpu leave the kernel. Must not fail. Called from 25f1e58583SAtish Patra * the cpu being stopped. 26f1e58583SAtish Patra * @cpu_is_stopped: Ensures a cpu has left the kernel. Called from another 27f1e58583SAtish Patra * cpu. 282875fe05SAtish Patra */ 292875fe05SAtish Patra struct cpu_operations { 302875fe05SAtish Patra const char *name; 312875fe05SAtish Patra int (*cpu_prepare)(unsigned int cpu); 322875fe05SAtish Patra int (*cpu_start)(unsigned int cpu, 332875fe05SAtish Patra struct task_struct *tidle); 34f1e58583SAtish Patra #ifdef CONFIG_HOTPLUG_CPU 35f1e58583SAtish Patra int (*cpu_disable)(unsigned int cpu); 36f1e58583SAtish Patra void (*cpu_stop)(void); 37f1e58583SAtish Patra int (*cpu_is_stopped)(unsigned int cpu); 38f1e58583SAtish Patra #endif 392875fe05SAtish Patra }; 402875fe05SAtish Patra 41*da6d2128SBen Dooks extern const struct cpu_operations cpu_ops_spinwait; 422875fe05SAtish Patra extern const struct cpu_operations *cpu_ops[NR_CPUS]; 432875fe05SAtish Patra void __init cpu_set_ops(int cpu); 442875fe05SAtish Patra 452875fe05SAtish Patra #endif /* ifndef __ASM_CPU_OPS_H */ 46