diff options
author | Christoph Muellner <christoph.muellner@theobroma-systems.com> | 2018-05-15 23:50:27 +0200 |
---|---|---|
committer | Christoph Muellner <christoph.muellner@theobroma-systems.com> | 2018-05-16 12:04:01 +0200 |
commit | 99460611802f2b9e1d40d924bfd022c39bedb7b4 (patch) | |
tree | f966525878a4d0d054c309795d526895fb42d777 | |
parent | 477b9791f15ad66ac25e308530bcc6a2556da967 (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/Kconfig | 1 | ||||
-rw-r--r-- | arch/arm64/kernel/cpu_errata.c | 12 |
2 files changed, 13 insertions, 0 deletions
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) { |