[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 5/9] exec/address-spaces: Wrap address space singletons into functions



On 20/9/22 01:17, Bernhard Beschow wrote:
In the next steps, these singletons will be resolved by turning them
into attributes of the system bus. The system bus is already accessible
via the global current_machine variable which will be made use of later
in the wrapper functions.

All changes have been performed with search-and-replace:
* s/&address_space_memory/get_address_space_memory()/
* s/&address_space_io/get_address_space_io()/
The only exceptions were exec/address-spaces.h and softmmu/physmem.c
which have been manually changed.

Signed-off-by: Bernhard Beschow <shentey@xxxxxxxxx>
---
  accel/hvf/hvf-accel-ops.c            |  2 +-
  accel/kvm/kvm-all.c                  | 12 ++++++------
  hw/alpha/dp264.c                     |  4 ++--
  hw/alpha/typhoon.c                   |  4 ++--
  hw/arm/smmu-common.c                 |  4 ++--
  hw/arm/smmuv3.c                      | 14 +++++++-------
  hw/arm/virt.c                        |  2 +-
  hw/char/goldfish_tty.c               |  4 ++--
  hw/core/loader.c                     |  2 +-
  hw/dma/pl330.c                       |  2 +-
  hw/dma/rc4030.c                      |  2 +-
  hw/dma/xlnx-zynq-devcfg.c            |  4 ++--
  hw/dma/xlnx_dpdma.c                  |  8 ++++----
  hw/hppa/machine.c                    |  4 ++--
  hw/hyperv/hyperv.c                   |  2 +-
  hw/hyperv/vmbus.c                    |  2 +-
  hw/i386/amd_iommu.c                  | 18 +++++++++---------
  hw/i386/fw_cfg.c                     |  2 +-
  hw/i386/intel_iommu.c                | 24 ++++++++++++------------
  hw/i386/microvm.c                    |  4 ++--
  hw/i386/pc.c                         |  2 +-
  hw/i386/xen/xen-hvm.c                |  4 ++--
  hw/ide/ahci.c                        |  2 +-
  hw/ide/macio.c                       | 10 +++++-----
  hw/intc/apic.c                       |  2 +-
  hw/intc/openpic_kvm.c                |  2 +-
  hw/intc/pnv_xive.c                   |  6 +++---
  hw/intc/pnv_xive2.c                  |  6 +++---
  hw/intc/riscv_aplic.c                |  2 +-
  hw/intc/spapr_xive.c                 |  2 +-
  hw/intc/xive.c                       |  4 ++--
  hw/intc/xive2.c                      |  4 ++--
  hw/mips/jazz.c                       |  4 ++--
  hw/misc/lasi.c                       |  2 +-
  hw/misc/macio/mac_dbdma.c            |  8 ++++----
  hw/net/ftgmac100.c                   | 16 ++++++++--------
  hw/net/i82596.c                      | 24 ++++++++++++------------
  hw/net/imx_fec.c                     | 22 +++++++++++-----------
  hw/net/lasi_i82596.c                 |  2 +-
  hw/net/npcm7xx_emc.c                 | 14 +++++++-------
  hw/openrisc/boot.c                   |  2 +-
  hw/pci-host/dino.c                   |  6 +++---
  hw/pci-host/pnv_phb3.c               |  6 +++---
  hw/pci-host/pnv_phb3_msi.c           |  6 +++---
  hw/pci-host/pnv_phb4.c               | 10 +++++-----
  hw/pci/pci.c                         |  2 +-
  hw/ppc/pnv_psi.c                     |  2 +-
  hw/ppc/spapr.c                       |  4 ++--
  hw/ppc/spapr_events.c                |  2 +-
  hw/ppc/spapr_hcall.c                 |  4 ++--
  hw/ppc/spapr_iommu.c                 |  4 ++--
  hw/ppc/spapr_ovec.c                  |  8 ++++----
  hw/ppc/spapr_rtas.c                  |  2 +-
  hw/remote/iommu.c                    |  2 +-
  hw/remote/message.c                  |  4 ++--
  hw/remote/proxy-memory-listener.c    |  2 +-
  hw/riscv/boot.c                      |  6 +++---
  hw/riscv/sifive_e.c                  |  2 +-
  hw/riscv/sifive_u.c                  |  2 +-
  hw/riscv/virt.c                      |  2 +-
  hw/s390x/css.c                       | 16 ++++++++--------
  hw/s390x/ipl.h                       |  2 +-
  hw/s390x/s390-pci-bus.c              |  4 ++--
  hw/s390x/s390-pci-inst.c             | 10 +++++-----
  hw/s390x/s390-skeys.c                |  2 +-
  hw/s390x/virtio-ccw.c                | 10 +++++-----
  hw/sd/sdhci.c                        |  2 +-
  hw/sh4/r2d.c                         |  4 ++--
  hw/sparc/sun4m.c                     |  2 +-
  hw/sparc/sun4m_iommu.c               |  4 ++--
  hw/sparc64/sun4u_iommu.c             |  4 ++--
  hw/timer/hpet.c                      |  2 +-
  hw/usb/hcd-ehci-pci.c                |  2 +-
  hw/usb/hcd-ehci-sysbus.c             |  2 +-
  hw/usb/hcd-ohci.c                    |  2 +-
  hw/usb/hcd-xhci-sysbus.c             |  2 +-
  hw/vfio/ap.c                         |  2 +-
  hw/vfio/ccw.c                        |  2 +-
  hw/vfio/common.c                     |  8 ++++----
  hw/vfio/platform.c                   |  2 +-
  hw/virtio/vhost-vdpa.c               |  2 +-
  hw/virtio/vhost.c                    |  2 +-
  hw/virtio/virtio-bus.c               |  4 ++--
  hw/virtio/virtio-iommu.c             |  6 +++---
  hw/virtio/virtio-pci.c               |  2 +-
  hw/xen/xen_pt.c                      |  4 ++--
  include/exec/address-spaces.h        |  4 ++--
  include/hw/elf_ops.h                 |  4 ++--
  include/hw/ppc/spapr.h               |  5 +++--
  include/hw/ppc/vof.h                 |  4 ++--
  monitor/misc.c                       |  4 ++--
  softmmu/ioport.c                     | 12 ++++++------
  softmmu/memory_mapping.c             |  2 +-
  softmmu/physmem.c                    | 17 ++++++++++++++---
  target/arm/hvf/hvf.c                 |  4 ++--
  target/arm/kvm.c                     |  4 ++--
  target/avr/helper.c                  |  8 ++++----
  target/i386/hax/hax-all.c            |  2 +-
  target/i386/hax/hax-mem.c            |  2 +-
  target/i386/hvf/hvf.c                |  2 +-
  target/i386/hvf/vmx.h                |  2 +-
  target/i386/hvf/x86_mmu.c            |  6 +++---
  target/i386/nvmm/nvmm-all.c          |  4 ++--
  target/i386/sev.c                    |  4 ++--
  target/i386/tcg/sysemu/misc_helper.c | 12 ++++++------
  target/i386/whpx/whpx-all.c          |  4 ++--
  target/s390x/diag.c                  |  2 +-
  target/s390x/mmu_helper.c            |  2 +-
  target/s390x/sigp.c                  |  2 +-
  target/xtensa/dbg_helper.c           |  2 +-
  tests/qtest/fuzz/generic_fuzz.c      |  4 ++--
  111 files changed, 285 insertions(+), 273 deletions(-)

