summary refs log tree commit diff stats
path: root/linux-user/user-internals.h
diff options
context:
space:
mode:
authorRichard Henderson <richard.henderson@linaro.org>2025-09-23 13:14:09 -0700
committerRichard Henderson <richard.henderson@linaro.org>2025-09-24 10:29:43 -0700
commit430014bee7a6c26a70e9f3854428843d5918cdf5 (patch)
tree2051589852633b77e63a5b5423787692f86c91f2 /linux-user/user-internals.h
parent7330741b3e4bc4b1b32e85b9c1372f44c896c4da (diff)
downloadfocaccia-qemu-430014bee7a6c26a70e9f3854428843d5918cdf5.tar.gz
focaccia-qemu-430014bee7a6c26a70e9f3854428843d5918cdf5.zip
linux-user: Split out begin_parallel_context
Move the test/flush/set block to a new function.
Use tb_flush__exclusive_or_serial while we're at it.

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Diffstat (limited to 'linux-user/user-internals.h')
-rw-r--r--linux-user/user-internals.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/linux-user/user-internals.h b/linux-user/user-internals.h
index 691b9a1775..7099349ec8 100644
--- a/linux-user/user-internals.h
+++ b/linux-user/user-internals.h
@@ -20,6 +20,8 @@
 
 #include "user/thunk.h"
 #include "qemu/log.h"
+#include "exec/tb-flush.h"
+#include "exec/translation-block.h"
 
 extern char *exec_path;
 void init_task_state(TaskState *ts);
@@ -172,6 +174,20 @@ static inline int regpairs_aligned(CPUArchState *cpu_env, int num) { return 0; }
  */
 void preexit_cleanup(CPUArchState *env, int code);
 
+/**
+ * begin_parallel_context
+ * @cs: the CPU context
+ *
+ * Called when starting the second vcpu, or joining shared memory.
+ */
+static inline void begin_parallel_context(CPUState *cs)
+{
+    if (!tcg_cflags_has(cs, CF_PARALLEL)) {
+        tb_flush__exclusive_or_serial();
+        tcg_cflags_set(cs, CF_PARALLEL);
+    }
+}
+
 /*
  * Include target-specific struct and function definitions;
  * they may need access to the target-independent structures