all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Dominik Csapak <d.csapak@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [PATCH qemu-server v4 5/7] pci: preparation: mdev: only generate uuid once
Date: Tue, 25 Aug 2026 15:54:50 +0200	[thread overview]
Message-ID: <20260825135502.3971930-6-d.csapak@proxmox.com> (raw)
In-Reply-To: <20260825135502.3971930-1-d.csapak@proxmox.com>

In `prepare_pci_device` we already generate a uuid for the mdev. Later,
for NVIDIA vGPU, we need the uuid again to add it to the qemu cmdline.
Instead of generating it twice, return it from `prepare_pci_device` and
reuse that if we can.

If the device uses the modern nvidia vgpu stack, we don't need to create
a mdev, so generate the fallback uuid in `prepare_pci_devices`.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
 src/PVE/QemuServer/PCI.pm | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/PVE/QemuServer/PCI.pm b/src/PVE/QemuServer/PCI.pm
index f7167dcc..5d2fdabb 100644
--- a/src/PVE/QemuServer/PCI.pm
+++ b/src/PVE/QemuServer/PCI.pm
@@ -739,7 +739,8 @@ sub prepare_pci_devices {
 
         # nvidia vgpu needs a uuid as qemu parameter
         if (!defined($uuid) && $chosen_mdev->{vendor} =~ m/^(0x)?10de$/) {
-            $uuid = PVE::QemuServer::PCI::Mdev::generate_mdev_uuid($vmid, $index);
+            $uuid = $chosen_mdev->{uuid}
+                // PVE::QemuServer::PCI::Mdev::generate_mdev_uuid($vmid, $index);
         }
     }
 
@@ -760,6 +761,7 @@ sub prepare_pci_device {
     } elsif (my $mdev = $device->{mdev}) {
         my $uuid = PVE::QemuServer::PCI::Mdev::generate_mdev_uuid($vmid, $index);
         PVE::QemuServer::PCI::Mdev::pci_create_mdev_device($pciid, $uuid, $mdev);
+        $info->{uuid} = $uuid;
     } else {
         die "can't unbind/bind PCI group to VFIO '$pciid'\n"
             if !PVE::SysFSTools::pci_dev_group_bind_to_vfio($pciid);
-- 
2.47.3





  parent reply	other threads:[~2026-08-25 13:55 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-25 13:54 [PATCH docs/guest-common/qemu-server v4 0/7] add new pci passthrough specific hookscript phase Dominik Csapak
2026-08-25 13:54 ` [PATCH guest-common v4 1/7] helpers: exec hookscript: add optional parameters Dominik Csapak
2026-08-25 13:54 ` [PATCH qemu-server v4 2/7] pci: mdev preparation: always generate local uuid first Dominik Csapak
2026-08-25 13:54 ` [PATCH qemu-server v4 3/7] pci: nvidia vgpu: correct wrong comment about uuid Dominik Csapak
2026-08-25 13:54 ` [PATCH qemu-server v4 4/7] pci: factor 'prepare_pci_devices' out to PVE::QemuServer::PCI module Dominik Csapak
2026-08-25 13:54 ` Dominik Csapak [this message]
2026-08-25 13:54 ` [PATCH qemu-server v4 6/7] pci: call hookscript for each prepared pci device Dominik Csapak
2026-08-25 13:54 ` [PATCH docs v4 7/7] examples: add new hookscript phase to example hookscript Dominik Csapak

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=20260825135502.3971930-6-d.csapak@proxmox.com \
    --to=d.csapak@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.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal