From 0430ca00f586a7ad27d3f13de3010ac4d6f40bb6 Mon Sep 17 00:00:00 2001 From: Richard Henderson Date: Tue, 9 Mar 2021 12:27:05 -0600 Subject: [PATCH] tcg: Split out tcg_region_initial_alloc MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This has only one user, and currently needs an ifdef, but will make more sense after some code motion. Reviewed-by: Luis Pires Reviewed-by: Alex BennĂ©e Signed-off-by: Richard Henderson --- tcg/tcg.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/tcg/tcg.c b/tcg/tcg.c index ba690e0483..36ea21d596 100644 --- 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(®ion.lock); + tcg_region_initial_alloc__locked(s); + qemu_mutex_unlock(®ion.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(®ion.lock); - tcg_region_initial_alloc__locked(s); - qemu_mutex_unlock(®ion.lock); + tcg_region_initial_alloc(s); } #endif /* !CONFIG_USER_ONLY */