From: "Dr. David Alan Gilbert" <dgilb...@redhat.com> Signed-off-by: Dr. David Alan Gilbert <dgilb...@redhat.com> --- arch_init.c | 11 +++++++++++ include/migration/migration.h | 1 + migration.c | 1 + 3 files changed, 13 insertions(+)
diff --git a/arch_init.c b/arch_init.c index 134ea7e..fd7399c 100644 --- a/arch_init.c +++ b/arch_init.c @@ -1234,6 +1234,17 @@ void ram_handle_compressed(void *host, uint8_t ch, uint64_t size) } } +/* + * Allocate data structures etc needed by incoming migration with postcopy-ram + * postcopy-ram's similarly names postcopy_ram_incoming_init does the work + */ +int ram_postcopy_incoming_init(MigrationIncomingState *mis) +{ + size_t ram_pages = last_ram_offset() >> TARGET_PAGE_BITS; + + return postcopy_ram_incoming_init(mis, ram_pages); +} + static int ram_load(QEMUFile *f, void *opaque, int version_id) { ram_addr_t addr; diff --git a/include/migration/migration.h b/include/migration/migration.h index 0ed3790..12a54e5 100644 --- a/include/migration/migration.h +++ b/include/migration/migration.h @@ -196,6 +196,7 @@ int ram_postcopy_each_ram_discard(MigrationState *ms); int ram_discard_range(MigrationIncomingState *mis, const char *block_name, int source_target_page_bits, uint64_t start, uint64_t end); +int ram_postcopy_incoming_init(MigrationIncomingState *mis); /** * @migrate_add_blocker - prevent migration from proceeding diff --git a/migration.c b/migration.c index b509e4d..d962aee 100644 --- a/migration.c +++ b/migration.c @@ -99,6 +99,7 @@ MigrationIncomingState *migration_incoming_state_init(QEMUFile* f) void migration_incoming_state_destroy(void) { + postcopy_pmi_destroy(mis_current); g_free(mis_current); mis_current = NULL; } -- 1.9.3