]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
accel: Propagate AccelState to AccelClass::init_machine()
authorPhilippe Mathieu-Daudé <philmd@linaro.org>
Fri, 6 Jun 2025 10:24:41 +0000 (12:24 +0200)
committerPhilippe Mathieu-Daudé <philmd@linaro.org>
Fri, 4 Jul 2025 10:08:44 +0000 (12:08 +0200)
In order to avoid init_machine() to call current_accel(),
pass AccelState along.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20250703173248.44995-31-philmd@linaro.org>

accel/accel-system.c
accel/hvf/hvf-all.c
accel/kvm/kvm-all.c
accel/qtest/qtest.c
accel/tcg/tcg-all.c
accel/xen/xen-all.c
bsd-user/main.c
include/qemu/accel.h
linux-user/main.c
target/i386/nvmm/nvmm-all.c
target/i386/whpx/whpx-all.c

index 64bc991b1ce70fe3e327bc562758ed54ad401ef9..913b7155d77ea837d323622ac7e438fce48e4ddb 100644 (file)
@@ -37,7 +37,7 @@ int accel_init_machine(AccelState *accel, MachineState *ms)
     int ret;
     ms->accelerator = accel;
     *(acc->allowed) = true;
-    ret = acc->init_machine(ms);
+    ret = acc->init_machine(accel, ms);
     if (ret < 0) {
         ms->accelerator = NULL;
         *(acc->allowed) = false;
index ddc77e629f5f09d957b99b670518127fa648106d..68f1425fae2681806abb99cca4479b561482e27c 100644 (file)
@@ -247,7 +247,7 @@ static MemoryListener hvf_memory_listener = {
     .log_sync = hvf_log_sync,
 };
 
-static int hvf_accel_init(MachineState *ms)
+static int hvf_accel_init(AccelState *as, MachineState *ms)
 {
     int x;
     hv_return_t ret;
index 17235f26464b78514ad823ae9044bbd3e9c829d2..264f288dc64b0986cee51164598201b19b9a578d 100644 (file)
@@ -2573,7 +2573,7 @@ static int kvm_setup_dirty_ring(KVMState *s)
     return 0;
 }
 
-static int kvm_init(MachineState *ms)
+static int kvm_init(AccelState *as, MachineState *ms)
 {
     MachineClass *mc = MACHINE_GET_CLASS(ms);
     static const char upgrade_note[] =
index 5474ce731359e560def426f3ea4f57a65ab8d720..2b8312602010c81c7da33dc9eda9b767ff724dc0 100644 (file)
@@ -38,7 +38,7 @@ static void qtest_set_virtual_clock(int64_t count)
     qatomic_set_i64(&qtest_clock_counter, count);
 }
 
-static int qtest_init_accel(MachineState *ms)
+static int qtest_init_accel(AccelState *as, MachineState *ms)
 {
     return 0;
 }
index 6e5dc333d59ebac34e9af946ca7e5cc37c0be898..d68fbb23773fb7078469efda5fd2278833ab576d 100644 (file)
@@ -80,7 +80,7 @@ static void tcg_accel_instance_init(Object *obj)
 
 bool one_insn_per_tb;
 
-static int tcg_init_machine(MachineState *ms)
+static int tcg_init_machine(AccelState *as, MachineState *ms)
 {
     TCGState *s = TCG_STATE(current_accel());
     unsigned max_threads = 1;
index c12c22de785076860902f5c087d45fe56f9c9186..8279746f115c1f2a9e9ffd89f1c9d662b026c6f1 100644 (file)
@@ -77,7 +77,7 @@ static void xen_setup_post(MachineState *ms, AccelState *accel)
     }
 }
 
-static int xen_init(MachineState *ms)
+static int xen_init(AccelState *as, MachineState *ms)
 {
     MachineClass *mc = MACHINE_GET_CLASS(ms);
 
index 7c0a059c3ba6fd35ff98349807963cad10e93670..d0cc8e0088f328921b3246a71dacd69e61b79188 100644 (file)
@@ -474,7 +474,7 @@ int main(int argc, char **argv)
                                  opt_one_insn_per_tb, &error_abort);
         object_property_set_int(OBJECT(accel), "tb-size",
                                 opt_tb_size, &error_abort);
-        ac->init_machine(NULL);
+        ac->init_machine(accel, NULL);
     }
 
     /*
index 9dea31454291cb65768598a7d63102ab72063137..b9a9b3593d81ffd926cca091fec6c294fe92067b 100644 (file)
@@ -40,7 +40,7 @@ typedef struct AccelClass {
     /* Cached by accel_init_ops_interfaces() when created */
     AccelOpsClass *ops;
 
-    int (*init_machine)(MachineState *ms);
+    int (*init_machine)(AccelState *as, MachineState *ms);
     bool (*cpu_common_realize)(CPUState *cpu, Error **errp);
     void (*cpu_common_unrealize)(CPUState *cpu);
 
index 5ac5b55dc65625d6079e00be17b06d6867e98d37..a9142ee726896ca0f746d981827f4d4167e5fb0c 100644 (file)
@@ -820,7 +820,7 @@ int main(int argc, char **argv, char **envp)
                                  opt_one_insn_per_tb, &error_abort);
         object_property_set_int(OBJECT(accel), "tb-size",
                                 opt_tb_size, &error_abort);
-        ac->init_machine(NULL);
+        ac->init_machine(accel, NULL);
     }
 
     /*
index 2df49d7eeb43eed28c99db71abc5314f05f0bef4..b4a4d50e86081dee3ab199ca3ef0c8a181f1a028 100644 (file)
@@ -1152,7 +1152,7 @@ static struct RAMBlockNotifier nvmm_ram_notifier = {
 /* -------------------------------------------------------------------------- */
 
 static int
-nvmm_accel_init(MachineState *ms)
+nvmm_accel_init(AccelState *as, MachineState *ms)
 {
     int ret, err;
 
index 94fd5fc7849032848658faf1f083bd714c28cf9d..721c4782b9c047553fe7b7669ae2ffcd3ddb75eb 100644 (file)
@@ -2504,7 +2504,7 @@ static void whpx_set_kernel_irqchip(Object *obj, Visitor *v,
  * Partition support
  */
 
-static int whpx_accel_init(MachineState *ms)
+static int whpx_accel_init(AccelState *as, MachineState *ms)
 {
     struct whpx_state *whpx;
     int ret;