public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Stefan Reiter <s.reiter@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH pve-qemu 1/7] add static supported machines file
Date: Thu,  4 Mar 2021 13:52:03 +0100	[thread overview]
Message-ID: <20210304125209.24078-2-s.reiter@proxmox.com> (raw)
In-Reply-To: <20210304125209.24078-1-s.reiter@proxmox.com>

Same rationale as the CPU flags file, avoids calling QEMU binary just to
query machine types.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
---
 debian/parse-machines.pl | 21 +++++++++++++++++++++
 debian/rules             |  4 +++-
 2 files changed, 24 insertions(+), 1 deletion(-)
 create mode 100755 debian/parse-machines.pl

diff --git a/debian/parse-machines.pl b/debian/parse-machines.pl
new file mode 100755
index 0000000..8ad335d
--- /dev/null
+++ b/debian/parse-machines.pl
@@ -0,0 +1,21 @@
+#!/usr/bin/perl
+
+use warnings;
+use strict;
+
+my @machines = ();
+
+while (<STDIN>) {
+    if (/^\s*Supported machines are:/) {
+	next;
+    }
+
+    s/^\s+//;
+    my @machine = split(/\s+/);
+    next if $machine[0] !~ m/^pc-(i440fx|q35)/;
+    push @machines, $machine[0];
+}
+
+die "no QEMU machine types detected from STDIN input" if scalar (@machines) <= 0;
+
+print join("\n", @machines) or die "$!\n";
diff --git a/debian/rules b/debian/rules
index 4a6b472..386ac4b 100755
--- a/debian/rules
+++ b/debian/rules
@@ -22,6 +22,7 @@ PACKAGE=pve-qemu-kvm
 destdir := $(CURDIR)/debian/$(PACKAGE)
 
 flagfile := $(destdir)/usr/share/kvm/recognized-CPUID-flags-x86_64
+machinefile := $(destdir)/usr/share/kvm/machine-versions-x86_64
 
 # default QEMU out-of-tree build directory is ./build
 BUILDDIR=build
@@ -124,7 +125,7 @@ install: build
 	rm $(destdir)/usr/share/kvm/qemu_vga.ndrv
 	rm $(destdir)/usr/share/kvm/slof.bin
 	rm $(destdir)/usr/share/kvm/u-boot.e500
-	# remove Aplha files
+	# remove Alpha files
 	rm $(destdir)/usr/share/kvm/palcode-clipper
 	# remove RISC-V files
 	rm $(destdir)/usr/share/kvm/opensbi-riscv32-generic-fw_dynamic.elf
@@ -138,6 +139,7 @@ install: build
 
 	# CPU flags are static for QEMU version, allows avoiding more costly checks
 	$(destdir)/usr/bin/qemu-system-x86_64 -cpu help | ./debian/parse-cpu-flags.pl > $(flagfile)
+	$(destdir)/usr/bin/qemu-system-x86_64 -machine help | ./debian/parse-machines.pl > $(machinefile)
 
 # Build architecture-independent files here.
 binary-indep: build install
-- 
2.20.1





  reply	other threads:[~2021-03-04 12:52 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-04 12:52 [pve-devel] [PATCH 0/7] Work around QEMU 5.2 windows incompatibility Stefan Reiter
2021-03-04 12:52 ` Stefan Reiter [this message]
2021-03-05 21:27   ` [pve-devel] applied: [PATCH pve-qemu 1/7] add static supported machines file Thomas Lamprecht
2021-03-04 12:52 ` [pve-devel] [PATCH pve-qemu 2/7] add ACPI compat patch for 5.1 and older machine types Stefan Reiter
2021-03-05 21:27   ` [pve-devel] applied: " Thomas Lamprecht
2021-03-04 12:52 ` [pve-devel] [PATCH qemu-server 3/7] api: add Machine module to query " Stefan Reiter
2021-03-05 21:28   ` [pve-devel] applied: " Thomas Lamprecht
2021-03-04 12:52 ` [pve-devel] [PATCH qemu-server 4/7] add postinst with Windows device incompatibility workaround Stefan Reiter
2021-03-04 13:31   ` Stefan Reiter
2021-03-05  8:03   ` Fabian Ebner
2021-03-05 21:32   ` [pve-devel] NAK: " Thomas Lamprecht
2021-03-04 12:52 ` [pve-devel] [PATCH manager 5/7] api: register Qemu::Machine call Stefan Reiter
2021-03-05 21:33   ` [pve-devel] applied: " Thomas Lamprecht
2021-03-04 12:52 ` [pve-devel] [PATCH manager 6/7] ui: create MachineEdit window Stefan Reiter
2021-03-05 21:33   ` [pve-devel] applied: " Thomas Lamprecht
2021-03-04 12:52 ` [pve-devel] [PATCH manager 7/7] ui: MachineEdit: add option for machine version pinning Stefan Reiter
2021-03-05 21:36   ` [pve-devel] applied: " Thomas Lamprecht
2021-03-05  7:24 ` [pve-devel] [PATCH 0/7] Work around QEMU 5.2 windows incompatibility Fabian Ebner

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=20210304125209.24078-2-s.reiter@proxmox.com \
    --to=s.reiter@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
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal