]> xenbits.xensource.com Git - libvirt.git/commitdiff
tests: Add TPM coverage to default-models tests
authorAndrea Bolognani <abologna@redhat.com>
Mon, 27 May 2024 16:37:58 +0000 (18:37 +0200)
committerAndrea Bolognani <abologna@redhat.com>
Fri, 7 Jun 2024 09:12:59 +0000 (11:12 +0200)
We have a non-trivial amount of architecture-specific logic
dealing with TPM, so it's good to have coverage for it.

Note that two architectures currently don't have support for
TPM devices enabled by default in QEMU: loongarch64 and s390x.
The situation might change for the former, but that's unlikely
to happen for the latter.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
27 files changed:
tests/qemuxmlconfdata/aarch64-virt-default-models.aarch64-latest.abi-update.args
tests/qemuxmlconfdata/aarch64-virt-default-models.aarch64-latest.abi-update.xml
tests/qemuxmlconfdata/aarch64-virt-default-models.aarch64-latest.args
tests/qemuxmlconfdata/aarch64-virt-default-models.aarch64-latest.xml
tests/qemuxmlconfdata/aarch64-virt-default-models.xml
tests/qemuxmlconfdata/loongarch64-virt-default-models.xml
tests/qemuxmlconfdata/ppc64-pseries-default-models.ppc64-latest.abi-update.args
tests/qemuxmlconfdata/ppc64-pseries-default-models.ppc64-latest.abi-update.xml
tests/qemuxmlconfdata/ppc64-pseries-default-models.ppc64-latest.args
tests/qemuxmlconfdata/ppc64-pseries-default-models.ppc64-latest.xml
tests/qemuxmlconfdata/ppc64-pseries-default-models.xml
tests/qemuxmlconfdata/riscv64-virt-default-models.riscv64-latest.abi-update.args
tests/qemuxmlconfdata/riscv64-virt-default-models.riscv64-latest.abi-update.xml
tests/qemuxmlconfdata/riscv64-virt-default-models.riscv64-latest.args
tests/qemuxmlconfdata/riscv64-virt-default-models.riscv64-latest.xml
tests/qemuxmlconfdata/riscv64-virt-default-models.xml
tests/qemuxmlconfdata/s390x-ccw-default-models.xml
tests/qemuxmlconfdata/x86_64-pc-default-models.x86_64-latest.abi-update.args
tests/qemuxmlconfdata/x86_64-pc-default-models.x86_64-latest.abi-update.xml
tests/qemuxmlconfdata/x86_64-pc-default-models.x86_64-latest.args
tests/qemuxmlconfdata/x86_64-pc-default-models.x86_64-latest.xml
tests/qemuxmlconfdata/x86_64-pc-default-models.xml
tests/qemuxmlconfdata/x86_64-q35-default-models.x86_64-latest.abi-update.args
tests/qemuxmlconfdata/x86_64-q35-default-models.x86_64-latest.abi-update.xml
tests/qemuxmlconfdata/x86_64-q35-default-models.x86_64-latest.args
tests/qemuxmlconfdata/x86_64-q35-default-models.x86_64-latest.xml
tests/qemuxmlconfdata/x86_64-q35-default-models.xml

index 0c4acf800fab1f301df3121529a4eb14b1a88f98..a503f45d0c231a271e672d1d26b766463f5f7277 100644 (file)
@@ -38,6 +38,9 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-guest/.config \
 -device '{"driver":"virtio-net-pci","netdev":"hostnet0","id":"net0","mac":"52:54:00:09:a4:37","bus":"pci.2","addr":"0x0"}' \
 -chardev pty,id=charserial0 \
 -serial chardev:charserial0 \
+-chardev socket,id=chrtpm,path=/dev/test \
+-tpmdev emulator,id=tpm-tpm0,chardev=chrtpm \
+-device '{"driver":"tpm-tis-device","tpmdev":"tpm-tpm0","id":"tpm0"}' \
 -audiodev '{"id":"audio1","driver":"none"}' \
 -device '{"driver":"virtio-gpu-pci","id":"video0","max_outputs":1,"bus":"pci.5","addr":"0x0"}' \
 -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \
index 87be062c89800cd009fea4410b64bb0ba5bb2e3f..bbe1dd931dd1f0d4dc5e37bcfe17be3758747056 100644 (file)
@@ -69,6 +69,9 @@
     <console type='pty'>
       <target type='serial' port='0'/>
     </console>
