summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorWill Deacon <will.deacon@arm.com>2019-04-26 15:32:20 +0300
committerWill Deacon <will.deacon@arm.com>2019-04-26 15:32:20 +0300
commitcbafee55b5a0ec47baac622bce6b4d19afe45576 (patch)
tree714c9c15ac2c507e7e3789bd20d95c62aa11ae99 /include
parent79a3aaa7b82e3106be97842dedfd8429248896e6 (diff)
parent0336e04a6520bdaefdb0769d2a70084fa52e81ed (diff)
downloadlinux-cbafee55b5a0ec47baac622bce6b4d19afe45576.tar.xz
Merge branch 'core/speculation' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip into for-next/mitigations
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.
Diffstat (limited to 'include')
-rw-r--r--include/linux/cpu.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/include/linux/cpu.h b/include/linux/cpu.h
index 5041357d0297..2d9c6f4b78f5 100644
--- a/include/linux/cpu.h
+++ b/include/linux/cpu.h
@@ -187,4 +187,28 @@ static inline void cpu_smt_disable(bool force) { }
static inline void cpu_smt_check_topology(void) { }
#endif
+/*
+ * These are used for a global "mitigations=" cmdline option for toggling
+ * optional CPU mitigations.
+ */
+enum cpu_mitigations {
+ CPU_MITIGATIONS_OFF,
+ CPU_MITIGATIONS_AUTO,
+ CPU_MITIGATIONS_AUTO_NOSMT,
+};
+
+extern enum cpu_mitigations cpu_mitigations;
+
+/* mitigations=off */
+static inline bool cpu_mitigations_off(void)
+{
+ return cpu_mitigations == CPU_MITIGATIONS_OFF;
+}
+
+/* mitigations=auto,nosmt */
+static inline bool cpu_mitigations_auto_nosmt(void)
+{
+ return cpu_mitigations == CPU_MITIGATIONS_AUTO_NOSMT;
+}
+
#endif /* _LINUX_CPU_H_ */