| 1 | /* |
| 2 | * QEMU Hardware accelerators 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 "system/kvm.h" |
| 16 | #include "system/hvf.h" |
| 17 | #include "system/mshv.h" |
| 18 | #include "system/whpx.h" |
| 19 | #include "system/nvmm.h" |
| 20 | #include "system/nitro-accel.h" |
| 21 | |
| 22 | /** |
| 23 | * cpu_synchronize_state: |
| 24 | * cpu_synchronize_pre_loadvm: |
| 25 | * @cpu: The vCPU to synchronize. |
| 26 | * |
| 27 | * Request to synchronize QEMU vCPU registers from the hardware accelerator |
| 28 | * (the hardware accelerator is the reference). |
| 29 | */ |
| 30 | void cpu_synchronize_state(CPUState *cpu); |
| 31 | void cpu_synchronize_pre_loadvm(CPUState *cpu); |
| 32 | |
| 33 | /** |
| 34 | * cpu_synchronize_post_reset: |
| 35 | * cpu_synchronize_post_init: |
| 36 | * @cpu: The vCPU to synchronize. |
| 37 | * |
| 38 | * Request to synchronize QEMU vCPU registers to the hardware accelerator |
| 39 | * (QEMU is the reference). |
| 40 | */ |
| 41 | void cpu_synchronize_post_reset(CPUState *cpu); |
| 42 | void cpu_synchronize_post_init(CPUState *cpu); |
| 43 | |
| 44 | /** |
| 45 | * hwaccel_enabled: |
| 46 | * |
| 47 | * Returns: %true if a hardware accelerator is enabled, %false otherwise. |
| 48 | */ |
| 49 | static inline bool hwaccel_enabled(void) |
| 50 | { |
| 51 | return hvf_enabled() |
| 52 | || kvm_enabled() |
| 53 | || nvmm_enabled() |
| 54 | || whpx_enabled(); |
| 55 | } |
| 56 | |
| 57 | #endif /* QEMU_HW_ACCEL_H */ |