]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
hw/sparc64/sun4u: Mark unusable PCI busses as full to ease device plugging
authorThomas Huth <thuth@redhat.com>
Mon, 9 Mar 2026 18:14:52 +0000 (19:14 +0100)
committerPhilippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Wed, 15 Jul 2026 13:50:22 +0000 (15:50 +0200)
When trying to plug a PCI device to a Sparc64 machine, you currently
have to specify the right bus ("bus=pciB"), otherwise you get this error:

 $ qemu-system-sparc64 -device virtio-scsi-pci
 qemu-system-sparc64: -device virtio-scsi-pci: PCI: no slot/function
 available for virtio-scsi-pci, all in use or reserved

This is quite annoying for the unexperienced users, and it also breaks
e.g. the iotests ("make check-block") when running with qemu-system-sparc64.

Mark the non-usable PCI busses as full now, so that QEMU can automatically
plug new PCI devices to the right "pciB" bus.

Signed-off-by: Thomas Huth <thuth@redhat.com>
Message-ID: <20260309181452.83702-1-thuth@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
hw/sparc64/sun4u.c

index d69ed9a81ac241d538bc9bd86c2f6dec8801e499..a348096aee6fd0f73975285b1a387af1f845dad5 100644 (file)
@@ -719,6 +719,13 @@ static void sun4uv_init(MemoryRegion *address_space_mem,
     fw_cfg_add_i16(fw_cfg, FW_CFG_SPARC64_DEPTH, graphic_depth);
 
     qemu_register_boot_set(fw_cfg_boot_set, fw_cfg);
+
+    /*
+     * Mark internal PCI busses as full so that the plugging of additional
+     * PCI devices happens on the right bus that still has free slots:
+     */
+    qbus_mark_full(&pci_bus->qbus);
+    qbus_mark_full(&pci_busA->qbus);
 }
 
 enum {