Re: [PATCH v3 6/7] x86/cpu, kvm: Support AMD Automatic IBRS

From: Pawan Gupta
Date: Wed Nov 30 2022 - 15:37:07 EST


On Tue, Nov 29, 2022 at 05:58:15PM -0600, Kim Phillips wrote:
--- a/arch/x86/kernel/cpu/common.c
+++ b/arch/x86/kernel/cpu/common.c
@@ -1406,6 +1406,14 @@ static void __init cpu_set_bug_bits(struct cpuinfo_x86 *c)
!(ia32_cap & ARCH_CAP_PBRSB_NO))
setup_force_cpu_bug(X86_BUG_EIBRS_PBRSB);

+ /*
+ * AMD's AutoIBRS is equivalent to Intel's eIBRS - use the Intel flag only
+ * after IBRS_ENHANCED bugs such as BUG_EIBRS_PBRSB above have been
+ * determined.
+ */

Minor comment, setting NO_EIBRS_PBRSB in cpu_vuln_whitelist for
non-EIBRS CPUs also (AMD and others) can remove this order dependency.

+ if (cpu_has(c, X86_FEATURE_AUTOIBRS))
+ setup_force_cpu_cap(X86_FEATURE_IBRS_ENHANCED);