Skip to content

KVM: SEV: Add support for the ALLOWED_SEV_FEATURES feature

Kim Phillips kvm linux-coco lkml 5 versions – Applied

Status from this message: Applied to kvm-x86 svm, thanks!

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v5 Latest2 patches 2 repliesApplied
  2. v42 patches 6 repliesSuperseded
  3. v32 patches 10 repliesSuperseded
Earlier versions · 2
VersionPostedPatchesRepliesStatus
v22 patches2 repliesSuperseded
v12 patches7 repliesSuperseded

Changes in v5 from the cover letter

- Add reviews-by
- Add the two new vmcb fields to dump_vmcb() output (Pankaj)
- Address comment by Tom and put single assignment in sev_es_init_vmcb

Patches in v5 Applied

#Subject and filesSizeRepliesApplied
1/2x86/cpufeatures: Add "Allowed SEV Features" Featurearch/x86/include/asm/cpufeatures.h+1 -00 replies
2/2KVM: SEV: Configure "ALLOWED_SEV_FEATURES" VMCB Fieldarch/x86/include/asm/svm.h arch/x86/kvm/svm/sev.c arch/x86/kvm/svm/svm.c+13 -11 reply

Reviews trailers per patch

All 2 patches have a Reviewed-by or Acked-by.

PatchTom LendackyPankaj GuptaBorislav Petkov (AMD)
1/2R-b R-b A-b
2/2R-b R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 3 reviewers.

Read the v5 thread

Cover letter [PATCH v5 0/2] KVM: SEV: Add support for the ALLOWED_SEV_FEATURES feature

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.

Tested SNP by setting random feature bits to the sev_features assignment in wakeup_cpu_via_vmgexit() (but not its ghcb_set_rax).

Tested SEV-ES by manipulating the save->sev_features assignment in sev_es_sync_vmsa(). Note that SEV-ES "allows" operation only works on features available in SEV-ES, i.e., it ignores SNP-only features. Zen5 SEV-ES features are DEBUG_SWAP, PREVENT_HOST_IBS, VMGEXIT_PARAMETER, PMC_VIRTUALIZATION, and IBS_VIRTUALIZATION.

Based on x86-kvm/next.

[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

v5:
- Add reviews-by
- Add the two new vmcb fields to dump_vmcb() output (Pankaj)
- Address comment by Tom and put single assignment in sev_es_init_vmcb

v4: https://lore.kernel.org/kvm/[email protected]/
- Revert the user-opt in (Sean, sorry for the misunderstanding)
- this basically undoes v3 uAPI changes and makes the feature always-on, if available
- rebased on top of x86-kvm/next

v3: https://lore.kernel.org/kvm/[email protected]/
- 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/[email protected]/
- 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/[email protected]/

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         | 7 ++++++-
 arch/x86/kvm/svm/sev.c             | 5 +++++
 arch/x86/kvm/svm/svm.c             | 2 ++
 4 files changed, 14 insertions(+), 1 deletion(-)

base-commit: c9ea48bb6ee6b28bbc956c1e8af98044618fed5e

Signature · 1 line
2.43.0