From nobody Fri Nov 14 20:46:02 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=1760102512; cv=none; d=zohomail.com; s=zohoarc; b=FWvceZor11dP3phrQikyEMsb4aP9Aj3aV7lxndv7zCMf28ut60t/8EyRwqrFykkKPe9u/fZThpCjs85i5h0CPvcg/Ft3m2RuU96+eErqM0eSryDe3Dwcxm0Jbcfmmd03uk+1tek6p4elBdoE+/LoMa+jan/p7cXFTkNuQkYUTLU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1760102512; h=Content-Type:Content-Transfer-Encoding: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:Cc; bh=7+nBYL3F8qlOvra824tlrP4zq/NyYtJG8TYO8wDuVM8=; b=UZewy5tE6fSyGYzUp1vRgReF5rNPKLiQ2/A9vKEqnsrSqTyO/sWaswL4oNmPJuxQ49FeCHELNaUfcSnzFJroBNLzO0ylCiYFoius5wV2Sld1jrbeHIDB4vm6+YQPqitA2JYFat1Na8NT/R+daeEdvfp4TSyJbCXPEI654AXy5uQ= 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 1760102512120422.8654905070117; Fri, 10 Oct 2025 06:21:52 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1v7CqD-00072K-TX; Fri, 10 Oct 2025 09:07:26 -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 1v7Cq1-0006v2-Kq for qemu-devel@nongnu.org; Fri, 10 Oct 2025 09:07:17 -0400 Received: from mail-wr1-x42b.google.com ([2a00:1450:4864:20::42b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1v7CpI-0003xG-P2 for qemu-devel@nongnu.org; Fri, 10 Oct 2025 09:07:12 -0400 Received: by mail-wr1-x42b.google.com with SMTP id ffacd0b85a97d-3fa528f127fso1526630f8f.1 for ; Fri, 10 Oct 2025 06:06:21 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-426ce583316sm4221657f8f.20.2025.10.10.06.06.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Oct 2025 06:06:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1760101578; x=1760706378; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=7+nBYL3F8qlOvra824tlrP4zq/NyYtJG8TYO8wDuVM8=; b=YWnPl/mW4LrJgSBdZygKnji0f3VMdgN/eDaJ1HWOdFL+pTIYJ9NvoTL/8qVK6bgrNs 127li20xA/t/yl06bgWEGOUKLrGN/i+q2ceShLsP9qjtDnNdU+iHXwBzz4rB0tl3pi3z DbpPEEpEut2wGu27sHxSURgHGbwC5jP1b3qkpTAhw00eYwP0gqQrXkbZhfmKgXuJYXKy qGnOjGm9OUXrEFvF9Y8g2apnJFZQrPFLiJXtc0BupbaxWmx/+l9oo+OBahHKMW5TDG6J xcX55iWmsmNV0O8RF5JCDJraypCiP5JPSDmGwHrPQa63vtMGk18RKGMt8jVd0GATrMSz gWbw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1760101578; x=1760706378; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=7+nBYL3F8qlOvra824tlrP4zq/NyYtJG8TYO8wDuVM8=; b=AhFb5SrUl3drjPKa1RG4Jp3FTNdUfzvvK66Nz+t7dg8+Fkpot1RfFCo1S3762MKysO iMxITZdNdNmWXlxA4z5g5aHyGYNKl4WOqgGH5s1RuWc3sH9bxDIKggPNzLQbjh/T1RN7 ywrh7faWzKCgFMdR75HrNg8tkqrqR0nYCWIIbQqbFtfJZp79dY5Zix+PkAv5G15du8XD G8X9/ubQHP/5RiFN+e51Qeh3v5C3wrCBFbxARJYapXwnEyFHnCNe8jRuwhou/U7mYhCY D+wtEuWBWj2puSHLiTwmI6CelZaIXQiuOajmylxqcskHdPoyTJvlrNMfgvwjYLc3oKM4 4jSA== X-Gm-Message-State: AOJu0YxtLBxJgeAmaWZOIMpW6Yzl0dIGcHJG//k77HgUSbjUCIJMWB25 RE5LuTizlT7LIU7/ptNqvQrkMc+rSFSsM9c2Y/29EkvmsqV5EI8FeTd7nD198qVHDKazmOy3Sqv vsMWp X-Gm-Gg: ASbGncuQMKkHy8p9Kje4ZzhZ27d6wsLZeTDb3Jkpb7+JB6z41YrGyCmqRRsPQ02e8OT 7zTR4uNNcE25wh1i/uEtvV/8FFptifk0Slnop4p/IbspmNd5FzGdD1/YAeOaRQrNoCmlmLfn3km D13CBOjDkCXJVBWS0ekMjFqeKqmyz80qvsLCNbnmwgevbO93a8qu2pxzEb/86zqBYIIv8v9LSC0 ZX9KmERZqfdnW2/y0b0rgk1S3yWj3HLDZijqRSN0+adCpL0iqqdtXfbPoUt8HR5R6TOgPaTxbZf 6Sc7vFn0jjn9D2bgLwTsWnjm3om6yhC1ldG+91VDcUCD9bIa9Bc02gGVIM4rDlHyZU5g4blJrBc DrKpbiHO43fs7hzXo5j2py4z5tN77JkoUgDwRswJROpo9aw5FNgE= X-Google-Smtp-Source: AGHT+IHMFOwhmXHr/OR2oBwK+pHFvwJ+D2U4oKlRQ+dGqNz18oPctB1sRFG0NpYfplokZ1gdBao6gQ== X-Received: by 2002:a05:6000:420e:b0:401:c55d:2d20 with SMTP id ffacd0b85a97d-42582a04d0amr9472662f8f.26.1760101577839; Fri, 10 Oct 2025 06:06:17 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 42/76] target/arm: Split {full,core}_a64_user_mem_index Date: Fri, 10 Oct 2025 14:04:53 +0100 Message-ID: <20251010130527.3921602-43-peter.maydell@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251010130527.3921602-1-peter.maydell@linaro.org> References: <20251010130527.3921602-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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=2a00:1450:4864:20::42b; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x42b.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: 1760102516174158500 From: Richard Henderson Separate get_a64_user_mem_index into two separate functions, one which returns the full ARMMMUIdx and one which returns the core mmu_idx. Reviewed-by: Pierrick Bouvier Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daud=C3=A9 Message-id: 20251008215613.300150-43-richard.henderson@linaro.org Signed-off-by: Peter Maydell --- target/arm/tcg/translate-a64.c | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c index 43c9bfef93f..1337e16a96b 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -93,7 +93,7 @@ void a64_translate_init(void) } =20 /* - * Return the core mmu_idx to use for A64 load/store insns which + * Return the full arm mmu_idx to use for A64 load/store insns which * have a "unprivileged load/store" variant. Those insns access * EL0 if executed from an EL which has control over EL0 (usually * EL1) but behave like normal loads and stores if executed from @@ -103,7 +103,7 @@ void a64_translate_init(void) * normal encoding (in which case we will return the same * thing as get_mem_index(). */ -static int get_a64_user_mem_index(DisasContext *s, bool unpriv) +static ARMMMUIdx full_a64_user_mem_index(DisasContext *s, bool unpriv) { /* * If AccType_UNPRIV is not used, the insn uses AccType_NORMAL, @@ -130,7 +130,13 @@ static int get_a64_user_mem_index(DisasContext *s, boo= l unpriv) g_assert_not_reached(); } } - return arm_to_core_mmu_idx(useridx); + return useridx; +} + +/* Return the core mmu_idx per above. */ +static int core_a64_user_mem_index(DisasContext *s, bool unpriv) +{ + return arm_to_core_mmu_idx(full_a64_user_mem_index(s, unpriv)); } =20 static void set_btype_raw(int val) @@ -3577,7 +3583,7 @@ static void op_addr_ldst_imm_pre(DisasContext *s, arg= _ldst_imm *a, if (!a->p) { tcg_gen_addi_i64(*dirty_addr, *dirty_addr, offset); } - memidx =3D get_a64_user_mem_index(s, a->unpriv); + memidx =3D core_a64_user_mem_index(s, a->unpriv); *clean_addr =3D gen_mte_check1_mmuidx(s, *dirty_addr, is_store, a->w || a->rn !=3D 31, mop, a->unpriv, memidx); @@ -3598,7 +3604,7 @@ static bool trans_STR_i(DisasContext *s, arg_ldst_imm= *a) { bool iss_sf, iss_valid =3D !a->w; TCGv_i64 clean_addr, dirty_addr, tcg_rt; - int memidx =3D get_a64_user_mem_index(s, a->unpriv); + int memidx =3D core_a64_user_mem_index(s, a->unpriv); MemOp mop =3D finalize_memop(s, a->sz + a->sign * MO_SIGN); =20 op_addr_ldst_imm_pre(s, a, &clean_addr, &dirty_addr, a->imm, true, mop= ); @@ -3616,7 +3622,7 @@ static bool trans_LDR_i(DisasContext *s, arg_ldst_imm= *a) { bool iss_sf, iss_valid =3D !a->w; TCGv_i64 clean_addr, dirty_addr, tcg_rt; - int memidx =3D get_a64_user_mem_index(s, a->unpriv); + int memidx =3D core_a64_user_mem_index(s, a->unpriv); MemOp mop =3D finalize_memop(s, a->sz + a->sign * MO_SIGN); =20 op_addr_ldst_imm_pre(s, a, &clean_addr, &dirty_addr, a->imm, false, mo= p); @@ -4514,7 +4520,7 @@ static bool do_SET(DisasContext *s, arg_set *a, bool = is_epilogue, return false; } =20 - memidx =3D get_a64_user_mem_index(s, a->unpriv); + memidx =3D core_a64_user_mem_index(s, a->unpriv); =20 /* * We pass option_a =3D=3D true, matching our implementation; @@ -4568,8 +4574,8 @@ static bool do_CPY(DisasContext *s, arg_cpy *a, bool = is_epilogue, CpyFn fn) return false; } =20 - rmemidx =3D get_a64_user_mem_index(s, runpriv); - wmemidx =3D get_a64_user_mem_index(s, wunpriv); + rmemidx =3D core_a64_user_mem_index(s, runpriv); + wmemidx =3D core_a64_user_mem_index(s, wunpriv); =20 /* * We pass option_a =3D=3D true, matching our implementation; --=20 2.43.0