[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 12/12] hw/sysbus: Ensure device is realized before mapping it
From: |
Philippe Mathieu-Daudé |
Subject: |
[PATCH v2 12/12] hw/sysbus: Ensure device is realized before mapping it |
Date: |
Thu, 19 Oct 2023 09:16:10 +0200 |
sysbus_mmio_map() should not be called on unrealized device.
Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
hw/core/sysbus.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/hw/core/sysbus.c b/hw/core/sysbus.c
index 8f53cb926b..a46828a808 100644
--- a/hw/core/sysbus.c
+++ b/hw/core/sysbus.c
@@ -133,6 +133,13 @@ static void sysbus_mmio_map_common(SysBusDevice *dev, int
n, hwaddr addr,
{
assert(n >= 0 && n < dev->num_mmio);
+ if (!DEVICE(dev)->realized) {
+ error_report("sysbus_mmio_map(type:%s, index:%d,
addr:0x%"HWADDR_PRIx","
+ " prio:%d) but object is not realized",
+ object_get_typename(OBJECT(dev)), n, addr, priority);
+ abort();
+ }
+
if (dev->mmio[n].addr == addr) {
/* ??? region already mapped here. */
return;
--
2.41.0
- Re: [PATCH v2 05/12] hw/pci-host/bonito: Do not use SysBus API to map local MMIO region, (continued)
- [PATCH v2 06/12] hw/acpi: Realize ACPI_GED sysbus device before accessing it, Philippe Mathieu-Daudé, 2023/10/19
- [PATCH v2 07/12] hw/arm/virt: Realize ARM_GICV2M sysbus device before accessing it, Philippe Mathieu-Daudé, 2023/10/19
- [PATCH v2 09/12] hw/s390x/css-bridge: Realize sysbus device before accessing it, Philippe Mathieu-Daudé, 2023/10/19
- [PATCH v2 11/12] hw/sysbus: Ensure device is not realized before adding MMIO region, Philippe Mathieu-Daudé, 2023/10/19
- [PATCH v2 08/12] hw/isa: Realize ISA BUS sysbus device before accessing it, Philippe Mathieu-Daudé, 2023/10/19
- [PATCH v2 10/12] hw/qdev: Ensure parent device is not realized before adding bus, Philippe Mathieu-Daudé, 2023/10/19
- [PATCH v2 12/12] hw/sysbus: Ensure device is realized before mapping it,
Philippe Mathieu-Daudé <=
- Re: [PATCH v2 00/12] hw: Strengthen SysBus & QBus API, Thomas Huth, 2023/10/19
- Re: [PATCH v2 00/12] hw: Strengthen SysBus & QBus API, Philippe Mathieu-Daudé, 2023/10/19