From patchwork Sat Oct 5 10:37:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 13823229 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 033B3CF8878 for ; Sat, 5 Oct 2024 10:41:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References :Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=fAZlcOg14oVFoKsvBt56uW+QGjwHi8HuTmr3kOxDKTk=; b=iDaX8sUUg56Q5Cmqxfjzt7i3Zo TjvJayBs1MR1/nEoVWN8QdAdTICIQNHlLLGUL09w3zRyYRIBiOBTGXYpyMIKD0GZk/+QKn5sGQuxB 56ZAhdYHDVSvFAn+Z4+lvFsw8SVpxZ1wq4HJaFduobxW55k0Q6gIiL3OC2vFr8NQD7Lkw04xXCUuL Gvvbk5D/G1Hi6A/oQN8Ygp4qL90KzFYGskBKQjVk6CTgLYW0Fi9m5MrGzJo5LDB+vDpxuf/nJgYqo RbCGrxcYgldGTe0D9tpnwC9ZSMZ/fSmHk7zCeZhseJCvHuuGruZPcleWJVUpHAUIzuKHoAmoJbX8B 2N35tVjA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1sx2EH-0000000FDxP-0jgi; Sat, 05 Oct 2024 10:41:41 +0000 Received: from nyc.source.kernel.org ([147.75.193.91]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1sx2Ac-0000000FDQ2-3Iy3 for linux-arm-kernel@lists.infradead.org; Sat, 05 Oct 2024 10:37:56 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id 7431DA403E8; Sat, 5 Oct 2024 10:37:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2A788C4CEC2; Sat, 5 Oct 2024 10:37:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1728124673; bh=8Pjxo9INu/EMoo+OhS44/Ry5FhrWqchqYTe1rDN+srw=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=bvXwRAie93MFmCGJRO4V+tIfv2x+W2yImgIjT6hJdi8+RZuCnPhDyIVR62QeMeBcP bLQZCqgGCXtgHpKLinhIeNj46JJWPgstEjHAmGFEGUatlhtrYZLlhOHv/sRa6dKcAC JCtd6Ozz9HTybQtmamvlkhY5/NEcsikCKeWJzS/wrEbHijhTrJY981GAAK7dZ218F+ k2ABlQM8wSaUG3CdsJSr33xOYVzszcTUbkwEsJWW4/fpWBJtznqHkZ7tv32Oe4KV7b FbI9M7fwPpdHJ8IirLdpZ1fSJ4BjohM10BkYdiwy/qkVyd+uE934J4TpkoyvHywrPG yCL//zlICqG9A== From: Mark Brown Date: Sat, 05 Oct 2024 11:37:29 +0100 Subject: [PATCH v14 2/5] arm64/gcs: Ensure FGTs for EL1 GCS instructions are disabled MIME-Version: 1.0 Message-Id: <20241005-arm64-gcs-v14-2-59060cd6092b@kernel.org> References: <20241005-arm64-gcs-v14-0-59060cd6092b@kernel.org> In-Reply-To: <20241005-arm64-gcs-v14-0-59060cd6092b@kernel.org> To: Catalin Marinas , Will Deacon , Marc Zyngier , Oliver Upton , Joey Gouly , Suzuki K Poulose , Shuah Khan Cc: linux-arm-kernel@lists.infradead.org, linux-doc@vger.kernel.org, kvmarm@lists.linux.dev, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Mark Brown X-Mailer: b4 0.15-dev-9b746 X-Developer-Signature: v=1; a=openpgp-sha256; l=1301; i=broonie@kernel.org; h=from:subject:message-id; bh=8Pjxo9INu/EMoo+OhS44/Ry5FhrWqchqYTe1rDN+srw=; b=owEBbQGS/pANAwAKASTWi3JdVIfQAcsmYgBnARb1lDpxvdKpZowgvD/JRoSi/pRDCs1WIRe/PPzb EpioVFSJATMEAAEKAB0WIQSt5miqZ1cYtZ/in+ok1otyXVSH0AUCZwEW9QAKCRAk1otyXVSH0LmUB/ 0banw7+CVnBt752fDpu8Y34/fz21ZAwQ8KbJGKTIH6/tX1K8ReNsMuZBsW2PSDY5tDYDQ4HQMLqHRl 230LEsoW/n2GqS/bGxFWXghMpzb/a0HiHyze5zB6NkXDiYhtLeb/gVocsBYnrUj85xpKCk7wDbciBX ru0Nft+Baamtso/j+nZfPBbV3D0aeG0jLuFs3e4vboXmQ08Wyr/DeKT2+d4LQpMYi1SxhjRcQaCiyJ aAW7h0aI3udMpf2yEJC73UWibBJ1FRrgbNyVz1FkR/M/QpKw+Ei+cfSirjvaLvKmGLIXjFJH5ae01B SRGU9w7ZvzFVN1KR7cBlqQd7nn+Nku X-Developer-Key: i=broonie@kernel.org; a=openpgp; fpr=3F2568AAC26998F9E813A1C5C3F436CA30F5D8EB X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241005_033754_933425_BC3528B3 X-CRM114-Status: UNSURE ( 7.92 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The initial EL2 setup for GCS did not include disabling of EL1 usage of GCS instructions, also disable these traps. This is the first disabling of instruction traps, use x2 to store the value to be written. Signed-off-by: Mark Brown --- arch/arm64/include/asm/el2_setup.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/arch/arm64/include/asm/el2_setup.h b/arch/arm64/include/asm/el2_setup.h index 27086a81eae34483a682681ab1be1959a339527a..99e887a5b2190f8810f1ed22d35b7acd26d2fd1e 100644 --- a/arch/arm64/include/asm/el2_setup.h +++ b/arch/arm64/include/asm/el2_setup.h @@ -170,6 +170,7 @@ cbz x1, .Lskip_fgt_\@ mov x0, xzr + mov x2, xzr mrs x1, id_aa64dfr0_el1 ubfx x1, x1, #ID_AA64DFR0_EL1_PMSVer_SHIFT, #4 cmp x1, #3 @@ -217,10 +218,14 @@ orr x0, x0, #HFGxTR_EL2_nGCS_EL1_MASK orr x0, x0, #HFGxTR_EL2_nGCS_EL0_MASK + orr x2, x2, #HFGITR_EL2_nGCSEPP_MASK + orr x2, x2, #HFGITR_EL2_nGCSSTR_EL1_MASK + orr x2, x2, #HFGITR_EL2_nGCSPUSHM_EL1_MASK + .Lset_fgt_\@: msr_s SYS_HFGRTR_EL2, x0 msr_s SYS_HFGWTR_EL2, x0 - msr_s SYS_HFGITR_EL2, xzr + msr_s SYS_HFGITR_EL2, x2 mrs x1, id_aa64pfr0_el1 // AMU traps UNDEF without AMU ubfx x1, x1, #ID_AA64PFR0_EL1_AMU_SHIFT, #4