From nobody Sat Nov 15 23:37:26 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1746031922; cv=none; d=zohomail.com; s=zohoarc; b=dB9V/zNYUfHo0NST/c1UfLJmkJ2cKHyKYDFE5jL22W53T2ZjXhVW4Rfv1BF6IsVDfL0NdkJbvRq3tBmXQopr7GUziv2pJHjN/gRIYO2yBu19V4YzF7jEXmodAPnCRD4eTbDzW3QQ/DXGrL5J9HZsntl0hjUX6aJcwvHjzts+6CY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1746031922; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=+nN+VhF6i+pyNwMFDScdlcKn4qf+d1VgVsfcYGuBPgk=; b=PDtGSODGhdTWaNBJRgzFLRMnjN5ERupyVuWgvjw+vX1Zy27sWOqua7GS77eALw9p0IvnbqMH9akqGuNhQK2NYkG0uh3HNtofBNHeXZMQhbXjg0m+j/41dlaFluQ6rs6LFFlhPaI+X0CyAsiRbDLdaDHigJ87niGnxIWHa4MkJpU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1746031922552649.1577248651904; Wed, 30 Apr 2025 09:52:02 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uAAcj-00060g-Vt; Wed, 30 Apr 2025 12:49:30 -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 1uAAcP-00059u-FA for qemu-devel@nongnu.org; Wed, 30 Apr 2025 12:49:14 -0400 Received: from mail-pf1-x42d.google.com ([2607:f8b0:4864:20::42d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uAAcM-0001vA-Sd for qemu-devel@nongnu.org; Wed, 30 Apr 2025 12:49:08 -0400 Received: by mail-pf1-x42d.google.com with SMTP id d2e1a72fcca58-7394945d37eso123161b3a.3 for ; Wed, 30 Apr 2025 09:49:05 -0700 (PDT) Received: from stoup.. (71-212-47-143.tukw.qwest.net. [71.212.47.143]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-b15f76f580asm9129704a12.2.2025.04.30.09.49.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 30 Apr 2025 09:49:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1746031745; x=1746636545; 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=+nN+VhF6i+pyNwMFDScdlcKn4qf+d1VgVsfcYGuBPgk=; b=N0ckhziHavNlFPS6jTpxvsIJZkPpMd5FSwD4CDBrKLf1opDQjLlm0PY+8Yj+pKQnyO a3o4vV93HBFBD0QJRiYSAqFIxc2dzl1FAmBeFv428w1e0fCQE1r6+qknGmi6U5qW/cNf 3ZJQTfXZdRtVu1pdT30WqczF94QKWhPAVXRH2e3WM+Yz+95d4EijC08NiWG1SvXj2gHi DFvD7AHp9SSMyftqF/DdiiVmfQuo/7OlIcx4/qeyyY8WbQwpv54UZAL3uk/Jx/u1bW+W BysTyIdPRcSRRRUotEpp0O2fyTop+Zqs9Z6NUJXDoMSeUbI+WutGn8Jvf1bjcUsqvrv0 FzSw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1746031745; x=1746636545; 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=+nN+VhF6i+pyNwMFDScdlcKn4qf+d1VgVsfcYGuBPgk=; b=gLIozX/oXp69TVEttWj7OFCP5C6P2fJQEmbxUhri7yEMsa7s15TfmUVknfuLt1rTWd 28SRjzugmeZAxPjFDwrCT7Mt5GCisyGlky1BsJt0cnuQyK+/Va2GwPmqbJ1DkoQt2QwN Ix6stuZpdjQRXOH+A71gqqNmEthlJJyzLrlCNPdiVuBRK4wAUGlHClSAuRbw6JA3pmZi 399DeOnqRRHv2OdUTs+3l68YjdoEjn/mnPx7LipSCQIgRvWTrbhSC1PoqlNtYg0hyyb0 t7dVW5N46aFmK4D+qqCGKrsVaZsSxJ1ZRrUQ1defoBmbCzRdYjMcZ9sQI47wGAgiKUgt Au+Q== X-Gm-Message-State: AOJu0Yy0NRPGAZ4eNWibE54KaVCsygKulN5AzVPetm0cA3i5NfD0eAmD 2jO/BB2Y3MNzOp2mE3OtC/q1F5MTvxsrCnS18RqbpjCtZTHsT4yjq8ueN+wldq9wSrl5T0tYDEG n X-Gm-Gg: ASbGncuzExWAol35rG6CTzfEwHbqoej1oY0h3n/rOG7bcAGCY4Zja1ZlHf802DS4hWS y/B6tw85EuYiHRtfwQrGAgB6x7ACQ6ZWpFXtj3Tq9Imfj0T0lkPyvbx+W76P5Q3J0NFr+uMkkMs T609+OIUD9X5QjGX7cdhs4oRY3oUR2XswLpRxg02l3dcJ+qzEokT3g4GMIBUGVvIocsoq9Xu952 WotYMfbEc/x0OmOsyGX2JVuA9G8DSP18Ic/QLL2TJn3MtYL/IWJNJjRx71hTzmEvA5Q/3UpetAa jXRgKNXoY4a8hc4IDuQZCeeV75m2aq9ZeH25iwY5oocjHB/3WzWyUshB/fJTJqpLCgPndG9NJIJ 6xUynetVqeA== X-Google-Smtp-Source: AGHT+IHnOcKwmRXIJF1cFlSqM1U1OBhDPMVLQSl6TTBIThOI/V0/WpobNbEIg39I4G6FsX+aZqTkGQ== X-Received: by 2002:a05:6a20:cfa4:b0:1f5:9208:3ac7 with SMTP id adf61e73a8af0-20aa468607fmr5534473637.41.1746031744677; Wed, 30 Apr 2025 09:49:04 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: pierrick.bouvier@linaro.org, philmd@linaro.org Subject: [PATCH v2 11/16] accel/tcg: Pass TCGTBCPUState to tb_lookup Date: Wed, 30 Apr 2025 09:48:49 -0700 Message-ID: <20250430164854.2233995-12-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250430164854.2233995-1-richard.henderson@linaro.org> References: <20250430164854.2233995-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::42d; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42d.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1746031925157019100 Content-Type: text/plain; charset="utf-8" Signed-off-by: Richard Henderson Reviewed-by: Pierrick Bouvier --- 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 *c= pu, 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; =20 /* we should never be trying to look up an INVALID tb */ - tcg_debug_assert(!(cflags & CF_INVALID)); + tcg_debug_assert(!(s.cflags & CF_INVALID)); =20 - hash =3D tb_jmp_cache_hash_func(pc); + hash =3D tb_jmp_cache_hash_func(s.pc); jc =3D cpu->tb_jmp_cache; =20 tb =3D qatomic_read(&jc->array[hash].tb); if (likely(tb && - jc->array[hash].pc =3D=3D pc && - tb->cs_base =3D=3D cs_base && - tb->flags =3D=3D flags && - tb_cflags(tb) =3D=3D cflags)) { + jc->array[hash].pc =3D=3D s.pc && + tb->cs_base =3D=3D s.cs_base && + tb->flags =3D=3D s.flags && + tb_cflags(tb) =3D=3D s.cflags)) { goto hit; } =20 - tb =3D tb_htable_lookup(cpu, pc, cs_base, flags, cflags); + tb =3D tb_htable_lookup(cpu, s.pc, s.cs_base, s.flags, s.cflags); if (tb =3D=3D NULL) { return NULL; } =20 - jc->array[hash].pc =3D pc; + jc->array[hash].pc =3D s.pc; qatomic_set(&jc->array[hash].tb, tb); =20 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 =3D=3D pc); + assert((tb_cflags(tb) & CF_PCREL) || tb->pc =3D=3D s.pc); return tb; } =20 @@ -402,7 +400,7 @@ const void *HELPER(lookup_tb_ptr)(CPUArchState *env) cpu_loop_exit(cpu); } =20 - tb =3D tb_lookup(cpu, s.pc, s.cs_base, s.flags, s.cflags); + tb =3D tb_lookup(cpu, s); if (tb =3D=3D 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. */ =20 - tb =3D tb_lookup(cpu, s.pc, s.cs_base, s.flags, s.cflags); + tb =3D tb_lookup(cpu, s); if (tb =3D=3D NULL) { mmap_lock(); tb =3D 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; } =20 - tb =3D tb_lookup(cpu, s.pc, s.cs_base, s.flags, s.cflags); + tb =3D tb_lookup(cpu, s); if (tb =3D=3D NULL) { CPUJumpCache *jc; uint32_t h; --=20 2.43.0