Skip to contentSkip to conversation

hw/sysbus: Spring cleanups (part 1)

PATCH Superseded Philippe Mathieu-Daudé 4 participants 35 messages Oct 24, 2025 – Oct 27, 2025

Subsystems (4)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

cover hw/sysbus: Spring cleanups (part 1)

- 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(-)
Signature · 1 line
2.51.0
#1 lore raw

PATCH 1/27 hw/qdev: Have qdev_get_gpio_out_connector() take const DeviceState arg

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

---
 include/hw/qdev-core.h | 3 ++-
 hw/core/gpio.c         | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)
include/hw/qdev-core.h +2 -1
index a7bfb10dc70..2caa0cbd26f 100644
@@ -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
hw/core/gpio.c +2 -1
index 6e32a8eec61..c7c2936fc55 100644
@@ -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);
Signature · 1 line
2.51.0
Reviewed-by on v1 1/27
#2 lore raw

Re: [PATCH 01/27] hw/qdev: Have qdev_get_gpio_out_connector() take const DeviceState arg

Quoted 28 lines · Philippe Mathieu-Daudé

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

---
  include/hw/qdev-core.h | 3 ++-
  hw/core/gpio.c         | 3 ++-
  2 files changed, 4 insertions(+), 2 deletions(-)
include/hw/qdev-core.h +2 -1
index a7bfb10dc70..2caa0cbd26f 100644
@@ -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
hw/core/gpio.c +0 -0
index 6e32a8eec61..c7c2936fc55 100644

hw/core/gpio.c void qdev_connect_gpio_out_named(DeviceState *dev, const char *name, int n, · line 136

Quoted 9 lines
hw/core/gpio.c +2 -1
@@ -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);

ATB,

Mark.

#3 lore raw

PATCH 2/27 hw/sysbus: Have various helpers take a const SysBusDevice argument

In reply to Philippe Mathieu-Daudé

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

---
 include/hw/sysbus.h | 10 +++++-----
 hw/core/sysbus.c    | 10 +++++-----
 2 files changed, 10 insertions(+), 10 deletions(-)
include/hw/sysbus.h +5 -5
index 18fde8a7b48..69eb62e29c8 100644
@@ -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,
hw/core/sysbus.c +5 -5
index ec69e877a2c..ae447c1196a 100644
@@ -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;
Signature · 1 line
2.51.0
Reviewed-by on v1 2/27
#4 lore raw

Re: [PATCH 02/27] hw/sysbus: Have various helpers take a const SysBusDevice argument

Quoted 74 lines · Philippe Mathieu-Daudé

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

---
  include/hw/sysbus.h | 10 +++++-----
  hw/core/sysbus.c    | 10 +++++-----
  2 files changed, 10 insertions(+), 10 deletions(-)
include/hw/sysbus.h +5 -5
index 18fde8a7b48..69eb62e29c8 100644
@@ -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,
hw/core/sysbus.c +4 -4
index ec69e877a2c..ae447c1196a 100644
@@ -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);
  }

hw/core/sysbus.c void sysbus_init_mmio(SysBusDevice *dev, MemoryRegion *memory) · line 196

Quoted 8 lines
hw/core/sysbus.c +1 -1
@@ -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;

ATB,

Mark.

#5 lore raw

PATCH 3/27 hw/sysbus: Use memory_region_name()

In reply to Philippe Mathieu-Daudé

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

---
 hw/core/sysbus.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/core/sysbus.c +1 -1
index ae447c1196a..d33be6b2b52 100644
@@ -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;
         }
Signature · 1 line
2.51.0
#6 lore raw

Re: [PATCH 03/27] hw/sysbus: Use memory_region_name()

Quoted 14 lines · Philippe Mathieu-Daudé

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

---
  hw/core/sysbus.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
hw/core/sysbus.c +0 -0
index ae447c1196a..d33be6b2b52 100644

