From 99460611802f2b9e1d40d924bfd022c39bedb7b4 Mon Sep 17 00:00:00 2001 From: Christoph Muellner Date: Tue, 15 May 2018 23:50:27 +0200 Subject: 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 --- arch/arm64/Kconfig | 1 + arch/arm64/kernel/cpu_errata.c | 12 ++++++++++++ 2 files changed, 13 insertions(+) diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index 66de4deb4a69..97eb626b032d 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 ed32e1f7e67a..a76b839c0354 100644 --- a/arch/arm64/kernel/cpu_errata.c +++ b/arch/arm64/kernel/cpu_errata.c @@ -370,6 +370,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) { -- cgit v1.2.3