x86/speculation/mds: Add 'mitigations=' support for MDS
authorJosh Poimboeuf <jpoimboe@redhat.com>
Wed, 17 Apr 2019 21:39:02 +0000 (16:39 -0500)
committerBen Hutchings <ben@decadent.org.uk>
Wed, 22 May 2019 22:15:26 +0000 (23:15 +0100)
commit 5c14068f87d04adc73ba3f41c2a303d3c3d1fa12 upstream.

Add MDS to the new 'mitigations=' cmdline option.

Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
[bwh: Backported to 3.16:
 - Drop the auto,nosmt option, which we can't support
 - Adjust filenames, context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Documentation/kernel-parameters.txt
arch/x86/kernel/cpu/bugs.c

index 434daddd64dbdc44d8aee3d3ae6e34a6e88d0b75..67a21b2ef3e4fbe3f0d313fc732c7418d53e508b 100644 (file)
@@ -1920,6 +1920,7 @@ bytes respectively. Such letter suffixes can also be entirely omitted.
                                               nospectre_v2 [X86]
                                               spectre_v2_user=off [X86]
                                               spec_store_bypass_disable=off [X86]
+                                              mds=off [X86]
 
                        auto (default)
                                Mitigate all CPU vulnerabilities, but leave SMT
index b08b7730836a59ea161572161308b9984a340834..967c01562441bcc84fd92e4cb5616b311ad5eb9c 100644 (file)
@@ -287,7 +287,7 @@ static const char * const mds_strings[] = {
 
 static void __init mds_select_mitigation(void)
 {
-       if (!boot_cpu_has_bug(X86_BUG_MDS)) {
+       if (!boot_cpu_has_bug(X86_BUG_MDS) || cpu_mitigations_off()) {
                mds_mitigation = MDS_MITIGATION_OFF;
                return;
        }