hw/core/sysbus.c void sysbus_mmio_map(SysBusDevice *dev, int n, hwaddr addr) · line 160

Quoted 8 lines
hw/core/sysbus.c +1 -1
@@ -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.

#7 lore raw

Re: [PATCH 03/27] hw/sysbus: Use memory_region_name()

Quoted 11 lines · Mark Cave-Ayland
Quoted 9 lines · Philippe Mathieu-Daudé

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

---
  hw/core/sysbus.c | 2 +-

  1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 16 lines
Quoted 13 lines
hw/core/sysbus.c +1 -1
index ae447c1196a..d33be6b2b52 100644
@@ -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;
Quoted 1 line

          }

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.

#8 lore raw

PATCH 4/27 hw/i386/microvm: Use proper SysBus accessors

In reply to Philippe Mathieu-Daudé

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

---
 hw/i386/microvm-dt.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
hw/i386/microvm-dt.c +4 -2
index cb27dfd732e..d7f49bc1b5f 100644
@@ -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;
Signature · 1 line
2.51.0
#9 lore raw

PATCH 5/27 hw/timer/hpet: Use proper SysBus accessors

In reply to Philippe Mathieu-Daudé

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

---
 hw/timer/hpet.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
hw/timer/hpet.c +2 -1
index 1acba4fa9db..4ed79d72620 100644
@@ -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;
Signature · 1 line
2.51.0
#10 lore raw

PATCH 6/27 hw/acpi/cxl: Use proper SysBus accessors

In reply to Philippe Mathieu-Daudé

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

---
 hw/acpi/cxl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/acpi/cxl.c +1 -1
index 75d5b30bb8b..77c99dfb184 100644
@@ -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);
Signature · 1 line
2.51.0
#11 lore raw

PATCH 7/27 hw/sysbus: Add sysbus_has_pio() and sysbus_pio_get_address()

In reply to Philippe Mathieu-Daudé

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

---
 include/hw/sysbus.h |  2 ++
 hw/core/sysbus.c    | 11 +++++++++++
 2 files changed, 13 insertions(+)
include/hw/sysbus.h +2 -0
index 69eb62e29c8..07a307b5ca0 100644
@@ -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);
hw/core/sysbus.c +11 -0
index d33be6b2b52..1dbc345a3ef 100644
@@ -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
Signature · 1 line
2.51.0
#12 lore raw

Re: [PATCH 07/27] hw/sysbus: Add sysbus_has_pio() and sysbus_pio_get_address()

Quoted 18 lines · Philippe Mathieu-Daudé

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

---
  include/hw/sysbus.h |  2 ++
  hw/core/sysbus.c    | 11 +++++++++++
  2 files changed, 13 insertions(+)
hw/core/sysbus.c +0 -0
index d33be6b2b52..1dbc345a3ef 100644
@@ -206,6 +206,17 @@ void sysbus_init_ioports(SysBusDevice *dev, uint32_t ioport, uint32_t size)
      }
  }
 

hw/core/sysbus.c void sysbus_init_ioports(SysBusDevice *dev, uint32_t ioport, uint32_t size) · line 218

Quoted 10 lines
hw/core/sysbus.c +10 -0
+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.

#13 lore raw

PATCH 8/27 hw/pci-bridge/pci_expander_bridge: Use proper SysBus accessors

In reply to Philippe Mathieu-Daudé

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

---
 hw/pci-bridge/pci_expander_bridge.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
hw/pci-bridge/pci_expander_bridge.c +6 -6
index 1bcceddbc4d..2e84bbe1615 100644
@@ -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;
 }
Signature · 1 line
2.51.0
#14 lore raw

PATCH 9/27 hw/platform-bus: Include missing 'system/memory.h' header

In reply to 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;
        |                ^
---
 include/hw/platform-bus.h | 1 +
 1 file changed, 1 insertion(+)
include/hw/platform-bus.h +1 -0
index 44f30c5353f..8672ccc45ec 100644
@@ -24,6 +24,7 @@
 
 #include "hw/sysbus.h"
 #include "qom/object.h"
+#include "system/memory.h"
 
 
 #define TYPE_PLATFORM_BUS_DEVICE "platform-bus-device"
Signature · 1 line
2.51.0
#15 lore raw

PATCH 10/27 hw/block/pflash: Include missing 'system/memory.h' header

In reply to Philippe Mathieu-Daudé

"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;
        |                ^
---
 hw/block/pflash_cfi01.c | 1 +
 hw/block/pflash_cfi02.c | 1 +
 2 files changed, 2 insertions(+)
hw/block/pflash_cfi01.c +1 -0
index 168101d8dfe..04c30d17a99 100644
@@ -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"
 
hw/block/pflash_cfi02.c +1 -0
index 3244b699b98..a2106a7ed9b 100644
@@ -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"
Signature · 1 line
2.51.0
#16 lore raw

PATCH 11/27 hw/misc/unimp: Include missing 'system/memory.h' header

In reply to 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/arm/aspeed_ast10x0.c:17:
include/hw/misc/unimp.h:22:18: error: field has incomplete type 'MemoryRegion' (aka 'struct MemoryRegion')

     22 |     MemoryRegion iomem;
        |                  ^
---
 include/hw/misc/unimp.h | 1 +
 1 file changed, 1 insertion(+)
include/hw/misc/unimp.h +1 -0
index 518d627dc5d..a0a1f359e1d 100644
@@ -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"
 
Signature · 1 line
2.51.0
#17 lore raw

PATCH 12/27 hw/misc/empty_slot: Include missing 'system/memory.h' header

In reply to Philippe Mathieu-Daudé

"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;
        |                  ^
---
 hw/misc/empty_slot.c | 1 +
 1 file changed, 1 insertion(+)
hw/misc/empty_slot.c +1 -0
index 239d7603207..1cc3bcd9050 100644
@@ -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)
Signature · 1 line
2.51.0
#18 lore raw

PATCH 13/27 hw/uefi: Include missing 'system/memory.h' header

In reply to Philippe Mathieu-Daudé

"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;
        |                                       ^
---
 include/hw/uefi/var-service.h | 1 +
 1 file changed, 1 insertion(+)
include/hw/uefi/var-service.h +1 -0
index f7ceac4ce24..91fb4a20918 100644
@@ -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)
Signature · 1 line
2.51.0
Acked-by on v1 13/27
#19 lore raw

Re: [PATCH 13/27] hw/uefi: Include missing 'system/memory.h' header

Quoted 8 lines · Philippe Mathieu-Daudé

"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;
        |                                       ^
#20 lore raw

PATCH 14/27 hw/usb/imx: Include missing 'system/memory.h' header

In reply to Philippe Mathieu-Daudé

"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;
        |                  ^
---
 include/hw/usb/imx-usb-phy.h | 1 +
 1 file changed, 1 insertion(+)
include/hw/usb/imx-usb-phy.h +1 -0
index d1e867b77a3..a267c03c7e1 100644
@@ -4,6 +4,7 @@
 #include "hw/sysbus.h"
 #include "qemu/bitops.h"
 #include "qom/object.h"
