aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorSean Christopherson <seanjc@google.com>2024-11-27 17:33:54 -0800
committerSean Christopherson <seanjc@google.com>2024-12-18 14:19:50 -0800
commit8d862c270bf14cb3e63ca84a9a51be77c9fa4e2a (patch)
tree5b6f9ee25bcc0f380c7a32b5e851f33f09ff7b51
parentKVM: x86: Handle kernel- and KVM-defined CPUID words in a single helper (diff)
downloadwireguard-linux-8d862c270bf14cb3e63ca84a9a51be77c9fa4e2a.tar.xz
wireguard-linux-8d862c270bf14cb3e63ca84a9a51be77c9fa4e2a.zip
KVM: x86: #undef SPEC_CTRL_SSBD in cpuid.c to avoid macro collisions
Undefine SPEC_CTRL_SSBD, which is #defined by msr-index.h to represent the enable flag in MSR_IA32_SPEC_CTRL, to avoid issues with the macro being unpacked into its raw value when passed to KVM's F() macro. This will allow using multiple layers of macros in F() and friends, e.g. to harden against incorrect usage of F(). No functional change intended (cpuid.c doesn't consume SPEC_CTRL_SSBD). Link: https://lore.kernel.org/r/20241128013424.4096668-28-seanjc@google.com Signed-off-by: Sean Christopherson <seanjc@google.com>
-rw-r--r--arch/x86/kvm/cpuid.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/arch/x86/kvm/cpuid.c b/arch/x86/kvm/cpuid.c
index 2cd06155684e..cebb7314b9be 100644
--- a/arch/x86/kvm/cpuid.c
+++ b/arch/x86/kvm/cpuid.c
@@ -665,6 +665,12 @@ static __always_inline void kvm_cpu_cap_init(u32 leaf, u32 mask)
feature_bit(name); \
})
+/*
+ * Undefine the MSR bit macro to avoid token concatenation issues when
+ * processing X86_FEATURE_SPEC_CTRL_SSBD.
+ */
+#undef SPEC_CTRL_SSBD
+
void kvm_set_cpu_caps(void)
{
memset(kvm_cpu_caps, 0, sizeof(kvm_cpu_caps));