hw/sd: give the RPMB vmstate subsection a name of its own
PATCH 1/1 hw/sd: give the RPMB vmstate subsection a name of its own
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=131072Name 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.
--- hw/sd/sd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/sd/sd.c +1 -1
@@ -1022,7 +1022,7 @@ static bool vmstate_needed_for_rpmb(void *opaque) }static const VMStateDescription emmc_rpmb_vmstate = { - .name ="sd-card/ext_csd_modes-state" , + .name ="sd-card/rpmb-state" , .version_id =1 , .minimum_version_id =1 , .needed = vmstate_needed_for_rpmb,
Signature · 1 line
2.53.0
Quoted 27 lines · Denis V. Lunev
From: Denis V. Lunev <[email protected]>
emmc_rpmb_vmstateandemmc_extcsd_vmstateare 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 ofext_csd_rwand 353 bytes of RPMB state.
vmstate_get_subsection()returns the first entry whose name matches, so the destination parses both of them asemmc_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: 38Reproduced 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=131072Name 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.
Quoted 6 lines
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(-)
and queued, thanks.