[PATCH] x86/cpu: Mark CPUs with BTB context tagging as not affected by VMSCAPE

From: Borislav Petkov

Date: Thu Dec 03 2026 - 12:21:20 EST


From: "Borislav Petkov (AMD)" <bp@xxxxxxxxx>

CPUs like Zen6 which tag guest/host BTB contexts are not affected by
VMSCAPE - guest BTB entries are never used by host code (including
host user-space VMMs).

Signed-off-by: Borislav Petkov (AMD) <bp@xxxxxxxxx>
---
arch/x86/kernel/cpu/common.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
index 2533131621fe..a82ca23f6f19 100644
--- a/arch/x86/kernel/cpu/common.c
+++ b/arch/x86/kernel/cpu/common.c
@@ -1617,9 +1617,12 @@ static void __init cpu_set_bug_bits(struct cpuinfo_x86 *c)
/*
* Set the bug only on bare-metal. A nested hypervisor should already be
* deploying IBPB to isolate itself from nested guests.
+ *
+ * A CPU with BTB context tagging is not affected either.
*/
if (cpu_matches(cpu_vuln_blacklist, VMSCAPE) &&
- !boot_cpu_has(X86_FEATURE_HYPERVISOR))
+ !boot_cpu_has(X86_FEATURE_HYPERVISOR) &&
+ !boot_cpu_has(X86_FEATURE_BTB_CTX_ISOLATION))
setup_force_cpu_bug(X86_BUG_VMSCAPE);

if (cpu_matches(cpu_vuln_whitelist, NO_MELTDOWN))
--
2.53.0