From: Dominik Csapak <d.csapak@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [PATCH qemu-server v3 8/8] cfg2cmd: pci: add pci.4 by default starting with machine version 11.1
Date: Tue, 8 Sep 2026 15:52:08 +0200 [thread overview]
Message-ID: <20260908135729.3869365-9-d.csapak@proxmox.com> (raw)
In-Reply-To: <20260908135729.3869365-1-d.csapak@proxmox.com>
Without that bridge, scsi14 and higher can't be hotplugged with lsi scsi
controllers (when the vm wasn't already started with such a disk), so
add it by default with the next machine version.
Add a test with a forced qemu version 11.1.
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
src/PVE/QemuServer.pm | 2 +-
src/PVE/QemuServer/PCI.pm | 4 +--
src/test/cfg2cmd/linux-bridges-qemu-11.1.conf | 14 ++++++++
.../cfg2cmd/linux-bridges-qemu-11.1.conf.cmd | 36 +++++++++++++++++++
4 files changed, 53 insertions(+), 3 deletions(-)
create mode 100644 src/test/cfg2cmd/linux-bridges-qemu-11.1.conf
create mode 100644 src/test/cfg2cmd/linux-bridges-qemu-11.1.conf.cmd
diff --git a/src/PVE/QemuServer.pm b/src/PVE/QemuServer.pm
index a5737f59..0294a0b3 100644
--- a/src/PVE/QemuServer.pm
+++ b/src/PVE/QemuServer.pm
@@ -3289,7 +3289,7 @@ sub config_to_command {
}
my $max_scsihw = PVE::QemuServer::DriveDevice::get_max_scsihw_index($conf);
- if (my $bridges = get_pci_bridges($conf, $arch, $q35, $max_scsihw)) {
+ if (my $bridges = get_pci_bridges($conf, $arch, $q35, $max_scsihw, $version_guard)) {
push @$devices, $bridges->@*;
}
diff --git a/src/PVE/QemuServer/PCI.pm b/src/PVE/QemuServer/PCI.pm
index 2d10f2e1..d7dc6121 100644
--- a/src/PVE/QemuServer/PCI.pm
+++ b/src/PVE/QemuServer/PCI.pm
@@ -884,7 +884,7 @@ sub reserve_pci_usage {
# Returns a list of bridge devices which are necessary for the remaining
# devices.
sub get_pci_bridges {
- my ($conf, $arch, $q35, $max_scsihw) = @_;
+ my ($conf, $arch, $q35, $max_scsihw, $version_guard) = @_;
my $bridges = {
# 0 => 1, always present
@@ -896,7 +896,7 @@ sub get_pci_bridges {
# some scsi controllers can only have 7 scsi disks per controller,
# so scsi14 and upwards need scsihw2,3,4 which live on bridge 4
- $bridges->{4} = 1 if $max_scsihw > 1;
+ $bridges->{4} = 1 if $max_scsihw > 1 || $version_guard->(11, 1);
# use cheap legacy igd check instead of a full parse_hostpci
my $legacy_igd = 0;
diff --git a/src/test/cfg2cmd/linux-bridges-qemu-11.1.conf b/src/test/cfg2cmd/linux-bridges-qemu-11.1.conf
new file mode 100644
index 00000000..fa9cc76b
--- /dev/null
+++ b/src/test/cfg2cmd/linux-bridges-qemu-11.1.conf
@@ -0,0 +1,14 @@
+# TEST: Test that bridge pci.4 is added by default in qemu 11.1
+# QEMU_VERSION: 11.1.0
+bootdisk: scsi0
+cores: 3
+ide2: none,media=cdrom
+memory: 768
+name: simple
+net0: virtio=A2:C0:43:77:08:A0,bridge=vmbr0
+numa: 0
+ostype: l26
+scsi0: local:8006/vm-8006-disk-0.qcow2,discard=on,size=104858K
+smbios1: uuid=7b10d7af-b932-4c66-b2c3-3996152ec465
+sockets: 1
+vmgenid: c773c261-d800-4348-9f5d-167fadd53cf8
diff --git a/src/test/cfg2cmd/linux-bridges-qemu-11.1.conf.cmd b/src/test/cfg2cmd/linux-bridges-qemu-11.1.conf.cmd
new file mode 100644
index 00000000..2aebdffa
--- /dev/null
+++ b/src/test/cfg2cmd/linux-bridges-qemu-11.1.conf.cmd
@@ -0,0 +1,36 @@
+/usr/bin/kvm \
+ -id 8006 \
+ -name simple \
+ -no-shutdown \
+ -chardev 'socket,id=qmp,path=/var/run/qemu-server/8006.qmp,server=on,wait=off' \
+ -mon 'chardev=qmp,mode=control' \
+ -chardev 'socket,id=qmp-event,path=/var/run/qmeventd.sock,reconnect-ms=5000' \
+ -mon 'chardev=qmp-event,mode=control' \
+ -pidfile /var/run/qemu-server/8006.pid \
+ -daemonize \
+ -smbios 'type=1,uuid=7b10d7af-b932-4c66-b2c3-3996152ec465' \
+ -smp '3,sockets=1,cores=3,maxcpus=3' \
+ -nodefaults \
+ -boot 'menu=on,strict=on,reboot-timeout=1000,splash=/usr/share/qemu-server/bootsplash.jpg' \
+ -vnc 'unix:/var/run/qemu-server/8006.vnc,password=on' \
+ -cpu kvm64,enforce,+kvm_pv_eoi,+kvm_pv_unhalt,+lahf_lm,+sep \
+ -m 768 \
+ -object '{"id":"throttle-drive-scsi0","limits":{},"qom-type":"throttle-group"}' \
+ -global 'PIIX4_PM.disable_s3=1' \
+ -global 'PIIX4_PM.disable_s4=1' \
+ -device 'pci-bridge,id=pci.1,chassis_nr=1,bus=pci.0,addr=0x1e' \
+ -device 'pci-bridge,id=pci.2,chassis_nr=2,bus=pci.0,addr=0x1f' \
+ -device 'pci-bridge,id=pci.4,chassis_nr=4,bus=pci.1,addr=0x1c' \
+ -device 'vmgenid,guid=c773c261-d800-4348-9f5d-167fadd53cf8' \
+ -device 'piix3-usb-uhci,id=uhci,bus=pci.0,addr=0x1.0x2' \
+ -device 'usb-tablet,id=tablet,bus=uhci.0,port=1' \
+ -device 'VGA,id=vga,bus=pci.0,addr=0x2' \
+ -device 'virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3,free-page-reporting=on' \
+ -iscsi 'initiator-name=iqn.1993-08.org.debian:01:aabbccddeeff' \
+ -device 'ide-cd,bus=ide.1,unit=0,id=ide2,bootindex=200' \
+ -device 'lsi,id=scsihw0,bus=pci.0,addr=0x5' \
+ -blockdev '{"detect-zeroes":"unmap","discard":"unmap","driver":"throttle","file":{"cache":{"direct":true,"no-flush":false},"detect-zeroes":"unmap","discard":"unmap","driver":"qcow2","file":{"aio":"io_uring","cache":{"direct":true,"no-flush":false},"detect-zeroes":"unmap","discard":"unmap","driver":"file","filename":"/var/lib/vz/images/8006/vm-8006-disk-0.qcow2","node-name":"ecd04be4259153b8293415fefa2a84c","read-only":false},"node-name":"fcd04be4259153b8293415fefa2a84c","read-only":false},"node-name":"drive-scsi0","read-only":false,"throttle-group":"throttle-drive-scsi0"}' \
+ -device 'scsi-hd,bus=scsihw0.0,scsi-id=0,drive=drive-scsi0,id=scsi0,device_id=drive-scsi0,bootindex=100,write-cache=on' \
+ -netdev 'type=tap,id=net0,ifname=tap8006i0,script=/usr/libexec/qemu-server/pve-bridge,downscript=/usr/libexec/qemu-server/pve-bridgedown,vhost=on' \
+ -device 'virtio-net-pci,mac=A2:C0:43:77:08:A0,netdev=net0,bus=pci.0,addr=0x12,id=net0,rx_queue_size=1024,tx_queue_size=256,bootindex=300,host_mtu=1500,host_tunnel=off' \
+ -machine 'hpet=off,type=pc+pve0'
--
2.47.3
prev parent reply other threads:[~2026-09-08 13:58 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-08 13:52 [PATCH qemu-server v3 0/8] pci: bridges: cleanup and hotplug fix Dominik Csapak
2026-09-08 13:52 ` [PATCH qemu-server v3 1/8] tests: cfg2cmd: add test for ivshmem with q35 Dominik Csapak
2026-09-08 13:52 ` [PATCH qemu-server v3 2/8] tests: cfg2cmd: add q35 + win7 + hostpci test Dominik Csapak
2026-09-08 13:52 ` [PATCH qemu-server v3 3/8] code cleanup: pci: don't export print_pcie_root_port Dominik Csapak
2026-09-08 13:52 ` [PATCH qemu-server v3 4/8] code cleanup: hot-plug: simplify getting bridge for device Dominik Csapak
2026-09-08 13:52 ` [PATCH qemu-server v3 5/8] hotplug: don't try to hotplug bridges Dominik Csapak
2026-09-08 13:52 ` [PATCH qemu-server v3 6/8] cfg2cmd: reject guests with machine version below 5.0 Dominik Csapak
2026-09-08 13:52 ` [PATCH qemu-server v3 7/8] cfg2cmd: pci: add bridges to device list up front Dominik Csapak
2026-09-08 13:52 ` Dominik Csapak [this message]
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=20260908135729.3869365-9-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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox