From patchwork Thu Mar 11 00:21:42 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 397466 Delivered-To: patch@linaro.org Received: by 2002:a17:906:a383:0:0:0:0 with SMTP id k3csp5700ejz; Wed, 10 Mar 2021 16:35:18 -0800 (PST) X-Google-Smtp-Source: ABdhPJxmFxcgoazZdE6zmSvv6+Hh5nXVf/2D2a9zKeesx8u4vQPHPOVEBuydwTUZ4xgVxjOjigu3 X-Received: by 2002:a6b:e312:: with SMTP id u18mr4418484ioc.58.1615422917996; Wed, 10 Mar 2021 16:35:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1615422917; cv=none; d=google.com; s=arc-20160816; b=MrtyCLfzMcV6cCrx0YPV9Tb0NMEpao88UTTLasSF4dF8GeiEu6hwb7bI/bbYS1dGhN zWm4JopMvK+oZldPESFsCAc+U4OVpSZPua+2Lc/sIpSBTsPdLfKnqfwpKH6s6TFiw+oL HG3ECKB8BaZC+a/sGdEwQ2+B5NTkqn6uknunaCseDnKKBnC0WyhbWnu+CEjzbsrPjs8e m4raa32VbhEhRCJPDklj1lshUlOpnapNIGhpHDwKKq+iCdfUqzwmxCKBI6fd/bl3w7eu UKz5p0YCD3lPxgJ9zE8KDgI+Ay6sjztjbqdG+86IArirXgVkVN2l9FpdcBUCkCtJ9csg HJiw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=1JDFX+MuUZit7885JaLDSIbe6sMdYH/iLicvWinCUzk=; b=jbXC4n6r96osU7XIfAfCS9iuz8UQKUdLKFl/6ez2UZp56CACx7yCwqGAc3GJWSjV4j ZvvObb9zDVKxXvXiG1csfFn/VKeCkO8DLq7RI9hruExyK7BB/BIAwOtQ6qSorYVGP5aN Iulfyk6DkyhHME7SI07mmPtUzX73BOjIal4J9eMoueDZZnEd74P479+kXzEyYjdANdBv dNtAHPHD7m5sVUn595CJ5N0wJ9GdpNdLR7fbgQimA8X9AzaB6QPSKGmJJuPoYya44PQD /rQ2m07BVlAq5EzezW2rZ+vJOjFq6tJ7U20G8BDr6nTQyN/8dEScuNB8IHODTFMa348f WZbQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=oamRHYls; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id n12si1294536ilk.3.2021.03.10.16.35.17 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 10 Mar 2021 16:35:17 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=oamRHYls; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:33532 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lK9IL-0003he-Br for patch@linaro.org; Wed, 10 Mar 2021 19:35:17 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:55158) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lK95w-0004uw-Ht for qemu-devel@nongnu.org; Wed, 10 Mar 2021 19:22:28 -0500 Received: from mail-ot1-x335.google.com ([2607:f8b0:4864:20::335]:37825) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lK95l-0001Mp-JW for qemu-devel@nongnu.org; Wed, 10 Mar 2021 19:22:28 -0500 Received: by mail-ot1-x335.google.com with SMTP id 75so15057406otn.4 for ; Wed, 10 Mar 2021 16:22:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=1JDFX+MuUZit7885JaLDSIbe6sMdYH/iLicvWinCUzk=; b=oamRHYls84rysOZM5w4pfNikUItq+ZbfZ3VS6JaOwegoi9OG3+dMGW/jjHTrZsyaS4 n7Bajs6cJmd6nXS5i/MjNmWu+o82W/y7xve2MLyGRKA5swf/Ufcg72fMs2uomHQJYKrF FSkw8ecxo2CYDFQemxqs1TkCQXQFjQDAmuX0kFekVG6hWoBSfpp2bMydVi6sl4xGvEnI ENYfNVjNukGIYOrhXpxbRoOMEishRNrXCEsKyR1/YskAxAQBxcYwro5n6CAdziTu/H6d inNX5+68PdbR0w3ZsyyxkuQylACqIXwDI0Jf9YYVfyxxt7zIH2/UNc5OMzMRBDK3Z4wi 21KA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=1JDFX+MuUZit7885JaLDSIbe6sMdYH/iLicvWinCUzk=; b=oW6RH03X+XXqe0Reu9ewJsdO/3F7xm/Tw0Wq8ef8z8Hm/ceQUm1//W3IB+iigGkHF6 ejiYlDxpoLjhXjMoy5XYIw3uh5sijyNNAVl51NBgyOrw9diSI4tdW9YGO5Ntx4Q0a/sp FTSpm6C22j3mL84wrlHuIAheiXriGEVl8enXZdT3WsgzAQ3uyugFWVhY/FdnSXyowBoF VbXlzBCIWkE/skgtfFMk6XgD0XBVkF1cmaLdmODmEGazbUMSPKSG3BOUmLxvpwa4vpTw wwtcnK5+2sGUf8R4BD5I1H2bctj6zWBqxUy72ptByi7TLCUj6z+e7MgHU5HxUkkGTSJH poQA== X-Gm-Message-State: AOAM533vTzTdIo2Infc9BYqx+miNCoDqJHgiiTq6/5PxUy7ToppigSsa MbxmKtwejOq8vL7GD3F0znmXwLh+tKADHp06 X-Received: by 2002:a9d:2cf:: with SMTP id 73mr4731292otl.28.1615422134335; Wed, 10 Mar 2021 16:22:14 -0800 (PST) Received: from localhost.localdomain (fixed-187-189-51-144.totalplay.net. [187.189.51.144]) by smtp.gmail.com with ESMTPSA id a6sm300962otq.79.2021.03.10.16.22.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Mar 2021 16:22:13 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 12/26] tcg: Create tcg_init Date: Wed, 10 Mar 2021 18:21:42 -0600 Message-Id: <20210311002156.253711-13-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210311002156.253711-1-richard.henderson@linaro.org> References: <20210311002156.253711-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::335; envelope-from=richard.henderson@linaro.org; helo=mail-ot1-x335.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: r.bolshakov@yadro.com, j@getutm.app Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Perform both tcg_context_init and tcg_region_init. Do not leave this split to the caller. Signed-off-by: Richard Henderson --- include/tcg/tcg.h | 3 +-- tcg/internal.h | 1 + accel/tcg/translate-all.c | 3 +-- tcg/tcg.c | 9 ++++++++- 4 files changed, 11 insertions(+), 5 deletions(-) -- 2.25.1 diff --git a/include/tcg/tcg.h b/include/tcg/tcg.h index 7a435bf807..3ad77ec34d 100644 --- a/include/tcg/tcg.h +++ b/include/tcg/tcg.h @@ -874,7 +874,6 @@ void *tcg_malloc_internal(TCGContext *s, int size); void tcg_pool_reset(TCGContext *s); TranslationBlock *tcg_tb_alloc(TCGContext *s); -void tcg_region_init(size_t tb_size, int splitwx); void tb_destroy(TranslationBlock *tb); void tcg_region_reset_all(void); @@ -907,7 +906,7 @@ static inline void *tcg_malloc(int size) } } -void tcg_context_init(TCGContext *s); +void tcg_init(size_t tb_size, int splitwx); void tcg_register_thread(void); void tcg_prologue_init(TCGContext *s); void tcg_func_start(TCGContext *s); diff --git a/tcg/internal.h b/tcg/internal.h index b1dda343c2..f13c564d9b 100644 --- a/tcg/internal.h +++ b/tcg/internal.h @@ -30,6 +30,7 @@ extern TCGContext **tcg_ctxs; extern unsigned int n_tcg_ctxs; +void tcg_region_init(size_t tb_size, int splitwx); bool tcg_region_alloc(TCGContext *s); void tcg_region_initial_alloc(TCGContext *s); void tcg_region_prologue_set(TCGContext *s); diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c index 4071edda16..050b4bff46 100644 --- a/accel/tcg/translate-all.c +++ b/accel/tcg/translate-all.c @@ -920,10 +920,9 @@ static void tb_htable_init(void) void tcg_exec_init(unsigned long tb_size, int splitwx) { tcg_allowed = true; - tcg_context_init(&tcg_init_ctx); page_init(); tb_htable_init(); - tcg_region_init(tb_size, splitwx); + tcg_init(tb_size, splitwx); #if defined(CONFIG_SOFTMMU) /* There's no guest base to take into account, so go ahead and diff --git a/tcg/tcg.c b/tcg/tcg.c index 10a571d41c..65a63bda8a 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -576,8 +576,9 @@ static void process_op_defs(TCGContext *s); static TCGTemp *tcg_global_reg_new_internal(TCGContext *s, TCGType type, TCGReg reg, const char *name); -void tcg_context_init(TCGContext *s) +static void tcg_context_init(void) { + TCGContext *s = &tcg_init_ctx; int op, total_args, n, i; TCGOpDef *def; TCGArgConstraint *args_ct; @@ -654,6 +655,12 @@ void tcg_context_init(TCGContext *s) cpu_env = temp_tcgv_ptr(ts); } +void tcg_init(size_t tb_size, int splitwx) +{ + tcg_context_init(); + tcg_region_init(tb_size, splitwx); +} + /* * Allocate TBs right before their corresponding translated code, making * sure that TBs and code are on different cache lines.