From patchwork Thu Jul 1 15:25:23 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 469104 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp499562jao; Thu, 1 Jul 2021 08:30:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxRakzYD+Dpl2a/LTZSuX92ak2ftR8JrYlSKWWLbidcn/PdnwFgAcGFHMwBtV2Z92IjSz30 X-Received: by 2002:a05:6402:4308:: with SMTP id m8mr496294edc.237.1625153454599; Thu, 01 Jul 2021 08:30:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625153454; cv=none; d=google.com; s=arc-20160816; b=XGRjOvWxyvHNqY5QrKl54Gqy3nNtESnQEaHegY3iESXw/dXZ8r1IRhJfqRFUo/t8EI UbllqI/1FF4iOE+pPGBfFJZ2r5o7af3/fuZFrDdD5wfWIBpvX6OAn8wmqvumaqEHuC34 0YyEnuS3IbkR66lQDGYAZGvPzOk0b3d+ZavXWSm6P5DOr42i7MJi9l3ngU5mXMNxbQVk 7lmfnsCuVgLbi1wWj9oIEtSE8blwDFYyvQWpj5PEXPUXEK3zv4Ptk11zGwxHVnEys6TK v+XJyQxP9ticQTzxM6skBmmcXvnh1V/9ikyBy/j6UVwuYDe+2uwayEBad7GbG10wLssd ///Q== 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=TJZF8LWW+S/evT7bkuT0HfWov+1lUwCTXAU5MMH8g9E=; b=H6u9dFJkiujbJYVrpMQkm1aGvGBXhBiFz4bCQoWHpeE66uYtTmo9+ZCVnSLP3twawm UtN4xG91A94PUP4e6naJtYnYIeSTf0CHQ6kSWAEtw9pctwgbcRtIyQaC0MVJlFz5mCzC jW3FyNUSCWJpP0s2uzzcyyshRAURBED8d4/PIkGu39OlWzIELJ4qJTek2asfUIccptEG HMaAr/zma/3PTNrjKKmsP1RdGs9ScTGoBcu85oC/ey96FbzNuc38dU3UFxTbWqT1ktTU PQBzjtHMbGYBrq1fMS3HmCMDhyQZI+EZuPIgPGA8HP7YIqhVnT9Z+yTFA8mullO7EDWg Udow== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=pqpfExdd; 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 y15si101080eda.75.2021.07.01.08.30.54 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 01 Jul 2021 08:30:54 -0700 (PDT) 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=pqpfExdd; 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]:51766 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lyyeT-0007xc-HT for patch@linaro.org; Thu, 01 Jul 2021 11:30:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52968) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lyyZi-0004Yw-E0 for qemu-devel@nongnu.org; Thu, 01 Jul 2021 11:25:58 -0400 Received: from mail-pj1-x102a.google.com ([2607:f8b0:4864:20::102a]:42742) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lyyZS-00089P-BO for qemu-devel@nongnu.org; Thu, 01 Jul 2021 11:25:58 -0400 Received: by mail-pj1-x102a.google.com with SMTP id p17-20020a17090b0111b02901723ab8d11fso4171216pjz.1 for ; Thu, 01 Jul 2021 08:25:41 -0700 (PDT) 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=TJZF8LWW+S/evT7bkuT0HfWov+1lUwCTXAU5MMH8g9E=; b=pqpfExdd9ILT2SiRxYpTlokLdbQMiKqjgAySps1UuI3DN0chCCiv5UAyQ7hAwc1FP+ mg7z3/JBGh7vgcPgEIHIVUFdmw/maGZxMUsKCun/4BuqnY6k/wNEnvFaCp1AsPJ21gYC vhuGSo6aTTPbpOzsIIOvhsJLNBqlverPt1t6YrJunA/4wo4w0khVrGFUxPpCIw/ocdX2 BCOmxadi78rd4jjiJdk/ZzoEyGfRSErB236oJoagWPkXybt7553JQ0lk+YzXS0ZDl+Ug Tkox6wtQfns8e55fxoAnyhKe139i57gt5PqIdNl7aegaC/ApziOlo0pNDdJs7/7X3FSH jM3w== 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=TJZF8LWW+S/evT7bkuT0HfWov+1lUwCTXAU5MMH8g9E=; b=e4vcouGJGZbkky92beMp3PXaAABXGCfy/DFh0DtdgdVjKPmuA2p+2+r8NyB58PGGvZ PDEP1KkJeHdE0GJVrCJUq03GB+qVhTOZ5C0bjLzFjGbnUlhR0llqL/ImLweAp7LVSpgB WZdgrcHLWMrJmFKZmct59waKkoirppjFXUCzk/3Dczg5PS9gsn3GWDqBbzEM/Slx2JQf Pkfv9uqWlVosmKhqiPgfTkcNMoJ1q3ZyV4O02/EUA1eiQF57OfNX7AOyyzX3XpbAzjTk YfS4ZcOcXAXW92g+YQjQue4fHnBKVxnk5ohek4TP3Dd+BZ2UtF39XgjoHV9tUBp5tK42 78qg== X-Gm-Message-State: AOAM53095rK4nPenQyHkxCFYkT8gbsQAZIGPMABoKezsAC66zGO2b4oH yRcuiHOrJo8CvX4sciqnUCZX3wYbJncM/w== X-Received: by 2002:a17:90a:a087:: with SMTP id r7mr10756966pjp.84.1625153140620; Thu, 01 Jul 2021 08:25:40 -0700 (PDT) Received: from localhost.localdomain ([71.212.149.176]) by smtp.gmail.com with ESMTPSA id j4sm10213197pjv.7.2021.07.01.08.25.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Jul 2021 08:25:40 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 03/17] accel/tcg: Move tb_lookup to cpu-exec.c Date: Thu, 1 Jul 2021 08:25:23 -0700 Message-Id: <20210701152537.3330420-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210701152537.3330420-1-richard.henderson@linaro.org> References: <20210701152537.3330420-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::102a; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102a.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: peter.maydell@linaro.org, mark.cave-ayland@ilande.co.uk, alex.bennee@linaro.org, f4bug@amsat.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Now that we've moved helper_lookup_tb_ptr, the only user of tb-lookup.h is cpu-exec.c; merge the contents in. Signed-off-by: Richard Henderson --- accel/tcg/tb-lookup.h | 49 ------------------------------------------- accel/tcg/cpu-exec.c | 31 ++++++++++++++++++++++++++- 2 files changed, 30 insertions(+), 50 deletions(-) delete mode 100644 accel/tcg/tb-lookup.h -- 2.25.1 Reviewed-by: Philippe Mathieu-Daudé diff --git a/accel/tcg/tb-lookup.h b/accel/tcg/tb-lookup.h deleted file mode 100644 index 9c9e0079da..0000000000 --- a/accel/tcg/tb-lookup.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (C) 2017, Emilio G. Cota - * - * License: GNU GPL, version 2 or later. - * See the COPYING file in the top-level directory. - */ -#ifndef EXEC_TB_LOOKUP_H -#define EXEC_TB_LOOKUP_H - -#ifdef NEED_CPU_H -#include "cpu.h" -#else -#include "exec/poison.h" -#endif - -#include "exec/exec-all.h" -#include "tb-hash.h" - -/* Might cause an exception, so have a longjmp destination ready */ -static inline TranslationBlock *tb_lookup(CPUState *cpu, target_ulong pc, - target_ulong cs_base, - uint32_t flags, uint32_t cflags) -{ - TranslationBlock *tb; - uint32_t hash; - - /* we should never be trying to look up an INVALID tb */ - tcg_debug_assert(!(cflags & CF_INVALID)); - - hash = tb_jmp_cache_hash_func(pc); - tb = qatomic_rcu_read(&cpu->tb_jmp_cache[hash]); - - if (likely(tb && - tb->pc == pc && - tb->cs_base == cs_base && - tb->flags == flags && - tb->trace_vcpu_dstate == *cpu->trace_dstate && - tb_cflags(tb) == cflags)) { - return tb; - } - tb = tb_htable_lookup(cpu, pc, cs_base, flags, cflags); - if (tb == NULL) { - return NULL; - } - qatomic_set(&cpu->tb_jmp_cache[hash], tb); - return tb; -} - -#endif /* EXEC_TB_LOOKUP_H */ diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c index fb6668606f..0d92698030 100644 --- a/accel/tcg/cpu-exec.c +++ b/accel/tcg/cpu-exec.c @@ -40,7 +40,6 @@ #include "sysemu/replay.h" #include "exec/helper-proto.h" #include "tb-hash.h" -#include "tb-lookup.h" #include "tb-context.h" #include "internal.h" @@ -146,6 +145,36 @@ static void init_delay_params(SyncClocks *sc, const CPUState *cpu) } #endif /* CONFIG USER ONLY */ +/* Might cause an exception, so have a longjmp destination ready */ +static inline TranslationBlock *tb_lookup(CPUState *cpu, target_ulong pc, + target_ulong cs_base, + uint32_t flags, uint32_t cflags) +{ + TranslationBlock *tb; + uint32_t hash; + + /* we should never be trying to look up an INVALID tb */ + tcg_debug_assert(!(cflags & CF_INVALID)); + + hash = tb_jmp_cache_hash_func(pc); + tb = qatomic_rcu_read(&cpu->tb_jmp_cache[hash]); + + if (likely(tb && + tb->pc == pc && + tb->cs_base == cs_base && + tb->flags == flags && + tb->trace_vcpu_dstate == *cpu->trace_dstate && + tb_cflags(tb) == cflags)) { + return tb; + } + tb = tb_htable_lookup(cpu, pc, cs_base, flags, cflags); + if (tb == NULL) { + return NULL; + } + qatomic_set(&cpu->tb_jmp_cache[hash], tb); + return tb; +} + /** * helper_lookup_tb_ptr: quick check for next tb * @env: current cpu state