xref: /openbmc/qemu/include/migration/colo.h (revision 7e1c0047015ffbd408e1aa4a5ec1abe4751dbf7e)
135a6ed4fSzhanghailiang /*
235a6ed4fSzhanghailiang  * COarse-grain LOck-stepping Virtual Machines for Non-stop Service (COLO)
335a6ed4fSzhanghailiang  * (a.k.a. Fault Tolerance or Continuous Replication)
435a6ed4fSzhanghailiang  *
535a6ed4fSzhanghailiang  * Copyright (c) 2016 HUAWEI TECHNOLOGIES CO., LTD.
635a6ed4fSzhanghailiang  * Copyright (c) 2016 FUJITSU LIMITED
735a6ed4fSzhanghailiang  * Copyright (c) 2016 Intel Corporation
835a6ed4fSzhanghailiang  *
935a6ed4fSzhanghailiang  * This work is licensed under the terms of the GNU GPL, version 2 or
1035a6ed4fSzhanghailiang  * later.  See the COPYING file in the top-level directory.
1135a6ed4fSzhanghailiang  */
1235a6ed4fSzhanghailiang 
1335a6ed4fSzhanghailiang #ifndef QEMU_COLO_H
1435a6ed4fSzhanghailiang #define QEMU_COLO_H
1535a6ed4fSzhanghailiang 
169af23989SMarkus Armbruster #include "qapi/qapi-types-migration.h"
1735a6ed4fSzhanghailiang 
180ffcece3SZhang Chen enum colo_event {
190ffcece3SZhang Chen     COLO_EVENT_NONE,
200ffcece3SZhang Chen     COLO_EVENT_CHECKPOINT,
210ffcece3SZhang Chen     COLO_EVENT_FAILOVER,
220ffcece3SZhang Chen };
230ffcece3SZhang Chen 
240b827d5eSzhanghailiang void migrate_start_colo_process(MigrationState *s);
250b827d5eSzhanghailiang bool migration_in_colo_state(void);
260b827d5eSzhanghailiang 
2725d0c16fSzhanghailiang /* loadvm */
2818b1d3c9SDavid Hildenbrand int migration_incoming_enable_colo(void);
29aad555c2SZhang Chen void migration_incoming_disable_colo(void);
30aad555c2SZhang Chen bool migration_incoming_colo_enabled(void);
3125d0c16fSzhanghailiang bool migration_incoming_in_colo_state(void);
32d89e666eSzhanghailiang 
33d89e666eSzhanghailiang COLOMode get_colo_mode(void);
34b3f7f0c5Szhanghailiang 
35b3f7f0c5Szhanghailiang /* failover */
36c0913d1dSZhang Chen void colo_do_failover(void);
37479125d5Szhanghailiang 
384332ffcdSVladimir Sementsov-Ogievskiy /*
394332ffcdSVladimir Sementsov-Ogievskiy  * colo_checkpoint_delay_set
404332ffcdSVladimir Sementsov-Ogievskiy  *
414332ffcdSVladimir Sementsov-Ogievskiy  * Handles change of x-checkpoint-delay migration parameter, called from
424332ffcdSVladimir Sementsov-Ogievskiy  * migrate_params_apply() to notify COLO module about the change.
434332ffcdSVladimir Sementsov-Ogievskiy  */
444332ffcdSVladimir Sementsov-Ogievskiy void colo_checkpoint_delay_set(void);
454332ffcdSVladimir Sementsov-Ogievskiy 
46d0a14a2bSVladimir Sementsov-Ogievskiy /*
47d0a14a2bSVladimir Sementsov-Ogievskiy  * Starts COLO incoming process. Called from process_incoming_migration_co()
48d0a14a2bSVladimir Sementsov-Ogievskiy  * after loading the state.
49d0a14a2bSVladimir Sementsov-Ogievskiy  *
50d0a14a2bSVladimir Sementsov-Ogievskiy  * Called with BQL locked, may temporary release BQL.
51d0a14a2bSVladimir Sementsov-Ogievskiy  */
52*787ea49eSLi Zhijian void coroutine_fn colo_incoming_co(void);
53d0a14a2bSVladimir Sementsov-Ogievskiy 
54795969abSRao, Lei void colo_shutdown(void);
5535a6ed4fSzhanghailiang #endif
56