aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilippe Mathieu-Daudé <philmd@linaro.org>2026-02-10 11:34:48 +0000
committerPeter Maydell <peter.maydell@linaro.org>2026-02-10 11:34:48 +0000
commit7ca22ae3e6e451d3aec3414d77d93d83ebd51cd9 (patch)
tree7367b68c25f0a11e232ace6fdb700b626960138d
parentd30b420c9cc4a0fe6882c7e6db5795948fed0352 (diff)
downloadqemu-7ca22ae3e6e451d3aec3414d77d93d83ebd51cd9.tar.gz
qemu-7ca22ae3e6e451d3aec3414d77d93d83ebd51cd9.tar.bz2
qemu-7ca22ae3e6e451d3aec3414d77d93d83ebd51cd9.zip
accel/system: Introduce hwaccel_enabled() helper
hwaccel_enabled() return whether any hardware accelerator is enabled. Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org> Reviewed-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-rw-r--r--include/system/hw_accel.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/include/system/hw_accel.h b/include/system/hw_accel.h
index 55497edc29..628a50e066 100644
--- a/include/system/hw_accel.h
+++ b/include/system/hw_accel.h
@@ -40,4 +40,17 @@ void cpu_synchronize_pre_loadvm(CPUState *cpu);
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 */