.. | .. |
---|
64 | 64 | char *buf); |
---|
65 | 65 | extern ssize_t cpu_show_itlb_multihit(struct device *dev, |
---|
66 | 66 | struct device_attribute *attr, char *buf); |
---|
| 67 | +extern ssize_t cpu_show_srbds(struct device *dev, struct device_attribute *attr, char *buf); |
---|
| 68 | +extern ssize_t cpu_show_mmio_stale_data(struct device *dev, |
---|
| 69 | + struct device_attribute *attr, |
---|
| 70 | + char *buf); |
---|
| 71 | +extern ssize_t cpu_show_retbleed(struct device *dev, |
---|
| 72 | + struct device_attribute *attr, char *buf); |
---|
| 73 | +extern ssize_t cpu_show_spec_rstack_overflow(struct device *dev, |
---|
| 74 | + struct device_attribute *attr, char *buf); |
---|
| 75 | +extern ssize_t cpu_show_gds(struct device *dev, |
---|
| 76 | + struct device_attribute *attr, char *buf); |
---|
67 | 77 | |
---|
68 | 78 | extern __printf(4, 5) |
---|
69 | 79 | struct device *cpu_device_create(struct device *parent, void *drvdata, |
---|
.. | .. |
---|
88 | 98 | |
---|
89 | 99 | #ifdef CONFIG_SMP |
---|
90 | 100 | extern bool cpuhp_tasks_frozen; |
---|
91 | | -int cpu_up(unsigned int cpu); |
---|
| 101 | +int add_cpu(unsigned int cpu); |
---|
| 102 | +int cpu_device_up(struct device *dev); |
---|
92 | 103 | void notify_cpu_starting(unsigned int cpu); |
---|
93 | 104 | extern void cpu_maps_update_begin(void); |
---|
94 | 105 | extern void cpu_maps_update_done(void); |
---|
| 106 | +int bringup_hibernate_cpu(unsigned int sleep_cpu); |
---|
| 107 | +void bringup_nonboot_cpus(unsigned int setup_max_cpus); |
---|
95 | 108 | |
---|
96 | 109 | #else /* CONFIG_SMP */ |
---|
97 | 110 | #define cpuhp_tasks_frozen 0 |
---|
.. | .. |
---|
117 | 130 | extern void cpu_hotplug_disable(void); |
---|
118 | 131 | extern void cpu_hotplug_enable(void); |
---|
119 | 132 | void clear_tasks_mm_cpumask(int cpu); |
---|
120 | | -int cpu_down(unsigned int cpu); |
---|
| 133 | +int remove_cpu(unsigned int cpu); |
---|
| 134 | +int pause_cpus(struct cpumask *cpumask); |
---|
| 135 | +int resume_cpus(struct cpumask *cpumask); |
---|
| 136 | +int cpu_device_down(struct device *dev); |
---|
| 137 | +extern void smp_shutdown_nonboot_cpus(unsigned int primary_cpu); |
---|
121 | 138 | |
---|
122 | 139 | #else /* CONFIG_HOTPLUG_CPU */ |
---|
123 | 140 | |
---|
.. | .. |
---|
129 | 146 | static inline void lockdep_assert_cpus_held(void) { } |
---|
130 | 147 | static inline void cpu_hotplug_disable(void) { } |
---|
131 | 148 | static inline void cpu_hotplug_enable(void) { } |
---|
132 | | - |
---|
| 149 | +static inline int pause_cpus(struct cpumask *cpumask) { return -ENODEV; } |
---|
| 150 | +static inline int resume_cpus(struct cpumask *cpumask) { return -ENODEV; } |
---|
| 151 | +static inline void smp_shutdown_nonboot_cpus(unsigned int primary_cpu) { } |
---|
133 | 152 | #endif /* !CONFIG_HOTPLUG_CPU */ |
---|
134 | 153 | |
---|
135 | 154 | /* Wrappers which go away once all code is converted */ |
---|
.. | .. |
---|
140 | 159 | |
---|
141 | 160 | #ifdef CONFIG_PM_SLEEP_SMP |
---|
142 | 161 | extern int freeze_secondary_cpus(int primary); |
---|
143 | | -static inline int disable_nonboot_cpus(void) |
---|
| 162 | +extern void thaw_secondary_cpus(void); |
---|
| 163 | + |
---|
| 164 | +static inline int suspend_disable_secondary_cpus(void) |
---|
144 | 165 | { |
---|
145 | | - return freeze_secondary_cpus(0); |
---|
| 166 | + int cpu = 0; |
---|
| 167 | + |
---|
| 168 | + if (IS_ENABLED(CONFIG_PM_SLEEP_SMP_NONZERO_CPU)) |
---|
| 169 | + cpu = -1; |
---|
| 170 | + |
---|
| 171 | + return freeze_secondary_cpus(cpu); |
---|
146 | 172 | } |
---|
147 | | -extern void enable_nonboot_cpus(void); |
---|
| 173 | +static inline void suspend_enable_secondary_cpus(void) |
---|
| 174 | +{ |
---|
| 175 | + return thaw_secondary_cpus(); |
---|
| 176 | +} |
---|
| 177 | + |
---|
148 | 178 | #else /* !CONFIG_PM_SLEEP_SMP */ |
---|
149 | | -static inline int disable_nonboot_cpus(void) { return 0; } |
---|
150 | | -static inline void enable_nonboot_cpus(void) {} |
---|
| 179 | +static inline void thaw_secondary_cpus(void) {} |
---|
| 180 | +static inline int suspend_disable_secondary_cpus(void) { return 0; } |
---|
| 181 | +static inline void suspend_enable_secondary_cpus(void) { } |
---|
151 | 182 | #endif /* !CONFIG_PM_SLEEP_SMP */ |
---|
152 | 183 | |
---|
153 | 184 | void cpu_startup_entry(enum cpuhp_state state); |
---|
.. | .. |
---|
155 | 186 | void cpu_idle_poll_ctrl(bool enable); |
---|
156 | 187 | |
---|
157 | 188 | /* Attach to any functions which should be considered cpuidle. */ |
---|
158 | | -#define __cpuidle __attribute__((__section__(".cpuidle.text"))) |
---|
| 189 | +#define __cpuidle __section(".cpuidle.text") |
---|
159 | 190 | |
---|
160 | 191 | bool cpu_in_idle(unsigned long pc); |
---|
161 | 192 | |
---|
.. | .. |
---|
165 | 196 | void arch_cpu_idle_exit(void); |
---|
166 | 197 | void arch_cpu_idle_dead(void); |
---|
167 | 198 | |
---|
| 199 | +#ifdef CONFIG_ARCH_HAS_CPU_FINALIZE_INIT |
---|
| 200 | +void arch_cpu_finalize_init(void); |
---|
| 201 | +#else |
---|
| 202 | +static inline void arch_cpu_finalize_init(void) { } |
---|
| 203 | +#endif |
---|
| 204 | + |
---|
168 | 205 | int cpu_report_state(int cpu); |
---|
169 | 206 | int cpu_check_up_prepare(int cpu); |
---|
170 | 207 | void cpu_set_state_online(int cpu); |
---|
171 | | -void play_idle(unsigned long duration_ms); |
---|
| 208 | +void play_idle_precise(u64 duration_ns, u64 latency_ns); |
---|
| 209 | + |
---|
| 210 | +static inline void play_idle(unsigned long duration_us) |
---|
| 211 | +{ |
---|
| 212 | + play_idle_precise(duration_us * NSEC_PER_USEC, U64_MAX); |
---|
| 213 | +} |
---|
172 | 214 | |
---|
173 | 215 | #ifdef CONFIG_HOTPLUG_CPU |
---|
174 | 216 | bool cpu_wait_death(unsigned int cpu, int seconds); |
---|
.. | .. |
---|
183 | 225 | CPU_SMT_DISABLED, |
---|
184 | 226 | CPU_SMT_FORCE_DISABLED, |
---|
185 | 227 | CPU_SMT_NOT_SUPPORTED, |
---|
| 228 | + CPU_SMT_NOT_IMPLEMENTED, |
---|
186 | 229 | }; |
---|
187 | 230 | |
---|
188 | 231 | #if defined(CONFIG_SMP) && defined(CONFIG_HOTPLUG_SMT) |
---|
189 | 232 | extern enum cpuhp_smt_control cpu_smt_control; |
---|
190 | 233 | extern void cpu_smt_disable(bool force); |
---|
191 | 234 | extern void cpu_smt_check_topology(void); |
---|
| 235 | +extern bool cpu_smt_possible(void); |
---|
192 | 236 | extern int cpuhp_smt_enable(void); |
---|
193 | 237 | extern int cpuhp_smt_disable(enum cpuhp_smt_control ctrlval); |
---|
194 | 238 | #else |
---|
195 | | -# define cpu_smt_control (CPU_SMT_ENABLED) |
---|
| 239 | +# define cpu_smt_control (CPU_SMT_NOT_IMPLEMENTED) |
---|
196 | 240 | static inline void cpu_smt_disable(bool force) { } |
---|
197 | 241 | static inline void cpu_smt_check_topology(void) { } |
---|
| 242 | +static inline bool cpu_smt_possible(void) { return false; } |
---|
198 | 243 | static inline int cpuhp_smt_enable(void) { return 0; } |
---|
199 | 244 | static inline int cpuhp_smt_disable(enum cpuhp_smt_control ctrlval) { return 0; } |
---|
200 | 245 | #endif |
---|