xref: /qemu/include/migration/misc.h (revision 73b49878)
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 #include "qemu/notify.h"
18 #include "qapi/qapi-types-migration.h"
19 #include "qapi/qapi-types-net.h"
20 
21 /* migration/ram.c */
22 
23 typedef enum PrecopyNotifyReason {
24     PRECOPY_NOTIFY_SETUP = 0,
25     PRECOPY_NOTIFY_BEFORE_BITMAP_SYNC = 1,
26     PRECOPY_NOTIFY_AFTER_BITMAP_SYNC = 2,
27     PRECOPY_NOTIFY_COMPLETE = 3,
28     PRECOPY_NOTIFY_CLEANUP = 4,
29     PRECOPY_NOTIFY_MAX = 5,
30 } PrecopyNotifyReason;
31 
32 typedef struct PrecopyNotifyData {
33     enum PrecopyNotifyReason reason;
34     Error **errp;
35 } PrecopyNotifyData;
36 
37 void precopy_infrastructure_init(void);
38 void precopy_add_notifier(NotifierWithReturn *n);
39 void precopy_remove_notifier(NotifierWithReturn *n);
40 int precopy_notify(PrecopyNotifyReason reason, Error **errp);
41 
42 void ram_mig_init(void);
43 void qemu_guest_free_page_hint(void *addr, size_t len);
44 bool migrate_ram_is_ignored(RAMBlock *block);
45 
46 /* migration/block.c */
47 
48 #ifdef CONFIG_LIVE_BLOCK_MIGRATION
49 void blk_mig_init(void);
50 #else
51 static inline void blk_mig_init(void) {}
52 #endif
53 
54 AnnounceParameters *migrate_announce_params(void);
55 /* migration/savevm.c */
56 
57 void dump_vmstate_json_to_file(FILE *out_fp);
58 
59 /* migration/migration.c */
60 void migration_object_init(void);
61 void migration_shutdown(void);
62 bool migration_is_idle(void);
63 bool migration_is_active(MigrationState *);
64 void migration_add_notifier(Notifier *notify,
65                             void (*func)(Notifier *notifier, void *data));
66 void migration_remove_notifier(Notifier *notify);
67 void migration_call_notifiers(MigrationState *s);
68 bool migration_in_setup(MigrationState *);
69 bool migration_has_finished(MigrationState *);
70 bool migration_has_failed(MigrationState *);
71 /* ...and after the device transmission */
72 bool migration_in_postcopy_after_devices(MigrationState *);
73 /* True if incoming migration entered POSTCOPY_INCOMING_DISCARD */
74 bool migration_in_incoming_postcopy(void);
75 /* True if incoming migration entered POSTCOPY_INCOMING_ADVISE */
76 bool migration_incoming_postcopy_advised(void);
77 /* True if background snapshot is active */
78 bool migration_in_bg_snapshot(void);
79 
80 /* migration/block-dirty-bitmap.c */
81 void dirty_bitmap_mig_init(void);
82 
83 #endif
84