From patchwork Mon Oct 10 14:27:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 613732 Delivered-To: patch@linaro.org Received: by 2002:a17:522:c983:b0:460:3032:e3c4 with SMTP id kr3csp2012358pvb; Mon, 10 Oct 2022 07:31:27 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6mPTp3t1bx1iyAHkl8qKdGgLiDraCM9veLr6gGEPeknnvphBpwyxeTvGXkYpyH9T6tfVra X-Received: by 2002:a05:620a:2902:b0:6ce:7e0d:c233 with SMTP id m2-20020a05620a290200b006ce7e0dc233mr12618812qkp.205.1665412287204; Mon, 10 Oct 2022 07:31:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665412287; cv=none; d=google.com; s=arc-20160816; b=nP0bP6AXpC3pTj+FvLdlR3P3570bOVxyJwwwnwXd7EmALmzRRAzQKpIfJ28HJkjBet 8fTiXCYW4X88Z2zDL2Mau0/sz6D/S3iAeE1gvPC4GM9PAOp/KHUxklASi6Qu/VVx1J1R RSb11SF8MY4o5+a4vJ2R/DVB8iskCW/3qFYDy6Oy9ys0Ya63wP2R42xUqQcYpFheZtKP C2L0WiVzhw34Xtkl34Xah7byYYI+XZyVUtDDZjd8z/nYwaRnOrwZj31BePKn2ZHgj4t4 dm8TrHNHmjiu919AJCIX9NgZC/NeXamXzSL8eGGK8wQI755Xej5ybwKNLxB8VaNX+Y/B xLrw== 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=3qV9Bd6BDRz/hfn9vSKAZJrKreSv3U0/Yi5V2ypL1h0=; b=awYbk/XezJBqfU/Ismke6l23SS76wDx1rvntMmjw1n91JMie9+/CvwY1DvlmJS6pCd RbJ3/6n6hbl3xtdWj8NlKgUWO0S7OsxJWV6ImQwvBfbyzLAFIyZs4/Oo3Rg2k9kKNFu1 y9p0q49BVN+X0swcGAibB8JINv/2iNGS39bVG6Clu+dHXwk36QhtKVx2zjjqAh1jndgc 6BOXGZ0T4qyxZxO/PXz89/TXdXm+gJkmJDhHtgfzOUdqhBCa0GEYw87u2pKotKYEagYI UahxfYzlTG29f0eEAJl8u49cls+iOVup5DQtam0qVkXo3xSHeH7uxRQHDxs5EkIkOm8X 3fdw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=IZaloUad; 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 dw1-20020a05620a600100b006ecdfa15141si1682059qkb.140.2022.10.10.07.31.27 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 10 Oct 2022 07:31:27 -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=IZaloUad; 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]:34042 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ohtoT-0001EK-SF for patch@linaro.org; Mon, 10 Oct 2022 10:31:25 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55764) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ohtkq-0005vv-S5 for qemu-devel@nongnu.org; Mon, 10 Oct 2022 10:27:40 -0400 Received: from mail-wr1-x42f.google.com ([2a00:1450:4864:20::42f]:41864) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ohtkp-0005XH-90 for qemu-devel@nongnu.org; Mon, 10 Oct 2022 10:27:40 -0400 Received: by mail-wr1-x42f.google.com with SMTP id bu30so17295571wrb.8 for ; Mon, 10 Oct 2022 07:27:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; 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=3qV9Bd6BDRz/hfn9vSKAZJrKreSv3U0/Yi5V2ypL1h0=; b=IZaloUadulQgUI7/p3bCUby23IM1lPDsLiz5HSkF35uq/GGcHKXBqM8x6iOBdqaJeI nARRwVBHdqgO0tP7kLKcQwfjR+dgSpg4wLPUDmw5QQZyTpbB7fUhh9kTxeitJ5qBDSir mSvTH7spbqjCc1E7tbKQl4S8gMzLfTvl5FhuPIpzdmtK4mA7+NEbwWss+hWGezw6J2wn A0y3XrwQOEQ+FMpSoCoHD/rSmJgRYBJPZTHSIx1ZepoxUAeiMi5GZhxtFqsxkr+Z/5ep DyLfhwk4SQLe07Gu0LXWgg3tTw/Fm4DQ3+ieVBDeaikQlo6VzpSbif2HJdUXebXytcKZ 1HPQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=3qV9Bd6BDRz/hfn9vSKAZJrKreSv3U0/Yi5V2ypL1h0=; b=Gm/lV8hOyWhCj77oXljBwl1wiV3a5wUyr4A96qfkSojxf2fEVMHFDlCMn5odco14hP QkENkmKB4EqYRCblX7VUTKuuVjDLh2hA0AIz2nPdcqaNyeImOv/2G4e3n+IgCHl744M2 T165vFEPqm78ORviKGJ0H5ZP7pcW+a4S1Nsz2BsVe3ZvVFa0YtmMN+AB+a+elD91Ee59 l4wlPBrQ2EshDpQ2NM3fYSh9FXFtHIRF93yB3ppgbHq7fOBXNhWfPd9EGmfX5hvBrwUD gP4lhJ9FXeQajS9oKa9L174hlRvnBLm0Upd2Lwkdjvb16UAMslqJ083/McIs1tQeCNmc YO8A== X-Gm-Message-State: ACrzQf3iWZv9Ztw+HjAB5YgRpd1i1rThRNYueB30J4X67mEfLs7HEjqB iLrkYpGPWMu6q6swhWEPK4RFkz3zOMo21g== X-Received: by 2002:adf:fb10:0:b0:22a:f1d8:18d2 with SMTP id c16-20020adffb10000000b0022af1d818d2mr11678812wrr.483.1665412058349; Mon, 10 Oct 2022 07:27:38 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id u6-20020adfed46000000b0022e04bfa661sm9037054wro.59.2022.10.10.07.27.37 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Oct 2022 07:27:37 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 05/28] target/arm: Make the final stage1+2 write to secure be unconditional Date: Mon, 10 Oct 2022 15:27:07 +0100 Message-Id: <20221010142730.502083-6-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221010142730.502083-1-peter.maydell@linaro.org> References: <20221010142730.502083-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42f; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x42f.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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson While the stage2 call to get_phys_addr_lpae should never set attrs.secure when given a non-secure input, it's just as easy to make the final update to attrs.secure be unconditional and false in the case of non-secure input. Suggested-by: Peter Maydell Signed-off-by: Richard Henderson Message-id: 20221007152159.1414065-1-richard.henderson@linaro.org Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell --- target/arm/ptw.c | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/target/arm/ptw.c b/target/arm/ptw.c index b8c494ad9f0..7d763a58477 100644 --- a/target/arm/ptw.c +++ b/target/arm/ptw.c @@ -2365,17 +2365,16 @@ bool get_phys_addr(CPUARMState *env, target_ulong address, result->cacheattrs = combine_cacheattrs(env, cacheattrs1, result->cacheattrs); - /* Check if IPA translates to secure or non-secure PA space. */ - if (is_secure) { - if (ipa_secure) { - result->attrs.secure = - !(env->cp15.vstcr_el2 & (VSTCR_SA | VSTCR_SW)); - } else { - result->attrs.secure = - !((env->cp15.vtcr_el2 & (VTCR_NSA | VTCR_NSW)) - || (env->cp15.vstcr_el2 & (VSTCR_SA | VSTCR_SW))); - } - } + /* + * Check if IPA translates to secure or non-secure PA space. + * Note that VSTCR overrides VTCR and {N}SW overrides {N}SA. + */ + result->attrs.secure = + (is_secure + && !(env->cp15.vstcr_el2 & (VSTCR_SA | VSTCR_SW)) + && (ipa_secure + || !(env->cp15.vtcr_el2 & (VTCR_NSA | VTCR_NSW)))); + return 0; } else { /*