On Thu, 29 Jan 2026, Peter Maydell wrote:
On Thu, 29 Jan 2026 at 16:21, BALATON Zoltan <[email protected]> wrote:

Nothing else does this, convert to regular memory_region_init_rom().

Signed-off-by: BALATON Zoltan <[email protected]>
---
 hw/display/cg3.c | 5 ++---
 hw/display/tcx.c | 5 ++---
 2 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/hw/display/cg3.c b/hw/display/cg3.c
index 568d6048a6..61bdb0552e 100644
--- a/hw/display/cg3.c
+++ b/hw/display/cg3.c
@@ -282,8 +282,8 @@ static void cg3_initfn(Object *obj)
     SysBusDevice *sbd = SYS_BUS_DEVICE(obj);
     CG3State *s = CG3(obj);

-    memory_region_init_rom_nomigrate(&s->rom, obj, "cg3.prom",
-                                     FCODE_MAX_ROM_SIZE, &error_fatal);
+    memory_region_init_rom(&s->rom, obj, "cg3.prom", FCODE_MAX_ROM_SIZE,
+                           &error_fatal);
     sysbus_init_mmio(sbd, &s->rom);

     memory_region_init_io(&s->reg, obj, &cg3_reg_ops, s, "cg3.reg",
@@ -299,7 +299,6 @@ static void cg3_realizefn(DeviceState *dev, Error **errp)
     char *fcode_filename;

     /* FCode ROM */
-    vmstate_register_ram_global(&s->rom);
     fcode_filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, CG3_ROM_FILE);
     if (fcode_filename) {
         ret = load_image_mr(fcode_filename, &s->rom);

This is a migration compatibility break, because the
memory_region_init_rom() function registers the MR
for migration via vmstate_register_ram(), which picks
an ID string for the memory that includes the path
of the device, whereas vmstate_register_ram_global()
picks an ID string for the memory that does not include
the path of any device. It is this difference that is the
reason why they're still using the _nomigrate functions.

I thought it might be the case but wasn't sure. How was this handled in all other machines where they were converted to not use _nomigrate? Only some Sun machines still seem to use this and this may be a good opportunity to bring them inline with all other machines.

I think it's reasonable to accept a compat break for the purposes
of cleaning up the codebase, because these are used on sparc machine
types and we don't version those, but the commit message needs to
note that this is a compat break.

If we accept that then the other memory_region_init_ram_nomigrate usages in Sun machines could also be converted. If Mark is not open to that I'm inclined to convert these two rom_nomigrate usages to memory_region_init_ram_flags_nomigrate + memory_region_set_readonly instead but get rid of these other _nomigrate variants anyhow. Let me know which way you prefer.

Regards,
BALATON Zoltan

Reply via email to