KVM: SEV: Allow SEV intra-host migration of VM with mirrors
authorPeter Gonda <pgonda@google.com>
Fri, 11 Feb 2022 19:36:34 +0000 (11:36 -0800)
committerPaolo Bonzini <pbonzini@redhat.com>
Fri, 18 Feb 2022 09:43:56 +0000 (04:43 -0500)
commitb2125513dfc0dd0ec5a9605138a3c356592cfb73
treedbc29c40e001addce3e94ac56eee7598a88a0aea
parentdb6e7adf8de9b3b99a9856acb73870cc3a70e3ca
KVM: SEV: Allow SEV intra-host migration of VM with mirrors

For SEV-ES VMs with mirrors to be intra-host migrated they need to be
able to migrate with the mirror. This is due to that fact that all VMSAs
need to be added into the VM with LAUNCH_UPDATE_VMSA before
lAUNCH_FINISH. Allowing migration with mirrors allows users of SEV-ES to
keep the mirror VMs VMSAs during migration.

Adds a list of mirror VMs for the original VM iterate through during its
migration. During the iteration the owner pointers can be updated from
the source to the destination. This fixes the ASID leaking issue which
caused the blocking of migration of VMs with mirrors.

Signed-off-by: Peter Gonda <pgonda@google.com>
Cc: Sean Christopherson <seanjc@google.com>
Cc: Marc Orr <marcorr@google.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: kvm@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Message-Id: <20220211193634.3183388-1-pgonda@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/svm/sev.c
arch/x86/kvm/svm/svm.h
tools/testing/selftests/kvm/x86_64/sev_migrate_tests.c