From patchwork Thu May 1 21:20:48 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 886429 Delivered-To: patch@linaro.org Received: by 2002:a5d:430f:0:b0:38f:210b:807b with SMTP id h15csp521434wrq; Thu, 1 May 2025 14:30:13 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXiZXWoxG5RBEWfbQAbQqwXC1bmb30ebTu7JI34qWjhg8B/QDdMWSE0GQY5NXmSdZSuFsDSJw==@linaro.org X-Google-Smtp-Source: AGHT+IGnjR6IrxE1KB7wnkTtT4ZLHLITuYo2cc6YrpB62chhLFuFxycNV80TRZ+zG/8L1L+qeoUz X-Received: by 2002:a05:622a:4a05:b0:476:fd4a:e885 with SMTP id d75a77b69052e-48c1a4bbef0mr11251061cf.20.1746135012920; Thu, 01 May 2025 14:30:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1746135012; cv=none; d=google.com; s=arc-20240605; b=YfsCwwWCpqadctV6/PpD4ZMB/hLTwfscKpzwiW331zlXNwNIdt5O7ICzToP0PHPFdW Pv7vup8bJ1WfAoi/dEIUdo3dUFfIghdYpF/F90QrdefIiapFhRcAmmmnmATzT4WR+jRI MgI5Omido4KFzSwa5Weu1HnY8b65jCBfKS9mqqYuVfFCYLGLsTeOait2IILev4M65+rs nMVHlKFG94l2pz5hLFhs1QRJUBc1c6nTR4NSjmlwQS592t2VOyQvbMIXFbvGAe5mGcKc otooFE9QT5Htz8gnSLM0iFKb1KJnbeFpSrQtbia8McMyiy/9Lo4DS27B4FEvzfC2exaI MZHA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to: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:cc:to :from:dkim-signature; bh=K4pHptChpTg8JmP9JZXmpp1i8GS4hyZpnC7DzMw80NY=; fh=vm85eyWrvOAHduw3sqEA+cYBqvHB7M0MHFcRJg7VWOo=; b=dZ1Fzp6As6EOX/RUsipZsQEZyFL46H+Gx3Qpz6hpTejWufLY9L792QjeODPd4XP1Mu 3kya9QHI2TsdPkX8V6sAjUOTAB0/rTeNCHMPQvGmRArqx2z/NdqjShxNmG+fqIfX8rm/ dQG2qZbbbNWTvAY6cehIfhz2oPl6aoERaTaZO9N1zUk9CmXsOlERfmpOV/aJ4JEEH0U/ A7eLbxkik/K/zc0b7A0NvbfeYYj/PZBNad73QRBogH1AGO+zIs4SZYPs9xcE0Q/b/gc0 GjCgEp590E+Vu1QEnAkZexg2NktY0U304B9cPLnzj+vLsVAiFSK/Oa2N8OG2IawgsJif ezJA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=HfPFFBu7; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-48b98d10d31si14343401cf.479.2025.05.01.14.30.12 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 01 May 2025 14:30:12 -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=pass header.i=@linaro.org header.s=google header.b=HfPFFBu7; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uAbLv-00016C-Nl; Thu, 01 May 2025 17:21:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uAbLm-00010a-QL for qemu-devel@nongnu.org; Thu, 01 May 2025 17:21:46 -0400 Received: from mail-pf1-x431.google.com ([2607:f8b0:4864:20::431]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uAbLk-0001Zj-6o for qemu-devel@nongnu.org; Thu, 01 May 2025 17:21:45 -0400 Received: by mail-pf1-x431.google.com with SMTP id d2e1a72fcca58-736c277331eso2479937b3a.1 for ; Thu, 01 May 2025 14:21:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1746134503; x=1746739303; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=K4pHptChpTg8JmP9JZXmpp1i8GS4hyZpnC7DzMw80NY=; b=HfPFFBu7agSOh1/mFjqBu3aKlsQg/cnynqxtGXNvoYDmgpzDX0xq5p6sV3fM7fPLzZ EYrKZw9QzDoBxBMYmDqa4kUAZQwLvD6UPALznsTry5HEBKL1nmA645ZwIRCMd8DFZIjC 8Z68/AAWASyBkeeaL/hJBKChB5VhpcUfZpGlZygTBVMR5I6PN6aQ9poOtfbx/0EPblEw tt964NHeL8Q51QA3Nd6+Udw+7txmfdOggW7iq3JOcbJ8fgyNWutCaBMaH+VseVWTjOgK ClEwrsEfK7EyvY2Cm4EnSgPb3gfStSx1hZgfpkG4L24Isr1OKm0brtO/4sBgW4CPDpFd dbVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1746134503; x=1746739303; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=K4pHptChpTg8JmP9JZXmpp1i8GS4hyZpnC7DzMw80NY=; b=YNYbCMVOx4qP2NybLnkyo7UgHD3815y4JJW1M9h3k8PB9qNaoyeMKTEOALTPLt/bza crJhU2xeQf2qNjqDqJ4JxB6nm8rtShMDw41BDIQnMrSZG+GxYVzcIgsJ9CxX7q+thX3E UszahH8kxe9kndiL9/ndR9ZiuPHnVYb8Xt8L4buFiI5iAFEMjbGLHTmruNZtV8c9sm4W iRwDyOez2DS73Jb/AE3vyUZUjrq5X0canB4ScBma/1a7SGsbJZo2HauaciIAydIqolgJ lIJZ1+RJ8QDp7+dRJGPsOe75nk/Ka3IZa+J7328hxluqseOsF0Z1g17kpv0ivqJdF1BZ 4gAg== X-Gm-Message-State: AOJu0YyLPbT0Jr1JsJ7MZ6mVH+JWCLjUv0fljAU2SVdo/xSrysJLeyrj EuUXdnAw1ZNsFxsbQhFOu7MTjsjMbHtqezSmGktY9FK8PXSpV242ns3LBpvHg28xygEPvc6WoAG x X-Gm-Gg: ASbGncs38ObZ5h7fryKB4Ol35DerH2RWxbHiv/lIBYEhNNXN/nQXQrC+5qDDeZoSFz1 05ok245/xIYIoCyKeLSwyBE7vBhnqNHY4RoeRBiCRku1NWebYSUFtFOFvr7q/ljymJtbHpgZ11d s2FsKdI1mLL+/g1r2dRWnJJEaVZA21XBh9Qw9IYpC2DD15Ec8uucuiHINvFnyL6fAhfuDz0L25F MdbUKDFicQ2+Y9629eqjTRl77sseA6guCh8wDrbZuzIJSxKVjo5M3aEDL6moDUYq3bLNoQpwulI /q52jKM69KjrQM7+8owwoIy6X/0c8LayaxidMwhVAyfNLqbuVM04+T1XVEdq53nNuQGAujVFDco = X-Received: by 2002:a17:90b:2cc5:b0:2fa:1d9f:c80 with SMTP id 98e67ed59e1d1-30a42fe44eamr5881267a91.17.1746134502705; Thu, 01 May 2025 14:21:42 -0700 (PDT) Received: from stoup.. (71-212-47-143.tukw.qwest.net. [71.212.47.143]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-30a476267e0sm1384573a91.39.2025.05.01.14.21.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 May 2025 14:21:42 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Pierrick Bouvier Subject: [PULL 34/59] accel/tcg: Pass TCGTBCPUState to tb_lookup Date: Thu, 1 May 2025 14:20:48 -0700 Message-ID: <20250501212113.2961531-35-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250501212113.2961531-1-richard.henderson@linaro.org> References: <20250501212113.2961531-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::431; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x431.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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Reviewed-by: Pierrick Bouvier Signed-off-by: Richard Henderson --- accel/tcg/cpu-exec.c | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c index 4a405d7b56..808983e461 100644 --- a/accel/tcg/cpu-exec.c +++ b/accel/tcg/cpu-exec.c @@ -232,35 +232,33 @@ static TranslationBlock *tb_htable_lookup(CPUState *cpu, vaddr pc, * * Returns: an existing translation block or NULL. */ -static inline TranslationBlock *tb_lookup(CPUState *cpu, vaddr pc, - uint64_t cs_base, uint32_t flags, - uint32_t cflags) +static inline TranslationBlock *tb_lookup(CPUState *cpu, TCGTBCPUState s) { TranslationBlock *tb; CPUJumpCache *jc; uint32_t hash; /* we should never be trying to look up an INVALID tb */ - tcg_debug_assert(!(cflags & CF_INVALID)); + tcg_debug_assert(!(s.cflags & CF_INVALID)); - hash = tb_jmp_cache_hash_func(pc); + hash = tb_jmp_cache_hash_func(s.pc); jc = cpu->tb_jmp_cache; tb = qatomic_read(&jc->array[hash].tb); if (likely(tb && - jc->array[hash].pc == pc && - tb->cs_base == cs_base && - tb->flags == flags && - tb_cflags(tb) == cflags)) { + jc->array[hash].pc == s.pc && + tb->cs_base == s.cs_base && + tb->flags == s.flags && + tb_cflags(tb) == s.cflags)) { goto hit; } - tb = tb_htable_lookup(cpu, pc, cs_base, flags, cflags); + tb = tb_htable_lookup(cpu, s.pc, s.cs_base, s.flags, s.cflags); if (tb == NULL) { return NULL; } - jc->array[hash].pc = pc; + jc->array[hash].pc = s.pc; qatomic_set(&jc->array[hash].tb, tb); hit: @@ -268,7 +266,7 @@ hit: * As long as tb is not NULL, the contents are consistent. Therefore, * the virtual PC has to match for non-CF_PCREL translations. */ - assert((tb_cflags(tb) & CF_PCREL) || tb->pc == pc); + assert((tb_cflags(tb) & CF_PCREL) || tb->pc == s.pc); return tb; } @@ -402,7 +400,7 @@ const void *HELPER(lookup_tb_ptr)(CPUArchState *env) cpu_loop_exit(cpu); } - tb = tb_lookup(cpu, s.pc, s.cs_base, s.flags, s.cflags); + tb = tb_lookup(cpu, s); if (tb == NULL) { return tcg_code_gen_epilogue; } @@ -581,7 +579,7 @@ void cpu_exec_step_atomic(CPUState *cpu) * Any breakpoint for this insn will have been recognized earlier. */ - tb = tb_lookup(cpu, s.pc, s.cs_base, s.flags, s.cflags); + tb = tb_lookup(cpu, s); if (tb == NULL) { mmap_lock(); tb = tb_gen_code(cpu, s.pc, s.cs_base, s.flags, s.cflags); @@ -955,7 +953,7 @@ cpu_exec_loop(CPUState *cpu, SyncClocks *sc) break; } - tb = tb_lookup(cpu, s.pc, s.cs_base, s.flags, s.cflags); + tb = tb_lookup(cpu, s); if (tb == NULL) { CPUJumpCache *jc; uint32_t h;