diff mbox

[28/46] postcopy: Incoming initialisation

Message ID 1404495717-4239-29-git-send-email-dgilbert@redhat.com
State New
Headers show

Commit Message

Dr. David Alan Gilbert July 4, 2014, 5:41 p.m. UTC
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>

Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
---
 arch_init.c                   | 11 +++++++++++
 include/migration/migration.h |  1 +
 migration.c                   |  2 ++
 3 files changed, 14 insertions(+)
diff mbox

Patch

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 722c846..397f41c 100644
--- a/include/migration/migration.h
+++ b/include/migration/migration.h
@@ -194,6 +194,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 ca0fd7b..55bb767 100644
--- a/migration.c
+++ b/migration.c
@@ -139,6 +139,8 @@  MigrationIncomingState *migration_incoming_state_init(QEMUFile* f)
 
 void migration_incoming_state_destroy(MigrationIncomingState *mis)
 {
+    postcopy_pmi_destroy(mis);
+
     g_free(mis);
 }