xref: /openbmc/qemu/include/migration/misc.h (revision a9ded601)
1 /*
2  * QEMU migration miscellaneus exported functions
3  *
4  * Copyright IBM, Corp. 2008
5  *
6  * Authors:
7  *  Anthony Liguori   <aliguori@us.ibm.com>
8  *
9  * This work is licensed under the terms of the GNU GPL, version 2.  See
10  * the COPYING file in the top-level directory.
11  *
12  */
13 
14 #ifndef MIGRATION_MISC_H
15 #define MIGRATION_MISC_H
16 
17 /* migration/ram.c */
18 
19 void ram_mig_init(void);
20 
21 /* migration/block.c */
22 
23 #ifdef CONFIG_LIVE_BLOCK_MIGRATION
24 void blk_mig_init(void);
25 #else
26 static inline void blk_mig_init(void) {}
27 #endif
28 
29 #define SELF_ANNOUNCE_ROUNDS 5
30 
31 static inline
32 int64_t self_announce_delay(int round)
33 {
34     assert(round < SELF_ANNOUNCE_ROUNDS && round > 0);
35     /* delay 50ms, 150ms, 250ms, ... */
36     return 50 + (SELF_ANNOUNCE_ROUNDS - round - 1) * 100;
37 }
38 
39 /* migration/savevm.c */
40 
41 void dump_vmstate_json_to_file(FILE *out_fp);
42 void savevm_skip_section_footers(void);
43 void savevm_skip_configuration(void);
44 
45 /* migration/migration.c */
46 void qemu_start_incoming_migration(const char *uri, Error **errp);
47 bool migration_is_idle(void);
48 void add_migration_state_change_notifier(Notifier *notify);
49 void remove_migration_state_change_notifier(Notifier *notify);
50 bool migration_in_setup(MigrationState *);
51 bool migration_has_finished(MigrationState *);
52 bool migration_has_failed(MigrationState *);
53 /* ...and after the device transmission */
54 bool migration_in_postcopy_after_devices(MigrationState *);
55 #endif
56