]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
accel: Extract AccelClass definition to 'accel/accel-ops.h'
authorPhilippe Mathieu-Daudé <philmd@linaro.org>
Thu, 3 Jul 2025 14:44:39 +0000 (16:44 +0200)
committerPhilippe Mathieu-Daudé <philmd@linaro.org>
Tue, 15 Jul 2025 17:34:33 +0000 (19:34 +0200)
Only accelerator implementations (and the common accelator
code) need to know about AccelClass internals. Move the
definition out but forward declare AccelState and AccelClass.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Zhao Liu <zhao1.liu@intel.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20250703173248.44995-39-philmd@linaro.org>

19 files changed:
MAINTAINERS
accel/accel-common.c
accel/accel-system.c
accel/hvf/hvf-all.c
accel/kvm/kvm-all.c
accel/qtest/qtest.c
accel/tcg/tcg-accel-ops.c
accel/tcg/tcg-all.c
accel/xen/xen-all.c
bsd-user/main.c
gdbstub/system.c
include/accel/accel-ops.h [new file with mode: 0644]
include/qemu/accel.h
include/system/hvf_int.h
include/system/kvm_int.h
linux-user/main.c
system/memory.c
target/i386/nvmm/nvmm-all.c
target/i386/whpx/whpx-all.c

index 0e945f3bd260abe12e32db2b580e9200764376b4..9d88c174331e7a6694721b9a4e57e4730394f567 100644 (file)
@@ -502,7 +502,7 @@ F: include/exec/target_long.h
 F: include/qemu/accel.h
 F: include/system/accel-*.h
 F: include/system/cpus.h
-F: include/accel/accel-cpu*.h
+F: include/accel/accel-*.h
 F: accel/accel-*.?
 F: accel/dummy-cpus.?
 F: accel/Makefile.objs
index 591ff4cbb654c6adb9232c16ee0c07e9b16fc6aa..850c5ab4b8e43ccac7a216ffa27005b8039f1787 100644 (file)
@@ -10,7 +10,9 @@
 #include "qemu/osdep.h"
 #include "qemu/accel.h"
 #include "qemu/target-info.h"
+#include "accel/accel-ops.h"
 #include "accel/accel-cpu.h"
+#include "accel/accel-cpu-ops.h"
 #include "accel-internal.h"
 
 /* Lookup AccelClass from opt_name. Returns NULL if not found */
index c2a955a6daab8ad47b82ecde1e5707e36041eecf..8df561b9539c01dac2bba4ad1c251db795fa8c16 100644 (file)
@@ -26,6 +26,7 @@
 #include "qemu/osdep.h"
 #include "qemu/accel.h"
 #include "hw/boards.h"
+#include "accel/accel-ops.h"
 #include "accel/accel-cpu-ops.h"
 #include "system/cpus.h"
 #include "qemu/error-report.h"
index 1fa07c8b69580168fcb891a386c901e2ac19736a..e67a8105a66a020ec98ae251eb61f7244d1a043a 100644 (file)
@@ -10,6 +10,7 @@
 
 #include "qemu/osdep.h"
 #include "qemu/error-report.h"
+#include "accel/accel-ops.h"
 #include "system/address-spaces.h"
 #include "system/memory.h"
 #include "system/hvf.h"
index a106d1ba0f0b04386f4a296640c3848a88099e6e..659ff881563a23bec013ddf925990e29138218bb 100644 (file)
@@ -32,6 +32,7 @@
 #include "system/runstate.h"
 #include "system/cpus.h"
 #include "system/accel-blocker.h"
+#include "accel/accel-ops.h"
 #include "qemu/bswap.h"
 #include "exec/tswap.h"
 #include "system/memory.h"
index a7fc8bee6dd8117b7fad6fd4096ab36de5865609..1d4337d698e6cb2419c88fac1496308c023746c7 100644 (file)
@@ -18,6 +18,7 @@
 #include "qemu/option.h"
 #include "qemu/config-file.h"
 #include "qemu/accel.h"
+#include "accel/accel-ops.h"
 #include "accel/accel-cpu-ops.h"
 #include "system/qtest.h"
 #include "system/cpus.h"
index 58ded9d6f0d6e0147ee786b8077c64f101506854..3b0d7d298e61f6c619f66b65ead1fd5be60e2f10 100644 (file)
@@ -26,6 +26,7 @@
  */
 
 #include "qemu/osdep.h"
