Skip to contentSkip to conversation

crypto/x86: Remove include/asm/inst.h

PATCH In review Uros Bizjak 2 participants 2 messages Jul 9, 2020 – Jul 16, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 crypto/x86: Remove include/asm/inst.h

Current minimum required version of binutils is 2.23, which supports PSHUFB, PCLMULQDQ, PEXTRD, AESKEYGENASSIST, AESIMC, AESENC, AESENCLAST, AESDEC, AESDECLAST and MOVQ instruction mnemonics.

Substitute macros from include/asm/inst.h with a proper instruction mnemonics in various assmbly files from x86/crypto directory, and remove now unneeded file.

The patch was tested by calculating and comparing sha256sum hashes of stripped object files before and after the patch, to be sure that executable code didn't change.

CC Herbert Xu <[email protected]>
CC "David S. Miller" <[email protected]>
CC Thomas Gleixner <[email protected]>
CC Ingo Molnar <[email protected]>
CC Borislav Petkov <[email protected]>
CC "H. Peter Anvin" <[email protected]>
---
 arch/x86/crypto/aes_ctrby8_avx-x86_64.S   |   1 -
 arch/x86/crypto/aesni-intel_asm.S         | 733 +++++++++++-----------
 arch/x86/crypto/aesni-intel_avx-x86_64.S  |   1 -
 arch/x86/crypto/crc32-pclmul_asm.S        |  47 +-
 arch/x86/crypto/crc32c-pcl-intel-asm_64.S |   5 +-
 arch/x86/crypto/ghash-clmulni-intel_asm.S |  17 +-
 arch/x86/include/asm/inst.h               | 311 ---------
 7 files changed, 399 insertions(+), 716 deletions(-)
 delete mode 100644 arch/x86/include/asm/inst.h
arch/x86/crypto/aes_ctrby8_avx-x86_64.S +0 -1
index ec437db1fa54..1b8ed607f06c 100644
@@ -63,7 +63,6 @@
  */
 
 #include <linux/linkage.h>
-#include <asm/inst.h>
 
 #define VMOVDQ		vmovdqu
 
arch/x86/crypto/aesni-intel_asm.S +366 -367

1,264 lines not on this page · raw message

arch/x86/crypto/aesni-intel_avx-x86_64.S +0 -1
index 0cea33295287..5fee47956f3b 100644
@@ -120,7 +120,6 @@
 ##
 
 #include <linux/linkage.h>
-#include <asm/inst.h>
 
 # constants in mergeable sections, linker can reorder and merge
 .section	.rodata.cst16.POLY, "aM", @progbits, 16
arch/x86/crypto/crc32-pclmul_asm.S +23 -24

108 lines not on this page · raw message

arch/x86/crypto/crc32c-pcl-intel-asm_64.S +2 -3
index 8501ec4532f4..d84c8bf64f02 100644
@@ -43,7 +43,6 @@
  * SOFTWARE.
  */
 
-#include <asm/inst.h>
 #include <linux/linkage.h>
 #include <asm/nospec-branch.h>
 
@@ -225,10 +224,10 @@ LABEL crc_ %i
 	subq    %rax, tmp			# tmp -= rax*24
 
 	movq    crc_init, %xmm1			# CRC for block 1
-	PCLMULQDQ 0x00,%xmm0,%xmm1		# Multiply by K2
+	pclmulqdq $0x00, %xmm0, %xmm1		# Multiply by K2
 
 	movq    crc1, %xmm2			# CRC for block 2
-	PCLMULQDQ 0x10, %xmm0, %xmm2		# Multiply by K1
+	pclmulqdq $0x10, %xmm0, %xmm2		# Multiply by K1
 
 	pxor    %xmm2,%xmm1
 	movq    %xmm1, %rax
arch/x86/crypto/ghash-clmulni-intel_asm.S +8 -9
index bb9735fbb865..99ac25e18e09 100644
@@ -14,7 +14,6 @@
  */
 
 #include <linux/linkage.h>
-#include <asm/inst.h>
 #include <asm/frame.h>
 
 .section	.rodata.cst16.bswap_mask, "aM", @progbits, 16
@@ -51,9 +50,9 @@ SYM_FUNC_START_LOCAL(__clmul_gf128mul_ble)
 	pxor DATA, T2
 	pxor SHASH, T3
 
-	PCLMULQDQ 0x00 SHASH DATA	# DATA = a0 * b0
-	PCLMULQDQ 0x11 SHASH T1		# T1 = a1 * b1
-	PCLMULQDQ 0x00 T3 T2		# T2 = (a1 + a0) * (b1 + b0)
+	pclmulqdq $0x00, SHASH, DATA	# DATA = a0 * b0
+	pclmulqdq $0x11, SHASH, T1	# T1 = a1 * b1
+	pclmulqdq $0x00, T3, T2		# T2 = (a1 + a0) * (b1 + b0)
 	pxor DATA, T2
 	pxor T1, T2			# T2 = a0 * b1 + a1 * b0
 
@@ -95,9 +94,9 @@ SYM_FUNC_START(clmul_ghash_mul)
 	movups (%rdi), DATA
 	movups (%rsi), SHASH
 	movaps .Lbswap_mask, BSWAP
-	PSHUFB_XMM BSWAP DATA
+	pshufb BSWAP, DATA
 	call __clmul_gf128mul_ble
-	PSHUFB_XMM BSWAP DATA
+	pshufb BSWAP, DATA
 	movups DATA, (%rdi)
 	FRAME_END
 	ret
@@ -114,18 +113,18 @@ SYM_FUNC_START(clmul_ghash_update)
 	movaps .Lbswap_mask, BSWAP
 	movups (%rdi), DATA
 	movups (%rcx), SHASH
-	PSHUFB_XMM BSWAP DATA
+	pshufb BSWAP, DATA
 .align 4
 .Lupdate_loop:
 	movups (%rsi), IN1
-	PSHUFB_XMM BSWAP IN1
+	pshufb BSWAP, IN1
 	pxor IN1, DATA
 	call __clmul_gf128mul_ble
 	sub $16, %rdx
 	add $16, %rsi
 	cmp $16, %rdx
 	jge .Lupdate_loop
-	PSHUFB_XMM BSWAP DATA
+	pshufb BSWAP, DATA
 	movups DATA, (%rdi)
 .Lupdate_just_ret:
 	FRAME_END
arch/x86/include/asm/inst.h deleted +0 -311

311 lines not on this page · raw message

Signature · 1 line
2.26.2
maintainer
#1 lore raw
Quoted 20 lines · Uros Bizjak

Current minimum required version of binutils is 2.23, which supports PSHUFB, PCLMULQDQ, PEXTRD, AESKEYGENASSIST, AESIMC, AESENC, AESENCLAST, AESDEC, AESDECLAST and MOVQ instruction mnemonics.

Substitute macros from include/asm/inst.h with a proper instruction mnemonics in various assmbly files from x86/crypto directory, and remove now unneeded file.

The patch was tested by calculating and comparing sha256sum hashes of stripped object files before and after the patch, to be sure that executable code didn't change.

CC Herbert Xu <[email protected]>
CC "David S. Miller" <[email protected]>
CC Thomas Gleixner <[email protected]>
CC Ingo Molnar <[email protected]>
CC Borislav Petkov <[email protected]>
CC "H. Peter Anvin" <[email protected]>
Quoted 10 lines
---
 arch/x86/crypto/aes_ctrby8_avx-x86_64.S   |   1 -
 arch/x86/crypto/aesni-intel_asm.S         | 733 +++++++++++-----------
 arch/x86/crypto/aesni-intel_avx-x86_64.S  |   1 -
 arch/x86/crypto/crc32-pclmul_asm.S        |  47 +-
 arch/x86/crypto/crc32c-pcl-intel-asm_64.S |   5 +-
 arch/x86/crypto/ghash-clmulni-intel_asm.S |  17 +-
 arch/x86/include/asm/inst.h               | 311 ---------
 7 files changed, 399 insertions(+), 716 deletions(-)
 delete mode 100644 arch/x86/include/asm/inst.h

Patch applied. Thanks.

Signature · 3 lines
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt