From patchwork Thu Aug 22 15:10:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joey Gouly X-Patchwork-Id: 13773674 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 E3D3CC3DA4A for ; Thu, 22 Aug 2024 15:11:45 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2B8A26B00E4; Thu, 22 Aug 2024 11:11:45 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 268066B0246; Thu, 22 Aug 2024 11:11:45 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0E2B46B024B; Thu, 22 Aug 2024 11:11:45 -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 DFC166B00E4 for ; Thu, 22 Aug 2024 11:11:44 -0400 (EDT) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 5B17141800 for ; Thu, 22 Aug 2024 15:11:44 +0000 (UTC) X-FDA: 82480220928.26.549D041 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf06.hostedemail.com (Postfix) with ESMTP id 570C818001F for ; Thu, 22 Aug 2024 15:11:42 +0000 (UTC) Authentication-Results: imf06.hostedemail.com; dkim=none; spf=pass (imf06.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=1724339421; 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=BEcWZioiXtHX8rackaBoYWZiwxpHMb6CvKiSOd8uBKQ=; b=odf8EBTpMBUd8J2w7ULI959SBA4WHneJwVWd4zgdtL75BJh8s4MMKgGH9xU5aWj0YjqXDy ZYfeObkwHQVBOiUS9SoWFH1SIQcv8J3Tq0zgmLps+WLD/JNWgo3jW7E3c9CXrqixIjyIp7 eu55WuIYXuXCsWBKlapIMJz6koV4JA8= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1724339421; a=rsa-sha256; cv=none; b=BR1UHww8ZHzXAH+HTBVM2xKv9qg8lx3FzN8j0VV5t8HcQxvbuzdX/Pq/j4z3iWbEyjfr4e W9j7p/OCbGQIjMyHxEBYAga3Q9iuaH5NSz1TPH6izhUJOqrrDnWVFfL10N2SkqDerhHZgb Nbn/an/LyntYd5nCBQ4AEdPOrBMDAA4= ARC-Authentication-Results: i=1; imf06.hostedemail.com; dkim=none; spf=pass (imf06.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 9FA9F1596; Thu, 22 Aug 2024 08:12:07 -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 819CA3F58B; Thu, 22 Aug 2024 08:11:37 -0700 (PDT) From: Joey Gouly To: linux-arm-kernel@lists.infradead.org Cc: nd@arm.com, akpm@linux-foundation.org, aneesh.kumar@kernel.org, aneesh.kumar@linux.ibm.com, anshuman.khandual@arm.com, bp@alien8.de, broonie@kernel.org, catalin.marinas@arm.com, christophe.leroy@csgroup.eu, dave.hansen@linux.intel.com, hpa@zytor.com, joey.gouly@arm.com, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linuxppc-dev@lists.ozlabs.org, maz@kernel.org, mingo@redhat.com, mpe@ellerman.id.au, naveen.n.rao@linux.ibm.com, npiggin@gmail.com, oliver.upton@linux.dev, shuah@kernel.org, skhan@linuxfoundation.org, szabolcs.nagy@arm.com, tglx@linutronix.de, will@kernel.org, x86@kernel.org, kvmarm@lists.linux.dev, linux-kselftest@vger.kernel.org Subject: [PATCH v5 04/30] arm64: disable trapping of POR_EL0 to EL2 Date: Thu, 22 Aug 2024 16:10:47 +0100 Message-Id: <20240822151113.1479789-5-joey.gouly@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240822151113.1479789-1-joey.gouly@arm.com> References: <20240822151113.1479789-1-joey.gouly@arm.com> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 570C818001F X-Stat-Signature: zojn1scmwj5zs7kfdixhfm6p8i6yynts X-HE-Tag: 1724339502-956714 X-HE-Meta: U2FsdGVkX1/MYAEx0fY1JqTbRqzS1unSvqYhWIevd/QO7L3ywER9qH8tGwkos0StzyGfZRf26mEvX4l/SFPWyt/lw46Od+P8ggwi7kEa8ZKx8nrSLi7DB6fT1sVggHG3ohp//NJqfEhE0bbR1w3F4vHerO3QtAV6Zrv0Szf2lNiK1hoB24nUpzHOmViTjkvNH9jbKzcXkItX5wJ/zH9BQx8TxCKYStbhm1HPIYwaVZQHsVutCgSXQtqVGq5PmY67vxY7mCZ2oIXNTPpTtMAauEtj34JcCUF5Q5tKg15usje/B3Y8hW9x+AlRo1y/XHEuXljPyIHvY/iU5n9lzNLYmmr4t0YClQEIQdMTiUXGBroDouEbMFl5WO9Zqyac7hJDg2eqlR0Eqq3C9v2+jC4KPM/igzNCIp1g4DKp8qJJLqDhQOuHg99wdscdNXrn4q/QjE4vbbk+Ye3NoJI1utAnGXiyvBD1FAethPmY1csD8Y9rJqwh/Z5Lnxe1DQWLzwXy9nwzBpFT7dAXPg/dZtdJvtBiMQ6uPwEwZVDAV29S4THYFp8LwlgpBQ2lzUPWTQXtFVgE8q9nEE6UqGepMy8iOYQLz+rBfWfpysn6t2COnyH1zOkVFGaGjSLra96AvE4eBUZbVDZ53VxogolvlLvQ62yVVkOkdlHVfrDtvlxYb7oJm+nXznGQQ4jqKWcRGpzlBA3kWYhh2fk+2G1lMRTtnQgGrR3Vjon1TPJ+BhOMaW52C01l2MYNJlSQCO+r8uM1d/CrJLhfiMgXKIbY9x33ypPKaQGqb/Fi7Ln1xqNP1SYrjXQz2A/6inUhmR4/BbWsUfwtu8WUdKz/gst7gV3cmVYXFDBvz7ytnDuqDQnZ4COnkTCU0ImchRF0E3jju27JxcShmnmUbI2nH+bVHXEuyDf2s6RsgFFJ1zfHuqyQ59yaoZZufkZH+kxzItMqDeZMKES52p0aAyKsKBMsFDh guekrWhZ USpl08peMVCERJq85i2/oawCLPCgdEDgfoNMgWCSAmxl/LiMC/Mzgg0kFvUgLByEhTcUF4+EWzPn3oWs5KMlNbsBa4wFg738O1JBZtO/vOaaPe8YnGF0Ub0SGeI0p52WENjV9S520JbsbpTAbEUN7tnW8SKFxZVhp7Mf701/8T+W41FKhrGPvF0R/LbQqdINGh3M50iYYZvtBulv9eSbivI8dezXByCo/7f25ZEIGpG1qr8R/tIl84IK5zhZk51xbDzuhOQV/ESndm0w= 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 Acked-by: Catalin Marinas Reviewed-by: Anshuman Khandual --- arch/arm64/include/asm/el2_setup.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git arch/arm64/include/asm/el2_setup.h arch/arm64/include/asm/el2_setup.h index fd87c4b8f984..212191ecad40 100644 --- arch/arm64/include/asm/el2_setup.h +++ arch/arm64/include/asm/el2_setup.h @@ -185,12 +185,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