@@ -313,7 +313,6 @@ static void pc_init1(MachineState *machine,
static void pc_compat_2_3(MachineState *machine)
{
PCMachineState *pcms = PC_MACHINE(machine);
- savevm_skip_section_footers();
if (kvm_enabled()) {
pcms->smm = ON_OFF_AUTO_OFF;
}
@@ -3592,7 +3592,6 @@ DEFINE_SPAPR_MACHINE(2_4, "2.4", false);
static void spapr_machine_2_3_instance_options(MachineState *machine)
{
spapr_machine_2_4_instance_options(machine);
- savevm_skip_section_footers();
}
static void spapr_machine_2_3_class_options(MachineClass *mc)
@@ -146,7 +146,7 @@ static int xen_init(MachineState *ms)
*/
register_compat_prop("migration", "store-global-state", "off");
register_compat_prop("migration", "skip-configuration", "on");
- savevm_skip_section_footers();
+ register_compat_prop("migration", "skip-section-footer", "on");
return 0;
}
@@ -183,6 +183,10 @@
.value = "on",\
},{\
.driver = "migration",\
+ .property = "skip-section-footer",\
+ .value = "on",\
+ },{\
+ .driver = "migration",\
.property = "store-global-state",\
.value = "off",\
},
@@ -174,6 +174,8 @@ struct MigrationState
/* Whether we skip QEMU_VM_CONFIGURATION for migration */
bool skip_configuration;
+ /* Whether we skip section footer */
+ bool skip_section_footer;
};
void migrate_set_state(int *state, int old_state, int new_state);
@@ -250,7 +252,6 @@ size_t ram_control_save_page(QEMUFile *f, ram_addr_t block_offset,
ram_addr_t offset, size_t size,
uint64_t *bytes_sent);
-void savevm_skip_section_footers(void);
void register_global_state(void);
int global_state_store(void);
void global_state_store_running(void);
@@ -2107,6 +2107,8 @@ static Property migration_properties[] = {
DEFINE_PROP_BOOL("only-migratable", MigrationState, only_migratable, false),
DEFINE_PROP_BOOL("skip-configuration", MigrationState,
skip_configuration, false),
+ DEFINE_PROP_BOOL("skip-section-footer", MigrationState,
+ skip_section_footer, false),
DEFINE_PROP_END_OF_LIST(),
};
@@ -65,8 +65,6 @@
const unsigned int postcopy_ram_discard_version = 0;
-static bool skip_section_footers;
-
/* Subcommands for QEMU_VM_COMMAND */
enum qemu_vm_cmd {
MIG_CMD_INVALID = 0, /* Must be 0 */
@@ -780,11 +778,6 @@ static void vmstate_save(QEMUFile *f, SaveStateEntry *se, QJSON *vmdesc)
vmstate_save_state(f, se->vmsd, se->opaque, vmdesc);
}
-void savevm_skip_section_footers(void)
-{
- skip_section_footers = true;
-}
-
/*
* Write the header for device section (QEMU_VM_SECTION START/END/PART/FULL)
*/
@@ -812,7 +805,7 @@ static void save_section_header(QEMUFile *f, SaveStateEntry *se,
*/
static void save_section_footer(QEMUFile *f, SaveStateEntry *se)
{
- if (!skip_section_footers) {
+ if (!migrate_get_current()->skip_section_footer) {
qemu_put_byte(f, QEMU_VM_SECTION_FOOTER);
qemu_put_be32(f, se->section_id);
}
@@ -1810,7 +1803,7 @@ static bool check_section_footer(QEMUFile *f, SaveStateEntry *se)
uint8_t read_mark;
uint32_t read_section_id;
- if (skip_section_footers) {
+ if (migrate_get_current()->skip_section_footer) {
/* No footer to check */
return true;
}
Move it into MigrationState, with a property binded to it. Same trick is played like previous patches. Signed-off-by: Peter Xu <peterx@redhat.com> --- hw/i386/pc_piix.c | 1 - hw/ppc/spapr.c | 1 - hw/xen/xen-common.c | 2 +- include/hw/compat.h | 4 ++++ include/migration/migration.h | 3 ++- migration/migration.c | 2 ++ migration/savevm.c | 11 ++--------- 7 files changed, 11 insertions(+), 13 deletions(-)