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