qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/27] hw/sysbus: Spring cleanups (part 1)
@ 2025-10-24 19:03 Philippe Mathieu-Daudé
  2025-10-24 19:03 ` [PATCH 01/27] hw/qdev: Have qdev_get_gpio_out_connector() take const DeviceState arg Philippe Mathieu-Daudé
                   ` (26 more replies)
  0 siblings, 27 replies; 35+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-10-24 19:03 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-arm, qemu-riscv, qemu-block, Philippe Mathieu-Daudé

- Constify SysBusDevice argument
- Add sysbus_has_pio() and sysbus_pio_get_address()
- Use proper SysBus accessors
- Include missing 'exec/cpu-common.h' and 'system/memory.h' headers

Philippe Mathieu-Daudé (27):
  hw/qdev: Have qdev_get_gpio_out_connector() take const DeviceState arg
  hw/sysbus: Have various helpers take a const SysBusDevice argument
  hw/sysbus: Use memory_region_name()
  hw/i386/microvm: Use proper SysBus accessors
  hw/timer/hpet: Use proper SysBus accessors
  hw/acpi/cxl: Use proper SysBus accessors
  hw/sysbus: Add sysbus_has_pio() and sysbus_pio_get_address()
  hw/pci-bridge/pci_expander_bridge: Use proper SysBus accessors
  hw/platform-bus: Include missing 'system/memory.h' header
  hw/block/pflash: Include missing 'system/memory.h' header
  hw/misc/unimp: Include missing 'system/memory.h' header
  hw/misc/empty_slot: Include missing 'system/memory.h' header
  hw/uefi: Include missing 'system/memory.h' header
  hw/usb/imx: Include missing 'system/memory.h' header
  hw/pci/pcihost: Include missing 'system/memory.h' header
  hw/scsi/esp: Include missing 'system/memory.h' header
  hw/avr: Include missing 'system/memory.h' header
  hw/input/lassi: Include missing 'system/memory.h' header
  hw/tricore: Include missing 'system/memory.h' header
  hw/int/loongarch: Include missing 'system/memory.h' header
  hw/rtc/m48t59: Include missing 'system/memory.h' header
  hw/rtc/sun: Include 'exec/cpu-common.h' and 'system/memory.h' headers
  hw/xilinx: Include 'exec/cpu-common.h' and 'system/memory.h' headers
  hw/mips: Include missing 'system/memory.h' header
  hw/sparc: Include missing 'system/memory.h' header
  hw/riscv: Include missing 'system/memory.h' header
  hw/rx: Include missing 'system/memory.h' header

 hw/rtc/m48t59-internal.h                  |  2 ++
 include/hw/char/avr_usart.h               |  1 +
 include/hw/char/cadence_uart.h            |  1 +
 include/hw/char/ibex_uart.h               |  1 +
 include/hw/char/renesas_sci.h             |  1 +
 include/hw/char/shakti_uart.h             |  1 +
 include/hw/char/sifive_uart.h             |  1 +
 include/hw/gpio/sifive_gpio.h             |  1 +
 include/hw/input/lasips2.h                |  1 +
 include/hw/intc/loongarch_dintc.h         |  2 +-
 include/hw/intc/loongarch_extioi_common.h |  1 +
 include/hw/intc/loongarch_pch_msi.h       |  1 +
 include/hw/intc/loongarch_pic_common.h    |  1 +
 include/hw/intc/loongson_ipi_common.h     |  2 ++
 include/hw/intc/riscv_aclint.h            |  1 +
 include/hw/intc/riscv_aplic.h             |  1 +
 include/hw/intc/riscv_imsic.h             |  1 +
 include/hw/intc/rx_icu.h                  |  1 +
 include/hw/intc/sifive_plic.h             |  1 +
 include/hw/misc/avr_power.h               |  1 +
 include/hw/misc/lasi.h                    |  1 +
 include/hw/misc/mchp_pfsoc_dmc.h          |  1 +
 include/hw/misc/mchp_pfsoc_ioscb.h        |  1 +
 include/hw/misc/mchp_pfsoc_sysreg.h       |  1 +
 include/hw/misc/mips_cmgcr.h              |  1 +
 include/hw/misc/mips_itu.h                |  1 +
 include/hw/misc/sifive_e_aon.h            |  1 +
 include/hw/misc/sifive_e_prci.h           |  1 +
 include/hw/misc/sifive_test.h             |  1 +
 include/hw/misc/sifive_u_otp.h            |  1 +
 include/hw/misc/sifive_u_prci.h           |  1 +
 include/hw/misc/unimp.h                   |  1 +
 include/hw/net/cadence_gem.h              |  1 +
 include/hw/pci/pci_host.h                 |  1 +
 include/hw/platform-bus.h                 |  1 +
 include/hw/qdev-core.h                    |  3 ++-
 include/hw/riscv/opentitan.h              |  1 +
 include/hw/riscv/shakti_c.h               |  1 +
 include/hw/riscv/sifive_e.h               |  1 +
 include/hw/riscv/xiangshan_kmh.h          |  1 +
 include/hw/rtc/goldfish_rtc.h             |  1 +
 include/hw/scsi/esp.h                     |  1 +
 include/hw/sparc/sparc32_dma.h            |  1 +
 include/hw/sparc/sun4m_iommu.h            |  1 +
 include/hw/sparc/sun4u_iommu.h            |  1 +
 include/hw/ssi/ibex_spi_host.h            |  1 +
 include/hw/ssi/sifive_spi.h               |  1 +
 include/hw/sysbus.h                       | 12 +++++++-----
 include/hw/timer/avr_timer16.h            |  1 +
 include/hw/timer/cadence_ttc.h            |  1 +
 include/hw/timer/ibex_timer.h             |  1 +
 include/hw/timer/renesas_cmt.h            |  1 +
 include/hw/timer/renesas_tmr.h            |  1 +
 include/hw/timer/sifive_pwm.h             |  1 +
 include/hw/tricore/tc27x_soc.h            |  1 +
 include/hw/tricore/tricore_testdevice.h   |  1 +
 include/hw/uefi/var-service.h             |  1 +
 include/hw/usb/imx-usb-phy.h              |  1 +
 hw/acpi/cxl.c                             |  2 +-
 hw/block/pflash_cfi01.c                   |  1 +
 hw/block/pflash_cfi02.c                   |  1 +
 hw/char/xilinx_uartlite.c                 |  2 ++
 hw/core/gpio.c                            |  3 ++-
 hw/core/sysbus.c                          | 23 +++++++++++++++++------
 hw/i386/microvm-dt.c                      |  6 ++++--
 hw/intc/xilinx_intc.c                     |  2 ++
 hw/misc/empty_slot.c                      |  1 +
 hw/net/xilinx_axienet.c                   |  2 ++
 hw/pci-bridge/pci_expander_bridge.c       | 12 ++++++------
 hw/rtc/sun4v-rtc.c                        |  2 ++
 hw/ssi/xilinx_spi.c                       |  2 ++
 hw/timer/hpet.c                           |  3 ++-
 hw/timer/xilinx_timer.c                   |  2 ++
 73 files changed, 114 insertions(+), 24 deletions(-)

-- 
2.51.0



^ permalink raw reply	[flat|nested] 35+ messages in thread

* [PATCH 01/27] hw/qdev: Have qdev_get_gpio_out_connector() take const DeviceState arg
  2025-10-24 19:03 [PATCH 00/27] hw/sysbus: Spring cleanups (part 1) Philippe Mathieu-Daudé
@ 2025-10-24 19:03 ` Philippe Mathieu-Daudé
  2025-10-24 19:35   ` Mark Cave-Ayland
  2025-10-24 19:03 ` [PATCH 02/27] hw/sysbus: Have various helpers take a const SysBusDevice argument Philippe Mathieu-Daudé
                   ` (25 subsequent siblings)
  26 siblings, 1 reply; 35+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-10-24 19:03 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-arm, qemu-riscv, qemu-block, Philippe Mathieu-Daudé,
	Paolo Bonzini, Daniel P. Berrangé, Eduardo Habkost

This getter doesn't update any DeviceState internal fields,
make it const.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 include/hw/qdev-core.h | 3 ++-
 hw/core/gpio.c         | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/include/hw/qdev-core.h b/include/hw/qdev-core.h
index a7bfb10dc70..2caa0cbd26f 100644
--- a/include/hw/qdev-core.h
+++ b/include/hw/qdev-core.h
@@ -725,7 +725,8 @@ void qdev_connect_gpio_out_named(DeviceState *dev, const char *name, int n,
  *
  * Return: qemu_irq associated with GPIO or NULL if un-wired.
  */
-qemu_irq qdev_get_gpio_out_connector(DeviceState *dev, const char *name, int n);
+qemu_irq qdev_get_gpio_out_connector(const DeviceState *dev,
+                                     const char *name, int n);
 
 /**
  * qdev_intercept_gpio_out: Intercept an existing GPIO connection
diff --git a/hw/core/gpio.c b/hw/core/gpio.c
index 6e32a8eec61..c7c2936fc55 100644
--- a/hw/core/gpio.c
+++ b/hw/core/gpio.c
@@ -129,7 +129,8 @@ void qdev_connect_gpio_out_named(DeviceState *dev, const char *name, int n,
     g_free(propname);
 }
 
-qemu_irq qdev_get_gpio_out_connector(DeviceState *dev, const char *name, int n)
+qemu_irq qdev_get_gpio_out_connector(const DeviceState *dev,
+                                     const char *name, int n)
 {
     g_autofree char *propname = g_strdup_printf("%s[%d]",
                                      name ? name : "unnamed-gpio-out", n);
-- 
2.51.0



^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [PATCH 02/27] hw/sysbus: Have various helpers take a const SysBusDevice argument
  2025-10-24 19:03 [PATCH 00/27] hw/sysbus: Spring cleanups (part 1) Philippe Mathieu-Daudé
  2025-10-24 19:03 ` [PATCH 01/27] hw/qdev: Have qdev_get_gpio_out_connector() take const DeviceState arg Philippe Mathieu-Daudé
@ 2025-10-24 19:03 ` Philippe Mathieu-Daudé
  2025-10-24 19:36   ` Mark Cave-Ayland
  2025-10-24 19:03 ` [PATCH 03/27] hw/sysbus: Use memory_region_name() Philippe Mathieu-Daudé
                   ` (24 subsequent siblings)
  26 siblings, 1 reply; 35+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-10-24 19:03 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-arm, qemu-riscv, qemu-block, Philippe Mathieu-Daudé,
	Paolo Bonzini, Daniel P. Berrangé, Eduardo Habkost

These getters don't update any SysBusDevice internal fields,
make the argument const.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 include/hw/sysbus.h | 10 +++++-----
 hw/core/sysbus.c    | 10 +++++-----
 2 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/include/hw/sysbus.h b/include/hw/sysbus.h
index 18fde8a7b48..69eb62e29c8 100644
--- a/include/hw/sysbus.h
+++ b/include/hw/sysbus.h
@@ -70,17 +70,17 @@ struct SysBusDevice {
 typedef void FindSysbusDeviceFunc(SysBusDevice *sbdev, void *opaque);
 
 void sysbus_init_mmio(SysBusDevice *dev, MemoryRegion *memory);
-MemoryRegion *sysbus_mmio_get_region(SysBusDevice *dev, int n);
+MemoryRegion *sysbus_mmio_get_region(const SysBusDevice *dev, int n);
 void sysbus_init_irq(SysBusDevice *dev, qemu_irq *p);
 void sysbus_pass_irq(SysBusDevice *dev, SysBusDevice *target);
 void sysbus_init_ioports(SysBusDevice *dev, uint32_t ioport, uint32_t size);
 
 
-bool sysbus_has_irq(SysBusDevice *dev, int n);
-bool sysbus_has_mmio(SysBusDevice *dev, unsigned int n);
+bool sysbus_has_irq(const SysBusDevice *dev, int n);
+bool sysbus_has_mmio(const SysBusDevice *dev, unsigned int n);
 void sysbus_connect_irq(SysBusDevice *dev, int n, qemu_irq irq);
-bool sysbus_is_irq_connected(SysBusDevice *dev, int n);
-qemu_irq sysbus_get_connected_irq(SysBusDevice *dev, int n);
+bool sysbus_is_irq_connected(const SysBusDevice *dev, int n);
+qemu_irq sysbus_get_connected_irq(const SysBusDevice *dev, int n);
 void sysbus_mmio_map(SysBusDevice *dev, int n, hwaddr addr);
 int sysbus_mmio_map_name(SysBusDevice *dev, const char*name, hwaddr addr);
 void sysbus_mmio_map_overlap(SysBusDevice *dev, int n, hwaddr addr,
diff --git a/hw/core/sysbus.c b/hw/core/sysbus.c
index ec69e877a2c..ae447c1196a 100644
--- a/hw/core/sysbus.c
+++ b/hw/core/sysbus.c
@@ -80,7 +80,7 @@ static void system_bus_class_init(ObjectClass *klass, const void *data)
 }
 
 /* Check whether an IRQ source exists */
-bool sysbus_has_irq(SysBusDevice *dev, int n)
+bool sysbus_has_irq(const SysBusDevice *dev, int n)
 {
     char *prop = g_strdup_printf("%s[%d]", SYSBUS_DEVICE_GPIO_IRQ, n);
     ObjectProperty *r;
@@ -91,12 +91,12 @@ bool sysbus_has_irq(SysBusDevice *dev, int n)
     return (r != NULL);
 }
 
-bool sysbus_is_irq_connected(SysBusDevice *dev, int n)
+bool sysbus_is_irq_connected(const SysBusDevice *dev, int n)
 {
     return !!sysbus_get_connected_irq(dev, n);
 }
 
-qemu_irq sysbus_get_connected_irq(SysBusDevice *dev, int n)
+qemu_irq sysbus_get_connected_irq(const SysBusDevice *dev, int n)
 {
     DeviceState *d = DEVICE(dev);
     return qdev_get_gpio_out_connector(d, SYSBUS_DEVICE_GPIO_IRQ, n);
@@ -114,7 +114,7 @@ void sysbus_connect_irq(SysBusDevice *dev, int n, qemu_irq irq)
 }
 
 /* Check whether an MMIO region exists */
-bool sysbus_has_mmio(SysBusDevice *dev, unsigned int n)
+bool sysbus_has_mmio(const SysBusDevice *dev, unsigned int n)
 {
     return (n < dev->num_mmio);
 }
@@ -190,7 +190,7 @@ void sysbus_init_mmio(SysBusDevice *dev, MemoryRegion *memory)
     dev->mmio[n].memory = memory;
 }
 
