From: Stefan Berger Date: Thu, 9 Jul 2020 20:46:18 +0000 (-0400) Subject: qemu: Move setting of TPM default to post parse function X-Git-Tag: v6.6.0-rc1~110 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5ab5239d89c80e6d2837ca459826d7cb92d2be4a;p=thirdparty%2Flibvirt.git qemu: Move setting of TPM default to post parse function Move setting the TPM default version out of the validation function into the post parse function. Signed-off-by: Stefan Berger Reviewed-by: Peter Krempa Reviewed-by: Daniel Henrique Barboza Reviewed-by: Marc-André Lureau --- diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 10d2033db1..44e832f57e 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -4111,12 +4111,13 @@ qemuDomainDefTPMsPostParse(virDomainDefPtr def) virDomainTPMDefPtr regularTPM = NULL; size_t i; - if (def->ntpms < 2) - return 0; - for (i = 0; i < def->ntpms; i++) { virDomainTPMDefPtr tpm = def->tpms[i]; + /* TPM 1.2 and 2 are not compatible, so we choose a specific version here */ + if (tpm->version == VIR_DOMAIN_TPM_VERSION_DEFAULT) + tpm->version = VIR_DOMAIN_TPM_VERSION_1_2; + if (tpm->model == VIR_DOMAIN_TPM_MODEL_SPAPR_PROXY) { if (proxyTPM) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c index bd7590a00a..d130b52bf2 100644 --- a/src/qemu/qemu_validate.c +++ b/src/qemu/qemu_validate.c @@ -3644,10 +3644,6 @@ qemuValidateDomainDeviceDefTPM(virDomainTPMDef *tpm, { virQEMUCapsFlags flag; - /* TPM 1.2 and 2 are not compatible, so we choose a specific version here */ - if (tpm->version == VIR_DOMAIN_TPM_VERSION_DEFAULT) - tpm->version = VIR_DOMAIN_TPM_VERSION_1_2; - switch (tpm->version) { case VIR_DOMAIN_TPM_VERSION_1_2: /* TPM 1.2 + CRB do not work */