]> git.ipfire.org Git - thirdparty/libvirt.git/commit
qemu: Fix swtpm device with aarch64
authorJim Fehlig <jfehlig@suse.com>
Tue, 9 Feb 2021 21:57:22 +0000 (14:57 -0700)
committerJim Fehlig <jfehlig@suse.com>
Thu, 11 Feb 2021 17:08:52 +0000 (10:08 -0700)
commit7cf60006ce1e9898b960d7810f146ac6c89f6bb0
tree7593df72538f7f36e3488edc40d52188538b37e6
parente970325093dc0ae6d19cabe74e1a2b3474606ac7
qemu: Fix swtpm device with aarch64

Starting a VM with swtpm device fails with qemu-system-aarch64.
E.g. with TPM device config

     <tpm model='tpm-tis'>
       <backend type='emulator' version='2.0'/>
      </tpm>

QEMU reports the following error

error: internal error: process exited while connecting to monitor:
2021-02-07T05:15:35.378927Z qemu-system-aarch64: -device
tpm-tis,tpmdev=tpm-tpm0,id=tpm0: 'tpm-tis' is not a valid device model name

Indeed the TPM device name is 'tpm-tis-device' [1][2] for aarch64,
versus the shorter 'tpm-tis' for x86. The devices are the same from
a functional POV, i.e. they both emulate a TPM device conforming to
the TIS specification. Account for the unfortunate name difference
when building the TPM device option in qemuBuildTPMDevStr(). Also
include a test case for 'tpm-tis-device'.

[1] https://qemu.readthedocs.io/en/latest/specs/tpm.html
[2] https://github.com/qemu/qemu/commit/c294ac327ca99342b90bd3a83d2cef9b447afaa7

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
src/qemu/qemu_command.c
tests/qemuxml2argvdata/aarch64-tpm.aarch64-latest.args [new file with mode: 0644]
tests/qemuxml2argvdata/aarch64-tpm.xml [new file with mode: 0644]
tests/qemuxml2argvtest.c