xref: /openbmc/qemu/include/sysemu/hw_accel.h (revision 80adf54e)
1 /*
2  * QEMU Hardware accelertors support
3  *
4  * Copyright 2016 Google, Inc.
5  *
6  * This work is licensed under the terms of the GNU GPL, version 2 or later.
7  * See the COPYING file in the top-level directory.
8  *
9  */
10 
11 #ifndef QEMU_HW_ACCEL_H
12 #define QEMU_HW_ACCEL_H
13 
14 #include "qom/cpu.h"
15 #include "sysemu/hax.h"
16 #include "sysemu/kvm.h"
17 
18 static inline void cpu_synchronize_state(CPUState *cpu)
19 {
20     if (kvm_enabled()) {
21         kvm_cpu_synchronize_state(cpu);
22     }
23     if (hax_enabled()) {
24         hax_cpu_synchronize_state(cpu);
25     }
26 }
27 
28 static inline void cpu_synchronize_post_reset(CPUState *cpu)
29 {
30     if (kvm_enabled()) {
31         kvm_cpu_synchronize_post_reset(cpu);
32     }
33     if (hax_enabled()) {
34         hax_cpu_synchronize_post_reset(cpu);
35     }
36 }
37 
38 static inline void cpu_synchronize_post_init(CPUState *cpu)
39 {
40     if (kvm_enabled()) {
41         kvm_cpu_synchronize_post_init(cpu);
42     }
43     if (hax_enabled()) {
44         hax_cpu_synchronize_post_init(cpu);
45     }
46 }
47 
48 static inline void cpu_synchronize_pre_loadvm(CPUState *cpu)
49 {
50     if (kvm_enabled()) {
51         kvm_cpu_synchronize_pre_loadvm(cpu);
52     }
53     if (hax_enabled()) {
54         hax_cpu_synchronize_pre_loadvm(cpu);
55     }
56 }
57 
58 #endif /* QEMU_HW_ACCEL_H */
59