xref: /openbmc/qemu/include/sysemu/hw_accel.h (revision 7f6c3d1a)
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 "hw/core/cpu.h"
15 #include "sysemu/hax.h"
16 #include "sysemu/kvm.h"
17 #include "sysemu/hvf.h"
18 #include "sysemu/whpx.h"
19 
20 static inline void cpu_synchronize_state(CPUState *cpu)
21 {
22     if (kvm_enabled()) {
23         kvm_cpu_synchronize_state(cpu);
24     }
25     if (hax_enabled()) {
26         hax_cpu_synchronize_state(cpu);
27     }
28     if (hvf_enabled()) {
29         hvf_cpu_synchronize_state(cpu);
30     }
31     if (whpx_enabled()) {
32         whpx_cpu_synchronize_state(cpu);
33     }
34 }
35 
36 static inline void cpu_synchronize_post_reset(CPUState *cpu)
37 {
38     if (kvm_enabled()) {
39         kvm_cpu_synchronize_post_reset(cpu);
40     }
41     if (hax_enabled()) {
42         hax_cpu_synchronize_post_reset(cpu);
43     }
44     if (hvf_enabled()) {
45         hvf_cpu_synchronize_post_reset(cpu);
46     }
47     if (whpx_enabled()) {
48         whpx_cpu_synchronize_post_reset(cpu);
49     }
50 }
51 
52 static inline void cpu_synchronize_post_init(CPUState *cpu)
53 {
54     if (kvm_enabled()) {
55         kvm_cpu_synchronize_post_init(cpu);
56     }
57     if (hax_enabled()) {
58         hax_cpu_synchronize_post_init(cpu);
59     }
60     if (hvf_enabled()) {
61         hvf_cpu_synchronize_post_init(cpu);
62     }
63     if (whpx_enabled()) {
64         whpx_cpu_synchronize_post_init(cpu);
65     }
66 }
67 
68 static inline void cpu_synchronize_pre_loadvm(CPUState *cpu)
69 {
70     if (kvm_enabled()) {
71         kvm_cpu_synchronize_pre_loadvm(cpu);
72     }
73     if (hax_enabled()) {
74         hax_cpu_synchronize_pre_loadvm(cpu);
75     }
76     if (hvf_enabled()) {
77         hvf_cpu_synchronize_pre_loadvm(cpu);
78     }
79     if (whpx_enabled()) {
80         whpx_cpu_synchronize_pre_loadvm(cpu);
81     }
82 }
83 
84 #endif /* QEMU_HW_ACCEL_H */
85