From patchwork Fri Oct 27 18:08:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joey Gouly X-Patchwork-Id: 13438775 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4C3EBC25B47 for ; Fri, 27 Oct 2023 18:09:17 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DB4396B03DB; Fri, 27 Oct 2023 14:09:16 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D3BFA6B03DC; Fri, 27 Oct 2023 14:09:16 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BDDC76B03DD; Fri, 27 Oct 2023 14:09:16 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id B00A76B03DB for ; Fri, 27 Oct 2023 14:09:16 -0400 (EDT) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 8A0DF140DC7 for ; Fri, 27 Oct 2023 18:09:16 +0000 (UTC) X-FDA: 81392028312.02.15DFF07 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf28.hostedemail.com (Postfix) with ESMTP id CE62BC001D for ; Fri, 27 Oct 2023 18:09:14 +0000 (UTC) Authentication-Results: imf28.hostedemail.com; dkim=none; spf=pass (imf28.hostedemail.com: domain of joey.gouly@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=joey.gouly@arm.com; dmarc=pass (policy=none) header.from=arm.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1698430154; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=IbrnELc79cTTyl8mSzRLYhNT8sC3fwyI3hxFhzA9Hnk=; b=PMCn+VN3Ea9wGirJSqk1UKGEHNnqdx98NQAwdN9GApKaOgquvyPhpZowWQuOmVwqyc7CfK 4Ts+8bI191X+uAnwBkTCs8dM9JWp/U3UvV8tBgpJDN1O21zHPk/7vv7TqX5dQ3tteUM8wN sw/I40LE0QpChhYtyGtcrLEp6HlHJPw= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1698430154; a=rsa-sha256; cv=none; b=oneMzoskTqbDzUOKUPHQe5QBLJWz2VP8bqeKNuywfF3fG2YOPAURE+OyA+9aD3IUlRLTUP FB+ZiOO94XcNjF0oZAWnfGFVC6ZCsAbEdca2oniHbdzp73i3kGyiAoXz/ztGRbwDya3aE1 5hgQ2exjbjA1IMPMfrrt79ICPj7ZC8c= ARC-Authentication-Results: i=1; imf28.hostedemail.com; dkim=none; spf=pass (imf28.hostedemail.com: domain of joey.gouly@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=joey.gouly@arm.com; dmarc=pass (policy=none) header.from=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id A0E571576; Fri, 27 Oct 2023 11:09:55 -0700 (PDT) Received: from e124191.cambridge.arm.com (e124191.cambridge.arm.com [10.1.197.45]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id D2A023F64C; Fri, 27 Oct 2023 11:09:11 -0700 (PDT) From: Joey Gouly To: linux-arm-kernel@lists.infradead.org Cc: akpm@linux-foundation.org, aneesh.kumar@linux.ibm.com, broonie@kernel.org, catalin.marinas@arm.com, dave.hansen@linux.intel.com, joey.gouly@arm.com, maz@kernel.org, oliver.upton@linux.dev, shuah@kernel.org, will@kernel.org, kvmarm@lists.linux.dev, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-kselftest@vger.kernel.org, James Morse , Suzuki K Poulose , Zenghui Yu Subject: [PATCH v2 04/24] arm64: disable trapping of POR_EL0 to EL2 Date: Fri, 27 Oct 2023 19:08:30 +0100 Message-Id: <20231027180850.1068089-5-joey.gouly@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231027180850.1068089-1-joey.gouly@arm.com> References: <20231027180850.1068089-1-joey.gouly@arm.com> MIME-Version: 1.0 X-Stat-Signature: gzy4pzjogqizmmx4gdsr5igpbizmaun3 X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: CE62BC001D X-Rspam-User: X-HE-Tag: 1698430154-839436 X-HE-Meta: U2FsdGVkX1+P8Zxr+o8zCPcHqhnng5I246ZFMw56rOh59NKQzpjo9E5HTxY0TwRcuoRlbLDpjdJ7bzZAUIIrFRKBZz1NrFx1Bj0Y0IL4/LmWhDP5DxuE5roga7b8wxj6xOIOe3So3DKHWD2A1/n4Y+wwjNgqbv3/iSlskDktXRoOUZ19TteiYrRS3EtITTIYwOaEvzELdsxbpzFpESTBFVXY1W2i/UBgRZZLZQoISkPUJYHqjDKo54btRa/xLt/KrkkXFi73bT2zw2ustQELgJXiPqARsATx7tXmdPr7W9E/3gxKLB+XYf7WMCmIV0OvriMjM+kn9d//7CIZourJOeal/LGn0gOIj8YSkTSVwYAttSZDZP00IXxax6hsx0CcAhvi93N/3M70fwVz8WmnKWIVj6rfrGR3chWFbQ/f6WzODH9XZKtF5e+BjtxjmLjLwkh1uvSHO2lcsRyBZZvd45KGT5a+3DCjh+eRi2Z/KbymzCPQQ+2lsyuW4zEt/idAFpmIsPd70arv3/m6M5VaW8dU5r5kELIS2xFulGmTImVv2yc6JLQfuf2E3N8FxXaiEOWkGOcuAn/UGkvNtAE6IMn4UHoDEyw0d8d9xASvWGUB5fCgBM82tsBbTKIbqcNW1BX+WUuFc+RH6af1+CX7hSvXRgvfYsmpAeD6qnP910Ljr783tMRxcinaxwwp2muY3G8Uqe+HuJ685ecZo3fSgbUBnjpkO1PYQuT6HsC2qOZ42j+iP+L5IiDBh8p37dMTIBz+p+vWXHMc7KVJOfAzI4eyVY7Z06C6p57LSl7sAeD5DXcgWWLItQKiQAXqhvF8o/hhBudnHLchEOf0knU2JfHphSAvt+Jkq5Y76z7RCDwCiOqKGewqBbixXYcM9uCcsVlOuaoyQPyDK5H0WeY0IkzJvig+gCDP+JWQgArPLzJhxEzeHcCanvJSPnPuKIy7AWi1ogcEDp1//zo/6l0 CJCPVIG9 PEJ4UeZ5EsD5P9oApD/x194txRilKsTuBype9k1LadSs78PveHiw5+GXv68Yw5OxFaXlO8HleL9k7yRoBjdwms9Dmlgsod79mgn6h3XhkI6UscZmWXTHTJ9RYcNt64ThyvoygVwIaTjuhaBH/BRhDsL3DI3aDJ3GMJpRsMrwzjDDgeLDtD7mVQNAHFERf3NlsAtdSzbktVI5v6J6aYuEirrtRTQ8A5JZXUWiVpxW08WOEqBgV3XaHsi/bWv0ZWUAWU1GFaLLVAjYExP4= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Allow EL0 or EL1 to access POR_EL0 without being trapped to EL2. Signed-off-by: Joey Gouly Cc: Catalin Marinas Cc: Will Deacon --- arch/arm64/include/asm/el2_setup.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/arch/arm64/include/asm/el2_setup.h b/arch/arm64/include/asm/el2_setup.h index b7afaa026842..df5614be4b70 100644 --- a/arch/arm64/include/asm/el2_setup.h +++ b/arch/arm64/include/asm/el2_setup.h @@ -184,12 +184,20 @@ .Lset_pie_fgt_\@: mrs_s x1, SYS_ID_AA64MMFR3_EL1 ubfx x1, x1, #ID_AA64MMFR3_EL1_S1PIE_SHIFT, #4 - cbz x1, .Lset_fgt_\@ + cbz x1, .Lset_poe_fgt_\@ /* Disable trapping of PIR_EL1 / PIRE0_EL1 */ orr x0, x0, #HFGxTR_EL2_nPIR_EL1 orr x0, x0, #HFGxTR_EL2_nPIRE0_EL1 +.Lset_poe_fgt_\@: + mrs_s x1, SYS_ID_AA64MMFR3_EL1 + ubfx x1, x1, #ID_AA64MMFR3_EL1_S1POE_SHIFT, #4 + cbz x1, .Lset_fgt_\@ + + /* Disable trapping of POR_EL0 */ + orr x0, x0, #HFGxTR_EL2_nPOR_EL0 + .Lset_fgt_\@: msr_s SYS_HFGRTR_EL2, x0 msr_s SYS_HFGWTR_EL2, x0