+    <tpm model='tpm-tis'>
+      <backend type='emulator' version='2.0'/>
+    </tpm>
     <audio id='1' type='none'/>
     <video>
       <model type='virtio' heads='1' primary='yes'/>
index 0c4acf800fab1f301df3121529a4eb14b1a88f98..a503f45d0c231a271e672d1d26b766463f5f7277 100644 (file)
@@ -38,6 +38,9 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-guest/.config \
 -device '{"driver":"virtio-net-pci","netdev":"hostnet0","id":"net0","mac":"52:54:00:09:a4:37","bus":"pci.2","addr":"0x0"}' \
 -chardev pty,id=charserial0 \
 -serial chardev:charserial0 \
+-chardev socket,id=chrtpm,path=/dev/test \
+-tpmdev emulator,id=tpm-tpm0,chardev=chrtpm \
+-device '{"driver":"tpm-tis-device","tpmdev":"tpm-tpm0","id":"tpm0"}' \
 -audiodev '{"id":"audio1","driver":"none"}' \
 -device '{"driver":"virtio-gpu-pci","id":"video0","max_outputs":1,"bus":"pci.5","addr":"0x0"}' \
 -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \
index 87be062c89800cd009fea4410b64bb0ba5bb2e3f..bbe1dd931dd1f0d4dc5e37bcfe17be3758747056 100644 (file)
@@ -69,6 +69,9 @@
     <console type='pty'>
       <target type='serial' port='0'/>
     </console>
+    <tpm model='tpm-tis'>
+      <backend type='emulator' version='2.0'/>
+    </tpm>
     <audio id='1' type='none'/>
     <video>
       <model type='virtio' heads='1' primary='yes'/>
index cf7f330c0bbcc7c838d7b9ef3f52847f5ebba261..d9ad495e7560e98f7d9ce0bffb6f74dd1d20db3a 100644 (file)
@@ -14,6 +14,9 @@
       <mac address='52:54:00:09:a4:37'/>
     </interface>
     <serial type='pty'/>
+    <tpm>
+      <backend type='emulator'/>
+    </tpm>
     <video/>
     <memballoon model='none'/>
     <!-- No default model for <panic/> on aarch64 -->
index 109fb3b3ea7b65813e0359688d3a71434688852a..07af08b25dc6a8550e353fb71e6d231770bd3463 100644 (file)
@@ -14,6 +14,9 @@
       <mac address='52:54:00:09:a4:37'/>
     </interface>
     <serial type='pty'/>
+    <!-- loongarch64 could probably use TPM but the necessary devices
+    are currently disabled in the default QEMU configuration for the
+    architecture. If that ever changes, add coverage here -->
     <video/>
     <memballoon model='none'/>
     <!-- No default model for <panic/> on loongarch64 -->
index 1395f19bfe9a662eb20d5088191c56f7dc9dd540..f4ae38f1b539ba60ca6bd07df5f2cf70241ce3a4 100644 (file)
@@ -32,6 +32,9 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-guest/.config \
 -device '{"driver":"rtl8139","netdev":"hostnet0","id":"net0","mac":"52:54:00:09:a4:37","bus":"pci.0","addr":"0x1"}' \
 -chardev pty,id=charserial0 \
 -device '{"driver":"spapr-vty","chardev":"charserial0","id":"serial0","reg":805306368}' \
+-chardev socket,id=chrtpm,path=/dev/test \
+-tpmdev emulator,id=tpm-tpm0,chardev=chrtpm \
+-device '{"driver":"tpm-spapr","tpmdev":"tpm-tpm0","id":"tpm0","reg":16384}' \
 -audiodev '{"id":"audio1","driver":"none"}' \
 -device '{"driver":"VGA","id":"video0","vgamem_mb":16,"bus":"pci.0","addr":"0x3"}' \
 -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \
index 2304c6f786def5cfe01f88be717e04472b5b2749..24eed24ab66e6871cd59ed7b4fcfb5e9f868e80c 100644 (file)
       <target type='serial' port='0'/>
       <address type='spapr-vio' reg='0x30000000'/>
     </console>
+    <tpm model='tpm-spapr'>
+      <backend type='emulator' version='2.0'/>
+      <address type='spapr-vio' reg='0x00004000'/>
+    </tpm>
     <audio id='1' type='none'/>
     <video>
       <model type='vga' vram='16384' heads='1' primary='yes'/>
index 84c341a24d4f37266ae9ca1f54d4df33c932920b..c833b6cbf9ae8c9c654718e08cef05c85bd2a07d 100644 (file)
@@ -32,6 +32,9 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-guest/.config \
 -device '{"driver":"rtl8139","netdev":"hostnet0","id":"net0","mac":"52:54:00:09:a4:37","bus":"pci.0","addr":"0x1"}' \
 -chardev pty,id=charserial0 \
 -device '{"driver":"spapr-vty","chardev":"charserial0","id":"serial0","reg":805306368}' \
+-chardev socket,id=chrtpm,path=/dev/test \
+-tpmdev emulator,id=tpm-tpm0,chardev=chrtpm \
+-device '{"driver":"tpm-spapr","tpmdev":"tpm-tpm0","id":"tpm0","reg":16384}' \
 -audiodev '{"id":"audio1","driver":"none"}' \
 -device '{"driver":"VGA","id":"video0","vgamem_mb":16,"bus":"pci.0","addr":"0x3"}' \
 -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \
index f342093ec8854f12d5afcdd575a7300d030162cd..4cf725753603739ee6a5dd81f99ed0703c0278ad 100644 (file)
       <target type='serial' port='0'/>
       <address type='spapr-vio' reg='0x30000000'/>
     </console>
+    <tpm model='tpm-spapr'>
+      <backend type='emulator' version='2.0'/>
+      <address type='spapr-vio' reg='0x00004000'/>
+    </tpm>
     <audio id='1' type='none'/>
     <video>
       <model type='vga' vram='16384' heads='1' primary='yes'/>
index 4c2d16f01a621e9cd05bac31d98366366dc0ef8b..afb2d5fc43cc95948a393cf026d80277c4753e53 100644 (file)
@@ -14,6 +14,9 @@
       <mac address='52:54:00:09:a4:37'/>
     </interface>
     <serial type='pty'/>
+    <tpm>
+      <backend type='emulator'/>
+    </tpm>
     <video/>
     <memballoon model='none'/>
     <panic/>
index 28b56d876cfad9a2451a848ee12a019e812c6e14..8f878120b0570463f264855155aea59d631d602a 100644 (file)
@@ -36,6 +36,9 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-guest/.config \
 -device '{"driver":"virtio-net-pci","netdev":"hostnet0","id":"net0","mac":"52:54:00:09:a4:37","bus":"pci.2","addr":"0x0"}' \
 -chardev pty,id=charserial0 \
 -serial chardev:charserial0 \
+-chardev socket,id=chrtpm,path=/dev/test \
+-tpmdev emulator,id=tpm-tpm0,chardev=chrtpm \
+-device '{"driver":"tpm-tis-device","tpmdev":"tpm-tpm0","id":"tpm0"}' \
 -audiodev '{"id":"audio1","driver":"none"}' \
 -device '{"driver":"virtio-vga","id":"video0","max_outputs":1,"bus":"pci.4","addr":"0x0"}' \
 -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \
index 942bd21f9e4beffbd3e900b077c87a0845cfa1a0..a3a701b8e4bb0eea8165fc05e48a02e2b40ed723 100644 (file)
@@ -58,6 +58,9 @@
     <console type='pty'>
       <target type='serial' port='0'/>
     </console>
+    <tpm model='tpm-tis'>
+      <backend type='emulator' version='1.2'/>
+    </tpm>
     <audio id='1' type='none'/>
     <video>
       <model type='virtio' heads='1' primary='yes'/>
index 28b56d876cfad9a2451a848ee12a019e812c6e14..8f878120b0570463f264855155aea59d631d602a 100644 (file)
@@ -36,6 +36,9 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-guest/.config \
 -device '{"driver":"virtio-net-pci","netdev":"hostnet0","id":"net0","mac":"52:54:00:09:a4:37","bus":"pci.2","addr":"0x0"}' \
 -chardev pty,id=charserial0 \
 -serial chardev:charserial0 \
+-chardev socket,id=chrtpm,path=/dev/test \
+-tpmdev emulator,id=tpm-tpm0,chardev=chrtpm \
+-device '{"driver":"tpm-tis-device","tpmdev":"tpm-tpm0","id":"tpm0"}' \
 -audiodev '{"id":"audio1","driver":"none"}' \
 -device '{"driver":"virtio-vga","id":"video0","max_outputs":1,"bus":"pci.4","addr":"0x0"}' \
 -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \
