summary refs log tree commit diff
path: root/sysdeps/x86/sys
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2020-09-15 05:49:27 -0700
committerH.J. Lu <hjl.tools@gmail.com>2020-09-16 05:56:10 -0700
commitf2c679d4b2c73a95f437c705f960a4af1fa23498 (patch)
tree1f30bd0a05a25caa79dda87c9330fb7c6de901bd /sysdeps/x86/sys
parenta140ff9162f353e804d6a8c83c8f3c18511850dd (diff)
downloadglibc-f2c679d4b2c73a95f437c705f960a4af1fa23498.tar.gz
glibc-f2c679d4b2c73a95f437c705f960a4af1fa23498.tar.xz
glibc-f2c679d4b2c73a95f437c705f960a4af1fa23498.zip
<sys/platform/x86.h>: Add Intel Key Locker support
Add Intel Key Locker:

https://software.intel.com/content/www/us/en/develop/download/intel-key-locker-specification.html

support to <sys/platform/x86.h>.  Intel Key Locker has

1. KL: AES Key Locker instructions.
2. WIDE_KL: AES wide Key Locker instructions.
3. AESKLE: AES Key Locker instructions are enabled by OS.

Applications should use

if (CPU_FEATURE_USABLE (KL))

and

if (CPU_FEATURE_USABLE (WIDE_KL))

to check if AES Key Locker instructions and AES wide Key Locker
instructions are usable.
Diffstat (limited to 'sysdeps/x86/sys')
-rw-r--r--sysdeps/x86/sys/platform/x86.h25
1 files changed, 22 insertions, 3 deletions
diff --git a/sysdeps/x86/sys/platform/x86.h b/sysdeps/x86/sys/platform/x86.h
index bf3727ebc0..2ba6d3c4f2 100644
--- a/sysdeps/x86/sys/platform/x86.h
+++ b/sysdeps/x86/sys/platform/x86.h
@@ -28,6 +28,7 @@ enum
   COMMON_CPUID_INDEX_80000007,
   COMMON_CPUID_INDEX_80000008,
   COMMON_CPUID_INDEX_7_ECX_1,
+  COMMON_CPUID_INDEX_19,
   /* Keep the following line at the end.  */
   COMMON_CPUID_INDEX_MAX
 };
@@ -224,7 +225,7 @@ extern const struct cpu_features *__x86_get_cpu_features (unsigned int)
 /* Note: Bits 17-21: The value of MAWAU used by the BNDLDX and BNDSTX
    instructions in 64-bit mode.  */
 #define bit_cpu_RDPID		(1u << 22)
-#define bit_cpu_INDEX_7_ECX_23	(1u << 23)
+#define bit_cpu_KL		(1u << 23)
 #define bit_cpu_INDEX_7_ECX_24	(1u << 24)
 #define bit_cpu_CLDEMOTE	(1u << 25)
 #define bit_cpu_INDEX_7_ECX_26	(1u << 26)
@@ -312,6 +313,12 @@ extern const struct cpu_features *__x86_get_cpu_features (unsigned int)
 /* EAX.  */
 #define bit_cpu_AVX512_BF16	(1u << 5)
 
+/* COMMON_CPUID_INDEX_19.  */
+
+/* EBX.  */
+#define bit_cpu_AESKLE		(1u << 0)
+#define bit_cpu_WIDE_KL		(1u << 2)
+
 /* COMMON_CPUID_INDEX_1.  */
 
 /* ECX.  */
@@ -437,7 +444,7 @@ extern const struct cpu_features *__x86_get_cpu_features (unsigned int)
 #define index_cpu_INDEX_7_ECX_15 COMMON_CPUID_INDEX_7
 #define index_cpu_INDEX_7_ECX_16 COMMON_CPUID_INDEX_7
 #define index_cpu_RDPID		COMMON_CPUID_INDEX_7
-#define index_cpu_INDEX_7_ECX_23 COMMON_CPUID_INDEX_7
+#define index_cpu_KL		COMMON_CPUID_INDEX_7
 #define index_cpu_INDEX_7_ECX_24 COMMON_CPUID_INDEX_7
 #define index_cpu_CLDEMOTE	COMMON_CPUID_INDEX_7
 #define index_cpu_INDEX_7_ECX_26 COMMON_CPUID_INDEX_7
@@ -525,6 +532,12 @@ extern const struct cpu_features *__x86_get_cpu_features (unsigned int)
 /* EAX.  */
 #define index_cpu_AVX512_BF16	COMMON_CPUID_INDEX_7_ECX_1
 
+/* COMMON_CPUID_INDEX_19.  */
+
+/* EBX.  */
+#define index_cpu_AESKLE	COMMON_CPUID_INDEX_19
+#define index_cpu_WIDE_KL	COMMON_CPUID_INDEX_19
+
 /* COMMON_CPUID_INDEX_1.  */
 
 /* ECX.  */
@@ -650,7 +663,7 @@ extern const struct cpu_features *__x86_get_cpu_features (unsigned int)
 #define reg_INDEX_7_ECX_15	ecx
 #define reg_INDEX_7_ECX_16	ecx
 #define reg_RDPID		ecx
-#define reg_INDEX_7_ECX_23	ecx
+#define reg_KL			ecx
 #define reg_INDEX_7_ECX_24	ecx
 #define reg_CLDEMOTE		ecx
 #define reg_INDEX_7_ECX_26	ecx
@@ -738,4 +751,10 @@ extern const struct cpu_features *__x86_get_cpu_features (unsigned int)
 /* EAX.  */
 #define reg_AVX512_BF16		eax
 
+/* COMMON_CPUID_INDEX_19.  */
+
+/* EBX.  */
+#define reg_AESKLE		ebx
+#define reg_WIDE_KL		ebx
+
 #endif  /* _SYS_PLATFORM_X86_H */