Commit | Line | Data |
---|---|---|
cff7d378 TG |
1 | #ifndef __CPUHOTPLUG_H |
2 | #define __CPUHOTPLUG_H | |
3 | ||
4 | enum cpuhp_state { | |
5 | CPUHP_OFFLINE, | |
6 | CPUHP_CREATE_THREADS, | |
7 | CPUHP_NOTIFY_PREPARE, | |
8 | CPUHP_BRINGUP_CPU, | |
e69aab13 | 9 | CPUHP_AP_IDLE_DEAD, |
4baa0afc | 10 | CPUHP_AP_OFFLINE, |
9cf7243d | 11 | CPUHP_AP_SCHED_STARTING, |
93131f7a | 12 | CPUHP_AP_IRQ_GIC_STARTING, |
4baa0afc TG |
13 | CPUHP_AP_NOTIFY_STARTING, |
14 | CPUHP_AP_ONLINE, | |
15 | CPUHP_TEARDOWN_CPU, | |
fc6d73d6 | 16 | CPUHP_AP_ONLINE_IDLE, |
1cf4f629 | 17 | CPUHP_AP_SMPBOOT_THREADS, |
07d36c9e | 18 | CPUHP_AP_X86_VDSO_VMA_ONLINE, |
1cf4f629 TG |
19 | CPUHP_AP_NOTIFY_ONLINE, |
20 | CPUHP_AP_ONLINE_DYN, | |
21 | CPUHP_AP_ONLINE_DYN_END = CPUHP_AP_ONLINE_DYN + 30, | |
aaddd7d1 | 22 | CPUHP_AP_ACTIVE, |
cff7d378 TG |
23 | CPUHP_ONLINE, |
24 | }; | |
25 | ||
5b7aa87e TG |
26 | int __cpuhp_setup_state(enum cpuhp_state state, const char *name, bool invoke, |
27 | int (*startup)(unsigned int cpu), | |
28 | int (*teardown)(unsigned int cpu)); | |
29 | ||
30 | /** | |
31 | * cpuhp_setup_state - Setup hotplug state callbacks with calling the callbacks | |
32 | * @state: The state for which the calls are installed | |
33 | * @name: Name of the callback (will be used in debug output) | |
34 | * @startup: startup callback function | |
35 | * @teardown: teardown callback function | |
36 | * | |
37 | * Installs the callback functions and invokes the startup callback on | |
38 | * the present cpus which have already reached the @state. | |
39 | */ | |
40 | static inline int cpuhp_setup_state(enum cpuhp_state state, | |
41 | const char *name, | |
42 | int (*startup)(unsigned int cpu), | |
43 | int (*teardown)(unsigned int cpu)) | |
44 | { | |
45 | return __cpuhp_setup_state(state, name, true, startup, teardown); | |
46 | } | |
47 | ||
48 | /** | |
49 | * cpuhp_setup_state_nocalls - Setup hotplug state callbacks without calling the | |
50 | * callbacks | |
51 | * @state: The state for which the calls are installed | |
52 | * @name: Name of the callback. | |
53 | * @startup: startup callback function | |
54 | * @teardown: teardown callback function | |
55 | * | |
56 | * Same as @cpuhp_setup_state except that no calls are executed are invoked | |
57 | * during installation of this callback. NOP if SMP=n or HOTPLUG_CPU=n. | |
58 | */ | |
59 | static inline int cpuhp_setup_state_nocalls(enum cpuhp_state state, | |
60 | const char *name, | |
61 | int (*startup)(unsigned int cpu), | |
62 | int (*teardown)(unsigned int cpu)) | |
63 | { | |
64 | return __cpuhp_setup_state(state, name, false, startup, teardown); | |
65 | } | |
66 | ||
67 | void __cpuhp_remove_state(enum cpuhp_state state, bool invoke); | |
68 | ||
69 | /** | |
70 | * cpuhp_remove_state - Remove hotplug state callbacks and invoke the teardown | |
71 | * @state: The state for which the calls are removed | |
72 | * | |
73 | * Removes the callback functions and invokes the teardown callback on | |
74 | * the present cpus which have already reached the @state. | |
75 | */ | |
76 | static inline void cpuhp_remove_state(enum cpuhp_state state) | |
77 | { | |
78 | __cpuhp_remove_state(state, true); | |
79 | } | |
80 | ||
81 | /** | |
82 | * cpuhp_remove_state_nocalls - Remove hotplug state callbacks without invoking | |
83 | * teardown | |
84 | * @state: The state for which the calls are removed | |
85 | */ | |
86 | static inline void cpuhp_remove_state_nocalls(enum cpuhp_state state) | |
87 | { | |
88 | __cpuhp_remove_state(state, false); | |
89 | } | |
90 | ||
8df3e07e TG |
91 | #ifdef CONFIG_SMP |
92 | void cpuhp_online_idle(enum cpuhp_state state); | |
93 | #else | |
94 | static inline void cpuhp_online_idle(enum cpuhp_state state) { } | |
95 | #endif | |
96 | ||
cff7d378 | 97 | #endif |