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