+#include "accel/accel-ops.h"
 #include "accel/accel-cpu-ops.h"
 #include "system/tcg.h"
 #include "system/replay.h"
index 5904582a68da7cbd79c21a5349a73a15e38f0cdf..eaeb465dfd588cbff8e458110aaeaefbf2195d39 100644 (file)
@@ -39,6 +39,8 @@
 #ifndef CONFIG_USER_ONLY
 #include "hw/boards.h"
 #endif
+#include "accel/accel-ops.h"
+#include "accel/accel-cpu-ops.h"
 #include "accel/tcg/cpu-ops.h"
 #include "internal-common.h"
 
index 55a60bb42c2d068f5d85375d3074a9823af79a09..97377d67d1c1dcd100e0e75fdec51b5e64fea208 100644 (file)
@@ -19,6 +19,7 @@
 #include "chardev/char.h"
 #include "qemu/accel.h"
 #include "accel/dummy-cpus.h"
+#include "accel/accel-ops.h"
 #include "accel/accel-cpu-ops.h"
 #include "system/cpus.h"
 #include "system/xen.h"
index d0cc8e0088f328921b3246a71dacd69e61b79188..7e5d4bbce09420ec715bc08933767d4c7a0fc86f 100644 (file)
@@ -38,6 +38,7 @@
 #include "qemu/plugin.h"
 #include "user/guest-base.h"
 #include "user/page-protection.h"
+#include "accel/accel-ops.h"
 #include "tcg/startup.h"
 #include "qemu/timer.h"
 #include "qemu/envlist.h"
index 5b6f8d073346c59442625454825f87edcd358672..5be0d3c58cec5db7c8d1b8c6c32af5005e6859dd 100644 (file)
@@ -19,6 +19,7 @@
 #include "gdbstub/commands.h"
 #include "exec/hwaddr.h"
 #include "exec/tb-flush.h"
+#include "accel/accel-ops.h"
 #include "accel/accel-cpu-ops.h"
 #include "system/cpus.h"
 #include "system/runstate.h"
diff --git a/include/accel/accel-ops.h b/include/accel/accel-ops.h
new file mode 100644 (file)
index 0000000..86a27c3
--- /dev/null
@@ -0,0 +1,49 @@
+/*
+ * Accelerator handlers
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+#ifndef ACCEL_OPS_H
+#define ACCEL_OPS_H
+
+#include "exec/hwaddr.h"
+#include "qemu/accel.h"
+#include "qom/object.h"
+
+struct AccelState {
+    Object parent_obj;
+};
+
+struct AccelClass {
+    ObjectClass parent_class;
+
+    const char *name;
+    /* Cached by accel_init_ops_interfaces() when created */
+    AccelOpsClass *ops;
+
+    int (*init_machine)(AccelState *as, MachineState *ms);
+    bool (*cpu_common_realize)(CPUState *cpu, Error **errp);
+    void (*cpu_common_unrealize)(CPUState *cpu);
+
+    /* system related hooks */
+    void (*setup_post)(AccelState *as);
+    void (*pre_resume_vm)(AccelState *as, bool step_pending);
+    bool (*has_memory)(AccelState *accel, AddressSpace *as,
+                       hwaddr start_addr, hwaddr size);
+
+    /* gdbstub related hooks */
+    int (*gdbstub_supported_sstep_flags)(AccelState *as);
+
+    bool *allowed;
+    /*
+     * Array of global properties that would be applied when specific
+     * accelerator is chosen. It works like MachineClass.compat_props
+     * but it's for accelerators not machines. Accelerator-provided
+     * global properties may be overridden by machine-type
+     * compat_props or user-provided global properties.
+     */
+    GPtrArray *compat_props;
+};
+
+#endif /* ACCEL_OPS_H */
index 9e821d0faeae7d2ffd586bae5c4fccc059c0b429..d3638c7bfda7355be7800fad3ff15d7768f36608 100644 (file)
 #include "qom/object.h"
 #include "exec/hwaddr.h"
 
