From nobody Mon Feb 9 23:19:08 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; 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 ARC-Seal: i=1; a=rsa-sha256; t=1610451260; cv=none; d=zohomail.com; s=zohoarc; b=Lo7mgrLVsRwnJs7ARx11O3VpCSKUrMbgRezFaWYoPB6pWWXz5vclk2HF8Ci3pabrYdgK0bw20HjxblxXHIpYJzYh6X6rFBM+7hOs76a4NgZ81O7UG4aD2NVI2v+UznnZvLZg9VkIVVsaLuTS+XYrfnI63DNk4QsPSA/Clp2WL50= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1610451260; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=lmUFJCYwhnVNi8Ia7pl3m6Mrr8xIN8fLTZkUiXODtQU=; b=KQNBO24ygZxk2UUadMHti/OqLJJRy0oQbiA4Ct/d9mHkUcgG+vAaTT8xWKd0yAp568s1nFL/b+1pKCMZ2K9/0aT0/hSZl0RcY83KgXdeJkmi1t6H601ogc5NvpgeMzEc1H7DpdXappf5TEAP+tpUkRc0QhK2/4nihhpGD9YNtno= ARC-Authentication-Results: i=1; mx.zohomail.com; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1610451260783557.8231124841698; Tue, 12 Jan 2021 03:34:20 -0800 (PST) Received: from localhost ([::1]:39292 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kzHwJ-0008S9-LU for importer@patchew.org; Tue, 12 Jan 2021 06:34:19 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:52762) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kzHB6-0003e6-Ft; Tue, 12 Jan 2021 05:45:34 -0500 Received: from poy.remlab.net ([2001:41d0:2:5a1a::]:56724 helo=ns207790.ip-94-23-215.eu) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kzHB2-0003T1-NS; Tue, 12 Jan 2021 05:45:32 -0500 Received: from basile.remlab.net (ip6-localhost [IPv6:::1]) by ns207790.ip-94-23-215.eu (Postfix) with ESMTP id 58F9360413; Tue, 12 Jan 2021 11:45:14 +0100 (CET) From: remi.denis.courmont@huawei.com To: qemu-arm@nongnu.org Subject: [PATCH 11/19] target/arm: do S1_ptw_translate() before address space lookup Date: Tue, 12 Jan 2021 12:45:03 +0200 Message-Id: <20210112104511.36576-11-remi.denis.courmont@huawei.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <12681824.uLZWGnKmhe@basile.remlab.net> References: <12681824.uLZWGnKmhe@basile.remlab.net> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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=2001:41d0:2:5a1a::; envelope-from=remi@remlab.net; helo=ns207790.ip-94-23-215.eu X-Spam_score_int: -16 X-Spam_score: -1.7 X-Spam_bar: - X-Spam_report: (-1.7 / 5.0 requ) BAYES_00=-1.9, HEADER_FROM_DIFFERENT_DOMAINS=0.249, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" From: R=C3=A9mi Denis-Courmont In the secure stage 2 translation regime, the VSTCR.SW and VTCR.NSW bits can invert the secure flag for pagetable walks. This patchset allows S1_ptw_translate() to change the non-secure bit. Signed-off-by: R=C3=A9mi Denis-Courmont Reviewed-by: Richard Henderson --- target/arm/helper.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/target/arm/helper.c b/target/arm/helper.c index 3e6b1c548b..7d96897f9a 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -10392,7 +10392,7 @@ static bool get_level1_table_address(CPUARMState *e= nv, ARMMMUIdx mmu_idx, =20 /* Translate a S1 pagetable walk through S2 if needed. */ static hwaddr S1_ptw_translate(CPUARMState *env, ARMMMUIdx mmu_idx, - hwaddr addr, MemTxAttrs txattrs, + hwaddr addr, bool *is_secure, ARMMMUFaultInfo *fi) { if (arm_mmu_idx_is_stage1_of_2(mmu_idx) && @@ -10402,6 +10402,9 @@ static hwaddr S1_ptw_translate(CPUARMState *env, AR= MMMUIdx mmu_idx, int s2prot; int ret; ARMCacheAttrs cacheattrs =3D {}; + MemTxAttrs txattrs =3D {}; + + assert(!*is_secure); /* TODO: S-EL2 */ =20 ret =3D get_phys_addr_lpae(env, addr, MMU_DATA_LOAD, ARMMMUIdx_Sta= ge2, false, @@ -10442,9 +10445,9 @@ static uint32_t arm_ldl_ptw(CPUState *cs, hwaddr ad= dr, bool is_secure, AddressSpace *as; uint32_t data; =20 + addr =3D S1_ptw_translate(env, mmu_idx, addr, &is_secure, fi); attrs.secure =3D is_secure; as =3D arm_addressspace(cs, attrs); - addr =3D S1_ptw_translate(env, mmu_idx, addr, attrs, fi); if (fi->s1ptw) { return 0; } @@ -10471,9 +10474,9 @@ static uint64_t arm_ldq_ptw(CPUState *cs, hwaddr ad= dr, bool is_secure, AddressSpace *as; uint64_t data; =20 + addr =3D S1_ptw_translate(env, mmu_idx, addr, &is_secure, fi); attrs.secure =3D is_secure; as =3D arm_addressspace(cs, attrs); - addr =3D S1_ptw_translate(env, mmu_idx, addr, attrs, fi); if (fi->s1ptw) { return 0; } --=20 2.30.0