hw/sparc64/sun4u: Mark unusable PCI busses as full to ease device plugging
PATCH v2 1/1 hw/sparc64/sun4u: Mark unusable PCI busses as full to ease device plugging
From: Thomas Huth <[email protected]>
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.
---
v2: Do the change in the machine code, not in the sabre device
hw/sparc64/sun4u.c | 7 +++++++ 1 file changed, 7 insertions(+)
hw/sparc64/sun4u.c +7 -0
@@ -723,6 +723,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 {
Signature · 1 line
2.53.0
Quoted 30 lines · Thomas Huth
From: Thomas Huth <[email protected]>
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 reservedThis 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 <[email protected]>---
v2: Do the change in the machine code, not in the sabre devicehw/sparc64/sun4u.c | 7 +++++++ 1 file changed, 7 insertions(+)hw/sparc64/sun4u.c +0
-0@@ -723,6 +723,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);
hw/sparc64/sun4u.c static void sun4uv_init(MemoryRegion *address_space_mem, · line 735
Quoted 10 lines
hw/sparc64/sun4u.c +7
-0+ +/* +* 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 {
Friendly ping!
Thomas
Quoted 35 lines · Thomas Huth
Quoted 34 lines · Thomas Huth
From: Thomas Huth <[email protected]>
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 reservedThis 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 <[email protected]>---
v2: Do the change in the machine code, not in the sabre device
hw/sparc64/sun4u.c| 7 +++++++1 file changed, 7 insertions(+)hw/sparc64/sun4u.c +3
-0@@ -723,6 +723,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
Quoted 8 lines
Quoted 6 lines
+ * 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 {Friendly ping!
This, being a simple change, somehow has not been reviewed still, so it's sitting in the queue...
/mjt
Quoted 43 lines · Michael Tokarev
Quoted 33 lines · Thomas Huth
Quoted 32 lines · Thomas Huth
From: Thomas Huth <[email protected]>
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 reservedThis 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 <[email protected]>---
v2: Do the change in the machine code, not in the sabre device
hw/sparc64/sun4u.c| 7 +++++++1 file changed, 7 insertions(+)hw/sparc64/sun4u.c +3
-0@@ -723,6 +723,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 Quoted 8 lines
hw/sparc64/sun4u.c static void sun4uv_init(MemoryRegion *address_space_mem, · line 735
Quoted 6 lines
hw/sparc64/sun4u.c +4
-0+* 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 {Friendly ping!
Quoted 2 lines
This, being a simple change, somehow has not been reviewed still, so it's sitting in the queue...
Yes, apologies - I've been absolutely flat out recently, and I've got a note to take a look at this and Peter's patch as soon as I can.
Is this fixing an urgent issue with "make check-block" or similar?
ATB,
Mark.
Quoted 46 lines · Mark Cave-Ayland
Quoted 44 lines · Michael Tokarev
Quoted 42 lines · Thomas Huth
Quoted 29 lines · Thomas Huth
From: Thomas Huth <[email protected]>
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 reservedThis 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 <[email protected]>---
v2: Do the change in the machine code, not in the sabre device
hw/sparc64/sun4u.c| 7 +++++++1 file changed, 7 insertions(+)hw/sparc64/sun4u.c +0
-0@@ -723,6 +723,13 @@ static void sun4uv_init(MemoryRegion *address_space_mem, fw_cfg_add_i16(fw_cfg, FW_CFG_SPARC64_DEPTH, graphic_depth);hw/sparc64/sun4u.c static void sun4uv_init(MemoryRegion · line 734
Quoted 10 lines
hw/sparc64/sun4u.c +7
-0qemu_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 {Friendly ping!
Quoted 6 lines
Quoted 2 lines
This, being a simple change, somehow has not been reviewed still, so it's sitting in the queue...
Yes, apologies - I've been absolutely flat out recently, and I've got a note to take a look at this and Peter's patch as soon as I can.
Is this fixing an urgent issue with "make check-block" or similar?
It's not urgent since this has been broken forever, but yes, it fixes "make check-block" for the case where sparc64 is the only available target during "configure --target-list=sparc64-softmmu" and thus the iotests run with qemu-system-sparc64.
Thomas
Quoted 48 lines · Thomas Huth
Quoted 47 lines · Mark Cave-Ayland
Quoted 45 lines · Michael Tokarev
Quoted 43 lines · Thomas Huth
Quoted 33 lines · Thomas Huth
From: Thomas Huth <[email protected]>
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 reservedThis 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 <[email protected]>---
v2: Do the change in the machine code, not in the sabre device
hw/sparc64/sun4u.c| 7 +++++++1 file changed, 7 insertions(+)hw/sparc64/sun4u.c +3
-0@@ -723,6 +723,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 Quoted 7 lines
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 {Friendly ping!
Quoted 8 lines
Quoted 6 lines
Quoted 2 lines
This, being a simple change, somehow has not been reviewed still, so it's sitting in the queue...
Yes, apologies - I've been absolutely flat out recently, and I've got a note to take a look at this and Peter's patch as soon as I can.
Is this fixing an urgent issue with "make check-block" or similar?
It's not urgent since this has been broken forever, but yes, it fixes "make check-block" for the case where sparc64 is the only available target during "configure --target-list=sparc64-softmmu" and thus the iotests run with qemu-system-sparc64.
Ping!
While it's not urgent, soft-freeze date is in a week, so it would be nice to get this merged before it misses another release ... WDYT?
Thanks,
Thomas
Philippe Mathieu-Daudé
AppliedQuoted 1 line · Thomas Huth
While it's not urgent, soft-freeze date is in a week, so it would be nice to get this merged before it misses another release ... WDYT?
Queued via hw-misc, thanks!
Phil.
Quoted 50 lines · Thomas Huth
Quoted 49 lines · Thomas Huth
Quoted 48 lines · Mark Cave-Ayland
Quoted 45 lines · Michael Tokarev
Quoted 33 lines · Thomas Huth
Quoted 32 lines · Thomas Huth
From: Thomas Huth <[email protected]>
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 reservedThis 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 <[email protected]>---
v2: Do the change in the machine code, not in the sabre device
hw/sparc64/sun4u.c| 7 +++++++1 file changed, 7 insertions(+)hw/sparc64/sun4u.c +3
-0@@ -723,6 +723,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 Quoted 8 lines
hw/sparc64/sun4u.c static void sun4uv_init(MemoryRegion *address_space_mem, · line 735
Quoted 6 lines
hw/sparc64/sun4u.c +4
-0+* 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 {Friendly ping!
This, being a simple change, somehow has not been reviewed still, so it's sitting in the queue...
Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
Yes, apologies - I've been absolutely flat out recently, and I've got a note to take a look at this and Peter's patch as soon as I can.
Is this fixing an urgent issue with "make check-block" or similar?
It's not urgent since this has been broken forever, but yes, it fixes "make check- block" for the case where sparc64 is the only available target during "configure -- target-list=sparc64-softmmu" and thus the iotests run with qemu-system-sparc64.
Ping!
While it's not urgent, soft-freeze date is in a week, so it would be nice to get this merged before it misses another release ... WDYT?
Hi Thomas,
I'm still playing catch-up a bit here, but I can't immediately find my notes on using pciA under QEMU. I think if it fixes the iotests then go ahead and merge it for now, which gives me time in freeze to investigate any reported issues.
ATB,
Mark.
Hi,
Quoted 59 lines · Mark Cave-Ayland
Quoted 57 lines · Thomas Huth
Quoted 56 lines · Thomas Huth
Quoted 54 lines · Mark Cave-Ayland
Quoted 46 lines · Michael Tokarev
Quoted 36 lines · Thomas Huth
Quoted 35 lines · Thomas Huth
From: Thomas Huth <[email protected]>
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 reservedThis 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 <[email protected]>---
v2: Do the change in the machine code, not in the sabre device
hw/sparc64/sun4u.c| 7 +++++++1 file changed, 7 insertions(+)hw/sparc64/sun4u.c +3
-0@@ -723,6 +723,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 freeQuoted 8 lines
Quoted 6 lines
slots:
+ */
+qbus_mark_full(&pci_bus->qbus);
+qbus_mark_full(&pci_busA->qbus);
}
enum {Friendly ping!
Quoted 2 lines
This, being a simple change, somehow has not been reviewed still, so it's sitting in the queue...
Yes, apologies - I've been absolutely flat out recently, and I've got a note to take a look at this and Peter's patch as soon as I can.
Is this fixing an urgent issue with "make check-block" or similar?
Quoted 8 lines
Quoted 4 lines
Quoted 1 line
It's not urgent since this has been broken forever, but yes, it fixes "make check- block" for the case where sparc64 is the only available target during "configure -- target-list=sparc64-softmmu" and thus the iotests run with qemu-system-sparc64.
Ping!
While it's not urgent, soft-freeze date is in a week, so it would be nice to get this merged before it misses another release ... WDYT?
Hi Thomas,
I'm still playing catch-up a bit here, but I can't immediately find my notes on using pciA under QEMU. I think if it fixes the iotests then go ahead and merge it for now, which gives me time in freeze to investigate any reported issues.
I wasn't sure whether merging this patch now or wait for your update during the freeze so hold my PR for a bit; today I looked a bit at it.
Some notes:
- pci_bus_*_slot_reserved_mask() API isn't much used. I supposed it worked for a pair of corner cases but doesn't scale (I expect it to be called in more code paths).
- Bus capacity is odd. We have a generic Bus-class @max_dev field but do not use it with PCI variants. If set, it limit the instances capacity. The capacity is tracked in the instance state, and when no @max_dev is set the only way to mark a bus full is using the qbus_mark_full() helper. Then if we remove devices, the bus remains full, and there is no helper to restore available slots.
Anyway, back to the problem here, the first part is indeed as noticed Thomas to use qbus_mark_full() for the root bus:
-- >8 --
hw/pci-host/sabre.c +3 -0
@@ -400,6 +400,9 @@ 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); + +/* Only in-built Simba APBs can exist on the root bus */ +qbus_mark_full (&phb->bus->qbus); }static void sabre_init (Object *obj)
hw/sparc64/sun4u.c +0 -0
@@ -546,7 +546,7 @@ static void sun4uv_init(MemoryRegion *address_space_mem,unsigned int i; uint64_t initrd_addr, initrd_size, kernel_addr, kernel_size,
kernel_entry;
SabreState *sabre;
- PCIBus *pci_bus, *pci_busA, *pci_busB;
+ PCIBus *pci_busA, *pci_busB;
PCIDevice *ebus, *pci_dev;
SysBusDevice *s;
DeviceState *iommu, *dev;
@@ -588,14 +588,13 @@ static void sun4uv_init(MemoryRegion *address_space_mem,
qdev_get_gpio_in_named(DEVICE(cpu), "ivec-irq", i));
}- pci_bus = PCI_HOST_BRIDGE(sabre)->bus;
pci_busA = pci_bridge_get_sec_bus(sabre->bridgeA);
pci_busB = pci_bridge_get_sec_bus(sabre->bridgeB);- /* Only in-built Simba APBs can exist on the root bus, slot 0 on busA is
- reserved (leaving no slots free after on-board devices) however slots
- 0-3 are free on busB */
- pci_bus_set_slot_reserved_mask(pci_bus, 0xfffffffc);
+ /*
+ * Slot 0 on busA is reserved (leaving no slots free after on-board
+ * devices) however slots 0-3 are free on busB
+ */
pci_bus_set_slot_reserved_mask(pci_busA, 0xfffffff1);
pci_bus_set_slot_reserved_mask(pci_busB, 0xfffffff0);---
I'm still looking at the 2nd part, the reserved slots.
Quoted 6 lines · Philippe Mathieu-Daudé
- Bus capacity is odd. We have a generic Bus-class @max_dev field but do not use it with PCI variants. If set, it limit the instances capacity. The capacity is tracked in the instance state, and when no @max_dev is set the only way to mark a bus full is using the
qbus_mark_full()helper. Then if we remove devices, the bus remains full, and there is no helper to restore available slots.
The qbus_mark_full() function is intended for the use case where a machine has a bus which in real hardware is entirely internal, so you have something like an I2C bus which has some on-board I2C devices connected to it, but there's no external socket that the user could add more to the bus for. The idea is that the machine model creates all the devices for this bus, then marks it as full. The devices never get removed from the bus, because they're hardwired in, not user-unpluggable.
thanks
-- PMM
Quoted 9 lines · Peter Maydell
Quoted 6 lines · Philippe Mathieu-Daudé
- Bus capacity is odd. We have a generic Bus-class @max_dev field but do not use it with PCI variants. If set, it limit the instances capacity. The capacity is tracked in the instance state, and when no @max_dev is set the only way to mark a bus full is using the
qbus_mark_full()helper. Then if we remove devices, the bus remains full, and there is no helper to restore available slots.
Quoted 8 lines
The
qbus_mark_full()function is intended for the use case where a machine has a bus which in real hardware is entirely internal, so you have something like an I2C bus which has some on-board I2C devices connected to it, but there's no external socket that the user could add more to the bus for. The idea is that the machine model creates all the devices for this bus, then marks it as full. The devices never get removed from the bus, because they're hardwired in, not user-unpluggable.
Are you saying, while this happens to work correctly for the Ultrasparc Sabre PCI host bridge, this is not the appropriate API to use? I understand the I2C example when the lines are populated within a board but can't be accessed outside of it (like our CLI -devices), but what about this Sabre case, the bus is internal to the chipset; can we consider it a full bus or should we use the BusClass::max_dev property instead?
Quoted 128 lines · Philippe Mathieu-Daudé
Hi,
Quoted 59 lines · Mark Cave-Ayland
Quoted 57 lines · Thomas Huth
Quoted 56 lines · Thomas Huth
Quoted 54 lines · Mark Cave-Ayland
Quoted 46 lines · Michael Tokarev
Quoted 36 lines · Thomas Huth
Quoted 35 lines · Thomas Huth
From: Thomas Huth <[email protected]>
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 reservedThis 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 <[email protected]>---
v2: Do the change in the machine code, not in the sabre device
hw/sparc64/sun4u.c| 7 +++++++1 file changed, 7 insertions(+)hw/sparc64/sun4u.c +3
-0@@ -723,6 +723,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 freeQuoted 8 lines
Quoted 6 lines
slots:
+ */
+qbus_mark_full(&pci_bus->qbus);
+qbus_mark_full(&pci_busA->qbus);
}
enum {Friendly ping!
Quoted 2 lines
This, being a simple change, somehow has not been reviewed still, so it's sitting in the queue...
Yes, apologies - I've been absolutely flat out recently, and I've got a note to take a look at this and Peter's patch as soon as I can.
Is this fixing an urgent issue with "make check-block" or similar?
Quoted 8 lines
Quoted 4 lines
Quoted 1 line
It's not urgent since this has been broken forever, but yes, it fixes "make check- block" for the case where sparc64 is the only available target during "configure -- target-list=sparc64-softmmu" and thus the iotests run with qemu-system-sparc64.
Ping!
While it's not urgent, soft-freeze date is in a week, so it would be nice to get this merged before it misses another release ... WDYT?
Hi Thomas,
I'm still playing catch-up a bit here, but I can't immediately find my notes on using pciA under QEMU. I think if it fixes the iotests then go ahead and merge it for now, which gives me time in freeze to investigate any reported issues.
Anyway, back to the problem here, the first part is indeed as noticed Thomas to use
qbus_mark_full()for the root bus:-- >8 --
hw/pci-host/sabre.c +3
-0@@ -400,6 +400,9 @@ 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); + + /* Only in-built Simba APBs can exist on the root bus */ + qbus_mark_full(&phb->bus->qbus); }static void
sabre_init(Object *obj)hw/sparc64/sun4u.c +1
-1@@ -546,7 +546,7 @@ static void sun4uv_init(MemoryRegion *address_space_mem, unsigned int i; uint64_t initrd_addr, initrd_size, kernel_addr, kernel_size, kernel_entry; SabreState *sabre; - PCIBus *pci_bus, *pci_busA, *pci_busB; + PCIBus *pci_busA, *pci_busB; PCIDevice *ebus, *pci_dev;SysBusDevice *s;
DeviceState *iommu, *dev;hw/sparc64/sun4u.c +0
-2@@ -588,14 +588,13 @@ static void sun4uv_init(MemoryRegion *address_space_mem, qdev_get_gpio_in_named(DEVICE(cpu), "ivec-irq", i)); } - pci_bus = PCI_HOST_BRIDGE(sabre)->bus; pci_busA = pci_bridge_get_sec_bus(sabre->bridgeA); pci_busB = pci_bridge_get_sec_bus(sabre->bridgeB); - /* Only in-built Simba APBs can exist on the root bus, slot 0 onbusA is
- reserved (leaving no slots free after on-board devices) however slots
- 0-3 are free on busB */
-pci_bus_set_slot_reserved_mask(pci_bus, 0xfffffffc);
+ /*
+ * Slot 0 on busA is reserved (leaving no slots free after on-board + * devices) however slots 0-3 are free on busB
+ */
pci_bus_set_slot_reserved_mask(pci_busA, 0xfffffff1);pci_bus_set_slot_reserved_mask(pci_busB, 0xfffffff0);
Quoted 3 lines
---
I'm still looking at the 2nd part, the reserved slots.
(Because with this patch, the test passes as we can plug devices from the command line, but they end plugged on pciA instead of pciB -- thus the 2nd part missing).
Quoted 120 lines · Philippe Mathieu-Daudé
Quoted 119 lines · Philippe Mathieu-Daudé
Hi,
Quoted 56 lines · Mark Cave-Ayland
Quoted 54 lines · Thomas Huth
Quoted 53 lines · Thomas Huth
Quoted 51 lines · Mark Cave-Ayland
Quoted 43 lines · Michael Tokarev
Quoted 33 lines · Thomas Huth
Quoted 32 lines · Thomas Huth
From: Thomas Huth <[email protected]>
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 reservedThis 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 <[email protected]>---
v2: Do the change in the machine code, not in the sabre device
hw/sparc64/sun4u.c| 7 +++++++1 file changed, 7 insertions(+)hw/sparc64/sun4u.c +3
-0@@ -723,6 +723,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 Quoted 8 lines
hw/sparc64/sun4u.c static void sun4uv_init(MemoryRegion *address_space_mem, · line 733
Quoted 6 lines
hw/sparc64/sun4u.c +4
-0+* 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 {Friendly ping!
Quoted 2 lines
This, being a simple change, somehow has not been reviewed still, so it's sitting in the queue...
Yes, apologies - I've been absolutely flat out recently, and I've got a note to take a look at this and Peter's patch as soon as I can.
Is this fixing an urgent issue with "make check-block" or similar?
Quoted 8 lines
Quoted 4 lines
Quoted 1 line
It's not urgent since this has been broken forever, but yes, it fixes "make check- block" for the case where sparc64 is the only available target during "configure -- target-list=sparc64-softmmu" and thus the iotests run with qemu- system-sparc64.
Ping!
While it's not urgent, soft-freeze date is in a week, so it would be nice to get this merged before it misses another release ... WDYT?
Hi Thomas,
I'm still playing catch-up a bit here, but I can't immediately find my notes on using pciA under QEMU. I think if it fixes the iotests then go ahead and merge it for now, which gives me time in freeze to investigate any reported issues.
Anyway, back to the problem here, the first part is indeed as noticed Thomas to use
qbus_mark_full()for the root bus:-- >8 --
hw/pci-host/sabre.c +3
-0@@ -400,6 +400,9 @@ 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); + + /* Only in-built Simba APBs can exist on the root bus */ + qbus_mark_full(&phb->bus->qbus); } static void sabre_init(Object *obj)hw/sparc64/sun4u.c +5
-6@@ -546,7 +546,7 @@ static void sun4uv_init(MemoryRegion *address_space_mem, unsigned int i; uint64_t initrd_addr, initrd_size, kernel_addr, kernel_size, kernel_entry; SabreState *sabre; - PCIBus *pci_bus, *pci_busA, *pci_busB; + PCIBus *pci_busA, *pci_busB; PCIDevice *ebus, *pci_dev; SysBusDevice *s; DeviceState *iommu, *dev;@@ -588,14 +588,13 @@ static void sun4uv_init(MemoryRegion *address_space_mem, qdev_get_gpio_in_named(DEVICE(cpu), "ivec-irq", i)); } - pci_bus = PCI_HOST_BRIDGE(sabre)->bus; pci_busA = pci_bridge_get_sec_bus(sabre->bridgeA); pci_busB = pci_bridge_get_sec_bus(sabre->bridgeB); - /* Only in-built Simba APBs can exist on the root bus, slot 0 on busA is - reserved (leaving no slots free after on-board devices) however slots - 0-3 are free on busB */ - pci_bus_set_slot_reserved_mask(pci_bus, 0xfffffffc); + /* + * Slot 0 on busA is reserved (leaving no slots free after on-board + * devices) however slots 0-3 are free on busB + */ pci_bus_set_slot_reserved_mask(pci_busA, 0xfffffff1); pci_bus_set_slot_reserved_mask(pci_busB, 0xfffffff0);
Quoted 7 lines
Quoted 3 lines
---
I'm still looking at the 2nd part, the reserved slots.
(Because with this patch, the test passes as we can plug devices from the command line, but they end plugged on pciA instead of pciB -- thus the 2nd part missing).
Thanks for taking a look, Phil. IIRC the reason I added slot_reserved_mask was so that it was possible to populate pciA programatically in sun4uv_init(), and then enable the mask so that specifying an additional PCI device using -device on the command line without an explict PCI bus would cause the automatic allocation to place the device on pciB.
ATB,
Mark.
Hey Mark,
Quoted 132 lines · Mark Cave-Ayland
Quoted 130 lines · Philippe Mathieu-Daudé
Quoted 129 lines · Philippe Mathieu-Daudé
Hi,
Quoted 59 lines · Mark Cave-Ayland
Quoted 57 lines · Thomas Huth
Quoted 56 lines · Thomas Huth
Quoted 54 lines · Mark Cave-Ayland
Quoted 46 lines · Michael Tokarev
Quoted 36 lines · Thomas Huth
Quoted 35 lines · Thomas Huth
From: Thomas Huth <[email protected]>
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 reservedThis 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 <[email protected]>---
v2: Do the change in the machine code, not in the sabre device
hw/sparc64/sun4u.c| 7 +++++++1 file changed, 7 insertions(+)hw/sparc64/sun4u.c +3
-0@@ -723,6 +723,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 hasQuoted 8 lines
Quoted 6 lines
free slots:
+ */
+qbus_mark_full(&pci_bus->qbus);
+qbus_mark_full(&pci_busA->qbus);
}
enum {Friendly ping!
Quoted 2 lines
This, being a simple change, somehow has not been reviewed still, so it's sitting in the queue...
Yes, apologies - I've been absolutely flat out recently, and I've got a note to take a look at this and Peter's patch as soon as I can.
Is this fixing an urgent issue with "make check-block" or similar?
Quoted 8 lines
Quoted 4 lines
Quoted 1 line
It's not urgent since this has been broken forever, but yes, it fixes "make check- block" for the case where sparc64 is the only available target during "configure -- target-list=sparc64-softmmu" and thus the iotests run with qemu- system-sparc64.
Ping!
While it's not urgent, soft-freeze date is in a week, so it would be nice to get this merged before it misses another release ... WDYT?
Hi Thomas,
I'm still playing catch-up a bit here, but I can't immediately find my notes on using pciA under QEMU. I think if it fixes the iotests then go ahead and merge it for now, which gives me time in freeze to investigate any reported issues.
Anyway, back to the problem here, the first part is indeed as noticed Thomas to use
qbus_mark_full()for the root bus:-- >8 --
hw/pci-host/sabre.c +3
-0@@ -400,6 +400,9 @@ 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); + + /* Only in-built Simba APBs can exist on the root bus */ + qbus_mark_full(&phb->bus->qbus); }static void
sabre_init(Object *obj)hw/sparc64/sun4u.c +1
-1@@ -546,7 +546,7 @@ static void sun4uv_init(MemoryRegion *address_space_mem, unsigned int i; uint64_t initrd_addr, initrd_size, kernel_addr, kernel_size, kernel_entry; SabreState *sabre; - PCIBus *pci_bus, *pci_busA, *pci_busB; + PCIBus *pci_busA, *pci_busB; PCIDevice *ebus, *pci_dev; SysBusDevice *s;DeviceState *iommu, *dev;
hw/sparc64/sun4u.c +0
-2@@ -588,14 +588,13 @@ static void sun4uv_init(MemoryRegion *address_space_mem, qdev_get_gpio_in_named(DEVICE(cpu), "ivec-irq", i)); } - pci_bus = PCI_HOST_BRIDGE(sabre)->bus; pci_busA = pci_bridge_get_sec_bus(sabre->bridgeA); pci_busB = pci_bridge_get_sec_bus(sabre->bridgeB); - /* Only in-built Simba APBs can exist on the root bus, slot 0 onbusA is
- reserved (leaving no slots free after on-board devices) however slots
- 0-3 are free on busB */
-pci_bus_set_slot_reserved_mask(pci_bus, 0xfffffffc);
+ /*
+ * Slot 0 on busA is reserved (leaving no slots free after on-board + * devices) however slots 0-3 are free on busB
+ */
pci_bus_set_slot_reserved_mask(pci_busA, 0xfffffff1);pci_bus_set_slot_reserved_mask(pci_busB, 0xfffffff0);---
Quoted 7 lines
Quoted 5 lines
Quoted 1 line
I'm still looking at the 2nd part, the reserved slots.
(Because with this patch, the test passes as we can plug devices from the command line, but they end plugged on pciA instead of pciB -- thus the 2nd part missing).
Thanks for taking a look, Phil. IIRC the reason I added
slot_reserved_maskwas so that it was possible to populate pciA programatically insun4uv_init(), and then enable the mask so that specifying an additional PCI device using -device on the command line without an explict PCI bus would cause the automatic allocation to place the device on pciB.
The slot_reserved_mask calls make sense, but AFAICT they don't work as expected, since CLI devices are added on pciA. If you want to have a look on top of this snippet, be my guest! Otherwise I'll continue debugging that tomorrow, long day and late here :\
Regards,
Phil.
Quoted 20 lines · Philippe Mathieu-Daudé
Quoted 9 lines · Peter Maydell
Quoted 6 lines · Philippe Mathieu-Daudé
- Bus capacity is odd. We have a generic Bus-class @max_dev field but do not use it with PCI variants. If set, it limit the instances capacity. The capacity is tracked in the instance state, and when no @max_dev is set the only way to mark a bus full is using the
qbus_mark_full()helper. Then if we remove devices, the bus remains full, and there is no helper to restore available slots.Quoted 8 lines
The
qbus_mark_full()function is intended for the use case where a machine has a bus which in real hardware is entirely internal, so you have something like an I2C bus which has some on-board I2C devices connected to it, but there's no external socket that the user could add more to the bus for. The idea is that the machine model creates all the devices for this bus, then marks it as full. The devices never get removed from the bus, because they're hardwired in, not user-unpluggable.
Quoted 7 lines
Are you saying, while this happens to work correctly for the Ultrasparc Sabre PCI host bridge, this is not the appropriate API to use? I understand the I2C example when the lines are populated within a board but can't be accessed outside of it (like our CLI -devices), but what about this Sabre case, the bus is internal to the chipset; can we consider it a full bus or should we use the
BusClass::max_devproperty instead?
If the bus is internal to the chipset then qbus_mark_full() sounds fine -- the only devices that will be put on the bus are the ones the machine itself creates, and the bus isn't intended to be available for users to dynamically add more.
It looks from a quick grep like the only use we make of BusClass::max_dev is that we set it to 1 for:
- PCI controllers that have a single root complex
- virtio transports, because you can plug exactly one virtio backend into a transport
Did I miss any other uses?
-- PMM
Quoted 30 lines · Philippe Mathieu-Daudé
Quoted 29 lines · Mark Cave-Ayland
Quoted 25 lines · Philippe Mathieu-Daudé
Quoted 18 lines
-
pci_bus= PCI_HOST_BRIDGE(sabre)->bus;pci_busA=pci_bridge_get_sec_bus(sabre->bridgeA);pci_busB=pci_bridge_get_sec_bus(sabre->bridgeB);- /* Only in-built Simba APBs can exist on the root bus, slot 0 on busA is
- reserved (leaving no slots free after on-board devices) however slots
- 0-3 are free on busB */
-pci_bus_set_slot_reserved_mask(pci_bus, 0xfffffffc); + /*
+ * Slot 0 on busA is reserved (leaving no slots free after on- board
+ * devices) however slots 0-3 are free on busB
+ */
pci_bus_set_slot_reserved_mask(pci_busA, 0xfffffff1);pci_bus_set_slot_reserved_mask(pci_busB, 0xfffffff0);Quoted 3 lines
---
I'm still looking at the 2nd part, the reserved slots.
(Because with this patch, the test passes as we can plug devices from the command line, but they end plugged on pciA instead of pciB -- thus the 2nd part missing).
Quoted 6 lines
Quoted 1 line
Thanks for taking a look, Phil. IIRC the reason I added
slot_reserved_maskwas so that it was possible to populate pciA programatically insun4uv_init(), and then enable the mask so that specifying an additional PCI device using -device on the command line without an explict PCI bus would cause the automatic allocation to place the device on pciB.The
slot_reserved_maskcalls make sense, but AFAICT they don't work as expected, since CLI devices are added on pciA. If you want to have a look on top of this snippet, be my guest! Otherwise I'll continue debugging that tomorrow, long day and late here :\
Generic PCI fix posted here:
https://lore.kernel.org/qemu-devel/[email protected]/
Hi Thomas,
Quoted 5 lines · Philippe Mathieu-Daudé
Quoted 1 line · Thomas Huth
While it's not urgent, soft-freeze date is in a week, so it would be nice to get this merged before it misses another release ... WDYT?
Queued via hw-misc, thanks!
I wanted to help with what appeared to be a trivial fix, but ended putting myself into troubles for the soft-freeze day, so I'm going to drop this patch. As Mark noticed, the issue can still be worked on until the hard freeze.
Regards,
Phil.
Quoted 30 lines · Philippe Mathieu-Daudé
Quoted 29 lines · Philippe Mathieu-Daudé
Quoted 27 lines · Mark Cave-Ayland
Quoted 15 lines · Philippe Mathieu-Daudé
Quoted 15 lines
-
pci_bus= PCI_HOST_BRIDGE(sabre)->bus;pci_busA=pci_bridge_get_sec_bus(sabre->bridgeA);pci_busB=pci_bridge_get_sec_bus(sabre->bridgeB);- /* Only in-built Simba APBs can exist on the root bus, slot 0 on busA is - reserved (leaving no slots free after on-board devices) however slots - 0-3 are free on busB */
-pci_bus_set_slot_reserved_mask(pci_bus, 0xfffffffc);
+ /*
+ * Slot 0 on busA is reserved (leaving no slots free after on- board + * devices) however slots 0-3 are free on busB
+ */
pci_bus_set_slot_reserved_mask(pci_busA, 0xfffffff1);pci_bus_set_slot_reserved_mask(pci_busB, 0xfffffff0);Quoted 7 lines
Quoted 3 lines
---
I'm still looking at the 2nd part, the reserved slots.
(Because with this patch, the test passes as we can plug devices from the command line, but they end plugged on pciA instead of pciB -- thus the 2nd part missing).
Thanks for taking a look, Phil. IIRC the reason I added
slot_reserved_maskwas so that it was possible to populate pciA programatically insun4uv_init(), and then enable the mask so that specifying an additional PCI device using -device on the command line without an explict PCI bus would cause the automatic allocation to place the device on pciB.
Quoted 7 lines
Quoted 4 lines
The
slot_reserved_maskcalls make sense, but AFAICT they don't work as expected, since CLI devices are added on pciA. If you want to have a look on top of this snippet, be my guest! Otherwise I'll continue debugging that tomorrow, long day and late here :\Generic PCI fix posted here:
https://lore.kernel.org/qemu-devel/[email protected]/
Thanks Phil! I can confirm that this solves the issue for me.
ATB,
Mark.
Quoted 97 lines · Philippe Mathieu-Daudé
Hi,
Quoted 59 lines · Mark Cave-Ayland
Quoted 57 lines · Thomas Huth
Quoted 56 lines · Thomas Huth
Quoted 54 lines · Mark Cave-Ayland
Quoted 46 lines · Michael Tokarev
Quoted 36 lines · Thomas Huth
Quoted 35 lines · Thomas Huth
From: Thomas Huth <[email protected]>
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 reservedThis 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 <[email protected]>---
v2: Do the change in the machine code, not in the sabre device
hw/sparc64/sun4u.c| 7 +++++++1 file changed, 7 insertions(+)hw/sparc64/sun4u.c +3
-0@@ -723,6 +723,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 freeQuoted 8 lines
Quoted 6 lines
slots:
+ */
+qbus_mark_full(&pci_bus->qbus);
+qbus_mark_full(&pci_busA->qbus);
}
enum {Friendly ping!
Quoted 2 lines
This, being a simple change, somehow has not been reviewed still, so it's sitting in the queue...
Yes, apologies - I've been absolutely flat out recently, and I've got a note to take a look at this and Peter's patch as soon as I can.
Is this fixing an urgent issue with "make check-block" or similar?
Quoted 8 lines
Quoted 4 lines
Quoted 1 line
It's not urgent since this has been broken forever, but yes, it fixes "make check- block" for the case where sparc64 is the only available target during "configure -- target-list=sparc64-softmmu" and thus the iotests run with qemu-system-sparc64.
Ping!
While it's not urgent, soft-freeze date is in a week, so it would be nice to get this merged before it misses another release ... WDYT?
Hi Thomas,
I'm still playing catch-up a bit here, but I can't immediately find my notes on using pciA under QEMU. I think if it fixes the iotests then go ahead and merge it for now, which gives me time in freeze to investigate any reported issues.
I wasn't sure whether merging this patch now or wait for your update during the freeze so hold my PR for a bit; today I looked a bit at it.
Some notes:
- pci_bus_*_slot_reserved_mask() API isn't much used. I supposed it worked for a pair of corner cases but doesn't scale (I expect it to be called in more code paths).
- Bus capacity is odd. We have a generic Bus-class @max_dev field but do not use it with PCI variants. If set, it limit the instances capacity. The capacity is tracked in the instance state, and when no @max_dev is set the only way to mark a bus full is using the
qbus_mark_full()helper. Then if we remove devices, the bus remains full, and there is no helper to restore available slots.Anyway, back to the problem here, the first part is indeed as noticed Thomas to use
qbus_mark_full()for the root bus:-- >8 --
hw/pci-host/sabre.c +0
-0
hw/pci-host/sabre.c static void sabre_realize(DeviceState *dev, Error · line 405
Quoted 6 lines
hw/pci-host/sabre.c +2
-0@@ -400,6 +400,9 @@ 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); + + /* Only in-built Simba APBs can exist on the root bus */
Per the manual "Up to four Advanced PCI Bridge ASICs (APB)s may be used with the UltraSPARC-IIi".
Quoted 2 lines
hw/pci-host/sabre.c +1
-0+ qbus_mark_full(&phb->bus->qbus); }
Quoted 89 lines · Philippe Mathieu-Daudé
Quoted 88 lines · Philippe Mathieu-Daudé
Hi,
Quoted 56 lines · Mark Cave-Ayland
Quoted 54 lines · Thomas Huth
Quoted 53 lines · Thomas Huth
Quoted 51 lines · Mark Cave-Ayland
Quoted 43 lines · Michael Tokarev
Quoted 33 lines · Thomas Huth
Quoted 32 lines · Thomas Huth
From: Thomas Huth <[email protected]>
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 reservedThis 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 <[email protected]>---
v2: Do the change in the machine code, not in the sabre device
hw/sparc64/sun4u.c| 7 +++++++1 file changed, 7 insertions(+)hw/sparc64/sun4u.c +3
-0@@ -723,6 +723,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 Quoted 8 lines
hw/sparc64/sun4u.c static void sun4uv_init(MemoryRegion *address_space_mem, · line 733
Quoted 6 lines
hw/sparc64/sun4u.c +4
-0+* 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 {Friendly ping!
Quoted 2 lines
This, being a simple change, somehow has not been reviewed still, so it's sitting in the queue...
Yes, apologies - I've been absolutely flat out recently, and I've got a note to take a look at this and Peter's patch as soon as I can.
Is this fixing an urgent issue with "make check-block" or similar?
Quoted 8 lines
Quoted 4 lines
Quoted 1 line
It's not urgent since this has been broken forever, but yes, it fixes "make check- block" for the case where sparc64 is the only available target during "configure -- target-list=sparc64-softmmu" and thus the iotests run with qemu- system-sparc64.
Ping!
While it's not urgent, soft-freeze date is in a week, so it would be nice to get this merged before it misses another release ... WDYT?
Hi Thomas,
I'm still playing catch-up a bit here, but I can't immediately find my notes on using pciA under QEMU. I think if it fixes the iotests then go ahead and merge it for now, which gives me time in freeze to investigate any reported issues.
I wasn't sure whether merging this patch now or wait for your update during the freeze so hold my PR for a bit; today I looked a bit at it.
Some notes:
- pci_bus_*_slot_reserved_mask() API isn't much used. I supposed it worked for a pair of corner cases but doesn't scale (I expect it to be called in more code paths).
- Bus capacity is odd. We have a generic Bus-class @max_dev field but do not use it with PCI variants. If set, it limit the instances capacity. The capacity is tracked in the instance state, and when no @max_dev is set the only way to mark a bus full is using the
qbus_mark_full()helper. Then if we remove devices, the bus remains full, and there is no helper to restore available slots.Anyway, back to the problem here, the first part is indeed as noticed Thomas to use
qbus_mark_full()for the root bus:
Quoted 14 lines
hw/pci-host/sabre.c static void sabre_realize(DeviceState *dev, Error **errp) · line 404
Quoted 11 lines
-- >8 --
hw/pci-host/sabre.c +2
-0@@ -400,6 +400,9 @@ 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); + + /* Only in-built Simba APBs can exist on the root bus */Per the manual "Up to four Advanced PCI Bridge ASICs (APB)s may be used with the UltraSPARC-IIi".
That sounds about right. IIRC the UPA bus used by the UltraSPARC-IIi CPU can have up to 32 devices connected to it which are typically CPUs, but there are also 4 UPA IDs reserved for APBs. However the real life Ultra-5 machine (which is the closest to what QEMU emulates) is physically limited to a single CPU and a single APB with two of the slots on the PCI bus containing the integrated Simba PCI-PCI bridges.
Which thinking about it means the comment above is wrong i.e. it should say something like "Only in-built Simba PCI-PCI bridges can exist on the root bus".
ATB,
Mark.