On Fri, 14 Jul 2023 at 20:13, Stefan Berger <stef...@linux.ibm.com> wrote: > Unfortunately the CRB device is being used by x86 on some distros > and the expectation is that this existing device can also downgrade > to a previous version of QEMU I would say. I have read people migrating > from RHEL 9.x even to RHEL 8.x and the expectation is that this works.
If you want both-ways migration compatibility for the change of implementation to use a RAM-backed MR rather than an MMIO MR: * make sure the new RAM-backed memory region is created using a memory_region_init_*_nomigrate() function so that we don't try to migrate the RAM as RAM * keep the regs array in the device struct, and add a comment that it's only used during migration * keep the vmstate entry for the regs array as it is * in the device's vmstate pre_save hook, copy from the backing RAM into the regs array (watch out for endianness issues :-)) * in the vmstate post_load hook, copy from the regs array into the backing RAM -- PMM