From: Fiona Ebner <f.ebner@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH qemu-server 2/3] machine: add machine_supports_flag() helper
Date: Wed, 12 Nov 2025 12:29:39 +0100 [thread overview]
Message-ID: <20251112112959.237909-3-f.ebner@proxmox.com> (raw)
In-Reply-To: <20251112112959.237909-1-f.ebner@proxmox.com>
Starting out with the 'hpet' flag, to be able to check it when
generating the timer commandline in a future commit.
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
---
src/PVE/QemuServer/Machine.pm | 32 ++++++++++++++++++++++++++++++++
1 file changed, 32 insertions(+)
diff --git a/src/PVE/QemuServer/Machine.pm b/src/PVE/QemuServer/Machine.pm
index 7a401087..ece90e80 100644
--- a/src/PVE/QemuServer/Machine.pm
+++ b/src/PVE/QemuServer/Machine.pm
@@ -172,6 +172,38 @@ sub machine_type_is_q35 {
return machine_base_type($machine_conf->{type}) eq 'q35' ? 1 : 0;
}
+# When you need to check a new flag, extend here and the POD for machine_supports_flag().
+my $supported_machine_flags = {
+ i440fx => {
+ hpet => 1,
+ },
+ q35 => {
+ hpet => 1,
+ },
+ virt => {},
+};
+
+=head3 machine_supports_flag
+
+ if (machine_supports_flag($machine_type, $flag)) {
+ push $machine_flags->@*, $flag;
+ }
+
+Check whether the machine type C<$machine_type> supports the machine flag C<$flag>. Both arguments
+must have a value. Flags which can be checked currently: C<hpet>.
+
+=cut
+
+sub machine_supports_flag {
+ my ($machine_type, $flag) = @_;
+
+ die "cannot check machine flag support - no machine type provided\n" if !$machine_type;
+ die "cannot check machine flag support - no flag provided\n" if !$flag;
+
+ my $base_type = machine_base_type($machine_type);
+ return $supported_machine_flags->{$base_type}->{$flag};
+}
+
# In list context, also returns whether the current machine is deprecated or not.
sub current_from_query_machines {
my ($machines) = @_;
--
2.47.3
_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
next prev parent reply other threads:[~2025-11-12 11:30 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-12 11:29 [pve-devel] [PATCH-SERIES qemu-server 0/3] fix #7014: fix regression starting aarch64 VMs with machine type >= 10.1 Fiona Ebner
2025-11-12 11:29 ` [pve-devel] [PATCH qemu-server 1/3] machine: add machine_base_type() helper Fiona Ebner
2025-11-12 11:29 ` Fiona Ebner [this message]
2025-11-12 11:29 ` [pve-devel] [PATCH qemu-server 3/3] fix #7014: fix regression starting aarch64 VMs with machine type >= 10.1 Fiona Ebner
2025-11-12 11:52 ` Fiona Ebner
2025-11-13 22:13 ` [pve-devel] applied: [PATCH-SERIES qemu-server 0/3] " Thomas Lamprecht
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=20251112112959.237909-3-f.ebner@proxmox.com \
--to=f.ebner@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.