[PATCH v3 0/6] Implement memory_region_new_* functions

BALATON Zoltan posted 6 patches 9 hours ago
Failed in applying to current master (apply log)
docs/devel/memory.rst   |  21 ++---
hw/ide/sii3112.c        |  30 +++----
hw/pci-host/articia.c   |  22 +++--
hw/ppc/amigaone.c       |  28 ++-----
hw/ppc/pegasos.c        |  13 ---
hw/xtensa/xtfpga.c      |   7 +-
include/system/memory.h | 179 +++++++++++++++++++++++++++++++++++++++
system/memory.c         | 181 ++++++++++++++++++++++++++++++++++++++++
8 files changed, 407 insertions(+), 74 deletions(-)
[PATCH v3 0/6] Implement memory_region_new_* functions
Posted by BALATON Zoltan 9 hours ago
Our documentation says that memory regions are automatically freed
when the owner dies and the reference counting to do this is also
implemented. However this relies on the QOM free funtion that can only
be set by creating objects with object_new but memory API only
provides constructors that call object_initialize which clears the
free function that prevents QOM to manage the memory region lifetime.
Implement corresponding memory_region_new_* functions that do the same
as the memory_region_init_* functions but create the memory region
with object_new so the lifetime can be automatically managed by QOM as
documented. The memory_region_init functions are kept because they are
useful for memory regions embedded in other object or managed
externally and not by QOM for some reason.

v3:
Based-on: <cover.1770753117.git.balaton@eik.bme.hu>
- convert xtfpga from nomigrate as this has no migration compatibility
issue

v2:
- rebase on master
- update documentation
- use these function to fix some leaks (there may be more, e.g. in
hw/pci-host/bonito but I leave that for later and/or others)

BALATON Zoltan (6):
  memory: Add memory_region_new* functions
  memory: Update documentation for memory_region_new*()
  hw/ide/sii3112: Use memory_region_new to avoid leaking regions
  hw/pci-host/articia: Map PCI memory windows in realize
  hw/pci-host/articia: Add variable for common type cast
  hw/xtensa/xtfpga: Fix leaking memory region

 docs/devel/memory.rst   |  21 ++---
 hw/ide/sii3112.c        |  30 +++----
 hw/pci-host/articia.c   |  22 +++--
 hw/ppc/amigaone.c       |  28 ++-----
 hw/ppc/pegasos.c        |  13 ---
 hw/xtensa/xtfpga.c      |   7 +-
 include/system/memory.h | 179 +++++++++++++++++++++++++++++++++++++++
 system/memory.c         | 181 ++++++++++++++++++++++++++++++++++++++++
 8 files changed, 407 insertions(+), 74 deletions(-)

-- 
2.41.3
Re: [PATCH v3 0/6] Implement memory_region_new_* functions
Posted by BALATON Zoltan 8 hours ago
On Tue, 10 Feb 2026, BALATON Zoltan wrote:
> Our documentation says that memory regions are automatically freed
> when the owner dies and the reference counting to do this is also
> implemented. However this relies on the QOM free funtion that can only
> be set by creating objects with object_new but memory API only
> provides constructors that call object_initialize which clears the
> free function that prevents QOM to manage the memory region lifetime.
> Implement corresponding memory_region_new_* functions that do the same
> as the memory_region_init_* functions but create the memory region
> with object_new so the lifetime can be automatically managed by QOM as
> documented. The memory_region_init functions are kept because they are
> useful for memory regions embedded in other object or managed
> externally and not by QOM for some reason.
>
> v3:
> Based-on: <cover.1770753117.git.balaton@eik.bme.hu>

I mean
Based-on: <cover.1770253186.git.balaton@eik.bme.hu>
[PATCH v4 0/8] memory: Remove most _nomigrate variants
series.

> - convert xtfpga from nomigrate as this has no migration compatibility
> issue
>
> v2:
> - rebase on master
> - update documentation
> - use these function to fix some leaks (there may be more, e.g. in
> hw/pci-host/bonito but I leave that for later and/or others)
>
> BALATON Zoltan (6):
>  memory: Add memory_region_new* functions
>  memory: Update documentation for memory_region_new*()
>  hw/ide/sii3112: Use memory_region_new to avoid leaking regions
>  hw/pci-host/articia: Map PCI memory windows in realize
>  hw/pci-host/articia: Add variable for common type cast
>  hw/xtensa/xtfpga: Fix leaking memory region
>
> docs/devel/memory.rst   |  21 ++---
> hw/ide/sii3112.c        |  30 +++----
> hw/pci-host/articia.c   |  22 +++--
> hw/ppc/amigaone.c       |  28 ++-----
> hw/ppc/pegasos.c        |  13 ---
> hw/xtensa/xtfpga.c      |   7 +-
> include/system/memory.h | 179 +++++++++++++++++++++++++++++++++++++++
> system/memory.c         | 181 ++++++++++++++++++++++++++++++++++++++++
> 8 files changed, 407 insertions(+), 74 deletions(-)
>
>