]> git.ipfire.org Git - thirdparty/kernel/stable.git/blobdiff - arch/x86/kernel/cpu/bugs.c
x86/speculation/mds: Add mitigation mode VMWERV
[thirdparty/kernel/stable.git] / arch / x86 / kernel / cpu / bugs.c
index 50b7d2a980e8182af37cc59322b151d62d1b4173..053d71a3b9cced4c771d83f17942ae0b1fdeb45f 100644 (file)
@@ -222,7 +222,8 @@ static enum mds_mitigations mds_mitigation __ro_after_init = MDS_MITIGATION_FULL
 
 static const char * const mds_strings[] = {
        [MDS_MITIGATION_OFF]    = "Vulnerable",
-       [MDS_MITIGATION_FULL]   = "Mitigation: Clear CPU buffers"
+       [MDS_MITIGATION_FULL]   = "Mitigation: Clear CPU buffers",
+       [MDS_MITIGATION_VMWERV] = "Vulnerable: Clear CPU buffers attempted, no microcode",
 };
 
 static void __init mds_select_mitigation(void)
@@ -233,10 +234,9 @@ static void __init mds_select_mitigation(void)
        }
 
        if (mds_mitigation == MDS_MITIGATION_FULL) {
-               if (boot_cpu_has(X86_FEATURE_MD_CLEAR))
-                       static_branch_enable(&mds_user_clear);
-               else
-                       mds_mitigation = MDS_MITIGATION_OFF;
+               if (!boot_cpu_has(X86_FEATURE_MD_CLEAR))
+                       mds_mitigation = MDS_MITIGATION_VMWERV;
+               static_branch_enable(&mds_user_clear);
        }
        pr_info("%s\n", mds_strings[mds_mitigation]);
 }
@@ -690,8 +690,14 @@ void arch_smt_update(void)
                break;
        }
 
-       if (mds_mitigation == MDS_MITIGATION_FULL)
+       switch (mds_mitigation) {
+       case MDS_MITIGATION_FULL:
+       case MDS_MITIGATION_VMWERV:
                update_mds_branch_idle();
+               break;
+       case MDS_MITIGATION_OFF:
+               break;
+       }
 
        mutex_unlock(&spec_ctrl_mutex);
 }