From nobody Sat Nov 23 18:21:23 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1731851459; cv=none; d=zohomail.com; s=zohoarc; b=afHMXp66v+Dr5KsBxK47a7hYSKckT0PHoCvmNZgUNR+4ratTrlW0X8+j2YNypccC2pdkrjw896gpGGn4BXtHfP8bMC8NAHFmx/ZMmLhkiFLMR2b/hc8Fby5azbC85myFlBCFa3tWsSfis0JIAuLP+CaozkdnjYU4WPUloNdexcM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1731851459; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=gjWfFSgM5KEzdl52FE7hGAgllBGqgBXace3aPtnBxZo=; b=jc59Earegjje6gauior9CCZgkL2ot8TW7zdUYESnoTxP6KfYWf+dETqX9RQrb3tJVD5A40MVL+P3ycFL1P3TSUf17RW/jhrOusz5QmfSTeF+KzxDF695Z3Alb9/EIK2qXRtUj0CXLkumNOMdYZhTSraE/QkxZdhd9QLZbx0h9ls= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1731851459860422.54332284940483; Sun, 17 Nov 2024 05:50:59 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tCffU-00065A-Qg; Sun, 17 Nov 2024 08:50:25 -0500 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 1tCffS-00064K-3s; Sun, 17 Nov 2024 08:50:22 -0500 Received: from mail-lj1-x229.google.com ([2a00:1450:4864:20::229]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tCffQ-0002HK-HX; Sun, 17 Nov 2024 08:50:21 -0500 Received: by mail-lj1-x229.google.com with SMTP id 38308e7fff4ca-2fb561f273eso31862121fa.2; Sun, 17 Nov 2024 05:50:19 -0800 (PST) Received: from fedora.. ([2a00:1370:8180:90b:d00f:257f:ffb:ac70]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-2ff698515e6sm6229361fa.25.2024.11.17.05.50.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 17 Nov 2024 05:50:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1731851418; x=1732456218; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=gjWfFSgM5KEzdl52FE7hGAgllBGqgBXace3aPtnBxZo=; b=N3HudcZLrV456Wbgpl0lsX3JIcV8znvXZIrr5issKus75Ocg7fIpmeDVPpx1/R+fEv GvkHi8NA6Jg2olwArSd5OMPUxijw6GrG0bLY1aRiqEVfOtJsuPkqoEPdO0b8Xxg12bdn gy6nt8wlkv3D0e/soZySdw0rFyYvaSCfj+jX9gUUuwrBmwlyWzVV9lPF6A4N7Xa7kuL6 wjmqwx3d5wgI6mM1wMvoMQOBdX1/G5B3LRN+sPL7mlhXdp0/NnZyRc6O/XijQNlS98BA DbTZyE4U/ukglXN+rGNXu3dQlLTO0LaOVMEgc0jsuI46J8J1nb9bl0djGQ4P7hOvQABo jp1Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731851418; x=1732456218; 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:message-id:reply-to; bh=gjWfFSgM5KEzdl52FE7hGAgllBGqgBXace3aPtnBxZo=; b=tT5SSoegc4hdxSaubiamTBRhOrowJE2K8p+QGibvX2fNJzykO0RB+8BTqmy19a4WwW EoFVNzo6F/AZWKbNZoEZH5UjUvcciviQg/AoC/lFZ18j6uqS0vevgkBmAPD9VK9T+z20 4XAviISTDxl4Is3NHeA1l9by0dJzg4qQYsmsuwCZXxSNqOdaxFJYsTu9T3VthjNCH5oh RJxHYGSn48TAC0KFKeO2SPTF1/Xmk7psazM0hSTCjpBRnlkri2eBWEyYelt6R5YkZAHi 2cfjmGN6uu5BRasHL09+DGCD9nwxkMtE79Y5x1TOvS5WvyBwiArRYXirPStjALVCdJpa 2ohg== X-Forwarded-Encrypted: i=1; AJvYcCUGz8LInRRJSsAfMoVsPq1Fwefb631U/jVTIcrio3sMMT6zNUhzsEsT9I4gVUhw5iNtM+LAXlP9OK7x@nongnu.org X-Gm-Message-State: AOJu0YwsutGohUUYZEkNRar1l8CtM10aLQ3b+z/BLtaP3PEUPd69wT2j 6IcoOY/3IDG7BqXMiXBnR8td/+frQr3S/zWeVIAUDw6Ib63EUbAr X-Google-Smtp-Source: AGHT+IFQXdDxrZNmVVDFFBqOD/FsCCK/L8uB284vQqOV9NdOt1ewm0VFgfc3fFyLWRPrzq+bZVMPew== X-Received: by 2002:a2e:b896:0:b0:2fb:403c:268b with SMTP id 38308e7fff4ca-2ff606fd49fmr42420011fa.34.1731851417825; Sun, 17 Nov 2024 05:50:17 -0800 (PST) From: Pavel Skripkin To: peter.maydell@linaro.org Cc: qemu-arm@nongnu.org, qemu-devel@nongnu.org, Pavel Skripkin Subject: [PATCH v2 1/2] arm/ptw: make get_S1prot accept decoded AP Date: Sun, 17 Nov 2024 08:50:10 -0500 Message-ID: <20241117135010.37410-1-paskripkin@gmail.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241117134931.37249-1-paskripkin@gmail.com> References: <20241117134931.37249-1-paskripkin@gmail.com> MIME-Version: 1.0 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=2a00:1450:4864:20::229; envelope-from=paskripkin@gmail.com; helo=mail-lj1-x229.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, FREEMAIL_FROM=0.001, 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1731851462084116600 Content-Type: text/plain; charset="utf-8" AP in armv7 short descriptor mode has 3 bits and also domain, which makes it incompatible with other arm schemas. To make it possible to share get_S1prot between armv8, armv7 long format, armv7 short format and armv6 it's easier to make caller decode AP. Signed-off-by: Pavel Skripkin --- target/arm/ptw.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/target/arm/ptw.c b/target/arm/ptw.c index 9849949508..50eed0f811 100644 --- a/target/arm/ptw.c +++ b/target/arm/ptw.c @@ -1357,25 +1357,24 @@ static int get_S2prot(CPUARMState *env, int s2ap, i= nt xn, bool s1_is_el0) * @env: CPUARMState * @mmu_idx: MMU index indicating required translation regime * @is_aa64: TRUE if AArch64 - * @ap: The 2-bit simple AP (AP[2:1]) + * @user_rw: Translated AP for user access + * @prot_rw: Translated AP for privileged access * @xn: XN (execute-never) bit * @pxn: PXN (privileged execute-never) bit * @in_pa: The original input pa space * @out_pa: The output pa space, modified by NSTable, NS, and NSE */ static int get_S1prot(CPUARMState *env, ARMMMUIdx mmu_idx, bool is_aa64, - int ap, int xn, int pxn, + int user_rw, int prot_rw, int xn, int pxn, ARMSecuritySpace in_pa, ARMSecuritySpace out_pa) { ARMCPU *cpu =3D env_archcpu(env); bool is_user =3D regime_is_user(env, mmu_idx); - int prot_rw, user_rw; bool have_wxn; int wxn =3D 0; =20 assert(!regime_is_stage2(mmu_idx)); =20 - user_rw =3D simple_ap_to_rw_prot_is_user(ap, true); if (is_user) { prot_rw =3D user_rw; } else { @@ -1393,8 +1392,6 @@ static int get_S1prot(CPUARMState *env, ARMMMUIdx mmu= _idx, bool is_aa64, regime_is_pan(env, mmu_idx) && (regime_sctlr(env, mmu_idx) & SCTLR_EPAN) && !xn) { prot_rw =3D 0; - } else { - prot_rw =3D simple_ap_to_rw_prot_is_user(ap, false); } } =20 @@ -2044,6 +2041,8 @@ static bool get_phys_addr_lpae(CPUARMState *env, S1Tr= anslate *ptw, int nse, ns =3D extract32(attrs, 5, 1); uint8_t attrindx; uint64_t mair; + int ap_usr =3D simple_ap_to_rw_prot_is_user(ap, true); + int ap_priv =3D simple_ap_to_rw_prot_is_user(ap, false); =20 switch (out_space) { case ARMSS_Root: @@ -2114,7 +2113,7 @@ static bool get_phys_addr_lpae(CPUARMState *env, S1Tr= anslate *ptw, * Note that we modified ptw->in_space earlier for NSTable, but * result->f.attrs retains a copy of the original security space. */ - result->f.prot =3D get_S1prot(env, mmu_idx, aarch64, ap, xn, pxn, + result->f.prot =3D get_S1prot(env, mmu_idx, aarch64, ap_usr, ap_pr= iv, xn, pxn, result->f.attrs.space, out_space); =20 /* Index into MAIR registers for cache attributes */ --=20 2.46.0 From nobody Sat Nov 23 18:21:23 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1731851460; cv=none; d=zohomail.com; s=zohoarc; b=JFf9stgvA3gxOM842XWVnZsYHx1KRatIXekseeyd2bLnWPtLanXzB5WEpWo5kdoJqOk7wJkgm5ryCDAMX0TzPdGo6EQj4PEqq1fkjWqgXL+FzGDVZjg2u7Wo/ikOVMZ4Z6poQYMoTrDjL/in+iQknPn0BiJ5bX4WfZVfgtiknlA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1731851460; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=/c3hbRcpnvd9se7nBaaHtOqLgezKzESTCDuZRz+zEik=; b=VG6Dn4r7Es+oW4GFTdM+rPhHYNeeoWju67rGVCVWw+zic7GvRAMxdzgqkHiIs24RcS1NwaBDSwYRFxMn3ZvchXnv4cTwL6aGjVxR1AC6CYw6wVldcbLRmg+OzP6UyVNlZwvxjzFpj2SvikqpXhWwOK5j5R4+sr37SxMmD3Ezzis= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1731851460108643.9337866958057; Sun, 17 Nov 2024 05:51:00 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tCffe-0006Ak-Oj; Sun, 17 Nov 2024 08:50:34 -0500 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 1tCffc-00069i-Km; Sun, 17 Nov 2024 08:50:32 -0500 Received: from mail-lf1-x12c.google.com ([2a00:1450:4864:20::12c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tCffa-0002I6-Rj; Sun, 17 Nov 2024 08:50:32 -0500 Received: by mail-lf1-x12c.google.com with SMTP id 2adb3069b0e04-53da3b911b9so2438725e87.2; Sun, 17 Nov 2024 05:50:30 -0800 (PST) Received: from fedora.. ([2a00:1370:8180:90b:d00f:257f:ffb:ac70]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-53da65019ccsm1293764e87.110.2024.11.17.05.50.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 17 Nov 2024 05:50:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1731851429; x=1732456229; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=/c3hbRcpnvd9se7nBaaHtOqLgezKzESTCDuZRz+zEik=; b=ErcRpUJar5PiYlN0RpNaFNg0GYD6oH9qb9RnV2o8nsr9pWSeW2Xbj0L+hwpxhB4Pek xO5anMFeDo99N8qeDKFRdNXh4f/dUIdAPYpHwGxPmVnNei6GCKvD+w0q0q0VOZYWVae2 oNlH5pntd6+MAiDo/lvE7TSEOAE0TixcStHpWtNlHIr4bitdTzDMa54k7nEAOTWC9MXW JKyC6Kv/MPOBc9QMdp1nBV+19qhr9mw95vazPaw81cj8WntpQofTYh41ooWuzU9YprWB AamtNYHX4V3HPbOURH/7ihXv4apRn7udKwbHoKAiC02ydhGa6tV9knBkis/YsNUsuaWh c20A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731851429; x=1732456229; 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:message-id:reply-to; bh=/c3hbRcpnvd9se7nBaaHtOqLgezKzESTCDuZRz+zEik=; b=dkIAclqz2fsEj7cB5n2WPr6vbsb+wUwZbPlc9g7pGXa6ZkL7a0UBC0wwWfAbIs0YQA 5EGN/AKrwsb8hMiH+FEYnaUHMUNe/qmCjlHUqW+RbyEHm6yzP0tXyP0ONLaU+VO2F4yt NSw5eYcwZH+Xxi47GfqX+zT5l17zwQ/165NiJ13Zes0CTWF+8XPqvNn0absqk7R3iktb KE86PvKuKEUDaCcv55C2cYZ3LR4ymN2jR4GhbLayI4LJYv1ANqUkq722Xala6hk1bwDA fAQDfiDjvN//9qWwgk/K6yaSummAacQB9g2CH4ZvxiCYYdpCn+oo83fYL5/r2yrMXAAI unNA== X-Forwarded-Encrypted: i=1; AJvYcCUxoOhT7FYzSRYcyyZ2y0evytssiLWISerRAwRRhoG+Raw0v0f76tpLdMVIS7/48/nZyWwREYVTLKPu@nongnu.org X-Gm-Message-State: AOJu0YzUGgdc9GClQ1tawXHvLXrLAhAOPLJllwCZ8RxI0LZmsMQevUqs SnX6tZMBLU2AMPWPMncH9db1LSNTBw2z/FY93gaHb8mkFm5QRS5BcRGdTGII X-Google-Smtp-Source: AGHT+IEuGBlMsbCpxpdtZKWoxuWjf8CQ6l8dHtBRFy6ueO39IpVsbi5P2LlDxKaf0lufXlV4ycC6vw== X-Received: by 2002:a05:6512:239a:b0:539:f7ab:e161 with SMTP id 2adb3069b0e04-53dab3bf59amr3430659e87.45.1731851428494; Sun, 17 Nov 2024 05:50:28 -0800 (PST) From: Pavel Skripkin To: peter.maydell@linaro.org Cc: qemu-arm@nongnu.org, qemu-devel@nongnu.org, Pavel Skripkin Subject: [PATCH v2 2/2] arm/ptw: use get_S1prot in get_phys_addr_v6 Date: Sun, 17 Nov 2024 08:50:22 -0500 Message-ID: <20241117135022.37508-1-paskripkin@gmail.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241117134931.37249-1-paskripkin@gmail.com> References: <20241117134931.37249-1-paskripkin@gmail.com> MIME-Version: 1.0 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=2a00:1450:4864:20::12c; envelope-from=paskripkin@gmail.com; helo=mail-lf1-x12c.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, FREEMAIL_FROM=0.001, 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1731851462688116600 Content-Type: text/plain; charset="utf-8" To share missing SCTRL.{U}WXN and SCR.SIF in short format walker, use get_S1prot instead of open-coded checks. Signed-off-by: Pavel Skripkin --- target/arm/ptw.c | 41 ++++++++++++++++++----------------------- 1 file changed, 18 insertions(+), 23 deletions(-) diff --git a/target/arm/ptw.c b/target/arm/ptw.c index 50eed0f811..0d003a9f7d 100644 --- a/target/arm/ptw.c +++ b/target/arm/ptw.c @@ -85,6 +85,10 @@ static bool get_phys_addr_gpc(CPUARMState *env, S1Transl= ate *ptw, GetPhysAddrResult *result, ARMMMUFaultInfo *fi); =20 +static int get_S1prot(CPUARMState *env, ARMMMUIdx mmu_idx, bool is_aa64, + int user_rw, int prot_rw, int xn, int pxn, + ARMSecuritySpace in_pa, ARMSecuritySpace out_pa); + /* This mapping is common between ID_AA64MMFR0.PARANGE and TCR_ELx.{I}PS. = */ static const uint8_t pamax_map[] =3D { [0] =3D 32, @@ -1148,7 +1152,6 @@ static bool get_phys_addr_v6(CPUARMState *env, S1Tran= slate *ptw, hwaddr phys_addr; uint32_t dacr; bool ns; - int user_prot; =20 /* Pagetable walk. */ /* Lookup l1 descriptor. */ @@ -1243,13 +1246,13 @@ static bool get_phys_addr_v6(CPUARMState *env, S1Tr= anslate *ptw, if (domain_prot =3D=3D 3) { result->f.prot =3D PAGE_READ | PAGE_WRITE | PAGE_EXEC; } else { - if (pxn && !regime_is_user(env, mmu_idx)) { - xn =3D 1; - } - if (xn && access_type =3D=3D MMU_INST_FETCH) { - fi->type =3D ARMFault_Permission; - goto do_fault; - } + int ap_usr; + int ap_priv; + ARMSecuritySpace out_space =3D ARMSS_NonSecure; + + /* NS bit is ignored in NWd. */ + if (result->f.attrs.space =3D=3D ARMSS_Secure && !ns) + out_space =3D ARMSS_Secure; =20 if (arm_feature(env, ARM_FEATURE_V6K) && (regime_sctlr(env, mmu_idx) & SCTLR_AFE)) { @@ -1259,28 +1262,20 @@ static bool get_phys_addr_v6(CPUARMState *env, S1Tr= anslate *ptw, fi->type =3D ARMFault_AccessFlag; goto do_fault; } - result->f.prot =3D simple_ap_to_rw_prot(env, mmu_idx, ap >> 1); - user_prot =3D simple_ap_to_rw_prot_is_user(ap >> 1, 1); + ap_priv =3D simple_ap_to_rw_prot(env, mmu_idx, ap >> 1); + ap_usr =3D simple_ap_to_rw_prot_is_user(ap >> 1, 1); } else { - result->f.prot =3D ap_to_rw_prot(env, mmu_idx, ap, domain_prot= ); - user_prot =3D ap_to_rw_prot_is_user(env, mmu_idx, ap, domain_p= rot, 1); - } - if (result->f.prot && !xn) { - result->f.prot |=3D PAGE_EXEC; + ap_priv =3D ap_to_rw_prot(env, mmu_idx, ap, domain_prot); + ap_usr =3D ap_to_rw_prot_is_user(env, mmu_idx, ap, domain_prot= , 1); } + + result->f.prot =3D get_S1prot(env, mmu_idx, false, ap_usr, ap_priv= , xn, pxn, + result->f.attrs.space, out_space); if (!(result->f.prot & (1 << access_type))) { /* Access permission fault. */ fi->type =3D ARMFault_Permission; goto do_fault; } - if (regime_is_pan(env, mmu_idx) && - !regime_is_user(env, mmu_idx) && - user_prot && - access_type !=3D MMU_INST_FETCH) { - /* Privileged Access Never fault */ - fi->type =3D ARMFault_Permission; - goto do_fault; - } } if (ns) { /* The NS bit will (as required by the architecture) have no effec= t if --=20 2.46.0