@samitouri / QOSamiQemu / commits / e098ba351c

accel/common: Remove last bit of target-specific code

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é <philmd@linaro.org> Reviewed-by: Anton Johansson <anjo@rev.ng> Reviewed-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com> Message-Id: <20260528140857.44130-1-philmd@linaro.org>

Philippe Mathieu-Daudé committed May 28, 2026 at 16:00 UTC e098ba351c01e153776d92a1de6e71f47072dc7b
3 files changed +15 -42
accel/accel-common.c
+15
@@ -134,3 +134,18 @@ static const TypeInfo accel_types[] = {
134 };
135
136 DEFINE_TYPES(accel_types)
137 +
138 +static void register_accel_target_type(void)
139 +{
140 + g_autofree char *name = g_strconcat("accel-", target_cpu_type(), NULL);
141 + const TypeInfo accel_cpu_type = {
142 + .name = name,
143 + .parent = TYPE_OBJECT,
144 + .abstract = true,
145 + .class_size = sizeof(AccelCPUClass),
146 + };
147 +
148 + type_register_static(&accel_cpu_type);
149 +}
150 +
151 +type_init(register_accel_target_type);
accel/accel-target.c deleted
-41
@@ -1,41 +0,0 @@
1 -/*
2 - * QEMU accel class, components common to system emulation and user mode
3 - *
4 - * Copyright (c) 2003-2008 Fabrice Bellard
5 - * Copyright (c) 2014 Red Hat Inc.
6 - *
7 - * Permission is hereby granted, free of charge, to any person obtaining a copy
8 - * of this software and associated documentation files (the "Software"), to deal
9 - * in the Software without restriction, including without limitation the rights
10 - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 - * copies of the Software, and to permit persons to whom the Software is
12 - * furnished to do so, subject to the following conditions:
13 - *
14 - * The above copyright notice and this permission notice shall be included in
15 - * all copies or substantial portions of the Software.
16 - *
17 - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20 - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23 - * THE SOFTWARE.
24 - */
25 -
26 -#include "qemu/osdep.h"
27 -#include "accel/accel-cpu-target.h"
28 -
29 -static const TypeInfo accel_cpu_type = {
30 - .name = TYPE_ACCEL_CPU,
31 - .parent = TYPE_OBJECT,
32 - .abstract = true,
33 - .class_size = sizeof(AccelCPUClass),
34 -};
35 -
36 -static void register_accel_types(void)
37 -{
38 - type_register_static(&accel_cpu_type);
39 -}
40 -
41 -type_init(register_accel_types);
accel/meson.build
-1
@@ -1,5 +1,4 @@
1 common_ss.add(files('accel-common.c'))
2 -specific_ss.add(files('accel-target.c'))
2 system_ss.add(files('accel-system.c', 'accel-blocker.c', 'accel-qmp.c', 'accel-irq.c'))
3 user_ss.add(files('accel-user.c'))
4