qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: qemu-devel@nongnu.org
Cc: "Alex Bennée" <alex.bennee@linaro.org>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Pierrick Bouvier" <pierrick.bouvier@linaro.org>,
	kvm@vger.kernel.org,
	"Richard Henderson" <richard.henderson@linaro.org>,
	"Philippe Mathieu-Daudé" <philmd@linaro.org>,
	"Cameron Esfahani" <dirty@apple.com>,
	"Roman Bolshakov" <rbolshakov@ddn.com>,
	"Phil Dennis-Jordan" <phil@philjordan.eu>,
	"Mads Ynddal" <mads@ynddal.dk>, "Fabiano Rosas" <farosas@suse.de>,
	"Laurent Vivier" <lvivier@redhat.com>,
	"Stefano Stabellini" <sstabellini@kernel.org>,
	"Anthony PERARD" <anthony@xenproject.org>,
	"Paul Durrant" <paul@xen.org>,
	"Edgar E. Iglesias" <edgar.iglesias@gmail.com>,
	"Warner Losh" <imp@bsdimp.com>, "Kyle Evans" <kevans@freebsd.org>,
	"Reinoud Zandijk" <reinoud@netbsd.org>,
	"Sunil Muthuswamy" <sunilmut@microsoft.com>,
	xen-devel@lists.xenproject.org
Subject: [PATCH v5 10/69] accel: Propagate AccelState to AccelClass::init_machine()
Date: Thu,  3 Jul 2025 12:54:36 +0200	[thread overview]
Message-ID: <20250703105540.67664-11-philmd@linaro.org> (raw)
In-Reply-To: <20250703105540.67664-1-philmd@linaro.org>

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>
---
 include/qemu/accel.h        | 2 +-
 accel/accel-system.c        | 2 +-
 accel/hvf/hvf-accel-ops.c   | 2 +-
 accel/kvm/kvm-all.c         | 2 +-
 accel/qtest/qtest.c         | 2 +-
 accel/tcg/tcg-all.c         | 2 +-
 accel/xen/xen-all.c         | 2 +-
 bsd-user/main.c             | 2 +-
 linux-user/main.c           | 2 +-
 target/i386/nvmm/nvmm-all.c | 2 +-
 target/i386/whpx/whpx-all.c | 2 +-
 11 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/include/qemu/accel.h b/include/qemu/accel.h
index 9dea3145429..b9a9b3593d8 100644
--- a/include/qemu/accel.h
+++ b/include/qemu/accel.h
@@ -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);
 
diff --git a/accel/accel-system.c b/accel/accel-system.c
index 64bc991b1ce..913b7155d77 100644
--- a/accel/accel-system.c
+++ b/accel/accel-system.c
@@ -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;
diff --git a/accel/hvf/hvf-accel-ops.c b/accel/hvf/hvf-accel-ops.c
index b9511103a75..6af849450e1 100644
--- a/accel/hvf/hvf-accel-ops.c
+++ b/accel/hvf/hvf-accel-ops.c
@@ -321,7 +321,7 @@ static void dummy_signal(int sig)
 
 bool hvf_allowed;
 
-static int hvf_accel_init(MachineState *ms)
+static int hvf_accel_init(AccelState *as, MachineState *ms)
 {
     int x;
     hv_return_t ret;
diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c
index 17235f26464..264f288dc64 100644
--- a/accel/kvm/kvm-all.c
+++ b/accel/kvm/kvm-all.c
@@ -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[] =
diff --git a/accel/qtest/qtest.c b/accel/qtest/qtest.c
index 92bed9264ce..8b109d4c03b 100644
--- a/accel/qtest/qtest.c
+++ b/accel/qtest/qtest.c
@@ -37,7 +37,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;
 }
diff --git a/accel/tcg/tcg-all.c b/accel/tcg/tcg-all.c
index 6e5dc333d59..d68fbb23773 100644
--- a/accel/tcg/tcg-all.c
+++ b/accel/tcg/tcg-all.c
@@ -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;
diff --git a/accel/xen/xen-all.c b/accel/xen/xen-all.c
index de52a8f882a..1117f52bef0 100644
--- a/accel/xen/xen-all.c
+++ b/accel/xen/xen-all.c
@@ -76,7 +76,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);
 
diff --git a/bsd-user/main.c b/bsd-user/main.c
index 7c0a059c3ba..d0cc8e0088f 100644
--- a/bsd-user/main.c
+++ b/bsd-user/main.c
@@ -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);
     }
 
     /*
diff --git a/linux-user/main.c b/linux-user/main.c
index 5ac5b55dc65..a9142ee7268 100644
--- a/linux-user/main.c
+++ b/linux-user/main.c
@@ -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);
     }
 
     /*
diff --git a/target/i386/nvmm/nvmm-all.c b/target/i386/nvmm/nvmm-all.c
index f1c6120ccf1..eaae175aa5d 100644
--- a/target/i386/nvmm/nvmm-all.c
+++ b/target/i386/nvmm/nvmm-all.c
@@ -1153,7 +1153,7 @@ static struct RAMBlockNotifier nvmm_ram_notifier = {
 /* -------------------------------------------------------------------------- */
 
 static int
-nvmm_accel_init(MachineState *ms)
+nvmm_accel_init(AccelState *as, MachineState *ms)
 {
     int ret, err;
 
diff --git a/target/i386/whpx/whpx-all.c b/target/i386/whpx/whpx-all.c
index cf6d3e4cdd4..f0be840b7db 100644
--- a/target/i386/whpx/whpx-all.c
+++ b/target/i386/whpx/whpx-all.c
@@ -2505,7 +2505,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;
-- 
2.49.0



  parent reply	other threads:[~2025-07-03 11:06 UTC|newest]

Thread overview: 87+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-03 10:54 [PATCH v5 00/69] accel: Preparatory cleanups for split-accel Philippe Mathieu-Daudé
2025-07-03 10:54 ` [PATCH v5 01/69] system/memory: Restrict eventfd dispatch_write() to emulators Philippe Mathieu-Daudé
2025-07-03 10:54 ` [PATCH v5 02/69] system/runstate: Document qemu_add_vm_change_state_handler() Philippe Mathieu-Daudé
2025-07-03 10:54 ` [PATCH v5 03/69] system/cpus: Defer memory layout changes until vCPUs are realized Philippe Mathieu-Daudé
2025-07-03 10:54 ` [PATCH v5 04/69] system/cpus: Assert interrupt handling is done with BQL locked Philippe Mathieu-Daudé
2025-07-03 10:54 ` [PATCH v5 05/69] accel: Keep reference to AccelOpsClass in AccelClass Philippe Mathieu-Daudé
2025-07-03 10:54 ` [PATCH v5 06/69] accel: Introduce AccelOpsClass::cpu_target_realize() hook Philippe Mathieu-Daudé
2025-07-03 10:54 ` [PATCH v5 07/69] accel/hvf: Add hvf_arch_cpu_realize() stubs Philippe Mathieu-Daudé
2025-07-03 10:54 ` [PATCH v5 08/69] accel/kvm: Remove kvm_init_cpu_signals() stub Philippe Mathieu-Daudé
2025-07-03 10:54 ` [PATCH v5 09/69] accel/kvm: Reduce kvm_create_vcpu() declaration scope Philippe Mathieu-Daudé
2025-07-03 10:54 ` Philippe Mathieu-Daudé [this message]
2025-07-03 10:54 ` [PATCH v5 11/69] accel/kvm: Prefer local AccelState over global MachineState::accel Philippe Mathieu-Daudé
2025-07-03 10:54 ` [PATCH v5 12/69] accel/hvf: Re-use QOM allocated state Philippe Mathieu-Daudé
2025-07-03 10:54 ` [PATCH v5 13/69] accel/tcg: Prefer local AccelState over global current_accel() Philippe Mathieu-Daudé
2025-07-03 10:54 ` [PATCH v5 14/69] accel: Directly pass AccelState argument to AccelClass::has_memory() Philippe Mathieu-Daudé
2025-07-03 10:54 ` [PATCH v5 15/69] accel/kvm: Directly pass KVMState argument to do_kvm_create_vm() Philippe Mathieu-Daudé
2025-07-03 10:54 ` [PATCH v5 16/69] accel: Remove unused MachineState argument of AccelClass::setup_post() Philippe Mathieu-Daudé
2025-07-03 10:54 ` [PATCH v5 17/69] accel: Pass AccelState argument to gdbstub_supported_sstep_flags() Philippe Mathieu-Daudé
2025-07-03 10:54 ` [PATCH v5 18/69] accel: Move supports_guest_debug() declaration to AccelClass Philippe Mathieu-Daudé
2025-07-03 10:54 ` [PATCH v5 19/69] accel: Move cpus_are_resettable() " Philippe Mathieu-Daudé
2025-07-03 10:54 ` [PATCH v5 20/69] accel: Move cpu_common_[un]realize() declarations to AccelOpsClass Philippe Mathieu-Daudé
2025-07-03 14:50   ` Philippe Mathieu-Daudé
2025-07-03 10:54 ` [PATCH v5 21/69] accel/system: Convert pre_resume() from AccelOpsClass to AccelClass Philippe Mathieu-Daudé
2025-07-03 10:54 ` [PATCH v5 22/69] hw/core/machine: Display CPU model name in 'info cpus' command Philippe Mathieu-Daudé
2025-07-03 10:54 ` [PATCH v5 23/69] accel/tcg: Remove 'info opcount' and @x-query-opcount Philippe Mathieu-Daudé
2025-07-03 11:32   ` Dr. David Alan Gilbert
2025-07-03 17:12   ` Richard Henderson
2025-07-03 10:54 ` [PATCH v5 24/69] accel/tcg: Remove profiler leftover Philippe Mathieu-Daudé
2025-07-03 17:12   ` Richard Henderson
2025-07-03 10:54 ` [PATCH v5 25/69] accel/tcg: Factor tcg_dump_flush_info() out Philippe Mathieu-Daudé
2025-07-03 10:54 ` [PATCH v5 26/69] accel/tcg: Factor tcg_dump_stats() out for re-use Philippe Mathieu-Daudé
2025-07-03 10:54 ` [PATCH v5 27/69] accel/tcg: Extract statistic related code to tcg-stats.c Philippe Mathieu-Daudé
2025-07-03 10:54 ` [PATCH v5 28/69] qapi: Move definitions related to accelerators in their own file Philippe Mathieu-Daudé
2025-07-03 16:42   ` Philippe Mathieu-Daudé
2025-07-15 17:29     ` Philippe Mathieu-Daudé
2025-07-16  8:23     ` Markus Armbruster
2025-07-16  9:24       ` Daniel P. Berrangé
2025-07-17  8:45         ` Philippe Mathieu-Daudé
2025-07-03 10:54 ` [PATCH v5 29/69] accel/system: Introduce @x-accel-stats QMP command Philippe Mathieu-Daudé
2025-07-03 10:54 ` [PATCH v5 30/69] accel/system: Add 'info accel' on human monitor Philippe Mathieu-Daudé
2025-07-03 10:54 ` [PATCH v5 31/69] accel/tcg: Implement get_[vcpu]_stats() Philippe Mathieu-Daudé
2025-07-03 10:54 ` [PATCH v5 32/69] accel/hvf: Implement get_vcpu_stats() Philippe Mathieu-Daudé
2025-07-03 10:54 ` [PATCH v5 33/69] accel/hvf: Report missing com.apple.security.hypervisor entitlement Philippe Mathieu-Daudé
2025-07-03 10:55 ` [PATCH v5 34/69] accel/hvf: Restrict internal declarations Philippe Mathieu-Daudé
2025-07-03 10:55 ` [PATCH v5 35/69] accel/hvf: Move per-cpu method declarations to hvf-accel-ops.c Philippe Mathieu-Daudé
2025-07-03 10:55 ` [PATCH v5 36/69] accel/hvf: Move generic method declarations to hvf-all.c Philippe Mathieu-Daudé
2025-07-03 10:55 ` [PATCH v5 37/69] cpus: Document CPUState::vcpu_dirty field Philippe Mathieu-Daudé
2025-07-03 10:55 ` [PATCH v5 38/69] accel/hvf: Replace @dirty field by generic " Philippe Mathieu-Daudé
2025-07-03 10:55 ` [PATCH v5 39/69] accel/nvmm: " Philippe Mathieu-Daudé
2025-07-03 10:55 ` [PATCH v5 40/69] accel/whpx: " Philippe Mathieu-Daudé
2025-07-03 10:55 ` [PATCH v5 41/69] accel/kvm: Remove kvm_cpu_synchronize_state() stub Philippe Mathieu-Daudé
2025-07-03 10:55 ` [PATCH v5 42/69] accel/system: Document cpu_synchronize_state() Philippe Mathieu-Daudé
2025-07-03 10:55 ` [PATCH v5 43/69] accel/system: Document cpu_synchronize_state_post_init/reset() Philippe Mathieu-Daudé
2025-07-03 10:55 ` [PATCH v5 44/69] accel/nvmm: Expose nvmm_enabled() to common code Philippe Mathieu-Daudé
2025-07-03 11:01   ` Philippe Mathieu-Daudé
2025-07-03 10:55 ` [PATCH v5 45/69] accel/whpx: Expose whpx_enabled() " Philippe Mathieu-Daudé
2025-07-03 11:02   ` Philippe Mathieu-Daudé
2025-07-03 10:55 ` [PATCH v5 46/69] accel/system: Introduce hwaccel_enabled() helper Philippe Mathieu-Daudé
2025-07-03 10:55 ` [PATCH v5 47/69] target/arm: Use generic hwaccel_enabled() to check 'host' cpu type Philippe Mathieu-Daudé
2025-07-03 13:45   ` Philippe Mathieu-Daudé
2025-07-03 13:46     ` Peter Maydell
2025-07-03 14:46       ` Philippe Mathieu-Daudé
2025-07-03 10:55 ` [PATCH v5 48/69] accel/dummy: Extract 'dummy-cpus.h' header from 'system/cpus.h' Philippe Mathieu-Daudé
2025-07-03 10:55 ` [PATCH v5 49/69] accel/dummy: Factor dummy_thread_precreate() out Philippe Mathieu-Daudé
2025-07-03 17:19   ` Richard Henderson
2025-07-03 10:55 ` [PATCH v5 50/69] accel/tcg: Factor tcg_vcpu_thread_precreate() out Philippe Mathieu-Daudé
2025-07-03 10:55 ` [PATCH v5 51/69] accel: Factor accel_create_vcpu_thread() out Philippe Mathieu-Daudé
2025-07-03 10:55 ` [PATCH v5 52/69] accel: Introduce AccelOpsClass::cpu_thread_routine handler Philippe Mathieu-Daudé
2025-07-03 10:55 ` [PATCH v5 53/69] accel/dummy: Convert to AccelOpsClass::cpu_thread_routine Philippe Mathieu-Daudé
2025-07-03 10:55 ` [PATCH v5 54/69] accel/tcg: " Philippe Mathieu-Daudé
2025-07-03 10:55 ` [PATCH v5 55/69] accel/hvf: " Philippe Mathieu-Daudé
2025-07-03 10:55 ` [PATCH v5 56/69] accel/kvm: " Philippe Mathieu-Daudé
2025-07-03 10:55 ` [PATCH v5 57/69] accel/nvmm: " Philippe Mathieu-Daudé
2025-07-03 10:55 ` [PATCH v5 58/69] accel/whpx: " Philippe Mathieu-Daudé
2025-07-03 10:55 ` [PATCH v5 59/69] accel: Factor accel_cpu_realize() out Philippe Mathieu-Daudé
2025-07-03 10:55 ` [PATCH v5 60/69] accel: Pass old/new interrupt mask to handle_interrupt() handler Philippe Mathieu-Daudé
2025-07-03 10:55 ` [PATCH v5 61/69] accel: Expose and register generic_handle_interrupt() Philippe Mathieu-Daudé
2025-07-03 17:21   ` Richard Henderson
2025-07-03 10:55 ` [PATCH v5 62/69] accel: Always register AccelOpsClass::kick_vcpu_thread() handler Philippe Mathieu-Daudé
2025-07-03 10:55 ` [PATCH v5 63/69] accel: Always register AccelOpsClass::get_elapsed_ticks() handler Philippe Mathieu-Daudé
2025-07-03 10:55 ` [PATCH v5 64/69] accel: Always register AccelOpsClass::get_virtual_clock() handler Philippe Mathieu-Daudé
2025-07-03 10:55 ` [PATCH v5 65/69] accel/tcg: Factor tcg_vcpu_init() out for re-use Philippe Mathieu-Daudé
2025-07-03 10:55 ` [PATCH v5 66/69] accel/tcg: Factor mttcg_cpu_exec() " Philippe Mathieu-Daudé
2025-07-03 10:55 ` [PATCH v5 67/69] accel/tcg: Factor rr_cpu_exec() out Philippe Mathieu-Daudé
2025-07-03 10:55 ` [PATCH v5 68/69] accel/tcg: Clear exit_request once in tcg_cpu_exec() Philippe Mathieu-Daudé
2025-07-03 10:55 ` [PATCH v5 69/69] accel/tcg: Unregister the RCU before exiting RR thread Philippe Mathieu-Daudé
2025-07-03 11:06 ` [PATCH v5 00/69] accel: Preparatory cleanups for split-accel Philippe Mathieu-Daudé

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250703105540.67664-11-philmd@linaro.org \
    --to=philmd@linaro.org \
    --cc=alex.bennee@linaro.org \
    --cc=anthony@xenproject.org \
    --cc=dirty@apple.com \
    --cc=edgar.iglesias@gmail.com \
    --cc=farosas@suse.de \
    --cc=imp@bsdimp.com \
    --cc=kevans@freebsd.org \
    --cc=kvm@vger.kernel.org \
    --cc=lvivier@redhat.com \
    --cc=mads@ynddal.dk \
    --cc=paul@xen.org \
    --cc=pbonzini@redhat.com \
    --cc=phil@philjordan.eu \
    --cc=pierrick.bouvier@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=rbolshakov@ddn.com \
    --cc=reinoud@netbsd.org \
    --cc=richard.henderson@linaro.org \
    --cc=sstabellini@kernel.org \
    --cc=sunilmut@microsoft.com \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).