On 28/05/26, 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); > +}
I think this is a nice solution compared to including accel_target_c in every target/. Reviewed-by: Anton Johansson <[email protected]>
