From nobody Tue Nov 26 18:29:15 2024 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=1706571140; cv=none; d=zohomail.com; s=zohoarc; b=iXe9dDX/31Gkz8qPmWQDkTe4AyQtP3WpDXVi3ngzCCHC5BJBWEWYXZRzH3JsLa4wVyLQ2w2OyTBBtZ4KKJxteqUK89Ww8wyT/TbV4VCPbs8VdKnKdzpd1/uoALFIXE/x75VLEz0Ksv1K69Tqlz/6MYj304S/i/WJwuAbuuL4xO0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1706571140; 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=lgGnmjgbm65ABwN9XCrwoifbds3p9aO0+EYuonhmffg=; b=dhAgqxp24QjfAQOOU4QTgDJlsqKrWS3OaPqPyRv8oKlyn/qGLrsTQ4yhUplxRMwJmP1TMhJS+n2cr6rOuS89PTtb0ztN5Tgl0ztGbKJP0dVkDaBkQIoCPvJRi2SvZzZAEgqsBFIaXGXka/GPEoiU32/pxNCvzBZvzPF4Ws/pokM= 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 1706571140575760.1838388963048; Mon, 29 Jan 2024 15:32:20 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rUb65-0005cd-El; Mon, 29 Jan 2024 18:31:25 -0500 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 1rUb5h-0005RM-LU for qemu-devel@nongnu.org; Mon, 29 Jan 2024 18:31:05 -0500 Received: from mail-pl1-x62e.google.com ([2607:f8b0:4864:20::62e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rUb5e-00050y-JM for qemu-devel@nongnu.org; Mon, 29 Jan 2024 18:31:00 -0500 Received: by mail-pl1-x62e.google.com with SMTP id d9443c01a7336-1d51ba18e1bso31328505ad.0 for ; Mon, 29 Jan 2024 15:30:58 -0800 (PST) Received: from stoup.. ([103.210.27.218]) by smtp.gmail.com with ESMTPSA id l6-20020a170902eb0600b001d8dbb867b1sm2710591plb.179.2024.01.29.15.30.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Jan 2024 15:30:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1706571057; x=1707175857; 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=lgGnmjgbm65ABwN9XCrwoifbds3p9aO0+EYuonhmffg=; b=uku3NPlSWeKEC8FomPlFBNrHecgO5mjHWY2nSjsU1Lvse3XhlPdPq0LI9RUxVG7/4c yhZ2pP3zvDrk+OjI70t2wZWeeuV3tJ2vTZTcCxL5kfKtXd7F7mdjSn7CwoFb3vKq6PYM XCJGqXVXjyymyTgd7+HkzZqWYMVAYcU58lSUDNVCTb/wQLHQ0CKgs1B/B7ywGL8/0zey W5cFu3j0P6OLkcLsVmfVSy1jJEchUPVbnVaarj4Vh/UrRIAYbVPE4kgdgXEEp2UbYVZC M3MYDKh6BF7QFVJJPLEWWzUxzqXjVO8jR8iYmHu8GlAIPrpJEcnEulXopcGA4NBbbNWl uYtg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706571057; x=1707175857; 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=lgGnmjgbm65ABwN9XCrwoifbds3p9aO0+EYuonhmffg=; b=DirFnAEGIHu1OfvfBWpvc8K9YpKuJ6L8+nkViPnwjLT9dyFuJa1NN5uAzwB1+FgqMC xYGgpS98sjWIoOYCmGJrIAPanGolbtek+wihjXwkAZSSxBuK+TlrJs773oJq01VWzsZi q4UgCvnR94VPYdi9ABYNHvCDhroDJ2mNNrJ+lPmFeqtD426ANPSYg+7kAbhZC//jhads hboxQlpWwPXqP9uOt+FIV3DoIw5ePDev8xC5MHSBcfZsL05T0N9yEOIuUb+Gr6Q+t7mw 1OqdjLCl449q0TJ+60CRCAQBeZboETQ2Que/B5U5cyWunVQlwaiO2atTl2fk3+xXIbt/ i/nA== X-Gm-Message-State: AOJu0YwQdAw0AjYpnHHA0wPn3x1XNermG/d1XOv4/txj7xudi0UVZrvk qVxXm280AtNszK/dsXMVS+lzs77PImxUW7vhVpvAITY9eLq1QhlFr9gn5u4UjilTbUeDKEiZ9O6 7nZg= X-Google-Smtp-Source: AGHT+IFsv+4o4EQvixLjxFxIuR9Arqu2C7qd/ohgjPO02aKUnfBrXHVlroh1PbfDNjzPrBKoHzk1/Q== X-Received: by 2002:a17:902:6849:b0:1d8:f106:cb92 with SMTP id f9-20020a170902684900b001d8f106cb92mr1944300pln.10.1706571057142; Mon, 29 Jan 2024 15:30:57 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: philmd@linaro.org, anjo@rev.ng Subject: [PATCH 04/33] target/arm: Split out arm_env_mmu_index Date: Tue, 30 Jan 2024 09:30:14 +1000 Message-Id: <20240129233043.34558-5-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240129233043.34558-1-richard.henderson@linaro.org> References: <20240129233043.34558-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::62e; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62e.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1706571141566100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Richard Henderson --- target/arm/internals.h | 5 +++++ target/arm/helper.c | 2 +- target/arm/tcg/helper-a64.c | 4 ++-- target/arm/tcg/mte_helper.c | 18 +++++++++--------- target/arm/tcg/sve_helper.c | 8 ++++---- target/arm/tcg/tlb_helper.c | 2 +- 6 files changed, 22 insertions(+), 17 deletions(-) diff --git a/target/arm/internals.h b/target/arm/internals.h index 71d6c70bf3..fc337fe40e 100644 --- a/target/arm/internals.h +++ b/target/arm/internals.h @@ -40,6 +40,11 @@ #define BANK_HYP 6 #define BANK_MON 7 =20 +static inline int arm_env_mmu_index(CPUARMState *env) +{ + return EX_TBFLAG_ANY(env->hflags, MMUIDX); +} + static inline bool excp_is_internal(int excp) { /* Return true if this exception number represents a QEMU-internal diff --git a/target/arm/helper.c b/target/arm/helper.c index 945d8571a6..b0488caf40 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -7841,7 +7841,7 @@ static void dccvap_writefn(CPUARMState *env, const AR= MCPRegInfo *opaque, uint64_t vaddr_in =3D (uint64_t) value; uint64_t vaddr =3D vaddr_in & ~(dline_size - 1); void *haddr; - int mem_idx =3D cpu_mmu_index(env, false); + int mem_idx =3D arm_env_mmu_index(env); =20 /* This won't be crossing page boundaries */ haddr =3D probe_read(env, vaddr, dline_size, mem_idx, GETPC()); diff --git a/target/arm/tcg/helper-a64.c b/target/arm/tcg/helper-a64.c index 198b975f20..ebaa7f00df 100644 --- a/target/arm/tcg/helper-a64.c +++ b/target/arm/tcg/helper-a64.c @@ -856,7 +856,7 @@ void HELPER(exception_return)(CPUARMState *env, uint64_= t new_pc) tbii =3D EX_TBFLAG_A64(env->hflags, TBII); if ((tbii >> extract64(new_pc, 55, 1)) & 1) { /* TBI is enabled. */ - int core_mmu_idx =3D cpu_mmu_index(env, false); + int core_mmu_idx =3D arm_env_mmu_index(env); if (regime_has_2_ranges(core_to_aa64_mmu_idx(core_mmu_idx))) { new_pc =3D sextract64(new_pc, 0, 56); } else { @@ -925,7 +925,7 @@ void HELPER(dc_zva)(CPUARMState *env, uint64_t vaddr_in) */ int blocklen =3D 4 << env_archcpu(env)->dcz_blocksize; uint64_t vaddr =3D vaddr_in & ~(blocklen - 1); - int mmu_idx =3D cpu_mmu_index(env, false); + int mmu_idx =3D arm_env_mmu_index(env); void *mem; =20 /* diff --git a/target/arm/tcg/mte_helper.c b/target/arm/tcg/mte_helper.c index ffb8ea1c34..d971b81370 100644 --- a/target/arm/tcg/mte_helper.c +++ b/target/arm/tcg/mte_helper.c @@ -291,7 +291,7 @@ static int load_tag1(uint64_t ptr, uint8_t *mem) =20 uint64_t HELPER(ldg)(CPUARMState *env, uint64_t ptr, uint64_t xt) { - int mmu_idx =3D cpu_mmu_index(env, false); + int mmu_idx =3D arm_env_mmu_index(env); uint8_t *mem; int rtag =3D 0; =20 @@ -311,7 +311,7 @@ static void check_tag_aligned(CPUARMState *env, uint64_= t ptr, uintptr_t ra) { if (unlikely(!QEMU_IS_ALIGNED(ptr, TAG_GRANULE))) { arm_cpu_do_unaligned_access(env_cpu(env), ptr, MMU_DATA_STORE, - cpu_mmu_index(env, false), ra); + arm_env_mmu_index(env), ra); g_assert_not_reached(); } } @@ -344,7 +344,7 @@ typedef void stg_store1(uint64_t, uint8_t *, int); static inline void do_stg(CPUARMState *env, uint64_t ptr, uint64_t xt, uintptr_t ra, stg_store1 store1) { - int mmu_idx =3D cpu_mmu_index(env, false); + int mmu_idx =3D arm_env_mmu_index(env); uint8_t *mem; =20 check_tag_aligned(env, ptr, ra); @@ -371,7 +371,7 @@ void HELPER(stg_parallel)(CPUARMState *env, uint64_t pt= r, uint64_t xt) =20 void HELPER(stg_stub)(CPUARMState *env, uint64_t ptr) { - int mmu_idx =3D cpu_mmu_index(env, false); + int mmu_idx =3D arm_env_mmu_index(env); uintptr_t ra =3D GETPC(); =20 check_tag_aligned(env, ptr, ra); @@ -381,7 +381,7 @@ void HELPER(stg_stub)(CPUARMState *env, uint64_t ptr) static inline void do_st2g(CPUARMState *env, uint64_t ptr, uint64_t xt, uintptr_t ra, stg_store1 store1) { - int mmu_idx =3D cpu_mmu_index(env, false); + int mmu_idx =3D arm_env_mmu_index(env); int tag =3D allocation_tag_from_addr(xt); uint8_t *mem1, *mem2; =20 @@ -429,7 +429,7 @@ void HELPER(st2g_parallel)(CPUARMState *env, uint64_t p= tr, uint64_t xt) =20 void HELPER(st2g_stub)(CPUARMState *env, uint64_t ptr) { - int mmu_idx =3D cpu_mmu_index(env, false); + int mmu_idx =3D arm_env_mmu_index(env); uintptr_t ra =3D GETPC(); int in_page =3D -(ptr | TARGET_PAGE_MASK); =20 @@ -445,7 +445,7 @@ void HELPER(st2g_stub)(CPUARMState *env, uint64_t ptr) =20 uint64_t HELPER(ldgm)(CPUARMState *env, uint64_t ptr) { - int mmu_idx =3D cpu_mmu_index(env, false); + int mmu_idx =3D arm_env_mmu_index(env); uintptr_t ra =3D GETPC(); int gm_bs =3D env_archcpu(env)->gm_blocksize; int gm_bs_bytes =3D 4 << gm_bs; @@ -505,7 +505,7 @@ uint64_t HELPER(ldgm)(CPUARMState *env, uint64_t ptr) =20 void HELPER(stgm)(CPUARMState *env, uint64_t ptr, uint64_t val) { - int mmu_idx =3D cpu_mmu_index(env, false); + int mmu_idx =3D arm_env_mmu_index(env); uintptr_t ra =3D GETPC(); int gm_bs =3D env_archcpu(env)->gm_blocksize; int gm_bs_bytes =3D 4 << gm_bs; @@ -555,7 +555,7 @@ void HELPER(stgm)(CPUARMState *env, uint64_t ptr, uint6= 4_t val) void HELPER(stzgm_tags)(CPUARMState *env, uint64_t ptr, uint64_t val) { uintptr_t ra =3D GETPC(); - int mmu_idx =3D cpu_mmu_index(env, false); + int mmu_idx =3D arm_env_mmu_index(env); int log2_dcz_bytes, log2_tag_bytes; intptr_t dcz_bytes, tag_bytes; uint8_t *mem; diff --git a/target/arm/tcg/sve_helper.c b/target/arm/tcg/sve_helper.c index f006d152cc..bce4295d28 100644 --- a/target/arm/tcg/sve_helper.c +++ b/target/arm/tcg/sve_helper.c @@ -5481,7 +5481,7 @@ bool sve_cont_ldst_pages(SVEContLdSt *info, SVEContFa= ult fault, CPUARMState *env, target_ulong addr, MMUAccessType access_type, uintptr_t retaddr) { - int mmu_idx =3D cpu_mmu_index(env, false); + int mmu_idx =3D arm_env_mmu_index(env); int mem_off =3D info->mem_off_first[0]; bool nofault =3D fault =3D=3D FAULT_NO; bool have_work =3D true; @@ -6529,7 +6529,7 @@ void sve_ld1_z(CPUARMState *env, void *vd, uint64_t *= vg, void *vm, sve_ldst1_host_fn *host_fn, sve_ldst1_tlb_fn *tlb_fn) { - const int mmu_idx =3D cpu_mmu_index(env, false); + const int mmu_idx =3D arm_env_mmu_index(env); const intptr_t reg_max =3D simd_oprsz(desc); const int scale =3D simd_data(desc); ARMVectorReg scratch; @@ -6715,7 +6715,7 @@ void sve_ldff1_z(CPUARMState *env, void *vd, uint64_t= *vg, void *vm, sve_ldst1_host_fn *host_fn, sve_ldst1_tlb_fn *tlb_fn) { - const int mmu_idx =3D cpu_mmu_index(env, false); + const int mmu_idx =3D arm_env_mmu_index(env); const intptr_t reg_max =3D simd_oprsz(desc); const int scale =3D simd_data(desc); const int esize =3D 1 << esz; @@ -6920,7 +6920,7 @@ void sve_st1_z(CPUARMState *env, void *vd, uint64_t *= vg, void *vm, sve_ldst1_host_fn *host_fn, sve_ldst1_tlb_fn *tlb_fn) { - const int mmu_idx =3D cpu_mmu_index(env, false); + const int mmu_idx =3D arm_env_mmu_index(env); const intptr_t reg_max =3D simd_oprsz(desc); const int scale =3D simd_data(desc); void *host[ARM_MAX_VQ * 4]; diff --git a/target/arm/tcg/tlb_helper.c b/target/arm/tcg/tlb_helper.c index 5477c7fb7d..885bf4ec14 100644 --- a/target/arm/tcg/tlb_helper.c +++ b/target/arm/tcg/tlb_helper.c @@ -281,7 +281,7 @@ void helper_exception_pc_alignment(CPUARMState *env, ta= rget_ulong pc) { ARMMMUFaultInfo fi =3D { .type =3D ARMFault_Alignment }; int target_el =3D exception_target_el(env); - int mmu_idx =3D cpu_mmu_index(env, true); + int mmu_idx =3D arm_env_mmu_index(env); uint32_t fsc; =20 env->exception.vaddress =3D pc; --=20 2.34.1