+#include "system/memory.h"
 
 enum IMXUsbPhyRegisters {
     USBPHY_PWD,
Signature · 1 line
2.51.0
#21 lore raw

PATCH 15/27 hw/pci/pcihost: Include missing 'system/memory.h' header

In reply to Philippe Mathieu-Daudé

"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;
        |                  ^
---
 include/hw/pci/pci_host.h | 1 +
 1 file changed, 1 insertion(+)
include/hw/pci/pci_host.h +1 -0
index 954dd446fa4..d06d64f6cad 100644
@@ -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"
Signature · 1 line
2.51.0
#22 lore raw

PATCH 16/27 hw/scsi/esp: Include missing 'system/memory.h' header

In reply to 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/scsi/esp.c:31:
include/hw/scsi/esp.h:82:18: error: field has incomplete type 'MemoryRegion' (aka 'struct MemoryRegion')

     82 |     MemoryRegion iomem;
        |                  ^
---
 include/hw/scsi/esp.h | 1 +
 1 file changed, 1 insertion(+)
include/hw/scsi/esp.h +1 -0
index 3526bad7464..340a713831e 100644
@@ -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"
Signature · 1 line
2.51.0
#23 lore raw

PATCH 17/27 hw/avr: Include missing 'system/memory.h' header

In reply to 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/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;
        |                ^
---
 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(+)
include/hw/char/avr_usart.h +1 -0
index 0cc599e9b15..2d2fc0669f2 100644
@@ -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
include/hw/misc/avr_power.h +1 -0
index 388e421aa7b..a3d3d1de878 100644
@@ -27,6 +27,7 @@
 
 #include "hw/sysbus.h"
 #include "qom/object.h"
+#include "system/memory.h"
 
 
 #define TYPE_AVR_MASK "avr-power"
include/hw/timer/avr_timer16.h +1 -0
index a1a032a24dc..c08288d6227 100644
@@ -31,6 +31,7 @@
 #include "hw/sysbus.h"
 #include "qemu/timer.h"
 #include "qom/object.h"
+#include "system/memory.h"
 
 enum NextInterrupt {
     OVERFLOW,
Signature · 1 line
2.51.0
#24 lore raw

PATCH 18/27 hw/input/lassi: Include missing 'system/memory.h' header

In reply to 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/input/lasips2.c:29:
include/hw/input/lasips2.h:41:18: error: field has incomplete type 'MemoryRegion' (aka 'struct MemoryRegion')

     41 |     MemoryRegion reg;
        |                  ^
---
 include/hw/input/lasips2.h | 1 +
 include/hw/misc/lasi.h     | 1 +
 2 files changed, 2 insertions(+)
include/hw/input/lasips2.h +1 -0
index 01911c50f9b..3510216effd 100644
@@ -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)
include/hw/misc/lasi.h +1 -0
index 0bdfb11b501..70c99fc017e 100644
@@ -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)
Signature · 1 line
2.51.0
#25 lore raw

PATCH 19/27 hw/tricore: Include missing 'system/memory.h' header

In reply to Philippe Mathieu-Daudé

"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;
        |                  ^
---
 include/hw/tricore/tc27x_soc.h          | 1 +
 include/hw/tricore/tricore_testdevice.h | 1 +
 2 files changed, 2 insertions(+)
include/hw/tricore/tc27x_soc.h +1 -0
index dd3a7485c85..40962eab04d 100644
@@ -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)
include/hw/tricore/tricore_testdevice.h +1 -0
index 2c57b62f222..98ef6e7a3d0 100644
@@ -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) \
Signature · 1 line
2.51.0
#26 lore raw

PATCH 20/27 hw/int/loongarch: Include missing 'system/memory.h' header

In reply to 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/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;
        |                  ^
---
 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(-)
include/hw/intc/loongarch_dintc.h +1 -1
index 0b0b5347b2c..01bb1e465cb 100644
@@ -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
 
include/hw/intc/loongarch_extioi_common.h +1 -0
index c021ccee0fa..1bd2bfa07fc 100644
@@ -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)
include/hw/intc/loongarch_pch_msi.h +1 -0
index b8586fb3b6f..ef4ec4fdeb8 100644
@@ -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)
include/hw/intc/loongarch_pic_common.h +1 -0
index 675ba96e64e..179361eb567 100644
@@ -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
include/hw/intc/loongson_ipi_common.h +2 -0
index e58ce2aa1c4..8b51af83e8b 100644
@@ -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
 
