All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 00/10] Implement memory_region_new_* functions
@ 2026-01-25 17:50 BALATON Zoltan
  2026-01-25 17:50 ` [PATCH v2 01/10] memory: Add internal memory_region_set_ops helper function BALATON Zoltan
                   ` (10 more replies)
  0 siblings, 11 replies; 24+ messages in thread
From: BALATON Zoltan @ 2026-01-25 17:50 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Xu, Akihiko Odaki, Paolo Bonzini, Michael S. Tsirkin,
	Philippe Mathieu-Daudé

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.

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 (10):
  memory: Add internal memory_region_set_ops helper function
  memory: Factor out common ram region initialization
  memory: Factor out more common ram region initialization
  memory: Shorten memory_region_init_rom_nomigrate
  memory: Add internal memory_region_register_ram function
  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

 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 --
 include/system/memory.h | 360 ++++++++++++++++++++++++++++++
 system/memory.c         | 484 +++++++++++++++++++++++++---------------
 7 files changed, 713 insertions(+), 245 deletions(-)

-- 
2.41.3



^ permalink raw reply	[flat|nested] 24+ messages in thread

end of thread, other threads:[~2026-01-30 21:32 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-25 17:50 [PATCH v2 00/10] Implement memory_region_new_* functions BALATON Zoltan
2026-01-25 17:50 ` [PATCH v2 01/10] memory: Add internal memory_region_set_ops helper function BALATON Zoltan
2026-01-25 17:50 ` [PATCH v2 02/10] memory: Factor out common ram region initialization BALATON Zoltan
2026-01-25 17:50 ` [PATCH v2 03/10] memory: Factor out more " BALATON Zoltan
2026-01-25 17:50 ` [PATCH v2 04/10] memory: Shorten memory_region_init_rom_nomigrate BALATON Zoltan
2026-01-25 17:51 ` [PATCH v2 05/10] memory: Add internal memory_region_register_ram function BALATON Zoltan
2026-01-25 17:51 ` [PATCH v2 06/10] memory: Add memory_region_new* functions BALATON Zoltan
2026-01-25 17:51 ` [PATCH v2 07/10] memory: Update documentation for memory_region_new*() BALATON Zoltan
2026-01-25 17:51 ` [PATCH v2 08/10] hw/ide/sii3112: Use memory_region_new to avoid leaking regions BALATON Zoltan
2026-01-25 17:51 ` [PATCH v2 09/10] hw/pci-host/articia: Map PCI memory windows in realize BALATON Zoltan
2026-01-25 17:51 ` [PATCH v2 10/10] hw/pci-host/articia: Add variable for common type cast BALATON Zoltan
2026-01-27 13:13 ` [PATCH v2 00/10] Implement memory_region_new_* functions Peter Maydell
2026-01-27 14:10   ` BALATON Zoltan
2026-01-27 19:51     ` Peter Xu
2026-01-27 20:22       ` BALATON Zoltan
2026-01-28 10:05         ` Akihiko Odaki
2026-01-28 11:40           ` BALATON Zoltan
2026-01-28 13:47             ` Peter Maydell
2026-01-28 15:46               ` BALATON Zoltan
2026-01-29  4:41                 ` Akihiko Odaki
2026-01-29 18:06                   ` Paolo Bonzini
2026-01-30  6:13                     ` Akihiko Odaki
2026-01-30 20:08                   ` Mark Cave-Ayland
2026-01-30 21:31                     ` BALATON Zoltan

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.