]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu: Set SPAPR TPM default to 2.0 and prevent 1.2 choice
authorStefan Berger <stefanb@linux.ibm.com>
Thu, 9 Jul 2020 20:46:19 +0000 (16:46 -0400)
committerPeter Krempa <pkrempa@redhat.com>
Wed, 15 Jul 2020 06:23:28 +0000 (08:23 +0200)
The firmware (SLOF) on QEMU for ppc64 does not support TPM 1.2, so
prevent the choice of TPM 1.2 when the SPAPR device model is chosen
and use a default of '2.0' (TPM 2) for the backend.

This patch addresses BZ 1781913: https://bugzilla.redhat.com/show_bug.cgi?id=1781913

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
src/qemu/qemu_domain.c
src/qemu/qemu_validate.c

index 44e832f57e765c72131d4f3f140cb313b732e5ad..21f82625c011f4b37d25ded32eac0836aaea7cd7 100644 (file)
@@ -4115,8 +4115,12 @@ qemuDomainDefTPMsPostParse(virDomainDefPtr def)
         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->version == VIR_DOMAIN_TPM_VERSION_DEFAULT) {
+            if (tpm->model == VIR_DOMAIN_TPM_MODEL_SPAPR)
+                tpm->version = VIR_DOMAIN_TPM_VERSION_2_0;
+            else
+                tpm->version = VIR_DOMAIN_TPM_VERSION_1_2;
+        }
 
         if (tpm->model == VIR_DOMAIN_TPM_MODEL_SPAPR_PROXY) {
             if (proxyTPM) {
index d130b52bf29237733967ca7a78bb0f3671891d82..488f258d0027768a21c45a619023253a178347f1 100644 (file)
@@ -3654,6 +3654,12 @@ qemuValidateDomainDeviceDefTPM(virDomainTPMDef *tpm,
                            virDomainTPMModelTypeToString(tpm->model));
             return -1;
         }
+        /* TPM 1.2 + SPAPR do not work with any 'type' (backend) */
+        if (tpm->model == VIR_DOMAIN_TPM_MODEL_SPAPR) {
+            virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+                           _("TPM 1.2 is not supported with the SPAPR device model"));
+            return -1;
+        }
         break;
     case VIR_DOMAIN_TPM_VERSION_2_0:
     case VIR_DOMAIN_TPM_VERSION_DEFAULT: