The VMSTATE_PTIMER macro is defined to pass a 'version' argument of 1
to VMSTATE_STRUCT_POINTER_TEST_V.  This means that the field will
only be used in migration when the vmstate struct that uses
VMSTATE_PTIMER has a version_id of at least 1.  This doesn't match
how we define other VMSTATE_FOO which don't take an explicit
version_id, which is to use a version argument of 0 (e.g. all the
common macros like VMSTATE_UINT32 are written to pass 0 to their
VMSTATE_UINT32_V counterparts, and so on). It also doesn't match
how we define VMSTATE_PTIMER_ARRAY.

The practical effect of this is that users of VMSTATE_PTIMER in
vmstate structs which explicitly or implicitly have a version_id of 0
were actually not getting their ptimers migrated.

This series:
 (1) fixes a mistake in wdt_imx2 where we bumped version_id
 but forgot to bump minimum_version_id
 (2) fixes the macro, and bumps version_id and minimum_version_id
 for the 2 vmstate structs that used VMSTATE_PTIMER and had an
 implicit or explicit version_id of 0 (vmstate_xlnx_csu_dma
 and vmstate_k230_wdt) so they cleanly fail migration from
 old to new QEMU

Changes v1->v2:
 * wdt_imx2 is no longer affected as it had a version bump for
   other reasons, but patch 1 is needed to correct an error
   in how we did it
 * patch 2 now bumps version on the affected vmstate structs

thanks
-- PMM

Peter Maydell (2):
  hw/watchdog/wdt_imx2: Set vmstate minimum_version_id to 1
  include/hw/core/ptimer.h: Fix 'version' argument of VMSTATE_PTIMER

 include/hw/core/ptimer.h | 2 +-
 hw/dma/xlnx_csu_dma.c    | 4 ++--
 hw/watchdog/k230_wdt.c   | 2 ++
 hw/watchdog/wdt_imx2.c   | 1 +
 4 files changed, 6 insertions(+), 3 deletions(-)

-- 
2.43.0


Reply via email to