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-23 13:00:58 +0200
commit2c78207c47daaaa3a05f1f5fef9927140d56f0c0 (patch)
treef09b0714cf4f2ec6e04afb48597a764c69b3b1f6
parenta7c5501f677041edd955a7f76f2cd695f2238f8e (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 c8c9f16e226f..b696de875d36 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 d9bc01ef8ed3..14ad3a45b601 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 void
enable_retpoline(const struct arm64_cpu_capabilities *entry)
{