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