Signature · 1 line
2.51.0
Reviewed-by on v1 20/27
#27 lore raw

Re: [PATCH 20/27] hw/int/loongarch: Include missing 'system/memory.h' header

Quoted 72 lines · 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/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;
         |                  ^
---
  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(-)
include/hw/intc/loongarch_dintc.h +1 -1
index 0b0b5347b2c..01bb1e465cb 100644
@@ -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
 
include/hw/intc/loongarch_extioi_common.h +1 -0
index c021ccee0fa..1bd2bfa07fc 100644
@@ -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)
include/hw/intc/loongarch_pch_msi.h +1 -0
index b8586fb3b6f..ef4ec4fdeb8 100644
@@ -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)
include/hw/intc/loongarch_pic_common.h +1 -0
index 675ba96e64e..179361eb567 100644
@@ -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
include/hw/intc/loongson_ipi_common.h +0 -0
index e58ce2aa1c4..8b51af83e8b 100644

include/hw/intc/loongson_ipi_common.h line 15

Quoted 5 lines
include/hw/intc/loongson_ipi_common.h +2 -0
@@ -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

Quoted 4 lines
include/hw/intc/loongson_ipi_common.h +0 -0
  #define IPI_MBX_NUM           4
 
 
#28 lore raw

PATCH 21/27 hw/rtc/m48t59: Include missing 'system/memory.h' header

In reply to 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;
        |                  ^
---
 hw/rtc/m48t59-internal.h | 2 ++
 1 file changed, 2 insertions(+)
hw/rtc/m48t59-internal.h +2 -0
index cd648241e98..791c15b7184 100644
@@ -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
Signature · 1 line
2.51.0
#29 lore raw

PATCH 22/27 hw/rtc/sun: Include 'exec/cpu-common.h' and 'system/memory.h' headers

In reply to Philippe Mathieu-Daudé

"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,
| ^

---
 hw/rtc/sun4v-rtc.c | 2 ++
 1 file changed, 2 insertions(+)
hw/rtc/sun4v-rtc.c +2 -0
index 29e24ef6bed..c0859b270d3 100644
@@ -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"
Signature · 1 line
2.51.0
#30 lore raw

PATCH 23/27 hw/xilinx: Include 'exec/cpu-common.h' and 'system/memory.h' headers

In reply to Philippe Mathieu-Daudé

"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,
| ^

---
 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(+)
hw/char/xilinx_uartlite.c +2 -0
index 8008171eea9..94f5bc22a1c 100644
@@ -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)
 
hw/intc/xilinx_intc.c +2 -0
index 5257ad54b17..5aa85ada5f8 100644
@@ -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)
 
hw/net/xilinx_axienet.c +2 -0
index 1f5c7480476..f4f2571c228 100644
@@ -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)
 
hw/ssi/xilinx_spi.c +2 -0
index 4144c8a6270..6039a654c3d 100644
@@ -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 { \
hw/timer/xilinx_timer.c +2 -0
index ff4a224d08f..51658ee2bd9 100644
@@ -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)
 
Signature · 1 line
2.51.0
#31 lore raw

PATCH 24/27 hw/mips: Include missing 'system/memory.h' header

In reply to 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/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;
        |                  ^
---
 include/hw/misc/mips_cmgcr.h | 1 +
 include/hw/misc/mips_itu.h   | 1 +
 2 files changed, 2 insertions(+)
include/hw/misc/mips_cmgcr.h +1 -0
index db4bf5f4499..e15731f18ce 100644
@@ -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)
include/hw/misc/mips_itu.h +1 -0
index 27c9a1090d5..1a684d90a15 100644
@@ -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)
Signature · 1 line
2.51.0
#32 lore raw

PATCH 25/27 hw/sparc: Include missing 'system/memory.h' header

In reply to 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/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;
        |                ^
---
 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(+)
include/hw/sparc/sparc32_dma.h +1 -0
index cde8ec02cb6..46ed0a20d88 100644
@@ -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
 
