Introduce address_space_create() (return .heap allocated AddressSpace) and return directly &address_space_memory if the root MemoryRegion is get_system_memory().
This simplifies the 'info mtree' output of some boards. Flatview is unchanged. Inspired by this thread: https://www.mail-archive.com/qemu-devel@nongnu.org/msg829819.html Based-on: <20210819141527.2821842-1-phi...@redhat.com> Philippe Mathieu-Daudé (6): memory: Do not increase refcount on global system_memory region memory: Introduce address_space_create() memory: Have cpu_address_space_init() use address_space_create() hw/dma: Replace alloc() + address_space_init() by address_space_create() hw/usb: Replace alloc() + address_space_init() by address_space_create() memory: Have address_space_create() re-use global &address_space_memory include/exec/memory.h | 14 ++++++++++++++ hw/dma/xlnx-zdma.c | 15 +++++++++------ hw/dma/xlnx_csu_dma.c | 9 ++------- hw/usb/hcd-xhci-sysbus.c | 16 ++++++++++------ softmmu/memory.c | 24 ++++++++++++++++++++++-- softmmu/physmem.c | 4 ++-- 6 files changed, 59 insertions(+), 23 deletions(-) -- 2.31.1