Merge tag 'x86_sev_for_v6.9_rc1' of git://git.kernel.org/pub/scm/linux/kernel/git...
[sfrench/cifs-2.6.git] / arch / x86 / kernel / cpu / common.c
index c44e6f0c8972b9ee05aab416d92d7bdc742e0adf..e5d7dcaea2093c0d06f2700f93c34f9b398dac98 100644 (file)
@@ -1309,8 +1309,13 @@ static void __init cpu_set_bug_bits(struct cpuinfo_x86 *c)
        /*
         * AMD's AutoIBRS is equivalent to Intel's eIBRS - use the Intel feature
         * flag and protect from vendor-specific bugs via the whitelist.
+        *
+        * Don't use AutoIBRS when SNP is enabled because it degrades host
+        * userspace indirect branch performance.
         */
-       if ((ia32_cap & ARCH_CAP_IBRS_ALL) || cpu_has(c, X86_FEATURE_AUTOIBRS)) {
+       if ((ia32_cap & ARCH_CAP_IBRS_ALL) ||
+           (cpu_has(c, X86_FEATURE_AUTOIBRS) &&
+            !cpu_feature_enabled(X86_FEATURE_SEV_SNP))) {
                setup_force_cpu_cap(X86_FEATURE_IBRS_ENHANCED);
                if (!cpu_matches(cpu_vuln_whitelist, NO_EIBRS_PBRSB) &&
                    !(ia32_cap & ARCH_CAP_PBRSB_NO))