include/hw/sparc/sun4m_iommu.h +1 -0
index 4e2ab34cdef..dd09a72c525 100644
@@ -27,6 +27,7 @@
 
 #include "hw/sysbus.h"
 #include "qom/object.h"
+#include "system/memory.h"
 
 #define IOMMU_NREGS         (4 * 4096 / 4)
 
include/hw/sparc/sun4u_iommu.h +1 -0
index f94566a72c9..fad71264408 100644
@@ -29,6 +29,7 @@
 
 #include "hw/sysbus.h"
 #include "qom/object.h"
+#include "system/memory.h"
 
 #define IOMMU_NREGS             3
 
Signature · 1 line
2.51.0
#33 lore raw

PATCH 26/27 hw/riscv: Include missing 'system/memory.h' header

In reply to Philippe Mathieu-Daudé

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

---
 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(+)
include/hw/char/cadence_uart.h +1 -0
index e7f7cd84683..d2b48313d4e 100644
@@ -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
include/hw/char/ibex_uart.h +1 -0
index 9deadf223bf..f95780063fe 100644
@@ -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 */
include/hw/char/shakti_uart.h +1 -0
index 526c408233f..c15b5f9c82c 100644
@@ -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
include/hw/char/sifive_uart.h +1 -0
index 0846cf62188..a46c4d12766 100644
@@ -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,
include/hw/gpio/sifive_gpio.h +1 -0
index fc53785c9d0..72e116252b7 100644
@@ -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;
include/hw/intc/riscv_aclint.h +1 -0
index 4b7406eec00..07e562fd6c1 100644
@@ -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"
 
include/hw/intc/riscv_aplic.h +1 -0
index 489b9133c26..86bbe0cf859 100644
@@ -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)
include/hw/intc/riscv_imsic.h +1 -0
index 58c2aaa8dc6..4b9de5eb612 100644
@@ -21,6 +21,7 @@
 
 #include "hw/sysbus.h"
 #include "qom/object.h"
+#include "system/memory.h"
 
 #define TYPE_RISCV_IMSIC "riscv.imsic"
 
include/hw/intc/sifive_plic.h +1 -0
index d3f45ec2481..85524711da4 100644
@@ -23,6 +23,7 @@
 
 #include "hw/sysbus.h"
 #include "qom/object.h"
+#include "system/memory.h"
 
 #define TYPE_SIFIVE_PLIC "riscv.sifive.plic"
 
include/hw/misc/mchp_pfsoc_dmc.h +1 -0
index 3bc1581e0f2..d3bc38a8ddd 100644
@@ -24,6 +24,7 @@
 #define MCHP_PFSOC_DMC_H
 
 #include "hw/sysbus.h"
+#include "system/memory.h"
 
 /* DDR SGMII PHY module */
 
include/hw/misc/mchp_pfsoc_ioscb.h +1 -0
index 3fd3e749665..276e2a1c533 100644
@@ -24,6 +24,7 @@
 #define MCHP_PFSOC_IOSCB_H
 
 #include "hw/sysbus.h"
+#include "system/memory.h"
 
 typedef struct MchpPfSoCIoscbState {
     SysBusDevice parent;
include/hw/misc/mchp_pfsoc_sysreg.h +1 -0
index c2232bd28d0..29ea39fe5c0 100644
@@ -24,6 +24,7 @@
 #define MCHP_PFSOC_SYSREG_H
 
 #include "hw/sysbus.h"
+#include "system/memory.h"
 
 #define MCHP_PFSOC_SYSREG_REG_SIZE  0x2000
 
include/hw/misc/sifive_e_aon.h +1 -0
index 2ae1c4139ca..77351e2ef84 100644
@@ -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)
include/hw/misc/sifive_e_prci.h +1 -0
index 6aa949e910d..adf9bd6da7e 100644
@@ -20,6 +20,7 @@
 #define HW_SIFIVE_E_PRCI_H
 
 #include "hw/sysbus.h"
