[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 38/46] hw/isa: Realize ISA bridge device before accessing it
From: |
Philippe Mathieu-Daudé |
Subject: |
[PULL 38/46] hw/isa: Realize ISA bridge device before accessing it |
Date: |
Thu, 19 Oct 2023 23:18:03 +0200 |
qbus_new() should not be called on unrealized device.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Message-Id: <20231019071611.98885-9-philmd@linaro.org>
---
hw/isa/isa-bus.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/hw/isa/isa-bus.c b/hw/isa/isa-bus.c
index a289eccfb1..f1e0f14007 100644
--- a/hw/isa/isa-bus.c
+++ b/hw/isa/isa-bus.c
@@ -52,18 +52,25 @@ static const TypeInfo isa_bus_info = {
ISABus *isa_bus_new(DeviceState *dev, MemoryRegion* address_space,
MemoryRegion *address_space_io, Error **errp)
{
+ DeviceState *bridge = NULL;
+
if (isabus) {
error_setg(errp, "Can't create a second ISA bus");
return NULL;
}
if (!dev) {
- dev = qdev_new("isabus-bridge");
- sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal);
+ bridge = qdev_new("isabus-bridge");
+ dev = bridge;
}
isabus = ISA_BUS(qbus_new(TYPE_ISA_BUS, dev, NULL));
isabus->address_space = address_space;
isabus->address_space_io = address_space_io;
+
+ if (bridge) {
+ sysbus_realize_and_unref(SYS_BUS_DEVICE(bridge), &error_fatal);
+ }
+
return isabus;
}
--
2.41.0
- [PULL 28/46] hw/intc/spapr_xive: Move sysbus_init_mmio() calls around, (continued)
- [PULL 28/46] hw/intc/spapr_xive: Move sysbus_init_mmio() calls around, Philippe Mathieu-Daudé, 2023/10/19
- [PULL 29/46] hw/intc/spapr_xive: Do not use SysBus API to map local MMIO region, Philippe Mathieu-Daudé, 2023/10/19
- [PULL 30/46] hw/audio/pcspk: Inline pcspk_init(), Philippe Mathieu-Daudé, 2023/10/19
- [PULL 31/46] hw/i386/amd_iommu: Do not use SysBus API to map local MMIO region, Philippe Mathieu-Daudé, 2023/10/19
- [PULL 32/46] hw/i386/intel_iommu: Do not use SysBus API to map local MMIO region, Philippe Mathieu-Daudé, 2023/10/19
- [PULL 33/46] hw/misc/allwinner-dramc: Move sysbus_mmio_map call from init -> realize, Philippe Mathieu-Daudé, 2023/10/19
- [PULL 34/46] hw/misc/allwinner-dramc: Do not use SysBus API to map local MMIO region, Philippe Mathieu-Daudé, 2023/10/19
- [PULL 35/46] hw/pci-host/bonito: Do not use SysBus API to map local MMIO region, Philippe Mathieu-Daudé, 2023/10/19
- [PULL 36/46] hw/acpi: Realize ACPI_GED sysbus device before accessing it, Philippe Mathieu-Daudé, 2023/10/19
- [PULL 37/46] hw/arm/virt: Realize ARM_GICV2M sysbus device before accessing it, Philippe Mathieu-Daudé, 2023/10/19
- [PULL 38/46] hw/isa: Realize ISA bridge device before accessing it,
Philippe Mathieu-Daudé <=
- [PULL 39/46] hw/s390x/css-bridge: Realize sysbus device before accessing it, Philippe Mathieu-Daudé, 2023/10/19
- [PULL 40/46] hw/virtio/virtio-pmem: Replace impossible check by assertion, Philippe Mathieu-Daudé, 2023/10/19
- [PULL 41/46] hw/block/vhost-user-blk: Use DEVICE() / VIRTIO_DEVICE() macros, Philippe Mathieu-Daudé, 2023/10/19
- [PULL 42/46] hw/display/virtio-gpu: Use VIRTIO_DEVICE() macro, Philippe Mathieu-Daudé, 2023/10/19
- [PULL 43/46] hw/scsi/virtio-scsi: Use VIRTIO_SCSI_COMMON() macro, Philippe Mathieu-Daudé, 2023/10/19
- [PULL 44/46] hw/dma: Declare link using static DEFINE_PROP_LINK() macro, Philippe Mathieu-Daudé, 2023/10/19
- [PULL 45/46] hw/net: Declare link using static DEFINE_PROP_LINK() macro, Philippe Mathieu-Daudé, 2023/10/19
- [PULL 46/46] ui/input: Constify QemuInputHandler structure, Philippe Mathieu-Daudé, 2023/10/19
- Re: [PULL 00/46] Misc HW/UI patches for 2023-10-19, Philippe Mathieu-Daudé, 2023/10/20
- Re: [PULL 00/46] Misc HW/UI patches for 2023-10-19, Stefan Hajnoczi, 2023/10/20