Message ID | 20250620171342.92678-40-philmd@linaro.org |
---|---|
State | New |
Headers | show |
Series | accel: Preparatory cleanups for split-accel | expand |
On 6/20/25 10:13, Philippe Mathieu-Daudé wrote: > hwaccel_enabled() return whether any hardware accelerator > is available. > > Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> > --- > 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); This belongs to a previous patch. > > +/** > + * 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 */ But the rest is ok. Reviewed-by: Richard Henderson <richard.henderson@linaro.org> r~
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 */
hwaccel_enabled() return whether any hardware accelerator is available. Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> --- include/system/hw_accel.h | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+)