From patchwork Sat Oct 1 16:22:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 611381 Delivered-To: patch@linaro.org Received: by 2002:a17:522:c983:b0:460:3032:e3c4 with SMTP id kr3csp273604pvb; Sat, 1 Oct 2022 09:27:35 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5NUuy0qV51jC2M7m4xIYElxNehvHUOZknQXJeWGelAKZ5ieO/KGMmbK23LtaQmXfP1qM8C X-Received: by 2002:a05:622a:391:b0:35d:46fd:6c3a with SMTP id j17-20020a05622a039100b0035d46fd6c3amr11083564qtx.8.1664641655190; Sat, 01 Oct 2022 09:27:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664641655; cv=none; d=google.com; s=arc-20160816; b=LqAylRNvlyxnZT0DaL8RfT0hJixUGQ9mg004DWmSr/ce6QJqKbaICWH7L6dfxJJ345 EQJjWOQItVZNyYZ+VKqR7mjU2mPhiQVX05agYZv0BzK/s9UUhydEy7UasvnvbUzDPMST UiP86uXKwBOv8gizxvTwZihwIyMuAEFcD3xeOFieHeyV+rmXfzkji8rMUqasIGfMkvUa sTjqaOl3iTz90lHGKGFa+w7OT6DaEGSGeH/WB9PpozxgZ5fBGnfOzWdH4lEfwf2GRxos 78ksRfxvhITx4EugfDFnWSgHIJVbdLEsdpf/NDFQk0D+CESqfJld4YeQ4j19eeKKJMMV TIRQ== 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:cc:to :from:dkim-signature; bh=t773ZS2LkVFwCoSMRlKqTFzA/pnkk1Ts0faFvUW3ikE=; b=vdWUiaGrDKRKjJEvm1TS1xOTQtmrC7Aa9RgMqR8ch3nti0ASJdTSwVNvprdQ5WwQQ1 Y36JtpxSGKgIZ4kvwHiomVy840Rs0gp64ZNuXCs5zTSrG9rsPycDEgwYjlwChP9qCMOn tZUcUExPVu+TLzTmbuoXRfzhxsC5itObBoXjVgE0US+IHNfaZZVbi8W+3kK1B5n7phzz yMezu8FRLRPWSICXWisCUvWap4J8ESu4eR6CUOaOZfPMWMllOCJhA/Y4JzAU3075iM3S ikvuLOP61DtKF9qOXlLLpKDJw+hz9kVqSgKT3CKEk437iJBKwmJVpi7AnaxILHi63XLh W1sw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=fIcAYeOm; 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 i16-20020ac87650000000b0033dccd86319si2449083qtr.558.2022.10.01.09.27.35 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 01 Oct 2022 09:27:35 -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=fIcAYeOm; 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]:41444 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oefKw-0004Qa-M7 for patch@linaro.org; Sat, 01 Oct 2022 12:27:34 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38968) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oefH2-0006RC-Vq for qemu-devel@nongnu.org; Sat, 01 Oct 2022 12:23:33 -0400 Received: from mail-qt1-x82a.google.com ([2607:f8b0:4864:20::82a]:45762) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oefGz-0006Dr-7e for qemu-devel@nongnu.org; Sat, 01 Oct 2022 12:23:32 -0400 Received: by mail-qt1-x82a.google.com with SMTP id r20so4337968qtn.12 for ; Sat, 01 Oct 2022 09:23:28 -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:cc:to:from:from:to:cc:subject:date; bh=t773ZS2LkVFwCoSMRlKqTFzA/pnkk1Ts0faFvUW3ikE=; b=fIcAYeOm9YcTeJK2gY64bWOaHy2X6wPoM0G/auDpVHgwHzrxfWiKO3WQ5cEpR41pDY VdBbzyCXqZLMxpPwhYJ1vf0y8dnwqOjBGgIxGJX2l71ciMRnaCyqo68Ru5EhwCg90u3P mO0eNEYs/7xYobvwDohnYjTUcE82i3tn6BtRT/rMdrqfktXHyfq6DiV/Ntpz8XCAIxtx 2KOOEXZ+Yh7p6Y3hO/8XT0JYBxSrQQ814nkl0dqDwRjhd9FKrRgMr1L7zN0O6GZyV5At jzBoct6crLtJ/HTjjWMaElcjuk+OfSfohYmD/94vyDoUmp2BfqSXcakijraOx7pq5VKI bPvQ== 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:cc:to:from:x-gm-message-state:from:to:cc :subject:date; bh=t773ZS2LkVFwCoSMRlKqTFzA/pnkk1Ts0faFvUW3ikE=; b=8Itl1rA+pXQHsOx3g0souOhYOvJYNUTSjz35a/lDxh6N0hpVsswwnpa4/mqtaOyuDW gw4f/yhZAOiTPB7soZ1Oa69jyspJdhv0QZhqns5RLNyUmlgeqqeD68VOBkEM40ljGrcA FybDdmTXYYl3T25thXVmHm0HyyqOzhd9SWPOrrgo/NTAAVe3S444YSsfFs4VcIwzt4AS I8Y6sC8fcS+wy6luUyLQ91JZcQB1Zyr+rvRj1iI8t//T/pL2MSM+17zpfJBb6095IudV uUArYbMNqv2DvBC0vBwECbkEfrHXPqWDE3pSk5mAD8rhKbC6w47TjQXWdWcxuVkJdf57 sgpQ== X-Gm-Message-State: ACrzQf2FYnwQmUSoAc54AZ0oe7faKDK0XQ6d9fImFwrNVKIigIJ0Pito ET8PXBNe+ZIO6fmdXSHpB5n7UDpV3OfM8A== X-Received: by 2002:ac8:5a86:0:b0:35c:d85f:915e with SMTP id c6-20020ac85a86000000b0035cd85f915emr11130479qtc.19.1664641408261; Sat, 01 Oct 2022 09:23:28 -0700 (PDT) Received: from stoup.. ([2605:ef80:8084:91a4:f7cb:db31:c505:b931]) by smtp.gmail.com with ESMTPSA id t4-20020a37ea04000000b006d1d8fdea8asm4387445qkj.85.2022.10.01.09.23.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 01 Oct 2022 09:23:27 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, =?utf-8?q?Alex_Benn=C3=A9e?= Subject: [PATCH v3 02/42] target/arm: Add is_secure parameter to get_phys_addr_lpae Date: Sat, 1 Oct 2022 09:22:38 -0700 Message-Id: <20221001162318.153420-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221001162318.153420-1-richard.henderson@linaro.org> References: <20221001162318.153420-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::82a; envelope-from=richard.henderson@linaro.org; helo=mail-qt1-x82a.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=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" 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 --- v3: Update to use s2walk_secure. --- 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 b8c494ad9f..b7c999ffce 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. */ @@ -2505,8 +2505,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);