]> git.baikalelectronics.ru Git - kernel.git/commitdiff
arm64: Add macro version of the BTI instruction
authorMark Brown <broonie@kernel.org>
Tue, 14 Dec 2021 15:27:12 +0000 (15:27 +0000)
committerCatalin Marinas <catalin.marinas@arm.com>
Tue, 14 Dec 2021 18:12:58 +0000 (18:12 +0000)
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 <mark.rutland@arm.com>
Acked-by: Ard Biesheuvel <ardb@kernel.org>
Acked-by: Will Deacon <will@kernel.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
Acked-by: Mark Rutland <mark.rutland@arm.com>
Link: https://lore.kernel.org/r/20211214152714.2380849-2-broonie@kernel.org
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
arch/arm64/crypto/aes-modes.S
arch/arm64/include/asm/assembler.h
arch/arm64/include/asm/linkage.h

index b495de22bb38081e20577798ccb59c0e785d47ac..ff01f0167ba2ca4548512fa4171a2b74b192e969 100644 (file)
@@ -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
index 136d13f3d6e922444d1bf41b529d1732fbf580e2..e8bd0af0141c36164170701ca598d8ff6610288b 100644 (file)
@@ -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
index 9906541a6861963ba26d297e0577f44c927d085a..c5d0c11d7709b59528fd4f09acc9188edf2770ce 100644 (file)
@@ -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