Backport AVX2 AES-GCM implementation from BoringSSL

This uses the AVX2 versions of the AESENC and PCLMULQDQ instructions; on
Zen 3 this provides an up to 80% performance improvement.

Original source:
https://github.com/google/boringssl/blob/d5440dd2c2c500ac2d3bba4afec47a054b4d99ae/gen/bcm/aes-gcm-avx2-x86_64-linux.S

See the original BoringSSL commit at
https://github.com/google/boringssl/commit/3b6e1be4391d96e81cee022f77f7bab85d51cf4e.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Rob Norris <robn@despairlabs.com>
Reviewed-by: Tony Hutter <hutter2@llnl.gov>
Reviewed-by: Attila Fülöp <attila@fueloep.org>
Signed-off-by: Joel Low <joel@joelsplace.sg>
Closes #17058
This commit is contained in:
Joel Low
2025-02-15 11:37:33 +08:00
committed by Brian Behlendorf
parent 885d929cf8
commit bb9225ea86
15 changed files with 3574 additions and 82 deletions
+26
View File
@@ -597,6 +597,32 @@ zfs_movbe_available(void)
#endif
}
/*
* Check if VAES instruction set is available
*/
static inline boolean_t
zfs_vaes_available(void)
{
#if defined(X86_FEATURE_VAES)
return (!!boot_cpu_has(X86_FEATURE_VAES));
#else
return (B_FALSE);
#endif
}
/*
* Check if VPCLMULQDQ instruction set is available
*/
static inline boolean_t
zfs_vpclmulqdq_available(void)
{
#if defined(X86_FEATURE_VPCLMULQDQ)
return (!!boot_cpu_has(X86_FEATURE_VPCLMULQDQ));
#else
return (B_FALSE);
#endif
}
/*
* Check if SHA_NI instruction set is available
*/