[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 10/12] hw/qdev: Ensure parent device is not realized before addin
From: |
Philippe Mathieu-Daudé |
Subject: |
[PATCH 10/12] hw/qdev: Ensure parent device is not realized before adding bus |
Date: |
Wed, 18 Oct 2023 16:11:48 +0200 |
qbus_new() should not be called on realized device.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
hw/core/bus.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/hw/core/bus.c b/hw/core/bus.c
index c7831b5293..c92d07667b 100644
--- a/hw/core/bus.c
+++ b/hw/core/bus.c
@@ -21,6 +21,7 @@
#include "hw/qdev-properties.h"
#include "qemu/ctype.h"
#include "qemu/module.h"
+#include "qemu/error-report.h"
#include "qapi/error.h"
void qbus_set_hotplug_handler(BusState *bus, Object *handler)
@@ -163,6 +164,12 @@ BusState *qbus_new(const char *typename, DeviceState
*parent, const char *name)
{
BusState *bus;
+ if (parent->realized) {
+ error_report("qbus_new(type:%s parent:%s, name:%s) but parent
realized",
+ typename, object_get_typename(OBJECT(parent)), name);
+ abort();
+ }
+
bus = BUS(object_new(typename));
qbus_init_internal(bus, parent, name);
--
2.41.0
- [PATCH 06/12] hw/acpi: Realize ACPI_GED sysbus device before accessing it, (continued)
- [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é, 2023/10/18
- [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é <=
- [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
- Re: [PATCH 00/12] hw: Strengthen SysBus & QBus API, Michael S. Tsirkin, 2023/10/18
- Re: [PATCH 00/12] hw: Strengthen SysBus & QBus API, Thomas Huth, 2023/10/18