KVM: SEV: Add KVM_SEV_SNP_LAUNCH_UPDATE command
authorBrijesh Singh <brijesh.singh@amd.com>
Wed, 1 May 2024 08:51:56 +0000 (03:51 -0500)
committerPaolo Bonzini <pbonzini@redhat.com>
Sun, 12 May 2024 08:09:29 +0000 (04:09 -0400)
commitdee5a47cc7a45287ec1137edb745bb4dffbe85f6
tree596d79d8d49bf723537c855cd50e4753a723b18c
parent136d8bc931c84fbe4c70c2d6e0a4d20a2aa90505
KVM: SEV: Add KVM_SEV_SNP_LAUNCH_UPDATE command

A key aspect of a launching an SNP guest is initializing it with a
known/measured payload which is then encrypted into guest memory as
pre-validated private pages and then measured into the cryptographic
launch context created with KVM_SEV_SNP_LAUNCH_START so that the guest
can attest itself after booting.

Since all private pages are provided by guest_memfd, make use of the
kvm_gmem_populate() interface to handle this. The general flow is that
guest_memfd will handle allocating the pages associated with the GPA
ranges being initialized by each particular call of
KVM_SEV_SNP_LAUNCH_UPDATE, copying data from userspace into those pages,
and then the post_populate callback will do the work of setting the
RMP entries for these pages to private and issuing the SNP firmware
calls to encrypt/measure them.

For more information see the SEV-SNP specification.

Signed-off-by: Brijesh Singh <brijesh.singh@amd.com>
Co-developed-by: Michael Roth <michael.roth@amd.com>
Signed-off-by: Michael Roth <michael.roth@amd.com>
Signed-off-by: Ashish Kalra <ashish.kalra@amd.com>
Message-ID: <20240501085210.2213060-7-michael.roth@amd.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Documentation/virt/kvm/x86/amd-memory-encryption.rst
arch/x86/include/uapi/asm/kvm.h
arch/x86/kvm/svm/sev.c