[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[RFC PATCH RESEND 12/42] accel/split: Have thread routine ready to dispa
From: |
Philippe Mathieu-Daudé |
Subject: |
[RFC PATCH RESEND 12/42] accel/split: Have thread routine ready to dispatch over HW/SW |
Date: |
Fri, 20 Jun 2025 19:27:20 +0200 |
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
accel/split/split-accel-ops.c | 22 ++++++++++++++++------
1 file changed, 16 insertions(+), 6 deletions(-)
diff --git a/accel/split/split-accel-ops.c b/accel/split/split-accel-ops.c
index 2c7945b6331..39495fdff14 100644
--- a/accel/split/split-accel-ops.c
+++ b/accel/split/split-accel-ops.c
@@ -19,12 +19,18 @@
static void *split_cpu_thread_routine(void *arg)
{
AccelState *as = current_accel();
+ SplitAccelState *sas = SPLIT_ACCEL(as);
+ AccelClass *hwc = ACCEL_GET_CLASS(sas->hw);
+ AccelClass *swc = ACCEL_GET_CLASS(sas->sw);
+ AccelOpsClass *hwops = hwc->ops;
+ AccelOpsClass *swops = swc->ops;
void *sw_force_rcu;
CPUState *cpu = arg;
AccelCPUState *acs;
int r;
- /* TODO: check accel allowed */
+ assert(swc->allowed);
+ assert(hwc->allowed);
rcu_register_thread();
sw_force_rcu = mttcg_vcpu_register(cpu);
@@ -35,7 +41,8 @@ static void *split_cpu_thread_routine(void *arg)
cpu->thread_id = qemu_get_thread_id();
current_cpu = cpu;
- /* TODO: init_vcpu_thread() */
+ hwops->init_vcpu_thread(cpu);
+ swops->init_vcpu_thread(cpu);
cpu->accel = g_renew(AccelCPUState, cpu->accel, 1); /* XXX only with
current TCG */
acs = cpu->accel;
acs->accel = as;
@@ -49,10 +56,12 @@ static void *split_cpu_thread_routine(void *arg)
cpu->exit_request = 1;
do {
- r = 0;
-
if (cpu_can_run(cpu)) {
- r = 0; /* TODO: exec_vcpu_thread() */
+ if (acs->use_hw) {
+ r = hwops->exec_vcpu_thread(cpu);
+ } else {
+ r = swops->exec_vcpu_thread(cpu);
+ }
switch (r) {
case 0:
break;
@@ -83,7 +92,8 @@ static void *split_cpu_thread_routine(void *arg)
qemu_wait_io_event(cpu);
} while (!cpu->unplug || cpu_can_run(cpu));
- /* TODO: destroy_vcpu_thread() */
+ hwops->destroy_vcpu_thread(cpu);
+ swops->destroy_vcpu_thread(cpu);
cpu_thread_signal_destroyed(cpu);
bql_unlock();
--
2.49.0
- [RFC PATCH RESEND 33/42] accel/split: Implement update_guest_debug(), (continued)
- [RFC PATCH RESEND 33/42] accel/split: Implement update_guest_debug(), Philippe Mathieu-Daudé, 2025/06/20
- [RFC PATCH RESEND 37/42] accel/hvf: Emulate HVC at EL2, Philippe Mathieu-Daudé, 2025/06/20
- [RFC PATCH RESEND 41/42] tests/functional: Add split_available() helper, Philippe Mathieu-Daudé, 2025/06/20
- [RFC PATCH RESEND 25/42] accel/split: Empty ops_init(), Philippe Mathieu-Daudé, 2025/06/20
- [RFC PATCH RESEND 31/42] accel/split: Implement remove_breakpoint(), Philippe Mathieu-Daudé, 2025/06/20
- [RFC PATCH RESEND 34/42] accel/split: Implement get_[vcpu]_stats(), Philippe Mathieu-Daudé, 2025/06/20
- [RFC PATCH RESEND 40/42] accel/split: Call TCGCPUOps::rebuild_tb_hflags(), Philippe Mathieu-Daudé, 2025/06/20
- [RFC PATCH RESEND 01/42] accel/split: Minimal stubs for split accelerator, Philippe Mathieu-Daudé, 2025/06/20
- [RFC PATCH RESEND 07/42] accel/split: Implement supports_guest_debug(), Philippe Mathieu-Daudé, 2025/06/20
- [RFC PATCH RESEND 05/42] accel/split: Expose 'hw' and 'sw' properties, Philippe Mathieu-Daudé, 2025/06/20
- [RFC PATCH RESEND 12/42] accel/split: Have thread routine ready to dispatch over HW/SW,
Philippe Mathieu-Daudé <=
- [RFC PATCH RESEND 16/42] accel/split: Implement synchronize_state(), Philippe Mathieu-Daudé, 2025/06/20
- [RFC PATCH RESEND 19/42] accel/split: Implement kick_vcpu_thread(), Philippe Mathieu-Daudé, 2025/06/20
- [RFC PATCH RESEND 23/42] target/arm: Implement SysemuCPUOps::can_accelerate() handler, Philippe Mathieu-Daudé, 2025/06/20
- [RFC PATCH RESEND 27/42] accel/split: Empty get_elapsed_ticks(), Philippe Mathieu-Daudé, 2025/06/20
- [RFC PATCH RESEND 28/42] accel/split: Empty cpu_thread_is_idle(), Philippe Mathieu-Daudé, 2025/06/20
- [RFC PATCH RESEND 26/42] accel/split: Empty set/get_virtual_clock(), Philippe Mathieu-Daudé, 2025/06/20
- [RFC PATCH RESEND 35/42] target/arm: Emulate EL2 under TCG, Philippe Mathieu-Daudé, 2025/06/20
- [RFC PATCH RESEND 09/42] accel/split: Add cpu_thread_routine() stub, Philippe Mathieu-Daudé, 2025/06/20
- [RFC PATCH RESEND 21/42] accel/split: Set use_hw in cpu_thread_routine() and switch over, Philippe Mathieu-Daudé, 2025/06/20