File kvm-sev-add-support-for-sev-intra-host-migration of Package linux-glibc-devel.29113

From: Peter Gonda <pgonda@google.com>
Date: Thu, 21 Oct 2021 10:43:00 -0700
Subject: KVM: SEV: Add support for SEV intra host migration
Git-commit: b56639318bb2be66aceba92836279714488709b4
Patch-mainline: v5.16-rc1
References: jsc#SLE-19924

For SEV to work with intra host migration, contents of the SEV info struct
such as the ASID (used to index the encryption key in the AMD SP) and
the list of memory regions need to be transferred to the target VM.
This change adds a commands for a target VMM to get a source SEV VM's sev
info.

Signed-off-by: Peter Gonda <pgonda@google.com>
Suggested-by: Sean Christopherson <seanjc@google.com>
Reviewed-by: Marc Orr <marcorr@google.com>
Cc: Marc Orr <marcorr@google.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Sean Christopherson <seanjc@google.com>
Cc: David Rientjes <rientjes@google.com>
Cc: Dr. David Alan Gilbert <dgilbert@redhat.com>
Cc: Brijesh Singh <brijesh.singh@amd.com>
Cc: Tom Lendacky <thomas.lendacky@amd.com>
Cc: Vitaly Kuznetsov <vkuznets@redhat.com>
Cc: Wanpeng Li <wanpengli@tencent.com>
Cc: Jim Mattson <jmattson@google.com>
Cc: Joerg Roedel <joro@8bytes.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: kvm@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Message-Id: <20211021174303.385706-3-pgonda@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Acked-by: Joerg Roedel <jroedel@suse.de>
---
 Documentation/virt/kvm/api.rst  |   14 +++
 arch/x86/include/asm/kvm_host.h |    1 
 arch/x86/kvm/svm/sev.c          |  152 ++++++++++++++++++++++++++++++++++++++++
 arch/x86/kvm/svm/svm.c          |    1 
 arch/x86/kvm/svm/svm.h          |    2 
 arch/x86/kvm/x86.c              |    6 +
 include/uapi/linux/kvm.h        |    1 
 7 files changed, 177 insertions(+)

--- a/include/linux/kvm.h
+++ b/include/linux/kvm.h
@@ -1112,6 +1112,7 @@ struct kvm_ppc_resize_hpt {
 #define KVM_CAP_BINARY_STATS_FD 203
 #define KVM_CAP_EXIT_ON_EMULATION_FAILURE 204
 #define KVM_CAP_ARM_MTE 205
+#define KVM_CAP_VM_MOVE_ENC_CONTEXT_FROM 206
 
 #ifdef KVM_CAP_IRQ_ROUTING
 
openSUSE Build Service is sponsored by