@@ -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();
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> --- accel/split/split-accel-ops.c | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-)