From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [45.144.208.40]) by lore.proxmox.com (Postfix) with ESMTPS id 92E001FF0AB for ; Mon, 07 Sep 2026 13:06:53 +0200 (CEST) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 04E4D21614; Mon, 07 Sep 2026 13:06:28 +0200 (CEST) From: Dominik Csapak To: pve-devel@lists.proxmox.com Subject: [PATCH qemu-server 0/4] pci: bridges: cleanup and hotplug fix Date: Mon, 7 Sep 2026 13:00:17 +0200 Message-ID: <20260907110621.2122120-1-d.csapak@proxmox.com> X-Mailer: git-send-email 2.47.3 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.534 Adjusted score from AWL reputation of From: address DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment (newer systems) RCVD_IN_DNSWL_MED -2.3 Sender listed at https://www.dnswl.org/, medium trust SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Message-ID-Hash: XG4ACCKNLHO4PZOLRJVQRU34JNO2XNZX X-Message-ID-Hash: XG4ACCKNLHO4PZOLRJVQRU34JNO2XNZX X-MailFrom: d.csapak@proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox VE development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Main motivation for this series was a defect in how we handle hotplugging certain devices: When e.g. adding scsi15 on a vm with i440fx + lsi controller, we'd need scsihw2 (since only 7 devices can live on scsihw0 and scsihw1 respectively) which sits on bus pci.4. This itself is not added by default to the config, so we tried to hotplug the bridge. This works, but without SHPC (which is neither the default, nor does it work reliably in all guests) one cannot hot-plug anything into a hot-plugged bridge. So when hotplugging scsi15 in this example, we'd hot-plug pci.4, but adding scsihw2 would fail and leave the disk in 'pending'. When now a live-migration is initiated, the already added bridge is never recorded in the config, and the guest crashes on the remote after it's resumed. Since this is a rather narrow case, I'd opted for preventing hot-plugging bridges completely. Further I tried to refactor and cleanup the bridge adding code a bit, so we don't have to pass the 'bridges' hash around anymore. (patch 4/4) To be sure, I added two tests for cases we didn't cover yet. (patches 1 and 2, these could be applied anyway since they just test the status quo). Further improvement could be to always add pci.4 with the next machine version, but this can be done as a follow up or separate series later too. Dominik Csapak (4): tests: add test with q35 and scsihw2 tests: add test for legacy-igd passthrough pci: don't try to hotplug bridges pci: bridges: add bridges to devices up front src/PVE/QemuServer.pm | 100 +++++------------- src/PVE/QemuServer/Drive.pm | 2 +- src/PVE/QemuServer/DriveDevice.pm | 23 +++- src/PVE/QemuServer/PCI.pm | 68 +++++++++++- src/PVE/QemuServer/RNG.pm | 4 +- src/PVE/QemuServer/USB.pm | 8 +- .../cfg2cmd/linux-hostpci-legacy-igd.conf | 16 +++ .../cfg2cmd/linux-hostpci-legacy-igd.conf.cmd | 38 +++++++ src/test/cfg2cmd/q35-scsihw2.conf | 13 +++ src/test/cfg2cmd/q35-scsihw2.conf.cmd | 37 +++++++ src/test/run_config2command_tests.pl | 1 + 11 files changed, 225 insertions(+), 85 deletions(-) create mode 100644 src/test/cfg2cmd/linux-hostpci-legacy-igd.conf create mode 100644 src/test/cfg2cmd/linux-hostpci-legacy-igd.conf.cmd create mode 100644 src/test/cfg2cmd/q35-scsihw2.conf create mode 100644 src/test/cfg2cmd/q35-scsihw2.conf.cmd -- 2.47.3