History

KVM: x86: Support KVM VMs sharing SEV context

Add a capability for userspace to mirror SEV encryption context from one vm to another. On our side, this is intended to support a Migration Helper vCPU, but it can also be used generically to support other in-guest workloads scheduled by the host. The intention is for the primary guest and the mirror to have nearly identical memslots. The primary benefits of this are that: 1) The VMs do not share KVM contexts (think APIC/MSRs/etc), so they can't accidentally clobber each other. 2) The VMs can have different memory-views, which is necessary for post-copy migration (the migration vCPUs on the target need to read and write to pages, when the primary guest would VMEXIT). This does not change the threat model for AMD SEV. Any memory involved is still owned by the primary guest and its initial state is still attested to through the normal SEV_LAUNCH_* flows. If userspace wanted to circumvent SEV, they could achieve the same effect by simply attaching a vCPU to the primary VM. This patch deliberately leaves userspace in charge of the memslots for the mirror, as it already has the power to mess with them in the primary guest. This patch does not support SEV-ES (much less SNP), as it does not handle handing off attested VMSAs to the mirror. For additional context, we need a Migration Helper because SEV PSP migration is far too slow for our live migration on its own. Using an in-guest migrator lets us speed this up significantly.

Nathan Tempelman committed 5 years ago

Commit 54526d11 parent ee695f29 files · +126 −2Browse files

Showing the changes to include/uapi (1 of 9 files). Show all

Unified · Split

include/uapi/linux/kvm.h+1−0
@@ -1080,6 +1080,7 @@ struct kvm_ppc_resize_hpt { · 1079 unmodified lines
1080#define KVM_CAP_PPC_DAWR1 1941080#define KVM_CAP_PPC_DAWR1 194
1081#define KVM_CAP_SET_GUEST_DEBUG2 1951081#define KVM_CAP_SET_GUEST_DEBUG2 195
1082#define KVM_CAP_SGX_ATTRIBUTE 1961082#define KVM_CAP_SGX_ATTRIBUTE 196
1083#define KVM_CAP_VM_COPY_ENC_CONTEXT_FROM 197
1083 1084
1084#ifdef KVM_CAP_IRQ_ROUTING1085#ifdef KVM_CAP_IRQ_ROUTING
1085 1086