2
0
Эх сурвалжийг харах

includes: move tb_flush into its own header

This aids subsystems (like gdbstub) that want to trigger a flush
without pulling target specific headers.

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>

Message-Id: <20230302190846.2593720-8-alex.bennee@linaro.org>
Message-Id: <20230303025805.625589-8-richard.henderson@linaro.org>
Alex Bennée 2 жил өмнө
parent
commit
548c96095d

+ 1 - 0
MAINTAINERS

@@ -136,6 +136,7 @@ F: docs/devel/decodetree.rst
 F: docs/devel/tcg*
 F: docs/devel/tcg*
 F: include/exec/cpu*.h
 F: include/exec/cpu*.h
 F: include/exec/exec-all.h
 F: include/exec/exec-all.h
+F: include/exec/tb-flush.h
 F: include/exec/helper*.h
 F: include/exec/helper*.h
 F: include/sysemu/cpus.h
 F: include/sysemu/cpus.h
 F: include/sysemu/tcg.h
 F: include/sysemu/tcg.h

+ 1 - 0
accel/stubs/tcg-stub.c

@@ -11,6 +11,7 @@
  */
  */
 
 
 #include "qemu/osdep.h"
 #include "qemu/osdep.h"
+#include "exec/tb-flush.h"
 #include "exec/exec-all.h"
 #include "exec/exec-all.h"
 
 
 void tb_flush(CPUState *cpu)
 void tb_flush(CPUState *cpu)

+ 1 - 0
accel/tcg/tb-maint.c

@@ -22,6 +22,7 @@
 #include "exec/cputlb.h"
 #include "exec/cputlb.h"
 #include "exec/log.h"
 #include "exec/log.h"
 #include "exec/exec-all.h"
 #include "exec/exec-all.h"
+#include "exec/tb-flush.h"
 #include "exec/translate-all.h"
 #include "exec/translate-all.h"
 #include "sysemu/tcg.h"
 #include "sysemu/tcg.h"
 #include "tcg/tcg.h"
 #include "tcg/tcg.h"

+ 1 - 0
accel/tcg/translate-all.c

@@ -47,6 +47,7 @@
 #include "exec/cputlb.h"
 #include "exec/cputlb.h"
 #include "exec/translate-all.h"
 #include "exec/translate-all.h"
 #include "exec/translator.h"
 #include "exec/translator.h"
+#include "exec/tb-flush.h"
 #include "qemu/bitmap.h"
 #include "qemu/bitmap.h"
 #include "qemu/qemu-print.h"
 #include "qemu/qemu-print.h"
 #include "qemu/main-loop.h"
 #include "qemu/main-loop.h"

+ 1 - 0
cpu.c

@@ -36,6 +36,7 @@
 #include "exec/replay-core.h"
 #include "exec/replay-core.h"
 #include "exec/cpu-common.h"
 #include "exec/cpu-common.h"
 #include "exec/exec-all.h"
 #include "exec/exec-all.h"
+#include "exec/tb-flush.h"
 #include "exec/translate-all.h"
 #include "exec/translate-all.h"
 #include "exec/log.h"
 #include "exec/log.h"
 #include "hw/core/accel-cpu.h"
 #include "hw/core/accel-cpu.h"

+ 2 - 0
gdbstub/gdbstub.c

@@ -47,6 +47,8 @@
 #include "semihosting/semihost.h"
 #include "semihosting/semihost.h"
 #include "exec/exec-all.h"
 #include "exec/exec-all.h"
 #include "exec/replay-core.h"
 #include "exec/replay-core.h"
+#include "exec/tb-flush.h"
+#include "exec/hwaddr.h"
 
 
 #include "internals.h"
 #include "internals.h"
 
 

+ 1 - 0
hw/ppc/spapr_hcall.c

@@ -8,6 +8,7 @@
 #include "qemu/module.h"
 #include "qemu/module.h"
 #include "qemu/error-report.h"
 #include "qemu/error-report.h"
 #include "exec/exec-all.h"
 #include "exec/exec-all.h"