index 942bd21f9e4beffbd3e900b077c87a0845cfa1a0..a3a701b8e4bb0eea8165fc05e48a02e2b40ed723 100644 (file)
@@ -58,6 +58,9 @@
     <console type='pty'>
       <target type='serial' port='0'/>
     </console>
+    <tpm model='tpm-tis'>
+      <backend type='emulator' version='1.2'/>
+    </tpm>
     <audio id='1' type='none'/>
     <video>
       <model type='virtio' heads='1' primary='yes'/>
index d421b080a8838997d006d35c056ba2016c07eceb..b89295af166319e8ab2fb4bcd660771d5f3b2196 100644 (file)
@@ -14,6 +14,9 @@
       <mac address='52:54:00:09:a4:37'/>
     </interface>
     <serial type='pty'/>
+    <tpm>
+      <backend type='emulator'/>
+    </tpm>
     <video/>
     <memballoon model='none'/>
     <!-- No default model for <panic/> on riscv64 -->
index a196129628cd3245076fe0b15411910aa4aad994..70e316f77dc64dbe785a06c1ed07c491511e9c7c 100644 (file)
@@ -14,6 +14,8 @@
       <mac address='52:54:00:09:a4:37'/>
     </interface>
     <serial type='pty'/>
+    <!-- QEMU doesn't currently support TPM devices on s390x and there
+    are no plans for that to change in the future  -->
     <video/>
     <memballoon model='none'/>
     <panic/>
index 3220a40959f235ee39a7625a39f930d7b2f9f449..6563b0593722dfdcfaef084a1cc72f27e4d1a98b 100644 (file)
@@ -32,6 +32,9 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-guest/.config \
 -device '{"driver":"rtl8139","netdev":"hostnet0","id":"net0","mac":"52:54:00:09:a4:37","bus":"pci.0","addr":"0x3"}' \
 -chardev pty,id=charserial0 \
 -device '{"driver":"isa-serial","chardev":"charserial0","id":"serial0","index":0}' \
+-chardev socket,id=chrtpm,path=/dev/test \
+-tpmdev emulator,id=tpm-tpm0,chardev=chrtpm \
+-device '{"driver":"tpm-tis","tpmdev":"tpm-tpm0","id":"tpm0"}' \
 -audiodev '{"id":"audio1","driver":"none"}' \
 -device '{"driver":"cirrus-vga","id":"video0","bus":"pci.0","addr":"0x2"}' \
 -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \
index dc563fdaf99cba202b8540621d88f74456a5818e..512d4bd597a76ffe72a1542b5bfae1342aa5a598 100644 (file)
@@ -39,6 +39,9 @@
     </console>
     <input type='mouse' bus='ps2'/>
     <input type='keyboard' bus='ps2'/>
+    <tpm model='tpm-tis'>
+      <backend type='emulator' version='1.2'/>
+    </tpm>
     <audio id='1' type='none'/>
     <video>
       <model type='cirrus' vram='16384' heads='1' primary='yes'/>
index 3220a40959f235ee39a7625a39f930d7b2f9f449..6563b0593722dfdcfaef084a1cc72f27e4d1a98b 100644 (file)
@@ -32,6 +32,9 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-guest/.config \
 -device '{"driver":"rtl8139","netdev":"hostnet0","id":"net0","mac":"52:54:00:09:a4:37","bus":"pci.0","addr":"0x3"}' \
 -chardev pty,id=charserial0 \
 -device '{"driver":"isa-serial","chardev":"charserial0","id":"serial0","index":0}' \
+-chardev socket,id=chrtpm,path=/dev/test \
+-tpmdev emulator,id=tpm-tpm0,chardev=chrtpm \
+-device '{"driver":"tpm-tis","tpmdev":"tpm-tpm0","id":"tpm0"}' \
 -audiodev '{"id":"audio1","driver":"none"}' \
 -device '{"driver":"cirrus-vga","id":"video0","bus":"pci.0","addr":"0x2"}' \
 -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \
index dc563fdaf99cba202b8540621d88f74456a5818e..512d4bd597a76ffe72a1542b5bfae1342aa5a598 100644 (file)
@@ -39,6 +39,9 @@
     </console>
     <input type='mouse' bus='ps2'/>
     <input type='keyboard' bus='ps2'/>
