]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blame - include/linux/cpuhotplug.h
bus/arm-ccn: Convert to hotplug statemachine
[mirror_ubuntu-artful-kernel.git] / include / linux / cpuhotplug.h
CommitLineData
cff7d378
TG
1#ifndef __CPUHOTPLUG_H
2#define __CPUHOTPLUG_H
3
4enum cpuhp_state {
5 CPUHP_OFFLINE,
6 CPUHP_CREATE_THREADS,
00e16c3d 7 CPUHP_PERF_PREPARE,
95ca792c 8 CPUHP_PERF_X86_PREPARE,
1a246b9f 9 CPUHP_PERF_X86_UNCORE_PREP,
96b2bd38 10 CPUHP_PERF_X86_AMD_UNCORE_PREP,
8b5b773d 11 CPUHP_PERF_X86_RAPL_PREP,
a409f5ee 12 CPUHP_PERF_BFIN,
57ecde42 13 CPUHP_PERF_POWER,
e3cfce17 14 CPUHP_PERF_SUPERH,
cff7d378
TG
15 CPUHP_NOTIFY_PREPARE,
16 CPUHP_BRINGUP_CPU,
e69aab13 17 CPUHP_AP_IDLE_DEAD,
4baa0afc 18 CPUHP_AP_OFFLINE,
9cf7243d 19 CPUHP_AP_SCHED_STARTING,
93131f7a 20 CPUHP_AP_IRQ_GIC_STARTING,
6670a6d8 21 CPUHP_AP_IRQ_GICV3_STARTING,
6c034d17 22 CPUHP_AP_IRQ_HIP04_STARTING,
cb5ff2d2
RC
23 CPUHP_AP_IRQ_ARMADA_XP_STARTING,
24 CPUHP_AP_IRQ_ARMADA_CASC_STARTING,
7ca04bc2 25 CPUHP_AP_IRQ_BCM2836_STARTING,
7fbbaebf 26 CPUHP_AP_ARM_MVEBU_COHERENCY,
1a246b9f 27 CPUHP_AP_PERF_X86_UNCORE_STARTING,
96b2bd38 28 CPUHP_AP_PERF_X86_AMD_UNCORE_STARTING,
95ca792c 29 CPUHP_AP_PERF_X86_STARTING,
9744f7b7 30 CPUHP_AP_PERF_X86_AMD_IBS_STARTING,
f0704827 31 CPUHP_AP_PERF_X86_CQM_STARTING,
77c34ef1 32 CPUHP_AP_PERF_X86_CSTATE_STARTING,
4baa0afc
TG
33 CPUHP_AP_NOTIFY_STARTING,
34 CPUHP_AP_ONLINE,
35 CPUHP_TEARDOWN_CPU,
fc6d73d6 36 CPUHP_AP_ONLINE_IDLE,
1cf4f629 37 CPUHP_AP_SMPBOOT_THREADS,
07d36c9e 38 CPUHP_AP_X86_VDSO_VMA_ONLINE,
00e16c3d 39 CPUHP_AP_PERF_ONLINE,
95ca792c 40 CPUHP_AP_PERF_X86_ONLINE,
1a246b9f 41 CPUHP_AP_PERF_X86_UNCORE_ONLINE,
96b2bd38 42 CPUHP_AP_PERF_X86_AMD_UNCORE_ONLINE,
8b5b773d 43 CPUHP_AP_PERF_X86_RAPL_ONLINE,
f0704827 44 CPUHP_AP_PERF_X86_CQM_ONLINE,
77c34ef1 45 CPUHP_AP_PERF_X86_CSTATE_ONLINE,
4f0f8217 46 CPUHP_AP_PERF_S390_CF_ONLINE,
e3d617fe 47 CPUHP_AP_PERF_S390_SF_ONLINE,
28c94843 48 CPUHP_AP_PERF_ARM_CCI_ONLINE,
fdc15a36 49 CPUHP_AP_PERF_ARM_CCN_ONLINE,
1cf4f629
TG
50 CPUHP_AP_NOTIFY_ONLINE,
51 CPUHP_AP_ONLINE_DYN,
52 CPUHP_AP_ONLINE_DYN_END = CPUHP_AP_ONLINE_DYN + 30,
aaddd7d1 53 CPUHP_AP_ACTIVE,
cff7d378
TG
54 CPUHP_ONLINE,
55};
56
5b7aa87e
TG
57int __cpuhp_setup_state(enum cpuhp_state state, const char *name, bool invoke,
58 int (*startup)(unsigned int cpu),
59 int (*teardown)(unsigned int cpu));
60
61/**
62 * cpuhp_setup_state - Setup hotplug state callbacks with calling the callbacks
63 * @state: The state for which the calls are installed
64 * @name: Name of the callback (will be used in debug output)
65 * @startup: startup callback function
66 * @teardown: teardown callback function
67 *
68 * Installs the callback functions and invokes the startup callback on
69 * the present cpus which have already reached the @state.
70 */
71static inline int cpuhp_setup_state(enum cpuhp_state state,
72 const char *name,
73 int (*startup)(unsigned int cpu),
74 int (*teardown)(unsigned int cpu))
75{
76 return __cpuhp_setup_state(state, name, true, startup, teardown);
77}
78
79/**
80 * cpuhp_setup_state_nocalls - Setup hotplug state callbacks without calling the
81 * callbacks
82 * @state: The state for which the calls are installed
83 * @name: Name of the callback.
84 * @startup: startup callback function
85 * @teardown: teardown callback function
86 *
87 * Same as @cpuhp_setup_state except that no calls are executed are invoked
88 * during installation of this callback. NOP if SMP=n or HOTPLUG_CPU=n.
89 */
90static inline int cpuhp_setup_state_nocalls(enum cpuhp_state state,
91 const char *name,
92 int (*startup)(unsigned int cpu),
93 int (*teardown)(unsigned int cpu))
94{
95 return __cpuhp_setup_state(state, name, false, startup, teardown);
96}
97
98void __cpuhp_remove_state(enum cpuhp_state state, bool invoke);
99
100/**
101 * cpuhp_remove_state - Remove hotplug state callbacks and invoke the teardown
102 * @state: The state for which the calls are removed
103 *
104 * Removes the callback functions and invokes the teardown callback on
105 * the present cpus which have already reached the @state.
106 */
107static inline void cpuhp_remove_state(enum cpuhp_state state)
108{
109 __cpuhp_remove_state(state, true);
110}
111
112/**
113 * cpuhp_remove_state_nocalls - Remove hotplug state callbacks without invoking
114 * teardown
115 * @state: The state for which the calls are removed
116 */
117static inline void cpuhp_remove_state_nocalls(enum cpuhp_state state)
118{
119 __cpuhp_remove_state(state, false);
120}
121
8df3e07e
TG
122#ifdef CONFIG_SMP
123void cpuhp_online_idle(enum cpuhp_state state);
124#else
125static inline void cpuhp_online_idle(enum cpuhp_state state) { }
126#endif
127
cff7d378 128#endif