]> www.infradead.org Git - qemu-nvme.git/commitdiff
tcg: Split out tcg_region_initial_alloc
authorRichard Henderson <richard.henderson@linaro.org>
Tue, 9 Mar 2021 18:27:05 +0000 (12:27 -0600)
committerRichard Henderson <richard.henderson@linaro.org>
Fri, 11 Jun 2021 16:26:28 +0000 (09:26 -0700)
This has only one user, and currently needs an ifdef,
but will make more sense after some code motion.

Reviewed-by: Luis Pires <luis.pires@eldorado.org.br>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
tcg/tcg.c

index ba690e0483fa80fa3ab5d1392d31ee78750583c2..36ea21d596e4dfee2a7e785035a46885268d3b83 100644 (file)
--- a/tcg/tcg.c
+++ b/tcg/tcg.c
@@ -726,6 +726,15 @@ static void tcg_region_initial_alloc__locked(TCGContext *s)
     g_assert(!err);
 }
 
+#ifndef CONFIG_USER_ONLY
+static void tcg_region_initial_alloc(TCGContext *s)
+{
+    qemu_mutex_lock(&region.lock);
+    tcg_region_initial_alloc__locked(s);
+    qemu_mutex_unlock(&region.lock);
+}
+#endif
+
 /* Call from a safe-work context */
 void tcg_region_reset_all(void)
 {
@@ -959,9 +968,7 @@ void tcg_register_thread(void)
     }
 
     tcg_ctx = s;
-    qemu_mutex_lock(&region.lock);
-    tcg_region_initial_alloc__locked(s);
-    qemu_mutex_unlock(&region.lock);
+    tcg_region_initial_alloc(s);
 }
 #endif /* !CONFIG_USER_ONLY */