- target/i386: Introduce SapphireRapids-v3 to add missing features - qtest/fuzz-lsi53c895a-test: set guest RAM to 2G - hw/net/lan9118: Signal TSFL_INT flag when TX FIFO reaches specified level - target/arm: Fix alignment for VLD4.32 - hw/microblaze: pass random seed to fdt - tests/qtest: npcm7xx-emc-test: Skip checking MAC - tests: mark io-command test as skipped if socat is missing - tests: unit: add NULL-pointer check - tests: test-qga: close socket on failure to connect - vdpa:block device capacity expansion online support vdpa block device update capacity. - virtio-net: Ensure queue index fits with RSS(CVE-2024-6505) - nbd/server: CVE-2024-7409: Avoid use-after-free when closing server - ppc/vof: Fix unaligned FDT property access - vvfat: Fix reading files with non-continuous clusters - vvfat: Fix bug in writing to middle of file - savevm: Fix load_snapshot error path crash - hw/dma/xilinx_axidma: Use semicolon at end of statement, not comma - hw/remote/message.c: Don't directly invoke DeviceClass:reset - crypto/tlscredspsk: Free username on finalize - hw/display/vhost-user-gpu.c: fix vhost_user_gpu_chr_read() - virtio: remove virtio_tswap16s() call in vring_packed_event_read() - char-stdio: Restore blocking mode of stdout on exit - hw/ppc: spapr: Use qemu_vfree() to free spapr->htab - smbios: sanitize type from external type before checking have_fields_bitmap - spapr_pci: fix leak in spapr_phb_vfio_get_loc_code - KVM: use store-release to mark dirty pages as harvested - monitor/hmp: print trace as option in help for log command - tpm_crb: Avoid backend startup just before shutdown under Xen - crypto/block-luks: make range overlap check more readable - spapr: Free stdout path - target/rx: Use target_ulong for address in LI - virtio-pci: Fix the use of an uninitialized irqfd - rtl8139: Fix behaviour for old kernels. - virtio-rng: block max-bytes=0 MIME-Version: 1.0 - hw/audio/es1370: Clean up comment - vhost-user-server: do not set memory fd non-blocking - ui: reject extended clipboard message if not activated - virtio-net: Fix vhost virtqueue notifiers for RSS - hw/misc/applesmc: Fix memory leak in reset() handler Signed-off-by: Jiabo Feng <fengjiabo1@huawei.com> (cherry picked from commit db7a5d9a7239db307c8c1454fab5f8a92fd486b8)
59 lines
2.0 KiB
Diff
59 lines
2.0 KiB
Diff
From 5cafaebb7f31713b826a678e79eef976beb8caf6 Mon Sep 17 00:00:00 2001
|
|
From: tangbinzy <tangbin_yewu@cmss.chinamobile.com>
|
|
Date: Tue, 3 Sep 2024 01:56:25 +0000
|
|
Subject: [PATCH] tpm_crb: Avoid backend startup just before shutdown under Xen
|
|
mainline inclusion commit f0ccce6a95f6ff947040692ef941230918181562 category:
|
|
bugfix
|
|
|
|
---------------------------------------------------------------
|
|
|
|
When running under Xen and the guest reboots, it boots into a new domain
|
|
with a new QEMU process (and a new swtpm process if using the emulator
|
|
backend). The existing reset function is triggered just before the old
|
|
QEMU process exists which causes QEMU to startup the TPM backend and
|
|
then immediately shut it down. This is probably harmless but when using
|
|
the emulated backend, it wastes CPU and IO time reloading state, etc.
|
|
|
|
Fix this by calling the reset function directly from realize() when
|
|
running under Xen. During a reboot, this will be called by the QEMU
|
|
process for the new domain.
|
|
|
|
Signed-off-by: Ross Lagerwall <ross.lagerwall@citrix.com>
|
|
Reviewed-by: Stefan Berger <stefanb@linux.ibm.com>
|
|
Message-id: 20220826143841.1515326-1-ross.lagerwall@citrix.com
|
|
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
|
|
|
|
Signed-off-by: tangbinzy <tangbin_yewu@cmss.chinamobile.com>
|
|
---
|
|
hw/tpm/tpm_crb.c | 7 ++++++-
|
|
1 file changed, 6 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/hw/tpm/tpm_crb.c b/hw/tpm/tpm_crb.c
|
|
index c05972736a..ed89ab4afe 100644
|
|
--- a/hw/tpm/tpm_crb.c
|
|
+++ b/hw/tpm/tpm_crb.c
|
|
@@ -25,6 +25,7 @@
|
|
#include "sysemu/tpm_backend.h"
|
|
#include "sysemu/tpm_util.h"
|
|
#include "sysemu/reset.h"
|
|
+#include "sysemu/xen.h"
|
|
#include "tpm_prop.h"
|
|
#include "tpm_ppi.h"
|
|
#include "trace.h"
|
|
@@ -307,7 +308,11 @@ static void tpm_crb_realize(DeviceState *dev, Error **errp)
|
|
TPM_PPI_ADDR_BASE, OBJECT(s));
|
|
}
|
|
|
|
- qemu_register_reset(tpm_crb_reset, dev);
|
|
+ if (xen_enabled()) {
|
|
+ tpm_crb_reset(dev);
|
|
+ } else {
|
|
+ qemu_register_reset(tpm_crb_reset, dev);
|
|
+ }
|
|
}
|
|
|
|
static void tpm_crb_class_init(ObjectClass *klass, void *data)
|
|
--
|
|
2.41.0.windows.1
|
|
|