mirror of
https://gitlab.com/qemu-project/qemu
synced 2024-10-15 07:22:46 +00:00
tpm_emulator: Avoid double initialization during migration
When resuming after a migration, the backend sends CMD_INIT to the emulator from the startup callback, then it sends the migration state from the vmstate to the emulator, then it sends CMD_INIT again. Skip the first CMD_INIT during a migration to avoid initializing the TPM twice. Signed-off-by: Ross Lagerwall <ross.lagerwall@citrix.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Tested-by: Stefan Berger <stefanb@linux.ibm.com> Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
This commit is contained in:
parent
79dfa177ae
commit
a0bcec0376
|
@ -32,6 +32,7 @@
|
||||||
#include "qemu/sockets.h"
|
#include "qemu/sockets.h"
|
||||||
#include "qemu/lockable.h"
|
#include "qemu/lockable.h"
|
||||||
#include "io/channel-socket.h"
|
#include "io/channel-socket.h"
|
||||||
|
#include "sysemu/runstate.h"
|
||||||
#include "sysemu/tpm_backend.h"
|
#include "sysemu/tpm_backend.h"
|
||||||
#include "sysemu/tpm_util.h"
|
#include "sysemu/tpm_util.h"
|
||||||
#include "tpm_int.h"
|
#include "tpm_int.h"
|
||||||
|
@ -383,6 +384,15 @@ err_exit:
|
||||||
|
|
||||||
static int tpm_emulator_startup_tpm(TPMBackend *tb, size_t buffersize)
|
static int tpm_emulator_startup_tpm(TPMBackend *tb, size_t buffersize)
|
||||||
{
|
{
|
||||||
|
/* TPM startup will be done from post_load hook */
|
||||||
|
if (runstate_check(RUN_STATE_INMIGRATE)) {
|
||||||
|
if (buffersize != 0) {
|
||||||
|
return tpm_emulator_set_buffer_size(tb, buffersize, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
return tpm_emulator_startup_tpm_resume(tb, buffersize, false);
|
return tpm_emulator_startup_tpm_resume(tb, buffersize, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue