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/whpx.h" 18 19 static inline void cpu_synchronize_state(CPUState *cpu) 20 { 21 if (kvm_enabled()) { 22 kvm_cpu_synchronize_state(cpu); 23 } 24 if (hax_enabled()) { 25 hax_cpu_synchronize_state(cpu); 26 } 27 if (whpx_enabled()) { 28 whpx_cpu_synchronize_state(cpu); 29 } 30 } 31 32 static inline void cpu_synchronize_post_reset(CPUState *cpu) 33 { 34 if (kvm_enabled()) { 35 kvm_cpu_synchronize_post_reset(cpu); 36 } 37 if (hax_enabled()) { 38 hax_cpu_synchronize_post_reset(cpu); 39 } 40 if (whpx_enabled()) { 41 whpx_cpu_synchronize_post_reset(cpu); 42 } 43 } 44 45 static inline void cpu_synchronize_post_init(CPUState *cpu) 46 { 47 if (kvm_enabled()) { 48 kvm_cpu_synchronize_post_init(cpu); 49 } 50 if (hax_enabled()) { 51 hax_cpu_synchronize_post_init(cpu); 52 } 53 if (whpx_enabled()) { 54 whpx_cpu_synchronize_post_init(cpu); 55 } 56 } 57 58 static inline void cpu_synchronize_pre_loadvm(CPUState *cpu) 59 { 60 if (kvm_enabled()) { 61 kvm_cpu_synchronize_pre_loadvm(cpu); 62 } 63 if (hax_enabled()) { 64 hax_cpu_synchronize_pre_loadvm(cpu); 65 } 66 if (whpx_enabled()) { 67 whpx_cpu_synchronize_pre_loadvm(cpu); 68 } 69 } 70 71 #endif /* QEMU_HW_ACCEL_H */ 72