+#include "system/memory.h"
 
 enum {
     SIFIVE_E_PRCI_HFROSCCFG = 0x0,
include/hw/misc/sifive_test.h +1 -0
index 88a38d00c59..a995b397f66 100644
@@ -21,6 +21,7 @@
 
 #include "hw/sysbus.h"
 #include "qom/object.h"
+#include "system/memory.h"
 
 #define TYPE_SIFIVE_TEST "riscv.sifive.test"
 
include/hw/misc/sifive_u_otp.h +1 -0
index 170d2148f25..99e9c0b6bcf 100644
@@ -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
include/hw/misc/sifive_u_prci.h +1 -0
index 4d2491ad46d..07dce36055b 100644
@@ -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
include/hw/net/cadence_gem.h +1 -0
index e63941f18fc..5057ec42032 100644
@@ -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 */
 
include/hw/riscv/opentitan.h +1 -0
index 609473d07b4..39fc92c9d69 100644
@@ -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)
include/hw/riscv/shakti_c.h +1 -0
index 539fe1156de..7bed56be91c 100644
@@ -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) \
include/hw/riscv/sifive_e.h +1 -0
index 31180a680e6..3f547b0acdc 100644
@@ -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) \
include/hw/riscv/xiangshan_kmh.h +1 -0
index c5dc6b1a9a7..5c7bc3a06ee 100644
@@ -12,6 +12,7 @@
 
 #include "hw/boards.h"
 #include "hw/riscv/riscv_hart.h"
+#include "system/memory.h"
 
 #define XIANGSHAN_KMH_MAX_CPUS 16
 
include/hw/rtc/goldfish_rtc.h +1 -0
index 162be338636..357fbea4203 100644
@@ -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)
include/hw/ssi/ibex_spi_host.h +1 -0
index 5bd5557b9a1..d2abeb916e2 100644
@@ -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) \
include/hw/ssi/sifive_spi.h +1 -0
index d0c40cdb11b..0b1bc86e540 100644
@@ -24,6 +24,7 @@
 
 #include "qemu/fifo8.h"
 #include "hw/sysbus.h"
+#include "system/memory.h"
 
 #define SIFIVE_SPI_REG_NUM  (0x78 / 4)
 
include/hw/timer/cadence_ttc.h +1 -0
index e1251383f2a..0640bc54ca0 100644
@@ -20,6 +20,7 @@
 
 #include "hw/sysbus.h"
 #include "qemu/timer.h"
+#include "system/memory.h"
 
 typedef struct {
     QEMUTimer *timer;
include/hw/timer/ibex_timer.h +1 -0
index 41f5c82a920..9e58079e391 100644
@@ -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)
include/hw/timer/sifive_pwm.h +1 -0
index 6a8cf7b29e4..bc68cca8efc 100644
@@ -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"
 
Signature · 1 line
2.51.0
#34 lore raw

PATCH 27/27 hw/rx: Include missing 'system/memory.h' header

In reply to 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/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;
        |                  ^
---
 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(+)
include/hw/char/renesas_sci.h +1 -0
index a4764e3eee3..26142a20baf 100644
@@ -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;
include/hw/intc/rx_icu.h +1 -0
index b23504f3dd1..a8ca94938d4 100644
@@ -23,6 +23,7 @@
 
 #include "hw/sysbus.h"
 #include "qom/object.h"
+#include "system/memory.h"
 
 enum TRG_MODE {
     TRG_LEVEL = 0,
include/hw/timer/renesas_cmt.h +1 -0
index 1c0b65c1d5a..64bd14dc7a8 100644
@@ -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;
include/hw/timer/renesas_tmr.h +1 -0
index caf7eec0dca..f6c5937f40a 100644
@@ -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;
Signature · 1 line
2.51.0