[PATCH 3/3] qemu: Only allow TPM 2.0 for RISC-V guests

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



We've made similar changes for aarch64 a few years back (see
d8a1c059e0ed and previous commits), and the rationale is the
same: the architecture is new enough that TPM 2.0 predates it,
so TPM 1.2 support was never considered and will just not work.

Signed-off-by: Andrea Bolognani <abologna@xxxxxxxxxx>
---
 src/qemu/qemu_domain.c                                 |  1 +
 src/qemu/qemu_validate.c                               | 10 ++++++----
 .../aarch64-tpm-wrong-model.aarch64-latest.err         |  2 +-
 ...4-virt-default-models.riscv64-latest.abi-update.xml |  2 +-
 .../riscv64-virt-default-models.riscv64-latest.xml     |  2 +-
 5 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index bda62f2e5c..6bb18ad5a8 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -6182,6 +6182,7 @@ qemuDomainTPMDefPostParse(virDomainTPMDef *tpm,
         tpm->data.emulator.version == VIR_DOMAIN_TPM_VERSION_DEFAULT) {
         if (tpm->model == VIR_DOMAIN_TPM_MODEL_SPAPR ||
             tpm->model == VIR_DOMAIN_TPM_MODEL_CRB ||
+            qemuDomainIsRISCVVirt(def) ||
             qemuDomainIsARMVirt(def))
             tpm->data.emulator.version = VIR_DOMAIN_TPM_VERSION_2_0;
         else
diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c
index ac1940cb31..7b871be05f 100644
--- a/src/qemu/qemu_validate.c
+++ b/src/qemu/qemu_validate.c
@@ -4765,10 +4765,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"));
+            /* TPM 1.2 does not work on certain modern architectures */
+            if (qemuDomainIsARMVirt(def) ||
+                qemuDomainIsRISCVVirt(def)) {
+                virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+                               _("TPM 1.2 is not supported on architecture '%1$s'"),
+                               virArchToString(def->os.arch));
                 return -1;
             }
             break;
diff --git a/tests/qemuxmlconfdata/aarch64-tpm-wrong-model.aarch64-latest.err b/tests/qemuxmlconfdata/aarch64-tpm-wrong-model.aarch64-latest.err
index a3a82fdcf5..44c6e7372b 100644
--- a/tests/qemuxmlconfdata/aarch64-tpm-wrong-model.aarch64-latest.err
+++ b/tests/qemuxmlconfdata/aarch64-tpm-wrong-model.aarch64-latest.err
@@ -1 +1 @@
-unsupported configuration: TPM 1.2 is not supported on ARM
+unsupported configuration: TPM 1.2 is not supported on architecture 'aarch64'
diff --git a/tests/qemuxmlconfdata/riscv64-virt-default-models.riscv64-latest.abi-update.xml b/tests/qemuxmlconfdata/riscv64-virt-default-models.riscv64-latest.abi-update.xml
index a3a701b8e4..6712c2d831 100644
--- a/tests/qemuxmlconfdata/riscv64-virt-default-models.riscv64-latest.abi-update.xml
+++ b/tests/qemuxmlconfdata/riscv64-virt-default-models.riscv64-latest.abi-update.xml
@@ -59,7 +59,7 @@
       <target type='serial' port='0'/>
     </console>
     <tpm model='tpm-tis'>
-      <backend type='emulator' version='1.2'/>
+      <backend type='emulator' version='2.0'/>
     </tpm>
     <audio id='1' type='none'/>
     <video>
diff --git a/tests/qemuxmlconfdata/riscv64-virt-default-models.riscv64-latest.xml b/tests/qemuxmlconfdata/riscv64-virt-default-models.riscv64-latest.xml
index a3a701b8e4..6712c2d831 100644
--- a/tests/qemuxmlconfdata/riscv64-virt-default-models.riscv64-latest.xml
+++ b/tests/qemuxmlconfdata/riscv64-virt-default-models.riscv64-latest.xml
@@ -59,7 +59,7 @@
       <target type='serial' port='0'/>
     </console>
     <tpm model='tpm-tis'>
-      <backend type='emulator' version='1.2'/>
+      <backend type='emulator' version='2.0'/>
     </tpm>
     <audio id='1' type='none'/>
     <video>
-- 
2.45.1




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux