KVM: SVM: Serialize access to the SEV ASID bitmap
authorTom Lendacky <thomas.lendacky@amd.com>
Thu, 3 Oct 2019 21:17:43 +0000 (21:17 +0000)
committerPaolo Bonzini <pbonzini@redhat.com>
Tue, 22 Oct 2019 11:34:06 +0000 (13:34 +0200)
commite3b9a9e147dbe1a8fb9d8398a2faa47d8a6f50de
treead89951488764d965ac69175b4b4a6bf5160cc3b
parent20baa8e515a55dc7467d9584cc458b5700c0a3aa
KVM: SVM: Serialize access to the SEV ASID bitmap

The SEV ASID bitmap currently is not protected against parallel SEV guest
startups. This can result in an SEV guest failing to start because another
SEV guest could have been assigned the same ASID value. Use a mutex to
serialize access to the SEV ASID bitmap.

Fixes: 1654efcbc431 ("KVM: SVM: Add KVM_SEV_INIT command")
Tested-by: David Rientjes <rientjes@google.com>
Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/svm.c