On 5/28/2026 11:47 AM, Pierrick Bouvier wrote: > On 5/28/2026 7:08 AM, Philippe Mathieu-Daudé wrote: >> Initialize the TypeInfo structure at runtime using the TargetInfo >> API to resolve TYPE_ACCEL_CPU, replacing CPU_RESOLVING_TYPE by >> target_cpu_type(). Since the code is no more target-specific, move >> it to accel-common.c, removing the need for accel-target.c. >> >> Signed-off-by: Philippe Mathieu-Daudé <[email protected]> >> --- >> Cc: Pierrick Bouvier <[email protected]> >> >> Pierrick, this is an alternative for both >> [email protected] >> and >> [email protected] >> for your "single-binary: fix compilation/execution for {arm, >> aarch32, microblaze}" series. WDYT? >> --- >> accel/accel-common.c | 15 +++++++++++++++ >> accel/accel-target.c | 41 ----------------------------------------- >> accel/meson.build | 1 - >> 3 files changed, 15 insertions(+), 42 deletions(-) >> delete mode 100644 accel/accel-target.c >> >> diff --git a/accel/accel-common.c b/accel/accel-common.c >> index 9c5b4111c8d..62590a7d9a6 100644 >> --- a/accel/accel-common.c >> +++ b/accel/accel-common.c >> @@ -134,3 +134,18 @@ static const TypeInfo accel_types[] = { >> }; >> >> DEFINE_TYPES(accel_types) >> + >> +static void register_accel_target_type(void) >> +{ >> + g_autofree char *name = g_strconcat("accel-", target_cpu_type(), NULL); >> + const TypeInfo accel_cpu_type = { >> + .name = name, >> + .parent = TYPE_OBJECT, >> + .abstract = true, >> + .class_size = sizeof(AccelCPUClass), >> + }; >> + >> + type_register_static(&accel_cpu_type); >> +} >> + >> +type_init(register_accel_target_type); >> diff --git a/accel/accel-target.c b/accel/accel-target.c >> deleted file mode 100644 >> index 7fd392fbc4a..00000000000 >> --- a/accel/accel-target.c >> +++ /dev/null >> @@ -1,41 +0,0 @@ >> -/* >> - * QEMU accel class, components common to system emulation and user mode >> - * >> - * Copyright (c) 2003-2008 Fabrice Bellard >> - * Copyright (c) 2014 Red Hat Inc. >> - * >> - * Permission is hereby granted, free of charge, to any person obtaining a >> copy >> - * of this software and associated documentation files (the "Software"), to >> deal >> - * in the Software without restriction, including without limitation the >> rights >> - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell >> - * copies of the Software, and to permit persons to whom the Software is >> - * furnished to do so, subject to the following conditions: >> - * >> - * The above copyright notice and this permission notice shall be included >> in >> - * all copies or substantial portions of the Software. >> - * >> - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS >> OR >> - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, >> - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL >> - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR >> OTHER >> - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING >> FROM, >> - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN >> - * THE SOFTWARE. >> - */ >> - >> -#include "qemu/osdep.h" >> -#include "accel/accel-cpu-target.h" >> - >> -static const TypeInfo accel_cpu_type = { >> - .name = TYPE_ACCEL_CPU, >> - .parent = TYPE_OBJECT, >> - .abstract = true, >> - .class_size = sizeof(AccelCPUClass), >> -}; >> - >> -static void register_accel_types(void) >> -{ >> - type_register_static(&accel_cpu_type); >> -} >> - >> -type_init(register_accel_types); >> diff --git a/accel/meson.build b/accel/meson.build >> index 7da12b9741f..1b5b37e3097 100644 >> --- a/accel/meson.build >> +++ b/accel/meson.build >> @@ -1,5 +1,4 @@ >> common_ss.add(files('accel-common.c')) >> -specific_ss.add(files('accel-target.c')) >> system_ss.add(files('accel-system.c', 'accel-blocker.c', 'accel-qmp.c', >> 'accel-irq.c')) >> user_ss.add(files('accel-user.c')) >> > > I'm open to follow this approach first . > The only downside is that it limits to a single accelerator parent type, > which will be a problem as soon as we have two arch using this framework > for tcg. Nothing we can't solve later though. > > Regards, > Pierrick
Forgot :) Reviewed-by: Pierrick Bouvier <[email protected]>