+#include "exec/tb-flush.h"
 #include "helper_regs.h"
 #include "helper_regs.h"
 #include "hw/ppc/ppc.h"
 #include "hw/ppc/ppc.h"
 #include "hw/ppc/spapr.h"
 #include "hw/ppc/spapr.h"

+ 0 - 1
include/exec/exec-all.h

@@ -677,7 +677,6 @@ void tb_invalidate_phys_addr(target_ulong addr);
 #else
 #else
 void tb_invalidate_phys_addr(AddressSpace *as, hwaddr addr, MemTxAttrs attrs);
 void tb_invalidate_phys_addr(AddressSpace *as, hwaddr addr, MemTxAttrs attrs);
 #endif
 #endif
-void tb_flush(CPUState *cpu);
 void tb_phys_invalidate(TranslationBlock *tb, tb_page_addr_t page_addr);
 void tb_phys_invalidate(TranslationBlock *tb, tb_page_addr_t page_addr);
 void tb_invalidate_phys_range(tb_page_addr_t start, tb_page_addr_t end);
 void tb_invalidate_phys_range(tb_page_addr_t start, tb_page_addr_t end);
 void tb_set_jmp_target(TranslationBlock *tb, int n, uintptr_t addr);
 void tb_set_jmp_target(TranslationBlock *tb, int n, uintptr_t addr);

+ 26 - 0
include/exec/tb-flush.h

@@ -0,0 +1,26 @@
+/*
+ * 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() - 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);
+
+#endif /* _TB_FLUSH_H_ */

+ 1 - 0
linux-user/user-internals.h

@@ -20,6 +20,7 @@
 
 
 #include "exec/user/thunk.h"
 #include "exec/user/thunk.h"
 #include "exec/exec-all.h"
 #include "exec/exec-all.h"
+#include "exec/tb-flush.h"
 #include "qemu/log.h"
 #include "qemu/log.h"
 
 
 extern char *exec_path;
 extern char *exec_path;

+ 1 - 0
plugins/core.c

@@ -24,6 +24,7 @@
 #include "exec/cpu-common.h"
 #include "exec/cpu-common.h"
 
 
 #include "exec/exec-all.h"
 #include "exec/exec-all.h"
+#include "exec/tb-flush.h"
 #include "exec/helper-proto.h"
 #include "exec/helper-proto.h"
 #include "tcg/tcg.h"
 #include "tcg/tcg.h"
 #include "tcg/tcg-op.h"
 #include "tcg/tcg-op.h"

+ 1 - 1
plugins/loader.c

@@ -29,7 +29,7 @@
 #include "qemu/plugin.h"
 #include "qemu/plugin.h"
 #include "qemu/memalign.h"
 #include "qemu/memalign.h"
 #include "hw/core/cpu.h"
 #include "hw/core/cpu.h"
-#include "exec/exec-all.h"
+#include "exec/tb-flush.h"
 #ifndef CONFIG_USER_ONLY
 #ifndef CONFIG_USER_ONLY
 #include "hw/boards.h"
 #include "hw/boards.h"
 #endif
 #endif

+ 1 - 0
target/alpha/sys_helper.c

@@ -20,6 +20,7 @@
 #include "qemu/osdep.h"
 #include "qemu/osdep.h"
 #include "cpu.h"
 #include "cpu.h"
 #include "exec/exec-all.h"
 #include "exec/exec-all.h"
+#include "exec/tb-flush.h"
 #include "exec/helper-proto.h"
 #include "exec/helper-proto.h"
 #include "sysemu/runstate.h"
 #include "sysemu/runstate.h"
 #include "sysemu/sysemu.h"
 #include "sysemu/sysemu.h"

+ 1 - 0
target/riscv/csr.c

@@ -25,6 +25,7 @@
 #include "time_helper.h"
 #include "time_helper.h"
 #include "qemu/main-loop.h"
 #include "qemu/main-loop.h"
 #include "exec/exec-all.h"
 #include "exec/exec-all.h"
+#include "exec/tb-flush.h"
 #include "sysemu/cpu-timers.h"
 #include "sysemu/cpu-timers.h"
 #include "qemu/guest-random.h"
 #include "qemu/guest-random.h"
 #include "qapi/error.h"
 #include "qapi/error.h"