all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Kaiyang Wu <wukaiyang2003@gmail.com>
To: pve-devel@lists.proxmox.com
Cc: Kaiyang Wu <wukaiyang@loongfans.cn>
Subject: [PATCH qemu-server 1/3] qemuserver: add pvpanic device
Date: Thu, 27 Aug 2026 18:35:27 +0800	[thread overview]
Message-ID: <20260827103529.393388-2-wukaiyang@loongfans.cn> (raw)
In-Reply-To: <20260827103529.393388-1-wukaiyang@loongfans.cn>

Add pvpanic device to monitor virtual machine system panics. Add pvpanic
field in virtual machine configuration files, allowing to choose the ISA
or the PCI variant of the pvpanic device.

Signed-off-by: Kaiyang Wu <wukaiyang@loongfans.cn>
---
 src/PVE/API2/Qemu.pm      |  1 +
 src/PVE/QemuServer.pm     | 19 +++++++++++++++++++
 src/PVE/QemuServer/PCI.pm |  1 +
 3 files changed, 21 insertions(+)

diff --git a/src/PVE/API2/Qemu.pm b/src/PVE/API2/Qemu.pm
index 71247eec..933f6221 100644
--- a/src/PVE/API2/Qemu.pm
+++ b/src/PVE/API2/Qemu.pm
@@ -818,6 +818,7 @@ my $hwtypeoptions = {
     'watchdog' => 1,
     'audio0' => 1,
     'rng0' => 1,
+    'pvpanic0' => 1,
 };
 
 my $generaloptions = {
diff --git a/src/PVE/QemuServer.pm b/src/PVE/QemuServer.pm
index 63d8c135..f476af94 100644
--- a/src/PVE/QemuServer.pm
+++ b/src/PVE/QemuServer.pm
@@ -739,6 +739,13 @@ EODESCR
         optional => 1,
         default => 1,
     },
+    pvpanic0 => {
+        optional => 1,
+        type => 'string',
+        description => "Configure a pvpanic device to monitor guest panics",
+        enum => [qw(pvpanic pvpanic-pci)],
+        default => undef,
+    },
 };
 
 my $cicustom_fmt = {
@@ -3415,6 +3422,18 @@ sub config_to_command {
         push @$cmd, '-nographic';
     }
 
+    my $pvpanic = $conf->{pvpanic0};
+    if (defined($pvpanic)) {
+        if ($pvpanic eq 'pvpanic') {
+            push @$devices, '-device', $pvpanic;
+        } elsif ($pvpanic eq 'pvpanic-pci') {
+            my $pvpanicpciaddr = print_pci_addr("pvpanic0", $bridges, $arch);
+            push @$devices, '-device', "$pvpanic,id=pvpanic$pvpanicpciaddr";
+        } else {
+            die "unknown pvpanic device type $pvpanic";
+        }
+    }
+
     # For now, handles only specific parts, but the final goal is to cover everything.
     my $cfg2cmd_opts = { forcemachine => $forcemachine };
     my $cfg2cmd = PVE::QemuServer::Cfg2Cmd->new($conf, $defaults, $version_guard, $cfg2cmd_opts);
diff --git a/src/PVE/QemuServer/PCI.pm b/src/PVE/QemuServer/PCI.pm
index 0b67943c..56770091 100644
--- a/src/PVE/QemuServer/PCI.pm
+++ b/src/PVE/QemuServer/PCI.pm
@@ -220,6 +220,7 @@ sub get_pci_addr_map {
         'pci.4' => { bus => 1, addr => 28 },
         'rng0' => { bus => 1, addr => 29 },
         'pci.2-igd' => { bus => 1, addr => 30 }, # replaces pci.2 in case a legacy IGD device is passed through
+        'pvpanic0' => { bus => 1, addr => 31 },
         'virtio6' => { bus => 2, addr => 1 },
         'virtio7' => { bus => 2, addr => 2 },
         'virtio8' => { bus => 2, addr => 3 },
-- 
2.55.0




  reply	other threads:[~2026-08-27 10:36 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-27 10:35 [PATCH qemu-server/docs/manager 0/3] add pvpanic device support Kaiyang Wu
2026-08-27 10:35 ` Kaiyang Wu [this message]
2026-08-27 10:35 ` [PATCH docs 2/3] qm: add document section for the pvpanic device Kaiyang Wu
2026-08-27 10:35 ` [PATCH manager 3/3] ui: qemu: add pvpanic device support Kaiyang Wu

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=20260827103529.393388-2-wukaiyang@loongfans.cn \
    --to=wukaiyang2003@gmail.com \
    --cc=pve-devel@lists.proxmox.com \
    --cc=wukaiyang@loongfans.cn \
    /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.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal