Skip to content

Commit

Permalink
accel: Introduce cpu_exec_reset_hold()
Browse files Browse the repository at this point in the history
Introduce cpu_exec_reset_hold() which call an accelerator
specific AccelOpsClass::cpu_reset_hold() handler.

Define a stub on TCG user emulation, because CPU reset is
irrelevant there.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Anton Johansson <anjo@rev.ng>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20230918104153.24433-3-philmd@linaro.org>
  • Loading branch information
philmd committed Nov 7, 2023
1 parent f4f826c commit 1b5120d
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 0 deletions.
4 changes: 4 additions & 0 deletions accel/tcg/user-exec-stub.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ void qemu_init_vcpu(CPUState *cpu)
{
}

void cpu_exec_reset_hold(CPUState *cpu)
{
}

/* User mode emulation does not support record/replay yet. */

bool replay_exception(void)
Expand Down
1 change: 1 addition & 0 deletions hw/core/cpu-common.c
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ static void cpu_common_reset_hold(Object *obj)
cpu->crash_occurred = false;
cpu->cflags_next_tb = -1;

cpu_exec_reset_hold(cpu);
if (tcg_enabled()) {
tcg_flush_jmp_cache(cpu);
tcg_flush_softmmu_tlb(cpu);
Expand Down
1 change: 1 addition & 0 deletions include/hw/core/cpu.h
Original file line number Diff line number Diff line change
Expand Up @@ -1153,6 +1153,7 @@ void cpu_class_init_props(DeviceClass *dc);
void cpu_exec_initfn(CPUState *cpu);
void cpu_exec_realizefn(CPUState *cpu, Error **errp);
void cpu_exec_unrealizefn(CPUState *cpu);
void cpu_exec_reset_hold(CPUState *cpu);

/**
* target_words_bigendian:
Expand Down
1 change: 1 addition & 0 deletions include/sysemu/accel-ops.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ struct AccelOpsClass {
void (*ops_init)(AccelOpsClass *ops);

bool (*cpus_are_resettable)(void);
void (*cpu_reset_hold)(CPUState *cpu);

void (*create_vcpu_thread)(CPUState *cpu); /* MANDATORY NON-NULL */
void (*kick_vcpu_thread)(CPUState *cpu);
Expand Down
7 changes: 7 additions & 0 deletions system/cpus.c
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,13 @@ bool cpus_are_resettable(void)
return true;
}

void cpu_exec_reset_hold(CPUState *cpu)
{
if (cpus_accel->cpu_reset_hold) {
cpus_accel->cpu_reset_hold(cpu);
}
}

int64_t cpus_get_virtual_clock(void)
{
/*
Expand Down

0 comments on commit 1b5120d

Please sign in to comment.