]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: SVM: Call SEV Guest Decommission if ASID binding fails
authorAlper Gun <alpergun@google.com>
Thu, 10 Jun 2021 17:46:04 +0000 (17:46 +0000)
committerPaolo Bonzini <pbonzini@redhat.com>
Fri, 11 Jun 2021 15:52:48 +0000 (11:52 -0400)
commite1d30bb0fe9fdcb501e88db1336ca7d7a4ae0058
treec778e64331b20b6fc52053468c584c51a0a3378a
parent3c2ee4617d88acebed6a70ed4680bfec756af41d
KVM: SVM: Call SEV Guest Decommission if ASID binding fails

Send SEV_CMD_DECOMMISSION command to PSP firmware if ASID binding
fails. If a failure happens after  a successful LAUNCH_START command,
a decommission command should be executed. Otherwise, guest context
will be unfreed inside the AMD SP. After the firmware will not have
memory to allocate more SEV guest context, LAUNCH_START command will
begin to fail with SEV_RET_RESOURCE_LIMIT error.

The existing code calls decommission inside sev_unbind_asid, but it is
not called if a failure happens before guest activation succeeds. If
sev_bind_asid fails, decommission is never called. PSP firmware has a
limit for the number of guests. If sev_asid_binding fails many times,
PSP firmware will not have resources to create another guest context.

Cc: stable@vger.kernel.org
Fixes: 324f894fc441 ("KVM: SVM: Add support for KVM_SEV_LAUNCH_START command")
Reported-by: Peter Gonda <pgonda@google.com>
Signed-off-by: Alper Gun <alpergun@google.com>
Reviewed-by: Marc Orr <marcorr@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Message-Id: <20210610174604.2554090-1-alpergun@google.com>
arch/x86/kvm/svm/sev.c