To be able to set a property on the ISA-IDE bridges objects before they are realized, explode the pci_create_simple() calls as pci_new() + pci_realize_and_unref().
Signed-off-by: Philippe Mathieu-Daudé <phi...@redhat.com> --- hw/i386/pc_piix.c | 5 +++-- hw/isa/piix4.c | 3 ++- hw/mips/fuloong2e.c | 3 ++- hw/ppc/pegasos2.c | 3 ++- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c index 30b8bd6ea92..fb606c14768 100644 --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c @@ -244,8 +244,9 @@ static void pc_init1(MachineState *machine, if (pcmc->pci_enabled) { PCIDevice *dev; - dev = pci_create_simple(pci_bus, piix3_devfn + 1, - xen_enabled() ? "piix3-ide-xen" : "piix3-ide"); + dev = pci_new(piix3_devfn + 1, + xen_enabled() ? "piix3-ide-xen" : "piix3-ide"); + pci_realize_and_unref(dev, pci_bus, &error_abort); pci_ide_create_devs(dev); idebus[0] = qdev_get_child_bus(&dev->qdev, "ide.0"); idebus[1] = qdev_get_child_bus(&dev->qdev, "ide.1"); diff --git a/hw/isa/piix4.c b/hw/isa/piix4.c index 0fe7b69bc4c..d60f161ecf4 100644 --- a/hw/isa/piix4.c +++ b/hw/isa/piix4.c @@ -261,7 +261,8 @@ DeviceState *piix4_create(PCIBus *pci_bus, ISABus **isa_bus, I2CBus **smbus) *isa_bus = ISA_BUS(qdev_get_child_bus(dev, "isa.0")); } - pci = pci_create_simple(pci_bus, devfn + 1, "piix4-ide"); + pci = pci_new(devfn + 1, "piix4-ide"); + pci_realize_and_unref(pci, pci_bus, &error_abort); pci_ide_create_devs(pci); pci_create_simple(pci_bus, devfn + 2, "piix4-usb-uhci"); diff --git a/hw/mips/fuloong2e.c b/hw/mips/fuloong2e.c index c1b8066a13b..40e9a645e1b 100644 --- a/hw/mips/fuloong2e.c +++ b/hw/mips/fuloong2e.c @@ -206,7 +206,8 @@ static void vt82c686b_southbridge_init(PCIBus *pci_bus, int slot, qemu_irq intc, TYPE_VT82C686B_ISA); qdev_connect_gpio_out(DEVICE(dev), 0, intc); - dev = pci_create_simple(pci_bus, PCI_DEVFN(slot, 1), "via-ide"); + dev = pci_new(PCI_DEVFN(slot, 1), "via-ide"); + pci_realize_and_unref(dev, pci_bus, &error_abort); pci_ide_create_devs(dev); pci_create_simple(pci_bus, PCI_DEVFN(slot, 2), "vt82c686b-usb-uhci"); diff --git a/hw/ppc/pegasos2.c b/hw/ppc/pegasos2.c index 0bfd0928aa5..8486a2eb8c6 100644 --- a/hw/ppc/pegasos2.c +++ b/hw/ppc/pegasos2.c @@ -108,7 +108,8 @@ static void pegasos2_init(MachineState *machine) qdev_get_gpio_in_named(mv, "gpp", 31)); /* VT8231 function 1: IDE Controller */ - dev = pci_create_simple(pci_bus, PCI_DEVFN(12, 1), "via-ide"); + dev = pci_new(PCI_DEVFN(12, 1), "via-ide"); + pci_realize_and_unref(dev, pci_bus, &error_abort); pci_ide_create_devs(dev); /* VT8231 function 2-3: USB Ports */ -- 2.26.3