From mboxrd@z Thu Jan 1 00:00:00 1970 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 EE7ADC433F5 for ; Tue, 14 Dec 2021 15:29:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=KazVys7XoKVUuewDPPJ+TAKYbxZ1YYeEJG3aLpNopr8=; b=pYQONFoJEbhEW0 UyLT0rMoOCDldYYglMV0twOTglu/i9dPdBX2zY6X1LSTQma6Dh8Ve/A6w0DsV9QLz4eF1dWpzI+u+ tUuubLCMCcApAwioUW1EZd+AogZiNgNWl2d4Pdrv9Q0SuAWGsMHAXrkUCOzhIoGuRO81tDXE5omQz pTOzv2cFZTei4UEOlJXpTelxSeTDzwNSpL71i3quLA5jnwnJNuWJzvavuN2znkzQ/1gxtTd8TJKb1 52i8OtIdcfB6ATBeXz4rWGJ+KN3LQpov8LCPiuBa6dWnZaDx5QZCM5SNXWpzqrgqXhrf3uBK/JjfS 0N3rRqjrfsR1WxOD5ieA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mx9ip-00Effi-Ht; Tue, 14 Dec 2021 15:28:07 +0000 Received: from ams.source.kernel.org ([145.40.68.75]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mx9if-00Efd0-Ie for linux-arm-kernel@lists.infradead.org; Tue, 14 Dec 2021 15:27:59 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 4C9E8B819D9; Tue, 14 Dec 2021 15:27:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AC6C1C34605; Tue, 14 Dec 2021 15:27:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1639495675; bh=scSh/oxicuV351rBfWruxHDHVBMAxOMsvP6m2f7b4wM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AgNG6Laf6xmDH5PDXOYWKnCvYVLsWC5Z+/FSfXYSG0cLmZ/6rj6AOiq41Oa/Vk7W7 +LmxkoWhfM8KNBNJAhTUVRtBWFa7XT79nx5YdF47Co/ztERNt9nBov4W/qBpwnLEZb rUBHccXcJDu7JnSaJ0sCbxnhThhqLJtUkV5ttLwf//UZZQM4m/XNVhlFc7eLnWxNIi nxby1ZesaSoP9sRM2Yb5rBZNsyaSuwuOG+XPnE0PCBvWeWZFnikkIwf1kdFZEPKcU1 w6OjouD4dd2Co7SwJnKshXTiZDACjWfVkv3PI/8L82ShGPfnYK1l+SekeM0zrV9WFt j4Vhtdjz/fDXA== From: Mark Brown To: Catalin Marinas , Will Deacon Cc: Mark Rutland , Ard Biesheuvel , linux-arm-kernel@lists.infradead.org, Mark Brown Subject: [PATCH v4 1/3] arm64: Add macro version of the BTI instruction Date: Tue, 14 Dec 2021 15:27:12 +0000 Message-Id: <20211214152714.2380849-2-broonie@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20211214152714.2380849-1-broonie@kernel.org> References: <20211214152714.2380849-1-broonie@kernel.org> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2508; h=from:subject; bh=scSh/oxicuV351rBfWruxHDHVBMAxOMsvP6m2f7b4wM=; b=owEBbQGS/pANAwAKASTWi3JdVIfQAcsmYgBhuLfOesd9wfzm74N0lVx+g0T4T8HGQRWvfZkt+54S zBYx98uJATMEAAEKAB0WIQSt5miqZ1cYtZ/in+ok1otyXVSH0AUCYbi3zgAKCRAk1otyXVSH0FeGB/ 9rCnX1gVkYRh+DOTbMX5jBRK2uWCqDC+5XCUp1p2sj/YkTqiT5RNy+hrwnXaXnGTcFencwVq/3CitE AHq2jrjd1pBW/CP+T6DRZAz87i0w0oarzFZJoTflw8FUs93SXxKxhGHS6MuTB3CWuEn+JN5W1dGkhL dWAf+aiIOW6xB3qY32l5yvzKgiz+Mg0ZruFnG1pQUkOHQII99LZTGD6JMZoIPMDtMM/rLKkcDzp7sY XVYg/deZ1ypSDYcKfkDPytLHxfZAvDYk1r41FG9J/0PlkuQlxoLNmuac7g4lJvqQAsoXasC8VKd1bs c1lE9f7FW+q9/TDh1E9tjUgVlPTukj 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-20211214_072757_931241_DF7720AB X-CRM114-Status: GOOD ( 14.26 ) 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: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org BTI is only available from v8.5 so we need to encode it using HINT in generic code and for older toolchains. Add an assembler macro based on one written by Mark Rutland which lets us use the mnemonic and update the existing users. Suggested-by: Mark Rutland Acked-by: Ard Biesheuvel Acked-by: Will Deacon Signed-off-by: Mark Brown --- arch/arm64/crypto/aes-modes.S | 10 +++++----- arch/arm64/include/asm/assembler.h | 10 ++++++++++ arch/arm64/include/asm/linkage.h | 7 +------ 3 files changed, 16 insertions(+), 11 deletions(-) diff --git a/arch/arm64/crypto/aes-modes.S b/arch/arm64/crypto/aes-modes.S index b495de22bb38..ff01f0167ba2 100644 --- a/arch/arm64/crypto/aes-modes.S +++ b/arch/arm64/crypto/aes-modes.S @@ -363,15 +363,15 @@ ST5( mov v4.16b, vctr.16b ) adr x16, 1f sub x16, x16, x12, lsl #3 br x16 - hint 34 // bti c + bti c mov v0.d[0], vctr.d[0] - hint 34 // bti c + bti c mov v1.d[0], vctr.d[0] - hint 34 // bti c + bti c mov v2.d[0], vctr.d[0] - hint 34 // bti c + bti c mov v3.d[0], vctr.d[0] -ST5( hint 34 ) +ST5( bti c ) ST5( mov v4.d[0], vctr.d[0] ) 1: b 2f .previous diff --git a/arch/arm64/include/asm/assembler.h b/arch/arm64/include/asm/assembler.h index 136d13f3d6e9..e8bd0af0141c 100644 --- a/arch/arm64/include/asm/assembler.h +++ b/arch/arm64/include/asm/assembler.h @@ -790,6 +790,16 @@ alternative_endif .Lnoyield_\@: .endm +/* + * Branch Target Identifier (BTI) + */ + .macro bti, targets + .equ .L__bti_targets_c, 34 + .equ .L__bti_targets_j, 36 + .equ .L__bti_targets_jc,38 + hint #.L__bti_targets_\targets + .endm + /* * This macro emits a program property note section identifying * architecture features which require special handling, mainly for diff --git a/arch/arm64/include/asm/linkage.h b/arch/arm64/include/asm/linkage.h index 9906541a6861..c5d0c11d7709 100644 --- a/arch/arm64/include/asm/linkage.h +++ b/arch/arm64/include/asm/linkage.h @@ -6,12 +6,7 @@ #if defined(CONFIG_ARM64_BTI_KERNEL) && defined(__aarch64__) -/* - * Since current versions of gas reject the BTI instruction unless we - * set the architecture version to v8.5 we use the hint instruction - * instead. - */ -#define BTI_C hint 34 ; +#define BTI_C bti c ; /* * When using in-kernel BTI we need to ensure that PCS-conformant assembly -- 2.30.2 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel