diff mbox series

[1/6] x86: add kconfig symbols for assembler VAES and VPCLMULQDQ support

Message ID 20240326080305.402382-2-ebiggers@kernel.org (mailing list archive)
State Superseded
Delegated to: Herbert Xu
Headers show
Series Faster AES-XTS on modern x86_64 CPUs | expand

Commit Message

Eric Biggers March 26, 2024, 8:02 a.m. UTC
From: Eric Biggers <ebiggers@google.com>

Add config symbols AS_VAES and AS_VPCLMULQDQ that expose whether the
assembler supports the vector AES and carryless multiplication
cryptographic extensions.

Signed-off-by: Eric Biggers <ebiggers@google.com>
---
 arch/x86/Kconfig.assembler | 10 ++++++++++
 1 file changed, 10 insertions(+)

Comments

Ingo Molnar March 26, 2024, 8:10 a.m. UTC | #1
* Eric Biggers <ebiggers@kernel.org> wrote:

> From: Eric Biggers <ebiggers@google.com>
> 
> Add config symbols AS_VAES and AS_VPCLMULQDQ that expose whether the
> assembler supports the vector AES and carryless multiplication
> cryptographic extensions.
> 
> Signed-off-by: Eric Biggers <ebiggers@google.com>
> ---
>  arch/x86/Kconfig.assembler | 10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/arch/x86/Kconfig.assembler b/arch/x86/Kconfig.assembler
> index 8ad41da301e5..59aedf32c4ea 100644
> --- a/arch/x86/Kconfig.assembler
> +++ b/arch/x86/Kconfig.assembler
> @@ -23,9 +23,19 @@ config AS_TPAUSE
>  config AS_GFNI
>  	def_bool $(as-instr,vgf2p8mulb %xmm0$(comma)%xmm1$(comma)%xmm2)
>  	help
>  	  Supported by binutils >= 2.30 and LLVM integrated assembler
>  
> +config AS_VAES
> +	def_bool $(as-instr,vaesenc %ymm0$(comma)%ymm1$(comma)%ymm2)
> +	help
> +	  Supported by binutils >= 2.30 and LLVM integrated assembler

Nit: any reason it isn't called AS_VAESENC, like the instruction itself?

The other new AS_ Kconfig symbols follow the same nomenclature:

> +config AS_VPCLMULQDQ
> +	def_bool $(as-instr,vpclmulqdq \$0x10$(comma)%ymm0$(comma)%ymm1$(comma)%ymm2)
> +	help
> +	  Supported by binutils >= 2.30 and LLVM integrated assembler
> +
>  config AS_WRUSS
>  	def_bool $(as-instr,wrussq %rax$(comma)(%rbx))
>  	help
>  	  Supported by binutils >= 2.31 and LLVM integrated assembler

With the nit above fixed:

  Reviewed-by: Ingo Molnar <mingo@kernel.org>

Thanks,

	Ingo
Eric Biggers March 26, 2024, 8:18 a.m. UTC | #2
On Tue, Mar 26, 2024 at 09:10:13AM +0100, Ingo Molnar wrote:
> 
> * Eric Biggers <ebiggers@kernel.org> wrote:
> 
> > From: Eric Biggers <ebiggers@google.com>
> > 
> > Add config symbols AS_VAES and AS_VPCLMULQDQ that expose whether the
> > assembler supports the vector AES and carryless multiplication
> > cryptographic extensions.
> > 
> > Signed-off-by: Eric Biggers <ebiggers@google.com>
> > ---
> >  arch/x86/Kconfig.assembler | 10 ++++++++++
> >  1 file changed, 10 insertions(+)
> > 
> > diff --git a/arch/x86/Kconfig.assembler b/arch/x86/Kconfig.assembler
> > index 8ad41da301e5..59aedf32c4ea 100644
> > --- a/arch/x86/Kconfig.assembler
> > +++ b/arch/x86/Kconfig.assembler
> > @@ -23,9 +23,19 @@ config AS_TPAUSE
> >  config AS_GFNI
> >  	def_bool $(as-instr,vgf2p8mulb %xmm0$(comma)%xmm1$(comma)%xmm2)
> >  	help
> >  	  Supported by binutils >= 2.30 and LLVM integrated assembler
> >  
> > +config AS_VAES
> > +	def_bool $(as-instr,vaesenc %ymm0$(comma)%ymm1$(comma)%ymm2)
> > +	help
> > +	  Supported by binutils >= 2.30 and LLVM integrated assembler
> 
> Nit: any reason it isn't called AS_VAESENC, like the instruction itself?
> 
> The other new AS_ Kconfig symbols follow the same nomenclature:

