Skip to content

zynqmp multi-arch: fix snapshot/restore - #110

Open
gsmecher wants to merge 6 commits into
Xilinx:masterfrom
gsmecher:snapshot-migration
Open

gsmecher wants to merge 6 commits into
Xilinx:masterfrom
gsmecher:snapshot-migration

Conversation

@gsmecher

Copy link
Copy Markdown

We snapshot a zynqmp multi-arch machine (ARM APU + microblaze PMU) to accelerate regression testing on an RFSoC design. However, snapshots don't completely capture machine state and the stored images don't resume correctly:

  1. CPU reset and halt pins aren't migrated: an A53 that was idle stays halted after the restore.
  2. MicroBlaze registers are never saved due to a version mismatch, and the restored PMU starts at its reset vector.
  3. I/O module and generic timer models have empty vmstates: the restored PMU has its interrupts disabled and its PITs stopped.
  4. RAM from device-tree memory nodes isn't registered for migration, and the PMU's ROM comes back zeroed.
  5. xlnx-zynqmp-boot runs its boot sequence again in the restored guest, clobbering the PC.

The last patch is about booting through the FSBL, not snapshots:

  1. mb_sleep stays high when an interrupt wakes the PMU, so the FSBL's wait on MB_SLEEP doesn't wait, and a slow PMU jumps into half-written firmware. This needs a companion qemu-devicetrees change (posted-updates = <0> on the PMU's interrupt line).

Not addressed:

  • During early boot, QEMU's boot helper stashes the PMU configuration object at DDR address 0. A snapshot taken before the PMU consumes this object sees 0 instead of the expected configuration and can't continue. This bug could be fixed, but storing the PMU configuration object in DDR seems a little hacky and this bug might be better addressed by modeling the underlying device more accurately.
  • remote-port has no vmstate. We currently take our cosimulation snapshot prior to our RTL kernel starting up, so this doesn't affect us.
  • existing test failures: make check fails identically under both master and this PR series - the stock virt and petalogix machines don't start in this tree and we don't touch them.

Tested with Linux guests restored under MTTCG, and with a 2026.1 backport in our cosimulation tree.

The destination's reset can assert a CPU's reset pin (ZynqMP's CRF does),
and nothing lowers it once the state is loaded: CPUs that were halted
when the state was saved never wake.

The subsection is always sent, so for every target, streams no longer
load on a QEMU without this change.

Signed-off-by: Graeme Smecher <gsmecher@t0.technology>
vmstate_mb_cpu is version 0 but its env field is tagged version 1, so
the registers were never saved or loaded. Make the description version
1, with a minimum of 1: older streams carry no registers.

Also save env->wakeup, the levels of the wakeup lines.

Fixes: 77f63e1 ("target/microblaze: Fill in VMStateDescription for cpu")
Signed-off-by: Graeme Smecher <gsmecher@t0.technology>
The MicroBlaze I/O module's models have empty vmstates, so the ZynqMP
PMU's interrupt controller and PITs come back as reset. Migrate their
state. Versions go from 1 to 2 with a minimum of 2: older streams carry
none of it.

The memory-mapped ARM generic timer migrates its registers but not
tick_offset and enabled. Add them as version 2 fields; older streams
still load.

Signed-off-by: Graeme Smecher <gsmecher@t0.technology>
Plain RAM nodes ("qemu,ram = <1>") are never registered for migration,
so they come back empty: the ZynqMP PMU's ROM, for one. Register them
once parenting has named them.

File-backed nodes ("qemu,ram = <2>") are left to the machine path's
shared files.

Signed-off-by: Graeme Smecher <gsmecher@t0.technology>
With use-pmufw, the boot sequence polls for the PMU firmware on a timer.
The reset that precedes an incoming migration starts it, and with no
migrated state to replace that, it runs again in the restored guest:
it rewrites DDR at address 0, sends PM_SET_CONFIGURATION, and sets the
boot CPU's PC. Restored Linux guests then sometimes hang or panic under
MTTCG.

The DDR contents saved while the firmware reads its configuration are
not migrated: a machine saved in that window keeps the configuration
object at address 0.

Signed-off-by: Graeme Smecher <gsmecher@t0.technology>
The mb_sleep output is lowered when a wakeup line rises, but not when
an interrupt wakes the CPU: it stays high while the CPU runs its
handler. On ZynqMP, the FSBL waits on it (PMU_GLOBAL's MB_SLEEP) for
the PMU's ROM to be done with an IPI before it writes the PMU's
firmware, and so doesn't wait.

Signed-off-by: Graeme Smecher <gsmecher@t0.technology>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant