tpm_crb: Avoid backend startup just before shutdown under Xen
authorRoss Lagerwall <ross.lagerwall@citrix.com>
Fri, 26 Aug 2022 14:38:41 +0000 (15:38 +0100)
committerStefan Berger <stefanb@linux.ibm.com>
Fri, 9 Sep 2022 21:55:59 +0000 (17:55 -0400)
commitf0ccce6a95f6ff947040692ef941230918181562
tree3797c96277bc3d44d20ec32c87df669fcc0f59cf
parenta0bcec03761477371ff7c2e80dc07fff14222d92
tpm_crb: Avoid backend startup just before shutdown under Xen

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>
hw/tpm/tpm_crb.c