+    <tpm model='tpm-tis'>
+      <backend type='emulator' version='1.2'/>
+    </tpm>
     <audio id='1' type='none'/>
     <video>
       <model type='cirrus' vram='16384' heads='1' primary='yes'/>
index 6727d2f6a097762a3c8d44546d3db9913d1ad3a9..7f4c9f8662d48e811892f0b9aece089da1abe986 100644 (file)
@@ -14,6 +14,9 @@
       <mac address='52:54:00:09:a4:37'/>
     </interface>
     <serial type='pty'/>
+    <tpm>
+      <backend type='emulator'/>
+    </tpm>
     <video/>
     <memballoon model='none'/>
     <panic/>
index b9905c64463a371a538f364a733a513f43434990..29ea0bedacd01664121a20bee8f8a2fa84439d27 100644 (file)
@@ -35,6 +35,9 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-guest/.config \
 -device '{"driver":"rtl8139","netdev":"hostnet0","id":"net0","mac":"52:54:00:09:a4:37","bus":"pci.2","addr":"0x1"}' \
 -chardev pty,id=charserial0 \
 -device '{"driver":"isa-serial","chardev":"charserial0","id":"serial0","index":0}' \
+-chardev socket,id=chrtpm,path=/dev/test \
+-tpmdev emulator,id=tpm-tpm0,chardev=chrtpm \
+-device '{"driver":"tpm-tis","tpmdev":"tpm-tpm0","id":"tpm0"}' \
 -audiodev '{"id":"audio1","driver":"none"}' \
 -device '{"driver":"cirrus-vga","id":"video0","bus":"pcie.0","addr":"0x1"}' \
 -global ICH9-LPC.noreboot=off \
index 782fe39491cedac8cea5dc6b2835948c047a017a..6406229b2fcf1efdc56648860f7817369af326bd 100644 (file)
@@ -56,6 +56,9 @@
     </console>
     <input type='mouse' bus='ps2'/>
     <input type='keyboard' bus='ps2'/>
+    <tpm model='tpm-tis'>
+      <backend type='emulator' version='1.2'/>
+    </tpm>
     <audio id='1' type='none'/>
     <video>
       <model type='cirrus' vram='16384' heads='1' primary='yes'/>
index b9905c64463a371a538f364a733a513f43434990..29ea0bedacd01664121a20bee8f8a2fa84439d27 100644 (file)
@@ -35,6 +35,9 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-guest/.config \
 -device '{"driver":"rtl8139","netdev":"hostnet0","id":"net0","mac":"52:54:00:09:a4:37","bus":"pci.2","addr":"0x1"}' \
 -chardev pty,id=charserial0 \
 -device '{"driver":"isa-serial","chardev":"charserial0","id":"serial0","index":0}' \
+-chardev socket,id=chrtpm,path=/dev/test \
+-tpmdev emulator,id=tpm-tpm0,chardev=chrtpm \
+-device '{"driver":"tpm-tis","tpmdev":"tpm-tpm0","id":"tpm0"}' \
 -audiodev '{"id":"audio1","driver":"none"}' \
 -device '{"driver":"cirrus-vga","id":"video0","bus":"pcie.0","addr":"0x1"}' \
 -global ICH9-LPC.noreboot=off \
index 782fe39491cedac8cea5dc6b2835948c047a017a..6406229b2fcf1efdc56648860f7817369af326bd 100644 (file)
@@ -56,6 +56,9 @@
     </console>
     <input type='mouse' bus='ps2'/>
     <input type='keyboard' bus='ps2'/>
+    <tpm model='tpm-tis'>
+      <backend type='emulator' version='1.2'/>
+    </tpm>
     <audio id='1' type='none'/>
     <video>
       <model type='cirrus' vram='16384' heads='1' primary='yes'/>
index 5cdf07f9d3dfe187aed62c8821dbdbd75f6c9a98..65fb76f2dcd6f51796a4184b27fb9fb780760c7e 100644 (file)
@@ -14,6 +14,9 @@
       <mac address='52:54:00:09:a4:37'/>
     </interface>
     <serial type='pty'/>
+    <tpm>
+      <backend type='emulator'/>
+    </tpm>
     <video/>
     <memballoon model='none'/>
     <panic/>