From: Hannes Duerr <h.duerr@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH qemu-server] cfg2cmd: use tpm-tis and tpm-tis-device depending on the arch
Date: Wed, 15 Jan 2025 14:58:06 +0100 [thread overview]
Message-ID: <20250115135806.169660-1-h.duerr@proxmox.com> (raw)
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@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
_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
reply other threads:[~2025-01-15 13:58 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250115135806.169660-1-h.duerr@proxmox.com \
--to=h.duerr@proxmox.com \
--cc=pve-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox