memory: QOM-ify AddressSpace
Subsystems (7)
cover memory: QOM-ify AddressSpace
Based-on: <[email protected]> ("[PATCH 00/14] Fix memory region use-after-finalization")
Make AddressSpaces QOM objects to ensure that they are destroyed when their owners are finalized and also to get a unique path for debugging output.
Suggested by BALATON Zoltan:
https://lore.kernel.org/qemu-devel/[email protected]/
---
Akihiko Odaki (35):
memory: QOM-ify AddressSpace hw/core/loader: Use address_space_get_path()
vfio: Use address_space_get_path() hw/alpha: QOM-ify AddressSpace hw/arm: QOM-ify AddressSpace hw/display: QOM-ify AddressSpace hw/dma: QOM-ify AddressSpace
hw/fsi: QOM-ify AddressSpace
hw/i2c: QOM-ify AddressSpace hw/i386: QOM-ify AddressSpace hw/intc: QOM-ify AddressSpace hw/loongarch: QOM-ify AddressSpace hw/mem: QOM-ify AddressSpace hw/misc: QOM-ify AddressSpace hw/net: QOM-ify AddressSpace hw/nubus: QOM-ify AddressSpace hw/pci: QOM-ify AddressSpace hw/pci-host: QOM-ify AddressSpace hw/ppc: QOM-ify AddressSpace hw/remote: QOM-ify AddressSpace hw/riscv: QOM-ify AddressSpace hw/s390x: QOM-ify AddressSpace hw/scsi: QOM-ify AddressSpace
hw/sd: QOM-ify AddressSpace hw/sparc: QOM-ify AddressSpace hw/sparc64: QOM-ify AddressSpace hw/ssi: QOM-ify AddressSpace
hw/usb: QOM-ify AddressSpace
hw/usb: QOM-ify AddressSpace hw/virtio: QOM-ify AddressSpace system/physmem: QOM-ify AddressSpace target/i386: QOM-ify AddressSpace target/mips: QOM-ify AddressSpace target/xtensa: QOM-ify AddressSpace
memory: Drop non-QOM AddressSpace support
include/exec/cpu-common.h | 4 +-- include/system/memory.h | 20 +++++++++------ hw/alpha/typhoon.c | 4 +-- hw/arm/armv7m.c | 2 +- hw/arm/aspeed_ast27x0.c | 2 +- hw/arm/smmu-common.c | 5 ++-- hw/core/loader.c | 8 +++--- hw/display/artist.c | 2 +- hw/display/bcm2835_fb.c | 2 +- hw/dma/bcm2835_dma.c | 2 +- hw/dma/pl080.c | 2 +- hw/dma/pl330.c | 3 +-- hw/dma/rc4030.c | 4 +-- hw/dma/xilinx_axidma.c | 4 +-- hw/dma/xlnx-zdma.c | 2 +- hw/dma/xlnx_csu_dma.c | 2 +- hw/fsi/aspeed_apb2opb.c | 2 +- hw/i2c/aspeed_i2c.c | 3 +-- hw/i386/amd_iommu.c | 5 ++-- hw/i386/intel_iommu.c | 5 +++- hw/intc/arm_gicv3_common.c | 3 +-- hw/intc/pnv_xive.c | 4 +-- hw/loongarch/virt.c | 3 ++- hw/mem/cxl_type3.c | 44 +++++++++------------------------ hw/mem/memory-device.c | 4 +-- hw/misc/aspeed_hace.c | 2 +- hw/misc/auxbus.c | 2 +- hw/misc/bcm2835_mbox.c | 2 +- hw/misc/bcm2835_property.c | 2 +- hw/misc/max78000_gcr.c | 2 +- hw/misc/tz-mpc.c | 6 ++--- hw/misc/tz-msc.c | 2 +- hw/misc/tz-ppc.c | 5 +++- hw/net/allwinner-sun8i-emac.c | 2 +- hw/net/cadence_gem.c | 4 +-- hw/net/dp8393x.c | 2 +- hw/net/msf2-emac.c | 2 +- hw/net/mv88w8618_eth.c | 2 +- hw/nubus/nubus-bus.c | 4 +-- hw/pci-host/astro.c | 3 +-- hw/pci-host/designware.c | 5 ++-- hw/pci-host/dino.c | 4 +-- hw/pci-host/gt64120.c | 2 +- hw/pci-host/pnv_phb3.c | 4 +-- hw/pci-host/pnv_phb4.c | 4 +-- hw/pci-host/ppc440_pcix.c | 2 +- hw/pci-host/ppce500.c | 2 +- hw/pci-host/raven.c | 2 +- hw/pci/pci.c | 6 ++--- hw/pci/pci_bridge.c | 10 ++++---- hw/ppc/pnv_lpc.c | 2 +- hw/ppc/pnv_xscom.c | 2 +- hw/ppc/spapr_pci.c | 5 ++-- hw/ppc/spapr_vio.c | 2 +- hw/remote/iommu.c | 4 +-- hw/riscv/riscv-iommu.c | 9 ++++--- hw/s390x/s390-pci-bus.c | 9 ++----- hw/scsi/lsi53c895a.c | 5 ++-- hw/sd/allwinner-sdhost.c | 2 +- hw/sd/sdhci.c | 4 +-- hw/sparc/sun4m_iommu.c | 2 +- hw/sparc64/sun4u_iommu.c | 2 +- hw/ssi/aspeed_smc.c | 6 ++--- hw/usb/hcd-dwc2.c | 2 +- hw/usb/hcd-xhci-sysbus.c | 2 +- hw/vfio/listener.c | 8 ++++-- hw/virtio/vhost-vdpa.c | 4 ++- hw/virtio/virtio-iommu.c | 3 ++- hw/virtio/virtio-pci.c | 12 ++++----- system/memory.c | 57 ++++++++++++++++++++++++++++--------------- system/physmem.c | 24 ++++++++++-------- target/i386/kvm/kvm.c | 3 ++- target/mips/cpu.c | 4 +-- target/xtensa/cpu.c | 2 +- 74 files changed, 204 insertions(+), 195 deletions(-)
---
base-commit: e101d33792530093fa0b0a6e5f43e4d8cfe4581e
change-id: 20250915-qom-e7fcca27d4db
prerequisite-change-id: 20250906-use-37ecc903a9e0:v2
prerequisite-patch-id: d464fda86a3c79ff8e6d7a2e623d979b2a47019b
prerequisite-patch-id: 17b153237f69c898b9c5b93aad0d5116d0bfe49f
prerequisite-patch-id: a323f67e01c672ab2958a237ea54b77f1443e2d1
prerequisite-patch-id: 822094864ad7a6a702fee098e4835621bd8092fe
prerequisite-patch-id: 5757efd81557b060257b5db6dec6fd189076ee77
prerequisite-patch-id: bd912830a326f13186bf38e916655ec980e11af8
prerequisite-patch-id: fe6b92112288829e60f10c305742a544f45e8984
prerequisite-patch-id: ac4ff0c11dcc1fc5d08b4fc480c14721fde574ad
prerequisite-patch-id: ff398fa97b5f2feee85372fdf108d82d8d5526b0
prerequisite-patch-id: 7ac446ae76e05dd267a63889ff775ac609712c31
prerequisite-patch-id: b49a74cd5f31348c3dc13dcfd1dad629e6b30387
prerequisite-patch-id: 8f61fe1b81cf3ec906ebbf61776573edd96c1e8c
prerequisite-patch-id: 01fb8ccbe7326021a94a8d7531189568d2e311a7
prerequisite-patch-id: 974b0fc6d7c8d6d56b8f44597260647e1a53cf38
prerequisite-patch-id: 55c4711a2a4e6b02b8b512e0283f8feaf7d3bfa3
prerequisite-message-id: <[email protected]>
prerequisite-patch-id: f9c7e666c59cdc8a561d6d122e7937648da490e1
prerequisite-patch-id: 9b52629b6d9d32e71e5c416aead9aadb0e3c7ae2
prerequisite-patch-id: 16467219e7dd93204cec6ceb6d69577e3e86c03a
prerequisite-patch-id: 37a3ee3288d2cda8303c9c9e3d5ec9d813b05ef6
prerequisite-patch-id: b707ebf05289b55e8458b6b3515aa0fc559c7c88
prerequisite-patch-id: 721e733f06ce38375881520725177c9da9c22633
prerequisite-patch-id: 3cd399b599a9ff57066d820b1e6504b335be4f79
prerequisite-patch-id: 8a607cc6e52a6a6958a73cd1a1b824b52a4f4582
prerequisite-patch-id: af3976b1c4c3ef4859f2371a318214af5418e97d
prerequisite-patch-id: 76c6e115f8771f31c99f454fd3188ca49e283025
prerequisite-patch-id: 488b5dd5a90070331daae2e22f7c1f6419a7e428
prerequisite-patch-id: 53b85575018fecb94e208bdb5d3047b8d66fb4dd
prerequisite-patch-id: 0426e04bb68376f2d4fad6ade4ac641202172396
prerequisite-patch-id: 6ba40a4bf6e2b0ba3d4ecf9a1c4fed7f46e5730c
Best regards,
Signature · 1 line
Akihiko Odaki <[email protected]>
PATCH 1/35 memory: QOM-ify AddressSpace
Make AddressSpaces QOM objects to ensure that they are destroyed when their owners are finalized and also to get a unique path for debugging output.
For incremental conversion, address_space_init() keeps the original behavior when the owner parameter is NULL, and all callers are changed to pass NULL as the owner parameter.
--- include/system/memory.h | 19 +++++++++++- hw/alpha/typhoon.c | 2 +- hw/arm/armv7m.c | 2 +- hw/arm/aspeed_ast27x0.c | 2 +- hw/arm/smmu-common.c | 2 +- hw/display/artist.c | 2 +- hw/display/bcm2835_fb.c | 2 +- hw/dma/bcm2835_dma.c | 2 +- hw/dma/pl080.c | 3 +- hw/dma/pl330.c | 2 +- hw/dma/rc4030.c | 3 +- hw/dma/xilinx_axidma.c | 2 +- hw/dma/xlnx-zdma.c | 2 +- hw/dma/xlnx_csu_dma.c | 2 +- hw/fsi/aspeed_apb2opb.c | 2 +- hw/i2c/aspeed_i2c.c | 2 +- hw/i386/amd_iommu.c | 2 +- hw/i386/intel_iommu.c | 3 +- hw/intc/arm_gicv3_common.c | 2 +- hw/intc/pnv_xive.c | 4 +-- hw/loongarch/virt.c | 2 +- hw/mem/cxl_type3.c | 6 ++-- hw/mem/memory-device.c | 2 +- hw/misc/aspeed_hace.c | 2 +- hw/misc/auxbus.c | 2 +- hw/misc/bcm2835_mbox.c | 3 +- hw/misc/bcm2835_property.c | 3 +- hw/misc/max78000_gcr.c | 2 +- hw/misc/tz-mpc.c | 4 +-- hw/misc/tz-msc.c | 2 +- hw/misc/tz-ppc.c | 2 +- hw/net/allwinner-sun8i-emac.c | 2 +- hw/net/cadence_gem.c | 2 +- hw/net/dp8393x.c | 2 +- hw/net/msf2-emac.c | 2 +- hw/net/mv88w8618_eth.c | 2 +- hw/nubus/nubus-bus.c | 2 +- hw/pci-host/astro.c | 2 +- hw/pci-host/designware.c | 2 +- hw/pci-host/dino.c | 2 +- hw/pci-host/gt64120.c | 2 +- hw/pci-host/pnv_phb3.c | 2 +- hw/pci-host/pnv_phb4.c | 2 +- hw/pci-host/ppc440_pcix.c | 2 +- hw/pci-host/ppce500.c | 2 +- hw/pci-host/raven.c | 2 +- hw/pci/pci.c | 2 +- hw/pci/pci_bridge.c | 5 ++-- hw/ppc/pnv_lpc.c | 2 +- hw/ppc/pnv_xscom.c | 2 +- hw/ppc/spapr_pci.c | 2 +- hw/ppc/spapr_vio.c | 2 +- hw/remote/iommu.c | 2 +- hw/riscv/riscv-iommu.c | 7 +++-- hw/s390x/s390-pci-bus.c | 2 +- hw/scsi/lsi53c895a.c | 3 +- hw/sd/allwinner-sdhost.c | 2 +- hw/sd/sdhci.c | 2 +- hw/sparc/sun4m_iommu.c | 3 +- hw/sparc64/sun4u_iommu.c | 3 +- hw/ssi/aspeed_smc.c | 4 +-- hw/usb/hcd-dwc2.c | 2 +- hw/usb/hcd-xhci-sysbus.c | 2 +- hw/virtio/virtio-iommu.c | 2 +- hw/virtio/virtio-pci.c | 4 +-- system/memory.c | 67 ++++++++++++++++++++++++++++++++----------- system/physmem.c | 13 ++++++--- target/i386/kvm/kvm.c | 2 +- target/mips/cpu.c | 2 +- target/xtensa/cpu.c | 2 +- 70 files changed, 163 insertions(+), 98 deletions(-)
include/system/memory.h +18 -1
@@ -47,6 +47,9 @@ typedef struct RamDiscardManager RamDiscardManager;DECLARE_OBJ_CHECKERS (RamDiscardManager, RamDiscardManagerClass,RAM_DISCARD_MANAGER ,TYPE_RAM_DISCARD_MANAGER ); +#define TYPE_ADDRESS_SPACE "address-space" +OBJECT_DECLARE_SIMPLE_TYPE(AddressSpace, ADDRESS_SPACE) +#ifdef CONFIG_FUZZ void fuzz_dma_read_cb(size_t addr, size_t len,
@@ -1158,7 +1161,9 @@ typedef struct AddressSpaceMapClient {*/ struct AddressSpace {/* private: */ +Object parent_obj;struct rcu_head rcu; +bool qom;char *name;MemoryRegion *root;
@@ -2706,11 +2711,13 @@ MemTxResult memory_region_dispatch_write(MemoryRegion *mr,* address_space_init: initializes an address space * * @as: an uninitialized #AddressSpace +* @parent: parent object * @root: a #MemoryRegion that routes addresses for the address space * @name: an address space name. The name is only used for debugging * output. */ -void address_space_init (AddressSpace *as,MemoryRegion *root,const char *name); +void address_space_init (AddressSpace *as,Object *parent,MemoryRegion *root, +const char *name);/** * address_space_destroy: destroy an address space
@@ -2723,6 +2730,16 @@ void address_space_init(AddressSpace *as, MemoryRegion *root, const char *name);*/ void address_space_destroy (AddressSpace *as); +/** +* address_space_get_path: get the path to an address space +* +* @as: an initialized #AddressSpace +* +* Returns: The canonical path for an address space, newly allocated. +* Use g_free() to free it. +*/ +char *address_space_get_path (AddressSpace *as); +/** * address_space_remove_listeners: unregister all listeners of an address space *
hw/alpha/typhoon.c +1 -1
@@ -900,7 +900,7 @@ PCIBus *typhoon_init(MemoryRegion *ram, qemu_irq *p_isa_irq,memory_region_init_iommu (&s->pchip.iommu,sizeof (s->pchip.iommu),TYPE_TYPHOON_IOMMU_MEMORY_REGION ,OBJECT (s),"iommu-typhoon" ,UINT64_MAX ); -address_space_init (&s->pchip.iommu_as,MEMORY_REGION (&s->pchip.iommu), +address_space_init (&s->pchip.iommu_as,NULL ,MEMORY_REGION (&s->pchip.iommu),"pchip0-pci" );pci_setup_iommu (b, &typhoon_iommu_ops, s);
hw/arm/armv7m.c +1 -1
@@ -117,7 +117,7 @@ static void bitband_realize(DeviceState *dev, Error **errp)return ; } -address_space_init (&s->source_as, s->source_memory,"bitband-source" ); +address_space_init (&s->source_as,NULL , s->source_memory,"bitband-source" ); }/* Board init. */
hw/arm/aspeed_ast27x0.c +1 -1
@@ -387,7 +387,7 @@ static bool aspeed_soc_ast2700_dram_init(DeviceState *dev, Error **errp)memory_region_init (&s->dram_container,OBJECT (s),"ram-container" , ram_size);memory_region_add_subregion (&s->dram_container,0 , s->dram_mr); -address_space_init (&s->dram_as, s->dram_mr,"dram" ); +address_space_init (&s->dram_as,NULL , s->dram_mr,"dram" );/* * Add a memory region beyond the RAM region to emulate
hw/arm/smmu-common.c +1 -1
@@ -873,7 +873,7 @@ static AddressSpace *smmu_find_add_as(PCIBus *bus, void *opaque, int devfn)memory_region_init_iommu (&sdev->iommu,sizeof (sdev->iommu), s->mrtypename,OBJECT (s), name,UINT64_MAX ); -address_space_init (&sdev->as, +address_space_init (&sdev->as,NULL ,MEMORY_REGION (&sdev->iommu), name);trace_smmu_add_mr (name);g_free (name);
hw/display/artist.c +1 -1
@@ -1391,7 +1391,7 @@ static void artist_realizefn(DeviceState *dev, Error **errp) }memory_region_init (&s->mem_as_root,OBJECT (dev),"artist" , ~0ull ); -address_space_init (&s->as, &s->mem_as_root,"artist" ); +address_space_init (&s->as,NULL , &s->mem_as_root,"artist" );artist_create_buffer (s,"cmap" , &offset,ARTIST_BUFFER_CMAP ,2048 ,4 ); artist_create_buffer(s, "ap", &offset, ARTIST_BUFFER_AP,
hw/display/bcm2835_fb.c +1 -1
@@ -421,7 +421,7 @@ static void bcm2835_fb_realize(DeviceState *dev, Error **errp) s->initial_config.base = s->vcram_base +BCM2835_FB_OFFSET ; s->dma_mr =MEMORY_REGION (obj); -address_space_init (&s->dma_as, s->dma_mr,TYPE_BCM2835_FB "-memory" ); +address_space_init (&s->dma_as,NULL , s->dma_mr,TYPE_BCM2835_FB "-memory" );bcm2835_fb_reset (dev);
hw/dma/bcm2835_dma.c +1 -1
@@ -380,7 +380,7 @@ static void bcm2835_dma_realize(DeviceState *dev, Error **errp) obj =object_property_get_link (OBJECT (dev),"dma-mr" , &error_abort); s->dma_mr =MEMORY_REGION (obj); -address_space_init (&s->dma_as, s->dma_mr,TYPE_BCM2835_DMA "-memory" ); +address_space_init (&s->dma_as,NULL , s->dma_mr,TYPE_BCM2835_DMA "-memory" );bcm2835_dma_reset (dev); }
hw/dma/pl080.c +2 -1
@@ -398,7 +398,8 @@ static void pl080_realize(DeviceState *dev, Error **errp)return ; } -address_space_init (&s->downstream_as, s->downstream,"pl080-downstream" ); +address_space_init (&s->downstream_as,NULL , s->downstream, +"pl080-downstream" ); }static void pl081_init (Object *obj)
hw/dma/pl330.c +1 -1
@@ -1569,7 +1569,7 @@ static void pl330_realize(DeviceState *dev, Error **errp) s->mem_as = &address_space_memory; }else { s->mem_as =g_new0 (AddressSpace,1 ); -address_space_init (s->mem_as, s->mem_mr, +address_space_init (s->mem_as,NULL , s->mem_mr,memory_region_name (s->mem_mr)); }
hw/dma/rc4030.c +2 -1
@@ -688,7 +688,8 @@ static void rc4030_realize(DeviceState *dev, Error **errp)memory_region_init_iommu (&s->dma_mr,sizeof (s->dma_mr),TYPE_RC4030_IOMMU_MEMORY_REGION , o,"rc4030.dma" ,4 * GiB); -address_space_init (&s->dma_as,MEMORY_REGION (&s->dma_mr),"rc4030-dma" ); +address_space_init (&s->dma_as,NULL ,MEMORY_REGION (&s->dma_mr), +"rc4030-dma" ); }static void rc4030_unrealize (DeviceState *dev)
hw/dma/xilinx_axidma.c +1 -1
@@ -588,7 +588,7 @@ static void xilinx_axidma_realize(DeviceState *dev, Error **errp)ptimer_transaction_commit (st->ptimer); } -address_space_init (&s->as, +address_space_init (&s->as,NULL , s->dma_mr ? s->dma_mr :get_system_memory (),"dma" ); }
hw/dma/xlnx-zdma.c +1 -1
@@ -769,7 +769,7 @@ static void zdma_realize(DeviceState *dev, Error **errp)error_setg (errp,TYPE_XLNX_ZDMA " 'dma' link not set" );return ; } -address_space_init (&s->dma_as, s->dma_mr,"zdma-dma" ); +address_space_init (&s->dma_as,NULL , s->dma_mr,"zdma-dma" );for (i =0 ; i <ARRAY_SIZE (zdma_regs_info); ++i) {RegisterInfo *r = &s->regs_info[zdma_regs_info[i].addr /4 ];
hw/dma/xlnx_csu_dma.c +1 -1
@@ -653,7 +653,7 @@ static void xlnx_csu_dma_realize(DeviceState *dev, Error **errp)error_setg (errp,TYPE_XLNX_CSU_DMA " 'dma' link not set" );return ; } -address_space_init (&s->dma_as, s->dma_mr,"csu-dma" ); +address_space_init (&s->dma_as,NULL , s->dma_mr,"csu-dma" ); reg_array = register_init_block32(dev, xlnx_csu_dma_regs_info[!!s->is_dst],
hw/fsi/aspeed_apb2opb.c +1 -1
@@ -349,7 +349,7 @@ static void fsi_opb_init(Object *o)OPBus *opb =OP_BUS (o);memory_region_init (&opb->mr,0 ,TYPE_FSI_OPB ,UINT32_MAX ); -address_space_init (&opb->as, &opb->mr,TYPE_FSI_OPB ); +address_space_init (&opb->as,NULL , &opb->mr,TYPE_FSI_OPB ); }static const TypeInfo opb_info = {
hw/i2c/aspeed_i2c.c +1 -1
@@ -1253,7 +1253,7 @@ static void aspeed_i2c_realize(DeviceState *dev, Error **errp)return ; } -address_space_init (&s->dram_as, s->dram_mr, +address_space_init (&s->dram_as,NULL , s->dram_mr,TYPE_ASPEED_I2C "-dma-dram" ); } }
hw/i386/amd_iommu.c +1 -1
@@ -1522,7 +1522,7 @@ static AddressSpace *amdvi_host_dma_iommu(PCIBus *bus, void *opaque, int devfn) "amd_iommu", UINT64_MAX);memory_region_init (&amdvi_dev_as->root,OBJECT (s),"amdvi_root" ,UINT64_MAX ); -address_space_init (&amdvi_dev_as->as, &amdvi_dev_as->root, name); +address_space_init (&amdvi_dev_as->as,NULL , &amdvi_dev_as->root, name);memory_region_add_subregion_overlap (&amdvi_dev_as->root,0 ,MEMORY_REGION (&amdvi_dev_as->iommu),0 );
hw/i386/intel_iommu.c +2 -1
@@ -4263,7 +4263,8 @@ VTDAddressSpace *vtd_find_add_as(IntelIOMMUState *s, PCIBus *bus, vtd_dev_as->iova_tree =iova_tree_new ();memory_region_init (&vtd_dev_as->root,OBJECT (s), name,UINT64_MAX ); -address_space_init (&vtd_dev_as->as, &vtd_dev_as->root,"vtd-root" ); +address_space_init (&vtd_dev_as->as,NULL , &vtd_dev_as->root, +"vtd-root" );/* * Build the DMAR-disabled container with aliases to the
hw/intc/arm_gicv3_common.c +1 -1
@@ -429,7 +429,7 @@ static void arm_gicv3_common_realize(DeviceState *dev, Error **errp) }if (s->lpi_enable) { -address_space_init (&s->dma_as, s->dma, +address_space_init (&s->dma_as,NULL , s->dma,"gicv3-its-sysmem" ); }
hw/intc/pnv_xive.c +2 -2
@@ -2012,10 +2012,10 @@ static void pnv_xive_realize(DeviceState *dev, Error **errp)memory_region_init (&xive->ipi_mmio,OBJECT (xive),"xive-vc-ipi" ,PNV9_XIVE_VC_SIZE ); -address_space_init (&xive->ipi_as, &xive->ipi_mmio,"xive-vc-ipi" ); +address_space_init (&xive->ipi_as,NULL , &xive->ipi_mmio,"xive-vc-ipi" );memory_region_init (&xive->end_mmio,OBJECT (xive),"xive-vc-end" ,PNV9_XIVE_VC_SIZE ); -address_space_init (&xive->end_as, &xive->end_mmio,"xive-vc-end" ); +address_space_init (&xive->end_as,NULL , &xive->end_mmio,"xive-vc-end" );/* * The MMIO windows exposing the IPI ESBs and the END ESBs in the
hw/loongarch/virt.c +1 -1
@@ -699,7 +699,7 @@ static void virt_init(MachineState *machine)/* Create IOCSR space */ memory_region_init_io (&lvms->system_iocsr,OBJECT (machine),NULL , machine,"iocsr" ,UINT64_MAX ); -address_space_init (&lvms->as_iocsr, &lvms->system_iocsr,"IOCSR" ); +address_space_init (&lvms->as_iocsr,NULL , &lvms->system_iocsr,"IOCSR" );memory_region_init_io (&lvms->iocsr_mem,OBJECT (machine), &virt_iocsr_misc_ops, machine,"iocsr_misc" ,0x428 );
hw/mem/cxl_type3.c +3 -3
@@ -770,7 +770,7 @@ static bool cxl_setup_memory(CXLType3Dev *ct3d, Error **errp) }else { v_name =g_strdup ("cxl-type3-dpa-vmem-space" ); } -address_space_init (&ct3d->hostvmem_as, vmr, v_name); +address_space_init (&ct3d->hostvmem_as,NULL , vmr, v_name); ct3d->cxl_dstate.vmem_size =memory_region_size (vmr); ct3d->cxl_dstate.static_mem_size +=memory_region_size (vmr);g_free (v_name);
@@ -798,7 +798,7 @@ static bool cxl_setup_memory(CXLType3Dev *ct3d, Error **errp) }else { p_name =g_strdup ("cxl-type3-dpa-pmem-space" ); } -address_space_init (&ct3d->hostpmem_as, pmr, p_name); +address_space_init (&ct3d->hostpmem_as,NULL , pmr, p_name); ct3d->cxl_dstate.pmem_size =memory_region_size (pmr); ct3d->cxl_dstate.static_mem_size +=memory_region_size (pmr);g_free (p_name);
@@ -837,7 +837,7 @@ static bool cxl_setup_memory(CXLType3Dev *ct3d, Error **errp) }else { dc_name =g_strdup ("cxl-dcd-dpa-dc-space" ); } -address_space_init (&ct3d->dc.host_dc_as, dc_mr, dc_name); +address_space_init (&ct3d->dc.host_dc_as,NULL , dc_mr, dc_name);g_free (dc_name);if (!cxl_create_dc_regions (ct3d, errp)) {
hw/mem/memory-device.c +1 -1
@@ -535,7 +535,7 @@ void machine_memory_devices_init(MachineState *ms, hwaddr base, uint64_t size)memory_region_init (&ms->device_memory->mr,OBJECT (ms),"device-memory" , size); -address_space_init (&ms->device_memory->as, &ms->device_memory->mr, +address_space_init (&ms->device_memory->as,NULL , &ms->device_memory->mr,"device-memory" );memory_region_add_subregion (get_system_memory (), ms->device_memory->base, &ms->device_memory->mr);
hw/misc/aspeed_hace.c +1 -1
@@ -603,7 +603,7 @@ static void aspeed_hace_realize(DeviceState *dev, Error **errp)return ; } -address_space_init (&s->dram_as, s->dram_mr,"dram" ); +address_space_init (&s->dram_as,NULL , s->dram_mr,"dram" );sysbus_init_mmio (sbd, &s->iomem); }
hw/misc/auxbus.c +1 -1
@@ -74,7 +74,7 @@ AUXBus *aux_bus_init(DeviceState *parent, const char *name)/* Memory related. */ bus->aux_io =g_malloc (sizeof (*bus->aux_io));memory_region_init (bus->aux_io,OBJECT (bus),"aux-io" ,1 * MiB); -address_space_init (&bus->aux_addr_space, bus->aux_io,"aux-io" ); +address_space_init (&bus->aux_addr_space,NULL , bus->aux_io,"aux-io" );return bus; }
hw/misc/bcm2835_mbox.c +2 -1
@@ -310,7 +310,8 @@ static void bcm2835_mbox_realize(DeviceState *dev, Error **errp) obj =object_property_get_link (OBJECT (dev),"mbox-mr" , &error_abort); s->mbox_mr =MEMORY_REGION (obj); -address_space_init (&s->mbox_as, s->mbox_mr,TYPE_BCM2835_MBOX "-memory" ); +address_space_init (&s->mbox_as,NULL , s->mbox_mr, +TYPE_BCM2835_MBOX "-memory" );bcm2835_mbox_reset (dev); }
hw/misc/bcm2835_property.c +2 -1
@@ -540,7 +540,8 @@ static void bcm2835_property_realize(DeviceState *dev, Error **errp) obj =object_property_get_link (OBJECT (dev),"dma-mr" , &error_abort); s->dma_mr =MEMORY_REGION (obj); -address_space_init (&s->dma_as, s->dma_mr,TYPE_BCM2835_PROPERTY "-memory" ); +address_space_init (&s->dma_as,NULL , s->dma_mr, +TYPE_BCM2835_PROPERTY "-memory" ); obj =object_property_get_link (OBJECT (dev),"otp" , &error_abort); s->otp =BCM2835_OTP (obj);
hw/misc/max78000_gcr.c +1 -1
@@ -320,7 +320,7 @@ static void max78000_gcr_realize(DeviceState *dev, Error **errp) {Max78000GcrState *s =MAX78000_GCR (dev); -address_space_init (&s->sram_as, s->sram,"sram" ); +address_space_init (&s->sram_as,NULL , s->sram,"sram" ); }static void max78000_gcr_class_init (ObjectClass *klass,const void *data)
hw/misc/tz-mpc.c +2 -2
@@ -550,9 +550,9 @@ static void tz_mpc_realize(DeviceState *dev, Error **errp)memory_region_init_io (&s->blocked_io, obj, &tz_mpc_mem_blocked_ops, s,"tz-mpc-blocked-io" , size); -address_space_init (&s->downstream_as, s->downstream, +address_space_init (&s->downstream_as,NULL , s->downstream,"tz-mpc-downstream" ); -address_space_init (&s->blocked_io_as, &s->blocked_io, +address_space_init (&s->blocked_io_as,NULL , &s->blocked_io,"tz-mpc-blocked-io" ); s->blk_lut =g_new0 (uint32_t, s->blk_max);
hw/misc/tz-msc.c +1 -1
@@ -260,7 +260,7 @@ static void tz_msc_realize(DeviceState *dev, Error **errp) } size =memory_region_size (s->downstream); -address_space_init (&s->downstream_as, s->downstream, name); +address_space_init (&s->downstream_as,NULL , s->downstream, name);memory_region_init_io (&s->upstream, obj, &tz_msc_ops, s, name, size);sysbus_init_mmio (sbd, &s->upstream); }
hw/misc/tz-ppc.c +1 -1
@@ -276,7 +276,7 @@ static void tz_ppc_realize(DeviceState *dev, Error **errp) name =g_strdup_printf ("tz-ppc-port[%d]" , i); port->ppc = s; -address_space_init (&port->downstream_as, port->downstream, name); +address_space_init (&port->downstream_as,NULL , port->downstream, name); size =memory_region_size (port->downstream); memory_region_init_io(&port->upstream, obj, &tz_ppc_ops,
hw/net/allwinner-sun8i-emac.c +1 -1
@@ -820,7 +820,7 @@ static void allwinner_sun8i_emac_realize(DeviceState *dev, Error **errp)return ; } -address_space_init (&s->dma_as, s->dma_mr,"emac-dma" ); +address_space_init (&s->dma_as,NULL , s->dma_mr,"emac-dma" );qemu_macaddr_default_if_unset (&s->conf.macaddr); s->nic = qemu_new_nic(&net_allwinner_sun8i_emac_info, &s->conf,
hw/net/cadence_gem.c +1 -1
@@ -1734,7 +1734,7 @@ static void gem_realize(DeviceState *dev, Error **errp)CadenceGEMState *s =CADENCE_GEM (dev);int i; -address_space_init (&s->dma_as, +address_space_init (&s->dma_as,NULL , s->dma_mr ? s->dma_mr :get_system_memory (),"dma" ); if (s->num_priority_queues == 0 ||
hw/net/dp8393x.c +1 -1
@@ -908,7 +908,7 @@ static void dp8393x_realize(DeviceState *dev, Error **errp) {dp8393xState *s =DP8393X (dev); -address_space_init (&s->as, s->dma_mr,"dp8393x" ); +address_space_init (&s->as,NULL , s->dma_mr,"dp8393x" );memory_region_init_io (&s->mmio,OBJECT (dev), &dp8393x_ops, s,"dp8393x-regs" ,SONIC_REG_COUNT << s->it_shift);
hw/net/msf2-emac.c +1 -1
@@ -526,7 +526,7 @@ static void msf2_emac_realize(DeviceState *dev, Error **errp)return ; } -address_space_init (&s->dma_as, s->dma_mr,"emac-ahb" ); +address_space_init (&s->dma_as,NULL , s->dma_mr,"emac-ahb" );qemu_macaddr_default_if_unset (&s->conf.macaddr); s->nic = qemu_new_nic(&net_msf2_emac_info, &s->conf,
hw/net/mv88w8618_eth.c +1 -1
@@ -348,7 +348,7 @@ static void mv88w8618_eth_realize(DeviceState *dev, Error **errp)return ; } -address_space_init (&s->dma_as, s->dma_mr,"emac-dma" ); +address_space_init (&s->dma_as,NULL , s->dma_mr,"emac-dma" ); s->nic =qemu_new_nic (&net_mv88w8618_info, &s->conf,object_get_typename (OBJECT (dev)), dev->id, &dev->mem_reentrancy_guard, s);
hw/nubus/nubus-bus.c +1 -1
@@ -94,7 +94,7 @@ static void nubus_realize(BusState *bus, Error **errp)return ; } -address_space_init (&nubus->nubus_as, &nubus->nubus_mr,"nubus" ); +address_space_init (&nubus->nubus_as,NULL , &nubus->nubus_mr,"nubus" ); }static void nubus_init (Object *obj)
hw/pci-host/astro.c +1 -1
@@ -835,7 +835,7 @@ static void astro_realize(DeviceState *obj, Error **errp)memory_region_init_iommu (&s->iommu,sizeof (s->iommu),TYPE_ASTRO_IOMMU_MEMORY_REGION ,OBJECT (s),"iommu-astro" ,UINT64_MAX ); -address_space_init (&s->iommu_as,MEMORY_REGION (&s->iommu), +address_space_init (&s->iommu_as,NULL ,MEMORY_REGION (&s->iommu),"bm-pci" );/* Create Elroys (PCI host bus chips). */
hw/pci-host/designware.c +1 -1
@@ -706,7 +706,7 @@ static void designware_pcie_host_realize(DeviceState *dev, Error **errp) UINT64_MAX);memory_region_add_subregion (&s->pci.address_space_root,0x0 , &s->pci.memory); -address_space_init (&s->pci.address_space, +address_space_init (&s->pci.address_space,NULL , &s->pci.address_space_root,"pcie-bus-address-space" );pci_setup_iommu (pci->bus, &designware_iommu_ops, s);
hw/pci-host/dino.c +1 -1
@@ -434,7 +434,7 @@ static void dino_pcihost_realize(DeviceState *dev, Error **errp)memory_region_add_subregion (&s->bm,0xfff00000 , &s->bm_cpu_alias); -address_space_init (&s->bm_as, &s->bm,"pci-bm" ); +address_space_init (&s->bm_as,NULL , &s->bm,"pci-bm" ); }static void dino_pcihost_unrealize (DeviceState *dev)
hw/pci-host/gt64120.c +1 -1
@@ -1198,7 +1198,7 @@ static void gt64120_realize(DeviceState *dev, Error **errp)memory_region_init_io (&s->ISD_mem,OBJECT (dev), &isd_mem_ops, s,"gt64120-isd" ,0x1000 );memory_region_init (&s->pci0_mem,OBJECT (dev),"pci0-mem" ,4 * GiB); -address_space_init (&s->pci0_mem_as, &s->pci0_mem,"pci0-mem" ); +address_space_init (&s->pci0_mem_as,NULL , &s->pci0_mem,"pci0-mem" ); phb->bus = pci_root_bus_new(dev, "pci", &s->pci0_mem, get_system_io(),
hw/pci-host/pnv_phb3.c +1 -1
@@ -956,7 +956,7 @@ static AddressSpace *pnv_phb3_dma_iommu(PCIBus *bus, void *opaque, int devfn)memory_region_init_iommu (&ds->dma_mr,sizeof (ds->dma_mr),TYPE_PNV_PHB3_IOMMU_MEMORY_REGION ,OBJECT (phb),"phb3_iommu" ,UINT64_MAX ); -address_space_init (&ds->dma_as,MEMORY_REGION (&ds->dma_mr), +address_space_init (&ds->dma_as,NULL ,MEMORY_REGION (&ds->dma_mr),"phb3_iommu" );memory_region_init_io (&ds->msi32_mr,OBJECT (phb), &pnv_phb3_msi_ops, ds,"msi32" ,0x10000 );
hw/pci-host/pnv_phb4.c +1 -1
@@ -1469,7 +1469,7 @@ static AddressSpace *pnv_phb4_dma_iommu(PCIBus *bus, void *opaque, int devfn)memory_region_init_iommu (&ds->dma_mr,sizeof (ds->dma_mr),TYPE_PNV_PHB4_IOMMU_MEMORY_REGION ,OBJECT (phb), name,UINT64_MAX ); -address_space_init (&ds->dma_as,MEMORY_REGION (&ds->dma_mr), +address_space_init (&ds->dma_as,NULL ,MEMORY_REGION (&ds->dma_mr), name);memory_region_init_io (&ds->msi32_mr,OBJECT (phb), &pnv_phb4_msi_ops, ds,"msi32" ,0x10000 );
hw/pci-host/ppc440_pcix.c +1 -1
@@ -502,7 +502,7 @@ static void ppc440_pcix_realize(DeviceState *dev, Error **errp)memory_region_init (&s->bm,OBJECT (s),"bm-ppc440-pcix" ,UINT64_MAX );memory_region_add_subregion (&s->bm,0x0 , &s->busmem); -address_space_init (&s->bm_as, &s->bm,"pci-bm" ); +address_space_init (&s->bm_as,NULL , &s->bm,"pci-bm" );pci_setup_iommu (h->bus, &ppc440_iommu_ops, s);memory_region_init (&s->container,OBJECT (s),"pci-container" ,PCI_ALL_SIZE );
hw/pci-host/ppce500.c +1 -1
@@ -470,7 +470,7 @@ static void e500_pcihost_realize(DeviceState *dev, Error **errp)/* Set up PCI view of memory */ memory_region_init (&s->bm,OBJECT (s),"bm-e500" ,UINT64_MAX );memory_region_add_subregion (&s->bm,0x0 , &s->busmem); -address_space_init (&s->bm_as, &s->bm,"pci-bm" ); +address_space_init (&s->bm_as,NULL , &s->bm,"pci-bm" );pci_setup_iommu (b, &ppce500_iommu_ops, s);pci_create_simple (b,0 ,TYPE_PPC_E500_PCI_BRIDGE );
hw/pci-host/raven.c +1 -1
@@ -214,7 +214,7 @@ static void raven_pcihost_realize(DeviceState *d, Error **errp)memory_region_init_alias (mr, o,"bm-system" ,get_system_memory (),0 ,0x80000000 );memory_region_add_subregion (bm,0x80000000 , mr); -address_space_init (&s->bm_as, bm,"raven-bm-as" ); +address_space_init (&s->bm_as,NULL , bm,"raven-bm-as" );pci_setup_iommu (h->bus, &raven_iommu_ops, s); }
hw/pci/pci.c +1 -1
@@ -1359,7 +1359,7 @@ static PCIDevice *do_pci_register_device(PCIDevice *pci_dev,memory_region_init (&pci_dev->bus_master_container_region,OBJECT (pci_dev),"bus master container" ,UINT64_MAX ); -address_space_init (&pci_dev->bus_master_as, +address_space_init (&pci_dev->bus_master_as,NULL , &pci_dev->bus_master_container_region, pci_dev->name); pci_dev->bus_master_as.max_bounce_buffer_size = pci_dev->max_bounce_buffer_size;
hw/pci/pci_bridge.c +3 -2
@@ -388,12 +388,13 @@ void pci_bridge_initfn(PCIDevice *dev, const char *typename) sec_bus->map_irq = br->map_irq ? br->map_irq : pci_swizzle_map_irq_fn; sec_bus->address_space_mem = &br->address_space_mem;memory_region_init (&br->address_space_mem,OBJECT (br),"pci_bridge_pci" ,UINT64_MAX ); -address_space_init (&br->as_mem, &br->address_space_mem, +address_space_init (&br->as_mem,NULL , &br->address_space_mem,"pci_bridge_pci_mem" ); sec_bus->address_space_io = &br->address_space_io;memory_region_init (&br->address_space_io,OBJECT (br),"pci_bridge_io" ,4 * GiB); -address_space_init (&br->as_io, &br->address_space_io,"pci_bridge_pci_io" ); +address_space_init (&br->as_io,NULL , &br->address_space_io, +"pci_bridge_pci_io" );pci_bridge_region_update (br, true);QLIST_INIT (&sec_bus->child);QLIST_INSERT_HEAD (&parent->child, sec_bus, sibling);
hw/ppc/pnv_lpc.c +1 -1
@@ -799,7 +799,7 @@ static void pnv_lpc_realize(DeviceState *dev, Error **errp)/* Create address space and backing MR for the OPB bus */ memory_region_init (&lpc->opb_mr,OBJECT (dev),"lpc-opb" ,0x100000000ull ); -address_space_init (&lpc->opb_as, &lpc->opb_mr,"lpc-opb" ); +address_space_init (&lpc->opb_as,NULL , &lpc->opb_mr,"lpc-opb" );/* * Create ISA IO, Mem, and FW space regions which are the root of
hw/ppc/pnv_xscom.c +1 -1
@@ -219,7 +219,7 @@ void pnv_xscom_init(PnvChip *chip, uint64_t size, hwaddr addr)memory_region_add_subregion (get_system_memory (), addr, &chip->xscom_mmio);memory_region_init (&chip->xscom,OBJECT (chip), name, size); -address_space_init (&chip->xscom_as, &chip->xscom, name); +address_space_init (&chip->xscom_as,NULL , &chip->xscom, name);g_free (name); }
hw/ppc/spapr_pci.c +1 -1
@@ -1902,7 +1902,7 @@ static void spapr_phb_realize(DeviceState *dev, Error **errp)memory_region_init (&sphb->iommu_root,OBJECT (sphb), namebuf,UINT64_MAX );g_free (namebuf); -address_space_init (&sphb->iommu_as, &sphb->iommu_root, +address_space_init (&sphb->iommu_as,NULL , &sphb->iommu_root, sphb->dtbusname);/*
hw/ppc/spapr_vio.c +1 -1
@@ -529,7 +529,7 @@ static void spapr_vio_busdev_realize(DeviceState *qdev, Error **errp)"iommu-spapr-bypass" ,get_system_memory (), 0, MACHINE(spapr)->ram_size);memory_region_add_subregion_overlap (&dev->mrroot,0 , &dev->mrbypass,1 ); -address_space_init (&dev->as, &dev->mrroot, qdev->id); +address_space_init (&dev->as,NULL , &dev->mrroot, qdev->id); dev->tcet =spapr_tce_new_table (qdev, liobn); spapr_tce_table_enable(dev->tcet, SPAPR_TCE_PAGE_SHIFT, 0,
hw/remote/iommu.c +1 -1
@@ -54,7 +54,7 @@ static AddressSpace *remote_iommu_find_add_as(PCIBus *pci_bus,if (!elem->mr) { elem->mr =MEMORY_REGION (object_new (TYPE_MEMORY_REGION ));memory_region_set_size (elem->mr,UINT64_MAX ); -address_space_init (&elem->as, elem->mr,NULL ); +address_space_init (&elem->as,NULL , elem->mr,NULL ); }qemu_mutex_unlock (&iommu->lock);
hw/riscv/riscv-iommu.c +4 -3
@@ -1221,7 +1221,8 @@ static AddressSpace *riscv_iommu_space(RISCVIOMMUState *s, uint32_t devid)memory_region_init_iommu (&as->iova_mr,sizeof (as->iova_mr),TYPE_RISCV_IOMMU_MEMORY_REGION ,OBJECT (as),"riscv_iommu" ,UINT64_MAX ); -address_space_init (&as->iova_as,MEMORY_REGION (&as->iova_mr), name); +address_space_init (&as->iova_as,NULL ,MEMORY_REGION (&as->iova_mr), + name);QLIST_INSERT_HEAD (&s->spaces, as, list);
@@ -2426,7 +2427,7 @@ static void riscv_iommu_realize(DeviceState *dev, Error **errp)/* Memory region for downstream access, if specified. */ if (s->target_mr) { s->target_as =g_new0 (AddressSpace,1 ); -address_space_init (s->target_as, s->target_mr, +address_space_init (s->target_as,NULL , s->target_mr,"riscv-iommu-downstream" ); }else {/* Fallback to global system memory. */
@@ -2436,7 +2437,7 @@ static void riscv_iommu_realize(DeviceState *dev, Error **errp)/* Memory region for untranslated MRIF/MSI writes */ memory_region_init_io (&s->trap_mr,OBJECT (dev), &riscv_iommu_trap_ops, s,"riscv-iommu-trap" , ~0ULL ); -address_space_init (&s->trap_as, &s->trap_mr,"riscv-iommu-trap-as" ); +address_space_init (&s->trap_as,NULL , &s->trap_mr,"riscv-iommu-trap-as" );if (s->cap &RISCV_IOMMU_CAP_HPM ) { s->hpm_timer =
hw/s390x/s390-pci-bus.c +1 -1
@@ -628,7 +628,7 @@ static S390PCIIOMMU *s390_pci_get_iommu(S390pciState *s, PCIBus *bus,PCI_SLOT (devfn), PCI_FUNC(devfn));memory_region_init (&iommu->mr,OBJECT (iommu), mr_name,UINT64_MAX ); -address_space_init (&iommu->as, &iommu->mr, as_name); +address_space_init (&iommu->as,NULL , &iommu->mr, as_name); iommu->iotlb =g_hash_table_new_full (g_int64_hash, g_int64_equal,NULL , g_free); table->iommu[PCI_SLOT (devfn)] = iommu;
hw/scsi/lsi53c895a.c +2 -1
@@ -2356,7 +2356,8 @@ static void lsi_scsi_realize(PCIDevice *dev, Error **errp) s->ram_io.disable_reentrancy_guard = true; s->mmio_io.disable_reentrancy_guard = true; -address_space_init (&s->pci_io_as,pci_address_space_io (dev),"lsi-pci-io" ); +address_space_init (&s->pci_io_as,NULL ,pci_address_space_io (dev), +"lsi-pci-io" );qdev_init_gpio_out (d, &s->ext_irq,1 );pci_register_bar (dev,0 ,PCI_BASE_ADDRESS_SPACE_IO , &s->io_io);
hw/sd/allwinner-sdhost.c +1 -1
@@ -832,7 +832,7 @@ static void allwinner_sdhost_realize(DeviceState *dev, Error **errp)return ; } -address_space_init (&s->dma_as, s->dma_mr,"sdhost-dma" ); +address_space_init (&s->dma_as,NULL , s->dma_mr,"sdhost-dma" ); }static void allwinner_sdhost_reset (DeviceState *dev)
hw/sd/sdhci.c +1 -1
@@ -1594,7 +1594,7 @@ static void sdhci_sysbus_realize(DeviceState *dev, Error **errp)if (s->dma_mr) { s->dma_as = &s->sysbus_dma_as; -address_space_init (s->dma_as, s->dma_mr,"sdhci-dma" ); +address_space_init (s->dma_as,NULL , s->dma_mr,"sdhci-dma" ); }else {/* use system_memory() if property "dma" not set */ s->dma_as = &address_space_memory;
hw/sparc/sun4m_iommu.c +2 -1
@@ -359,7 +359,8 @@ static void iommu_init(Object *obj)memory_region_init_iommu (&s->iommu,sizeof (s->iommu),TYPE_SUN4M_IOMMU_MEMORY_REGION ,OBJECT (dev),"iommu-sun4m" ,UINT64_MAX ); -address_space_init (&s->iommu_as,MEMORY_REGION (&s->iommu),"iommu-as" ); +address_space_init (&s->iommu_as,NULL ,MEMORY_REGION (&s->iommu), +"iommu-as" );sysbus_init_irq (dev, &s->irq);
hw/sparc64/sun4u_iommu.c +2 -1
@@ -298,7 +298,8 @@ static void iommu_init(Object *obj)memory_region_init_iommu (&s->iommu,sizeof (s->iommu),TYPE_SUN4U_IOMMU_MEMORY_REGION ,OBJECT (s),"iommu-sun4u" ,UINT64_MAX ); -address_space_init (&s->iommu_as,MEMORY_REGION (&s->iommu),"iommu-as" ); +address_space_init (&s->iommu_as,NULL ,MEMORY_REGION (&s->iommu), +"iommu-as" );memory_region_init_io (&s->iomem, obj, &iommu_mem_ops, s,"iommu" ,IOMMU_NREGS *sizeof (uint64_t ));
hw/ssi/aspeed_smc.c +2 -2
@@ -1191,9 +1191,9 @@ static void aspeed_smc_dma_setup(AspeedSMCState *s, Error **errp)return ; } -address_space_init (&s->flash_as, &s->mmio_flash, +address_space_init (&s->flash_as,NULL , &s->mmio_flash,TYPE_ASPEED_SMC ".dma-flash" ); -address_space_init (&s->dram_as, s->dram_mr, +address_space_init (&s->dram_as,NULL , s->dram_mr,TYPE_ASPEED_SMC ".dma-dram" ); }
hw/usb/hcd-dwc2.c +1 -1
@@ -1351,7 +1351,7 @@ static void dwc2_realize(DeviceState *dev, Error **errp) obj =object_property_get_link (OBJECT (dev),"dma-mr" , &error_abort); s->dma_mr =MEMORY_REGION (obj); -address_space_init (&s->dma_as, s->dma_mr,"dwc2" ); +address_space_init (&s->dma_as,NULL , s->dma_mr,"dwc2" );usb_bus_new (&s->bus,sizeof (s->bus), &dwc2_bus_ops, dev); usb_register_port(&s->bus, &s->uport, s, 0, &dwc2_port_ops,
hw/usb/hcd-xhci-sysbus.c +1 -1
@@ -45,7 +45,7 @@ static void xhci_sysbus_realize(DeviceState *dev, Error **errp) s->xhci.numintrs);if (s->xhci.dma_mr) { s->xhci.as =g_malloc0 (sizeof (AddressSpace)); -address_space_init (s->xhci.as, s->xhci.dma_mr,NULL ); +address_space_init (s->xhci.as,NULL , s->xhci.dma_mr,NULL ); }else { s->xhci.as = &address_space_memory; }
hw/virtio/virtio-iommu.c +1 -1
@@ -430,7 +430,7 @@ static AddressSpace *virtio_iommu_find_add_as(PCIBus *bus, void *opaque,trace_virtio_iommu_init_iommu_mr (name);memory_region_init (&sdev->root,OBJECT (s), name,UINT64_MAX ); -address_space_init (&sdev->as, &sdev->root,TYPE_VIRTIO_IOMMU ); +address_space_init (&sdev->as,NULL , &sdev->root,TYPE_VIRTIO_IOMMU );add_prop_resv_regions (sdev);/*
hw/virtio/virtio-pci.c +2 -2
@@ -2062,7 +2062,7 @@ static void virtio_pci_device_plugged(DeviceState *d, Error **errp)if (modern_pio) {memory_region_init (&proxy->io_bar,OBJECT (proxy),"virtio-pci-io" ,0x4 ); -address_space_init (&proxy->modern_cfg_io_as, &proxy->io_bar, +address_space_init (&proxy->modern_cfg_io_as,NULL , &proxy->io_bar,"virtio-pci-cfg-io-as" ); pci_register_bar(&proxy->pci_dev, proxy->modern_io_bar_idx,
@@ -2199,7 +2199,7 @@ static void virtio_pci_realize(PCIDevice *pci_dev, Error **errp)/* PCI BAR regions must be powers of 2 */ pow2ceil(proxy->notify.offset + proxy->notify.size)); -address_space_init (&proxy->modern_cfg_mem_as, &proxy->modern_bar, +address_space_init (&proxy->modern_cfg_mem_as,NULL , &proxy->modern_bar,"virtio-pci-cfg-mem-as" );if (proxy->disable_legacy ==ON_OFF_AUTO_AUTO ) {
system/memory.c +50 -17
142 lines not on this page · raw message
system/physmem.c +9 -4
@@ -782,7 +782,7 @@ void cpu_address_space_init(CPUState *cpu, int asidx,assert (mr); as_name =g_strdup_printf ("%s-%d" , prefix, cpu->cpu_index); -address_space_init (as, mr, as_name); +address_space_init (as,NULL , mr, as_name);g_free (as_name);/* Target code should have set num_ases before calling us */
@@ -812,6 +812,11 @@ void cpu_address_space_init(CPUState *cpu, int asidx, } } +static void address_space_free (struct rcu_head *head) +{ +g_free (container_of (head, AddressSpace, rcu)); +} +void cpu_address_space_destroy (CPUState *cpu,int asidx) {CPUAddressSpace *cpuas;
@@ -827,7 +832,7 @@ void cpu_address_space_destroy(CPUState *cpu, int asidx) }address_space_destroy (cpuas->as); -g_free_rcu (cpuas->as, rcu); +call_rcu1 (&cpuas->as->rcu, address_space_free);if (asidx ==0 ) {/* reset the convenience alias for address space 0 */
@@ -2812,12 +2817,12 @@ static void memory_map_init(void) system_memory =g_malloc (sizeof (*system_memory));memory_region_init (system_memory,NULL ,"system" ,UINT64_MAX ); -address_space_init (&address_space_memory, system_memory,"memory" ); +address_space_init (&address_space_memory,NULL , system_memory,"memory" ); system_io =g_malloc (sizeof (*system_io));memory_region_init_io (system_io,NULL , &unassigned_io_ops,NULL ,"io" ,65536 ); -address_space_init (&address_space_io, system_io,"I/O" ); +address_space_init (&address_space_io,NULL , system_io,"I/O" ); }MemoryRegion *get_system_memory (void )
target/i386/kvm/kvm.c +1 -1
@@ -2725,7 +2725,7 @@ static void register_smram_listener(Notifier *n, void *unused)memory_region_set_enabled (smram, true); } -address_space_init (&smram_address_space, &smram_as_root,"KVM-SMRAM" ); +address_space_init (&smram_address_space,NULL , &smram_as_root,"KVM-SMRAM" );kvm_memory_listener_register (kvm_state, &smram_listener, &smram_address_space,1 ,"kvm-smram" ); }
target/mips/cpu.c +1 -1
@@ -505,7 +505,7 @@ static void mips_cpu_initfn(Object *obj)if (mcc->cpu_def->lcsr_cpucfg2 & (1 <<CPUCFG2_LCSRP )) {memory_region_init_io (&env->iocsr.mr,OBJECT (cpu),NULL , env,"iocsr" ,UINT64_MAX ); -address_space_init (&env->iocsr.as, +address_space_init (&env->iocsr.as,NULL , &env->iocsr.mr,"IOCSR" ); }#endif
target/xtensa/cpu.c +1 -1
@@ -272,7 +272,7 @@ static void xtensa_cpu_initfn(Object *obj) env->system_er =g_malloc (sizeof (*env->system_er));memory_region_init_io (env->system_er, obj,NULL , env,"er" ,UINT64_C (0x100000000 )); -address_space_init (env->address_space_er, env->system_er,"ER" ); +address_space_init (env->address_space_er,NULL , env->system_er,"ER" ); cpu->clock =qdev_init_clock_in (DEVICE (obj),"clk-in" ,NULL , cpu,0 );clock_set_hz (cpu->clock, env->config->clock_freq_khz *1000 );
Signature · 1 line
2.51.0
system/memory.c void address_space_destroy(AddressSpace *as) · line 3274
Quoted 6 lines · Akihiko Odaki
system/memory.c +6
-0+char *address_space_get_path (AddressSpace *as) +{ +char *path; + +if (!as->qom) { +return as->name;
You need to strdup this to allow the caller to free the result.
r~
Quoted 6 lines
system/memory.c +5
-0+ } + + path =object_get_canonical_path (OBJECT (as)); + +return path ? path :g_strdup ("orphan" ); }
PATCH 2/35 hw/core/loader: Use address_space_get_path()
In reply to Akihiko OdakiThe name field of an QOM-ified AddressSpace represents a property name, which may not be sufficient to identify the AddressSpace. Use address_space_get_path() instead.
--- hw/core/loader.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
hw/core/loader.c +4 -4
@@ -1258,10 +1258,10 @@ static bool roms_overlap(Rom *last_rom, Rom *this_rom) last_rom->addr + last_rom->romsize > this_rom->addr; } -static const char *rom_as_name (Rom *rom) +static const char *rom_as_path (Rom *rom) { -const char *name = rom->as ? rom->as->name :NULL ; -return name ?:"anonymous" ; +const char *path = rom->as ?address_space_get_path (rom->as) :NULL ; +return path ?:"anonymous" ; }static void rom_print_overlap_error_header (void )
@@ -1280,7 +1280,7 @@ static void rom_print_one_overlap_error(Rom *last_rom, Rom *rom) {error_printf ("\nThe following two regions overlap (in the %s address space):\n" , -rom_as_name (rom)); +rom_as_path (rom));error_printf (" %s (addresses 0x" HWADDR_FMT_plx" - 0x" HWADDR_FMT_plx")\n" , last_rom->name, last_rom->addr, last_rom->addr + last_rom->romsize);
Signature · 1 line
2.51.0
Re: [PATCH 02/35] hw/core/loader: Use address_space_get_path()
Quoted 15 lines · Akihiko Odaki
The name field of an QOM-ified AddressSpace represents a property name, which may not be sufficient to identify the AddressSpace. Use
address_space_get_path()instead.Signed-off-by Akihiko Odaki <[email protected]>--- hw/core/loader.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)hw/core/loader.c +0
-0@@ -1258,10 +1258,10 @@ static bool roms_overlap(Rom *last_rom, Rom *this_rom) last_rom->addr + last_rom->romsize > this_rom->addr;
hw/core/loader.c static bool roms_overlap(Rom *last_rom, Rom *this_rom) · line 1265
Quoted 10 lines
hw/core/loader.c +3
-3} -static const char *rom_as_name (Rom *rom) +static const char *rom_as_path (Rom *rom) { -const char *name = rom->as ? rom->as->name :NULL ; -return name ?:"anonymous" ; +const char *path = rom->as ?address_space_get_path (rom->as) :NULL ; +return path ?:"anonymous" ; }
You're not freeing the result of address_space_get_path.
r~
Quoted 12 lines
hw/core/loader.c +1
-1static void rom_print_overlap_error_header (void )@@ -1280,7 +1280,7 @@ static void rom_print_one_overlap_error(Rom *last_rom, Rom *rom) {error_printf ("\nThe following two regions overlap (in the %s address space):\n" , -rom_as_name (rom)); +rom_as_path (rom));error_printf (" %s (addresses 0x" HWADDR_FMT_plx" - 0x" HWADDR_FMT_plx")\n" , last_rom->name, last_rom->addr, last_rom->addr + last_rom->romsize);
Re: [PATCH 02/35] hw/core/loader: Use address_space_get_path()
Quoted 19 lines · Richard Henderson
Quoted 18 lines · Akihiko Odaki
The name field of an QOM-ified AddressSpace represents a property name, which may not be sufficient to identify the AddressSpace. Use
address_space_get_path()instead.Signed-off-by Akihiko Odaki <[email protected]>---
hw/core/loader.c| 8 ++++----1 file changed, 4 insertions(+), 4 deletions(-)hw/core/loader.c +1
-1@@ -1258,10 +1258,10 @@ static bool roms_overlap(Rom *last_rom, Rom *this_rom) last_rom->addr + last_rom->romsize > this_rom->addr; } -static const char *rom_as_name (Rom *rom) +static const char *rom_as_path (Rom *rom)
Quoted 8 lines
hw/core/loader.c static bool roms_overlap(Rom *last_rom, Rom *this_rom) · line 1265
Quoted 6 lines
hw/core/loader.c +2
-2{ - const char *name = rom->as ? rom->as->name : NULL; - return name ?: "anonymous"; + const char *path = rom->as ? address_space_get_path(rom->as) : NULL; + return path ?: "anonymous"; }You're not freeing the result of
address_space_get_path.
In addition, I think the result of address_space_get_path cannot be null, so,
if (rom->as) {
return address_space_get_path(rom->as);
}
return g_strdup("anonymous");r~
PATCH 3/35 vfio: Use address_space_get_path()
In reply to Akihiko OdakiThe name field of an QOM-ified AddressSpace represents a property name, which may not be sufficient to identify the AddressSpace. Use address_space_get_path() instead.
--- hw/vfio/listener.c | 8 ++++++-- hw/virtio/vhost-vdpa.c | 4 +++- 2 files changed, 9 insertions(+), 3 deletions(-)
hw/vfio/listener.c +6 -2
@@ -137,9 +137,11 @@ static void vfio_iommu_map_notify(IOMMUNotifier *n, IOMMUTLBEntry *iotlb) iova, iova + iotlb->addr_mask);if (iotlb->target_as != &address_space_memory) { + g_autofree char *path = address_space_get_path(iotlb->target_as); +error_setg (&local_err,"Wrong target AS \"%s\", only system memory is allowed" , - iotlb->target_as->name ? iotlb->target_as->name :"none" ); + path);if (migration_is_running ()) {migration_file_set_error (-EINVAL , local_err); }else {
@@ -1060,9 +1062,11 @@ static void vfio_iommu_map_dirty_notify(IOMMUNotifier *n, IOMMUTLBEntry *iotlb)trace_vfio_iommu_map_dirty_notify (iova, iova + iotlb->addr_mask);if (iotlb->target_as != &address_space_memory) { + g_autofree char *path = address_space_get_path(iotlb->target_as); +error_setg (&local_err,"Wrong target AS \"%s\", only system memory is allowed" , - iotlb->target_as->name ? iotlb->target_as->name :"none" ); + path); goto out; }
hw/virtio/vhost-vdpa.c +3 -1
@@ -213,8 +213,10 @@ static void vhost_vdpa_iommu_map_notify(IOMMUNotifier *n, IOMMUTLBEntry *iotlb)hwaddr xlat;if (iotlb->target_as != &address_space_memory) { + g_autofree char *path = address_space_get_path(iotlb->target_as); +error_report ("Wrong target AS \"%s\", only system memory is allowed" , - iotlb->target_as->name ? iotlb->target_as->name :"none" ); + path);return ; }RCU_READ_LOCK_GUARD ();
Signature · 1 line
2.51.0
Re: [PATCH 03/35] vfio: Use address_space_get_path()
Quoted 5 lines · Akihiko Odaki
The name field of an QOM-ified AddressSpace represents a property name, which may not be sufficient to identify the AddressSpace. Use
address_space_get_path()instead.Signed-off-by Akihiko Odaki <[email protected]>
Thanks,
C.
Quoted 52 lines
--- hw/vfio/listener.c | 8 ++++++-- hw/virtio/vhost-vdpa.c | 4 +++- 2 files changed, 9 insertions(+), 3 deletions(-)hw/vfio/listener.c +6
-2@@ -137,9 +137,11 @@ static void vfio_iommu_map_notify(IOMMUNotifier *n, IOMMUTLBEntry *iotlb) iova, iova + iotlb->addr_mask);if (iotlb->target_as != &address_space_memory) { + g_autofree char *path = address_space_get_path(iotlb->target_as); +error_setg (&local_err,"Wrong target AS \"%s\", only system memory is allowed" , - iotlb->target_as->name ? iotlb->target_as->name :"none" ); + path);if (migration_is_running ()) {migration_file_set_error (-EINVAL , local_err); }else {@@ -1060,9 +1062,11 @@ static void vfio_iommu_map_dirty_notify(IOMMUNotifier *n, IOMMUTLBEntry *iotlb)trace_vfio_iommu_map_dirty_notify (iova, iova + iotlb->addr_mask);if (iotlb->target_as != &address_space_memory) { + g_autofree char *path = address_space_get_path(iotlb->target_as); +error_setg (&local_err,"Wrong target AS \"%s\", only system memory is allowed" , - iotlb->target_as->name ? iotlb->target_as->name :"none" ); + path); goto out; }hw/virtio/vhost-vdpa.c +3
-1@@ -213,8 +213,10 @@ static void vhost_vdpa_iommu_map_notify(IOMMUNotifier *n, IOMMUTLBEntry *iotlb)hwaddr xlat;if (iotlb->target_as != &address_space_memory) { + g_autofree char *path = address_space_get_path(iotlb->target_as); +error_report ("Wrong target AS \"%s\", only system memory is allowed" , - iotlb->target_as->name ? iotlb->target_as->name :"none" ); + path);return ; }RCU_READ_LOCK_GUARD ();
PATCH 4/35 hw/alpha: QOM-ify AddressSpace
In reply to Akihiko OdakiMake AddressSpaces QOM objects to ensure that they are destroyed when their owners are finalized and also to get a unique path for debugging output.
--- hw/alpha/typhoon.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
hw/alpha/typhoon.c +2 -2
@@ -900,8 +900,8 @@ PCIBus *typhoon_init(MemoryRegion *ram, qemu_irq *p_isa_irq,memory_region_init_iommu (&s->pchip.iommu,sizeof (s->pchip.iommu),TYPE_TYPHOON_IOMMU_MEMORY_REGION ,OBJECT (s),"iommu-typhoon" ,UINT64_MAX ); -address_space_init (&s->pchip.iommu_as,NULL ,MEMORY_REGION (&s->pchip.iommu), -"pchip0-pci" ); +address_space_init (&s->pchip.iommu_as,OBJECT (s), +MEMORY_REGION (&s->pchip.iommu),"pchip0-pci" );pci_setup_iommu (b, &typhoon_iommu_ops, s);/* Pchip0 PCI special/interrupt acknowledge, 0x801.F800.0000, 64MB. */
Signature · 1 line
2.51.0
Re: [PATCH 04/35] hw/alpha: QOM-ify AddressSpace
Quoted 8 lines · Akihiko Odaki
Make AddressSpaces QOM objects to ensure that they are destroyed when their owners are finalized and also to get a unique path for debugging output.
Signed-off-by Akihiko Odaki <[email protected]>--- hw/alpha/typhoon.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
r~
Quoted 17 lines
hw/alpha/typhoon.c +2
-2@@ -900,8 +900,8 @@ PCIBus *typhoon_init(MemoryRegion *ram, qemu_irq *p_isa_irq,memory_region_init_iommu (&s->pchip.iommu,sizeof (s->pchip.iommu),TYPE_TYPHOON_IOMMU_MEMORY_REGION ,OBJECT (s),"iommu-typhoon" ,UINT64_MAX ); -address_space_init (&s->pchip.iommu_as,NULL ,MEMORY_REGION (&s->pchip.iommu), -"pchip0-pci" ); +address_space_init (&s->pchip.iommu_as,OBJECT (s), +MEMORY_REGION (&s->pchip.iommu),"pchip0-pci" );pci_setup_iommu (b, &typhoon_iommu_ops, s);/* Pchip0 PCI special/interrupt acknowledge, 0x801.F800.0000, 64MB. */
PATCH 5/35 hw/arm: QOM-ify AddressSpace
In reply to Akihiko OdakiMake AddressSpaces QOM objects to ensure that they are destroyed when their owners are finalized and also to get a unique path for debugging output.
The name arguments were used to distinguish AddresSpaces in debugging output, but they will represent property names after QOM-ification and debugging output will show QOM paths. So change them to make them more concise and also avoid conflicts with other properties.
--- hw/arm/armv7m.c | 2 +- hw/arm/aspeed_ast27x0.c | 2 +- hw/arm/smmu-common.c | 5 +++-- 3 files changed, 5 insertions(+), 4 deletions(-)
hw/arm/armv7m.c +1 -1
@@ -117,7 +117,7 @@ static void bitband_realize(DeviceState *dev, Error **errp)return ; } -address_space_init (&s->source_as,NULL , s->source_memory,"bitband-source" ); +address_space_init (&s->source_as,OBJECT (s), s->source_memory,"as" ); }/* Board init. */
hw/arm/aspeed_ast27x0.c +1 -1
@@ -387,7 +387,7 @@ static bool aspeed_soc_ast2700_dram_init(DeviceState *dev, Error **errp)memory_region_init (&s->dram_container,OBJECT (s),"ram-container" , ram_size);memory_region_add_subregion (&s->dram_container,0 , s->dram_mr); -address_space_init (&s->dram_as,NULL , s->dram_mr,"dram" ); +address_space_init (&s->dram_as,OBJECT (s), s->dram_mr,"dram-as" );/* * Add a memory region beyond the RAM region to emulate
hw/arm/smmu-common.c +3 -2
@@ -863,6 +863,7 @@ static AddressSpace *smmu_find_add_as(PCIBus *bus, void *opaque, int devfn) sdev = sbus->pbdev[devfn];if (!sdev) {char *name =g_strdup_printf ("%s-%d-%d" , s->mrtypename, devfn, index++); + g_autofree char *as_name = g_strconcat(name, "-as", NULL); sdev = sbus->pbdev[devfn] =g_new0 (SMMUDevice,1 );
@@ -873,8 +874,8 @@ static AddressSpace *smmu_find_add_as(PCIBus *bus, void *opaque, int devfn)memory_region_init_iommu (&sdev->iommu,sizeof (sdev->iommu), s->mrtypename,OBJECT (s), name,UINT64_MAX ); -address_space_init (&sdev->as,NULL , -MEMORY_REGION (&sdev->iommu), name); +address_space_init (&sdev->as,OBJECT (s), +MEMORY_REGION (&sdev->iommu), as_name);trace_smmu_add_mr (name);g_free (name); }
Signature · 1 line
2.51.0
Re: [PATCH 05/35] hw/arm: QOM-ify AddressSpace
Quoted 9 lines · Akihiko Odaki
Make AddressSpaces QOM objects to ensure that they are destroyed when their owners are finalized and also to get a unique path for debugging output.
The name arguments were used to distinguish AddresSpaces in debugging output, but they will represent property names after QOM-ification and debugging output will show QOM paths. So change them to make them more concise and also avoid conflicts with other properties.
Quoted 6 lines
Signed-off-by Akihiko Odaki<[email protected]>--- hw/arm/armv7m.c | 2 +- hw/arm/aspeed_ast27x0.c | 2 +- hw/arm/smmu-common.c | 5 +++-- 3 files changed, 5 insertions(+), 4 deletions(-)
r~
PATCH 6/35 hw/display: QOM-ify AddressSpace
In reply to Akihiko OdakiMake AddressSpaces QOM objects to ensure that they are destroyed when their owners are finalized and also to get a unique path for debugging output.
The name arguments were used to distinguish AddresSpaces in debugging output, but they will represent property names after QOM-ification and debugging output will show QOM paths. So change them to make them more concise and also avoid conflicts with other properties.
--- hw/display/artist.c | 2 +- hw/display/bcm2835_fb.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
hw/display/artist.c +1 -1
@@ -1391,7 +1391,7 @@ static void artist_realizefn(DeviceState *dev, Error **errp) }memory_region_init (&s->mem_as_root,OBJECT (dev),"artist" , ~0ull ); -address_space_init (&s->as,NULL , &s->mem_as_root,"artist" ); +address_space_init (&s->as,OBJECT (s), &s->mem_as_root,"as" );artist_create_buffer (s,"cmap" , &offset,ARTIST_BUFFER_CMAP ,2048 ,4 ); artist_create_buffer(s, "ap", &offset, ARTIST_BUFFER_AP,
hw/display/bcm2835_fb.c +1 -1
@@ -421,7 +421,7 @@ static void bcm2835_fb_realize(DeviceState *dev, Error **errp) s->initial_config.base = s->vcram_base +BCM2835_FB_OFFSET ; s->dma_mr =MEMORY_REGION (obj); -address_space_init (&s->dma_as,NULL , s->dma_mr,TYPE_BCM2835_FB "-memory" ); +address_space_init (&s->dma_as,OBJECT (s), s->dma_mr,"as" );bcm2835_fb_reset (dev);
Signature · 1 line
2.51.0
PATCH 7/35 hw/dma: QOM-ify AddressSpace
In reply to Akihiko OdakiMake AddressSpaces QOM objects to ensure that they are destroyed when their owners are finalized and also to get a unique path for debugging output.
The name arguments were used to distinguish AddresSpaces in debugging output, but they will represent property names after QOM-ification and debugging output will show QOM paths. So change them to make them more concise and also avoid conflicts with other properties.
--- hw/dma/bcm2835_dma.c | 2 +- hw/dma/pl080.c | 3 +-- hw/dma/pl330.c | 3 +-- hw/dma/rc4030.c | 5 ++--- hw/dma/xilinx_axidma.c | 4 ++-- hw/dma/xlnx-zdma.c | 2 +- hw/dma/xlnx_csu_dma.c | 2 +- 7 files changed, 9 insertions(+), 12 deletions(-)
hw/dma/bcm2835_dma.c +1 -1
@@ -380,7 +380,7 @@ static void bcm2835_dma_realize(DeviceState *dev, Error **errp) obj =object_property_get_link (OBJECT (dev),"dma-mr" , &error_abort); s->dma_mr =MEMORY_REGION (obj); -address_space_init (&s->dma_as,NULL , s->dma_mr,TYPE_BCM2835_DMA "-memory" ); +address_space_init (&s->dma_as,OBJECT (s), s->dma_mr,"as" );bcm2835_dma_reset (dev); }
hw/dma/pl080.c +1 -2
@@ -398,8 +398,7 @@ static void pl080_realize(DeviceState *dev, Error **errp)return ; } -address_space_init (&s->downstream_as,NULL , s->downstream, -"pl080-downstream" ); +address_space_init (&s->downstream_as,OBJECT (s), s->downstream,"as" ); }static void pl081_init (Object *obj)
hw/dma/pl330.c +1 -2
@@ -1569,8 +1569,7 @@ static void pl330_realize(DeviceState *dev, Error **errp) s->mem_as = &address_space_memory; }else { s->mem_as =g_new0 (AddressSpace,1 ); -address_space_init (s->mem_as,NULL , s->mem_mr, -memory_region_name (s->mem_mr)); +address_space_init (s->mem_as,OBJECT (s), s->mem_mr,"as" ); } s->timer =timer_new_ns (QEMU_CLOCK_VIRTUAL , pl330_exec_cycle_timer, s);
hw/dma/rc4030.c +2 -3
@@ -688,8 +688,7 @@ static void rc4030_realize(DeviceState *dev, Error **errp)memory_region_init_iommu (&s->dma_mr,sizeof (s->dma_mr),TYPE_RC4030_IOMMU_MEMORY_REGION , o,"rc4030.dma" ,4 * GiB); -address_space_init (&s->dma_as,NULL ,MEMORY_REGION (&s->dma_mr), -"rc4030-dma" ); +address_space_init (&s->dma_as, o,MEMORY_REGION (&s->dma_mr),"as" ); }static void rc4030_unrealize (DeviceState *dev)
@@ -698,7 +697,7 @@ static void rc4030_unrealize(DeviceState *dev)timer_free (s->periodic_timer); -address_space_destroy (&s->dma_as); +object_unparent (OBJECT (&s->dma_as));object_unparent (OBJECT (&s->dma_mr)); }
hw/dma/xilinx_axidma.c +2 -2
@@ -588,8 +588,8 @@ static void xilinx_axidma_realize(DeviceState *dev, Error **errp)ptimer_transaction_commit (st->ptimer); } -address_space_init (&s->as,NULL , - s->dma_mr ? s->dma_mr :get_system_memory (),"dma" ); +address_space_init (&s->as,OBJECT (s), + s->dma_mr ? s->dma_mr :get_system_memory (),"as" ); }static void xilinx_axidma_init (Object *obj)
hw/dma/xlnx-zdma.c +1 -1
@@ -769,7 +769,7 @@ static void zdma_realize(DeviceState *dev, Error **errp)error_setg (errp,TYPE_XLNX_ZDMA " 'dma' link not set" );return ; } -address_space_init (&s->dma_as,NULL , s->dma_mr,"zdma-dma" ); +address_space_init (&s->dma_as,OBJECT (s), s->dma_mr,"as" );for (i =0 ; i <ARRAY_SIZE (zdma_regs_info); ++i) {RegisterInfo *r = &s->regs_info[zdma_regs_info[i].addr /4 ];
hw/dma/xlnx_csu_dma.c +1 -1
@@ -653,7 +653,7 @@ static void xlnx_csu_dma_realize(DeviceState *dev, Error **errp)error_setg (errp,TYPE_XLNX_CSU_DMA " 'dma' link not set" );return ; } -address_space_init (&s->dma_as,NULL , s->dma_mr,"csu-dma" ); +address_space_init (&s->dma_as,OBJECT (s), s->dma_mr,"as" ); reg_array = register_init_block32(dev, xlnx_csu_dma_regs_info[!!s->is_dst],
Signature · 1 line
2.51.0
PATCH 8/35 hw/fsi: QOM-ify AddressSpace
In reply to Akihiko OdakiMake AddressSpaces QOM objects to ensure that they are destroyed when their owners are finalized and also to get a unique path for debugging output.
The name arguments were used to distinguish AddresSpaces in debugging output, but they will represent property names after QOM-ification and debugging output will show QOM paths. So change them to make them more concise and also avoid conflicts with other properties.
--- hw/fsi/aspeed_apb2opb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/fsi/aspeed_apb2opb.c +1 -1
@@ -349,7 +349,7 @@ static void fsi_opb_init(Object *o)OPBus *opb =OP_BUS (o);memory_region_init (&opb->mr,0 ,TYPE_FSI_OPB ,UINT32_MAX ); -address_space_init (&opb->as,NULL , &opb->mr,TYPE_FSI_OPB ); +address_space_init (&opb->as,OBJECT (opb), &opb->mr,"as" ); }static const TypeInfo opb_info = {
Signature · 1 line
2.51.0
PATCH 9/35 hw/i2c: QOM-ify AddressSpace
In reply to Akihiko OdakiMake AddressSpaces QOM objects to ensure that they are destroyed when their owners are finalized and also to get a unique path for debugging output.
The name arguments were used to distinguish AddresSpaces in debugging output, but they will represent property names after QOM-ification and debugging output will show QOM paths. So change them to make them more concise and also avoid conflicts with other properties.
--- hw/i2c/aspeed_i2c.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
hw/i2c/aspeed_i2c.c +1 -2
@@ -1253,8 +1253,7 @@ static void aspeed_i2c_realize(DeviceState *dev, Error **errp)return ; } -address_space_init (&s->dram_as,NULL , s->dram_mr, -TYPE_ASPEED_I2C "-dma-dram" ); +address_space_init (&s->dram_as,OBJECT (s), s->dram_mr,"as" ); } }
Signature · 1 line
2.51.0
PATCH 10/35 hw/i386: QOM-ify AddressSpace
In reply to Akihiko OdakiMake AddressSpaces QOM objects to ensure that they are destroyed when their owners are finalized and also to get a unique path for debugging output.
The name arguments were used to distinguish AddresSpaces in debugging output, but they will represent property names after QOM-ification and debugging output will show QOM paths. So change them to make them more concise and also avoid conflicts with other properties.
--- hw/i386/amd_iommu.c | 5 +++-- hw/i386/intel_iommu.c | 6 ++++-- 2 files changed, 7 insertions(+), 4 deletions(-)
hw/i386/amd_iommu.c +3 -2
@@ -1494,7 +1494,7 @@ static AddressSpace *amdvi_host_dma_iommu(PCIBus *bus, void *opaque, int devfn)/* set up AMD-Vi region */ if (!iommu_as[devfn]) { -snprintf (name,sizeof (name),"amd_iommu_devfn_%d" , devfn); +snprintf (name,sizeof (name),"as-%d" , devfn); iommu_as[devfn] =g_new0 (AMDVIAddressSpace,1 ); iommu_as[devfn]->bus_num = (uint8_t )bus_num;
@@ -1522,7 +1522,8 @@ static AddressSpace *amdvi_host_dma_iommu(PCIBus *bus, void *opaque, int devfn) "amd_iommu", UINT64_MAX);memory_region_init (&amdvi_dev_as->root,OBJECT (s),"amdvi_root" ,UINT64_MAX ); -address_space_init (&amdvi_dev_as->as,NULL , &amdvi_dev_as->root, name); +address_space_init (&amdvi_dev_as->as,OBJECT (s), &amdvi_dev_as->root, + name);memory_region_add_subregion_overlap (&amdvi_dev_as->root,0 ,MEMORY_REGION (&amdvi_dev_as->iommu),0 );
hw/i386/intel_iommu.c +4 -2
@@ -4221,6 +4221,7 @@ VTDAddressSpace *vtd_find_add_as(IntelIOMMUState *s, PCIBus *bus,vtd_iommu_unlock (s);if (!vtd_dev_as) { + g_autofree char *as_name = NULL;struct vtd_as_key *new_key;/* Slow path */
@@ -4263,8 +4264,9 @@ VTDAddressSpace *vtd_find_add_as(IntelIOMMUState *s, PCIBus *bus, vtd_dev_as->iova_tree =iova_tree_new ();memory_region_init (&vtd_dev_as->root,OBJECT (s), name,UINT64_MAX ); -address_space_init (&vtd_dev_as->as,NULL , &vtd_dev_as->root, -"vtd-root" ); + as_name =g_strconcat (name,"-as" ,NULL ); +address_space_init (&vtd_dev_as->as,OBJECT (s), &vtd_dev_as->root, + as_name);/* * Build the DMAR-disabled container with aliases to the
Signature · 1 line
2.51.0
Re: [PATCH 10/35] hw/i386: QOM-ify AddressSpace
Hi Akihiko,
Why do we change the naming scheme in amd-vi?
Did you have any issue with the old one?
If we decide not to stick to the old one, maybe splitting the slot and function would be convenient.
Thanks
Quoted 68 lines · Akihiko Odaki
Make AddressSpaces QOM objects to ensure that they are destroyed when their owners are finalized and also to get a unique path for debugging output.
The name arguments were used to distinguish AddresSpaces in debugging output, but they will represent property names after QOM-ification and debugging output will show QOM paths. So change them to make them more concise and also avoid conflicts with other properties.
---
hw/i386/amd_iommu.c | 5 +++--
hw/i386/intel_iommu.c | 6 ++++--2 files changed, 7 insertions(+), 4 deletions(-)hw/i386/amd_iommu.c +3
-2@@ -1494,7 +1494,7 @@ static AddressSpace *amdvi_host_dma_iommu(PCIBus *bus, void *opaque, int devfn) /* set up AMD-Vi region */ if (!iommu_as[devfn]) { - snprintf(name, sizeof(name), "amd_iommu_devfn_%d", devfn); + snprintf(name, sizeof(name), "as-%d", devfn); iommu_as[devfn] = g_new0(AMDVIAddressSpace, 1); iommu_as[devfn]->bus_num = (uint8_t)bus_num;@@ -1522,7 +1522,8 @@ static AddressSpace *amdvi_host_dma_iommu(PCIBus *bus, void *opaque, int devfn) "amd_iommu", UINT64_MAX); memory_region_init(&amdvi_dev_as->root, OBJECT(s), "amdvi_root", UINT64_MAX); - address_space_init(&amdvi_dev_as->as, NULL, &amdvi_dev_as->root, name); + address_space_init(&amdvi_dev_as->as, OBJECT(s), &amdvi_dev_as->root, + name); memory_region_add_subregion_overlap(&amdvi_dev_as->root, 0, MEMORY_REGION(&amdvi_dev_as->iommu), 0);hw/i386/intel_iommu.c +4
-2@@ -4221,6 +4221,7 @@ VTDAddressSpace *vtd_find_add_as(IntelIOMMUState *s, PCIBus *bus, vtd_iommu_unlock(s); if (!vtd_dev_as) { + g_autofree char *as_name = NULL; struct vtd_as_key *new_key; /* Slow path */@@ -4263,8 +4264,9 @@ VTDAddressSpace *vtd_find_add_as(IntelIOMMUState *s, PCIBus *bus, vtd_dev_as->iova_tree = iova_tree_new(); memory_region_init(&vtd_dev_as->root, OBJECT(s), name, UINT64_MAX); - address_space_init(&vtd_dev_as->as, NULL, &vtd_dev_as->root, - "vtd-root"); + as_name = g_strconcat(name, "-as", NULL); + address_space_init(&vtd_dev_as->as, OBJECT(s), &vtd_dev_as->root, + as_name); /** Build the DMAR-disabled container with aliases to the Signature · 2 lines
-- 2.51.0
Re: [PATCH 10/35] hw/i386: QOM-ify AddressSpace
Quoted 4 lines · CLEMENT MATHIEU--DRIF
Hi Akihiko,
Why do we change the naming scheme in amd-vi?
Did you have any issue with the old one?
QOM-ifying AddressSpaces moves the responsibility to create distinct identifiers for debug outputs from the callers of address_space_init() to AddressSpaces. QOM-ified AddressSpaces can create unique, unambigous identifiers by inspecting the QOM hierarchy and cover all devices, not just amd-iommu.
Quoted 2 lines
If we decide not to stick to the old one, maybe splitting the slot and function would be convenient.
Strictly speaking such a change is an out-of-scope of this patch, but it won't hurt to have it. I'll make the change with the next version.
Regards,
Akihiko Odaki
PATCH 11/35 hw/intc: QOM-ify AddressSpace
In reply to Akihiko OdakiMake AddressSpaces QOM objects to ensure that they are destroyed when their owners are finalized and also to get a unique path for debugging output.
The name arguments were used to distinguish AddresSpaces in debugging output, but they will represent property names after QOM-ification and debugging output will show QOM paths. So change them to make them more concise and also avoid conflicts with other properties.
--- hw/intc/arm_gicv3_common.c | 3 +-- hw/intc/pnv_xive.c | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-)
hw/intc/arm_gicv3_common.c +1 -2
@@ -429,8 +429,7 @@ static void arm_gicv3_common_realize(DeviceState *dev, Error **errp) }if (s->lpi_enable) { -address_space_init (&s->dma_as,NULL , s->dma, -"gicv3-its-sysmem" ); +address_space_init (&s->dma_as,OBJECT (s), s->dma,"as" ); } s->cpu =g_new0 (GICv3CPUState, s->num_cpu);
hw/intc/pnv_xive.c +2 -2
@@ -2012,10 +2012,10 @@ static void pnv_xive_realize(DeviceState *dev, Error **errp)memory_region_init (&xive->ipi_mmio,OBJECT (xive),"xive-vc-ipi" ,PNV9_XIVE_VC_SIZE ); -address_space_init (&xive->ipi_as,NULL , &xive->ipi_mmio,"xive-vc-ipi" ); +address_space_init (&xive->ipi_as,OBJECT (xive), &xive->ipi_mmio,"ipi-as" );memory_region_init (&xive->end_mmio,OBJECT (xive),"xive-vc-end" ,PNV9_XIVE_VC_SIZE ); -address_space_init (&xive->end_as,NULL , &xive->end_mmio,"xive-vc-end" ); +address_space_init (&xive->end_as,OBJECT (xive), &xive->end_mmio,"end-as" );/* * The MMIO windows exposing the IPI ESBs and the END ESBs in the
Signature · 1 line
2.51.0
PATCH 12/35 hw/loongarch: QOM-ify AddressSpace
In reply to Akihiko OdakiMake AddressSpaces QOM objects to ensure that they are destroyed when their owners are finalized and also to get a unique path for debugging output.
The name arguments were used to distinguish AddresSpaces in debugging output, but they will represent property names after QOM-ification and debugging output will show QOM paths. So change them to make them more concise and also avoid conflicts with other properties.
--- hw/loongarch/virt.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
hw/loongarch/virt.c +2 -1
@@ -699,7 +699,8 @@ static void virt_init(MachineState *machine)/* Create IOCSR space */ memory_region_init_io (&lvms->system_iocsr,OBJECT (machine),NULL , machine,"iocsr" ,UINT64_MAX ); -address_space_init (&lvms->as_iocsr,NULL , &lvms->system_iocsr,"IOCSR" ); +address_space_init (&lvms->as_iocsr,OBJECT (machine), &lvms->system_iocsr, +"iocsr-as" );memory_region_init_io (&lvms->iocsr_mem,OBJECT (machine), &virt_iocsr_misc_ops, machine,"iocsr_misc" ,0x428 );
Signature · 1 line
2.51.0
PATCH 13/35 hw/mem: QOM-ify AddressSpace
In reply to Akihiko OdakiMake AddressSpaces QOM objects to ensure that they are destroyed when their owners are finalized and also to get a unique path for debugging output.
The name arguments were used to distinguish AddresSpaces in debugging output, but they will represent property names after QOM-ification and debugging output will show QOM paths. So change them to make them more concise and also avoid conflicts with other properties.
--- hw/mem/cxl_type3.c | 44 ++++++++++++-------------------------------- hw/mem/memory-device.c | 4 ++-- 2 files changed, 14 insertions(+), 34 deletions(-)
hw/mem/cxl_type3.c +12 -32
@@ -727,8 +727,6 @@ static void cxl_destroy_dc_regions(CXLType3Dev *ct3d)static bool cxl_setup_memory (CXLType3Dev *ct3d,Error **errp) { -DeviceState *ds =DEVICE (ct3d); -if (!ct3d->hostmem && !ct3d->hostvmem && !ct3d->hostpmem && !ct3d->dc.num_regions) {error_setg (errp,"at least one memdev property must be set" );
@@ -750,7 +748,6 @@ static bool cxl_setup_memory(CXLType3Dev *ct3d, Error **errp)if (ct3d->hostvmem) {MemoryRegion *vmr; -char *v_name; vmr =host_memory_backend_get_memory (ct3d->hostvmem);if (!vmr) {
@@ -765,20 +762,14 @@ static bool cxl_setup_memory(CXLType3Dev *ct3d, Error **errp)memory_region_set_nonvolatile (vmr, false);memory_region_set_enabled (vmr, true);host_memory_backend_set_mapped (ct3d->hostvmem, true); -if (ds->id) { - v_name =g_strdup_printf ("cxl-type3-dpa-vmem-space:%s" , ds->id); - }else { - v_name =g_strdup ("cxl-type3-dpa-vmem-space" ); - } -address_space_init (&ct3d->hostvmem_as,NULL , vmr, v_name); +address_space_init (&ct3d->hostvmem_as,OBJECT (ct3d), vmr, +"volatile-as" ); ct3d->cxl_dstate.vmem_size =memory_region_size (vmr); ct3d->cxl_dstate.static_mem_size +=memory_region_size (vmr); -g_free (v_name); }if (ct3d->hostpmem) {MemoryRegion *pmr; -char *p_name; pmr =host_memory_backend_get_memory (ct3d->hostpmem);if (!pmr) {
@@ -793,21 +784,15 @@ static bool cxl_setup_memory(CXLType3Dev *ct3d, Error **errp)memory_region_set_nonvolatile (pmr, true);memory_region_set_enabled (pmr, true);host_memory_backend_set_mapped (ct3d->hostpmem, true); -if (ds->id) { - p_name =g_strdup_printf ("cxl-type3-dpa-pmem-space:%s" , ds->id); - }else { - p_name =g_strdup ("cxl-type3-dpa-pmem-space" ); - } -address_space_init (&ct3d->hostpmem_as,NULL , pmr, p_name); +address_space_init (&ct3d->hostpmem_as,OBJECT (ct3d), pmr, +"persistent-as" ); ct3d->cxl_dstate.pmem_size =memory_region_size (pmr); ct3d->cxl_dstate.static_mem_size +=memory_region_size (pmr); -g_free (p_name); } ct3d->dc.total_capacity =0 ;if (ct3d->dc.num_regions >0 ) {MemoryRegion *dc_mr; -char *dc_name;if (!ct3d->dc.host_dc) {error_setg (errp,"dynamic capacity must have a backing device" );
@@ -832,13 +817,8 @@ static bool cxl_setup_memory(CXLType3Dev *ct3d, Error **errp)memory_region_set_nonvolatile (dc_mr, false);memory_region_set_enabled (dc_mr, true);host_memory_backend_set_mapped (ct3d->dc.host_dc, true); -if (ds->id) { - dc_name =g_strdup_printf ("cxl-dcd-dpa-dc-space:%s" , ds->id); - }else { - dc_name =g_strdup ("cxl-dcd-dpa-dc-space" ); - } -address_space_init (&ct3d->dc.host_dc_as,NULL , dc_mr, dc_name); -g_free (dc_name); +address_space_init (&ct3d->dc.host_dc_as,OBJECT (ct3d), dc_mr, +"volatile-dc-as" );if (!cxl_create_dc_regions (ct3d, errp)) {error_append_hint (errp,"setup DC regions failed" );
@@ -974,13 +954,13 @@ err_free_special_ops:g_free (regs->special_ops);if (ct3d->dc.host_dc) {cxl_destroy_dc_regions (ct3d); -address_space_destroy (&ct3d->dc.host_dc_as); +object_unparent (OBJECT (&ct3d->dc.host_dc_as)); }if (ct3d->hostpmem) { -address_space_destroy (&ct3d->hostpmem_as); +object_unparent (OBJECT (&ct3d->hostpmem_as)); }if (ct3d->hostvmem) { -address_space_destroy (&ct3d->hostvmem_as); +object_unparent (OBJECT (&ct3d->hostvmem_as)); } }
@@ -997,13 +977,13 @@ static void ct3_exit(PCIDevice *pci_dev)cxl_destroy_cci (&ct3d->cci);if (ct3d->dc.host_dc) {cxl_destroy_dc_regions (ct3d); -address_space_destroy (&ct3d->dc.host_dc_as); +object_unparent (OBJECT (&ct3d->dc.host_dc_as)); }if (ct3d->hostpmem) { -address_space_destroy (&ct3d->hostpmem_as); +object_unparent (OBJECT (&ct3d->hostpmem_as)); }if (ct3d->hostvmem) { -address_space_destroy (&ct3d->hostvmem_as); +object_unparent (OBJECT (&ct3d->hostvmem_as)); } }
hw/mem/memory-device.c +2 -2
@@ -535,8 +535,8 @@ void machine_memory_devices_init(MachineState *ms, hwaddr base, uint64_t size)memory_region_init (&ms->device_memory->mr,OBJECT (ms),"device-memory" , size); -address_space_init (&ms->device_memory->as,NULL , &ms->device_memory->mr, -"device-memory" ); +address_space_init (&ms->device_memory->as,OBJECT (ms), + &ms->device_memory->mr,"device-memory-as" );memory_region_add_subregion (get_system_memory (), ms->device_memory->base, &ms->device_memory->mr);
Signature · 1 line
2.51.0
Re: [PATCH 13/35] hw/mem: QOM-ify AddressSpace
Quoted 10 lines · On Wed, 17 Sep 2025 21:56:25 +0900 Akihiko Odaki…
Make AddressSpaces QOM objects to ensure that they are destroyed when their owners are finalized and also to get a unique path for debugging output.
The name arguments were used to distinguish AddresSpaces in debugging output, but they will represent property names after QOM-ification and debugging output will show QOM paths. So change them to make them more concise and also avoid conflicts with other properties.
Signed-off-by Akihiko Odaki <[email protected]>
Assuming the fundamental change makes sense (which I haven't looked into in enough depth!), this CXL bit looks fine to me.
Quoted 1 line
PATCH 14/35 hw/misc: QOM-ify AddressSpace
In reply to Akihiko OdakiMake AddressSpaces QOM objects to ensure that they are destroyed when their owners are finalized and also to get a unique path for debugging output.
The name arguments were used to distinguish AddresSpaces in debugging output, but they will represent property names after QOM-ification and debugging output will show QOM paths. So change them to make them more concise and also avoid conflicts with other properties.
--- hw/misc/aspeed_hace.c | 2 +- hw/misc/auxbus.c | 2 +- hw/misc/bcm2835_mbox.c | 3 +-- hw/misc/bcm2835_property.c | 3 +-- hw/misc/max78000_gcr.c | 2 +- hw/misc/tz-mpc.c | 6 ++---- hw/misc/tz-msc.c | 2 +- hw/misc/tz-ppc.c | 5 ++++- 8 files changed, 12 insertions(+), 13 deletions(-)
hw/misc/aspeed_hace.c +1 -1
@@ -603,7 +603,7 @@ static void aspeed_hace_realize(DeviceState *dev, Error **errp)return ; } -address_space_init (&s->dram_as,NULL , s->dram_mr,"dram" ); +address_space_init (&s->dram_as,OBJECT (s), s->dram_mr,"as" );sysbus_init_mmio (sbd, &s->iomem); }
hw/misc/auxbus.c +1 -1
@@ -74,7 +74,7 @@ AUXBus *aux_bus_init(DeviceState *parent, const char *name)/* Memory related. */ bus->aux_io =g_malloc (sizeof (*bus->aux_io));memory_region_init (bus->aux_io,OBJECT (bus),"aux-io" ,1 * MiB); -address_space_init (&bus->aux_addr_space,NULL , bus->aux_io,"aux-io" ); +address_space_init (&bus->aux_addr_space,OBJECT (bus), bus->aux_io,"as" );return bus; }
hw/misc/bcm2835_mbox.c +1 -2
@@ -310,8 +310,7 @@ static void bcm2835_mbox_realize(DeviceState *dev, Error **errp) obj =object_property_get_link (OBJECT (dev),"mbox-mr" , &error_abort); s->mbox_mr =MEMORY_REGION (obj); -address_space_init (&s->mbox_as,NULL , s->mbox_mr, -TYPE_BCM2835_MBOX "-memory" ); +address_space_init (&s->mbox_as,OBJECT (s), s->mbox_mr,"as" );bcm2835_mbox_reset (dev); }
hw/misc/bcm2835_property.c +1 -2
@@ -540,8 +540,7 @@ static void bcm2835_property_realize(DeviceState *dev, Error **errp) obj =object_property_get_link (OBJECT (dev),"dma-mr" , &error_abort); s->dma_mr =MEMORY_REGION (obj); -address_space_init (&s->dma_as,NULL , s->dma_mr, -TYPE_BCM2835_PROPERTY "-memory" ); +address_space_init (&s->dma_as,OBJECT (s), s->dma_mr,"as" ); obj =object_property_get_link (OBJECT (dev),"otp" , &error_abort); s->otp =BCM2835_OTP (obj);
hw/misc/max78000_gcr.c +1 -1
@@ -320,7 +320,7 @@ static void max78000_gcr_realize(DeviceState *dev, Error **errp) {Max78000GcrState *s =MAX78000_GCR (dev); -address_space_init (&s->sram_as,NULL , s->sram,"sram" ); +address_space_init (&s->sram_as,OBJECT (s), s->sram,"as" ); }static void max78000_gcr_class_init (ObjectClass *klass,const void *data)
hw/misc/tz-mpc.c +2 -4
@@ -550,10 +550,8 @@ static void tz_mpc_realize(DeviceState *dev, Error **errp)memory_region_init_io (&s->blocked_io, obj, &tz_mpc_mem_blocked_ops, s,"tz-mpc-blocked-io" , size); -address_space_init (&s->downstream_as,NULL , s->downstream, -"tz-mpc-downstream" ); -address_space_init (&s->blocked_io_as,NULL , &s->blocked_io, -"tz-mpc-blocked-io" ); +address_space_init (&s->downstream_as, obj, s->downstream,"downstream-as" ); +address_space_init (&s->blocked_io_as, obj, &s->blocked_io,"blocked-io-as" ); s->blk_lut =g_new0 (uint32_t, s->blk_max); }
hw/misc/tz-msc.c +1 -1
@@ -260,7 +260,7 @@ static void tz_msc_realize(DeviceState *dev, Error **errp) } size =memory_region_size (s->downstream); -address_space_init (&s->downstream_as,NULL , s->downstream, name); +address_space_init (&s->downstream_as, obj, s->downstream,"as" );memory_region_init_io (&s->upstream, obj, &tz_msc_ops, s, name, size);sysbus_init_mmio (sbd, &s->upstream); }
hw/misc/tz-ppc.c +4 -1
@@ -257,6 +257,7 @@ static void tz_ppc_realize(DeviceState *dev, Error **errp)for (i =0 ; i <= max_port; i++) {TZPPCPort *port = &s->port[i];char *name; + g_autofree char *as_name = NULL;uint64_t size;if (!port->downstream) {
@@ -274,9 +275,11 @@ static void tz_ppc_realize(DeviceState *dev, Error **errp) } name =g_strdup_printf ("tz-ppc-port[%d]" , i); + as_name =g_strconcat (name,"-as" ,NULL ); port->ppc = s; -address_space_init (&port->downstream_as,NULL , port->downstream, name); +address_space_init (&port->downstream_as, obj, port->downstream, + as_name); size =memory_region_size (port->downstream); memory_region_init_io(&port->upstream, obj, &tz_ppc_ops,
Signature · 1 line
2.51.0
PATCH 15/35 hw/net: QOM-ify AddressSpace
In reply to Akihiko OdakiMake AddressSpaces QOM objects to ensure that they are destroyed when their owners are finalized and also to get a unique path for debugging output.
The name arguments were used to distinguish AddresSpaces in debugging output, but they will represent property names after QOM-ification and debugging output will show QOM paths. So change them to make them more concise and also avoid conflicts with other properties.
--- hw/net/allwinner-sun8i-emac.c | 2 +- hw/net/cadence_gem.c | 4 ++-- hw/net/dp8393x.c | 2 +- hw/net/msf2-emac.c | 2 +- hw/net/mv88w8618_eth.c | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-)
hw/net/allwinner-sun8i-emac.c +1 -1
@@ -820,7 +820,7 @@ static void allwinner_sun8i_emac_realize(DeviceState *dev, Error **errp)return ; } -address_space_init (&s->dma_as,NULL , s->dma_mr,"emac-dma" ); +address_space_init (&s->dma_as,OBJECT (s), s->dma_mr,"as" );qemu_macaddr_default_if_unset (&s->conf.macaddr); s->nic = qemu_new_nic(&net_allwinner_sun8i_emac_info, &s->conf,
hw/net/cadence_gem.c +2 -2
@@ -1734,8 +1734,8 @@ static void gem_realize(DeviceState *dev, Error **errp)CadenceGEMState *s =CADENCE_GEM (dev);int i; -address_space_init (&s->dma_as,NULL , - s->dma_mr ? s->dma_mr :get_system_memory (),"dma" ); +address_space_init (&s->dma_as,OBJECT (s), + s->dma_mr ? s->dma_mr :get_system_memory (),"as" );if (s->num_priority_queues ==0 || s->num_priority_queues >MAX_PRIORITY_QUEUES ) {
hw/net/dp8393x.c +1 -1
@@ -908,7 +908,7 @@ static void dp8393x_realize(DeviceState *dev, Error **errp) {dp8393xState *s =DP8393X (dev); -address_space_init (&s->as,NULL , s->dma_mr,"dp8393x" ); +address_space_init (&s->as,OBJECT (s), s->dma_mr,"as" );memory_region_init_io (&s->mmio,OBJECT (dev), &dp8393x_ops, s,"dp8393x-regs" ,SONIC_REG_COUNT << s->it_shift);
hw/net/msf2-emac.c +1 -1
@@ -526,7 +526,7 @@ static void msf2_emac_realize(DeviceState *dev, Error **errp)return ; } -address_space_init (&s->dma_as,NULL , s->dma_mr,"emac-ahb" ); +address_space_init (&s->dma_as,OBJECT (s), s->dma_mr,"as" );qemu_macaddr_default_if_unset (&s->conf.macaddr); s->nic = qemu_new_nic(&net_msf2_emac_info, &s->conf,
hw/net/mv88w8618_eth.c +1 -1
@@ -348,7 +348,7 @@ static void mv88w8618_eth_realize(DeviceState *dev, Error **errp)return ; } -address_space_init (&s->dma_as,NULL , s->dma_mr,"emac-dma" ); +address_space_init (&s->dma_as,OBJECT (s), s->dma_mr,"as" ); s->nic =qemu_new_nic (&net_mv88w8618_info, &s->conf,object_get_typename (OBJECT (dev)), dev->id, &dev->mem_reentrancy_guard, s);
Signature · 1 line
2.51.0
PATCH 16/35 hw/nubus: QOM-ify AddressSpace
In reply to Akihiko OdakiMake AddressSpaces QOM objects to ensure that they are destroyed when their owners are finalized and also to get a unique path for debugging output.
The name arguments were used to distinguish AddresSpaces in debugging output, but they will represent property names after QOM-ification and debugging output will show QOM paths. So change them to make them more concise and also avoid conflicts with other properties.
--- hw/nubus/nubus-bus.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
hw/nubus/nubus-bus.c +2 -2
@@ -82,7 +82,7 @@ static void nubus_unrealize(BusState *bus) {NubusBus *nubus =NUBUS_BUS (bus); -address_space_destroy (&nubus->nubus_as); +object_unparent (OBJECT (&nubus->nubus_as)); }static void nubus_realize (BusState *bus,Error **errp)
@@ -94,7 +94,7 @@ static void nubus_realize(BusState *bus, Error **errp)return ; } -address_space_init (&nubus->nubus_as,NULL , &nubus->nubus_mr,"nubus" ); +address_space_init (&nubus->nubus_as,OBJECT (nubus), &nubus->nubus_mr,"as" ); }static void nubus_init (Object *obj)
Signature · 1 line
2.51.0
PATCH 17/35 hw/pci: QOM-ify AddressSpace
In reply to Akihiko OdakiMake AddressSpaces QOM objects to ensure that they are destroyed when their owners are finalized and also to get a unique path for debugging output.
The name arguments were used to distinguish AddresSpaces in debugging output, but they will represent property names after QOM-ification and debugging output will show QOM paths. So change them to make them more concise and also avoid conflicts with other properties.
--- hw/pci/pci.c | 6 +++--- hw/pci/pci_bridge.c | 11 +++++------ 2 files changed, 8 insertions(+), 9 deletions(-)
hw/pci/pci.c +3 -3
@@ -1188,7 +1188,7 @@ static void do_pci_unregister_device(PCIDevice *pci_dev)if (xen_mode ==XEN_EMULATE ) {xen_evtchn_remove_pci_device (pci_dev); } -address_space_destroy (&pci_dev->bus_master_as); +object_unparent (OBJECT (&pci_dev->bus_master_as)); }/* Extract PCIReqIDCache into BDF format */
@@ -1359,8 +1359,8 @@ static PCIDevice *do_pci_register_device(PCIDevice *pci_dev,memory_region_init (&pci_dev->bus_master_container_region,OBJECT (pci_dev),"bus master container" ,UINT64_MAX ); -address_space_init (&pci_dev->bus_master_as,NULL , - &pci_dev->bus_master_container_region, pci_dev->name); +address_space_init (&pci_dev->bus_master_as,OBJECT (pci_dev), + &pci_dev->bus_master_container_region,"bus-master-as" ); pci_dev->bus_master_as.max_bounce_buffer_size = pci_dev->max_bounce_buffer_size;
hw/pci/pci_bridge.c +5 -6
@@ -388,13 +388,12 @@ void pci_bridge_initfn(PCIDevice *dev, const char *typename) sec_bus->map_irq = br->map_irq ? br->map_irq : pci_swizzle_map_irq_fn; sec_bus->address_space_mem = &br->address_space_mem;memory_region_init (&br->address_space_mem,OBJECT (br),"pci_bridge_pci" ,UINT64_MAX ); -address_space_init (&br->as_mem,NULL , &br->address_space_mem, -"pci_bridge_pci_mem" ); +address_space_init (&br->as_mem,OBJECT (br), &br->address_space_mem, +"mem-as" ); sec_bus->address_space_io = &br->address_space_io;memory_region_init (&br->address_space_io,OBJECT (br),"pci_bridge_io" ,4 * GiB); -address_space_init (&br->as_io,NULL , &br->address_space_io, -"pci_bridge_pci_io" ); +address_space_init (&br->as_io,OBJECT (br), &br->address_space_io,"io-as" );pci_bridge_region_update (br, true);QLIST_INIT (&sec_bus->child);QLIST_INSERT_HEAD (&parent->child, sec_bus, sibling);
@@ -411,8 +410,8 @@ void pci_bridge_exitfn(PCIDevice *pci_dev)PCIBridge *s =PCI_BRIDGE (pci_dev);assert (QLIST_EMPTY (&s->sec_bus.child));QLIST_REMOVE (&s->sec_bus, sibling); -address_space_destroy (&s->as_mem); -address_space_destroy (&s->as_io); +object_unparent (OBJECT (&s->as_mem)); +object_unparent (OBJECT (&s->as_io));pci_bridge_region_del (s, &s->windows);pci_bridge_region_cleanup (s, &s->windows);/* object_unparent() is called automatically during device deletion */
Signature · 1 line
2.51.0
PATCH 18/35 hw/pci-host: QOM-ify AddressSpace
In reply to Akihiko OdakiMake AddressSpaces QOM objects to ensure that they are destroyed when their owners are finalized and also to get a unique path for debugging output.
The name arguments were used to distinguish AddresSpaces in debugging output, but they will represent property names after QOM-ification and debugging output will show QOM paths. So change them to make them more concise and also avoid conflicts with other properties.
--- hw/pci-host/astro.c | 3 +-- hw/pci-host/designware.c | 5 ++--- hw/pci-host/dino.c | 4 ++-- hw/pci-host/gt64120.c | 2 +- hw/pci-host/pnv_phb3.c | 4 ++-- hw/pci-host/pnv_phb4.c | 4 ++-- hw/pci-host/ppc440_pcix.c | 2 +- hw/pci-host/ppce500.c | 2 +- hw/pci-host/raven.c | 2 +- 9 files changed, 13 insertions(+), 15 deletions(-)
hw/pci-host/astro.c +1 -2
@@ -835,8 +835,7 @@ static void astro_realize(DeviceState *obj, Error **errp)memory_region_init_iommu (&s->iommu,sizeof (s->iommu),TYPE_ASTRO_IOMMU_MEMORY_REGION ,OBJECT (s),"iommu-astro" ,UINT64_MAX ); -address_space_init (&s->iommu_as,NULL ,MEMORY_REGION (&s->iommu), -"bm-pci" ); +address_space_init (&s->iommu_as,OBJECT (s),MEMORY_REGION (&s->iommu),"as" );/* Create Elroys (PCI host bus chips). */ for (i =0 ; i <ELROY_NUM ; i++) {
hw/pci-host/designware.c +2 -3
@@ -706,9 +706,8 @@ static void designware_pcie_host_realize(DeviceState *dev, Error **errp) UINT64_MAX);memory_region_add_subregion (&s->pci.address_space_root,0x0 , &s->pci.memory); -address_space_init (&s->pci.address_space,NULL , - &s->pci.address_space_root, -"pcie-bus-address-space" ); +address_space_init (&s->pci.address_space,OBJECT (s), + &s->pci.address_space_root,"as" );pci_setup_iommu (pci->bus, &designware_iommu_ops, s);qdev_realize (DEVICE (&s->root),BUS (pci->bus), &error_fatal);
hw/pci-host/dino.c +2 -2
@@ -434,14 +434,14 @@ static void dino_pcihost_realize(DeviceState *dev, Error **errp)memory_region_add_subregion (&s->bm,0xfff00000 , &s->bm_cpu_alias); -address_space_init (&s->bm_as,NULL , &s->bm,"pci-bm" ); +address_space_init (&s->bm_as,OBJECT (s), &s->bm,"as" ); }static void dino_pcihost_unrealize (DeviceState *dev) {DinoState *s =DINO_PCI_HOST_BRIDGE (dev); -address_space_destroy (&s->bm_as); +object_unparent (OBJECT (&s->bm_as)); }static void dino_pcihost_init (Object *obj)
hw/pci-host/gt64120.c +1 -1
@@ -1198,7 +1198,7 @@ static void gt64120_realize(DeviceState *dev, Error **errp)memory_region_init_io (&s->ISD_mem,OBJECT (dev), &isd_mem_ops, s,"gt64120-isd" ,0x1000 );memory_region_init (&s->pci0_mem,OBJECT (dev),"pci0-mem" ,4 * GiB); -address_space_init (&s->pci0_mem_as,NULL , &s->pci0_mem,"pci0-mem" ); +address_space_init (&s->pci0_mem_as,OBJECT (s), &s->pci0_mem,"as" ); phb->bus = pci_root_bus_new(dev, "pci", &s->pci0_mem, get_system_io(),
hw/pci-host/pnv_phb3.c +2 -2
@@ -956,8 +956,8 @@ static AddressSpace *pnv_phb3_dma_iommu(PCIBus *bus, void *opaque, int devfn)memory_region_init_iommu (&ds->dma_mr,sizeof (ds->dma_mr),TYPE_PNV_PHB3_IOMMU_MEMORY_REGION ,OBJECT (phb),"phb3_iommu" ,UINT64_MAX ); -address_space_init (&ds->dma_as,NULL ,MEMORY_REGION (&ds->dma_mr), -"phb3_iommu" ); +address_space_init (&ds->dma_as,OBJECT (phb),MEMORY_REGION (&ds->dma_mr), +"as" );memory_region_init_io (&ds->msi32_mr,OBJECT (phb), &pnv_phb3_msi_ops, ds,"msi32" ,0x10000 ); memory_region_init_io(&ds->msi64_mr, OBJECT(phb), &pnv_phb3_msi_ops,
hw/pci-host/pnv_phb4.c +2 -2
@@ -1469,8 +1469,8 @@ static AddressSpace *pnv_phb4_dma_iommu(PCIBus *bus, void *opaque, int devfn)memory_region_init_iommu (&ds->dma_mr,sizeof (ds->dma_mr),TYPE_PNV_PHB4_IOMMU_MEMORY_REGION ,OBJECT (phb), name,UINT64_MAX ); -address_space_init (&ds->dma_as,NULL ,MEMORY_REGION (&ds->dma_mr), - name); +address_space_init (&ds->dma_as,OBJECT (phb),MEMORY_REGION (&ds->dma_mr), +"as" );memory_region_init_io (&ds->msi32_mr,OBJECT (phb), &pnv_phb4_msi_ops, ds,"msi32" ,0x10000 ); memory_region_init_io(&ds->msi64_mr, OBJECT(phb), &pnv_phb4_msi_ops,
hw/pci-host/ppc440_pcix.c +1 -1
@@ -502,7 +502,7 @@ static void ppc440_pcix_realize(DeviceState *dev, Error **errp)memory_region_init (&s->bm,OBJECT (s),"bm-ppc440-pcix" ,UINT64_MAX );memory_region_add_subregion (&s->bm,0x0 , &s->busmem); -address_space_init (&s->bm_as,NULL , &s->bm,"pci-bm" ); +address_space_init (&s->bm_as,OBJECT (s), &s->bm,"as" );pci_setup_iommu (h->bus, &ppc440_iommu_ops, s);memory_region_init (&s->container,OBJECT (s),"pci-container" ,PCI_ALL_SIZE );
hw/pci-host/ppce500.c +1 -1
@@ -470,7 +470,7 @@ static void e500_pcihost_realize(DeviceState *dev, Error **errp)/* Set up PCI view of memory */ memory_region_init (&s->bm,OBJECT (s),"bm-e500" ,UINT64_MAX );memory_region_add_subregion (&s->bm,0x0 , &s->busmem); -address_space_init (&s->bm_as,NULL , &s->bm,"pci-bm" ); +address_space_init (&s->bm_as,OBJECT (s), &s->bm,"as" );pci_setup_iommu (b, &ppce500_iommu_ops, s);pci_create_simple (b,0 ,TYPE_PPC_E500_PCI_BRIDGE );
hw/pci-host/raven.c +1 -1
@@ -214,7 +214,7 @@ static void raven_pcihost_realize(DeviceState *d, Error **errp)memory_region_init_alias (mr, o,"bm-system" ,get_system_memory (),0 ,0x80000000 );memory_region_add_subregion (bm,0x80000000 , mr); -address_space_init (&s->bm_as,NULL , bm,"raven-bm-as" ); +address_space_init (&s->bm_as, o, bm,"as" );pci_setup_iommu (h->bus, &raven_iommu_ops, s); }
Signature · 1 line
2.51.0
PATCH 19/35 hw/ppc: QOM-ify AddressSpace
In reply to Akihiko OdakiMake AddressSpaces QOM objects to ensure that they are destroyed when their owners are finalized and also to get a unique path for debugging output.
The name arguments were used to distinguish AddresSpaces in debugging output, but they will represent property names after QOM-ification and debugging output will show QOM paths. So change them to make them more concise and also avoid conflicts with other properties.
--- hw/ppc/pnv_lpc.c | 2 +- hw/ppc/pnv_xscom.c | 2 +- hw/ppc/spapr_pci.c | 5 ++--- hw/ppc/spapr_vio.c | 2 +- 4 files changed, 5 insertions(+), 6 deletions(-)
hw/ppc/pnv_lpc.c +1 -1
@@ -799,7 +799,7 @@ static void pnv_lpc_realize(DeviceState *dev, Error **errp)/* Create address space and backing MR for the OPB bus */ memory_region_init (&lpc->opb_mr,OBJECT (dev),"lpc-opb" ,0x100000000ull ); -address_space_init (&lpc->opb_as,NULL , &lpc->opb_mr,"lpc-opb" ); +address_space_init (&lpc->opb_as,OBJECT (dev), &lpc->opb_mr,"as" );/* * Create ISA IO, Mem, and FW space regions which are the root of
hw/ppc/pnv_xscom.c +1 -1
@@ -219,7 +219,7 @@ void pnv_xscom_init(PnvChip *chip, uint64_t size, hwaddr addr)memory_region_add_subregion (get_system_memory (), addr, &chip->xscom_mmio);memory_region_init (&chip->xscom,OBJECT (chip), name, size); -address_space_init (&chip->xscom_as,NULL , &chip->xscom, name); +address_space_init (&chip->xscom_as,OBJECT (chip), &chip->xscom,"as" );g_free (name); }
hw/ppc/spapr_pci.c +2 -3
@@ -1759,7 +1759,7 @@ static void spapr_phb_unrealize(DeviceState *dev)* address space. */ address_space_remove_listeners (&sphb->iommu_as); -address_space_destroy (&sphb->iommu_as); +object_unparent (OBJECT (&sphb->iommu_as));qbus_set_hotplug_handler (BUS (phb->bus),NULL );pci_unregister_root_bus (phb->bus);
@@ -1902,8 +1902,7 @@ static void spapr_phb_realize(DeviceState *dev, Error **errp)memory_region_init (&sphb->iommu_root,OBJECT (sphb), namebuf,UINT64_MAX );g_free (namebuf); -address_space_init (&sphb->iommu_as,NULL , &sphb->iommu_root, - sphb->dtbusname); +address_space_init (&sphb->iommu_as,OBJECT (sphb), &sphb->iommu_root,"as" );/* * As MSI/MSIX interrupts trigger by writing at MSI/MSIX vectors,
hw/ppc/spapr_vio.c +1 -1
@@ -529,7 +529,7 @@ static void spapr_vio_busdev_realize(DeviceState *qdev, Error **errp)"iommu-spapr-bypass" ,get_system_memory (), 0, MACHINE(spapr)->ram_size);memory_region_add_subregion_overlap (&dev->mrroot,0 , &dev->mrbypass,1 ); -address_space_init (&dev->as,NULL , &dev->mrroot, qdev->id); +address_space_init (&dev->as,OBJECT (dev), &dev->mrroot,"as" ); dev->tcet =spapr_tce_new_table (qdev, liobn); spapr_tce_table_enable(dev->tcet, SPAPR_TCE_PAGE_SHIFT, 0,
Signature · 1 line
2.51.0
PATCH 20/35 hw/remote: QOM-ify AddressSpace
In reply to Akihiko OdakiMake AddressSpaces QOM objects to ensure that they are destroyed when their owners are finalized and also to get a unique path for debugging output.
The name arguments were used to distinguish AddresSpaces in debugging output, but they will represent property names after QOM-ification and debugging output will show QOM paths. So change them to make them more concise and also avoid conflicts with other properties.
--- hw/remote/iommu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
hw/remote/iommu.c +2 -2
@@ -54,7 +54,7 @@ static AddressSpace *remote_iommu_find_add_as(PCIBus *pci_bus,if (!elem->mr) { elem->mr =MEMORY_REGION (object_new (TYPE_MEMORY_REGION ));memory_region_set_size (elem->mr,UINT64_MAX ); -address_space_init (&elem->as,NULL , elem->mr,NULL ); +address_space_init (&elem->as,OBJECT (iommu), elem->mr,"as" ); }qemu_mutex_unlock (&iommu->lock);
@@ -73,7 +73,7 @@ void remote_iommu_unplug_dev(PCIDevice *pci_dev) elem =container_of (as, RemoteIommuElem, as); -address_space_destroy (&elem->as); +object_unparent (OBJECT (&elem->as));object_unref (elem->mr);
Signature · 1 line
2.51.0
PATCH 21/35 hw/riscv: QOM-ify AddressSpace
In reply to Akihiko OdakiMake AddressSpaces QOM objects to ensure that they are destroyed when their owners are finalized and also to get a unique path for debugging output.
The name arguments were used to distinguish AddresSpaces in debugging output, but they will represent property names after QOM-ification and debugging output will show QOM paths. So change them to make them more concise and also avoid conflicts with other properties.
--- hw/riscv/riscv-iommu.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
hw/riscv/riscv-iommu.c +5 -5
@@ -1221,8 +1221,8 @@ static AddressSpace *riscv_iommu_space(RISCVIOMMUState *s, uint32_t devid)memory_region_init_iommu (&as->iova_mr,sizeof (as->iova_mr),TYPE_RISCV_IOMMU_MEMORY_REGION ,OBJECT (as),"riscv_iommu" ,UINT64_MAX ); -address_space_init (&as->iova_as,NULL ,MEMORY_REGION (&as->iova_mr), - name); +address_space_init (&as->iova_as,OBJECT (s),MEMORY_REGION (&as->iova_mr), +"iova-as" );QLIST_INSERT_HEAD (&s->spaces, as, list);
@@ -2427,8 +2427,8 @@ static void riscv_iommu_realize(DeviceState *dev, Error **errp)/* Memory region for downstream access, if specified. */ if (s->target_mr) { s->target_as =g_new0 (AddressSpace,1 ); -address_space_init (s->target_as,NULL , s->target_mr, -"riscv-iommu-downstream" ); +address_space_init (s->target_as,OBJECT (s), s->target_mr, +"downstream-as" ); }else {/* Fallback to global system memory. */ s->target_as = &address_space_memory;
@@ -2437,7 +2437,7 @@ static void riscv_iommu_realize(DeviceState *dev, Error **errp)/* Memory region for untranslated MRIF/MSI writes */ memory_region_init_io (&s->trap_mr,OBJECT (dev), &riscv_iommu_trap_ops, s,"riscv-iommu-trap" , ~0ULL ); -address_space_init (&s->trap_as,NULL , &s->trap_mr,"riscv-iommu-trap-as" ); +address_space_init (&s->trap_as,OBJECT (s), &s->trap_mr,"trap-as" );if (s->cap &RISCV_IOMMU_CAP_HPM ) { s->hpm_timer =
Signature · 1 line
2.51.0
PATCH 22/35 hw/s390x: QOM-ify AddressSpace
In reply to Akihiko OdakiMake AddressSpaces QOM objects to ensure that they are destroyed when their owners are finalized and also to get a unique path for debugging output.
The name arguments were used to distinguish AddresSpaces in debugging output, but they will represent property names after QOM-ification and debugging output will show QOM paths. So change them to make them more concise and also avoid conflicts with other properties.
--- hw/s390x/s390-pci-bus.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-)
hw/s390x/s390-pci-bus.c +2 -7
@@ -623,18 +623,13 @@ static S390PCIIOMMU *s390_pci_get_iommu(S390pciState *s, PCIBus *bus,pci_bus_num (bus),PCI_SLOT (devfn), PCI_FUNC(devfn)); -char *as_name =g_strdup_printf ("iommu-pci-%02x:%02x.%01x" , -pci_bus_num (bus), -PCI_SLOT (devfn), -PCI_FUNC (devfn));memory_region_init (&iommu->mr,OBJECT (iommu), mr_name,UINT64_MAX ); -address_space_init (&iommu->as,NULL , &iommu->mr, as_name); +address_space_init (&iommu->as,OBJECT (iommu), &iommu->mr,"as" ); iommu->iotlb =g_hash_table_new_full (g_int64_hash, g_int64_equal,NULL , g_free); table->iommu[PCI_SLOT (devfn)] = iommu;g_free (mr_name); -g_free (as_name); }return iommu;
@@ -785,7 +780,7 @@ static void s390_pci_iommu_free(S390pciState *s, PCIBus *bus, int32_t devfn)* Remove the listeners now before destroying the address space. */ address_space_remove_listeners (&iommu->as); -address_space_destroy (&iommu->as); +object_unparent (OBJECT (&iommu->as));object_unparent (OBJECT (&iommu->mr));object_unparent (OBJECT (iommu));object_unref (OBJECT (iommu));
Signature · 1 line
2.51.0
PATCH 23/35 hw/scsi: QOM-ify AddressSpace
In reply to Akihiko OdakiMake AddressSpaces QOM objects to ensure that they are destroyed when their owners are finalized and also to get a unique path for debugging output.
The name arguments were used to distinguish AddresSpaces in debugging output, but they will represent property names after QOM-ification and debugging output will show QOM paths. So change them to make them more concise and also avoid conflicts with other properties.
--- hw/scsi/lsi53c895a.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
hw/scsi/lsi53c895a.c +3 -3
@@ -2356,8 +2356,8 @@ static void lsi_scsi_realize(PCIDevice *dev, Error **errp) s->ram_io.disable_reentrancy_guard = true; s->mmio_io.disable_reentrancy_guard = true; -address_space_init (&s->pci_io_as,NULL ,pci_address_space_io (dev), -"lsi-pci-io" ); +address_space_init (&s->pci_io_as,OBJECT (s),pci_address_space_io (dev), +"io-as" );qdev_init_gpio_out (d, &s->ext_irq,1 );pci_register_bar (dev,0 ,PCI_BASE_ADDRESS_SPACE_IO , &s->io_io);
@@ -2372,7 +2372,7 @@ static void lsi_scsi_exit(PCIDevice *dev) {LSIState *s =LSI53C895A (dev); -address_space_destroy (&s->pci_io_as); +object_unparent (OBJECT (&s->pci_io_as));timer_free (s->scripts_timer); }
Signature · 1 line
2.51.0
PATCH 24/35 hw/sd: QOM-ify AddressSpace
In reply to Akihiko OdakiMake AddressSpaces QOM objects to ensure that they are destroyed when their owners are finalized and also to get a unique path for debugging output.
The name arguments were used to distinguish AddresSpaces in debugging output, but they will represent property names after QOM-ification and debugging output will show QOM paths. So change them to make them more concise and also avoid conflicts with other properties.
--- hw/sd/allwinner-sdhost.c | 2 +- hw/sd/sdhci.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)
hw/sd/allwinner-sdhost.c +1 -1
@@ -832,7 +832,7 @@ static void allwinner_sdhost_realize(DeviceState *dev, Error **errp)return ; } -address_space_init (&s->dma_as,NULL , s->dma_mr,"sdhost-dma" ); +address_space_init (&s->dma_as,OBJECT (s), s->dma_mr,"as" ); }static void allwinner_sdhost_reset (DeviceState *dev)
hw/sd/sdhci.c +2 -2
@@ -1594,7 +1594,7 @@ static void sdhci_sysbus_realize(DeviceState *dev, Error **errp)if (s->dma_mr) { s->dma_as = &s->sysbus_dma_as; -address_space_init (s->dma_as,NULL , s->dma_mr,"sdhci-dma" ); +address_space_init (s->dma_as,OBJECT (s), s->dma_mr,"as" ); }else {/* use system_memory() if property "dma" not set */ s->dma_as = &address_space_memory;
@@ -1612,7 +1612,7 @@ static void sdhci_sysbus_unrealize(DeviceState *dev)sdhci_common_unrealize (s);if (s->dma_mr) { -address_space_destroy (s->dma_as); +object_unparent (OBJECT (s->dma_as)); } }
Signature · 1 line
2.51.0
PATCH 25/35 hw/sparc: QOM-ify AddressSpace
In reply to Akihiko OdakiMake AddressSpaces QOM objects to ensure that they are destroyed when their owners are finalized and also to get a unique path for debugging output.
The name arguments were used to distinguish AddresSpaces in debugging output, but they will represent property names after QOM-ification and debugging output will show QOM paths. So change them to make them more concise and also avoid conflicts with other properties.
--- hw/sparc/sun4m_iommu.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
hw/sparc/sun4m_iommu.c +1 -2
@@ -359,8 +359,7 @@ static void iommu_init(Object *obj)memory_region_init_iommu (&s->iommu,sizeof (s->iommu),TYPE_SUN4M_IOMMU_MEMORY_REGION ,OBJECT (dev),"iommu-sun4m" ,UINT64_MAX ); -address_space_init (&s->iommu_as,NULL ,MEMORY_REGION (&s->iommu), -"iommu-as" ); +address_space_init (&s->iommu_as,OBJECT (s),MEMORY_REGION (&s->iommu),"as" );sysbus_init_irq (dev, &s->irq);
Signature · 1 line
2.51.0
PATCH 26/35 hw/sparc64: QOM-ify AddressSpace
In reply to Akihiko OdakiMake AddressSpaces QOM objects to ensure that they are destroyed when their owners are finalized and also to get a unique path for debugging output.
The name arguments were used to distinguish AddresSpaces in debugging output, but they will represent property names after QOM-ification and debugging output will show QOM paths. So change them to make them more concise and also avoid conflicts with other properties.
--- hw/sparc64/sun4u_iommu.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
hw/sparc64/sun4u_iommu.c +1 -2
@@ -298,8 +298,7 @@ static void iommu_init(Object *obj)memory_region_init_iommu (&s->iommu,sizeof (s->iommu),TYPE_SUN4U_IOMMU_MEMORY_REGION ,OBJECT (s),"iommu-sun4u" ,UINT64_MAX ); -address_space_init (&s->iommu_as,NULL ,MEMORY_REGION (&s->iommu), -"iommu-as" ); +address_space_init (&s->iommu_as, obj,MEMORY_REGION (&s->iommu),"as" );memory_region_init_io (&s->iomem, obj, &iommu_mem_ops, s,"iommu" ,IOMMU_NREGS *sizeof (uint64_t ));
Signature · 1 line
2.51.0
PATCH 27/35 hw/ssi: QOM-ify AddressSpace
In reply to Akihiko OdakiMake AddressSpaces QOM objects to ensure that they are destroyed when their owners are finalized and also to get a unique path for debugging output.
The name arguments were used to distinguish AddresSpaces in debugging output, but they will represent property names after QOM-ification and debugging output will show QOM paths. So change them to make them more concise and also avoid conflicts with other properties.
--- hw/ssi/aspeed_smc.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
hw/ssi/aspeed_smc.c +2 -4
@@ -1191,10 +1191,8 @@ static void aspeed_smc_dma_setup(AspeedSMCState *s, Error **errp)return ; } -address_space_init (&s->flash_as,NULL , &s->mmio_flash, -TYPE_ASPEED_SMC ".dma-flash" ); -address_space_init (&s->dram_as,NULL , s->dram_mr, -TYPE_ASPEED_SMC ".dma-dram" ); +address_space_init (&s->flash_as,OBJECT (s), &s->mmio_flash,"flash-as" ); +address_space_init (&s->dram_as,OBJECT (s), s->dram_mr,"dram-as" ); }static void aspeed_smc_realize (DeviceState *dev,Error **errp)
Signature · 1 line
2.51.0
PATCH 28/35 hw/usb: QOM-ify AddressSpace
In reply to Akihiko OdakiMake AddressSpaces QOM objects to ensure that they are destroyed when their owners are finalized and also to get a unique path for debugging output.
The name arguments were used to distinguish AddresSpaces in debugging output, but they will represent property names after QOM-ification and debugging output will show QOM paths. So change them to make them more concise and also avoid conflicts with other properties.
--- hw/usb/hcd-dwc2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/usb/hcd-dwc2.c +1 -1
@@ -1351,7 +1351,7 @@ static void dwc2_realize(DeviceState *dev, Error **errp) obj =object_property_get_link (OBJECT (dev),"dma-mr" , &error_abort); s->dma_mr =MEMORY_REGION (obj); -address_space_init (&s->dma_as,NULL , s->dma_mr,"dwc2" ); +address_space_init (&s->dma_as,OBJECT (s), s->dma_mr,"as" );usb_bus_new (&s->bus,sizeof (s->bus), &dwc2_bus_ops, dev); usb_register_port(&s->bus, &s->uport, s, 0, &dwc2_port_ops,
Signature · 1 line
2.51.0
PATCH 29/35 hw/usb: QOM-ify AddressSpace
In reply to Akihiko OdakiMake AddressSpaces QOM objects to ensure that they are destroyed when their owners are finalized and also to get a unique path for debugging output.
The name arguments were used to distinguish AddresSpaces in debugging output, but they will represent property names after QOM-ification and debugging output will show QOM paths. So change them to make them more concise and also avoid conflicts with other properties.
--- hw/usb/hcd-xhci-sysbus.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/usb/hcd-xhci-sysbus.c +1 -1
@@ -45,7 +45,7 @@ static void xhci_sysbus_realize(DeviceState *dev, Error **errp) s->xhci.numintrs);if (s->xhci.dma_mr) { s->xhci.as =g_malloc0 (sizeof (AddressSpace)); -address_space_init (s->xhci.as,NULL , s->xhci.dma_mr,NULL ); +address_space_init (s->xhci.as,OBJECT (s), s->xhci.dma_mr,"as" ); }else { s->xhci.as = &address_space_memory; }
Signature · 1 line
2.51.0
PATCH 30/35 hw/virtio: QOM-ify AddressSpace
In reply to Akihiko OdakiMake AddressSpaces QOM objects to ensure that they are destroyed when their owners are finalized and also to get a unique path for debugging output.
The name arguments were used to distinguish AddresSpaces in debugging output, but they will represent property names after QOM-ification and debugging output will show QOM paths. So change them to make them more concise and also avoid conflicts with other properties.
--- hw/virtio/virtio-iommu.c | 3 ++- hw/virtio/virtio-pci.c | 12 ++++++------ 2 files changed, 8 insertions(+), 7 deletions(-)
hw/virtio/virtio-iommu.c +2 -1
@@ -421,6 +421,7 @@ static AddressSpace *virtio_iommu_find_add_as(PCIBus *bus, void *opaque,char *name =g_strdup_printf ("%s-%d-%d" ,TYPE_VIRTIO_IOMMU_MEMORY_REGION , mr_index++, devfn); + g_autofree char *as_name = g_strconcat(name, "-as", NULL); sdev = sbus->pbdev[devfn] =g_new0 (IOMMUDevice,1 ); sdev->viommu = s;
@@ -430,7 +431,7 @@ static AddressSpace *virtio_iommu_find_add_as(PCIBus *bus, void *opaque,trace_virtio_iommu_init_iommu_mr (name);memory_region_init (&sdev->root,OBJECT (s), name,UINT64_MAX ); -address_space_init (&sdev->as,NULL , &sdev->root,TYPE_VIRTIO_IOMMU ); +address_space_init (&sdev->as,OBJECT (s), &sdev->root, as_name);add_prop_resv_regions (sdev);/*
hw/virtio/virtio-pci.c +6 -6
@@ -2062,8 +2062,8 @@ static void virtio_pci_device_plugged(DeviceState *d, Error **errp)if (modern_pio) {memory_region_init (&proxy->io_bar,OBJECT (proxy),"virtio-pci-io" ,0x4 ); -address_space_init (&proxy->modern_cfg_io_as,NULL , &proxy->io_bar, -"virtio-pci-cfg-io-as" ); +address_space_init (&proxy->modern_cfg_io_as,OBJECT (proxy), + &proxy->io_bar,"io-as" );pci_register_bar (&proxy->pci_dev, proxy->modern_io_bar_idx,PCI_BASE_ADDRESS_SPACE_IO , &proxy->io_bar);
@@ -2199,8 +2199,8 @@ static void virtio_pci_realize(PCIDevice *pci_dev, Error **errp)/* PCI BAR regions must be powers of 2 */ pow2ceil(proxy->notify.offset + proxy->notify.size)); -address_space_init (&proxy->modern_cfg_mem_as,NULL , &proxy->modern_bar, -"virtio-pci-cfg-mem-as" ); +address_space_init (&proxy->modern_cfg_mem_as,OBJECT (proxy), + &proxy->modern_bar,"mem-as" );if (proxy->disable_legacy ==ON_OFF_AUTO_AUTO ) { proxy->disable_legacy = pcie_port ?ON_OFF_AUTO_ON :ON_OFF_AUTO_OFF ;
@@ -2296,9 +2296,9 @@ static void virtio_pci_exit(PCIDevice *pci_dev) pci_is_express(pci_dev)) {pcie_aer_exit (pci_dev); } -address_space_destroy (&proxy->modern_cfg_mem_as); +object_unparent (OBJECT (&proxy->modern_cfg_mem_as));if (modern_pio) { -address_space_destroy (&proxy->modern_cfg_io_as); +object_unparent (OBJECT (&proxy->modern_cfg_io_as)); } }
Signature · 1 line
2.51.0
PATCH 31/35 system/physmem: QOM-ify AddressSpace
In reply to Akihiko OdakiMake AddressSpaces QOM objects to ensure that they are destroyed when their owners are finalized and also to get a unique path for debugging output.
The name arguments were used to distinguish AddresSpaces in debugging output, but they will represent property names after QOM-ification and debugging output will show QOM paths. So change them to make them more concise and also avoid conflicts with other properties.
--- include/exec/cpu-common.h | 4 ++-- system/physmem.c | 17 ++++++++--------- 2 files changed, 10 insertions(+), 11 deletions(-)
include/exec/cpu-common.h +2 -2
@@ -105,7 +105,7 @@ size_t qemu_ram_pagesize_largest(void);* cpu_address_space_init: * @cpu: CPU to add this address space to * @asidx: integer index of this address space -* @prefix: prefix to be used as name of address space +* @name: name of address space * @mr: the root memory region of address space * * Add the specified address space to the CPU's cpu_ases list.
@@ -121,7 +121,7 @@ size_t qemu_ram_pagesize_largest(void);* Note that with KVM only one address space is supported. */ void cpu_address_space_init (CPUState *cpu,int asidx, -const char *prefix,MemoryRegion *mr); +const char *name,MemoryRegion *mr);/** * cpu_address_space_destroy: * @cpu: CPU for which address space needs to be destroyed
system/physmem.c +8 -9
@@ -774,16 +774,13 @@ hwaddr memory_region_section_get_iotlb(CPUState *cpu,#endif /* CONFIG_TCG */ void cpu_address_space_init (CPUState *cpu,int asidx, -const char *prefix,MemoryRegion *mr) +const char *name,MemoryRegion *mr) {CPUAddressSpace *newas;AddressSpace *as =g_new0 (AddressSpace,1 ); -char *as_name;assert (mr); - as_name =g_strdup_printf ("%s-%d" , prefix, cpu->cpu_index); -address_space_init (as,NULL , mr, as_name); -g_free (as_name); +address_space_init (as,OBJECT (cpu), mr, name);/* Target code should have set num_ases before calling us */ assert (asidx < cpu->num_ases);
@@ -831,7 +828,7 @@ void cpu_address_space_destroy(CPUState *cpu, int asidx)memory_listener_unregister (&cpuas->tcg_as_listener); } -address_space_destroy (cpuas->as); +object_unparent (OBJECT (cpuas->as));call_rcu1 (&cpuas->as->rcu, address_space_free);if (asidx ==0 ) {
@@ -2814,15 +2811,17 @@ static void tcg_commit(MemoryListener *listener)static void memory_map_init (void ) { - system_memory =g_malloc (sizeof (*system_memory)); +Object *owner =machine_get_container ("unattached" ); + system_memory =g_malloc (sizeof (*system_memory));memory_region_init (system_memory,NULL ,"system" ,UINT64_MAX ); -address_space_init (&address_space_memory,NULL , system_memory,"memory" ); +address_space_init (&address_space_memory, owner, system_memory, +"system-as" ); system_io =g_malloc (sizeof (*system_io));memory_region_init_io (system_io,NULL , &unassigned_io_ops,NULL ,"io" ,65536 ); -address_space_init (&address_space_io,NULL , system_io,"I/O" ); +address_space_init (&address_space_io, owner, system_io,"io-as" ); }MemoryRegion *get_system_memory (void )
Signature · 1 line
2.51.0
PATCH 32/35 target/i386: QOM-ify AddressSpace
In reply to Akihiko OdakiMake AddressSpaces QOM objects to ensure that they are destroyed when their owners are finalized and also to get a unique path for debugging output.
The name arguments were used to distinguish AddresSpaces in debugging output, but they will represent property names after QOM-ification and debugging output will show QOM paths. So change them to make them more concise and also avoid conflicts with other properties.
--- target/i386/kvm/kvm.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
target/i386/kvm/kvm.c +2 -1
@@ -2725,7 +2725,8 @@ static void register_smram_listener(Notifier *n, void *unused)memory_region_set_enabled (smram, true); } -address_space_init (&smram_address_space,NULL , &smram_as_root,"KVM-SMRAM" ); +address_space_init (&smram_address_space,OBJECT (kvm_state), &smram_as_root, +"smram-as" );kvm_memory_listener_register (kvm_state, &smram_listener, &smram_address_space,1 ,"kvm-smram" ); }
Signature · 1 line
2.51.0
PATCH 33/35 target/mips: QOM-ify AddressSpace
In reply to Akihiko OdakiMake AddressSpaces QOM objects to ensure that they are destroyed when their owners are finalized and also to get a unique path for debugging output.
The name arguments were used to distinguish AddresSpaces in debugging output, but they will represent property names after QOM-ification and debugging output will show QOM paths. So change them to make them more concise and also avoid conflicts with other properties.
--- target/mips/cpu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
target/mips/cpu.c +2 -2
@@ -505,8 +505,8 @@ static void mips_cpu_initfn(Object *obj)if (mcc->cpu_def->lcsr_cpucfg2 & (1 <<CPUCFG2_LCSRP )) {memory_region_init_io (&env->iocsr.mr,OBJECT (cpu),NULL , env,"iocsr" ,UINT64_MAX ); -address_space_init (&env->iocsr.as,NULL , - &env->iocsr.mr,"IOCSR" ); +address_space_init (&env->iocsr.as,OBJECT (cpu), + &env->iocsr.mr,"iocsr-as" ); }#endif }
Signature · 1 line
2.51.0
PATCH 34/35 target/xtensa: QOM-ify AddressSpace
In reply to Akihiko OdakiMake AddressSpaces QOM objects to ensure that they are destroyed when their owners are finalized and also to get a unique path for debugging output.
The name arguments were used to distinguish AddresSpaces in debugging output, but they will represent property names after QOM-ification and debugging output will show QOM paths. So change them to make them more concise and also avoid conflicts with other properties.
--- target/xtensa/cpu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
target/xtensa/cpu.c +1 -1
@@ -272,7 +272,7 @@ static void xtensa_cpu_initfn(Object *obj) env->system_er =g_malloc (sizeof (*env->system_er));memory_region_init_io (env->system_er, obj,NULL , env,"er" ,UINT64_C (0x100000000 )); -address_space_init (env->address_space_er,NULL , env->system_er,"ER" ); +address_space_init (env->address_space_er, obj, env->system_er,"er-as" ); cpu->clock =qdev_init_clock_in (DEVICE (obj),"clk-in" ,NULL , cpu,0 );clock_set_hz (cpu->clock, env->config->clock_freq_khz *1000 );
Signature · 1 line
2.51.0
PATCH 35/35 memory: Drop non-QOM AddressSpace support
In reply to Akihiko OdakiNow all AddressSpace instances are converted to QOM so drop non-QOM AddressSpace support.
--- include/system/memory.h | 13 ------------- system/memory.c | 26 +++++--------------------- 2 files changed, 5 insertions(+), 34 deletions(-)
include/system/memory.h +0 -13
@@ -1163,8 +1163,6 @@ struct AddressSpace {/* private: */ Object parent_obj;struct rcu_head rcu; -bool qom; -char *name;MemoryRegion *root;/* Accessed via RCU. */
@@ -2719,17 +2717,6 @@ MemTxResult memory_region_dispatch_write(MemoryRegion *mr,void address_space_init (AddressSpace *as,Object *parent,MemoryRegion *root,const char *name); -/** -* address_space_destroy: destroy an address space -* -* Releases all resources associated with an address space. After an address space -* is destroyed, its root memory region (given by address_space_init()) may be destroyed -* as well. -* -* @as: address space to be destroyed -*/ -void address_space_destroy (AddressSpace *as); -/** * address_space_get_path: get the path to an address space *
system/memory.c +5 -21
@@ -3206,11 +3206,7 @@ void address_space_remove_listeners(AddressSpace *as)void address_space_init (AddressSpace *as,Object *parent,MemoryRegion *root,const char *name) { -if (parent) { -object_initialize_child (parent, name, as,TYPE_ADDRESS_SPACE ); - } - - as->qom = parent; +object_initialize_child (parent, name, as,TYPE_ADDRESS_SPACE );memory_region_ref (root); as->root = root; as->current_map =NULL ;
@@ -3222,12 +3218,11 @@ void address_space_init(AddressSpace *as, Object *parent, MemoryRegion *root, as->bounce_buffer_size =0 ;qemu_mutex_init (&as->map_client_list_lock);QLIST_INIT (&as->map_client_list); - as->name =g_strdup (name ? name :"anonymous" );address_space_update_topology (as);address_space_update_ioeventfds (as); } -static void do_address_space_destroy (struct rcu_head *head) +static void do_address_space_finalize (struct rcu_head *head) {AddressSpace *as =container_of (head, AddressSpace, rcu);
@@ -3238,18 +3233,13 @@ static void do_address_space_destroy(struct rcu_head *head)assert (QTAILQ_EMPTY (&as->listeners));flatview_unref (as->current_map); -g_free (as->name);g_free (as->ioeventfds);memory_region_unref (as->root); }static void address_space_finalize (Object *obj) { -address_space_destroy (ADDRESS_SPACE (obj)); -} - -void address_space_destroy (AddressSpace *as) -{ +AddressSpace *as =ADDRESS_SPACE (obj);MemoryRegion *root = as->root;/* Flush out anything from MemoryListeners listening in on this */
@@ -3263,18 +3253,12 @@ void address_space_destroy(AddressSpace *as)* values to expire before freeing the data. */ as->root = root; -call_rcu1 (&as->rcu, do_address_space_destroy); +call_rcu1 (&as->rcu, do_address_space_finalize); }char *address_space_get_path (AddressSpace *as) { -char *path; - -if (!as->qom) { -return as->name; - } - - path =object_get_canonical_path (OBJECT (as)); +char *path =object_get_canonical_path (OBJECT (as));return path ? path :g_strdup ("orphan" ); }
Signature · 1 line
2.51.0
Re: [PATCH 35/35] memory: Drop non-QOM AddressSpace support
Quoted 8 lines · Akihiko Odaki
Now all AddressSpace instances are converted to QOM so drop non-QOM AddressSpace support.
Signed-off-by Akihiko Odaki <[email protected]>--- include/system/memory.h | 13 ------------- system/memory.c | 26 +++++--------------------- 2 files changed, 5 insertions(+), 34 deletions(-)
r~
Hello Akihiko,
Quoted 11 lines · Akihiko Odaki
Based-on: <[email protected]> ("[PATCH 00/14] Fix memory region use-after-finalization")
Make AddressSpaces QOM objects to ensure that they are destroyed when their owners are finalized and also to get a unique path for debugging output.
Suggested by BALATON Zoltan:
https://lore.kernel.org/qemu-devel/[email protected]/Signed-off-by Akihiko Odaki <[email protected]>
I wonder if this is going to fix an issue I was seeing a while ago in the FSI models. I couldn't find a clean way to avoid corrupting memory because of how the address_space was created and later on destroyed. See below,
Thanks,
C.
from hw/fsi/ :
typedef struct OPBus {
BusState bus;
MemoryRegion mr;
AddressSpace as;
} OPBus;
typedef struct AspeedAPB2OPBState {
...
OPBus opb[ASPEED_FSI_NUM];
...
}
static void fsi_aspeed_apb2opb_realize(DeviceState *dev, Error **errp)
{
SysBusDevice *sbd = SYS_BUS_DEVICE(dev);
AspeedAPB2OPBState *s = ASPEED_APB2OPB(dev);
int i;
/*
* TODO: The OPBus model initializes the OPB address space in
* the .instance_init handler and this is problematic for test
* device-introspect-test. To avoid a memory corruption and a QEMU
* crash, qbus_init() should be called from realize(). Something to
* improve. Possibly, OPBus could also be removed.
*/
for (i = 0; i < ASPEED_FSI_NUM; i++) {
qbus_init(&s->opb[i], sizeof(s->opb[i]), TYPE_OP_BUS, DEVICE(s),
NULL);
}
....
static void fsi_opb_init(Object *o)
{
OPBus *opb = OP_BUS(o);
memory_region_init(&opb->mr, 0, TYPE_FSI_OPB, UINT32_MAX);
address_space_init(&opb->as, &opb->mr, TYPE_FSI_OPB);}
Quoted 13 lines · Cédric Le Goater
Hello Akihiko,
Quoted 10 lines · Akihiko Odaki
Based-on: <[email protected]> ("[PATCH 00/14] Fix memory region use-after-finalization")
Make AddressSpaces QOM objects to ensure that they are destroyed when their owners are finalized and also to get a unique path for debugging output.
Suggested by BALATON Zoltan:
https://lore.kernel.org/qemu-devel/cd21698f-db77-eb75-6966- [email protected]/
Quoted 6 lines
Quoted 1 line
Signed-off-by Akihiko Odaki <[email protected]>I wonder if this is going to fix an issue I was seeing a while ago in the FSI models. I couldn't find a clean way to avoid corrupting memory because of how the
address_spacewas created and later on destroyed. See below,
Partially, but this is insufficient.
The first problem is that AddressSpace suffers from circular references the following series solves:
https://lore.kernel.org/qemu-devel/[email protected]/
"[PATCH v2 0/3] memory: Stop piggybacking on memory region owners"
Another problem is that RCU is not properly waited. This is left to future work.
Regards,
Akihiko Odaki
Quoted 24 lines · Akihiko Odaki
Quoted 14 lines · Cédric Le Goater
Hello Akihiko,
Quoted 11 lines · Akihiko Odaki
Based-on: <[email protected]> ("[PATCH 00/14] Fix memory region use-after-finalization")
Make AddressSpaces QOM objects to ensure that they are destroyed when their owners are finalized and also to get a unique path for debugging output.
Suggested by BALATON Zoltan:
https://lore.kernel.org/qemu-devel/cd21698f-db77-eb75-6966-
[email protected]/Quoted 6 lines
Quoted 1 line
Signed-off-by Akihiko Odaki <[email protected]>I wonder if this is going to fix an issue I was seeing a while ago in the FSI models. I couldn't find a clean way to avoid corrupting memory because of how the
address_spacewas created and later on destroyed. See below,Partially, but this is insufficient.
Quoted 7 lines
The first problem is that AddressSpace suffers from circular references the following series solves:
https://lore.kernel.org/qemu-devel/[email protected]/
"[PATCH v2 0/3] memory: Stop piggybacking on memory region owners"Another problem is that RCU is not properly waited. This is left to future work.
Just to mention, Peter Maydell just posted a series for fixing AS destructions here:
https://lore.kernel.org/qemu-devel/[email protected]/
IIUC it should also work for FSI, if FSI can convert to use dynamically allocated AddressSpaces (with/without QOMify; as Akihiko pointed out correctly, these should be orthogonal), then provide a proper unrealize() of the bus device to invoke address_space_destroy_free().
Thanks,
Signature · 1 line
Peter Xu
Quoted 36 lines · Peter Xu
Quoted 24 lines · Akihiko Odaki
Quoted 14 lines · Cédric Le Goater
Hello Akihiko,
Quoted 11 lines · Akihiko Odaki
Based-on: <[email protected]> ("[PATCH 00/14] Fix memory region use-after-finalization")
Make AddressSpaces QOM objects to ensure that they are destroyed when their owners are finalized and also to get a unique path for debugging output.
Suggested by BALATON Zoltan:
https://lore.kernel.org/qemu-devel/cd21698f-db77-eb75-6966-
[email protected]/Quoted 6 lines
Quoted 1 line
Signed-off-by Akihiko Odaki <[email protected]>I wonder if this is going to fix an issue I was seeing a while ago in the FSI models. I couldn't find a clean way to avoid corrupting memory because of how the
address_spacewas created and later on destroyed. See below,Partially, but this is insufficient.
Quoted 7 lines
The first problem is that AddressSpace suffers from circular references the following series solves:
https://lore.kernel.org/qemu-devel/[email protected]/
"[PATCH v2 0/3] memory: Stop piggybacking on memory region owners"Another problem is that RCU is not properly waited. This is left to future work.
Just to mention, Peter Maydell just posted a series for fixing AS destructions here:
Quoted 6 lines
https://lore.kernel.org/qemu-devel/[email protected]/
IIUC it should also work for FSI, if FSI can convert to use dynamically allocated AddressSpaces (with/without QOMify; as Akihiko pointed out correctly, these should be orthogonal), then provide a proper
unrealize()of the bus device to invokeaddress_space_destroy_free().
Thanks,
I see the series is reviewed. Once merged, I will rework the OP bus and check if the issue we initially saw on the OPB address space is fixed.
C.