From patchwork Mon Oct 10 14:27:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 613742 Delivered-To: patch@linaro.org Received: by 2002:a17:522:c983:b0:460:3032:e3c4 with SMTP id kr3csp2018762pvb; Mon, 10 Oct 2022 07:42:16 -0700 (PDT) X-Google-Smtp-Source: AMsMyM46CyCNmmIw776r/UxkvzspkRdU4anne7wy8AswLdN9t29EtRPWw0uasRZEUpfzDyLGlNiN X-Received: by 2002:a37:9a46:0:b0:6ec:55c9:7872 with SMTP id c67-20020a379a46000000b006ec55c97872mr5128985qke.102.1665412936096; Mon, 10 Oct 2022 07:42:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665412936; cv=none; d=google.com; s=arc-20160816; b=XssC/Aj071MWJbv7xJNlEN4rZsNb0WlCigyzMfWsnejb+NSz/ymcH+0mA464sW7qCH ciYCtqLmqciizi4MFje13aMAywj42XahnJ2d9KP7rI1pqPbHkIQjIiDeH4B2cZ6C299K MUAUcoTa7zQfLYZHLm4AL3/R5lme4kS9IQjaXCsPNRoRnXby6v1N6XE292xtSa3Y6MLn LANbI21mviI7/6mGFqljZCkSppXzmKBzh3AiIlaMVFyL2iQGYFQ+CyYTAH1X3IxmhLU1 HmtE41Gbc0FnTUa0LRwRiqbXpctMkneRaEpyBZ9vK5btLjmEoD5HtrfhhJTpg0P+skEh qn8Q== 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=WkSdaubmZsgSKUeMueDtAeU2twM74yQQ9e2GcRuy584=; b=nXbfWGkRPkQzFsR0edsI+FAyJ7rwh2O5l0jfzQle80RQFxyzcKhm+bLSbS6iGTkM4D 0G84ffHU1tNB9ZWeCkVzz+6Df6c2ZnDdhb5JukX3eoe2BMdTfmoQELe9ZbnoT8U33DUf VZkZwURt9HoZUSGvoYKhQ0tWG0ImRuZ1ZPt5xG8vz2xTXtFE5MgywQhL6csR3t0b8XAA 0/T8KUkmJTtb1kc8fcmsfh2Sp2LbAzUcjvOjv3b+K3a+OSDmPziIy9Gru0wASjBMFU72 m5LoCOX2Tb20FHFRSylBjv8SQiiFi/twn/nx7d4Gvi4PIzwhuedVujIC6Hqe+1SUhJOK NKGQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=cCurrrjh; 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 h7-20020ac87d47000000b00399d7c42f5asi2155732qtb.201.2022.10.10.07.42.15 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 10 Oct 2022 07:42:16 -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=cCurrrjh; 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]:39714 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ohtyx-0006Rp-Ji for patch@linaro.org; Mon, 10 Oct 2022 10:42:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55766) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ohtkt-00063b-L7 for qemu-devel@nongnu.org; Mon, 10 Oct 2022 10:27:43 -0400 Received: from mail-wr1-x42b.google.com ([2a00:1450:4864:20::42b]:47075) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ohtkr-0005YG-RJ for qemu-devel@nongnu.org; Mon, 10 Oct 2022 10:27:43 -0400 Received: by mail-wr1-x42b.google.com with SMTP id bk15so17271383wrb.13 for ; Mon, 10 Oct 2022 07:27:40 -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=WkSdaubmZsgSKUeMueDtAeU2twM74yQQ9e2GcRuy584=; b=cCurrrjhvZJpDlGn3otC20frDXwJK/lzweblDkrwNPK4gt7iIDgXDF+kJji1JFhEeD A516anrdXIhzf4pcDoz34accH1LXraRONpEBm0Wz1OVYemRNMlPEdN2LPHtsY0zshff3 ZsukArbvKSFctoW3bEsAcgnQ1i5/F65vGQ79rF7nJ9RyEeQDUzi5T3AIBL9tN/qEZmOr HCb9ijGp5fdQPtnS/jFSOBx/cbUCSJ0HerLhC/j3e830W36EabFIV3GWoCOooeCTDkPP QoZ3PoO/HYeiNJZHxvh8lKUZ4ersGmQVkdaEYbThYiUrw2JBvVKnZDSIyDXcaEJeIri+ iE7A== 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=WkSdaubmZsgSKUeMueDtAeU2twM74yQQ9e2GcRuy584=; b=qxjVQOo8DZusGOuh7IQZ0huw7q3jvm6OSWT2ViW+FjHTSx1poyRDGFCm5W+o0zVMUB cSB2o8BNjh1AB9k9FoPbWpo+xDcSXAE5PcppVOd/AAMOLX3YhebHZddzG/md5qKEadz3 FaUZv5PTKTP8VkB3wwFWpDSRVt9X/xLBl9Aeparn8tqGoR+lJwrLaK+2/+FsSK/Zc/kF ITi+PHV03jTUNC3LtSdSI5ZpBtbK+kY0GyJyxTeNR7kMT68+YxrLRbHH0exAtByHMx52 2pgQrIctWHbFzZUP5QjdBiLHX1uSDTI399D9hhsQzQksY4vfAJWCwRTDGj0D5NvHSt1U pkjg== X-Gm-Message-State: ACrzQf2sfTgKotfjwD0ztjIg/R+0VMaR0VfDiEQdJ9lN+xpIdqAE037K B5il4wyMMYqGyUxZKc1Ea16ZBXBosrvVYw== X-Received: by 2002:a5d:4909:0:b0:22e:7bbf:c8d with SMTP id x9-20020a5d4909000000b0022e7bbf0c8dmr10878414wrq.80.1665412059333; Mon, 10 Oct 2022 07:27:39 -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.38 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Oct 2022 07:27:38 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 06/28] target/arm: Add is_secure parameter to get_phys_addr_lpae Date: Mon, 10 Oct 2022 15:27:08 +0100 Message-Id: <20221010142730.502083-7-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::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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson Remove the use of regime_is_secure from get_phys_addr_lpae, using the new parameter instead. Reviewed-by: Alex Bennée Signed-off-by: Richard Henderson Message-id: 20221001162318.153420-3-richard.henderson@linaro.org Signed-off-by: Peter Maydell --- target/arm/ptw.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/target/arm/ptw.c b/target/arm/ptw.c index 7d763a58477..96ed8e13afc 100644 --- a/target/arm/ptw.c +++ b/target/arm/ptw.c @@ -16,8 +16,8 @@ static bool get_phys_addr_lpae(CPUARMState *env, uint64_t address, MMUAccessType access_type, ARMMMUIdx mmu_idx, - bool s1_is_el0, GetPhysAddrResult *result, - ARMMMUFaultInfo *fi) + bool is_secure, bool s1_is_el0, + GetPhysAddrResult *result, ARMMMUFaultInfo *fi) __attribute__((nonnull)); /* This mapping is common between ID_AA64MMFR0.PARANGE and TCR_ELx.{I}PS. */ @@ -207,8 +207,8 @@ static hwaddr S1_ptw_translate(CPUARMState *env, ARMMMUIdx mmu_idx, GetPhysAddrResult s2 = {}; int ret; - ret = get_phys_addr_lpae(env, addr, MMU_DATA_LOAD, s2_mmu_idx, false, - &s2, fi); + ret = get_phys_addr_lpae(env, addr, MMU_DATA_LOAD, s2_mmu_idx, + *is_secure, false, &s2, fi); if (ret) { assert(fi->type != ARMFault_None); fi->s2addr = addr; @@ -965,8 +965,8 @@ static bool check_s2_mmu_setup(ARMCPU *cpu, bool is_aa64, int level, */ static bool get_phys_addr_lpae(CPUARMState *env, uint64_t address, MMUAccessType access_type, ARMMMUIdx mmu_idx, - bool s1_is_el0, GetPhysAddrResult *result, - ARMMMUFaultInfo *fi) + bool is_secure, bool s1_is_el0, + GetPhysAddrResult *result, ARMMMUFaultInfo *fi) { ARMCPU *cpu = env_archcpu(env); /* Read an LPAE long-descriptor translation table. */ @@ -1183,7 +1183,7 @@ static bool get_phys_addr_lpae(CPUARMState *env, uint64_t address, * remain non-secure. We implement this by just ORing in the NSTable/NS * bits at each step. */ - tableattrs = regime_is_secure(env, mmu_idx) ? 0 : (1 << 4); + tableattrs = is_secure ? 0 : (1 << 4); for (;;) { uint64_t descriptor; bool nstable; @@ -2337,7 +2337,7 @@ bool get_phys_addr(CPUARMState *env, target_ulong address, memset(result, 0, sizeof(*result)); ret = get_phys_addr_lpae(env, ipa, access_type, s2_mmu_idx, - is_el0, result, fi); + s2walk_secure, is_el0, result, fi); fi->s2addr = ipa; /* Combine the S1 and S2 perms. */ @@ -2504,8 +2504,8 @@ bool get_phys_addr(CPUARMState *env, target_ulong address, } if (regime_using_lpae_format(env, mmu_idx)) { - return get_phys_addr_lpae(env, address, access_type, mmu_idx, false, - result, fi); + return get_phys_addr_lpae(env, address, access_type, mmu_idx, + is_secure, false, result, fi); } else if (regime_sctlr(env, mmu_idx) & SCTLR_XP) { return get_phys_addr_v6(env, address, access_type, mmu_idx, is_secure, result, fi);