Skip to content

Commit e56ba18

Browse files
Steve SistareFabiano Rosas
authored andcommitted
pflash: fix cpr
During normal migration, new QEMU creates and initializes memory regions, then loads the preserved contents of the region from vmstate. During CPR, memory regions are preserved in place, then the realize method initializes the regions contents, losing the old contents. To fix, skip the re-init during CPR. Signed-off-by: Steve Sistare <[email protected]> Reviewed-by: Fabiano Rosas <[email protected]> Message-ID: <[email protected]> Signed-off-by: Fabiano Rosas <[email protected]>
1 parent 1632a20 commit e56ba18

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

hw/block/block.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#include "system/blockdev.h"
1313
#include "system/block-backend.h"
1414
#include "hw/block/block.h"
15+
#include "migration/cpr.h"
1516
#include "qapi/error.h"
1617
#include "qapi/qapi-types-block.h"
1718

@@ -66,6 +67,10 @@ bool blk_check_size_and_read_all(BlockBackend *blk, DeviceState *dev,
6667
int ret;
6768
g_autofree char *dev_id = NULL;
6869

70+
if (cpr_is_incoming()) {
71+
return true;
72+
}
73+
6974
blk_len = blk_getlength(blk);
7075
if (blk_len < 0) {
7176
error_setg_errno(errp, -blk_len,

0 commit comments

Comments
 (0)