* [PATCH] hw/pci-host/sabre: Mark unusable PCI busses as full to ease device plugging
@ 2026-02-16 15:49 Thomas Huth
2026-03-08 23:06 ` Mark Cave-Ayland
0 siblings, 1 reply; 3+ messages in thread
From: Thomas Huth @ 2026-02-16 15:49 UTC (permalink / raw)
To: qemu-devel, Mark Cave-Ayland
From: Thomas Huth <thuth@redhat.com>
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>
---
Note: Only lightly tested, it seems to work fine for me at a first glance,
but maybe I missed something...
hw/pci-host/sabre.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/hw/pci-host/sabre.c b/hw/pci-host/sabre.c
index cd2328ad53f..9c8519f3849 100644
--- a/hw/pci-host/sabre.c
+++ b/hw/pci-host/sabre.c
@@ -382,6 +382,7 @@ static void sabre_realize(DeviceState *dev, Error **errp)
&s->pci_mmio,
&s->pci_ioport,
0, 0x40, TYPE_PCI_BUS);
+ qbus_mark_full(&phb->bus->qbus);
pci_create_simple(phb->bus, 0, TYPE_SABRE_PCI_DEVICE);
@@ -400,6 +401,7 @@ static void sabre_realize(DeviceState *dev, Error **errp)
s->bridgeA = PCI_BRIDGE(pci_dev);
pci_bridge_map_irq(s->bridgeA, "pciA", pci_simbaA_map_irq);
pci_realize_and_unref(pci_dev, phb->bus, &error_fatal);
+ qbus_mark_full(&s->bridgeA->sec_bus.qbus);
}
static void sabre_init(Object *obj)
--
2.53.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] hw/pci-host/sabre: Mark unusable PCI busses as full to ease device plugging
2026-02-16 15:49 [PATCH] hw/pci-host/sabre: Mark unusable PCI busses as full to ease device plugging Thomas Huth
@ 2026-03-08 23:06 ` Mark Cave-Ayland
2026-03-09 18:09 ` Thomas Huth
0 siblings, 1 reply; 3+ messages in thread
From: Mark Cave-Ayland @ 2026-03-08 23:06 UTC (permalink / raw)
To: Thomas Huth, qemu-devel
On 16/02/2026 15:49, Thomas Huth wrote:
> From: Thomas Huth <thuth@redhat.com>
>
> 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>
> ---
> Note: Only lightly tested, it seems to work fine for me at a first glance,
> but maybe I missed something...
>
> hw/pci-host/sabre.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/hw/pci-host/sabre.c b/hw/pci-host/sabre.c
> index cd2328ad53f..9c8519f3849 100644
> --- a/hw/pci-host/sabre.c
> +++ b/hw/pci-host/sabre.c
> @@ -382,6 +382,7 @@ static void sabre_realize(DeviceState *dev, Error **errp)
> &s->pci_mmio,
> &s->pci_ioport,
> 0, 0x40, TYPE_PCI_BUS);
> + qbus_mark_full(&phb->bus->qbus);
>
> pci_create_simple(phb->bus, 0, TYPE_SABRE_PCI_DEVICE);
>
> @@ -400,6 +401,7 @@ static void sabre_realize(DeviceState *dev, Error **errp)
> s->bridgeA = PCI_BRIDGE(pci_dev);
> pci_bridge_map_irq(s->bridgeA, "pciA", pci_simbaA_map_irq);
> pci_realize_and_unref(pci_dev, phb->bus, &error_fatal);
> + qbus_mark_full(&s->bridgeA->sec_bus.qbus);
> }
>
> static void sabre_init(Object *obj)
Apologies for the delay on this: I think the patch makes logical sense, however the
existing logic to manage the available PCI slots is handled in sun4uv_init(). Do you
think it makes sense to move the qbus_mark_full() calls to the same place?
ATB,
Mark.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] hw/pci-host/sabre: Mark unusable PCI busses as full to ease device plugging
2026-03-08 23:06 ` Mark Cave-Ayland
@ 2026-03-09 18:09 ` Thomas Huth
0 siblings, 0 replies; 3+ messages in thread
From: Thomas Huth @ 2026-03-09 18:09 UTC (permalink / raw)
To: Mark Cave-Ayland, qemu-devel
On 09/03/2026 00.06, Mark Cave-Ayland wrote:
> On 16/02/2026 15:49, Thomas Huth wrote:
>
>> From: Thomas Huth <thuth@redhat.com>
>>
>> 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>
>> ---
>> Note: Only lightly tested, it seems to work fine for me at a first glance,
>> but maybe I missed something...
>>
>> hw/pci-host/sabre.c | 2 ++
>> 1 file changed, 2 insertions(+)
>>
>> diff --git a/hw/pci-host/sabre.c b/hw/pci-host/sabre.c
>> index cd2328ad53f..9c8519f3849 100644
>> --- a/hw/pci-host/sabre.c
>> +++ b/hw/pci-host/sabre.c
>> @@ -382,6 +382,7 @@ static void sabre_realize(DeviceState *dev, Error **errp)
>> &s->pci_mmio,
>> &s->pci_ioport,
>> 0, 0x40, TYPE_PCI_BUS);
>> + qbus_mark_full(&phb->bus->qbus);
>> pci_create_simple(phb->bus, 0, TYPE_SABRE_PCI_DEVICE);
>> @@ -400,6 +401,7 @@ static void sabre_realize(DeviceState *dev, Error **errp)
>> s->bridgeA = PCI_BRIDGE(pci_dev);
>> pci_bridge_map_irq(s->bridgeA, "pciA", pci_simbaA_map_irq);
>> pci_realize_and_unref(pci_dev, phb->bus, &error_fatal);
>> + qbus_mark_full(&s->bridgeA->sec_bus.qbus);
>> }
>> static void sabre_init(Object *obj)
>
> Apologies for the delay on this: I think the patch makes logical sense,
> however the existing logic to manage the available PCI slots is handled in
> sun4uv_init(). Do you think it makes sense to move the qbus_mark_full()
> calls to the same place?
That makes sense, indeed! I'll send a v2...
Thomas
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-03-09 18:10 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-16 15:49 [PATCH] hw/pci-host/sabre: Mark unusable PCI busses as full to ease device plugging Thomas Huth
2026-03-08 23:06 ` Mark Cave-Ayland
2026-03-09 18:09 ` Thomas Huth
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox