qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: qemu-devel@nongnu.org
Cc: "Alexander Graf" <agraf@csgraf.de>,
	"Alex Bennée" <alex.bennee@linaro.org>,
	"Richard Henderson" <richard.henderson@linaro.org>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Peter Maydell" <peter.maydell@linaro.org>,
	"Julian Armistead" <julian.armistead@linaro.org>,
	"Cameron Esfahani" <dirty@apple.com>,
	"Mark Burton" <mburton@qti.qualcomm.com>,
	"Thomas Huth" <thuth@redhat.com>,
	"Edgar E. Iglesias" <edgar.iglesias@gmail.com>,
	"Pierrick Bouvier" <pierrick.bouvier@linaro.org>,
	"Philippe Mathieu-Daudé" <philmd@linaro.org>
Subject: [RFC PATCH RESEND 01/42] accel/split: Minimal stubs for split accelerator
Date: Fri, 20 Jun 2025 19:27:09 +0200	[thread overview]
Message-ID: <20250620172751.94231-2-philmd@linaro.org> (raw)
In-Reply-To: <20250620172751.94231-1-philmd@linaro.org>

From: Julian Armistead <julian.armistead@linaro.org>

Signed-off-by: Julian Armistead <julian.armistead@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 accel/split/split-accel-ops.c | 161 ++++++++++++++++++++++++++++++++++
 accel/split/split-all.c       |  77 ++++++++++++++++
 system/vl.c                   |   4 +
 accel/Kconfig                 |   6 ++
 accel/meson.build             |   1 +
 accel/split/meson.build       |   9 ++
 6 files changed, 258 insertions(+)
 create mode 100644 accel/split/split-accel-ops.c
 create mode 100644 accel/split/split-all.c
 create mode 100644 accel/split/meson.build

diff --git a/accel/split/split-accel-ops.c b/accel/split/split-accel-ops.c
new file mode 100644
index 00000000000..e5c1d51d426
--- /dev/null
+++ b/accel/split/split-accel-ops.c
@@ -0,0 +1,161 @@
+/*
+ * QEMU "split" accelerator (HW + SW) ops
+ *
+ * Copyright (c) 2025 Linaro Ltd.
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+#include "qemu/osdep.h"
+#include "system/accel-ops.h"
+
+static void *split_cpu_thread_routine(void *arg)
+{
+    g_assert_not_reached();
+}
+
+static void split_ops_init(AccelClass *ac)
+{
+    g_assert_not_reached();
+}
+
+static bool split_cpu_common_realize(CPUState *cpu, Error **errp)
+{
+    g_assert_not_reached();
+}
+
+static void split_cpu_common_unrealize(CPUState *cpu)
+{
+    g_assert_not_reached();
+}
+
+static void split_cpu_reset_hold(CPUState *cpu)
+{
+    g_assert_not_reached();
+}
+
+static void split_kick_vcpu_thread(CPUState *cpu)
+{
+    g_assert_not_reached();
+}
+
+static bool split_cpu_thread_is_idle(CPUState *cpu)
+{
+    g_assert_not_reached();
+}
+
+static void split_synchronize_post_reset(CPUState *cpu)
+{
+    g_assert_not_reached();
+}
+
+static void split_synchronize_post_init(CPUState *cpu)
+{
+    g_assert_not_reached();
+}
+
+static void split_synchronize_state(CPUState *cpu)
+{
+    g_assert_not_reached();
+}
+
+static void split_synchronize_pre_loadvm(CPUState *cpu)
+{
+    g_assert_not_reached();
+}
+
+static void split_synchronize_pre_resume(bool step_pending)
+{
+    g_assert_not_reached();
+}
+
+static void split_handle_interrupt(CPUState *cpu, int mask)
+{
+    g_assert_not_reached();
+}
+
+static int64_t split_get_virtual_clock(void)
+{
+    g_assert_not_reached();
+}
+
+static void split_set_virtual_clock(int64_t time)
+{
+    g_assert_not_reached();
+}
+
+static int64_t split_get_elapsed_ticks(void)
+{
+    g_assert_not_reached();
+}
+
+static int split_update_guest_debug(CPUState *cpu)
+{
+    g_assert_not_reached();
+}
+
+static int split_insert_breakpoint(CPUState *cpu, int type,
+                                   vaddr addr, vaddr len)
+{
+    g_assert_not_reached();
+}
+
+static int split_remove_breakpoint(CPUState *cpu, int type,
+                                   vaddr addr, vaddr len)
+{
+    g_assert_not_reached();
+}
+
+static void split_remove_all_breakpoints(CPUState *cpu)
+{
+    g_assert_not_reached();
+}
+
+static void split_get_vcpu_stats(CPUState *cpu, GString *buf)
+{
+    g_assert_not_reached();
+}
+
+static void split_accel_ops_class_init(ObjectClass *oc, const void *data)
+{
+    AccelOpsClass *ops = ACCEL_OPS_CLASS(oc);
+
+    ops->ops_init = split_ops_init;
+    ops->cpu_common_realize = split_cpu_common_realize;
+    ops->cpu_common_unrealize = split_cpu_common_unrealize;
+    ops->cpu_reset_hold = split_cpu_reset_hold;
+    ops->cpu_thread_routine = split_cpu_thread_routine;
+    ops->kick_vcpu_thread = split_kick_vcpu_thread;
+    ops->cpu_thread_is_idle = split_cpu_thread_is_idle;
+
+    ops->synchronize_post_reset = split_synchronize_post_reset;
+    ops->synchronize_post_init = split_synchronize_post_init;
+    ops->synchronize_state = split_synchronize_state;
+    ops->synchronize_pre_loadvm = split_synchronize_pre_loadvm;
+    ops->synchronize_pre_resume = split_synchronize_pre_resume;
+
+    ops->handle_interrupt = split_handle_interrupt;
+    ops->get_vcpu_stats = split_get_vcpu_stats;
+
+    ops->get_virtual_clock = split_get_virtual_clock;
+    ops->set_virtual_clock = split_set_virtual_clock;
+    ops->get_elapsed_ticks = split_get_elapsed_ticks;
+
+    ops->update_guest_debug = split_update_guest_debug;
+    ops->insert_breakpoint = split_insert_breakpoint;
+    ops->remove_breakpoint = split_remove_breakpoint;
+    ops->remove_all_breakpoints = split_remove_all_breakpoints;
+}
+
+static const TypeInfo split_accel_ops_type = {
+    .name = ACCEL_OPS_NAME("split"),
+    .parent = TYPE_ACCEL_OPS,
+    .class_init = split_accel_ops_class_init,
+    .abstract = true,
+};
+
+static void split_accel_ops_register_types(void)
+{
+    type_register_static(&split_accel_ops_type);
+}
+type_init(split_accel_ops_register_types);
diff --git a/accel/split/split-all.c b/accel/split/split-all.c
new file mode 100644
index 00000000000..7e308f3c1e7
--- /dev/null
+++ b/accel/split/split-all.c
@@ -0,0 +1,77 @@
+/*
+ * QEMU "split" accelerator (HW + SW emulator)
+ *
+ * Copyright (c) 2025 Linaro Ltd.
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+#include "qemu/osdep.h"
+#include "qemu/accel.h"
+
+bool split_allowed;
+
+static int split_accel_init_machine(MachineState *ms, AccelState *as)
+{
+    g_assert_not_reached();
+}
+
+static void split_setup_post(MachineState *ms, AccelState *accel)
+{
+    g_assert_not_reached();
+}
+
+static bool split_has_memory(MachineState *ms, AddressSpace *as,
+                             hwaddr start_addr, hwaddr size)
+{
+    g_assert_not_reached();
+}
+
+static bool split_cpus_are_resettable(AccelState *as)
+{
+    g_assert_not_reached();
+}
+
+static bool split_supports_guest_debug(AccelState *as)
+{
+    g_assert_not_reached();
+}
+
+static int split_gdbstub_supported_sstep_flags(AccelState *as)
+{
+    g_assert_not_reached();
+}
+
+static void split_get_stats(AccelState *as, GString *buf)
+{
+    g_assert_not_reached();
+}
+
+static void split_accel_class_init(ObjectClass *oc, const void *data)
+{
+    AccelClass *ac = ACCEL_CLASS(oc);
+
+    ac->name = "split";
+    ac->init_machine = split_accel_init_machine;
+    ac->setup_post = split_setup_post;
+    ac->has_memory = split_has_memory;
+    ac->cpus_are_resettable = split_cpus_are_resettable;
+    ac->supports_guest_debug = split_supports_guest_debug;
+    ac->gdbstub_supported_sstep_flags = split_gdbstub_supported_sstep_flags;
+    ac->get_stats = split_get_stats;
+    ac->allowed = &split_allowed;
+    ac->compat_props = NULL;
+}
+
+static const TypeInfo split_accel_type = {
+    .name = ACCEL_CLASS_NAME("split"),
+    .parent = TYPE_ACCEL,
+    .class_init = split_accel_class_init,
+};
+
+static void register_accel_types(void)
+{
+    type_register_static(&split_accel_type);
+}
+
+type_init(register_accel_types);
diff --git a/system/vl.c b/system/vl.c
index 3b7057e6c66..c7111d743ab 100644
--- a/system/vl.c
+++ b/system/vl.c
@@ -2433,6 +2433,7 @@ static void configure_accelerators(const char *progname)
             bool have_tcg = accel_find("tcg");
             bool have_kvm = accel_find("kvm");
             bool have_hvf = accel_find("hvf");
+            bool have_split = accel_find("split");
 
             if (have_tcg && have_kvm) {
                 if (g_str_has_suffix(progname, "kvm")) {
@@ -2447,6 +2448,9 @@ static void configure_accelerators(const char *progname)
                 accelerators = "tcg";
             } else if (have_hvf) {
                 accelerators = "hvf";
+            } else if (have_split) {
+                assert(have_tcg);
+                accelerators = "split";
             } else {
                 error_report("No accelerator selected and"
                              " no default accelerator available");
diff --git a/accel/Kconfig b/accel/Kconfig
index 4263cab7227..122ca9945ad 100644
--- a/accel/Kconfig
+++ b/accel/Kconfig
@@ -10,6 +10,12 @@ config HVF
 config TCG
     bool
 
+config SPLIT
+    bool
+    default y
+    depends on TCG
+    depends on HVF
+
 config KVM
     bool
 
diff --git a/accel/meson.build b/accel/meson.build
index 52909314bfa..b6d4740725f 100644
--- a/accel/meson.build
+++ b/accel/meson.build
@@ -9,6 +9,7 @@ if have_system
   subdir('qtest')
   subdir('kvm')
   subdir('xen')
+  subdir('split')
   subdir('stubs')
 endif
 
diff --git a/accel/split/meson.build b/accel/split/meson.build
new file mode 100644
index 00000000000..fbc68593180
--- /dev/null
+++ b/accel/split/meson.build
@@ -0,0 +1,9 @@
+# SPDX-License-Identifier: GPL-2.0-or-later
+
+split_ss = ss.source_set()
+split_ss.add(files(
+  'split-all.c',
+  'split-accel-ops.c',
+))
+
+specific_ss.add_all(when: 'CONFIG_SPLIT', if_true: split_ss)
-- 
2.49.0



  reply	other threads:[~2025-06-20 22:25 UTC|newest]

Thread overview: 83+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-20 17:27 [RFC PATCH RESEND 00/42] accel/split/arm: Run EL2 using TCG and EL1/EL0 in hardware with HVF Philippe Mathieu-Daudé
2025-06-20 17:27 ` Philippe Mathieu-Daudé [this message]
2025-06-22  2:18   ` [RFC PATCH RESEND 01/42] accel/split: Minimal stubs for split accelerator Richard Henderson
2025-06-20 17:27 ` [RFC PATCH RESEND 02/42] accel/split: Define SplitAccelState Philippe Mathieu-Daudé
2025-06-22  2:19   ` Richard Henderson
2025-06-20 17:27 ` [RFC PATCH RESEND 03/42] accel/split: Implement cpus_are_resettable() Philippe Mathieu-Daudé
2025-06-22  2:20   ` Richard Henderson
2025-06-20 17:27 ` [RFC PATCH RESEND 04/42] accel/split: Implement accel_init_machine() Philippe Mathieu-Daudé
2025-06-22  2:22   ` Richard Henderson
2025-06-22  2:23   ` Richard Henderson
2025-06-20 17:27 ` [RFC PATCH RESEND 05/42] accel/split: Expose 'hw' and 'sw' properties Philippe Mathieu-Daudé
2025-06-22  2:26   ` Richard Henderson
2025-06-20 17:27 ` [RFC PATCH RESEND 06/42] accel/split: Empty setup_post() Philippe Mathieu-Daudé
2025-06-22  2:26   ` Richard Henderson
2025-06-20 17:27 ` [RFC PATCH RESEND 07/42] accel/split: Implement supports_guest_debug() Philippe Mathieu-Daudé
2025-06-22  2:28   ` Richard Henderson
2025-06-20 17:27 ` [RFC PATCH RESEND 08/42] accel/split: Implement gdbstub_supported_sstep_flags() Philippe Mathieu-Daudé
2025-06-22  2:30   ` Richard Henderson
2025-06-20 17:27 ` [RFC PATCH RESEND 09/42] accel/split: Add cpu_thread_routine() stub Philippe Mathieu-Daudé
2025-06-22  2:32   ` Richard Henderson
2025-06-20 17:27 ` [RFC PATCH RESEND 10/42] accel/split: Define and allocate AccelCPUState Philippe Mathieu-Daudé
2025-06-22  2:35   ` Richard Henderson
2025-06-20 17:27 ` [RFC PATCH RESEND 11/42] accel/split: Register MTTCG Philippe Mathieu-Daudé
2025-06-22  2:38   ` Richard Henderson
2025-06-20 17:27 ` [RFC PATCH RESEND 12/42] accel/split: Have thread routine ready to dispatch over HW/SW Philippe Mathieu-Daudé
2025-06-22  2:45   ` Richard Henderson
2025-06-20 17:27 ` [RFC PATCH RESEND 13/42] accel/split: Implement cpu_reset_hold() Philippe Mathieu-Daudé
2025-06-22  2:46   ` Richard Henderson
2025-06-20 17:27 ` [RFC PATCH RESEND 14/42] accel/split: Implement synchronize_post_init() Philippe Mathieu-Daudé
2025-06-22  2:47   ` Richard Henderson
2025-06-20 17:27 ` [RFC PATCH RESEND 15/42] accel/split: Implement synchronize_pre_resume() Philippe Mathieu-Daudé
2025-06-22  2:47   ` Richard Henderson
2025-06-20 17:27 ` [RFC PATCH RESEND 16/42] accel/split: Implement synchronize_state() Philippe Mathieu-Daudé
2025-06-22  2:52   ` Richard Henderson
2025-06-22  2:54     ` Richard Henderson
2025-06-20 17:27 ` [RFC PATCH RESEND 17/42] accel/split: Implement synchronize_post_reset() Philippe Mathieu-Daudé
2025-06-20 17:27 ` [RFC PATCH RESEND 18/42] accel/split: Implement synchronize_pre_loadvm() Philippe Mathieu-Daudé
2025-06-20 17:27 ` [RFC PATCH RESEND 19/42] accel/split: Implement kick_vcpu_thread() Philippe Mathieu-Daudé
2025-06-22  2:56   ` Richard Henderson
2025-06-20 17:27 ` [RFC PATCH RESEND 20/42] accel/split: Implement cpu_common_realize() Philippe Mathieu-Daudé
2025-06-22  2:56   ` Richard Henderson
2025-06-20 17:27 ` [RFC PATCH RESEND 21/42] accel/split: Set use_hw in cpu_thread_routine() and switch over Philippe Mathieu-Daudé
2025-06-22  3:02   ` Richard Henderson
2025-06-20 17:27 ` [RFC PATCH RESEND 22/42] accel/split: Add few trace events in cpu_thread_routine handler Philippe Mathieu-Daudé
2025-06-20 17:27 ` [RFC PATCH RESEND 23/42] target/arm: Implement SysemuCPUOps::can_accelerate() handler Philippe Mathieu-Daudé
2025-06-22  3:03   ` Richard Henderson
2025-06-20 17:27 ` [RFC PATCH RESEND 24/42] accel/split: Implement handle_interrupt() Philippe Mathieu-Daudé
2025-06-22  3:04   ` Richard Henderson
2025-06-20 17:27 ` [RFC PATCH RESEND 25/42] accel/split: Empty ops_init() Philippe Mathieu-Daudé
2025-06-22  3:09   ` Richard Henderson
2025-06-20 17:27 ` [RFC PATCH RESEND 26/42] accel/split: Empty set/get_virtual_clock() Philippe Mathieu-Daudé
2025-06-22  3:11   ` Richard Henderson
2025-06-20 17:27 ` [RFC PATCH RESEND 27/42] accel/split: Empty get_elapsed_ticks() Philippe Mathieu-Daudé
2025-06-22  3:12   ` Richard Henderson
2025-06-20 17:27 ` [RFC PATCH RESEND 28/42] accel/split: Empty cpu_thread_is_idle() Philippe Mathieu-Daudé
2025-06-22  3:14   ` Richard Henderson
2025-06-20 17:27 ` [RFC PATCH RESEND 29/42] accel/split: Kludge qemu_tcg_mttcg_enabled() Philippe Mathieu-Daudé
2025-06-20 17:27 ` [RFC PATCH RESEND 30/42] accel/split: Implement remove_all_breakpoints() Philippe Mathieu-Daudé
2025-06-22  3:17   ` Richard Henderson
2025-06-20 17:27 ` [RFC PATCH RESEND 31/42] accel/split: Implement remove_breakpoint() Philippe Mathieu-Daudé
2025-06-22  3:17   ` Richard Henderson
2025-06-20 17:27 ` [RFC PATCH RESEND 32/42] accel/split: Implement insert_breakpoint() Philippe Mathieu-Daudé
2025-06-22  3:17   ` Richard Henderson
2025-06-20 17:27 ` [RFC PATCH RESEND 33/42] accel/split: Implement update_guest_debug() Philippe Mathieu-Daudé
2025-06-22  3:18   ` Richard Henderson
2025-06-20 17:27 ` [RFC PATCH RESEND 34/42] accel/split: Implement get_[vcpu]_stats() Philippe Mathieu-Daudé
2025-06-22  3:19   ` Richard Henderson
2025-06-20 17:27 ` [RFC PATCH RESEND 35/42] target/arm: Emulate EL2 under TCG Philippe Mathieu-Daudé
2025-06-22  3:20   ` Richard Henderson
2025-06-20 17:27 ` [RFC PATCH RESEND 36/42] target/arm: Have ERET switch to hw accel for EL0/EL1 Philippe Mathieu-Daudé
2025-06-22  3:27   ` Richard Henderson
2025-06-20 17:27 ` [RFC PATCH RESEND 37/42] accel/hvf: Emulate HVC at EL2 Philippe Mathieu-Daudé
2025-06-22  3:28   ` Richard Henderson
2025-07-18  5:47     ` Philippe Mathieu-Daudé
2025-06-20 17:27 ` [RFC PATCH RESEND 38/42] accel/tcg: Introduce TCGCPUOps::rebuild_tb_hflags handler Philippe Mathieu-Daudé
2025-06-22  3:33   ` Richard Henderson
2025-06-20 17:27 ` [RFC PATCH RESEND 39/42] target/arm: Implement TCGCPUOps::rebuild_tb_hflags() Philippe Mathieu-Daudé
2025-06-20 17:27 ` [RFC PATCH RESEND 40/42] accel/split: Call TCGCPUOps::rebuild_tb_hflags() Philippe Mathieu-Daudé
2025-06-22  3:34   ` Richard Henderson
2025-06-20 17:27 ` [RFC PATCH RESEND 41/42] tests/functional: Add split_available() helper Philippe Mathieu-Daudé
2025-06-22  3:36   ` Richard Henderson
2025-06-20 17:27 ` [RFC PATCH RESEND 42/42] tests/functional: Test Aarch64 virt machine with split-accelerator Philippe Mathieu-Daudé
2025-09-02 13:49 ` [RFC PATCH RESEND 00/42] accel/split/arm: Run EL2 using TCG and EL1/EL0 in hardware with HVF 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=20250620172751.94231-2-philmd@linaro.org \
    --to=philmd@linaro.org \
    --cc=agraf@csgraf.de \
    --cc=alex.bennee@linaro.org \
    --cc=dirty@apple.com \
    --cc=edgar.iglesias@gmail.com \
    --cc=julian.armistead@linaro.org \
    --cc=mburton@qti.qualcomm.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=pierrick.bouvier@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=richard.henderson@linaro.org \
    --cc=thuth@redhat.com \
    /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).