Commit 9085154835 for qemu.org

commit 9085154835063f13a9084eea7599f25ea5f5143f
Author: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Date:   Wed Feb 18 20:01:43 2026 -0800

    tcg: move tcg_use_softmmu to tcg/tcg-internal.h

    In next commit, we'll apply same helper pattern for base helpers
    remaining.

    Our new helper pattern always include helper-*-common.h, which ends up
    including include/tcg/tcg.h, which contains one occurrence of
    CONFIG_USER_ONLY.
    Thus, common files not being duplicated between system and target
    relying on helpers will fail to compile. Existing occurrences are:
    - target/arm/tcg/arith_helper.c
    - target/arm/tcg/crypto_helper.c

    This occurrence of CONFIG_USER_ONLY is for defining variable
    tcg_use_softmmu, and we rely on dead code elimination with it in various
    tcg-target.c.inc.

    Thus, move its definition to tcg/tcg-internal.h, so helpers can be
    included by common files. Also, change it to a define, as it has fixed
    values for now.

    Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
    Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
    Message-id: 20260219040150.2098396-8-pierrick.bouvier@linaro.org
    Signed-off-by: Peter Maydell <peter.maydell@linaro.org>

diff --git a/include/tcg/tcg.h b/include/tcg/tcg.h
index 60942ce05c..45c7e118c3 100644
--- a/include/tcg/tcg.h
+++ b/include/tcg/tcg.h
@@ -445,12 +445,6 @@ static inline bool temp_readonly(TCGTemp *ts)
     return ts->kind >= TEMP_FIXED;
 }

-#ifdef CONFIG_USER_ONLY
-extern bool tcg_use_softmmu;
-#else
-#define tcg_use_softmmu  true
-#endif
-
 extern __thread TCGContext *tcg_ctx;
 extern const void *tcg_code_gen_epilogue;
 extern uintptr_t tcg_splitwx_diff;
diff --git a/tcg/tcg-internal.h b/tcg/tcg-internal.h
index 2cbfb5d5ca..2615684612 100644
--- a/tcg/tcg-internal.h
+++ b/tcg/tcg-internal.h
@@ -34,6 +34,12 @@ extern TCGContext **tcg_ctxs;
 extern unsigned int tcg_cur_ctxs;
 extern unsigned int tcg_max_ctxs;

+#ifdef CONFIG_USER_ONLY
+#define tcg_use_softmmu false
+#else
+#define tcg_use_softmmu true
+#endif
+
 void tcg_region_init(size_t tb_size, int splitwx, unsigned max_threads);
 bool tcg_region_alloc(TCGContext *s);
 void tcg_region_initial_alloc(TCGContext *s);
diff --git a/tcg/tcg.c b/tcg/tcg.c
index e7bf4dad4e..3111e1f426 100644
--- a/tcg/tcg.c
+++ b/tcg/tcg.c
@@ -236,10 +236,6 @@ static TCGAtomAlign atom_and_align_for_opc(TCGContext *s, MemOp opc,
                                            MemOp host_atom, bool allow_two_ops)
     __attribute__((unused));

-#ifdef CONFIG_USER_ONLY
-bool tcg_use_softmmu;
-#endif
-
 TCGContext tcg_init_ctx;
 __thread TCGContext *tcg_ctx;