diff options
author | Claudio Fontana <cfontana@suse.de> | 2021-02-04 17:39:25 +0100 |
---|---|---|
committer | Richard Henderson <richard.henderson@linaro.org> | 2021-02-05 10:24:15 -1000 |
commit | b86f59c71552591a17dd21ba8f09654bfa19a31e (patch) | |
tree | c73b9240fa6c4dbf46fdf1b67d65f7d283997589 /target/i386/hax | |
parent | 940e43aa30e0f793bd18b79221296cdf17724018 (diff) | |
download | qemu-b86f59c71552591a17dd21ba8f09654bfa19a31e.zip qemu-b86f59c71552591a17dd21ba8f09654bfa19a31e.tar.gz qemu-b86f59c71552591a17dd21ba8f09654bfa19a31e.tar.bz2 |
accel: replace struct CpusAccel with AccelOpsClass
This will allow us to centralize the registration of
the cpus.c module accelerator operations (in accel/accel-softmmu.c),
and trigger it automatically using object hierarchy lookup from the
new accel_init_interfaces() initialization step, depending just on
which accelerators are available in the code.
Rename all tcg-cpus.c, kvm-cpus.c, etc to tcg-accel-ops.c,
kvm-accel-ops.c, etc, matching the object type names.
Signed-off-by: Claudio Fontana <cfontana@suse.de>
Message-Id: <20210204163931.7358-18-cfontana@suse.de>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Diffstat (limited to 'target/i386/hax')
-rw-r--r-- | target/i386/hax/hax-accel-ops.c (renamed from target/i386/hax/hax-cpus.c) | 33 | ||||
-rw-r--r-- | target/i386/hax/hax-accel-ops.h (renamed from target/i386/hax/hax-cpus.h) | 2 | ||||
-rw-r--r-- | target/i386/hax/hax-all.c | 5 | ||||
-rw-r--r-- | target/i386/hax/hax-mem.c | 2 | ||||
-rw-r--r-- | target/i386/hax/hax-posix.c | 2 | ||||
-rw-r--r-- | target/i386/hax/hax-windows.c | 2 | ||||
-rw-r--r-- | target/i386/hax/hax-windows.h | 2 | ||||
-rw-r--r-- | target/i386/hax/meson.build | 2 |
8 files changed, 31 insertions, 19 deletions
diff --git a/target/i386/hax/hax-cpus.c b/target/i386/hax/hax-accel-ops.c index f72c85b..136630e 100644 --- a/target/i386/hax/hax-cpus.c +++ b/target/i386/hax/hax-accel-ops.c @@ -26,7 +26,7 @@ #include "sysemu/cpus.h" #include "qemu/guest-random.h" -#include "hax-cpus.h" +#include "hax-accel-ops.h" static void *hax_cpu_thread_fn(void *arg) { @@ -74,12 +74,29 @@ static void hax_start_vcpu_thread(CPUState *cpu) #endif } -const CpusAccel hax_cpus = { - .create_vcpu_thread = hax_start_vcpu_thread, - .kick_vcpu_thread = hax_kick_vcpu_thread, +static void hax_accel_ops_class_init(ObjectClass *oc, void *data) +{ + AccelOpsClass *ops = ACCEL_OPS_CLASS(oc); + + ops->create_vcpu_thread = hax_start_vcpu_thread; + ops->kick_vcpu_thread = hax_kick_vcpu_thread; + + ops->synchronize_post_reset = hax_cpu_synchronize_post_reset; + ops->synchronize_post_init = hax_cpu_synchronize_post_init; + ops->synchronize_state = hax_cpu_synchronize_state; + ops->synchronize_pre_loadvm = hax_cpu_synchronize_pre_loadvm; +} - .synchronize_post_reset = hax_cpu_synchronize_post_reset, - .synchronize_post_init = hax_cpu_synchronize_post_init, - .synchronize_state = hax_cpu_synchronize_state, - .synchronize_pre_loadvm = hax_cpu_synchronize_pre_loadvm, +static const TypeInfo hax_accel_ops_type = { + .name = ACCEL_OPS_NAME("hax"), + + .parent = TYPE_ACCEL_OPS, + .class_init = hax_accel_ops_class_init, + .abstract = true, }; + +static void hax_accel_ops_register_types(void) +{ + type_register_static(&hax_accel_ops_type); +} +type_init(hax_accel_ops_register_types); diff --git a/target/i386/hax/hax-cpus.h b/target/i386/hax/hax-accel-ops.h index ee8ab7a..c769851 100644 --- a/target/i386/hax/hax-cpus.h +++ b/target/i386/hax/hax-accel-ops.h @@ -12,8 +12,6 @@ #include "sysemu/cpus.h" -extern const CpusAccel hax_cpus; - #include "hax-interface.h" #include "hax-i386.h" diff --git a/target/i386/hax/hax-all.c b/target/i386/hax/hax-all.c index d7f4bb4..bf65ed6 100644 --- a/target/i386/hax/hax-all.c +++ b/target/i386/hax/hax-all.c @@ -33,7 +33,7 @@ #include "sysemu/runstate.h" #include "hw/boards.h" -#include "hax-cpus.h" +#include "hax-accel-ops.h" #define DEBUG_HAX 0 @@ -364,9 +364,6 @@ static int hax_accel_init(MachineState *ms) !ret ? "working" : "not working", !ret ? "fast virt" : "emulation"); } - if (ret == 0) { - cpus_register_accel(&hax_cpus); - } return ret; } diff --git a/target/i386/hax/hax-mem.c b/target/i386/hax/hax-mem.c index 71e637c..35495f5 100644 --- a/target/i386/hax/hax-mem.c +++ b/target/i386/hax/hax-mem.c @@ -13,7 +13,7 @@ #include "exec/address-spaces.h" #include "qemu/error-report.h" -#include "hax-cpus.h" +#include "hax-accel-ops.h" #include "qemu/queue.h" #define DEBUG_HAX_MEM 0 diff --git a/target/i386/hax/hax-posix.c b/target/i386/hax/hax-posix.c index 735a749..ac1a510 100644 --- a/target/i386/hax/hax-posix.c +++ b/target/i386/hax/hax-posix.c @@ -15,7 +15,7 @@ #include <sys/ioctl.h> #include "sysemu/cpus.h" -#include "hax-cpus.h" +#include "hax-accel-ops.h" hax_fd hax_mod_open(void) { diff --git a/target/i386/hax/hax-windows.c b/target/i386/hax/hax-windows.c index 6c82dfb..59afa21 100644 --- a/target/i386/hax/hax-windows.c +++ b/target/i386/hax/hax-windows.c @@ -12,7 +12,7 @@ #include "qemu/osdep.h" #include "cpu.h" -#include "hax-cpus.h" +#include "hax-accel-ops.h" /* * return 0 when success, -1 when driver not loaded, diff --git a/target/i386/hax/hax-windows.h b/target/i386/hax/hax-windows.h index a5ce12d..b1f5d4f3 100644 --- a/target/i386/hax/hax-windows.h +++ b/target/i386/hax/hax-windows.h @@ -23,7 +23,7 @@ #include <winioctl.h> #include <windef.h> -#include "hax-cpus.h" +#include "hax-accel-ops.h" #define HAX_INVALID_FD INVALID_HANDLE_VALUE diff --git a/target/i386/hax/meson.build b/target/i386/hax/meson.build index 77ea431..d6c520f 100644 --- a/target/i386/hax/meson.build +++ b/target/i386/hax/meson.build @@ -1,7 +1,7 @@ i386_softmmu_ss.add(when: 'CONFIG_HAX', if_true: files( 'hax-all.c', 'hax-mem.c', - 'hax-cpus.c', + 'hax-accel-ops.c', )) i386_softmmu_ss.add(when: ['CONFIG_HAX', 'CONFIG_POSIX'], if_true: files('hax-posix.c')) i386_softmmu_ss.add(when: ['CONFIG_HAX', 'CONFIG_WIN32'], if_true: files('hax-windows.c')) |