]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
accel/system: Introduce hwaccel_enabled() helper
authorPhilippe Mathieu-Daudé <philmd@linaro.org>
Tue, 10 Feb 2026 11:34:48 +0000 (11:34 +0000)
committerPeter Maydell <peter.maydell@linaro.org>
Tue, 10 Feb 2026 11:34:48 +0000 (11:34 +0000)
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>
include/system/hw_accel.h

index 55497edc2936daf489e709efc5d29bae2c7475ed..628a50e066ec7c12843f29decca7bc326b2bb98f 100644 (file)
@@ -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 */