[PATCH v3 0/2] KVM: SEV: Add support for the ALLOWED_SEV_FEATURES feature

Kim Phillips
2025-02-07T23:34:28Z

AMD EPYC 5th generation processors have introduced a feature that allows
the hypervisor to control the SEV_FEATURES that are set for, or by, a
guest [1]. ALLOWED_SEV_FEATURES can be used by the hypervisor to enforce
that SEV-ES and SEV-SNP guests cannot enable features that the
hypervisor does not want to be enabled.

Patch 1/2 adds support to detect the feature.

Patch 2/2 configures the ALLOWED_SEV_FEATURES field in the VMCB
according to the features the hypervisor supports.

[1] Section 15.36.20 "Allowed SEV Features", AMD64 Architecture
Programmer's Manual, Pub. 24593 Rev. 3.42 - March 2024:
https://bugzilla.kernel.org/attachment.cgi?id=306250

Based on 6.14-rc1.

v3:
- Assign allowed_sev_features based on user-provided vmsa_features mask (Sean)
- Users now have to explicitly opt-in with a qemu "allowed-sev-features=on" switch.
- Rebased on top of 6.14-rc1 and reworked authorship chain (tglx)

v2: https://lore.kernel.org/lkml/20240822221938.2192109-1-kim.phillips@amd.com/
- Added some SEV_FEATURES require to be explicitly allowed by
ALLOWED_SEV_FEATURES wording (Sean).
- Added Nikunj's Reviewed-by.

v1: https://lore.kernel.org/lkml/20240802015732.3192877-3-kim.phillips@amd.com/

Kim Phillips (1):
KVM: SEV: Configure "ALLOWED_SEV_FEATURES" VMCB Field

Kishon Vijay Abraham I (1):
x86/cpufeatures: Add "Allowed SEV Features" Feature

arch/x86/include/asm/cpufeatures.h | 1 +
arch/x86/include/asm/svm.h | 5 ++++-
arch/x86/kvm/svm/sev.c | 17 +++++++++++++++++
3 files changed, 22 insertions(+), 1 deletion(-)

--
2.43.0