hwaccel_enabled() return whether any hardware accelerator
is available.
Signed-off-by: Philippe Mathieu-Daudé <[email protected]>
---
include/system/hw_accel.h | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/include/system/hw_accel.h b/include/system/hw_accel.h
index 574c9738408..49556b026e0 100644
--- a/include/system/hw_accel.h
+++ b/include/system/hw_accel.h
@@ -28,7 +28,28 @@
void cpu_synchronize_state(CPUState *cpu);
void cpu_synchronize_pre_loadvm(CPUState *cpu);
+/**
+ * cpu_synchronize_post_reset:
+ * cpu_synchronize_post_init:
+ * @cpu: The vCPU to synchronize.
+ *
+ * Request to synchronize QEMU vCPU registers to the hardware accelerator
+ * (QEMU is the reference).
+ */
void cpu_synchronize_post_reset(CPUState *cpu);
void cpu_synchronize_post_init(CPUState *cpu);
+/**
+ * hwaccel_enabled:
+ *
+ * Returns: %true if a hardware accelerator is enabled, %false otherwise.
+ */
+static inline bool hwaccel_enabled(void)
+{
+ return hvf_enabled()
+ || kvm_enabled()
+ || nvmm_enabled()
+ || whpx_enabled();
+}
+
#endif /* QEMU_HW_ACCEL_H */
--
2.49.0