From patchwork Mon Jun 26 15:39:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 696447 Delivered-To: patch@linaro.org Received: by 2002:adf:e885:0:0:0:0:0 with SMTP id d5csp3297192wrm; Mon, 26 Jun 2023 08:40:26 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7/B5oclDr/MNZzy9nH0YteGd/lKUzPPy/iVIayRbFPElFP+FeNQN6CG5/zLlzAlsywXjk1 X-Received: by 2002:a37:ab19:0:b0:765:3fcc:4f9e with SMTP id u25-20020a37ab19000000b007653fcc4f9emr10985623qke.38.1687794026110; Mon, 26 Jun 2023 08:40:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687794026; cv=none; d=google.com; s=arc-20160816; b=PrKipoIoZun5oqvwcSK02S7KwRE3pT5JaBeajmJ7eNxzNs5ON4fRvlgxjCSKj+8qnw WxMSXO2xRc3o6wMe7XvccHX9b4FR8+tqGrVrDC6EMRw69ElldPilTtLbPt6Xps4ab8Kw r2fWh/e4sDw+cq6sm4277yxYOFvXp4C0HRsHTyfkEIgfzWk+Z6xQeqLZHd3sbvQOf4A+ gf76lhjMdS1AePjIyJu8MGZrQM1Azw2q71qompOYcqb0guouqkB4VpQZ0v+WCjLEDCUx e8FF9RHwrgSBC2t6m3uJAgOpizsnzsqK5NU3/7rxPvZ/OKyXAJuihBdZlfOYmvs1brYV BT4Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=Kv3gPH6s0OE3PjFPgTi8pMQisc8pYxjYjhVnRHERxkM=; fh=l3rThTWYtfg9kQ3pwkdseR7wGfUMT6wsJF5cqMswxYY=; b=0N46hvVn6KRzQJkmZRqOQGpspNasHDkWp3IBGb7C5kGMoWbnaEtHt9W9J/8MWK7Fg9 jMQaS9BQ7Ycp5fii1XK4xjAl8hUyc6MKT+63Uuvo035joMgYSbBwRvo1p+exlv/y/Wqj PGGw5PMe/7QXLhTFfozUiGbKvD1Pjo4v/CGu31u+VsaANNEuONfw26MxA+G/0h9ahFO6 phPLpKcUkouX4hLzcex1DH0ZFrYTr3rsEebBQZInvZXkl3a+AHSIR8IZ/RrW7Yb/M8eN vDaXT7HzCPKf9KwrA/0uc9CAs2y+qagRHEbpNw6kmr23q6XzAdUcd+L2yjW7mvzLvca+ /4gw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=eTQucsj4; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id bk3-20020a05620a1a0300b0075f0817d708si1945012qkb.591.2023.06.26.08.40.25 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 26 Jun 2023 08:40:26 -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=eTQucsj4; 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 Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qDoJp-0000IS-Kz; Mon, 26 Jun 2023 11:39:57 -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 1qDoJn-0000Gm-RA for qemu-devel@nongnu.org; Mon, 26 Jun 2023 11:39:56 -0400 Received: from mail-wr1-x436.google.com ([2a00:1450:4864:20::436]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qDoJk-0002oI-Ki for qemu-devel@nongnu.org; Mon, 26 Jun 2023 11:39:55 -0400 Received: by mail-wr1-x436.google.com with SMTP id ffacd0b85a97d-313f58d6652so810884f8f.2 for ; Mon, 26 Jun 2023 08:39:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1687793991; x=1690385991; 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=Kv3gPH6s0OE3PjFPgTi8pMQisc8pYxjYjhVnRHERxkM=; b=eTQucsj4gU+DI+WKrTP0xa7hB2fAmZ7TmmLODDcs/OCW55DGiCT0WYsyQD6DDbDlWZ sdzXuXawbuXRlSKgMuKPAopn5S96Z+Oovskq2ouQI3ny0h8fcvzovDPkVtieBuOjAP7g 4EGVjB+2+sKptmIjnH8xxiavD1hVR0H6sjjR1ip/92029P8Wb8ZCx3ajLxX039HnqQ1d P5iMPPKM0tAyixbPOeu+9r5HGnVzC0Z0dDE5EXt0ct+NDZ4t8450S0Kwjuuqr6Cd9fsH RZPiGdh9BmctiBJGNM1JzGe3yZHfUd6TJIstjF88wNJyNOQEKeCPAF2sZQllbMKWYZ0t yMKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687793991; x=1690385991; 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=Kv3gPH6s0OE3PjFPgTi8pMQisc8pYxjYjhVnRHERxkM=; b=APblx4QHek0Td23x41GUpms10enP+Gw38hY5wuOqQpaF90LS58WnMu93wq/3jOhYd7 uxJyZ6cJGbEjN11zGjN05Lv3mntzsKIG45XMSMBOIAgQrmdbIZmVO342DF7/Y8HKMYRx rQaVhI7dRCSnRyYEh0ALZWstKAn4pCcFaA6rXWbXe4F9jfEkilZUxak5nkrtxmJeI6ke 9NKxja9NVhHREyWwTZL1XVY+PjKbZxAq0IORlFNNjvYSfaEBsZwG5N/+Hzxq8wFnuyX2 njkolSTbHajNdia0SXb1fqDTGQoKJ9WcysAbJDBJFBI/b+t7fbn/VkRdzFLcgdoTO0yz rsdw== X-Gm-Message-State: AC+VfDxmEid2rfFzf6udcTF0cOfTHTf15lU69DUsG6ZVAG1GMBeQPrn2 jcTDJeUzXvnqFp5Bik/0XAzDDqRWrLesdfPmFMDL6M9F X-Received: by 2002:a5d:468d:0:b0:30a:f2a0:64fa with SMTP id u13-20020a5d468d000000b0030af2a064famr25636524wrq.10.1687793990871; Mon, 26 Jun 2023 08:39:50 -0700 (PDT) Received: from localhost.localdomain ([139.47.42.170]) by smtp.gmail.com with ESMTPSA id t1-20020adfe441000000b00313f45f74a8sm2164178wrm.103.2023.06.26.08.39.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Jun 2023 08:39:50 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Anton Johansson Subject: [PULL 07/22] accel/tcg: Widen pc to vaddr in CPUJumpCache Date: Mon, 26 Jun 2023 17:39:30 +0200 Message-Id: <20230626153945.76180-8-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230626153945.76180-1-richard.henderson@linaro.org> References: <20230626153945.76180-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::436; envelope-from=richard.henderson@linaro.org; helo=mail-wr1-x436.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, T_SCC_BODY_TEXT_LINE=-0.01 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 From: Anton Johansson Related functions dealing with the jump cache are also updated. Signed-off-by: Anton Johansson Reviewed-by: Richard Henderson Message-Id: <20230621135633.1649-8-anjo@rev.ng> Signed-off-by: Richard Henderson --- accel/tcg/tb-hash.h | 12 ++++++------ accel/tcg/tb-jmp-cache.h | 2 +- accel/tcg/cputlb.c | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/accel/tcg/tb-hash.h b/accel/tcg/tb-hash.h index 2ba2193731..a0c61f25cd 100644 --- a/accel/tcg/tb-hash.h +++ b/accel/tcg/tb-hash.h @@ -35,16 +35,16 @@ #define TB_JMP_ADDR_MASK (TB_JMP_PAGE_SIZE - 1) #define TB_JMP_PAGE_MASK (TB_JMP_CACHE_SIZE - TB_JMP_PAGE_SIZE) -static inline unsigned int tb_jmp_cache_hash_page(target_ulong pc) +static inline unsigned int tb_jmp_cache_hash_page(vaddr pc) { - target_ulong tmp; + vaddr tmp; tmp = pc ^ (pc >> (TARGET_PAGE_BITS - TB_JMP_PAGE_BITS)); return (tmp >> (TARGET_PAGE_BITS - TB_JMP_PAGE_BITS)) & TB_JMP_PAGE_MASK; } -static inline unsigned int tb_jmp_cache_hash_func(target_ulong pc) +static inline unsigned int tb_jmp_cache_hash_func(vaddr pc) { - target_ulong tmp; + vaddr tmp; tmp = pc ^ (pc >> (TARGET_PAGE_BITS - TB_JMP_PAGE_BITS)); return (((tmp >> (TARGET_PAGE_BITS - TB_JMP_PAGE_BITS)) & TB_JMP_PAGE_MASK) | (tmp & TB_JMP_ADDR_MASK)); @@ -53,7 +53,7 @@ static inline unsigned int tb_jmp_cache_hash_func(target_ulong pc) #else /* In user-mode we can get better hashing because we do not have a TLB */ -static inline unsigned int tb_jmp_cache_hash_func(target_ulong pc) +static inline unsigned int tb_jmp_cache_hash_func(vaddr pc) { return (pc ^ (pc >> TB_JMP_CACHE_BITS)) & (TB_JMP_CACHE_SIZE - 1); } @@ -61,7 +61,7 @@ static inline unsigned int tb_jmp_cache_hash_func(target_ulong pc) #endif /* CONFIG_SOFTMMU */ static inline -uint32_t tb_hash_func(tb_page_addr_t phys_pc, target_ulong pc, +uint32_t tb_hash_func(tb_page_addr_t phys_pc, vaddr pc, uint32_t flags, uint64_t flags2, uint32_t cf_mask) { return qemu_xxhash8(phys_pc, pc, flags2, flags, cf_mask); diff --git a/accel/tcg/tb-jmp-cache.h b/accel/tcg/tb-jmp-cache.h index bee87eb840..bb424c8a05 100644 --- a/accel/tcg/tb-jmp-cache.h +++ b/accel/tcg/tb-jmp-cache.h @@ -21,7 +21,7 @@ struct CPUJumpCache { struct rcu_head rcu; struct { TranslationBlock *tb; - target_ulong pc; + vaddr pc; } array[TB_JMP_CACHE_SIZE]; }; diff --git a/accel/tcg/cputlb.c b/accel/tcg/cputlb.c index cc53d0fb64..bdf400f6e6 100644 --- a/accel/tcg/cputlb.c +++ b/accel/tcg/cputlb.c @@ -99,7 +99,7 @@ static void tlb_window_reset(CPUTLBDesc *desc, int64_t ns, desc->window_max_entries = max_entries; } -static void tb_jmp_cache_clear_page(CPUState *cpu, target_ulong page_addr) +static void tb_jmp_cache_clear_page(CPUState *cpu, vaddr page_addr) { CPUJumpCache *jc = cpu->tb_jmp_cache; int i, i0;