Skip to content

Commit

Permalink
accel/tcg: Factor tcg_cpu_reset_hold() out
Browse files Browse the repository at this point in the history
Factor the TCG specific code from cpu_common_reset_hold() to
tcg_cpu_reset_hold() within tcg-accel-ops.c. Since this file
is sysemu specific, we can inline tcg_flush_softmmu_tlb(),
removing its declaration in "exec/cpu-common.h".

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-4-philmd@linaro.org>
  • Loading branch information
philmd committed Nov 7, 2023
1 parent 1b5120d commit bb6cf6f
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 19 deletions.
4 changes: 0 additions & 4 deletions accel/stubs/tcg-stub.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,6 @@ void tlb_set_dirty(CPUState *cpu, vaddr vaddr)
{
}

void tcg_flush_jmp_cache(CPUState *cpu)
{
}

int probe_access_flags(CPUArchState *env, vaddr addr, int size,
MMUAccessType access_type, int mmu_idx,
bool nonfault, void **phost, uintptr_t retaddr)
Expand Down
8 changes: 8 additions & 0 deletions accel/tcg/tcg-accel-ops.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,13 @@ int tcg_cpus_exec(CPUState *cpu)
return ret;
}

static void tcg_cpu_reset_hold(CPUState *cpu)
{
tcg_flush_jmp_cache(cpu);

tlb_flush(cpu);
}

/* mask must never be zero, except for A20 change call */
void tcg_handle_interrupt(CPUState *cpu, int mask)
{
Expand Down Expand Up @@ -206,6 +213,7 @@ static void tcg_accel_ops_init(AccelOpsClass *ops)
}
}

ops->cpu_reset_hold = tcg_cpu_reset_hold;
ops->supports_guest_debug = tcg_supports_guest_debug;
ops->insert_breakpoint = tcg_insert_breakpoint;
ops->remove_breakpoint = tcg_remove_breakpoint;
Expand Down
8 changes: 0 additions & 8 deletions accel/tcg/translate-all.c
Original file line number Diff line number Diff line change
Expand Up @@ -673,11 +673,3 @@ void tcg_flush_jmp_cache(CPUState *cpu)
qatomic_set(&jc->array[i].tb, NULL);
}
}

/* This is a wrapper for common code that can not use CONFIG_SOFTMMU */
void tcg_flush_softmmu_tlb(CPUState *cs)
{
#ifdef CONFIG_SOFTMMU
tlb_flush(cs);
#endif
}
5 changes: 0 additions & 5 deletions hw/core/cpu-common.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
#include "qemu/main-loop.h"
#include "exec/log.h"
#include "exec/cpu-common.h"
#include "exec/tb-flush.h"
#include "qemu/error-report.h"
#include "qemu/qemu-print.h"
#include "sysemu/tcg.h"
Expand Down Expand Up @@ -138,10 +137,6 @@ static void cpu_common_reset_hold(Object *obj)
cpu->cflags_next_tb = -1;

cpu_exec_reset_hold(cpu);
if (tcg_enabled()) {
tcg_flush_jmp_cache(cpu);
tcg_flush_softmmu_tlb(cpu);
}
}

static bool cpu_common_has_work(CPUState *cs)
Expand Down
2 changes: 0 additions & 2 deletions include/exec/cpu-common.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@ void cpu_list_lock(void);
void cpu_list_unlock(void);
unsigned int cpu_list_generation_id_get(void);

void tcg_flush_softmmu_tlb(CPUState *cs);

void tcg_iommu_init_notifier_list(CPUState *cpu);
void tcg_iommu_free_notifier_list(CPUState *cpu);

Expand Down

0 comments on commit bb6cf6f

Please sign in to comment.