Please consider using scripts/git.orderfile for tree-wide refactors,
it helps reviewers.

diff --git a/include/exec/address-spaces.h b/include/exec/address-spaces.h
index db8bfa9a92..d5c8cbd718 100644
--- a/include/exec/address-spaces.h
+++ b/include/exec/address-spaces.h
@@ -33,8 +33,8 @@ MemoryRegion *get_system_memory(void);
   */
  MemoryRegion *get_system_io(void);
-extern AddressSpace address_space_memory;
-extern AddressSpace address_space_io;
+AddressSpace *get_address_space_memory(void);
+AddressSpace *get_address_space_io(void);
#endif

diff --git a/softmmu/physmem.c b/softmmu/physmem.c
index 56e03e07b5..0ac920d446 100644
--- a/softmmu/physmem.c
+++ b/softmmu/physmem.c
@@ -89,8 +89,8 @@ RAMList ram_list = { .blocks = 
QLIST_HEAD_INITIALIZER(ram_list.blocks) };
  static MemoryRegion *system_memory;
  static MemoryRegion *system_io;
-AddressSpace address_space_io;
-AddressSpace address_space_memory;
+static AddressSpace address_space_io;
+static AddressSpace address_space_memory;
static MemoryRegion io_mem_unassigned; @@ -2690,6 +2690,16 @@ MemoryRegion *get_system_io(void)
      return system_io;
  }
+AddressSpace *get_address_space_memory(void)
+{
+    return &address_space_memory;
+}
+
+AddressSpace *get_address_space_io(void)
+{
+    return &address_space_io;
+}

Reviewed-by: Philippe Mathieu-Daudé <f4bug@xxxxxxxxx>



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.