Skip to content

Commit 9073428

Browse files
kimphillamdbp3tk0v
authored andcommitted
x86/sev: Allow IBPB-on-Entry feature for SNP guests
The SEV-SNP IBPB-on-Entry feature does not require a guest-side implementation. It was added in Zen5 h/w, after the first SNP Zen implementation, and thus was not accounted for when the initial set of SNP features were added to the kernel. In its abundant precaution, commit 8c29f01 ("x86/sev: Add SEV-SNP guest feature negotiation support") included SEV_STATUS' IBPB-on-Entry bit as a reserved bit, thereby masking guests from using the feature. Allow guests to make use of IBPB-on-Entry when supported by the hypervisor, as the bit is now architecturally defined and safe to expose. Fixes: 8c29f01 ("x86/sev: Add SEV-SNP guest feature negotiation support") Signed-off-by: Kim Phillips <kim.phillips@amd.com> Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de> Reviewed-by: Nikunj A Dadhania <nikunj@amd.com> Reviewed-by: Tom Lendacky <thomas.lendacky@amd.com> Cc: stable@kernel.org Link: https://patch.msgid.link/20260203222405.4065706-2-kim.phillips@amd.com
1 parent 4ca191c commit 9073428

3 files changed

Lines changed: 6 additions & 1 deletion

File tree

arch/x86/boot/compressed/sev.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,7 @@ bool sev_es_check_ghcb_fault(unsigned long address)
188188
MSR_AMD64_SNP_RESERVED_BIT13 | \
189189
MSR_AMD64_SNP_RESERVED_BIT15 | \
190190
MSR_AMD64_SNP_SECURE_AVIC | \
191+
MSR_AMD64_SNP_RESERVED_BITS19_22 | \
191192
MSR_AMD64_SNP_RESERVED_MASK)
192193

193194
#ifdef CONFIG_AMD_SECURE_AVIC

arch/x86/coco/sev/core.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ static const char * const sev_status_feat_names[] = {
8989
[MSR_AMD64_SNP_VMSA_REG_PROT_BIT] = "VMSARegProt",
9090
[MSR_AMD64_SNP_SMT_PROT_BIT] = "SMTProt",
9191
[MSR_AMD64_SNP_SECURE_AVIC_BIT] = "SecureAVIC",
92+
[MSR_AMD64_SNP_IBPB_ON_ENTRY_BIT] = "IBPBOnEntry",
9293
};
9394

9495
/*

arch/x86/include/asm/msr-index.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -740,7 +740,10 @@
740740
#define MSR_AMD64_SNP_SMT_PROT BIT_ULL(MSR_AMD64_SNP_SMT_PROT_BIT)
741741
#define MSR_AMD64_SNP_SECURE_AVIC_BIT 18
742742
#define MSR_AMD64_SNP_SECURE_AVIC BIT_ULL(MSR_AMD64_SNP_SECURE_AVIC_BIT)
743-
#define MSR_AMD64_SNP_RESV_BIT 19
743+
#define MSR_AMD64_SNP_RESERVED_BITS19_22 GENMASK_ULL(22, 19)
744+
#define MSR_AMD64_SNP_IBPB_ON_ENTRY_BIT 23
745+
#define MSR_AMD64_SNP_IBPB_ON_ENTRY BIT_ULL(MSR_AMD64_SNP_IBPB_ON_ENTRY_BIT)
746+
#define MSR_AMD64_SNP_RESV_BIT 24
744747
#define MSR_AMD64_SNP_RESERVED_MASK GENMASK_ULL(63, MSR_AMD64_SNP_RESV_BIT)
745748
#define MSR_AMD64_SAVIC_CONTROL 0xc0010138
746749
#define MSR_AMD64_SAVIC_EN_BIT 0

0 commit comments

Comments
 (0)