aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Sistare <steven.sistare@oracle.com>2025-03-07 12:55:52 -0800
committerFabiano Rosas <farosas@suse.de>2025-03-14 09:29:19 -0300
commite56ba1878fefe7babff76ff399311ae5e399c5c5 (patch)
tree2454901262a56b2de3d092a56fcf5a6a63436dd2
parent1632a2017f682a9dc6ce51756b9765af07977873 (diff)
downloadqemu-e56ba1878fefe7babff76ff399311ae5e399c5c5.zip
qemu-e56ba1878fefe7babff76ff399311ae5e399c5c5.tar.gz
qemu-e56ba1878fefe7babff76ff399311ae5e399c5c5.tar.bz2
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 <steven.sistare@oracle.com> Reviewed-by: Fabiano Rosas <farosas@suse.de> Message-ID: <1741380954-341079-3-git-send-email-steven.sistare@oracle.com> Signed-off-by: Fabiano Rosas <farosas@suse.de>
-rw-r--r--hw/block/block.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/hw/block/block.c b/hw/block/block.c
index 1d405e0..2e10611 100644
--- a/hw/block/block.c
+++ b/hw/block/block.c
@@ -12,6 +12,7 @@
#include "system/blockdev.h"
#include "system/block-backend.h"
#include "hw/block/block.h"
+#include "migration/cpr.h"
#include "qapi/error.h"
#include "qapi/qapi-types-block.h"
@@ -66,6 +67,10 @@ bool blk_check_size_and_read_all(BlockBackend *blk, DeviceState *dev,
int ret;
g_autofree char *dev_id = NULL;
+ if (cpr_is_incoming()) {
+ return true;
+ }
+
blk_len = blk_getlength(blk);
if (blk_len < 0) {
error_setg_errno(errp, -blk_len,