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