[pve-devel] [PATCH qemu-server v2 1/1] fix #6400: pci: allow other pci domains than 0000 for NVIDIA vGPUs

Dominik Csapak d.csapak at proxmox.com
Fri Jul 4 08:18:52 CEST 2025


when creating or cleaning up NVIDIA vGPUs, we mistakenly assumed a
PCI domain of 0000, but this might be different.

Use 'normalize_pci_id' from PVE::SysFSTools, which handles this already
correctly.

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 src/PVE/QemuServer.pm     | 2 +-
 src/PVE/QemuServer/PCI.pm | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/PVE/QemuServer.pm b/src/PVE/QemuServer.pm
index 92c8fad6..d36fd1d0 100644
--- a/src/PVE/QemuServer.pm
+++ b/src/PVE/QemuServer.pm
@@ -5882,7 +5882,7 @@ sub cleanup_pci_devices {
     my $reservations = PVE::QemuServer::PCI::get_reservations($vmid);
     # clean up nvidia devices
     for my $id ($reservations->@*) {
-        $id = '0000:' . $id if $id !~ m/^0000:/;
+        $id = PVE::SysFSTools::normalize_pci_id($id);
 
         my $create_path = "/sys/bus/pci/devices/$id/nvidia/current_vgpu_type";
 
diff --git a/src/PVE/QemuServer/PCI.pm b/src/PVE/QemuServer/PCI.pm
index ddf2f028..b713f532 100644
--- a/src/PVE/QemuServer/PCI.pm
+++ b/src/PVE/QemuServer/PCI.pm
@@ -540,7 +540,7 @@ sub parse_hostpci_devices {
 my sub create_nvidia_device {
     my ($id, $model) = @_;
 
-    $id = '0000:' . $id if $id !~ m/^0000:/;
+    $id = PVE::SysFSTools::normalize_pci_id($id);
 
     my $creation = "/sys/bus/pci/devices/$id/nvidia/current_vgpu_type";
 
-- 
2.39.5





More information about the pve-devel mailing list