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