@@ -36,6 +36,8 @@ extern TCGv_i32 TCGV_HIGH_link_error(TCGv_i64);
#define TCGV_HIGH TCGV_HIGH_link_error
#endif
+extern int smp_cpus;
+
/* Note that this is optimized for sequential allocation during translate.
Up to and including filling in the forward link immediately. We'll do
proper termination of the end of the list after we finish translation. */
@@ -145,8 +147,9 @@ void tcg_gen_op6(TCGContext *ctx, TCGOpcode opc, TCGArg a1, TCGArg a2,
void tcg_gen_mb(TCGArg a)
{
- /* ??? Enable only when MTTCG is enabled. */
- tcg_gen_op1(&tcg_ctx, INDEX_op_mb, 0);
+ if (qemu_tcg_mttcg_enabled() && smp_cpus > 1) {
+ tcg_gen_op1(&tcg_ctx, INDEX_op_mb, 0);
+ }
}
/* 32 bit ops */
We need to generate fence instructions only for SMP MTTCG guests. This patch enforces that. Signed-off-by: Pranith Kumar <bobby.prani@gmail.com> --- tcg/tcg-op.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)