[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 08/12] hw/isa: Realize ISA BUS sysbus device before accessing it
From: |
Philippe Mathieu-Daudé |
Subject: |
[PATCH 08/12] hw/isa: Realize ISA BUS sysbus device before accessing it |
Date: |
Wed, 18 Oct 2023 16:11:46 +0200 |
sysbus_mmio_map() should not be called on unrealized device.
Signed-off-by: Philippe Mathieu-Daudé <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
- [PATCH 02/12] hw/i386/intel_iommu: Do not use SysBus API to map local MMIO region, (continued)
- [PATCH 02/12] hw/i386/intel_iommu: Do not use SysBus API to map local MMIO region, Philippe Mathieu-Daudé, 2023/10/18
- [PATCH 03/12] hw/misc/allwinner-dramc: Move sysbus_mmio_map call from init -> realize, Philippe Mathieu-Daudé, 2023/10/18
- [PATCH 04/12] hw/misc/allwinner-dramc: Do not use SysBus API to map local MMIO region, Philippe Mathieu-Daudé, 2023/10/18
- [PATCH 05/12] hw/pci-host/bonito: Do not use SysBus API to map local MMIO region, Philippe Mathieu-Daudé, 2023/10/18
- [PATCH 06/12] hw/acpi: Realize ACPI_GED sysbus device before accessing it, Philippe Mathieu-Daudé, 2023/10/18
- [PATCH 07/12] hw/arm/virt: Realize ARM_GICV2M sysbus device before accessing it, Philippe Mathieu-Daudé, 2023/10/18
- [PATCH 08/12] hw/isa: Realize ISA BUS sysbus device before accessing it,
Philippe Mathieu-Daudé <=
- [PATCH 09/12] hw/s390x/css-bridge: Realize sysbus device before accessing it, Philippe Mathieu-Daudé, 2023/10/18
- [PATCH 10/12] hw/qdev: Ensure parent device is not realized before adding bus, Philippe Mathieu-Daudé, 2023/10/18
- [PATCH 11/12] hw/sysbus: Ensure device is not realized before adding MMIO region, Philippe Mathieu-Daudé, 2023/10/18
- [PATCH 12/12] hw/sysbus: Ensure device is realized before mapping it, Philippe Mathieu-Daudé, 2023/10/18