The CPU feature flag is called VAES.  It guards the vaesenc, vaesenclast,
vaesdec, and vaesdeclast instructions when used on ymm and zmm registers.

So the name AS_VAES seems fine as-is.

I think you may have been confused by AS_VPCLMULQDQ, because in that case the
feature happens to provides a single instruction with the same name as the CPU
feature flag.

- Eric
Ingo Molnar March 26, 2024, 8:28 a.m. UTC | #3
* Eric Biggers <ebiggers@kernel.org> wrote:

> On Tue, Mar 26, 2024 at 09:10:13AM +0100, Ingo Molnar wrote:
> > 
> > * Eric Biggers <ebiggers@kernel.org> wrote:
> > 
> > > From: Eric Biggers <ebiggers@google.com>
> > > 
> > > Add config symbols AS_VAES and AS_VPCLMULQDQ that expose whether the
> > > assembler supports the vector AES and carryless multiplication
> > > cryptographic extensions.
> > > 
> > > Signed-off-by: Eric Biggers <ebiggers@google.com>
> > > ---
> > >  arch/x86/Kconfig.assembler | 10 ++++++++++
> > >  1 file changed, 10 insertions(+)
> > > 
> > > diff --git a/arch/x86/Kconfig.assembler b/arch/x86/Kconfig.assembler
> > > index 8ad41da301e5..59aedf32c4ea 100644
> > > --- a/arch/x86/Kconfig.assembler
> > > +++ b/arch/x86/Kconfig.assembler
> > > @@ -23,9 +23,19 @@ config AS_TPAUSE
> > >  config AS_GFNI
> > >  	def_bool $(as-instr,vgf2p8mulb %xmm0$(comma)%xmm1$(comma)%xmm2)
> > >  	help
> > >  	  Supported by binutils >= 2.30 and LLVM integrated assembler
> > >  
> > > +config AS_VAES
> > > +	def_bool $(as-instr,vaesenc %ymm0$(comma)%ymm1$(comma)%ymm2)
> > > +	help
> > > +	  Supported by binutils >= 2.30 and LLVM integrated assembler
> > 
> > Nit: any reason it isn't called AS_VAESENC, like the instruction itself?
> > 
> > The other new AS_ Kconfig symbols follow the same nomenclature:
> 
> The CPU feature flag is called VAES.  It guards the vaesenc, vaesenclast,
> vaesdec, and vaesdeclast instructions when used on ymm and zmm registers.

I see - fair enough:

   Reviewed-by: Ingo Molnar <mingo@kernel.org>

Thanks,

	Ingo
diff mbox series

Patch

diff --git a/arch/x86/Kconfig.assembler b/arch/x86/Kconfig.assembler
index 8ad41da301e5..59aedf32c4ea 100644
--- a/arch/x86/Kconfig.assembler
+++ b/arch/x86/Kconfig.assembler
@@ -23,9 +23,19 @@  config AS_TPAUSE
 config AS_GFNI
 	def_bool $(as-instr,vgf2p8mulb %xmm0$(comma)%xmm1$(comma)%xmm2)
 	help
 	  Supported by binutils >= 2.30 and LLVM integrated assembler
 
+config AS_VAES
+	def_bool $(as-instr,vaesenc %ymm0$(comma)%ymm1$(comma)%ymm2)
+	help
+	  Supported by binutils >= 2.30 and LLVM integrated assembler
+
+config AS_VPCLMULQDQ
+	def_bool $(as-instr,vpclmulqdq \$0x10$(comma)%ymm0$(comma)%ymm1$(comma)%ymm2)
+	help
+	  Supported by binutils >= 2.30 and LLVM integrated assembler
+
 config AS_WRUSS
 	def_bool $(as-instr,wrussq %rax$(comma)(%rbx))
 	help
 	  Supported by binutils >= 2.31 and LLVM integrated assembler