qemu/tpm_emulator-Avoid-double-initialization-during-migr.patch

59 lines
1.9 KiB
Diff
Raw Normal View History

QEMU update to version 6.2.0-92: - s390x/sclp: Simplify get_sclp_device() - target/ppc: Remove msr_pr macro - docs/system/target-arm: Re-alphabetize board list - migration: Extend query-migrate to provide dirty page limit info - migration: Implement dirty-limit convergence algo - migration: Put the detection logic before auto-converge checking - migration: Refactor auto-converge capability logic - migration: Introduce dirty-limit capability - qapi/migration: Introduce vcpu-dirty-limit parameters - qapi/migration: Introduce x-vcpu-dirty-limit-period parameter - Change the value of no_ged from true to false - Allow UNIX socket option for VNC websocket - tpm_emulator: Avoid double initialization during - chardev/char-socket: Update AF_UNIX for Windows - KVM: dirty ring: add missing memory barrier - i386: reset KVM nested state upon CPU reset - esp: Handle CMD_BUSRESET by resetting the SCSI bus - dbus-vmstate: Restrict error checks to registered proxies in dbus_get_proxies - vfio/pci: Add Ascend310b scend910b support - target/i386: Export RFDS bit to guests - target/i386: Add new CPU model SierraForest - target/i386: Introduce Icelake-Server-v7 to enable TSX - hw/virtio: handle un-configured shutdown in virtio-pci - target/s390x: display deprecation status in '-cpu help' - target/i386: display deprecation status in '-cpu help' - pc-bios/s390-ccw: Fix booting with logical block size < physical block size Signed-off-by: Jiabo Feng <fengjiabo1@huawei.com> (cherry picked from commit 90057151bbb0e2253cdd9ff86a81736e6efc5561)
2024-06-13 14:32:49 +08:00
From 65582eea0238d4b833934281fc6580a28cc82694 Mon Sep 17 00:00:00 2001
From: tangbinzy <tangbin_yewu@cmss.chinamobile.com>
Date: Wed, 15 May 2024 01:33:59 +0000
Subject: [PATCH] tpm_emulator: Avoid double initialization during migration
mainline inclusion commit a0bcec03761477371ff7c2e80dc07fff14222d92 category:
bugfix
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---------------------------------------------------------------
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>
Signed-off-by: tangbinzy <tangbin_yewu@cmss.chinamobile.com>
---
backends/tpm/tpm_emulator.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/backends/tpm/tpm_emulator.c b/backends/tpm/tpm_emulator.c
index 87d061e9bb..9b50c5b3e2 100644
--- a/backends/tpm/tpm_emulator.c
+++ b/backends/tpm/tpm_emulator.c
@@ -32,6 +32,7 @@
#include "qemu/sockets.h"
#include "qemu/lockable.h"
#include "io/channel-socket.h"
+#include "sysemu/runstate.h"
#include "sysemu/tpm_backend.h"
#include "sysemu/tpm_util.h"
#include "tpm_int.h"
@@ -383,6 +384,15 @@ err_exit:
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);
}
--
2.27.0