From: Steve Sistare <steven.sistare@oracle.com>
To: qemu-devel@nongnu.org
Cc: Philippe Mathieu-Daude <philmd@linaro.org>,
Richard Henderson <richard.henderson@linaro.org>,
Gerd Hoffmann <kraxel@redhat.com>, Kevin Wolf <kwolf@redhat.com>,
Hanna Reitz <hreitz@redhat.com>, Peter Xu <peterx@redhat.com>,
Fabiano Rosas <farosas@suse.de>,
Steve Sistare <steven.sistare@oracle.com>
Subject: [PATCH V1 3/4] hw/loader: fix roms during cpr
Date: Fri, 7 Mar 2025 12:55:53 -0800 [thread overview]
Message-ID: <1741380954-341079-4-git-send-email-steven.sistare@oracle.com> (raw)
In-Reply-To: <1741380954-341079-1-git-send-email-steven.sistare@oracle.com>
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>
---
hw/core/loader.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/hw/core/loader.c b/hw/core/loader.c
index fd25c5e..3c3a9a0 100644
--- a/hw/core/loader.c
+++ b/hw/core/loader.c
@@ -51,6 +51,7 @@
#include "trace.h"
#include "hw/hw.h"
#include "disas/disas.h"
+#include "migration/cpr.h"
#include "migration/vmstate.h"
#include "monitor/monitor.h"
#include "system/reset.h"
@@ -1029,7 +1030,9 @@ static void *rom_set_mr(Rom *rom, Object *owner, const char *name, bool ro)
vmstate_register_ram_global(rom->mr);
data = memory_region_get_ram_ptr(rom->mr);
- memcpy(data, rom->data, rom->datasize);
+ if (!cpr_is_incoming()) {
+ memcpy(data, rom->data, rom->datasize);
+ }
return data;
}
--
1.8.3.1
next prev parent reply other threads:[~2025-03-07 20:57 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-07 20:55 [PATCH V1 0/4] skip memory init during CPR Steve Sistare
2025-03-07 20:55 ` [PATCH V1 1/4] migration: cpr_is_incoming Steve Sistare
2025-03-07 23:08 ` Peter Xu
2025-03-07 20:55 ` [PATCH V1 2/4] pflash: fix cpr Steve Sistare
2025-03-07 20:55 ` Steve Sistare [this message]
2025-03-07 20:55 ` [PATCH V1 4/4] hw/qxl: " Steve Sistare
2025-03-11 14:39 ` [PATCH V1 0/4] skip memory init during CPR Fabiano Rosas
2025-03-13 17:24 ` Fabiano Rosas
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1741380954-341079-4-git-send-email-steven.sistare@oracle.com \
--to=steven.sistare@oracle.com \
--cc=farosas@suse.de \
--cc=hreitz@redhat.com \
--cc=kraxel@redhat.com \
--cc=kwolf@redhat.com \
--cc=peterx@redhat.com \
--cc=philmd@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).