On 19 January 2018 at 18:35, Alistair Francis <alistair.fran...@xilinx.com> wrote: > Allow the guest to determine the time set from the QEMU command line. > > This includes adding a trace event to debug the new time. > > The migration logic was copied from the PL031 migration logic.
Unfortunately, that logic won't work for your case. The PL031 presave/postload functions were added in commit b0f26631bc5 and are there to handle a change in the semantics of a pre-existing tick offset field in the vmstate. In your case there is no tick offset field at all, and just adding one like this will cause migration from the previous QEMU version to break. > static const VMStateDescription vmstate_rtc = { > .name = TYPE_XLNX_ZYNQMP_RTC, > .version_id = 1, > .minimum_version_id = 1, > + .pre_save = rtc_pre_save, > + .post_load = rtc_post_load, > .fields = (VMStateField[]) { > VMSTATE_UINT32_ARRAY(regs, XlnxZynqMPRTC, XLNX_ZYNQMP_RTC_R_MAX), > + VMSTATE_UINT32(tick_offset_vmstate, XlnxZynqMPRTC), > VMSTATE_END_OF_LIST(), > } > }; For migration compatibility here you'll need to put the new field into its own subsection, and then in pre-load and/or post-load you can handle the "inbound data is from an old version". thanks -- PMM