From nobody Mon Sep 8 12:48:52 2025 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=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1756572531; cv=none; d=zohomail.com; s=zohoarc; b=E0ZblKRSHrzeR3lSuhNmh2HLQnRcUiqe4BFoAf63yheoNYdVkHwuaFYybxRRMz/rWyLcyxBmYlCwSXOGAhHZJksItm6jY2VfoPItmHpbpEeDje9QwuKputOUYq4cAkg8MKRb4Ra09CB9ElSwq0P71ZBMVaVt6YFF1ThLhqGdV9Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1756572531; 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=pPlzqMTyUH1o75eqZe6kHnvlek/VG80/rmWxffANEJg=; b=YkpEyj8js+rBH2NumYcqNmlIogRolzOGQuwCRGOhQqZmdaHshlGjQk210llxzk5wjMT2WwJllqwGs1AdQGwkkVvQxdv6b87Wxy9EyLSOODloJHnvQyknXNH8Xro3vG59N0Kup8M+a4Zc8sDM+8wTUmC2aPJ3wkM+imUoJt8mbmI= 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 1756572531760784.9269144000872; Sat, 30 Aug 2025 09:48:51 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1usNw8-0008Ti-ED; Sat, 30 Aug 2025 11:56:22 -0400 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 1usEM6-0005y2-4P for qemu-devel@nongnu.org; Sat, 30 Aug 2025 01:42:26 -0400 Received: from mail-pf1-x42c.google.com ([2607:f8b0:4864:20::42c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1usEM4-0004AW-IC for qemu-devel@nongnu.org; Sat, 30 Aug 2025 01:42:25 -0400 Received: by mail-pf1-x42c.google.com with SMTP id d2e1a72fcca58-77238cb3cbbso727114b3a.0 for ; Fri, 29 Aug 2025 22:42:24 -0700 (PDT) Received: from stoup.. (122-150-204-48.dyn.ip.vocus.au. [122.150.204.48]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-b4d96829a66sm2435905a12.6.2025.08.29.22.42.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Aug 2025 22:42:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1756532543; x=1757137343; 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=pPlzqMTyUH1o75eqZe6kHnvlek/VG80/rmWxffANEJg=; b=RmKBZPqwMqEHDiMO3HNsyn/DgO7NURTg50VQ0H3v41Zre5KXBESZfRtYCeUCmKugyt C/094xRln6+rSPQ6KnorVnQ6GzLYH34aKOrz5IMD5WTvQPrng39ggkf3V6TGC1a8Xvp0 DqGZpA60Ez3BakmEoJ/TZFQCYCg1udc6a/wwl9jRVv2L8WLqlqXmpGqICLXZbn9LotGt lQfn9wHVBXaQ6Uxw6vgpMkmA+ZuP9naeWed4XAcAoN183ZC7lFkKk01xOIEStd/ME/Ex Zkevo7GzIbPEoqjCWkvqroQ5TCk2exFg40agzHu1KNCQqLBUSEBDspvSusLF5CkH6W+G w8ZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1756532543; x=1757137343; 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=pPlzqMTyUH1o75eqZe6kHnvlek/VG80/rmWxffANEJg=; b=bj8aZNWFP800HIRoSpEzHGimMt4aaIylnkil4uquURT7dvo1C2/x73FLmA6qYpIj7Z k2/bwOzpfLh1p/irwppTnAZBsbzM4gGkzn8J6d6B1zxww7iNvT5+V3X2Q60ZK88pdoF1 kkTy8uNBLixpiuL/MpZn8GPGcJZo9NZmP4njOmuZnhlJhrlz7VLLnB005OJsthkQyoWp 6HW1Vz10CqMVW+6fdLAtOIxDEnucKb12GBIvmPDOdbAz75jwKVLdlkILgtMzZyWRJH/P IX2kanIupQyOF873y5SMx+jgXAbw0glYAqZ5R4lw+ZfHqFY2HvUwta2VmWbk8YwtI5zV 1d1w== X-Gm-Message-State: AOJu0Yy4Di2o2ohk+FEbZAJ4eWX5MiKDem7Jk6w0eOv8TjTAYsLwexsH MBud+sXWUip5mCgrNf5shuLp8XBp1MpDiS0KqwySag7EGuE6fMwko9CQ+CX88sMIl7tjI3lyrvN slfPserE= X-Gm-Gg: ASbGncu9hg5pk3mjlIXwX2IfBsFWaIxvv3/grE65d+1tSFcoMyKwWuGlywfvMXF4i4T hfA7Z9BpHcDwYCqdaYhDiJF+yKbPvnSYexJ6qudvNw9gc0YnLaHgJmwV31ZpQno00rE9dqo25ka gFzq0JOrILrDwHt9MUlggD/Ziu42u6Zg5NwEfXTPOjEcJDtTPb59UnuepE/L4+A862oB67xVbzK ewDlb5aT2Sf+UrGM5dN/ABLiQloK8diA7tP6ZG3IDyLS/R/Epv1ydEh5oDEimzhxKJOPpQObQ+F q5drrOWfHeZtfvXqq/WP0JgJPBIHFxsuhZKz1xoQTVu5u0aiYzzAwteb8W3sZBR/rSAq/VrQ2RK icgbSKNsCFEpyOpjqpxQVACdgrEKJycoZt0mexxNjRckYNd5xH5XAL7u/RJzd9QUQ5sT9YvE= X-Google-Smtp-Source: AGHT+IEwt1XnJrjDqrslx8RzcVEHugcigKgHhfuwS3PbkeD+NxqNVXecM0s5uhZypZZrK9wKm/4PqA== X-Received: by 2002:a05:6a21:32a7:b0:23f:f4df:6ce3 with SMTP id adf61e73a8af0-243d6e01f60mr1526362637.18.1756532543274; Fri, 29 Aug 2025 22:42:23 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Pierrick Bouvier Subject: [PATCH v4 17/84] target/arm: Cache NV1 early in get_phys_addr_lpae Date: Sat, 30 Aug 2025 15:40:21 +1000 Message-ID: <20250830054128.448363-18-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250830054128.448363-1-richard.henderson@linaro.org> References: <20250830054128.448363-1-richard.henderson@linaro.org> 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=2607:f8b0:4864:20::42c; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42c.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1756572534463124100 Content-Type: text/plain; charset="utf-8" We were not using the correct security space in the existing call to nv_nv1_enabled, because it may have been modified for NSTable. Cache it early, as we will shortly need it elsewhere as well. Reviewed-by: Pierrick Bouvier Signed-off-by: Richard Henderson --- target/arm/ptw.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/target/arm/ptw.c b/target/arm/ptw.c index aecac27c54..214279ffeb 100644 --- a/target/arm/ptw.c +++ b/target/arm/ptw.c @@ -76,6 +76,8 @@ typedef struct S1Translate { * may be suppressed for debug or AT insns. */ uint8_t in_prot_check; + /* Cached EffectiveHCR_EL2_NVx() bit */ + bool in_nv1; bool out_rw; bool out_be; ARMSecuritySpace out_space; @@ -1642,12 +1644,6 @@ static bool lpae_block_desc_valid(ARMCPU *cpu, bool = ds, } } =20 -static bool nv_nv1_enabled(CPUARMState *env, S1Translate *ptw) -{ - uint64_t hcr =3D arm_hcr_el2_eff_secstate(env, ptw->in_space); - return (hcr & (HCR_NV | HCR_NV1)) =3D=3D (HCR_NV | HCR_NV1); -} - /** * get_phys_addr_lpae: perform one stage of page table walk, LPAE format * @@ -1699,6 +1695,10 @@ static bool get_phys_addr_lpae(CPUARMState *env, S1T= ranslate *ptw, !arm_el_is_aa64(env, 1)); level =3D 0; =20 + /* Cache NV1 before we adjust ptw->in_space for NSTable. */ + ptw->in_nv1 =3D (arm_hcr_el2_eff_secstate(env, ptw->in_space) + & (HCR_NV | HCR_NV1)) =3D=3D (HCR_NV | HCR_NV1); + /* * If TxSZ is programmed to a value larger than the maximum, * or smaller than the effective minimum, it is IMPLEMENTATION @@ -2074,7 +2074,7 @@ static bool get_phys_addr_lpae(CPUARMState *env, S1Tr= anslate *ptw, xn =3D extract64(attrs, 54, 1); pxn =3D extract64(attrs, 53, 1); =20 - if (el =3D=3D 1 && nv_nv1_enabled(env, ptw)) { + if (el =3D=3D 1 && ptw->in_nv1) { /* * With FEAT_NV, when HCR_EL2.{NV,NV1} =3D=3D {1,1}, the block= /page * descriptor bit 54 holds PXN, 53 is RES0, and the effective = value --=20 2.43.0