Message ID | 20250424222112.36194-17-philmd@linaro.org |
---|---|
State | New |
Headers | show |
Series | single-binary: Make hw/arm/ common | expand |
On 4/24/25 15:21, Philippe Mathieu-Daudé wrote: > It is not possible to call accelerator runtime helpers > when QOM types are registered, because they depend on > the parsing of the '-accel FOO' command line option, > which happens after main(). > > Now than get_valid_cpu_types() is called after > accelerator initializations, it is safe to call the > accelerator helpers: > > main > + configure_accelerators > + qmp_x_exit_preconfig > + qemu_init_board > + machine_run_board_init > + is_cpu_type_supported > > Replace compile-time check on CONFIG_{ACCEL} by > runtime check on {accel}_enabled() helpers. > > Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> > Reviewed-by: Richard Henderson <richard.henderson@linaro.org> > --- > hw/arm/virt.c | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) > Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
diff --git a/hw/arm/virt.c b/hw/arm/virt.c index f29f541ea93..13aa2f34c6c 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -3130,7 +3130,7 @@ static GPtrArray *virt_get_valid_cpu_types(const MachineState *ms) { GPtrArray *vct = g_ptr_array_new_with_free_func(g_free); -#ifdef CONFIG_TCG + if (tcg_enabled()) { g_ptr_array_add(vct, g_strdup(ARM_CPU_TYPE_NAME("cortex-a7"))); g_ptr_array_add(vct, g_strdup(ARM_CPU_TYPE_NAME("cortex-a15"))); #ifdef TARGET_AARCH64 @@ -3144,13 +3144,13 @@ static GPtrArray *virt_get_valid_cpu_types(const MachineState *ms) g_ptr_array_add(vct, g_strdup(ARM_CPU_TYPE_NAME("neoverse-v1"))); g_ptr_array_add(vct, g_strdup(ARM_CPU_TYPE_NAME("neoverse-n2"))); #endif /* TARGET_AARCH64 */ -#endif /* CONFIG_TCG */ + } #ifdef TARGET_AARCH64 g_ptr_array_add(vct, g_strdup(ARM_CPU_TYPE_NAME("cortex-a53"))); g_ptr_array_add(vct, g_strdup(ARM_CPU_TYPE_NAME("cortex-a57"))); -#if defined(CONFIG_KVM) || defined(CONFIG_HVF) + if (kvm_enabled() || hvf_enabled()) { g_ptr_array_add(vct, g_strdup(ARM_CPU_TYPE_NAME("host"))); -#endif /* CONFIG_KVM || CONFIG_HVF */ + } #endif /* TARGET_AARCH64 */ g_ptr_array_add(vct, g_strdup(ARM_CPU_TYPE_NAME("max")));