]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blame - include/linux/cpuhotplug.h
leds/trigger/cpu: Convert to hotplug state machine
[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,
48d7f6c7 15 CPUHP_X86_HPET_DEAD,
148b9e2a 16 CPUHP_X86_APB_DEAD,
7ee681b2 17 CPUHP_WORKQUEUE_PREP,
cff7d378
TG
18 CPUHP_NOTIFY_PREPARE,
19 CPUHP_BRINGUP_CPU,
e69aab13 20 CPUHP_AP_IDLE_DEAD,
4baa0afc 21 CPUHP_AP_OFFLINE,
9cf7243d 22 CPUHP_AP_SCHED_STARTING,
93131f7a 23 CPUHP_AP_IRQ_GIC_STARTING,
6670a6d8 24 CPUHP_AP_IRQ_GICV3_STARTING,
6c034d17 25 CPUHP_AP_IRQ_HIP04_STARTING,
cb5ff2d2
RC
26 CPUHP_AP_IRQ_ARMADA_XP_STARTING,
27 CPUHP_AP_IRQ_ARMADA_CASC_STARTING,
7ca04bc2 28 CPUHP_AP_IRQ_BCM2836_STARTING,
7fbbaebf 29 CPUHP_AP_ARM_MVEBU_COHERENCY,
1a246b9f 30 CPUHP_AP_PERF_X86_UNCORE_STARTING,
96b2bd38 31 CPUHP_AP_PERF_X86_AMD_UNCORE_STARTING,
95ca792c 32 CPUHP_AP_PERF_X86_STARTING,
9744f7b7 33 CPUHP_AP_PERF_X86_AMD_IBS_STARTING,
f0704827 34 CPUHP_AP_PERF_X86_CQM_STARTING,
77c34ef1 35 CPUHP_AP_PERF_X86_CSTATE_STARTING,
25a77b55 36 CPUHP_AP_PERF_XTENSA_STARTING,
e5b61baf 37 CPUHP_AP_ARM_VFP_STARTING,
7d88eb69 38 CPUHP_AP_PERF_ARM_STARTING,
7e86e8bd 39 CPUHP_AP_ARM_ARCH_TIMER_STARTING,
00c1d17a 40 CPUHP_AP_DUMMY_TIMER_STARTING,
31e8e5db 41 CPUHP_AP_METAG_TIMER_STARTING,
b0404165 42 CPUHP_AP_QCOM_TIMER_STARTING,
2dab9093 43 CPUHP_AP_MIPS_GIC_TIMER_STARTING,
8c18b2d2 44 CPUHP_AP_KVM_STARTING,
911a359d 45 CPUHP_AP_LEDTRIG_STARTING,
4baa0afc
TG
46 CPUHP_AP_NOTIFY_STARTING,
47 CPUHP_AP_ONLINE,
48 CPUHP_TEARDOWN_CPU,
fc6d73d6 49 CPUHP_AP_ONLINE_IDLE,
1cf4f629 50 CPUHP_AP_SMPBOOT_THREADS,
07d36c9e 51 CPUHP_AP_X86_VDSO_VMA_ONLINE,
00e16c3d 52 CPUHP_AP_PERF_ONLINE,
95ca792c 53 CPUHP_AP_PERF_X86_ONLINE,
1a246b9f 54 CPUHP_AP_PERF_X86_UNCORE_ONLINE,
96b2bd38 55 CPUHP_AP_PERF_X86_AMD_UNCORE_ONLINE,
c6a84daa 56 CPUHP_AP_PERF_X86_AMD_POWER_ONLINE,
8b5b773d 57 CPUHP_AP_PERF_X86_RAPL_ONLINE,
f0704827 58 CPUHP_AP_PERF_X86_CQM_ONLINE,
77c34ef1 59 CPUHP_AP_PERF_X86_CSTATE_ONLINE,
4f0f8217 60 CPUHP_AP_PERF_S390_CF_ONLINE,
e3d617fe 61 CPUHP_AP_PERF_S390_SF_ONLINE,
28c94843 62 CPUHP_AP_PERF_ARM_CCI_ONLINE,
fdc15a36 63 CPUHP_AP_PERF_ARM_CCN_ONLINE,
7ee681b2 64 CPUHP_AP_WORKQUEUE_ONLINE,
1cf4f629
TG
65 CPUHP_AP_NOTIFY_ONLINE,
66 CPUHP_AP_ONLINE_DYN,
67 CPUHP_AP_ONLINE_DYN_END = CPUHP_AP_ONLINE_DYN + 30,
48d7f6c7 68 CPUHP_AP_X86_HPET_ONLINE,
251a5fd6 69 CPUHP_AP_X86_KVM_CLK_ONLINE,
aaddd7d1 70 CPUHP_AP_ACTIVE,
cff7d378
TG
71 CPUHP_ONLINE,
72};
73
5b7aa87e
TG
74int __cpuhp_setup_state(enum cpuhp_state state, const char *name, bool invoke,
75 int (*startup)(unsigned int cpu),
76 int (*teardown)(unsigned int cpu));
77
78/**
79 * cpuhp_setup_state - Setup hotplug state callbacks with calling the callbacks
80 * @state: The state for which the calls are installed
81 * @name: Name of the callback (will be used in debug output)
82 * @startup: startup callback function
83 * @teardown: teardown callback function
84 *
85 * Installs the callback functions and invokes the startup callback on
86 * the present cpus which have already reached the @state.
87 */
88static inline int cpuhp_setup_state(enum cpuhp_state state,
89 const char *name,
90 int (*startup)(unsigned int cpu),
91 int (*teardown)(unsigned int cpu))
92{
93 return __cpuhp_setup_state(state, name, true, startup, teardown);
94}
95
96/**
97 * cpuhp_setup_state_nocalls - Setup hotplug state callbacks without calling the
98 * callbacks
99 * @state: The state for which the calls are installed
100 * @name: Name of the callback.
101 * @startup: startup callback function
102 * @teardown: teardown callback function
103 *
104 * Same as @cpuhp_setup_state except that no calls are executed are invoked
105 * during installation of this callback. NOP if SMP=n or HOTPLUG_CPU=n.
106 */
107static inline int cpuhp_setup_state_nocalls(enum cpuhp_state state,
108 const char *name,
109 int (*startup)(unsigned int cpu),
110 int (*teardown)(unsigned int cpu))
111{
112 return __cpuhp_setup_state(state, name, false, startup, teardown);
113}
114
115void __cpuhp_remove_state(enum cpuhp_state state, bool invoke);
116
117/**
118 * cpuhp_remove_state - Remove hotplug state callbacks and invoke the teardown
119 * @state: The state for which the calls are removed
120 *
121 * Removes the callback functions and invokes the teardown callback on
122 * the present cpus which have already reached the @state.
123 */
124static inline void cpuhp_remove_state(enum cpuhp_state state)
125{
126 __cpuhp_remove_state(state, true);
127}
128
129/**
130 * cpuhp_remove_state_nocalls - Remove hotplug state callbacks without invoking
131 * teardown
132 * @state: The state for which the calls are removed
133 */
134static inline void cpuhp_remove_state_nocalls(enum cpuhp_state state)
135{
136 __cpuhp_remove_state(state, false);
137}
138
8df3e07e
TG
139#ifdef CONFIG_SMP
140void cpuhp_online_idle(enum cpuhp_state state);
141#else
142static inline void cpuhp_online_idle(enum cpuhp_state state) { }
143#endif
144
cff7d378 145#endif