1 /* SPDX-License-Identifier: GPL-2.0-only */
3 * Copyright (C) 2013 ARM Ltd.
5 #ifndef __ASM_CPU_OPS_H
6 #define __ASM_CPU_OPS_H
8 #include <linux/init.h>
9 #include <linux/threads.h>
12 * struct cpu_operations - Callback operations for hotplugging CPUs.
14 * @name: Name of the property as appears in a devicetree cpu node's
15 * enable-method property. On systems booting with ACPI, @name
16 * identifies the struct cpu_operations entry corresponding to
17 * the boot protocol specified in the ACPI MADT table.
18 * @cpu_init: Reads any data necessary for a specific enable-method for a
19 * proposed logical id.
20 * @cpu_prepare: Early one-time preparation step for a cpu. If there is a
21 * mechanism for doing so, tests whether it is possible to boot
23 * @cpu_boot: Boots a cpu into the kernel.
24 * @cpu_postboot: Optionally, perform any post-boot cleanup or necesary
25 * synchronisation. Called from the cpu being booted.
26 * @cpu_can_disable: Determines whether a CPU can be disabled based on
27 * mechanism-specific information.
28 * @cpu_disable: Prepares a cpu to die. May fail for some mechanism-specific
29 * reason, which will cause the hot unplug to be aborted. Called
30 * from the cpu to be killed.
31 * @cpu_die: Makes a cpu leave the kernel. Must not fail. Called from the
33 * @cpu_kill: Ensures a cpu has left the kernel. Called from another cpu.
34 * @cpu_init_idle: Reads any data necessary to initialize CPU idle states for
35 * a proposed logical id.
36 * @cpu_suspend: Suspends a cpu and saves the required context. May fail owing
37 * to wrong parameters or error conditions. Called from the
38 * CPU being suspended. Must be called with IRQs disabled.
40 struct cpu_operations
{
42 int (*cpu_init
)(unsigned int);
43 int (*cpu_prepare
)(unsigned int);
44 int (*cpu_boot
)(unsigned int);
45 void (*cpu_postboot
)(void);
46 #ifdef CONFIG_HOTPLUG_CPU
47 bool (*cpu_can_disable
)(unsigned int cpu
);
48 int (*cpu_disable
)(unsigned int cpu
);
49 void (*cpu_die
)(unsigned int cpu
);
50 int (*cpu_kill
)(unsigned int cpu
);
52 #ifdef CONFIG_CPU_IDLE
53 int (*cpu_init_idle
)(unsigned int);
54 int (*cpu_suspend
)(unsigned long);
58 extern const struct cpu_operations
*cpu_ops
[NR_CPUS
];
59 int __init
cpu_read_ops(int cpu
);
61 static inline void __init
cpu_read_bootcpu_ops(void)
66 #endif /* ifndef __ASM_CPU_OPS_H */