-MemoryRegion *sysbus_mmio_get_region(SysBusDevice *dev, int n)
+MemoryRegion *sysbus_mmio_get_region(const SysBusDevice *dev, int n)
 {
     assert(n >= 0 && n < QDEV_MAX_MMIO);
     return dev->mmio[n].memory;
-- 
2.51.0



^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [PATCH 03/27] hw/sysbus: Use memory_region_name()
  2025-10-24 19:03 [PATCH 00/27] hw/sysbus: Spring cleanups (part 1) Philippe Mathieu-Daudé
  2025-10-24 19:03 ` [PATCH 01/27] hw/qdev: Have qdev_get_gpio_out_connector() take const DeviceState arg Philippe Mathieu-Daudé
  2025-10-24 19:03 ` [PATCH 02/27] hw/sysbus: Have various helpers take a const SysBusDevice argument Philippe Mathieu-Daudé
@ 2025-10-24 19:03 ` Philippe Mathieu-Daudé
  2025-10-24 19:40   ` Mark Cave-Ayland
  2025-10-24 19:03 ` [PATCH 04/27] hw/i386/microvm: Use proper SysBus accessors Philippe Mathieu-Daudé
                   ` (23 subsequent siblings)
  26 siblings, 1 reply; 35+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-10-24 19:03 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-arm, qemu-riscv, qemu-block, Philippe Mathieu-Daudé,
	Paolo Bonzini, Daniel P. Berrangé, Eduardo Habkost

MemoryRegion::name is kind of internal. Use the proper
memory_region_name() accessor, which might return a different
name.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 hw/core/sysbus.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/core/sysbus.c b/hw/core/sysbus.c
index ae447c1196a..d33be6b2b52 100644
--- a/hw/core/sysbus.c
+++ b/hw/core/sysbus.c
@@ -154,7 +154,7 @@ void sysbus_mmio_map(SysBusDevice *dev, int n, hwaddr addr)
 int sysbus_mmio_map_name(SysBusDevice *dev, const char *name, hwaddr addr)
 {
     for (int i = 0; i < dev->num_mmio; i++) {
-        if (!strcmp(dev->mmio[i].memory->name, name)) {
+        if (!strcmp(memory_region_name(dev->mmio[i].memory), name)) {
             sysbus_mmio_map(dev, i, addr);
             return i;
         }
-- 
2.51.0



^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [PATCH 04/27] hw/i386/microvm: Use proper SysBus accessors
  2025-10-24 19:03 [PATCH 00/27] hw/sysbus: Spring cleanups (part 1) Philippe Mathieu-Daudé
                   ` (2 preceding siblings ...)
  2025-10-24 19:03 ` [PATCH 03/27] hw/sysbus: Use memory_region_name() Philippe Mathieu-Daudé
@ 2025-10-24 19:03 ` Philippe Mathieu-Daudé
  2025-10-24 19:03 ` [PATCH 05/27] hw/timer/hpet: " Philippe Mathieu-Daudé
                   ` (22 subsequent siblings)
  26 siblings, 0 replies; 35+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-10-24 19:03 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-arm, qemu-riscv, qemu-block, Philippe Mathieu-Daudé,
	Michael S. Tsirkin, Marcel Apfelbaum, Paolo Bonzini,
	Richard Henderson, Eduardo Habkost

SysBusDevice::mmio[] is kind of internal. Use the proper
sysbus_mmio_get_region() accessor.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 hw/i386/microvm-dt.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/hw/i386/microvm-dt.c b/hw/i386/microvm-dt.c
index cb27dfd732e..d7f49bc1b5f 100644
--- a/hw/i386/microvm-dt.c
+++ b/hw/i386/microvm-dt.c
@@ -71,7 +71,8 @@ static void dt_add_virtio(MicrovmMachineState *mms, VirtIOMMIOProxy *mmio)
         return;
     }
 
-    hwaddr base = dev->mmio[0].addr;
+    MemoryRegion *mr = sysbus_mmio_get_region(dev, 0);
+    hwaddr base = mr->addr;
     hwaddr size = 512;
     unsigned index = (base - VIRTIO_MMIO_BASE) / size;
     uint32_t irq = mms->virtio_irq_base + index;
@@ -150,7 +151,8 @@ static void dt_add_pcie(MicrovmMachineState *mms)
 
 static void dt_add_ioapic(MicrovmMachineState *mms, SysBusDevice *dev)
 {
-    hwaddr base = dev->mmio[0].addr;
+    MemoryRegion *mr = sysbus_mmio_get_region(dev, 0);
+    hwaddr base = mr->addr;
     char *nodename;
     uint32_t ph;
     int index;
-- 
2.51.0



^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [PATCH 05/27] hw/timer/hpet: Use proper SysBus accessors
  2025-10-24 19:03 [PATCH 00/27] hw/sysbus: Spring cleanups (part 1) Philippe Mathieu-Daudé
                   ` (3 preceding siblings ...)
  2025-10-24 19:03 ` [PATCH 04/27] hw/i386/microvm: Use proper SysBus accessors Philippe Mathieu-Daudé
@ 2025-10-24 19:03 ` Philippe Mathieu-Daudé
  2025-10-24 19:03 ` [PATCH 06/27] hw/acpi/cxl: " Philippe Mathieu-Daudé
                   ` (21 subsequent siblings)
  26 siblings, 0 replies; 35+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-10-24 19:03 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-arm, qemu-riscv, qemu-block, Philippe Mathieu-Daudé,
	Michael S. Tsirkin, Paolo Bonzini

SysBusDevice::mmio[] is kind of internal. Use the proper
sysbus_mmio_get_region() accessor.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 hw/timer/hpet.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/hw/timer/hpet.c b/hw/timer/hpet.c
index 1acba4fa9db..4ed79d72620 100644
--- a/hw/timer/hpet.c
+++ b/hw/timer/hpet.c
@@ -655,6 +655,7 @@ static void hpet_reset(DeviceState *d)
 {
     HPETState *s = HPET(d);
     SysBusDevice *sbd = SYS_BUS_DEVICE(d);
+    MemoryRegion *mr = sysbus_mmio_get_region(sbd, 0);
     int i;
 
     for (i = 0; i < s->num_timers; i++) {
@@ -677,7 +678,7 @@ static void hpet_reset(DeviceState *d)
     s->hpet_offset = 0ULL;
     s->config = 0ULL;
     hpet_fw_cfg.hpet[s->hpet_id].event_timer_block_id = (uint32_t)s->capability;
-    hpet_fw_cfg.hpet[s->hpet_id].address = sbd->mmio[0].addr;
+    hpet_fw_cfg.hpet[s->hpet_id].address = mr->addr;
 
     /* to document that the RTC lowers its output on reset as well */
     s->rtc_irq_level = 0;
-- 
2.51.0



^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [PATCH 06/27] hw/acpi/cxl: Use proper SysBus accessors
  2025-10-24 19:03 [PATCH 00/27] hw/sysbus: Spring cleanups (part 1) Philippe Mathieu-Daudé
                   ` (4 preceding siblings ...)
  2025-10-24 19:03 ` [PATCH 05/27] hw/timer/hpet: " Philippe Mathieu-Daudé
@ 2025-10-24 19:03 ` Philippe Mathieu-Daudé
  2025-10-24 19:03 ` [PATCH 07/27] hw/sysbus: Add sysbus_has_pio() and sysbus_pio_get_address() Philippe Mathieu-Daudé
                   ` (20 subsequent siblings)
  26 siblings, 0 replies; 35+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-10-24 19:03 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-arm, qemu-riscv, qemu-block, Philippe Mathieu-Daudé,
	Michael S. Tsirkin, Igor Mammedov, Ani Sinha

SysBusDevice::mmio[] is kind of internal. Use the proper
sysbus_mmio_get_region() accessor.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 hw/acpi/cxl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/acpi/cxl.c b/hw/acpi/cxl.c
index 75d5b30bb8b..77c99dfb184 100644
--- a/hw/acpi/cxl.c
+++ b/hw/acpi/cxl.c
@@ -104,7 +104,7 @@ static void cedt_build_chbs(GArray *table_data, PXBCXLDev *cxl)
 {
     PXBDev *pxb = PXB_DEV(cxl);
     SysBusDevice *sbd = SYS_BUS_DEVICE(cxl->cxl_host_bridge);
-    struct MemoryRegion *mr = sbd->mmio[0].memory;
+    MemoryRegion *mr = sysbus_mmio_get_region(sbd, 0);
 
     /* Type */
     build_append_int_noprefix(table_data, 0, 1);
-- 
2.51.0



^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [PATCH 07/27] hw/sysbus: Add sysbus_has_pio() and sysbus_pio_get_address()
  2025-10-24 19:03 [PATCH 00/27] hw/sysbus: Spring cleanups (part 1) Philippe Mathieu-Daudé
                   ` (5 preceding siblings ...)
  2025-10-24 19:03 ` [PATCH 06/27] hw/acpi/cxl: " Philippe Mathieu-Daudé
@ 2025-10-24 19:03 ` Philippe Mathieu-Daudé
  2025-10-26 17:34   ` Philippe Mathieu-Daudé
  2025-10-24 19:03 ` [PATCH 08/27] hw/pci-bridge/pci_expander_bridge: Use proper SysBus accessors Philippe Mathieu-Daudé
                   ` (19 subsequent siblings)
  26 siblings, 1 reply; 35+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-10-24 19:03 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-arm, qemu-riscv, qemu-block, Philippe Mathieu-Daudé,
	Paolo Bonzini, Daniel P. Berrangé, Eduardo Habkost

Similarly to sysbus_has_mmio() and sysbus_mmio_get_region(),
add sysbus_has_pio() and sysbus_pio_get_address() for PIO.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 include/hw/sysbus.h |  2 ++
 hw/core/sysbus.c    | 11 +++++++++++
 2 files changed, 13 insertions(+)

diff --git a/include/hw/sysbus.h b/include/hw/sysbus.h
index 69eb62e29c8..07a307b5ca0 100644
--- a/include/hw/sysbus.h
+++ b/include/hw/sysbus.h
@@ -71,6 +71,7 @@ typedef void FindSysbusDeviceFunc(SysBusDevice *sbdev, void *opaque);
 
 void sysbus_init_mmio(SysBusDevice *dev, MemoryRegion *memory);
 MemoryRegion *sysbus_mmio_get_region(const SysBusDevice *dev, int n);
+uint32_t sysbus_pio_get_address(const SysBusDevice *dev, int n);
 void sysbus_init_irq(SysBusDevice *dev, qemu_irq *p);
 void sysbus_pass_irq(SysBusDevice *dev, SysBusDevice *target);
 void sysbus_init_ioports(SysBusDevice *dev, uint32_t ioport, uint32_t size);
@@ -78,6 +79,7 @@ void sysbus_init_ioports(SysBusDevice *dev, uint32_t ioport, uint32_t size);
 
 bool sysbus_has_irq(const SysBusDevice *dev, int n);
 bool sysbus_has_mmio(const SysBusDevice *dev, unsigned int n);
+bool sysbus_has_pio(const SysBusDevice *dev, unsigned int n);
 void sysbus_connect_irq(SysBusDevice *dev, int n, qemu_irq irq);
 bool sysbus_is_irq_connected(const SysBusDevice *dev, int n);
 qemu_irq sysbus_get_connected_irq(const SysBusDevice *dev, int n);
diff --git a/hw/core/sysbus.c b/hw/core/sysbus.c
index d33be6b2b52..1dbc345a3ef 100644
--- a/hw/core/sysbus.c
+++ b/hw/core/sysbus.c
@@ -206,6 +206,17 @@ void sysbus_init_ioports(SysBusDevice *dev, uint32_t ioport, uint32_t size)
     }
 }
 
+bool sysbus_has_pio(const SysBusDevice *dev, unsigned int n)
+{
+    return (n < dev->num_pio);
+}
+
+uint32_t sysbus_pio_get_address(const SysBusDevice *dev, int n)
+{
+    assert(n >= 0 && n < QDEV_MAX_PIO);
+    return dev->pio[n];
+}
+
 /* The purpose of preserving this empty realize function
  * is to prevent the parent_realize field of some subclasses
  * from being set to NULL to break the normal init/realize
-- 
2.51.0



^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [PATCH 08/27] hw/pci-bridge/pci_expander_bridge: Use proper SysBus accessors
  2025-10-24 19:03 [PATCH 00/27] hw/sysbus: Spring cleanups (part 1) Philippe Mathieu-Daudé
                   ` (6 preceding siblings ...)
  2025-10-24 19:03 ` [PATCH 07/27] hw/sysbus: Add sysbus_has_pio() and sysbus_pio_get_address() Philippe Mathieu-Daudé
@ 2025-10-24 19:03 ` Philippe Mathieu-Daudé
  2025-10-24 19:03 ` [PATCH 09/27] hw/platform-bus: Include missing 'system/memory.h' header Philippe Mathieu-Daudé
                   ` (18 subsequent siblings)
  26 siblings, 0 replies; 35+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-10-24 19:03 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-arm, qemu-riscv, qemu-block, Philippe Mathieu-Daudé,
	Michael S. Tsirkin, Marcel Apfelbaum

SysBusDevice::mmio[] and SysBusDevice::pio[] are kind of internal.
Use the proper accessors.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 hw/pci-bridge/pci_expander_bridge.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/hw/pci-bridge/pci_expander_bridge.c b/hw/pci-bridge/pci_expander_bridge.c
index 1bcceddbc4d..2e84bbe1615 100644
--- a/hw/pci-bridge/pci_expander_bridge.c
+++ b/hw/pci-bridge/pci_expander_bridge.c
@@ -157,13 +157,13 @@ static char *pxb_host_ofw_unit_address(const SysBusDevice *dev)
     main_host = PCI_HOST_BRIDGE(pxb_dev_base->parent_bus->parent);
     main_host_sbd = SYS_BUS_DEVICE(main_host);
 
-    if (main_host_sbd->num_mmio > 0) {
-        return g_strdup_printf(HWADDR_FMT_plx ",%x",
-                               main_host_sbd->mmio[0].addr, position + 1);
+    if (sysbus_has_mmio(main_host_sbd, 0)) {
+        MemoryRegion *mr = sysbus_mmio_get_region(main_host_sbd, 0);
+        return g_strdup_printf(HWADDR_FMT_plx ",%x", mr->addr, position + 1);
     }
-    if (main_host_sbd->num_pio > 0) {
-        return g_strdup_printf("i%04x,%x",
-                               main_host_sbd->pio[0], position + 1);
+    if (sysbus_has_pio(main_host_sbd, 0)) {
+        uint32_t addr = sysbus_pio_get_address(main_host_sbd, 0);
+        return g_strdup_printf("i%04x,%x", addr, position + 1);
     }
     return NULL;
 }
-- 
2.51.0



^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [PATCH 09/27] hw/platform-bus: Include missing 'system/memory.h' header
  2025-10-24 19:03 [PATCH 00/27] hw/sysbus: Spring cleanups (part 1) Philippe Mathieu-Daudé
                   ` (7 preceding siblings ...)
  2025-10-24 19:03 ` [PATCH 08/27] hw/pci-bridge/pci_expander_bridge: Use proper SysBus accessors Philippe Mathieu-Daudé
@ 2025-10-24 19:03 ` Philippe Mathieu-Daudé
  2025-10-24 19:03 ` [PATCH 10/27] hw/block/pflash: " Philippe Mathieu-Daudé
                   ` (17 subsequent siblings)
  26 siblings, 0 replies; 35+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-10-24 19:03 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-arm, qemu-riscv, qemu-block, Philippe Mathieu-Daudé

"system/memory.h" header is indirectly pulled by "hw/sysbus.h".
Include it explicitly to avoid when refactoring the latter:

  In file included from ../../hw/core/platform-bus.c:23:
  include/hw/platform-bus.h:38:18: error: field has incomplete type 'MemoryRegion' (aka 'struct MemoryRegion')
     38 |     MemoryRegion mmio;
        |                  ^
  include/qemu/typedefs.h:68:16: note: forward declaration of 'struct MemoryRegion'
     68 | typedef struct MemoryRegion MemoryRegion;
        |                ^

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 include/hw/platform-bus.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/hw/platform-bus.h b/include/hw/platform-bus.h
index 44f30c5353f..8672ccc45ec 100644
--- a/include/hw/platform-bus.h
+++ b/include/hw/platform-bus.h
@@ -24,6 +24,7 @@
 
 #include "hw/sysbus.h"
 #include "qom/object.h"
+#include "system/memory.h"
 
 
 #define TYPE_PLATFORM_BUS_DEVICE "platform-bus-device"
-- 
2.51.0



^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [PATCH 10/27] hw/block/pflash: Include missing 'system/memory.h' header
  2025-10-24 19:03 [PATCH 00/27] hw/sysbus: Spring cleanups (part 1) Philippe Mathieu-Daudé
                   ` (8 preceding siblings ...)
  2025-10-24 19:03 ` [PATCH 09/27] hw/platform-bus: Include missing 'system/memory.h' header Philippe Mathieu-Daudé
@ 2025-10-24 19:03 ` Philippe Mathieu-Daudé
  2025-10-24 19:03 ` [PATCH 11/27] hw/misc/unimp: " Philippe Mathieu-Daudé
                   ` (16 subsequent siblings)
  26 siblings, 0 replies; 35+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-10-24 19:03 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-arm, qemu-riscv, qemu-block, Philippe Mathieu-Daudé,
	Kevin Wolf, Hanna Reitz

"system/memory.h" header is indirectly pulled by "hw/sysbus.h".
Include it explicitly to avoid when refactoring the latter:

  hw/block/pflash_cfi01.c:83:18: error: field has incomplete type 'MemoryRegion' (aka 'struct MemoryRegion')
     83 |     MemoryRegion mem;
        |                  ^
  hw/block/pflash_cfi02.c:100:18: error: field has incomplete type 'MemoryRegion' (aka 'struct MemoryRegion')
    100 |     MemoryRegion mem;
        |                  ^
  include/qemu/typedefs.h:68:16: note: forward declaration of 'struct MemoryRegion'
     68 | typedef struct MemoryRegion MemoryRegion;
        |                ^

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 hw/block/pflash_cfi01.c | 1 +
 hw/block/pflash_cfi02.c | 1 +
 2 files changed, 2 insertions(+)

diff --git a/hw/block/pflash_cfi01.c b/hw/block/pflash_cfi01.c
index 168101d8dfe..04c30d17a99 100644
--- a/hw/block/pflash_cfi01.c
+++ b/hw/block/pflash_cfi01.c
@@ -51,6 +51,7 @@
 #include "hw/sysbus.h"
 #include "migration/vmstate.h"
 #include "system/blockdev.h"
+#include "system/memory.h"
 #include "system/runstate.h"
 #include "trace.h"
 
diff --git a/hw/block/pflash_cfi02.c b/hw/block/pflash_cfi02.c
index 3244b699b98..a2106a7ed9b 100644
--- a/hw/block/pflash_cfi02.c
+++ b/hw/block/pflash_cfi02.c
@@ -42,6 +42,7 @@
 #include "qemu/bitmap.h"
 #include "qemu/timer.h"
 #include "system/block-backend.h"
+#include "system/memory.h"
 #include "qemu/host-utils.h"
 #include "qemu/module.h"
 #include "hw/sysbus.h"
-- 
2.51.0



^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [PATCH 11/27] hw/misc/unimp: Include missing 'system/memory.h' header
  2025-10-24 19:03 [PATCH 00/27] hw/sysbus: Spring cleanups (part 1) Philippe Mathieu-Daudé
                   ` (9 preceding siblings ...)
  2025-10-24 19:03 ` [PATCH 10/27] hw/block/pflash: " Philippe Mathieu-Daudé
@ 2025-10-24 19:03 ` Philippe Mathieu-Daudé
  2025-10-24 19:03 ` [PATCH 12/27] hw/misc/empty_slot: " Philippe Mathieu-Daudé
                   ` (15 subsequent siblings)
  26 siblings, 0 replies; 35+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-10-24 19:03 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-arm, qemu-riscv, qemu-block, Philippe Mathieu-Daudé,
	Peter Maydell, Ani Sinha

"system/memory.h" header is indirectly pulled by "hw/sysbus.h".
Include it explicitly to avoid when refactoring the latter:

  In file included from ../../hw/arm/aspeed_ast10x0.c:17:
  include/hw/misc/unimp.h:22:18: error: field has incomplete type 'MemoryRegion' (aka 'struct MemoryRegion')
     22 |     MemoryRegion iomem;
        |                  ^

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 include/hw/misc/unimp.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/hw/misc/unimp.h b/include/hw/misc/unimp.h
index 518d627dc5d..a0a1f359e1d 100644
--- a/include/hw/misc/unimp.h
+++ b/include/hw/misc/unimp.h
@@ -12,6 +12,7 @@
 #include "hw/sysbus.h"
 #include "qapi/error.h"
 #include "qom/object.h"
+#include "system/memory.h"
 
 #define TYPE_UNIMPLEMENTED_DEVICE "unimplemented-device"
 
-- 
2.51.0



^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [PATCH 12/27] hw/misc/empty_slot: Include missing 'system/memory.h' header
  2025-10-24 19:03 [PATCH 00/27] hw/sysbus: Spring cleanups (part 1) Philippe Mathieu-Daudé
                   ` (10 preceding siblings ...)
  2025-10-24 19:03 ` [PATCH 11/27] hw/misc/unimp: " Philippe Mathieu-Daudé
@ 2025-10-24 19:03 ` Philippe Mathieu-Daudé
  2025-10-24 19:04 ` [PATCH 13/27] hw/uefi: " Philippe Mathieu-Daudé
                   ` (14 subsequent siblings)
  26 siblings, 0 replies; 35+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-10-24 19:03 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-arm, qemu-riscv, qemu-block, Philippe Mathieu-Daudé,
	Artyom Tarasenko, Ani Sinha

"system/memory.h" header is indirectly pulled by "hw/sysbus.h".
Include it explicitly to avoid when refactoring the latter:

  hw/misc/empty_slot.c:26:18: error: field has incomplete type 'MemoryRegion' (aka 'struct MemoryRegion')
     26 |     MemoryRegion iomem;
        |                  ^

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 hw/misc/empty_slot.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/hw/misc/empty_slot.c b/hw/misc/empty_slot.c
index 239d7603207..1cc3bcd9050 100644
--- a/hw/misc/empty_slot.c
+++ b/hw/misc/empty_slot.c
@@ -16,6 +16,7 @@
 #include "qapi/error.h"
 #include "trace.h"
 #include "qom/object.h"
+#include "system/memory.h"
 
 #define TYPE_EMPTY_SLOT "empty_slot"
 OBJECT_DECLARE_SIMPLE_TYPE(EmptySlot, EMPTY_SLOT)
-- 
2.51.0



^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [PATCH 13/27] hw/uefi: Include missing 'system/memory.h' header
  2025-10-24 19:03 [PATCH 00/27] hw/sysbus: Spring cleanups (part 1) Philippe Mathieu-Daudé
                   ` (11 preceding siblings ...)
  2025-10-24 19:03 ` [PATCH 12/27] hw/misc/empty_slot: " Philippe Mathieu-Daudé
@ 2025-10-24 19:04 ` Philippe Mathieu-Daudé
  2025-10-27  7:26   ` Gerd Hoffmann
  2025-10-24 19:04 ` [PATCH 14/27] hw/usb/imx: " Philippe Mathieu-Daudé
                   ` (13 subsequent siblings)
  26 siblings, 1 reply; 35+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-10-24 19:04 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-arm, qemu-riscv, qemu-block, Philippe Mathieu-Daudé,
	Gerd Hoffmann

"system/memory.h" header is indirectly pulled by "hw/sysbus.h".
Include it explicitly to avoid when refactoring the latter:

  include/hw/uefi/var-service.h:50:39: error: field has incomplete type 'MemoryRegion' (aka 'struct MemoryRegion')
     50 |     MemoryRegion                      mr;
        |                                       ^

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 include/hw/uefi/var-service.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/hw/uefi/var-service.h b/include/hw/uefi/var-service.h
index f7ceac4ce24..91fb4a20918 100644
--- a/include/hw/uefi/var-service.h
+++ b/include/hw/uefi/var-service.h
@@ -9,6 +9,7 @@
 #include "qemu/uuid.h"
 #include "qemu/queue.h"
 
+#include "system/memory.h"
 #include "hw/uefi/var-service-edk2.h"
 
 #define MAX_BUFFER_SIZE (64 * 1024)
-- 
2.51.0



^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [PATCH 14/27] hw/usb/imx: Include missing 'system/memory.h' header
  2025-10-24 19:03 [PATCH 00/27] hw/sysbus: Spring cleanups (part 1) Philippe Mathieu-Daudé
                   ` (12 preceding siblings ...)
  2025-10-24 19:04 ` [PATCH 13/27] hw/uefi: " Philippe Mathieu-Daudé
@ 2025-10-24 19:04 ` Philippe Mathieu-Daudé
  2025-10-24 19:04 ` [PATCH 15/27] hw/pci/pcihost: " Philippe Mathieu-Daudé
                   ` (12 subsequent siblings)
  26 siblings, 0 replies; 35+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-10-24 19:04 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-arm, qemu-riscv, qemu-block, Philippe Mathieu-Daudé,
	Peter Maydell, Jean-Christophe Dubois

"system/memory.h" header is indirectly pulled by "hw/sysbus.h".
Include it explicitly to avoid when refactoring the latter:

  include/hw/usb/imx-usb-phy.h:49:18: error: field has incomplete type 'MemoryRegion' (aka 'struct MemoryRegion')
     49 |     MemoryRegion iomem;
        |                  ^

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 include/hw/usb/imx-usb-phy.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/hw/usb/imx-usb-phy.h b/include/hw/usb/imx-usb-phy.h
index d1e867b77a3..a267c03c7e1 100644
--- a/include/hw/usb/imx-usb-phy.h
+++ b/include/hw/usb/imx-usb-phy.h
@@ -4,6 +4,7 @@
 #include "hw/sysbus.h"
 #include "qemu/bitops.h"
 #include "qom/object.h"
+#include "system/memory.h"
 
 enum IMXUsbPhyRegisters {
     USBPHY_PWD,
-- 
2.51.0



^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [PATCH 15/27] hw/pci/pcihost: Include missing 'system/memory.h' header
  2025-10-24 19:03 [PATCH 00/27] hw/sysbus: Spring cleanups (part 1) Philippe Mathieu-Daudé
                   ` (13 preceding siblings ...)
  2025-10-24 19:04 ` [PATCH 14/27] hw/usb/imx: " Philippe Mathieu-Daudé
@ 2025-10-24 19:04 ` Philippe Mathieu-Daudé
  2025-10-24 19:04 ` [PATCH 16/27] hw/scsi/esp: " Philippe Mathieu-Daudé
                   ` (11 subsequent siblings)
  26 siblings, 0 replies; 35+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-10-24 19:04 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-arm, qemu-riscv, qemu-block, Philippe Mathieu-Daudé,
	Michael S. Tsirkin, Marcel Apfelbaum

"system/memory.h" header is indirectly pulled by "hw/sysbus.h".
Include it explicitly to avoid when refactoring the latter:

  include/hw/pci/pci_host.h:42:18: error: field has incomplete type 'MemoryRegion' (aka 'struct MemoryRegion')
     42 |     MemoryRegion conf_mem;
        |                  ^

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 include/hw/pci/pci_host.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/hw/pci/pci_host.h b/include/hw/pci/pci_host.h
index 954dd446fa4..d06d64f6cad 100644
--- a/include/hw/pci/pci_host.h
+++ b/include/hw/pci/pci_host.h
@@ -29,6 +29,7 @@
 #define PCI_HOST_H
 
 #include "hw/sysbus.h"
+#include "system/memory.h"
 #include "qom/object.h"
 
 #define PCI_HOST_BYPASS_IOMMU "bypass-iommu"
-- 
2.51.0



^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [PATCH 16/27] hw/scsi/esp: Include missing 'system/memory.h' header
  2025-10-24 19:03 [PATCH 00/27] hw/sysbus: Spring cleanups (part 1) Philippe Mathieu-Daudé
                   ` (14 preceding siblings ...)
  2025-10-24 19:04 ` [PATCH 15/27] hw/pci/pcihost: " Philippe Mathieu-Daudé
@ 2025-10-24 19:04 ` Philippe Mathieu-Daudé
  2025-10-24 19:04 ` [PATCH 17/27] hw/avr: " Philippe Mathieu-Daudé
                   ` (10 subsequent siblings)
  26 siblings, 0 replies; 35+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-10-24 19:04 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-arm, qemu-riscv, qemu-block, Philippe Mathieu-Daudé,
	Paolo Bonzini, Fam Zheng

"system/memory.h" header is indirectly pulled by "hw/sysbus.h".
Include it explicitly to avoid when refactoring the latter:

  In file included from ../../hw/scsi/esp.c:31:
  include/hw/scsi/esp.h:82:18: error: field has incomplete type 'MemoryRegion' (aka 'struct MemoryRegion')
     82 |     MemoryRegion iomem;
        |                  ^

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 include/hw/scsi/esp.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/hw/scsi/esp.h b/include/hw/scsi/esp.h
index 3526bad7464..340a713831e 100644
--- a/include/hw/scsi/esp.h
+++ b/include/hw/scsi/esp.h
@@ -1,6 +1,7 @@
 #ifndef QEMU_HW_ESP_H
 #define QEMU_HW_ESP_H
 
+#include "system/memory.h"
 #include "hw/scsi/scsi.h"
 #include "hw/sysbus.h"
 #include "qemu/fifo8.h"
-- 
2.51.0



^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [PATCH 17/27] hw/avr: Include missing 'system/memory.h' header
  2025-10-24 19:03 [PATCH 00/27] hw/sysbus: Spring cleanups (part 1) Philippe Mathieu-Daudé
                   ` (15 preceding siblings ...)
  2025-10-24 19:04 ` [PATCH 16/27] hw/scsi/esp: " Philippe Mathieu-Daudé
@ 2025-10-24 19:04 ` Philippe Mathieu-Daudé
  2025-10-24 19:04 ` [PATCH 18/27] hw/input/lassi: " Philippe Mathieu-Daudé
                   ` (9 subsequent siblings)
  26 siblings, 0 replies; 35+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-10-24 19:04 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-arm, qemu-riscv, qemu-block, Philippe Mathieu-Daudé,
	Michael Rolnik, Marc-André Lureau, Paolo Bonzini

"system/memory.h" header is indirectly pulled by "hw/sysbus.h".
Include it explicitly to avoid when refactoring the latter:

  In file included from ../../hw/misc/avr_power.c:26:
  include/hw/misc/avr_power.h:40:18: error: field has incomplete type 'MemoryRegion' (aka 'struct MemoryRegion')
     40 |     MemoryRegion iomem;
        |                  ^
  In file included from ../../hw/timer/avr_timer16.c:39:
  include/hw/timer/avr_timer16.h:51:18: error: field has incomplete type 'MemoryRegion' (aka 'struct MemoryRegion')
     51 |     MemoryRegion iomem;
        |                  ^
  In file included from ../../hw/char/avr_usart.c:23:
  include/hw/char/avr_usart.h:67:18: error: field has incomplete type 'MemoryRegion' (aka 'struct MemoryRegion')
     67 |     MemoryRegion mmio;
        |                  ^
  include/qemu/typedefs.h:68:16: note: forward declaration of 'struct MemoryRegion'
     68 | typedef struct MemoryRegion MemoryRegion;
        |                ^

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 include/hw/char/avr_usart.h    | 1 +
 include/hw/misc/avr_power.h    | 1 +
 include/hw/timer/avr_timer16.h | 1 +
 3 files changed, 3 insertions(+)

diff --git a/include/hw/char/avr_usart.h b/include/hw/char/avr_usart.h
index 0cc599e9b15..2d2fc0669f2 100644
--- a/include/hw/char/avr_usart.h
+++ b/include/hw/char/avr_usart.h
@@ -25,6 +25,7 @@
 #include "hw/sysbus.h"
 #include "chardev/char-fe.h"
 #include "qom/object.h"
+#include "system/memory.h"
 
 /* Offsets of registers. */
 #define USART_DR   0x06
diff --git a/include/hw/misc/avr_power.h b/include/hw/misc/avr_power.h
index 388e421aa7b..a3d3d1de878 100644
--- a/include/hw/misc/avr_power.h
+++ b/include/hw/misc/avr_power.h
@@ -27,6 +27,7 @@
 
 #include "hw/sysbus.h"
 #include "qom/object.h"
+#include "system/memory.h"
 
 
 #define TYPE_AVR_MASK "avr-power"
diff --git a/include/hw/timer/avr_timer16.h b/include/hw/timer/avr_timer16.h
index a1a032a24dc..c08288d6227 100644
--- a/include/hw/timer/avr_timer16.h
+++ b/include/hw/timer/avr_timer16.h
@@ -31,6 +31,7 @@
 #include "hw/sysbus.h"
 #include "qemu/timer.h"
 #include "qom/object.h"
+#include "system/memory.h"
 
 enum NextInterrupt {
     OVERFLOW,
-- 
2.51.0



^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [PATCH 18/27] hw/input/lassi: Include missing 'system/memory.h' header
  2025-10-24 19:03 [PATCH 00/27] hw/sysbus: Spring cleanups (part 1) Philippe Mathieu-Daudé
                   ` (16 preceding siblings ...)
  2025-10-24 19:04 ` [PATCH 17/27] hw/avr: " Philippe Mathieu-Daudé
@ 2025-10-24 19:04 ` Philippe Mathieu-Daudé
  2025-10-24 19:04 ` [PATCH 19/27] hw/tricore: " Philippe Mathieu-Daudé
                   ` (8 subsequent siblings)
  26 siblings, 0 replies; 35+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-10-24 19:04 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-arm, qemu-riscv, qemu-block, Philippe Mathieu-Daudé,
	Richard Henderson, Helge Deller

"system/memory.h" header is indirectly pulled by "hw/sysbus.h".
Include it explicitly to avoid when refactoring the latter:

  In file included from ../../hw/input/lasips2.c:29:
  include/hw/input/lasips2.h:41:18: error: field has incomplete type 'MemoryRegion' (aka 'struct MemoryRegion')
     41 |     MemoryRegion reg;
        |                  ^

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 include/hw/input/lasips2.h | 1 +
 include/hw/misc/lasi.h     | 1 +
 2 files changed, 2 insertions(+)

diff --git a/include/hw/input/lasips2.h b/include/hw/input/lasips2.h
index 01911c50f9b..3510216effd 100644
--- a/include/hw/input/lasips2.h
+++ b/include/hw/input/lasips2.h
@@ -22,6 +22,7 @@
 #include "exec/hwaddr.h"
 #include "hw/sysbus.h"
 #include "hw/input/ps2.h"
+#include "system/memory.h"
 
 #define TYPE_LASIPS2_PORT "lasips2-port"
 OBJECT_DECLARE_TYPE(LASIPS2Port, LASIPS2PortDeviceClass, LASIPS2_PORT)
diff --git a/include/hw/misc/lasi.h b/include/hw/misc/lasi.h
index 0bdfb11b501..70c99fc017e 100644
--- a/include/hw/misc/lasi.h
+++ b/include/hw/misc/lasi.h
@@ -15,6 +15,7 @@
 #include "system/address-spaces.h"
 #include "hw/pci/pci_host.h"
 #include "hw/boards.h"
+#include "system/memory.h"
 
 #define TYPE_LASI_CHIP "lasi-chip"
 OBJECT_DECLARE_SIMPLE_TYPE(LasiState, LASI_CHIP)
-- 
2.51.0



^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [PATCH 19/27] hw/tricore: Include missing 'system/memory.h' header
  2025-10-24 19:03 [PATCH 00/27] hw/sysbus: Spring cleanups (part 1) Philippe Mathieu-Daudé
                   ` (17 preceding siblings ...)
  2025-10-24 19:04 ` [PATCH 18/27] hw/input/lassi: " Philippe Mathieu-Daudé
@ 2025-10-24 19:04 ` Philippe Mathieu-Daudé
  2025-10-24 19:04 ` [PATCH 20/27] hw/int/loongarch: " Philippe Mathieu-Daudé
                   ` (7 subsequent siblings)
  26 siblings, 0 replies; 35+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-10-24 19:04 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-arm, qemu-riscv, qemu-block, Philippe Mathieu-Daudé,
	Bastian Koppelmann

"system/memory.h" header is indirectly pulled by "hw/sysbus.h".
Include it explicitly to avoid when refactoring the latter:

  include/hw/tricore/tricore_testdevice.h:30:18: error: field has incomplete type 'MemoryRegion' (aka 'struct MemoryRegion')
     30 |     MemoryRegion iomem;
        |                  ^

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 include/hw/tricore/tc27x_soc.h          | 1 +
 include/hw/tricore/tricore_testdevice.h | 1 +
 2 files changed, 2 insertions(+)

diff --git a/include/hw/tricore/tc27x_soc.h b/include/hw/tricore/tc27x_soc.h
index dd3a7485c85..40962eab04d 100644
--- a/include/hw/tricore/tc27x_soc.h
+++ b/include/hw/tricore/tc27x_soc.h
@@ -24,6 +24,7 @@
 #include "hw/sysbus.h"
 #include "target/tricore/cpu.h"
 #include "qom/object.h"
+#include "system/memory.h"
 
 #define TYPE_TC27X_SOC ("tc27x-soc")
 OBJECT_DECLARE_TYPE(TC27XSoCState, TC27XSoCClass, TC27X_SOC)
diff --git a/include/hw/tricore/tricore_testdevice.h b/include/hw/tricore/tricore_testdevice.h
index 2c57b62f222..98ef6e7a3d0 100644
--- a/include/hw/tricore/tricore_testdevice.h
+++ b/include/hw/tricore/tricore_testdevice.h
@@ -19,6 +19,7 @@
 #define HW_TRICORE_TESTDEVICE_H
 
 #include "hw/sysbus.h"
+#include "system/memory.h"
 
 #define TYPE_TRICORE_TESTDEVICE "tricore_testdevice"
 #define TRICORE_TESTDEVICE(obj) \
-- 
2.51.0



^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [PATCH 20/27] hw/int/loongarch: Include missing 'system/memory.h' header
  2025-10-24 19:03 [PATCH 00/27] hw/sysbus: Spring cleanups (part 1) Philippe Mathieu-Daudé
                   ` (18 preceding siblings ...)
  2025-10-24 19:04 ` [PATCH 19/27] hw/tricore: " Philippe Mathieu-Daudé
@ 2025-10-24 19:04 ` Philippe Mathieu-Daudé
  2025-10-27  2:49   ` Bibo Mao
  2025-10-24 19:04 ` [PATCH 21/27] hw/rtc/m48t59: " Philippe Mathieu-Daudé
                   ` (6 subsequent siblings)
  26 siblings, 1 reply; 35+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-10-24 19:04 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-arm, qemu-riscv, qemu-block, Philippe Mathieu-Daudé,
	Song Gao, Bibo Mao, Jiaxun Yang, Huacai Chen

"system/memory.h" header is indirectly pulled by "hw/sysbus.h".
Include it explicitly to avoid when refactoring the latter:

  In file included from ../../hw/intc/loongson_ipi.c:9:
  In file included from /Users/philmd/source/qemu/include/hw/intc/loongson_ipi.h:12:
  include/hw/intc/loongson_ipi_common.h:37:18: error: field has incomplete type 'MemoryRegion' (aka 'struct MemoryRegion')
     37 |     MemoryRegion ipi_iocsr_mem;
        |                  ^

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 include/hw/intc/loongarch_dintc.h         | 2 +-
 include/hw/intc/loongarch_extioi_common.h | 1 +
 include/hw/intc/loongarch_pch_msi.h       | 1 +
 include/hw/intc/loongarch_pic_common.h    | 1 +
 include/hw/intc/loongson_ipi_common.h     | 2 ++
 5 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/include/hw/intc/loongarch_dintc.h b/include/hw/intc/loongarch_dintc.h
index 0b0b5347b2c..01bb1e465cb 100644
--- a/include/hw/intc/loongarch_dintc.h
+++ b/include/hw/intc/loongarch_dintc.h
@@ -8,7 +8,7 @@
 #include "qom/object.h"
 #include "hw/sysbus.h"
 #include "hw/loongarch/virt.h"
-
+#include "system/memory.h"
 
 #define NR_VECTORS     256
 
diff --git a/include/hw/intc/loongarch_extioi_common.h b/include/hw/intc/loongarch_extioi_common.h
index c021ccee0fa..1bd2bfa07fc 100644
--- a/include/hw/intc/loongarch_extioi_common.h
+++ b/include/hw/intc/loongarch_extioi_common.h
@@ -10,6 +10,7 @@
 #include "qom/object.h"
 #include "hw/sysbus.h"
 #include "hw/loongarch/virt.h"
+#include "system/memory.h"
 
 #define LS3A_INTC_IP                 8
 #define EXTIOI_IRQS                  (256)
diff --git a/include/hw/intc/loongarch_pch_msi.h b/include/hw/intc/loongarch_pch_msi.h
index b8586fb3b6f..ef4ec4fdeb8 100644
--- a/include/hw/intc/loongarch_pch_msi.h
+++ b/include/hw/intc/loongarch_pch_msi.h
@@ -6,6 +6,7 @@
  */
 
 #include "hw/sysbus.h"
+#include "system/memory.h"
 
 #define TYPE_LOONGARCH_PCH_MSI "loongarch_pch_msi"
 OBJECT_DECLARE_SIMPLE_TYPE(LoongArchPCHMSI, LOONGARCH_PCH_MSI)
diff --git a/include/hw/intc/loongarch_pic_common.h b/include/hw/intc/loongarch_pic_common.h
index 675ba96e64e..179361eb567 100644
--- a/include/hw/intc/loongarch_pic_common.h
+++ b/include/hw/intc/loongarch_pic_common.h
@@ -9,6 +9,7 @@
 
 #include "hw/loongarch/virt.h"
 #include "hw/sysbus.h"
+#include "system/memory.h"
 
 #define PCH_PIC_INT_ID                  0x00
 #define  PCH_PIC_INT_ID_VAL             0x7
diff --git a/include/hw/intc/loongson_ipi_common.h b/include/hw/intc/loongson_ipi_common.h
index e58ce2aa1c4..8b51af83e8b 100644
--- a/include/hw/intc/loongson_ipi_common.h
+++ b/include/hw/intc/loongson_ipi_common.h
@@ -11,6 +11,8 @@
 #include "qom/object.h"
 #include "hw/sysbus.h"
 #include "exec/memattrs.h"
+#include "system/memory.h"
+#include "system/memory.h"
 
 #define IPI_MBX_NUM           4
 
-- 
2.51.0



^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [PATCH 21/27] hw/rtc/m48t59: Include missing 'system/memory.h' header
  2025-10-24 19:03 [PATCH 00/27] hw/sysbus: Spring cleanups (part 1) Philippe Mathieu-Daudé
                   ` (19 preceding siblings ...)
  2025-10-24 19:04 ` [PATCH 20/27] hw/int/loongarch: " Philippe Mathieu-Daudé
@ 2025-10-24 19:04 ` Philippe Mathieu-Daudé
  2025-10-24 19:04 ` [PATCH 22/27] hw/rtc/sun: Include 'exec/cpu-common.h' and 'system/memory.h' headers Philippe Mathieu-Daudé
                   ` (5 subsequent siblings)
  26 siblings, 0 replies; 35+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-10-24 19:04 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-arm, qemu-riscv, qemu-block, Philippe Mathieu-Daudé

"system/memory.h" header is indirectly pulled by "hw/sysbus.h".
Include it explicitly to avoid when refactoring the latter:

  In file included from ../../hw/rtc/m48t59.c:41:
  ../../hw/rtc/m48t59-internal.h:44:18: error: field has incomplete type 'MemoryRegion' (aka 'struct MemoryRegion')
     44 |     MemoryRegion iomem;
        |                  ^

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 hw/rtc/m48t59-internal.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/hw/rtc/m48t59-internal.h b/hw/rtc/m48t59-internal.h
index cd648241e98..791c15b7184 100644
--- a/hw/rtc/m48t59-internal.h
+++ b/hw/rtc/m48t59-internal.h
@@ -26,6 +26,8 @@
 #ifndef HW_M48T59_INTERNAL_H
 #define HW_M48T59_INTERNAL_H
 
+#include "system/memory.h"
+
 /*
  * The M48T02, M48T08 and M48T59 chips are very similar. The newer '59 has
  * alarm and a watchdog timer and related control registers. In the
-- 
2.51.0



^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [PATCH 22/27] hw/rtc/sun: Include 'exec/cpu-common.h' and 'system/memory.h' headers
  2025-10-24 19:03 [PATCH 00/27] hw/sysbus: Spring cleanups (part 1) Philippe Mathieu-Daudé
                   ` (20 preceding siblings ...)
  2025-10-24 19:04 ` [PATCH 21/27] hw/rtc/m48t59: " Philippe Mathieu-Daudé
@ 2025-10-24 19:04 ` Philippe Mathieu-Daudé
  2025-10-24 19:04 ` [PATCH 23/27] hw/xilinx: " Philippe Mathieu-Daudé
                   ` (4 subsequent siblings)
  26 siblings, 0 replies; 35+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-10-24 19:04 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-arm, qemu-riscv, qemu-block, Philippe Mathieu-Daudé,
	Artyom Tarasenko

"exec/cpu-common.h" and "system/memory.h" headers are indirectly
pulled by "hw/sysbus.h". Include them explicitly to avoid when
refactoring the latter:

  hw/rtc/sun4v-rtc.c:28:18: error: field has incomplete type 'MemoryRegion' (aka 'struct MemoryRegion')
     28 |     MemoryRegion iomem;
        |                  ^
  hw/rtc/sun4v-rtc.c:52:19: error: use of undeclared identifier 'DEVICE_NATIVE_ENDIAN'
     52 |     .endianness = DEVICE_NATIVE_ENDIAN,
        |                   ^

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 hw/rtc/sun4v-rtc.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/hw/rtc/sun4v-rtc.c b/hw/rtc/sun4v-rtc.c
index 29e24ef6bed..c0859b270d3 100644
--- a/hw/rtc/sun4v-rtc.c
+++ b/hw/rtc/sun4v-rtc.c
@@ -17,6 +17,8 @@
 #include "hw/rtc/sun4v-rtc.h"
 #include "trace.h"
 #include "qom/object.h"
+#include "exec/cpu-common.h"
+#include "system/memory.h"
 
 
 #define TYPE_SUN4V_RTC "sun4v_rtc"
-- 
2.51.0



^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [PATCH 23/27] hw/xilinx: Include 'exec/cpu-common.h' and 'system/memory.h' headers
  2025-10-24 19:03 [PATCH 00/27] hw/sysbus: Spring cleanups (part 1) Philippe Mathieu-Daudé
                   ` (21 preceding siblings ...)
  2025-10-24 19:04 ` [PATCH 22/27] hw/rtc/sun: Include 'exec/cpu-common.h' and 'system/memory.h' headers Philippe Mathieu-Daudé
@ 2025-10-24 19:04 ` Philippe Mathieu-Daudé
  2025-10-24 19:04 ` [PATCH 24/27] hw/mips: Include missing 'system/memory.h' header Philippe Mathieu-Daudé
                   ` (3 subsequent siblings)
  26 siblings, 0 replies; 35+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-10-24 19:04 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-arm, qemu-riscv, qemu-block, Philippe Mathieu-Daudé,
	Edgar E. Iglesias, Alistair Francis, Peter Maydell,
	Marc-André Lureau, Paolo Bonzini, Jason Wang

"exec/cpu-common.h" and "system/memory.h" headers are indirectly
pulled by "hw/sysbus.h". Include them explicitly to avoid when
refactoring the latter:

  hw/ssi/xilinx_spi.c:88:5: error: unknown type name 'EndianMode'
     88 |     EndianMode model_endianness;
        |     ^
  hw/ssi/xilinx_spi.c:89:18: error: field has incomplete type 'MemoryRegion' (aka 'struct MemoryRegion')
     89 |     MemoryRegion mmio;
        |                  ^
  hw/timer/xilinx_timer.c:77:5: error: unknown type name 'EndianMode'
     77 |     EndianMode model_endianness;
        |     ^
  hw/timer/xilinx_timer.c:78:18: error: field has incomplete type 'MemoryRegion' (aka 'struct MemoryRegion')
     78 |     MemoryRegion mmio;
        |                  ^
  hw/char/xilinx_uartlite.c:61:5: error: unknown type name 'EndianMode'
     61 |     EndianMode model_endianness;
        |     ^
  hw/char/xilinx_uartlite.c:62:18: error: field has incomplete type 'MemoryRegion' (aka 'struct MemoryRegion')
     62 |     MemoryRegion mmio;
        |                  ^
  hw/intc/xilinx_intc.c:57:5: error: unknown type name 'EndianMode'
     57 |     EndianMode model_endianness;
        |     ^
  hw/intc/xilinx_intc.c:58:18: error: field has incomplete type 'MemoryRegion' (aka 'struct MemoryRegion')
     58 |     MemoryRegion mmio;
        |                  ^
  hw/net/xilinx_axienet.c:320:18: error: field has incomplete type 'MemoryRegion' (aka 'struct MemoryRegion')
    320 |     MemoryRegion iomem;
        |                  ^
  hw/net/xilinx_axienet.c:645:19: error: use of undeclared identifier 'DEVICE_LITTLE_ENDIAN'
    645 |     .endianness = DEVICE_LITTLE_ENDIAN,
        |                   ^

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 hw/char/xilinx_uartlite.c | 2 ++
 hw/intc/xilinx_intc.c     | 2 ++
 hw/net/xilinx_axienet.c   | 2 ++
 hw/ssi/xilinx_spi.c       | 2 ++
 hw/timer/xilinx_timer.c   | 2 ++
 5 files changed, 10 insertions(+)

diff --git a/hw/char/xilinx_uartlite.c b/hw/char/xilinx_uartlite.c
index 8008171eea9..94f5bc22a1c 100644
--- a/hw/char/xilinx_uartlite.c
+++ b/hw/char/xilinx_uartlite.c
@@ -25,6 +25,7 @@
 #include "qemu/osdep.h"
 #include "qemu/log.h"
 #include "qapi/error.h"
+#include "qapi/qapi-types-common.h"
 #include "hw/char/xilinx_uartlite.h"
 #include "hw/irq.h"
 #include "hw/qdev-properties.h"
@@ -33,6 +34,7 @@
 #include "qemu/module.h"
 #include "chardev/char-fe.h"
 #include "qom/object.h"
+#include "system/memory.h"
 
 #define DUART(x)
 
diff --git a/hw/intc/xilinx_intc.c b/hw/intc/xilinx_intc.c
index 5257ad54b17..5aa85ada5f8 100644
--- a/hw/intc/xilinx_intc.c
+++ b/hw/intc/xilinx_intc.c
@@ -27,12 +27,14 @@
 
 #include "qemu/osdep.h"
 #include "qapi/error.h"
+#include "qapi/qapi-types-common.h"
 #include "hw/sysbus.h"
 #include "qemu/module.h"
 #include "hw/irq.h"
 #include "hw/qdev-properties.h"
 #include "hw/qdev-properties-system.h"
 #include "qom/object.h"
+#include "system/memory.h"
 
 #define D(x)
 
diff --git a/hw/net/xilinx_axienet.c b/hw/net/xilinx_axienet.c
index 1f5c7480476..f4f2571c228 100644
--- a/hw/net/xilinx_axienet.c
+++ b/hw/net/xilinx_axienet.c
@@ -31,10 +31,12 @@
 #include "net/net.h"
 #include "net/checksum.h"
 
+#include "exec/cpu-common.h"
 #include "hw/irq.h"
 #include "hw/qdev-properties.h"
 #include "hw/stream.h"
 #include "qom/object.h"
+#include "system/memory.h"
 
 #define DPHY(x)
 
diff --git a/hw/ssi/xilinx_spi.c b/hw/ssi/xilinx_spi.c
index 4144c8a6270..6039a654c3d 100644
--- a/hw/ssi/xilinx_spi.c
+++ b/hw/ssi/xilinx_spi.c
@@ -26,6 +26,7 @@
 
 #include "qemu/osdep.h"
 #include "qapi/error.h"
+#include "qapi/qapi-types-common.h"
 #include "hw/sysbus.h"
 #include "migration/vmstate.h"
 #include "qemu/module.h"
@@ -36,6 +37,7 @@
 #include "hw/qdev-properties-system.h"
 #include "hw/ssi/ssi.h"
 #include "qom/object.h"
+#include "system/memory.h"
 
 #ifdef XILINX_SPI_ERR_DEBUG
 #define DB_PRINT(...) do { \
diff --git a/hw/timer/xilinx_timer.c b/hw/timer/xilinx_timer.c
index ff4a224d08f..51658ee2bd9 100644
--- a/hw/timer/xilinx_timer.c
+++ b/hw/timer/xilinx_timer.c
@@ -27,6 +27,7 @@
 
 #include "qemu/osdep.h"
 #include "qapi/error.h"
+#include "qapi/qapi-types-common.h"
 #include "hw/sysbus.h"
 #include "hw/irq.h"
 #include "hw/ptimer.h"
@@ -35,6 +36,7 @@
 #include "qemu/log.h"
 #include "qemu/module.h"
 #include "qom/object.h"
+#include "system/memory.h"
 
 #define D(x)
 
-- 
2.51.0



^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [PATCH 24/27] hw/mips: Include missing 'system/memory.h' header
  2025-10-24 19:03 [PATCH 00/27] hw/sysbus: Spring cleanups (part 1) Philippe Mathieu-Daudé
                   ` (22 preceding siblings ...)
  2025-10-24 19:04 ` [PATCH 23/27] hw/xilinx: " Philippe Mathieu-Daudé
@ 2025-10-24 19:04 ` Philippe Mathieu-Daudé
  2025-10-24 19:04 ` [PATCH 25/27] hw/sparc: " Philippe Mathieu-Daudé
                   ` (2 subsequent siblings)
  26 siblings, 0 replies; 35+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-10-24 19:04 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-arm, qemu-riscv, qemu-block, Philippe Mathieu-Daudé,
	Jiaxun Yang

"system/memory.h" header is indirectly pulled by "hw/sysbus.h".
Include it explicitly to avoid when refactoring the latter:

  In file included from ../../hw/misc/mips_itu.c:26:
  include/hw/misc/mips_itu.h:65:18: error: field has incomplete type 'MemoryRegion' (aka 'struct MemoryRegion')
     65 |     MemoryRegion storage_io;
        |                  ^
  In file included from ../../hw/misc/mips_cmgcr.c:17:
  include/hw/misc/mips_cmgcr.h:80:18: error: field has incomplete type 'MemoryRegion' (aka 'struct MemoryRegion')
     80 |     MemoryRegion iomem;
        |                  ^

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 include/hw/misc/mips_cmgcr.h | 1 +
 include/hw/misc/mips_itu.h   | 1 +
 2 files changed, 2 insertions(+)

diff --git a/include/hw/misc/mips_cmgcr.h b/include/hw/misc/mips_cmgcr.h
index db4bf5f4499..e15731f18ce 100644
--- a/include/hw/misc/mips_cmgcr.h
+++ b/include/hw/misc/mips_cmgcr.h
@@ -12,6 +12,7 @@
 
 #include "hw/sysbus.h"
 #include "qom/object.h"
+#include "system/memory.h"
 
 #define TYPE_MIPS_GCR "mips-gcr"
 OBJECT_DECLARE_SIMPLE_TYPE(MIPSGCRState, MIPS_GCR)
diff --git a/include/hw/misc/mips_itu.h b/include/hw/misc/mips_itu.h
index 27c9a1090d5..1a684d90a15 100644
--- a/include/hw/misc/mips_itu.h
+++ b/include/hw/misc/mips_itu.h
@@ -22,6 +22,7 @@
 
 #include "hw/sysbus.h"
 #include "qom/object.h"
+#include "system/memory.h"
 
 #define TYPE_MIPS_ITU "mips-itu"
 OBJECT_DECLARE_SIMPLE_TYPE(MIPSITUState, MIPS_ITU)
-- 
2.51.0



^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [PATCH 25/27] hw/sparc: Include missing 'system/memory.h' header
  2025-10-24 19:03 [PATCH 00/27] hw/sysbus: Spring cleanups (part 1) Philippe Mathieu-Daudé
                   ` (23 preceding siblings ...)
  2025-10-24 19:04 ` [PATCH 24/27] hw/mips: Include missing 'system/memory.h' header Philippe Mathieu-Daudé
@ 2025-10-24 19:04 ` Philippe Mathieu-Daudé
  2025-10-24 19:04 ` [PATCH 26/27] hw/riscv: " Philippe Mathieu-Daudé
  2025-10-24 19:04 ` [PATCH 27/27] hw/rx: " Philippe Mathieu-Daudé
  26 siblings, 0 replies; 35+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-10-24 19:04 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-arm, qemu-riscv, qemu-block, Philippe Mathieu-Daudé,
	Mark Cave-Ayland

"system/memory.h" header is indirectly pulled by "hw/sysbus.h".
Include it explicitly to avoid when refactoring the latter:

  In file included from ../../hw/sparc/sun4m_iommu.c:28:
  include/hw/sparc/sun4m_iommu.h:36:18: error: field has incomplete type 'AddressSpace' (aka 'struct AddressSpace')
     36 |     AddressSpace iommu_as;
        |                  ^
  In file included from ../../hw/sparc64/sun4u_iommu.c:29:
  include/hw/sparc/sun4u_iommu.h:38:18: error: field has incomplete type 'AddressSpace' (aka 'struct AddressSpace')
     38 |     AddressSpace iommu_as;
        |                  ^
  include/qemu/typedefs.h:27:16: note: forward declaration of 'struct AddressSpace'
     27 | typedef struct AddressSpace AddressSpace;
        |                ^

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 include/hw/sparc/sparc32_dma.h | 1 +
 include/hw/sparc/sun4m_iommu.h | 1 +
 include/hw/sparc/sun4u_iommu.h | 1 +
 3 files changed, 3 insertions(+)

diff --git a/include/hw/sparc/sparc32_dma.h b/include/hw/sparc/sparc32_dma.h
index cde8ec02cb6..46ed0a20d88 100644
--- a/include/hw/sparc/sparc32_dma.h
+++ b/include/hw/sparc/sparc32_dma.h
@@ -5,6 +5,7 @@
 #include "hw/scsi/esp.h"
 #include "hw/net/lance.h"
 #include "qom/object.h"
+#include "system/memory.h"
 
 #define DMA_REGS 4
 
diff --git a/include/hw/sparc/sun4m_iommu.h b/include/hw/sparc/sun4m_iommu.h
index 4e2ab34cdef..dd09a72c525 100644
--- a/include/hw/sparc/sun4m_iommu.h
+++ b/include/hw/sparc/sun4m_iommu.h
@@ -27,6 +27,7 @@
 
 #include "hw/sysbus.h"
 #include "qom/object.h"
+#include "system/memory.h"
 
 #define IOMMU_NREGS         (4 * 4096 / 4)
 
diff --git a/include/hw/sparc/sun4u_iommu.h b/include/hw/sparc/sun4u_iommu.h
index f94566a72c9..fad71264408 100644
--- a/include/hw/sparc/sun4u_iommu.h
+++ b/include/hw/sparc/sun4u_iommu.h
@@ -29,6 +29,7 @@
 
 #include "hw/sysbus.h"
 #include "qom/object.h"
+#include "system/memory.h"
 
 #define IOMMU_NREGS             3
 
-- 
2.51.0



^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [PATCH 26/27] hw/riscv: Include missing 'system/memory.h' header
  2025-10-24 19:03 [PATCH 00/27] hw/sysbus: Spring cleanups (part 1) Philippe Mathieu-Daudé
                   ` (24 preceding siblings ...)
  2025-10-24 19:04 ` [PATCH 25/27] hw/sparc: " Philippe Mathieu-Daudé
@ 2025-10-24 19:04 ` Philippe Mathieu-Daudé
  2025-10-24 19:04 ` [PATCH 27/27] hw/rx: " Philippe Mathieu-Daudé
  26 siblings, 0 replies; 35+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-10-24 19:04 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-arm, qemu-riscv, qemu-block, Philippe Mathieu-Daudé,
	Marc-André Lureau, Paolo Bonzini, Alistair Francis,
	Vijai Kumar K, Palmer Dabbelt, Jason Wang, Weiwei Li,
	Daniel Henrique Barboza, Liu Zhiwei, Ran Wang, Anup Patel

"system/memory.h" header is indirectly pulled by "hw/sysbus.h".
Include it explicitly to avoid build error when refactoring the
latter.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 include/hw/char/cadence_uart.h      | 1 +
 include/hw/char/ibex_uart.h         | 1 +
 include/hw/char/shakti_uart.h       | 1 +
 include/hw/char/sifive_uart.h       | 1 +
 include/hw/gpio/sifive_gpio.h       | 1 +
 include/hw/intc/riscv_aclint.h      | 1 +
 include/hw/intc/riscv_aplic.h       | 1 +
 include/hw/intc/riscv_imsic.h       | 1 +
 include/hw/intc/sifive_plic.h       | 1 +
 include/hw/misc/mchp_pfsoc_dmc.h    | 1 +
 include/hw/misc/mchp_pfsoc_ioscb.h  | 1 +
 include/hw/misc/mchp_pfsoc_sysreg.h | 1 +
 include/hw/misc/sifive_e_aon.h      | 1 +
 include/hw/misc/sifive_e_prci.h     | 1 +
 include/hw/misc/sifive_test.h       | 1 +
 include/hw/misc/sifive_u_otp.h      | 1 +
 include/hw/misc/sifive_u_prci.h     | 1 +
 include/hw/net/cadence_gem.h        | 1 +
 include/hw/riscv/opentitan.h        | 1 +
 include/hw/riscv/shakti_c.h         | 1 +
 include/hw/riscv/sifive_e.h         | 1 +
 include/hw/riscv/xiangshan_kmh.h    | 1 +
 include/hw/rtc/goldfish_rtc.h       | 1 +
 include/hw/ssi/ibex_spi_host.h      | 1 +
 include/hw/ssi/sifive_spi.h         | 1 +
 include/hw/timer/cadence_ttc.h      | 1 +
 include/hw/timer/ibex_timer.h       | 1 +
 include/hw/timer/sifive_pwm.h       | 1 +
 28 files changed, 28 insertions(+)

diff --git a/include/hw/char/cadence_uart.h b/include/hw/char/cadence_uart.h
index e7f7cd84683..d2b48313d4e 100644
--- a/include/hw/char/cadence_uart.h
+++ b/include/hw/char/cadence_uart.h
@@ -25,6 +25,7 @@
 #include "qapi/error.h"
 #include "qemu/timer.h"
 #include "qom/object.h"
+#include "system/memory.h"
 
 #define CADENCE_UART_RX_FIFO_SIZE           16
 #define CADENCE_UART_TX_FIFO_SIZE           16
diff --git a/include/hw/char/ibex_uart.h b/include/hw/char/ibex_uart.h
index 9deadf223bf..f95780063fe 100644
--- a/include/hw/char/ibex_uart.h
+++ b/include/hw/char/ibex_uart.h
@@ -29,6 +29,7 @@
 #include "chardev/char-fe.h"
 #include "qemu/timer.h"
 #include "qom/object.h"
+#include "system/memory.h"
 
 #define IBEX_UART_TX_FIFO_SIZE 16
 #define IBEX_UART_CLOCK 50000000 /* 50MHz clock */
diff --git a/include/hw/char/shakti_uart.h b/include/hw/char/shakti_uart.h
index 526c408233f..c15b5f9c82c 100644
--- a/include/hw/char/shakti_uart.h
+++ b/include/hw/char/shakti_uart.h
@@ -27,6 +27,7 @@
 
 #include "hw/sysbus.h"
 #include "chardev/char-fe.h"
+#include "system/memory.h"
 
 #define SHAKTI_UART_BAUD        0x00
 #define SHAKTI_UART_TX          0x04
diff --git a/include/hw/char/sifive_uart.h b/include/hw/char/sifive_uart.h
index 0846cf62188..a46c4d12766 100644
--- a/include/hw/char/sifive_uart.h
+++ b/include/hw/char/sifive_uart.h
@@ -25,6 +25,7 @@
 #include "hw/sysbus.h"
 #include "qom/object.h"
 #include "qemu/fifo8.h"
+#include "system/memory.h"
 
 enum {
     SIFIVE_UART_TXFIFO        = 0,
diff --git a/include/hw/gpio/sifive_gpio.h b/include/hw/gpio/sifive_gpio.h
index fc53785c9d0..72e116252b7 100644
--- a/include/hw/gpio/sifive_gpio.h
+++ b/include/hw/gpio/sifive_gpio.h
@@ -16,6 +16,7 @@
 
 #include "hw/sysbus.h"
 #include "qom/object.h"
+#include "system/memory.h"
 
 #define TYPE_SIFIVE_GPIO "sifive_soc.gpio"
 typedef struct SIFIVEGPIOState SIFIVEGPIOState;
diff --git a/include/hw/intc/riscv_aclint.h b/include/hw/intc/riscv_aclint.h
index 4b7406eec00..07e562fd6c1 100644
--- a/include/hw/intc/riscv_aclint.h
+++ b/include/hw/intc/riscv_aclint.h
@@ -22,6 +22,7 @@
 #define HW_RISCV_ACLINT_H
 
 #include "hw/sysbus.h"
+#include "system/memory.h"
 
 #define TYPE_RISCV_ACLINT_MTIMER "riscv.aclint.mtimer"
 
diff --git a/include/hw/intc/riscv_aplic.h b/include/hw/intc/riscv_aplic.h
index 489b9133c26..86bbe0cf859 100644
--- a/include/hw/intc/riscv_aplic.h
+++ b/include/hw/intc/riscv_aplic.h
@@ -23,6 +23,7 @@
 #include "qom/object.h"
 
 #define TYPE_RISCV_APLIC "riscv.aplic"
+#include "system/memory.h"
 
 typedef struct RISCVAPLICState RISCVAPLICState;
 DECLARE_INSTANCE_CHECKER(RISCVAPLICState, RISCV_APLIC, TYPE_RISCV_APLIC)
diff --git a/include/hw/intc/riscv_imsic.h b/include/hw/intc/riscv_imsic.h
index 58c2aaa8dc6..4b9de5eb612 100644
--- a/include/hw/intc/riscv_imsic.h
+++ b/include/hw/intc/riscv_imsic.h
@@ -21,6 +21,7 @@
 
 #include "hw/sysbus.h"
 #include "qom/object.h"
+#include "system/memory.h"
 
 #define TYPE_RISCV_IMSIC "riscv.imsic"
 
diff --git a/include/hw/intc/sifive_plic.h b/include/hw/intc/sifive_plic.h
index d3f45ec2481..85524711da4 100644
--- a/include/hw/intc/sifive_plic.h
+++ b/include/hw/intc/sifive_plic.h
@@ -23,6 +23,7 @@
 
 #include "hw/sysbus.h"
 #include "qom/object.h"
+#include "system/memory.h"
 
 #define TYPE_SIFIVE_PLIC "riscv.sifive.plic"
 
diff --git a/include/hw/misc/mchp_pfsoc_dmc.h b/include/hw/misc/mchp_pfsoc_dmc.h
index 3bc1581e0f2..d3bc38a8ddd 100644
--- a/include/hw/misc/mchp_pfsoc_dmc.h
+++ b/include/hw/misc/mchp_pfsoc_dmc.h
@@ -24,6 +24,7 @@
 #define MCHP_PFSOC_DMC_H
 
 #include "hw/sysbus.h"
+#include "system/memory.h"
 
 /* DDR SGMII PHY module */
 
diff --git a/include/hw/misc/mchp_pfsoc_ioscb.h b/include/hw/misc/mchp_pfsoc_ioscb.h
index 3fd3e749665..276e2a1c533 100644
--- a/include/hw/misc/mchp_pfsoc_ioscb.h
+++ b/include/hw/misc/mchp_pfsoc_ioscb.h
@@ -24,6 +24,7 @@
 #define MCHP_PFSOC_IOSCB_H
 
 #include "hw/sysbus.h"
+#include "system/memory.h"
 
 typedef struct MchpPfSoCIoscbState {
     SysBusDevice parent;
diff --git a/include/hw/misc/mchp_pfsoc_sysreg.h b/include/hw/misc/mchp_pfsoc_sysreg.h
index c2232bd28d0..29ea39fe5c0 100644
--- a/include/hw/misc/mchp_pfsoc_sysreg.h
+++ b/include/hw/misc/mchp_pfsoc_sysreg.h
@@ -24,6 +24,7 @@
 #define MCHP_PFSOC_SYSREG_H
 
 #include "hw/sysbus.h"
+#include "system/memory.h"
 
 #define MCHP_PFSOC_SYSREG_REG_SIZE  0x2000
 
diff --git a/include/hw/misc/sifive_e_aon.h b/include/hw/misc/sifive_e_aon.h
index 2ae1c4139ca..77351e2ef84 100644
--- a/include/hw/misc/sifive_e_aon.h
+++ b/include/hw/misc/sifive_e_aon.h
@@ -21,6 +21,7 @@
 
 #include "hw/sysbus.h"
 #include "qom/object.h"
+#include "system/memory.h"
 
 #define TYPE_SIFIVE_E_AON "riscv.sifive.e.aon"
 OBJECT_DECLARE_SIMPLE_TYPE(SiFiveEAONState, SIFIVE_E_AON)
diff --git a/include/hw/misc/sifive_e_prci.h b/include/hw/misc/sifive_e_prci.h
index 6aa949e910d..adf9bd6da7e 100644
--- a/include/hw/misc/sifive_e_prci.h
+++ b/include/hw/misc/sifive_e_prci.h
@@ -20,6 +20,7 @@
 #define HW_SIFIVE_E_PRCI_H
 
 #include "hw/sysbus.h"
+#include "system/memory.h"
 
 enum {
     SIFIVE_E_PRCI_HFROSCCFG = 0x0,
diff --git a/include/hw/misc/sifive_test.h b/include/hw/misc/sifive_test.h
index 88a38d00c59..a995b397f66 100644
--- a/include/hw/misc/sifive_test.h
+++ b/include/hw/misc/sifive_test.h
@@ -21,6 +21,7 @@
 
 #include "hw/sysbus.h"
 #include "qom/object.h"
+#include "system/memory.h"
 
 #define TYPE_SIFIVE_TEST "riscv.sifive.test"
 
diff --git a/include/hw/misc/sifive_u_otp.h b/include/hw/misc/sifive_u_otp.h
index 170d2148f25..99e9c0b6bcf 100644
--- a/include/hw/misc/sifive_u_otp.h
+++ b/include/hw/misc/sifive_u_otp.h
@@ -20,6 +20,7 @@
 #define HW_SIFIVE_U_OTP_H
 
 #include "hw/sysbus.h"
+#include "system/memory.h"
 
 #define SIFIVE_U_OTP_PA         0x00
 #define SIFIVE_U_OTP_PAIO       0x04
diff --git a/include/hw/misc/sifive_u_prci.h b/include/hw/misc/sifive_u_prci.h
index 4d2491ad46d..07dce36055b 100644
--- a/include/hw/misc/sifive_u_prci.h
+++ b/include/hw/misc/sifive_u_prci.h
@@ -20,6 +20,7 @@
 #define HW_SIFIVE_U_PRCI_H
 
 #include "hw/sysbus.h"
+#include "system/memory.h"
 
 #define SIFIVE_U_PRCI_HFXOSCCFG     0x00
 #define SIFIVE_U_PRCI_COREPLLCFG0   0x04
diff --git a/include/hw/net/cadence_gem.h b/include/hw/net/cadence_gem.h
index e63941f18fc..5057ec42032 100644
--- a/include/hw/net/cadence_gem.h
+++ b/include/hw/net/cadence_gem.h
@@ -31,6 +31,7 @@ OBJECT_DECLARE_SIMPLE_TYPE(CadenceGEMState, CADENCE_GEM)
 
 #include "net/net.h"
 #include "hw/sysbus.h"
+#include "system/memory.h"
 
 #define CADENCE_GEM_MAXREG        (0x00000800 / 4) /* Last valid GEM address */
 
diff --git a/include/hw/riscv/opentitan.h b/include/hw/riscv/opentitan.h
index 609473d07b4..39fc92c9d69 100644
--- a/include/hw/riscv/opentitan.h
+++ b/include/hw/riscv/opentitan.h
@@ -26,6 +26,7 @@
 #include "hw/ssi/ibex_spi_host.h"
 #include "hw/boards.h"
 #include "qom/object.h"
+#include "system/memory.h"
 
 #define TYPE_RISCV_IBEX_SOC "riscv.lowrisc.ibex.soc"
 OBJECT_DECLARE_SIMPLE_TYPE(LowRISCIbexSoCState, RISCV_IBEX_SOC)
diff --git a/include/hw/riscv/shakti_c.h b/include/hw/riscv/shakti_c.h
index 539fe1156de..7bed56be91c 100644
--- a/include/hw/riscv/shakti_c.h
+++ b/include/hw/riscv/shakti_c.h
@@ -22,6 +22,7 @@
 #include "hw/riscv/riscv_hart.h"
 #include "hw/boards.h"
 #include "hw/char/shakti_uart.h"
+#include "system/memory.h"
 
 #define TYPE_RISCV_SHAKTI_SOC "riscv.shakti.cclass.soc"
 #define RISCV_SHAKTI_SOC(obj) \
diff --git a/include/hw/riscv/sifive_e.h b/include/hw/riscv/sifive_e.h
index 31180a680e6..3f547b0acdc 100644
--- a/include/hw/riscv/sifive_e.h
+++ b/include/hw/riscv/sifive_e.h
@@ -24,6 +24,7 @@
 #include "hw/gpio/sifive_gpio.h"
 #include "hw/misc/sifive_e_aon.h"
 #include "hw/boards.h"
+#include "system/memory.h"
 
 #define TYPE_RISCV_E_SOC "riscv.sifive.e.soc"
 #define RISCV_E_SOC(obj) \
diff --git a/include/hw/riscv/xiangshan_kmh.h b/include/hw/riscv/xiangshan_kmh.h
index c5dc6b1a9a7..5c7bc3a06ee 100644
--- a/include/hw/riscv/xiangshan_kmh.h
+++ b/include/hw/riscv/xiangshan_kmh.h
@@ -12,6 +12,7 @@
 
 #include "hw/boards.h"
 #include "hw/riscv/riscv_hart.h"
+#include "system/memory.h"
 
 #define XIANGSHAN_KMH_MAX_CPUS 16
 
diff --git a/include/hw/rtc/goldfish_rtc.h b/include/hw/rtc/goldfish_rtc.h
index 162be338636..357fbea4203 100644
--- a/include/hw/rtc/goldfish_rtc.h
+++ b/include/hw/rtc/goldfish_rtc.h
@@ -24,6 +24,7 @@
 
 #include "hw/sysbus.h"
 #include "qom/object.h"
+#include "system/memory.h"
 
 #define TYPE_GOLDFISH_RTC "goldfish_rtc"
 OBJECT_DECLARE_SIMPLE_TYPE(GoldfishRTCState, GOLDFISH_RTC)
diff --git a/include/hw/ssi/ibex_spi_host.h b/include/hw/ssi/ibex_spi_host.h
index 5bd5557b9a1..d2abeb916e2 100644
--- a/include/hw/ssi/ibex_spi_host.h
+++ b/include/hw/ssi/ibex_spi_host.h
@@ -32,6 +32,7 @@
 #include "qemu/fifo8.h"
 #include "qom/object.h"
 #include "qemu/timer.h"
+#include "system/memory.h"
 
 #define TYPE_IBEX_SPI_HOST "ibex-spi"
 #define IBEX_SPI_HOST(obj) \
diff --git a/include/hw/ssi/sifive_spi.h b/include/hw/ssi/sifive_spi.h
index d0c40cdb11b..0b1bc86e540 100644
--- a/include/hw/ssi/sifive_spi.h
+++ b/include/hw/ssi/sifive_spi.h
@@ -24,6 +24,7 @@
 
 #include "qemu/fifo8.h"
 #include "hw/sysbus.h"
+#include "system/memory.h"
 
 #define SIFIVE_SPI_REG_NUM  (0x78 / 4)
 
diff --git a/include/hw/timer/cadence_ttc.h b/include/hw/timer/cadence_ttc.h
index e1251383f2a..0640bc54ca0 100644
--- a/include/hw/timer/cadence_ttc.h
+++ b/include/hw/timer/cadence_ttc.h
@@ -20,6 +20,7 @@
 
 #include "hw/sysbus.h"
 #include "qemu/timer.h"
+#include "system/memory.h"
 
 typedef struct {
     QEMUTimer *timer;
diff --git a/include/hw/timer/ibex_timer.h b/include/hw/timer/ibex_timer.h
index 41f5c82a920..9e58079e391 100644
--- a/include/hw/timer/ibex_timer.h
+++ b/include/hw/timer/ibex_timer.h
@@ -26,6 +26,7 @@
 #define HW_IBEX_TIMER_H
 
 #include "hw/sysbus.h"
+#include "system/memory.h"
 
 #define TYPE_IBEX_TIMER "ibex-timer"
 OBJECT_DECLARE_SIMPLE_TYPE(IbexTimerState, IBEX_TIMER)
diff --git a/include/hw/timer/sifive_pwm.h b/include/hw/timer/sifive_pwm.h
index 6a8cf7b29e4..bc68cca8efc 100644
--- a/include/hw/timer/sifive_pwm.h
+++ b/include/hw/timer/sifive_pwm.h
@@ -30,6 +30,7 @@
 #include "hw/sysbus.h"
 #include "qemu/timer.h"
 #include "qom/object.h"
+#include "system/memory.h"
 
 #define TYPE_SIFIVE_PWM "sifive-pwm"
 
-- 
2.51.0



^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [PATCH 27/27] hw/rx: Include missing 'system/memory.h' header
  2025-10-24 19:03 [PATCH 00/27] hw/sysbus: Spring cleanups (part 1) Philippe Mathieu-Daudé
                   ` (25 preceding siblings ...)
  2025-10-24 19:04 ` [PATCH 26/27] hw/riscv: " Philippe Mathieu-Daudé
@ 2025-10-24 19:04 ` Philippe Mathieu-Daudé
  26 siblings, 0 replies; 35+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-10-24 19:04 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-arm, qemu-riscv, qemu-block, Philippe Mathieu-Daudé,
	Yoshinori Sato, Magnus Damm, Marc-André Lureau,
	Paolo Bonzini

"system/memory.h" header is indirectly pulled by "hw/sysbus.h".
Include it explicitly to avoid when refactoring the latter:

  In file included from ../../hw/rx/rx62n.c:27:
  In file included from /Users/philmd/source/qemu/include/hw/rx/rx62n.h:28:
  include/hw/intc/rx_icu.h:50:18: error: field has incomplete type 'MemoryRegion' (aka 'struct MemoryRegion')
     50 |     MemoryRegion memory;
        |                  ^
  In file included from ../../hw/char/renesas_sci.c:30:
  include/hw/char/renesas_sci.h:34:18: error: field has incomplete type 'MemoryRegion' (aka 'struct MemoryRegion')
     34 |     MemoryRegion memory;
        |                  ^

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 include/hw/char/renesas_sci.h  | 1 +
 include/hw/intc/rx_icu.h       | 1 +
 include/hw/timer/renesas_cmt.h | 1 +
 include/hw/timer/renesas_tmr.h | 1 +
 4 files changed, 4 insertions(+)

diff --git a/include/hw/char/renesas_sci.h b/include/hw/char/renesas_sci.h
index a4764e3eee3..26142a20baf 100644
--- a/include/hw/char/renesas_sci.h
+++ b/include/hw/char/renesas_sci.h
@@ -12,6 +12,7 @@
 #include "chardev/char-fe.h"
 #include "hw/sysbus.h"
 #include "qom/object.h"
+#include "system/memory.h"
 
 #define TYPE_RENESAS_SCI "renesas-sci"
 typedef struct RSCIState RSCIState;
diff --git a/include/hw/intc/rx_icu.h b/include/hw/intc/rx_icu.h
index b23504f3dd1..a8ca94938d4 100644
--- a/include/hw/intc/rx_icu.h
+++ b/include/hw/intc/rx_icu.h
@@ -23,6 +23,7 @@
 
 #include "hw/sysbus.h"
 #include "qom/object.h"
+#include "system/memory.h"
 
 enum TRG_MODE {
     TRG_LEVEL = 0,
diff --git a/include/hw/timer/renesas_cmt.h b/include/hw/timer/renesas_cmt.h
index 1c0b65c1d5a..64bd14dc7a8 100644
--- a/include/hw/timer/renesas_cmt.h
+++ b/include/hw/timer/renesas_cmt.h
@@ -12,6 +12,7 @@
 #include "qemu/timer.h"
 #include "hw/sysbus.h"
 #include "qom/object.h"
+#include "system/memory.h"
 
 #define TYPE_RENESAS_CMT "renesas-cmt"
 typedef struct RCMTState RCMTState;
diff --git a/include/hw/timer/renesas_tmr.h b/include/hw/timer/renesas_tmr.h
index caf7eec0dca..f6c5937f40a 100644
--- a/include/hw/timer/renesas_tmr.h
+++ b/include/hw/timer/renesas_tmr.h
@@ -12,6 +12,7 @@
 #include "qemu/timer.h"
 #include "hw/sysbus.h"
 #include "qom/object.h"
+#include "system/memory.h"
 
 #define TYPE_RENESAS_TMR "renesas-tmr"
 typedef struct RTMRState RTMRState;
-- 
2.51.0



^ permalink raw reply related	[flat|nested] 35+ messages in thread

* Re: [PATCH 01/27] hw/qdev: Have qdev_get_gpio_out_connector() take const DeviceState arg
  2025-10-24 19:03 ` [PATCH 01/27] hw/qdev: Have qdev_get_gpio_out_connector() take const DeviceState arg Philippe Mathieu-Daudé
@ 2025-10-24 19:35   ` Mark Cave-Ayland
  0 siblings, 0 replies; 35+ messages in thread
From: Mark Cave-Ayland @ 2025-10-24 19:35 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel
  Cc: qemu-arm, qemu-riscv, qemu-block, Paolo Bonzini,
	Daniel P. Berrangé, Eduardo Habkost

On 24/10/2025 20:03, Philippe Mathieu-Daudé wrote:

> This getter doesn't update any DeviceState internal fields,
> make it const.
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
>   include/hw/qdev-core.h | 3 ++-
>   hw/core/gpio.c         | 3 ++-
>   2 files changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/include/hw/qdev-core.h b/include/hw/qdev-core.h
> index a7bfb10dc70..2caa0cbd26f 100644
> --- a/include/hw/qdev-core.h
> +++ b/include/hw/qdev-core.h
> @@ -725,7 +725,8 @@ void qdev_connect_gpio_out_named(DeviceState *dev, const char *name, int n,
>    *
>    * Return: qemu_irq associated with GPIO or NULL if un-wired.
>    */
> -qemu_irq qdev_get_gpio_out_connector(DeviceState *dev, const char *name, int n);
> +qemu_irq qdev_get_gpio_out_connector(const DeviceState *dev,
> +                                     const char *name, int n);
>   
>   /**
>    * qdev_intercept_gpio_out: Intercept an existing GPIO connection
> diff --git a/hw/core/gpio.c b/hw/core/gpio.c
> index 6e32a8eec61..c7c2936fc55 100644
> --- a/hw/core/gpio.c
> +++ b/hw/core/gpio.c
> @@ -129,7 +129,8 @@ void qdev_connect_gpio_out_named(DeviceState *dev, const char *name, int n,
>       g_free(propname);
>   }
>   
> -qemu_irq qdev_get_gpio_out_connector(DeviceState *dev, const char *name, int n)
> +qemu_irq qdev_get_gpio_out_connector(const DeviceState *dev,
> +                                     const char *name, int n)
>   {
>       g_autofree char *propname = g_strdup_printf("%s[%d]",
>                                        name ? name : "unnamed-gpio-out", n);

Reviewed-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>


ATB,

Mark.



^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [PATCH 02/27] hw/sysbus: Have various helpers take a const SysBusDevice argument
  2025-10-24 19:03 ` [PATCH 02/27] hw/sysbus: Have various helpers take a const SysBusDevice argument Philippe Mathieu-Daudé
@ 2025-10-24 19:36   ` Mark Cave-Ayland
  0 siblings, 0 replies; 35+ messages in thread
From: Mark Cave-Ayland @ 2025-10-24 19:36 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel
  Cc: qemu-arm, qemu-riscv, qemu-block, Paolo Bonzini,
	Daniel P. Berrangé, Eduardo Habkost

On 24/10/2025 20:03, Philippe Mathieu-Daudé wrote:

> These getters don't update any SysBusDevice internal fields,
> make the argument const.
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
>   include/hw/sysbus.h | 10 +++++-----
>   hw/core/sysbus.c    | 10 +++++-----
>   2 files changed, 10 insertions(+), 10 deletions(-)
> 
> diff --git a/include/hw/sysbus.h b/include/hw/sysbus.h
> index 18fde8a7b48..69eb62e29c8 100644
> --- a/include/hw/sysbus.h
> +++ b/include/hw/sysbus.h
> @@ -70,17 +70,17 @@ struct SysBusDevice {
>   typedef void FindSysbusDeviceFunc(SysBusDevice *sbdev, void *opaque);
>   
>   void sysbus_init_mmio(SysBusDevice *dev, MemoryRegion *memory);
> -MemoryRegion *sysbus_mmio_get_region(SysBusDevice *dev, int n);
> +MemoryRegion *sysbus_mmio_get_region(const SysBusDevice *dev, int n);
>   void sysbus_init_irq(SysBusDevice *dev, qemu_irq *p);
>   void sysbus_pass_irq(SysBusDevice *dev, SysBusDevice *target);
>   void sysbus_init_ioports(SysBusDevice *dev, uint32_t ioport, uint32_t size);
>   
>   
> -bool sysbus_has_irq(SysBusDevice *dev, int n);
> -bool sysbus_has_mmio(SysBusDevice *dev, unsigned int n);
> +bool sysbus_has_irq(const SysBusDevice *dev, int n);
> +bool sysbus_has_mmio(const SysBusDevice *dev, unsigned int n);
>   void sysbus_connect_irq(SysBusDevice *dev, int n, qemu_irq irq);
> -bool sysbus_is_irq_connected(SysBusDevice *dev, int n);
> -qemu_irq sysbus_get_connected_irq(SysBusDevice *dev, int n);
> +bool sysbus_is_irq_connected(const SysBusDevice *dev, int n);
> +qemu_irq sysbus_get_connected_irq(const SysBusDevice *dev, int n);
>   void sysbus_mmio_map(SysBusDevice *dev, int n, hwaddr addr);
>   int sysbus_mmio_map_name(SysBusDevice *dev, const char*name, hwaddr addr);
>   void sysbus_mmio_map_overlap(SysBusDevice *dev, int n, hwaddr addr,
> diff --git a/hw/core/sysbus.c b/hw/core/sysbus.c
> index ec69e877a2c..ae447c1196a 100644
> --- a/hw/core/sysbus.c
> +++ b/hw/core/sysbus.c
> @@ -80,7 +80,7 @@ static void system_bus_class_init(ObjectClass *klass, const void *data)
>   }
>   
>   /* Check whether an IRQ source exists */
> -bool sysbus_has_irq(SysBusDevice *dev, int n)
> +bool sysbus_has_irq(const SysBusDevice *dev, int n)
>   {
>       char *prop = g_strdup_printf("%s[%d]", SYSBUS_DEVICE_GPIO_IRQ, n);
>       ObjectProperty *r;
> @@ -91,12 +91,12 @@ bool sysbus_has_irq(SysBusDevice *dev, int n)
>       return (r != NULL);
>   }
>   
> -bool sysbus_is_irq_connected(SysBusDevice *dev, int n)
> +bool sysbus_is_irq_connected(const SysBusDevice *dev, int n)
>   {
>       return !!sysbus_get_connected_irq(dev, n);
>   }
>   
> -qemu_irq sysbus_get_connected_irq(SysBusDevice *dev, int n)
> +qemu_irq sysbus_get_connected_irq(const SysBusDevice *dev, int n)
>   {
>       DeviceState *d = DEVICE(dev);
>       return qdev_get_gpio_out_connector(d, SYSBUS_DEVICE_GPIO_IRQ, n);
> @@ -114,7 +114,7 @@ void sysbus_connect_irq(SysBusDevice *dev, int n, qemu_irq irq)
>   }
>   
>   /* Check whether an MMIO region exists */
> -bool sysbus_has_mmio(SysBusDevice *dev, unsigned int n)
> +bool sysbus_has_mmio(const SysBusDevice *dev, unsigned int n)
>   {
>       return (n < dev->num_mmio);
>   }
> @@ -190,7 +190,7 @@ void sysbus_init_mmio(SysBusDevice *dev, MemoryRegion *memory)
>       dev->mmio[n].memory = memory;
>   }
>   
> -MemoryRegion *sysbus_mmio_get_region(SysBusDevice *dev, int n)
> +MemoryRegion *sysbus_mmio_get_region(const SysBusDevice *dev, int n)
>   {
>       assert(n >= 0 && n < QDEV_MAX_MMIO);
>       return dev->mmio[n].memory;

Reviewed-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>


ATB,

Mark.



^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [PATCH 03/27] hw/sysbus: Use memory_region_name()
  2025-10-24 19:03 ` [PATCH 03/27] hw/sysbus: Use memory_region_name() Philippe Mathieu-Daudé
@ 2025-10-24 19:40   ` Mark Cave-Ayland
  2025-10-24 21:00     ` Philippe Mathieu-Daudé
  0 siblings, 1 reply; 35+ messages in thread
From: Mark Cave-Ayland @ 2025-10-24 19:40 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel
  Cc: qemu-arm, qemu-riscv, qemu-block, Paolo Bonzini,
	Daniel P. Berrangé, Eduardo Habkost

On 24/10/2025 20:03, Philippe Mathieu-Daudé wrote:

> MemoryRegion::name is kind of internal. Use the proper
> memory_region_name() accessor, which might return a different
> name.
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
>   hw/core/sysbus.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/hw/core/sysbus.c b/hw/core/sysbus.c
> index ae447c1196a..d33be6b2b52 100644
> --- a/hw/core/sysbus.c
> +++ b/hw/core/sysbus.c
> @@ -154,7 +154,7 @@ void sysbus_mmio_map(SysBusDevice *dev, int n, hwaddr addr)
>   int sysbus_mmio_map_name(SysBusDevice *dev, const char *name, hwaddr addr)
>   {
>       for (int i = 0; i < dev->num_mmio; i++) {
> -        if (!strcmp(dev->mmio[i].memory->name, name)) {
> +        if (!strcmp(memory_region_name(dev->mmio[i].memory), name)) {
>               sysbus_mmio_map(dev, i, addr);
>               return i;
>           }

Interesting. I'm mildly curious as to if you discovered anything that broke with this 
change (even though I agree it is correct)?


ATB,

Mark.



^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [PATCH 03/27] hw/sysbus: Use memory_region_name()
  2025-10-24 19:40   ` Mark Cave-Ayland
@ 2025-10-24 21:00     ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 35+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-10-24 21:00 UTC (permalink / raw)
  To: Mark Cave-Ayland, qemu-devel
  Cc: qemu-arm, qemu-riscv, qemu-block, Paolo Bonzini,
	Daniel P. Berrangé, Eduardo Habkost

On 24/10/25 21:40, Mark Cave-Ayland wrote:
> On 24/10/2025 20:03, Philippe Mathieu-Daudé wrote:
> 
>> MemoryRegion::name is kind of internal. Use the proper
>> memory_region_name() accessor, which might return a different
>> name.
>>
>> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
>> ---
>>   hw/core/sysbus.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/hw/core/sysbus.c b/hw/core/sysbus.c
>> index ae447c1196a..d33be6b2b52 100644
>> --- a/hw/core/sysbus.c
>> +++ b/hw/core/sysbus.c
>> @@ -154,7 +154,7 @@ void sysbus_mmio_map(SysBusDevice *dev, int n, 
>> hwaddr addr)
>>   int sysbus_mmio_map_name(SysBusDevice *dev, const char *name, hwaddr 
>> addr)
>>   {
>>       for (int i = 0; i < dev->num_mmio; i++) {
>> -        if (!strcmp(dev->mmio[i].memory->name, name)) {
>> +        if (!strcmp(memory_region_name(dev->mmio[i].memory), name)) {
>>               sysbus_mmio_map(dev, i, addr);
>>               return i;
>>           }
> 
> Interesting. I'm mildly curious as to if you discovered anything that 
> broke with this change (even though I agree it is correct)?

I'm working on having qdev to absorb sysbus features (MMIO, PIO
and IRQ links); what is left is the qom parenting on the main
sysbus, only used during legacy reset; I hope to convert the
remaining as a cripple reset tree.


^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [PATCH 07/27] hw/sysbus: Add sysbus_has_pio() and sysbus_pio_get_address()
  2025-10-24 19:03 ` [PATCH 07/27] hw/sysbus: Add sysbus_has_pio() and sysbus_pio_get_address() Philippe Mathieu-Daudé
@ 2025-10-26 17:34   ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 35+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-10-26 17:34 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-arm, qemu-riscv, qemu-block, Paolo Bonzini,
	Daniel P. Berrangé, Eduardo Habkost

On 24/10/25 21:03, Philippe Mathieu-Daudé wrote:
> Similarly to sysbus_has_mmio() and sysbus_mmio_get_region(),
> add sysbus_has_pio() and sysbus_pio_get_address() for PIO.
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
>   include/hw/sysbus.h |  2 ++
>   hw/core/sysbus.c    | 11 +++++++++++
>   2 files changed, 13 insertions(+)


> diff --git a/hw/core/sysbus.c b/hw/core/sysbus.c
> index d33be6b2b52..1dbc345a3ef 100644
> --- a/hw/core/sysbus.c
> +++ b/hw/core/sysbus.c
> @@ -206,6 +206,17 @@ void sysbus_init_ioports(SysBusDevice *dev, uint32_t ioport, uint32_t size)
>       }
>   }
>   
> +bool sysbus_has_pio(const SysBusDevice *dev, unsigned int n)
> +{
> +    return (n < dev->num_pio);
> +}
> +
> +uint32_t sysbus_pio_get_address(const SysBusDevice *dev, int n)
> +{
> +    assert(n >= 0 && n < QDEV_MAX_PIO);
> +    return dev->pio[n];
> +}

Actually not needed, will remove in v2.


^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [PATCH 20/27] hw/int/loongarch: Include missing 'system/memory.h' header
  2025-10-24 19:04 ` [PATCH 20/27] hw/int/loongarch: " Philippe Mathieu-Daudé
@ 2025-10-27  2:49   ` Bibo Mao
  0 siblings, 0 replies; 35+ messages in thread
From: Bibo Mao @ 2025-10-27  2:49 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel
  Cc: qemu-arm, qemu-riscv, qemu-block, Song Gao, Jiaxun Yang,
	Huacai Chen



On 2025/10/25 上午3:04, Philippe Mathieu-Daudé wrote:
> "system/memory.h" header is indirectly pulled by "hw/sysbus.h".
> Include it explicitly to avoid when refactoring the latter:
> 
>    In file included from ../../hw/intc/loongson_ipi.c:9:
>    In file included from /Users/philmd/source/qemu/include/hw/intc/loongson_ipi.h:12:
>    include/hw/intc/loongson_ipi_common.h:37:18: error: field has incomplete type 'MemoryRegion' (aka 'struct MemoryRegion')
>       37 |     MemoryRegion ipi_iocsr_mem;
>          |                  ^
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
>   include/hw/intc/loongarch_dintc.h         | 2 +-
>   include/hw/intc/loongarch_extioi_common.h | 1 +
>   include/hw/intc/loongarch_pch_msi.h       | 1 +
>   include/hw/intc/loongarch_pic_common.h    | 1 +
>   include/hw/intc/loongson_ipi_common.h     | 2 ++
>   5 files changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/include/hw/intc/loongarch_dintc.h b/include/hw/intc/loongarch_dintc.h
> index 0b0b5347b2c..01bb1e465cb 100644
> --- a/include/hw/intc/loongarch_dintc.h
> +++ b/include/hw/intc/loongarch_dintc.h
> @@ -8,7 +8,7 @@
>   #include "qom/object.h"
>   #include "hw/sysbus.h"
>   #include "hw/loongarch/virt.h"
> -
> +#include "system/memory.h"
>   
>   #define NR_VECTORS     256
>   
> diff --git a/include/hw/intc/loongarch_extioi_common.h b/include/hw/intc/loongarch_extioi_common.h
> index c021ccee0fa..1bd2bfa07fc 100644
> --- a/include/hw/intc/loongarch_extioi_common.h
> +++ b/include/hw/intc/loongarch_extioi_common.h
> @@ -10,6 +10,7 @@
>   #include "qom/object.h"
>   #include "hw/sysbus.h"
>   #include "hw/loongarch/virt.h"
> +#include "system/memory.h"
>   
>   #define LS3A_INTC_IP                 8
>   #define EXTIOI_IRQS                  (256)
> diff --git a/include/hw/intc/loongarch_pch_msi.h b/include/hw/intc/loongarch_pch_msi.h
> index b8586fb3b6f..ef4ec4fdeb8 100644
> --- a/include/hw/intc/loongarch_pch_msi.h
> +++ b/include/hw/intc/loongarch_pch_msi.h
> @@ -6,6 +6,7 @@
>    */
>   
>   #include "hw/sysbus.h"
> +#include "system/memory.h"
>   
>   #define TYPE_LOONGARCH_PCH_MSI "loongarch_pch_msi"
>   OBJECT_DECLARE_SIMPLE_TYPE(LoongArchPCHMSI, LOONGARCH_PCH_MSI)
> diff --git a/include/hw/intc/loongarch_pic_common.h b/include/hw/intc/loongarch_pic_common.h
> index 675ba96e64e..179361eb567 100644
> --- a/include/hw/intc/loongarch_pic_common.h
> +++ b/include/hw/intc/loongarch_pic_common.h
> @@ -9,6 +9,7 @@
>   
>   #include "hw/loongarch/virt.h"
>   #include "hw/sysbus.h"
> +#include "system/memory.h"
>   
>   #define PCH_PIC_INT_ID                  0x00
>   #define  PCH_PIC_INT_ID_VAL             0x7
> diff --git a/include/hw/intc/loongson_ipi_common.h b/include/hw/intc/loongson_ipi_common.h
> index e58ce2aa1c4..8b51af83e8b 100644
> --- a/include/hw/intc/loongson_ipi_common.h
> +++ b/include/hw/intc/loongson_ipi_common.h
> @@ -11,6 +11,8 @@
>   #include "qom/object.h"
>   #include "hw/sysbus.h"
>   #include "exec/memattrs.h"
> +#include "system/memory.h"
> +#include "system/memory.h"
one small nit for duplicated including here :)

Otherwise
Reviewed-by: Bibo Mao <maobibo@loongson.cn>
>   
>   #define IPI_MBX_NUM           4
>   
> 



^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [PATCH 13/27] hw/uefi: Include missing 'system/memory.h' header
  2025-10-24 19:04 ` [PATCH 13/27] hw/uefi: " Philippe Mathieu-Daudé
@ 2025-10-27  7:26   ` Gerd Hoffmann
  0 siblings, 0 replies; 35+ messages in thread
From: Gerd Hoffmann @ 2025-10-27  7:26 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé; +Cc: qemu-devel, qemu-arm, qemu-riscv, qemu-block

On Fri, Oct 24, 2025 at 09:04:00PM +0200, Philippe Mathieu-Daudé wrote:
> "system/memory.h" header is indirectly pulled by "hw/sysbus.h".
> Include it explicitly to avoid when refactoring the latter:
> 
>   include/hw/uefi/var-service.h:50:39: error: field has incomplete type 'MemoryRegion' (aka 'struct MemoryRegion')
>      50 |     MemoryRegion                      mr;
>         |                                       ^
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>

Acked-by: Gerd Hoffmann <kraxel@redhat.com>



^ permalink raw reply	[flat|nested] 35+ messages in thread

end of thread, other threads:[~2025-10-27  8:06 UTC | newest]

Thread overview: 35+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-24 19:03 [PATCH 00/27] hw/sysbus: Spring cleanups (part 1) Philippe Mathieu-Daudé
2025-10-24 19:03 ` [PATCH 01/27] hw/qdev: Have qdev_get_gpio_out_connector() take const DeviceState arg Philippe Mathieu-Daudé
2025-10-24 19:35   ` Mark Cave-Ayland
2025-10-24 19:03 ` [PATCH 02/27] hw/sysbus: Have various helpers take a const SysBusDevice argument Philippe Mathieu-Daudé
2025-10-24 19:36   ` Mark Cave-Ayland
2025-10-24 19:03 ` [PATCH 03/27] hw/sysbus: Use memory_region_name() Philippe Mathieu-Daudé
2025-10-24 19:40   ` Mark Cave-Ayland
2025-10-24 21:00     ` Philippe Mathieu-Daudé
2025-10-24 19:03 ` [PATCH 04/27] hw/i386/microvm: Use proper SysBus accessors Philippe Mathieu-Daudé
2025-10-24 19:03 ` [PATCH 05/27] hw/timer/hpet: " Philippe Mathieu-Daudé
2025-10-24 19:03 ` [PATCH 06/27] hw/acpi/cxl: " Philippe Mathieu-Daudé
2025-10-24 19:03 ` [PATCH 07/27] hw/sysbus: Add sysbus_has_pio() and sysbus_pio_get_address() Philippe Mathieu-Daudé
2025-10-26 17:34   ` Philippe Mathieu-Daudé
2025-10-24 19:03 ` [PATCH 08/27] hw/pci-bridge/pci_expander_bridge: Use proper SysBus accessors Philippe Mathieu-Daudé
2025-10-24 19:03 ` [PATCH 09/27] hw/platform-bus: Include missing 'system/memory.h' header Philippe Mathieu-Daudé
2025-10-24 19:03 ` [PATCH 10/27] hw/block/pflash: " Philippe Mathieu-Daudé
2025-10-24 19:03 ` [PATCH 11/27] hw/misc/unimp: " Philippe Mathieu-Daudé
2025-10-24 19:03 ` [PATCH 12/27] hw/misc/empty_slot: " Philippe Mathieu-Daudé
2025-10-24 19:04 ` [PATCH 13/27] hw/uefi: " Philippe Mathieu-Daudé
2025-10-27  7:26   ` Gerd Hoffmann
2025-10-24 19:04 ` [PATCH 14/27] hw/usb/imx: " Philippe Mathieu-Daudé
2025-10-24 19:04 ` [PATCH 15/27] hw/pci/pcihost: " Philippe Mathieu-Daudé
2025-10-24 19:04 ` [PATCH 16/27] hw/scsi/esp: " Philippe Mathieu-Daudé
2025-10-24 19:04 ` [PATCH 17/27] hw/avr: " Philippe Mathieu-Daudé
2025-10-24 19:04 ` [PATCH 18/27] hw/input/lassi: " Philippe Mathieu-Daudé
2025-10-24 19:04 ` [PATCH 19/27] hw/tricore: " Philippe Mathieu-Daudé
2025-10-24 19:04 ` [PATCH 20/27] hw/int/loongarch: " Philippe Mathieu-Daudé
2025-10-27  2:49   ` Bibo Mao
2025-10-24 19:04 ` [PATCH 21/27] hw/rtc/m48t59: " Philippe Mathieu-Daudé
2025-10-24 19:04 ` [PATCH 22/27] hw/rtc/sun: Include 'exec/cpu-common.h' and 'system/memory.h' headers Philippe Mathieu-Daudé
2025-10-24 19:04 ` [PATCH 23/27] hw/xilinx: " Philippe Mathieu-Daudé
2025-10-24 19:04 ` [PATCH 24/27] hw/mips: Include missing 'system/memory.h' header Philippe Mathieu-Daudé
2025-10-24 19:04 ` [PATCH 25/27] hw/sparc: " Philippe Mathieu-Daudé
2025-10-24 19:04 ` [PATCH 26/27] hw/riscv: " Philippe Mathieu-Daudé
2025-10-24 19:04 ` [PATCH 27/27] hw/rx: " Philippe Mathieu-Daudé

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).