From patchwork Fri Jul 14 15:46:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 702737 Delivered-To: patch@linaro.org Received: by 2002:adf:db4e:0:b0:314:25da:8dc4 with SMTP id f14csp1162078wrj; Fri, 14 Jul 2023 08:49:48 -0700 (PDT) X-Google-Smtp-Source: APBJJlHcfZjp0GdPSE5US3EcwD6mNgUPWKdgZfRAbOR7zjyBYOXA8SLV3h2lXJDWQ4iw5UloerQD X-Received: by 2002:a1f:5e07:0:b0:481:3721:7811 with SMTP id s7-20020a1f5e07000000b0048137217811mr3597052vkb.0.1689349787856; Fri, 14 Jul 2023 08:49:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689349787; cv=none; d=google.com; s=arc-20160816; b=EhwL7wM2/JmNOgqC5W3XsmKy49aENfxSShotuwyJLtjNuckYtNH5slWBYx4+uX9wFY sKg15mvsSHBP6eT+Ts8E8SeF+QlEKc2cNIhPWjwzBsLY7AzMi8kELgbt37ms4R5Cniau hqdeQSSOM/0esvQdVUDbncfixM78TEELpEeiNLlOqBLttnvczW1MwQ2wAfYlo30AfI5S xXbP15nhr4xNRhM9O6Ah6jT/3rv6F38+XqG2aSmv4z5QpjZnxdRVLYFsOo1yTgoW09LX p+WZe2/XO8ryEcGxBMjGPaHKsExvwZ3rKT2kzvodAQkjCH2eKgUDx2fDZUgK5Zbi8xvx cOsA== 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:to:from :dkim-signature; bh=FCSU4FtaO/3zeArkUS9xQ1e+FjPheX63usjZ65/2/SU=; fh=jvpdohKmRoZMO537s6xMKXXtj7EZws1LOMQI/oP4vXs=; b=m2pVqZsycZAgII82sFbl558nJy0+EhhhCOohI0jDelxRvmmbwKI5h5YQZgzPCSDPIa S5UCOJM3YQQ1oZoNP/lp4R6X6m4ZXtgwa7NTXAUOkNdISuzxC6K69RW7r2uYAE+bH+e8 NfcdQ7rJ3s7pziQWxvBEQc/JXGu7RbcgiF6WKeRdOSQTOJzb9Jby+KNQJEV148+Fqqzq L96Maqy9OspxYMFpr4LsjX7Zjl3ZcMpiGKX2xWJBL87xN1C5Xry9YO2N41iyD9uVBL9x yUgCW8/6PFs+Z9Z+VElsOCvfPV1RtQNOkEKLxz4WuOp41nmG21LBc7WVAnMoyZXskrtc dhBQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=I40HmBU3; 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 s11-20020ac85ccb000000b004039c748ebdsi4583567qta.658.2023.07.14.08.49.47 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 14 Jul 2023 08:49:47 -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=I40HmBU3; 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 1qKL0a-0007HZ-Ia; Fri, 14 Jul 2023 11:47:04 -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 1qKL0X-0007Fn-Mc for qemu-devel@nongnu.org; Fri, 14 Jul 2023 11:47:01 -0400 Received: from mail-wm1-x335.google.com ([2a00:1450:4864:20::335]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qKL0T-000764-4U for qemu-devel@nongnu.org; Fri, 14 Jul 2023 11:47:01 -0400 Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-3fbc5d5746cso19466425e9.2 for ; Fri, 14 Jul 2023 08:46:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1689349614; x=1691941614; 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=FCSU4FtaO/3zeArkUS9xQ1e+FjPheX63usjZ65/2/SU=; b=I40HmBU3rZY0v8A2a6SryEyazK4Rika5QmWP1Ios04mMrSxepkYPiMIH87VL9FZWDw 2rXoYF+OAm6chK0IFfeZHDRQExP97xeVEq6NvbLmLvh3Jbj2/zqEFfu39jJP7ScHpeZ7 r1O2rbAdc95BXROfBbMtD9lvnjOhnMT95ht+h/uKFqUmbtJ8j4U1jwqEXwDpkITMBN4u btY+x8a1GnjU6DfuAOwWjgD/Jl2KMkCzG4hy6KU6Q1FzjaUJIQebMWmomvSfMTehymXs Or4/6mYmYnXeoVQ5ZTmkMY0nrO1L8BdFM9DBTVyAn7INFGRRFmQIKA2kM2z/gOEOMcp/ 6XkA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689349614; x=1691941614; 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=FCSU4FtaO/3zeArkUS9xQ1e+FjPheX63usjZ65/2/SU=; b=JM3VDHQY/THgwE9gUcHvTkVzUOokfVSutUTnx8S5QTsY6bGirfKsmk4TSxVw1QKqTw Bhb5yP/iLxTtHB2rAGYIhCHsxyt2iyEdDcQ5kwAVpiHr0qSItUjULoOQEfUvNJWQ3xG7 xyBx1fGW1yXCVgvA3SfG54rXCpWm93QPjPJ0m/l0BQV+zVTvEo7ewchw3vN4MEzlTWt1 aVfmmqsp1sMrENbBvEX134Nr6b021enGl1ya5LsqCHe1L2yIF3QFExOPF+YDaM2wWOJl uBxT/5cLLX9ZAjsRIsBgUklqfhJpE8CiyBZwe9iKCbJHSxflFGcavALxYvb1HYTSEFuA bytA== X-Gm-Message-State: ABy/qLZ5JA/xwuz4gRLpNjhCbxKMe6FZyaMSRbrR7+HrGmgTh2yrDeBt 6kfv/oFlDI1Tq0FpMJw1khRByinsa8cRaqTplto= X-Received: by 2002:a5d:538e:0:b0:314:36f0:2214 with SMTP id d14-20020a5d538e000000b0031436f02214mr4443398wrv.6.1689349614715; Fri, 14 Jul 2023 08:46:54 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id t16-20020a5d49d0000000b003143bb5ecd5sm11214025wrs.69.2023.07.14.08.46.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Jul 2023 08:46:54 -0700 (PDT) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH 08/14] target/arm/ptw: Remove last uses of ptw->in_secure Date: Fri, 14 Jul 2023 16:46:42 +0100 Message-Id: <20230714154648.327466-9-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230714154648.327466-1-peter.maydell@linaro.org> References: <20230714154648.327466-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::335; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x335.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=unavailable 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 Replace the last uses of ptw->in_secure with appropriate checks on ptw->in_space. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson --- target/arm/ptw.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/target/arm/ptw.c b/target/arm/ptw.c index c30d3fe69a0..bc834675fb2 100644 --- a/target/arm/ptw.c +++ b/target/arm/ptw.c @@ -3247,7 +3247,6 @@ static bool get_phys_addr_nogpc(CPUARMState *env, S1Translate *ptw, ARMMMUFaultInfo *fi) { ARMMMUIdx mmu_idx = ptw->in_mmu_idx; - bool is_secure = ptw->in_secure; ARMMMUIdx s1_mmu_idx; /* @@ -3255,8 +3254,8 @@ static bool get_phys_addr_nogpc(CPUARMState *env, S1Translate *ptw, * cannot upgrade a NonSecure translation regime's attributes * to Secure or Realm. */ - result->f.attrs.secure = is_secure; result->f.attrs.space = ptw->in_space; + result->f.attrs.secure = arm_space_is_secure(ptw->in_space); switch (mmu_idx) { case ARMMMUIdx_Phys_S: @@ -3270,8 +3269,12 @@ static bool get_phys_addr_nogpc(CPUARMState *env, S1Translate *ptw, case ARMMMUIdx_Stage1_E0: case ARMMMUIdx_Stage1_E1: case ARMMMUIdx_Stage1_E1_PAN: - /* First stage lookup uses second stage for ptw. */ - ptw->in_ptw_idx = is_secure ? ARMMMUIdx_Stage2_S : ARMMMUIdx_Stage2; + /* + * First stage lookup uses second stage for ptw; only + * Secure has both S and NS IPA and starts with Stage2_S. + */ + ptw->in_ptw_idx = (ptw->in_space == ARMSS_Secure) ? + ARMMMUIdx_Stage2_S : ARMMMUIdx_Stage2; break; case ARMMMUIdx_Stage2: