From nobody Tue Nov 26 18:45:32 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=1706571380; cv=none; d=zohomail.com; s=zohoarc; b=SP8jDr01/kXy5Mrh9D22O4tSHCpYs2bdAB4xhfFOUNsPKLXfSOZ5NoN+a93kRxMVCTfvwB5ugZuHGbwVYDIN32Mo8IJSz2uGzGGCf5iv/IEFwSqJe2myEdaA3hoUkEkUtrT75nYXLicbxd1GOPo+mTmyrFT02GR7kmEhGJ0I1LU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1706571380; 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=jR/oo/A0As45gwF9os4Db/TKdBueduPDROlzWdMxfpg=; b=V9OxCB+sMPWO/X267I9+4+xGX+y6Cm9UTlzyWoB2fAUywDSu92hXv5HHOiVGJ2xV00ekboXPBhiU1HenZkA7WRWlTtF3eI3jlbzwYYMx6JxiYOmVhhLow+WHsbpskjVQFkNivwx+Wz8nP3MWqbErDT+kNLO1u2NNjZL0VUbhNPM= 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 1706571380125734.2934762002828; Mon, 29 Jan 2024 15:36:20 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rUb74-00074q-KU; Mon, 29 Jan 2024 18:32:26 -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 1rUb6V-0005z1-5e for qemu-devel@nongnu.org; Mon, 29 Jan 2024 18:31:53 -0500 Received: from mail-pl1-x634.google.com ([2607:f8b0:4864:20::634]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rUb6S-0005AD-Pm for qemu-devel@nongnu.org; Mon, 29 Jan 2024 18:31:50 -0500 Received: by mail-pl1-x634.google.com with SMTP id d9443c01a7336-1d72f71f222so15759925ad.1 for ; Mon, 29 Jan 2024 15:31:48 -0800 (PST) Received: from stoup.. ([103.210.27.218]) by smtp.gmail.com with ESMTPSA id l6-20020a170902eb0600b001d8dbb867b1sm2710591plb.179.2024.01.29.15.31.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Jan 2024 15:31:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1706571107; x=1707175907; 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=jR/oo/A0As45gwF9os4Db/TKdBueduPDROlzWdMxfpg=; b=OuHfqSDQbwsey1YRliUSP74xVHjz9qfbWE/lm3Hck07BNcbqBBZ1EbOOjP5z/mn5M+ eFNbVKSNeSz3PX1Fa9oQxWF5B2grG9XGWnCCt/L4uJNlTpQq3I9MVa3kC5KHKmh6/m12 U65E7M0+T0Y8ghTosbna15fa33BpCvbZd+HM9v1N5y2MWHHcFnSNpSieVN0wtcG/pznl IJ/Ri9LcaldQFyp0dGgXfDpCzMAdgFcgVgcoZh83x9tiOhxeB320Awu8GKIsUVT8sklG 2UqKB3dcp4gvAxcIwTpjwN+8zOHCFWlz3UI675P4YNgjZvr+VHgSXqND31APwZ88blZI Ziww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706571107; x=1707175907; 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=jR/oo/A0As45gwF9os4Db/TKdBueduPDROlzWdMxfpg=; b=rCvASZ21EXE1J1kRkWc0cYbxv5sX3pn8cRTteao9g+aOlrVUjpdrA5WIhzD2OMXK1t WvDDdD6v8miLRZ1M37X2G0lHMn/Dnz+otHFYpAHlYbX8rNysgGE3sqlVO50opQYjnXFz eu42oancq3pZkbCR9sOvNgMH6OBRcxk8wv3LtUbGIpdANW13VW/POXXAIpJoLQ1Z+ib8 /zdlQFY6LyyiwjtQ9whWIwSbqoL1HqMww0+NXf420CfFgG+aVBTQZd1SiWq5VbljQY1t odPPyFs8K5Nk9jhjwc3axebv0NNOWwXJrN5k/+lYjPhsnJUtHGINEeMKolVCaiSjhWAd CziQ== X-Gm-Message-State: AOJu0Yxle+etfJ8ybcHesQWLVXFLn8a+EhQExhAnA5WXCJrwghqzzEZY O2DZCz4Qzapc0m3VZBShQA3AH+E38aOw+BloFqFTD39hHR9cxXF//8VPtik31jpATSiVRvcqG1Z cjlI= X-Google-Smtp-Source: AGHT+IENUS8VPQtYLctmhtMmh+6g4SXCKdSCIpZCfl+cxbYxkU1orl33ziIXpcMi9JZ64uKPYWCmSA== X-Received: by 2002:a17:902:e805:b0:1d8:f98b:616b with SMTP id u5-20020a170902e80500b001d8f98b616bmr1908682plg.44.1706571107530; Mon, 29 Jan 2024 15:31:47 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: philmd@linaro.org, anjo@rev.ng Subject: [PATCH 26/33] target/s390x: Split out s390x_env_mmu_index Date: Tue, 30 Jan 2024 09:30:36 +1000 Message-Id: <20240129233043.34558-27-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::634; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x634.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: 1706571382140100003 Content-Type: text/plain; charset="utf-8" Signed-off-by: Richard Henderson --- target/s390x/cpu.h | 4 +++- target/s390x/tcg/mem_helper.c | 34 ++++++++++++++++++---------------- 2 files changed, 21 insertions(+), 17 deletions(-) diff --git a/target/s390x/cpu.h b/target/s390x/cpu.h index fa3aac4f97..f0fed5d6ad 100644 --- a/target/s390x/cpu.h +++ b/target/s390x/cpu.h @@ -381,7 +381,7 @@ extern const VMStateDescription vmstate_s390_cpu; #define MMU_HOME_IDX 2 #define MMU_REAL_IDX 3 =20 -static inline int cpu_mmu_index(CPUS390XState *env, bool ifetch) +static inline int s390x_env_mmu_index(CPUS390XState *env, bool ifetch) { #ifdef CONFIG_USER_ONLY return MMU_USER_IDX; @@ -412,6 +412,8 @@ static inline int cpu_mmu_index(CPUS390XState *env, boo= l ifetch) #endif } =20 +#define cpu_mmu_index s390x_env_mmu_index + #ifdef CONFIG_TCG =20 #include "tcg/tcg_s390x.h" diff --git a/target/s390x/tcg/mem_helper.c b/target/s390x/tcg/mem_helper.c index 84103251b9..557831def4 100644 --- a/target/s390x/tcg/mem_helper.c +++ b/target/s390x/tcg/mem_helper.c @@ -358,7 +358,7 @@ static int mmu_idx_from_as(uint8_t as) static uint32_t do_helper_nc(CPUS390XState *env, uint32_t l, uint64_t dest, uint64_t src, uintptr_t ra) { - const int mmu_idx =3D cpu_mmu_index(env, false); + const int mmu_idx =3D s390x_env_mmu_index(env, false); S390Access srca1, srca2, desta; uint32_t i; uint8_t c =3D 0; @@ -392,7 +392,7 @@ uint32_t HELPER(nc)(CPUS390XState *env, uint32_t l, uin= t64_t dest, static uint32_t do_helper_xc(CPUS390XState *env, uint32_t l, uint64_t dest, uint64_t src, uintptr_t ra) { - const int mmu_idx =3D cpu_mmu_index(env, false); + const int mmu_idx =3D s390x_env_mmu_index(env, false); S390Access srca1, srca2, desta; uint32_t i; uint8_t c =3D 0; @@ -433,7 +433,7 @@ uint32_t HELPER(xc)(CPUS390XState *env, uint32_t l, uin= t64_t dest, static uint32_t do_helper_oc(CPUS390XState *env, uint32_t l, uint64_t dest, uint64_t src, uintptr_t ra) { - const int mmu_idx =3D cpu_mmu_index(env, false); + const int mmu_idx =3D s390x_env_mmu_index(env, false); S390Access srca1, srca2, desta; uint32_t i; uint8_t c =3D 0; @@ -467,7 +467,7 @@ uint32_t HELPER(oc)(CPUS390XState *env, uint32_t l, uin= t64_t dest, static uint32_t do_helper_mvc(CPUS390XState *env, uint32_t l, uint64_t des= t, uint64_t src, uintptr_t ra) { - const int mmu_idx =3D cpu_mmu_index(env, false); + const int mmu_idx =3D s390x_env_mmu_index(env, false); S390Access srca, desta; uint32_t i; =20 @@ -508,7 +508,7 @@ void HELPER(mvc)(CPUS390XState *env, uint32_t l, uint64= _t dest, uint64_t src) /* move right to left */ void HELPER(mvcrl)(CPUS390XState *env, uint64_t l, uint64_t dest, uint64_t= src) { - const int mmu_idx =3D cpu_mmu_index(env, false); + const int mmu_idx =3D s390x_env_mmu_index(env, false); const uint64_t ra =3D GETPC(); S390Access srca, desta; int32_t i; @@ -529,7 +529,7 @@ void HELPER(mvcrl)(CPUS390XState *env, uint64_t l, uint= 64_t dest, uint64_t src) /* move inverse */ void HELPER(mvcin)(CPUS390XState *env, uint32_t l, uint64_t dest, uint64_t= src) { - const int mmu_idx =3D cpu_mmu_index(env, false); + const int mmu_idx =3D s390x_env_mmu_index(env, false); S390Access srca, desta; uintptr_t ra =3D GETPC(); int i; @@ -550,7 +550,7 @@ void HELPER(mvcin)(CPUS390XState *env, uint32_t l, uint= 64_t dest, uint64_t src) /* move numerics */ void HELPER(mvn)(CPUS390XState *env, uint32_t l, uint64_t dest, uint64_t s= rc) { - const int mmu_idx =3D cpu_mmu_index(env, false); + const int mmu_idx =3D s390x_env_mmu_index(env, false); S390Access srca1, srca2, desta; uintptr_t ra =3D GETPC(); int i; @@ -572,7 +572,7 @@ void HELPER(mvn)(CPUS390XState *env, uint32_t l, uint64= _t dest, uint64_t src) /* move with offset */ void HELPER(mvo)(CPUS390XState *env, uint32_t l, uint64_t dest, uint64_t s= rc) { - const int mmu_idx =3D cpu_mmu_index(env, false); + const int mmu_idx =3D s390x_env_mmu_index(env, false); /* MVO always processes one more byte than specified - maximum is 16 */ const int len_dest =3D (l >> 4) + 1; const int len_src =3D (l & 0xf) + 1; @@ -606,7 +606,7 @@ void HELPER(mvo)(CPUS390XState *env, uint32_t l, uint64= _t dest, uint64_t src) /* move zones */ void HELPER(mvz)(CPUS390XState *env, uint32_t l, uint64_t dest, uint64_t s= rc) { - const int mmu_idx =3D cpu_mmu_index(env, false); + const int mmu_idx =3D s390x_env_mmu_index(env, false); S390Access srca1, srca2, desta; uintptr_t ra =3D GETPC(); int i; @@ -669,7 +669,7 @@ uint32_t HELPER(clm)(CPUS390XState *env, uint32_t r1, u= int32_t mask, =20 if (!mask) { /* Recognize access exceptions for the first byte */ - probe_read(env, addr, 1, cpu_mmu_index(env, false), ra); + probe_read(env, addr, 1, s390x_env_mmu_index(env, false), ra); } =20 while (mask) { @@ -893,7 +893,7 @@ uint32_t HELPER(mvpg)(CPUS390XState *env, uint64_t r0, = uint32_t r1, uint32_t r2) { const uint64_t src =3D get_address(env, r2) & TARGET_PAGE_MASK; const uint64_t dst =3D get_address(env, r1) & TARGET_PAGE_MASK; - const int mmu_idx =3D cpu_mmu_index(env, false); + const int mmu_idx =3D s390x_env_mmu_index(env, false); const bool f =3D extract64(r0, 11, 1); const bool s =3D extract64(r0, 10, 1); const bool cco =3D extract64(r0, 8, 1); @@ -946,7 +946,7 @@ inject_exc: /* string copy */ uint32_t HELPER(mvst)(CPUS390XState *env, uint32_t r1, uint32_t r2) { - const int mmu_idx =3D cpu_mmu_index(env, false); + const int mmu_idx =3D s390x_env_mmu_index(env, false); const uint64_t d =3D get_address(env, r1); const uint64_t s =3D get_address(env, r2); const uint8_t c =3D env->regs[0]; @@ -1027,7 +1027,7 @@ static inline uint32_t do_mvcl(CPUS390XState *env, uint64_t *src, uint64_t *srclen, uint16_t pad, int wordsize, uintptr_t ra) { - const int mmu_idx =3D cpu_mmu_index(env, false); + const int mmu_idx =3D s390x_env_mmu_index(env, false); int len =3D MIN(*destlen, -(*dest | TARGET_PAGE_MASK)); S390Access srca, desta; int i, cc; @@ -1084,7 +1084,7 @@ static inline uint32_t do_mvcl(CPUS390XState *env, /* move long */ uint32_t HELPER(mvcl)(CPUS390XState *env, uint32_t r1, uint32_t r2) { - const int mmu_idx =3D cpu_mmu_index(env, false); + const int mmu_idx =3D s390x_env_mmu_index(env, false); uintptr_t ra =3D GETPC(); uint64_t destlen =3D env->regs[r1 + 1] & 0xffffff; uint64_t dest =3D get_address(env, r1); @@ -1742,7 +1742,7 @@ uint32_t HELPER(trXX)(CPUS390XState *env, uint32_t r1= , uint32_t r2, static uint32_t do_csst(CPUS390XState *env, uint32_t r3, uint64_t a1, uint64_t a2, bool parallel) { - uint32_t mem_idx =3D cpu_mmu_index(env, false); + uint32_t mem_idx =3D s390x_env_mmu_index(env, false); MemOpIdx oi16 =3D make_memop_idx(MO_TE | MO_128, mem_idx); MemOpIdx oi8 =3D make_memop_idx(MO_TE | MO_64, mem_idx); MemOpIdx oi4 =3D make_memop_idx(MO_TE | MO_32, mem_idx); @@ -2867,12 +2867,14 @@ uint32_t HELPER(cu42)(CPUS390XState *env, uint32_t = r1, uint32_t r2, uint32_t m3) void probe_write_access(CPUS390XState *env, uint64_t addr, uint64_t len, uintptr_t ra) { + const int mmu_idx =3D s390x_env_mmu_index(env, false); + /* test the actual access, not just any access to the page due to LAP = */ while (len) { const uint64_t pagelen =3D -(addr | TARGET_PAGE_MASK); const uint64_t curlen =3D MIN(pagelen, len); =20 - probe_write(env, addr, curlen, cpu_mmu_index(env, false), ra); + probe_write(env, addr, curlen, mmu_idx, ra); addr =3D wrap_address(env, addr + curlen); len -=3D curlen; } --=20 2.34.1