]> git.karo-electronics.de Git - linux-beck.git/blob - include/linux/cpuhotplug.h
cpu/hotplug: Move online calls to hotplugged cpu
[linux-beck.git] / include / linux / cpuhotplug.h
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,
9         CPUHP_AP_OFFLINE,
10         CPUHP_AP_NOTIFY_STARTING,
11         CPUHP_AP_ONLINE,
12         CPUHP_TEARDOWN_CPU,
13         CPUHP_CPU_SET_ACTIVE,
14         CPUHP_KICK_AP_THREAD,
15         CPUHP_BP_ONLINE,
16         CPUHP_AP_SMPBOOT_THREADS,
17         CPUHP_AP_NOTIFY_ONLINE,
18         CPUHP_AP_ONLINE_DYN,
19         CPUHP_AP_ONLINE_DYN_END         = CPUHP_AP_ONLINE_DYN + 30,
20         CPUHP_ONLINE,
21 };
22
23 int __cpuhp_setup_state(enum cpuhp_state state, const char *name, bool invoke,
24                         int (*startup)(unsigned int cpu),
25                         int (*teardown)(unsigned int cpu));
26
27 /**
28  * cpuhp_setup_state - Setup hotplug state callbacks with calling the callbacks
29  * @state:      The state for which the calls are installed
30  * @name:       Name of the callback (will be used in debug output)
31  * @startup:    startup callback function
32  * @teardown:   teardown callback function
33  *
34  * Installs the callback functions and invokes the startup callback on
35  * the present cpus which have already reached the @state.
36  */
37 static inline int cpuhp_setup_state(enum cpuhp_state state,
38                                     const char *name,
39                                     int (*startup)(unsigned int cpu),
40                                     int (*teardown)(unsigned int cpu))
41 {
42         return __cpuhp_setup_state(state, name, true, startup, teardown);
43 }
44
45 /**
46  * cpuhp_setup_state_nocalls - Setup hotplug state callbacks without calling the
47  *                             callbacks
48  * @state:      The state for which the calls are installed
49  * @name:       Name of the callback.
50  * @startup:    startup callback function
51  * @teardown:   teardown callback function
52  *
53  * Same as @cpuhp_setup_state except that no calls are executed are invoked
54  * during installation of this callback. NOP if SMP=n or HOTPLUG_CPU=n.
55  */
56 static inline int cpuhp_setup_state_nocalls(enum cpuhp_state state,
57                                             const char *name,
58                                             int (*startup)(unsigned int cpu),
59                                             int (*teardown)(unsigned int cpu))
60 {
61         return __cpuhp_setup_state(state, name, false, startup, teardown);
62 }
63
64 void __cpuhp_remove_state(enum cpuhp_state state, bool invoke);
65
66 /**
67  * cpuhp_remove_state - Remove hotplug state callbacks and invoke the teardown
68  * @state:      The state for which the calls are removed
69  *
70  * Removes the callback functions and invokes the teardown callback on
71  * the present cpus which have already reached the @state.
72  */
73 static inline void cpuhp_remove_state(enum cpuhp_state state)
74 {
75         __cpuhp_remove_state(state, true);
76 }
77
78 /**
79  * cpuhp_remove_state_nocalls - Remove hotplug state callbacks without invoking
80  *                              teardown
81  * @state:      The state for which the calls are removed
82  */
83 static inline void cpuhp_remove_state_nocalls(enum cpuhp_state state)
84 {
85         __cpuhp_remove_state(state, false);
86 }
87
88 #endif