summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph Muellner <christoph.muellner@theobroma-systems.com>2018-05-15 23:50:27 +0200
committerChristoph Muellner <christoph.muellner@theobroma-systems.com>2018-05-29 18:12:19 +0200
commit82496fcaf250cd4f56609db644af8a32372eebb6 (patch)
treec77fa52a05a46d076fc72dccfa54157c20a0e355
parente9593c62a1696f6d5112006d35ef02b088aa65df (diff)
arm64: Provide spectre v2 status via generic CPU vulnerability folder.
This patch enables GENERIC_CPU_VULNERABILITIES on arm64 and sets the spectre v2 status depending on the retpoline mitigation level. Signed-off-by: Christoph Muellner <christoph.muellner@theobroma-systems.com>
-rw-r--r--arch/arm64/Kconfig1
-rw-r--r--arch/arm64/kernel/cpu_errata.c12
2 files changed, 13 insertions, 0 deletions
diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index 7df0bafa6a6d..e888623baded 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -68,6 +68,7 @@ config ARM64
select GENERIC_CLOCKEVENTS
select GENERIC_CLOCKEVENTS_BROADCAST
select GENERIC_CPU_AUTOPROBE
+ select GENERIC_CPU_VULNERABILITIES
select GENERIC_EARLY_IOREMAP
select GENERIC_IDLE_POLL_SETUP
select GENERIC_IRQ_PROBE
diff --git a/arch/arm64/kernel/cpu_errata.c b/arch/arm64/kernel/cpu_errata.c
index c1e2ee0144f6..4eb57ddf72ca 100644
--- a/arch/arm64/kernel/cpu_errata.c
+++ b/arch/arm64/kernel/cpu_errata.c
@@ -281,6 +281,18 @@ static inline const char *spectre_v2_module_string(void)
return spectre_v2_bad_module ? " - vulnerable module loaded" : "";
}
+#ifdef CONFIG_SYSFS
+
+ssize_t cpu_show_spectre_v2(struct device *dev,
+ struct device_attribute *attr,
+ char *buf)
+{
+ return sprintf(buf, "%s%s\n", spectre_v2_strings[spectre_v2_enabled],
+ spectre_v2_module_string());
+}
+
+#endif
+
static int
enable_retpoline(void *data)
{