Re: [PATCH v3 11/15] crypto: x86/aes-kl - Support AES algorithm using Key Locker instructions

From: Bae, Chang Seok
Date: Mon Dec 06 2021 - 16:32:45 EST


On Dec 2, 2021, at 06:21, Peter Zijlstra <peterz@xxxxxxxxxxxxx> wrote:
> On Wed, Nov 24, 2021 at 12:06:56PM -0800, Chang S. Bae wrote:
>> + encodekey256 %eax, %eax
>
> So this thing uses the fancy new keylocker instructions, however:
>
>> diff --git a/crypto/Kconfig b/crypto/Kconfig
>> index 285f82647d2b..784a04433549 100644
>> --- a/crypto/Kconfig
>> +++ b/crypto/Kconfig
>> @@ -1113,6 +1113,50 @@ config CRYPTO_AES_NI_INTEL
>> ECB, CBC, LRW, XTS. The 64 bit version has additional
>> acceleration for CTR.
>>
>> +config CRYPTO_AES_KL
>> + tristate "AES cipher algorithms (AES-KL)"
>> + depends on (LD_VERSION >= 23600) || (LLD_VERSION >= 120000)
>> + depends on DM_CRYPT
>> + select X86_KEYLOCKER
>> + select CRYPTO_AES_NI_INTEL
>
>
> There is no dependency on the compiler actually supporting them..
>
> config AS_HAS_KEYLOCKER
> def_bool $(as-instr,encodekey256)
>
> depends on AS_HAS_KEYLOCKER
>
> Hmm?

Well, LD_VERSION reflects the binutils version.

But yes, the as-instr macro looks to be useful here:

+config AS_HAS_KEYLOCKER
+ def_bool $(as-instr,encodekey256 %eax$(comma)%eax)
+ help
+ Supported by binutils >=2.36 and LLVM integrated assembler >= V12
+
config CRYPTO_AES_KL
tristate "AES cipher algorithms (AES-KL)"
- depends on (LD_VERSION >= 23600) || (LLD_VERSION >= 120000)
+ depends on AS_HAS_KEYLOCKER

Thanks,
Chang