On 14/8/26 20:38, Denis V. Lunev wrote:
From: Denis V. Lunev <[email protected]>

emmc_rpmb_vmstate and emmc_extcsd_vmstate are both called
"sd-card/ext_csd_modes-state" and both sit in sd_vmstate.subsections, so
a card with an RPMB partition sends two subsections under one name:
192 bytes of ext_csd_rw and 353 bytes of RPMB state.

vmstate_get_subsection() returns the first entry whose name matches, so
the destination parses both of them as emmc_extcsd_vmstate. The RPMB
section is 161 bytes longer than the fields being loaded from it, the
stream is left mid-section, and the load fails:

   (qemu) migrate file:vm.mig
   ... on the destination:
   load of migration failed: Invalid argument:
   Section footer error, section_id: 38

Reproduced with

   qemu-system-x86_64 -M q35 -device sdhci-pci,id=mmc \
     -drive if=none,id=d0,file=emmc.raw,format=raw \
     -device emmc,bus=sd-bus,drive=d0,rpmb-partition-size=131072

Name it "sd-card/rpmb-state". A stream written by an affected version
cannot be loaded by any version, this one included, so there is no
working format to stay compatible with.

Cc: [email protected]
Fixes: 8ef4260a3f ("hw/sd/sdcard: Add basic support for RPMB partition")
Signed-off-by: Denis V. Lunev <[email protected]>
---
  hw/sd/sd.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

Reviewed-by: Philippe Mathieu-Daudé <[email protected]>

and queued, thanks.

Reply via email to