Pull in core support for the "mitigations=" cmdline option from Thomas Gleixner via -tip, which we can build on top of when we expose our mitigation state via sysfs.
Showing the changes to include/linux (1 of 8 files). Show all
Unified · Split
| @@ -187,4 +187,28 @@ static inline void cpu_smt_disable(bool force) { } · 186 unmodified lines | ||
| 187 | 187 | static inline void cpu_smt_check_topology(void) { } |
| 188 | 188 | #endif |
| 189 | 189 | |
| 190 | +/* | |
| 191 | + * These are used for a global "mitigations=" cmdline option for toggling | |
| 192 | + * optional CPU mitigations. | |
| 193 | + */ | |
| 194 | +enum cpu_mitigations { | |
| 195 | + CPU_MITIGATIONS_OFF, | |
| 196 | + CPU_MITIGATIONS_AUTO, | |
| 197 | + CPU_MITIGATIONS_AUTO_NOSMT, | |
| 198 | +}; | |
| 199 | + | |
| 200 | +extern enum cpu_mitigations cpu_mitigations; | |
| 201 | + | |
| 202 | +/* mitigations=off */ | |
| 203 | +static inline bool cpu_mitigations_off(void) | |
| 204 | +{ | |
| 205 | + return cpu_mitigations == CPU_MITIGATIONS_OFF; | |
| 206 | +} | |
| 207 | + | |
| 208 | +/* mitigations=auto,nosmt */ | |
| 209 | +static inline bool cpu_mitigations_auto_nosmt(void) | |
| 210 | +{ | |
| 211 | + return cpu_mitigations == CPU_MITIGATIONS_AUTO_NOSMT; | |
| 212 | +} | |
| 213 | + | |
| 190 | 214 | #endif /* _LINUX_CPU_H_ */ |