[pve-devel] [PATCH qemu-server] cfg2cmd: use tpm-tis and tpm-tis-device depending on the arch
Hannes Duerr
h.duerr at proxmox.com
Wed Jan 15 14:58:06 CET 2025
When using arch aarch64 for a VM in combination with new enough Windows
OS type the VM start fails:
> qemu-system-aarch64: -device tpm-tis,tpmdev=tpmdev: 'tpm-tis' is not a valid device model name
QEMU uses the `tpm-tis-device` device model for ARM[0] and RISCV[1]
instead of the `tmp-tis` which is used for x86_64.
This patch is a follow-up to [2].
[0] https://www.qemu.org/docs/master/specs/tpm.html#the-qemu-tpm-emulator-device
[1] https://www.qemu.org/docs/master/system/riscv/virt.html#enabling-tpm
[2] https://lore.proxmox.com/pve-devel/20250113135638.88099-1-f.ebner@proxmox.com/
Signed-off-by: Hannes Duerr <h.duerr at proxmox.com>
---
PVE/QemuServer.pm | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index 43008f3f..f7cb5fcb 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -3203,7 +3203,7 @@ sub get_tpm_paths {
}
sub add_tpm_device {
- my ($vmid, $devices, $conf) = @_;
+ my ($vmid, $devices, $conf, $arch) = @_;
return if !$conf->{tpmstate0};
@@ -3211,7 +3211,11 @@ sub add_tpm_device {
push @$devices, "-chardev", "socket,id=tpmchar,path=$paths->{socket}";
push @$devices, "-tpmdev", "emulator,id=tpmdev,chardev=tpmchar";
- push @$devices, "-device", "tpm-tis,tpmdev=tpmdev";
+ if ($arch eq 'x86_64') {
+ push @$devices, "-device", "tpm-tis,tpmdev=tpmdev";
+ } else {
+ push @$devices, "-device", "tpm-tis-device,tpmdev=tpmdev";
+ }
}
sub start_swtpm {
@@ -3838,7 +3842,7 @@ sub config_to_command {
# Add a TPM only if the VM is not a template,
# to support backing up template VMs even if the TPM disk is write-protected.
- add_tpm_device($vmid, $devices, $conf) if (!PVE::QemuConfig->is_template($conf));
+ add_tpm_device($vmid, $devices, $conf, $arch) if (!PVE::QemuConfig->is_template($conf));
my $sockets = 1;
$sockets = $conf->{smp} if $conf->{smp}; # old style - no longer iused
--
2.39.5
More information about the pve-devel
mailing list