qemu-cr16/include/exec/tb-flush.h
Richard Henderson b773c149a8 accel/tcg: Split out tb_flush__exclusive_or_serial
Expose a routine to be called when no cpus are running.
Simplify the do_tb_flush run_on_cpu callback, because
that is explicitly called with start_exclusive; there
is no need for the mmap_lock as well.

Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2025-09-24 10:29:43 -07:00

43 lines
1.4 KiB
C

/*
* tb-flush prototype for use by the rest of the system.
*
* Copyright (c) 2022 Linaro Ltd
*
* SPDX-License-Identifier: GPL-2.0-or-later
*/
#ifndef _TB_FLUSH_H_
#define _TB_FLUSH_H_
/**
* tb_flush__exclusive_or_serial()
*
* Used to flush all the translation blocks in the system. Mostly this is
* used to empty the code generation buffer after it is full. Sometimes it
* is used when it is simpler to flush everything than work out which
* individual translations are now invalid.
*
* Must be called from an exclusive or serial context, e.g. start_exclusive,
* vm_stop, or when there is only one vcpu. Note that start_exclusive cannot
* be called from within the cpu run loop, so this cannot be called from
* within target code.
*/
void tb_flush__exclusive_or_serial(void);
/**
* tb_flush() - flush all translation blocks
* @cs: CPUState (must be valid, but treated as anonymous pointer)
*
* Used to flush all the translation blocks in the system. Sometimes
* it is simpler to flush everything than work out which individual
* translations are now invalid and ensure they are not called
* anymore.
*
* tb_flush() takes care of running the flush in an exclusive context
* if it is not already running in one. This means no guest code will
* run until this complete.
*/
void tb_flush(CPUState *cs);
void tcg_flush_jmp_cache(CPUState *cs);
#endif /* _TB_FLUSH_H_ */