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 90BE9C433F5 for ; Wed, 8 Dec 2021 16:15:46 +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=XeJ5mb/f5rwdDE6c87r7PDmjmUFHEgy+drwT5rBYsNw=; b=NEVzYkr/e1qcBu jHCd+tYgmFM9mMZJUakdxtc0QC1AwNfX+Nt3juqsCmr1jYGhUkBIgiFSEk1Dtivah9HYLNBa8siQd Oa5iFq8fQEUjZ7LoJ6YUVG/wkr1/H1a40Jb6TerdXNCciNuJNzLXCVus/aVu2hcDJe8Zp9eeoMvtk HHnExeRmWeFRHPC0lX2W9IBCTe9dHSbvZxhQYUGnI1USyp81h9RIc1OUjSuWF0pP8neEwD4B2tg1A fG/3eV68ZnObtySV4TaELCgpEOTbfJ8j1TcKHbADLxUOadnFb5158BF++Q2sDVOoZgVGJY7KSQMS8 zgSjXhUo0wYnSnpX9Kig==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1muza7-00DVVQ-82; Wed, 08 Dec 2021 16:14:11 +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 1muzZt-00DVTA-Ln for linux-arm-kernel@lists.infradead.org; Wed, 08 Dec 2021 16:13: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 6B53FB82183; Wed, 8 Dec 2021 16:13:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CDB2CC341CC; Wed, 8 Dec 2021 16:13:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1638980035; bh=TiSPXglZW9XXzNasPGATr8E7+zlhcQFqe9KTiHEZZFs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UoeJgyi8bhe2lOMDVd6Ajq5ps8maY/Rw8of8CtZQDVOPGjLhDuahlqQq0ZbW9S+1W 7ioDAaCjjl+Wnv8uXPScIvQXoeXjLX3+JJuSxD9DuOALoee3RIVIcWZM67j7/SHSTj kWJa5sOcv/qkUXtfPVfl7GhHgs3MpDMMzQxRwqaSjeEBTFTNR+woYJfKHWDzz3oWKv 7LRJpvGf585Vr+8+jp/5eQ+Lxdjz6PjhMTGZ8hb111z87H+/3VPP9SUEMmzzGaibOy a2R0zwbssMlrpFKlc9c4cxcHx5hCS/avO2t5+W2psx1DdERcOtNChxkC4P3tm+zKfE l58YZ6CUm6Yag== From: Mark Brown To: Catalin Marinas , Will Deacon Cc: Mark Rutland , Ard Biesheuvel , linux-arm-kernel@lists.infradead.org, Mark Brown Subject: [PATCH v3 1/2] arm64: Add macro version of the BTI instruction Date: Wed, 8 Dec 2021 16:08:18 +0000 Message-Id: <20211208160819.3515958-2-broonie@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20211208160819.3515958-1-broonie@kernel.org> References: <20211208160819.3515958-1-broonie@kernel.org> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2410; h=from:subject; bh=TiSPXglZW9XXzNasPGATr8E7+zlhcQFqe9KTiHEZZFs=; b=owEBbQGS/pANAwAKASTWi3JdVIfQAcsmYgBhsNhu8cv7z5IHj4Jr8zZjfZDYkri3tPV/rkabwxcs X1Lvt/2JATMEAAEKAB0WIQSt5miqZ1cYtZ/in+ok1otyXVSH0AUCYbDYbgAKCRAk1otyXVSH0HKbB/ 9vqG2LbSBRLH40nwKoFJx5Xx6PKSxWXyu5bsJ8pU1IG4pQBo8L9y6JS0pRhIJXzOhGTC1NGrb8OdiJ p0oRujTNDAr0ybTqmiuiBAhguXsqK8LtAvIWkYGCSVikRujRKS3eWmz1Fup2KZDnIFIMw38a1I9NB4 oLtNV/6Bqn8snLRt6N8LHF3jld+kKoF1bdb08hAHndHjewhWjTUc36btN1QmVbzpCBXGcRP2FjJ10v +JfqLuw9s9WVyPqSZZxIKVN8YqV7XvbOD4RPBIBjrq/DWKiopS3ylILr8k1E5BEsOjn8gZ/fsL7v2c ppk/h4YsHyshw8XLX/84qqO2Bqgn6X 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-20211208_081358_008206_C1FCDB78 X-CRM114-Status: GOOD ( 14.30 ) 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 written by Mark Rutland which lets us use the mnemonic and update the existing users. Suggested-by: Mark Rutland 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