]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu: Reject TPM 1.2 for ARM virt guests
authorAndrea Bolognani <abologna@redhat.com>
Fri, 25 Jun 2021 13:33:33 +0000 (15:33 +0200)
committerAndrea Bolognani <abologna@redhat.com>
Thu, 1 Jul 2021 14:15:05 +0000 (16:15 +0200)
We already reject TPM 1.2 in a number of scenarios; let's add
ARM virt guests to the list.

https://bugzilla.redhat.com/show_bug.cgi?id=1970310

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Tested-by: Liu Yiding <liuyd.fnst@fujitsu.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
src/qemu/qemu_validate.c
tests/qemuxml2argvdata/aarch64-tpm-wrong-model.err [new file with mode: 0644]
tests/qemuxml2argvdata/aarch64-tpm-wrong-model.xml [new file with mode: 0644]
tests/qemuxml2argvtest.c

index 382473d03b7abf84fc0beeee36d30e138ae01a5c..b133ce3cd6801f37df059b4100f594dbd4663116 100644 (file)
@@ -4517,6 +4517,12 @@ qemuValidateDomainDeviceDefTPM(virDomainTPMDef *tpm,
                            _("TPM 1.2 is not supported with the SPAPR device model"));
             return -1;
         }
+        /* TPM 1.2 + ARM does not work */
+        if (qemuDomainIsARMVirt(def)) {
+            virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+                           _("TPM 1.2 is not supported on ARM"));
+            return -1;
+        }
         break;
     case VIR_DOMAIN_TPM_VERSION_2_0:
     case VIR_DOMAIN_TPM_VERSION_DEFAULT:
diff --git a/tests/qemuxml2argvdata/aarch64-tpm-wrong-model.err b/tests/qemuxml2argvdata/aarch64-tpm-wrong-model.err
new file mode 100644 (file)
index 0000000..a3a82fd
--- /dev/null
@@ -0,0 +1 @@
+unsupported configuration: TPM 1.2 is not supported on ARM
diff --git a/tests/qemuxml2argvdata/aarch64-tpm-wrong-model.xml b/tests/qemuxml2argvdata/aarch64-tpm-wrong-model.xml
new file mode 100644 (file)
index 0000000..9441c4d
--- /dev/null
@@ -0,0 +1,15 @@
+<domain type="qemu">
+  <name>aarch64test</name>
+  <uuid>496d7ea8-9739-544b-4ebd-ef08be936e8b</uuid>
+  <memory>1048576</memory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch="aarch64" machine="virt">hvm</type>
+  </os>
+  <devices>
+    <emulator>/usr/bin/qemu-system-aarch64</emulator>
+    <tpm model='tpm-tis'>
+      <backend type='emulator' version='1.2'/>
+    </tpm>
+  </devices>
+</domain>
index 9df28658b9b9f509485b97dd6b423115b3296da1..16236f03310374fc7612bd2e95fd82ae0fab906c 100644 (file)
@@ -2565,6 +2565,7 @@ mymain(void)
     DO_TEST_CAPS_LATEST("tpm-emulator-tpm2-pstate");
     DO_TEST_CAPS_LATEST_PPC64("tpm-emulator-spapr");
     DO_TEST_CAPS_ARCH_LATEST("aarch64-tpm", "aarch64");
+    DO_TEST_PARSE_ERROR("aarch64-tpm-wrong-model", "aarch64");
 
     DO_TEST_PARSE_ERROR("pci-domain-invalid", NONE);
     DO_TEST_PARSE_ERROR("pci-bus-invalid", NONE);