-struct AccelState {
-    /*< private >*/
-    Object parent_obj;
-};
-
-typedef struct AccelClass {
-    /*< private >*/
-    ObjectClass parent_class;
-    /*< public >*/
-
-    const char *name;
-    /* Cached by accel_init_ops_interfaces() when created */
-    AccelOpsClass *ops;
-
-    int (*init_machine)(AccelState *as, MachineState *ms);
-    bool (*cpu_common_realize)(CPUState *cpu, Error **errp);
-    void (*cpu_common_unrealize)(CPUState *cpu);
-
-    /* system related hooks */
-    void (*setup_post)(AccelState *as);
-    void (*pre_resume_vm)(AccelState *as, bool step_pending);
-    bool (*has_memory)(AccelState *accel, AddressSpace *as,
-                       hwaddr start_addr, hwaddr size);
-
-    /* gdbstub related hooks */
-    int (*gdbstub_supported_sstep_flags)(AccelState *as);
-
-    bool *allowed;
-    /*
-     * Array of global properties that would be applied when specific
-     * accelerator is chosen. It works like MachineClass.compat_props
-     * but it's for accelerators not machines. Accelerator-provided
-     * global properties may be overridden by machine-type
-     * compat_props or user-provided global properties.
-     */
-    GPtrArray *compat_props;
-} AccelClass;
+typedef struct AccelState AccelState;
+typedef struct AccelClass AccelClass;
 
 #define TYPE_ACCEL "accel"
 
index 5150c7dd9c9cbf98200b70cf2a9bbaf1e94718bf..a3b06a3e75b6d521b7ecd1617498a1c8527d71d0 100644 (file)
@@ -14,6 +14,7 @@
 #include "qemu/queue.h"
 #include "exec/vaddr.h"
 #include "qom/object.h"
+#include "accel/accel-ops.h"
 
 #ifdef __aarch64__
 #include <Hypervisor/Hypervisor.h>
@@ -45,7 +46,7 @@ typedef struct hvf_vcpu_caps {
 } hvf_vcpu_caps;
 
 struct HVFState {
-    AccelState parent;
+    AccelState parent_obj;
 
     hvf_slot slots[32];
     int num_slots;
index 756a3c0a250e36e14e1215a27320f6db0c08b137..9247493b029912547e284c5177fe9b6ee10e6b04 100644 (file)
@@ -14,6 +14,7 @@
 #include "qemu/accel.h"
 #include "qemu/queue.h"
 #include "system/kvm.h"
+#include "accel/accel-ops.h"
 #include "hw/boards.h"
 #include "hw/i386/topology.h"
 #include "io/channel-socket.h"
index f4f20074396201ddde7d38cd833975b8d064a1c0..68972f00a155a14fd47bb93aa64733bfa332e3c8 100644 (file)
@@ -42,6 +42,7 @@
 #include "user/page-protection.h"
 #include "exec/gdbstub.h"
 #include "gdbstub/user.h"
+#include "accel/accel-ops.h"
 #include "tcg/startup.h"
 #include "qemu/timer.h"
 #include "qemu/envlist.h"
index e8d9b15b28f6bb95c52afef9457e12478b3d1083..0983ff896222b3a86719c9b3532eb8b970290b48 100644 (file)
@@ -29,6 +29,7 @@
 #include "system/runstate.h"
 #include "system/tcg.h"
 #include "qemu/accel.h"
+#include "accel/accel-ops.h"
 #include "hw/boards.h"
 #include "migration/vmstate.h"
 #include "system/address-spaces.h"
index b4a4d50e86081dee3ab199ca3ef0c8a181f1a028..aab12d7732655bc0d8cad007193b0e6d0d35bab7 100644 (file)
@@ -12,6 +12,7 @@
 #include "system/address-spaces.h"
 #include "system/ioport.h"
 #include "qemu/accel.h"
+#include "accel/accel-ops.h"
 #include "system/nvmm.h"
 #include "system/cpus.h"
 #include "system/runstate.h"
index faf56e19722881a7a6571d4aa6559ed10fd26d54..10df2d398f7648e3c8e435c26aefdd7a9d943dc7 100644 (file)
@@ -14,6 +14,7 @@
 #include "system/ioport.h"
 #include "gdbstub/helpers.h"
 #include "qemu/accel.h"
+#include "accel/accel-ops.h"
 #include "system/whpx.h"
 #include "system/cpus.h"
 #include "system/runstate.h"