b1dca6
commit 28c13ae5bbc81aa2ae67890ce53e65257d4703a4
b1dca6
Author: H.J. Lu <hjl.tools@gmail.com>
b1dca6
Date:   Mon Jul 6 06:57:08 2020 -0700
b1dca6
b1dca6
    x86: Detect Extended Feature Disable (XFD)
b1dca6
    
b1dca6
    An extension called extended feature disable (XFD) is an extension added
b1dca6
    for Intel AMX to the XSAVE feature set that allows an operating system
b1dca6
    to enable a feature while preventing specific user threads from using
b1dca6
    the feature.
b1dca6
b1dca6
diff --git a/sysdeps/x86/cpu-features.h b/sysdeps/x86/cpu-features.h
b1dca6
index 535b3cb2d25b245b..e7ea9e8ece3e8211 100644
b1dca6
--- a/sysdeps/x86/cpu-features.h
b1dca6
+++ b/sysdeps/x86/cpu-features.h
b1dca6
@@ -393,6 +393,7 @@ extern const struct cpu_features *__get_cpu_features (void)
b1dca6
 #define bit_cpu_XSAVEC		(1u << 1)
b1dca6
 #define bit_cpu_XGETBV_ECX_1	(1u << 2)
b1dca6
 #define bit_cpu_XSAVES		(1u << 3)
b1dca6
+#define bit_cpu_XFD		(1u << 4)
b1dca6
 
b1dca6
 /* COMMON_CPUID_INDEX_80000007.  */
b1dca6
 
b1dca6
@@ -578,6 +579,7 @@ extern const struct cpu_features *__get_cpu_features (void)
b1dca6
 #define index_cpu_XSAVEC	COMMON_CPUID_INDEX_D_ECX_1
b1dca6
 #define index_cpu_XGETBV_ECX_1	COMMON_CPUID_INDEX_D_ECX_1
b1dca6
 #define index_cpu_XSAVES	COMMON_CPUID_INDEX_D_ECX_1
b1dca6
+#define index_cpu_XFD		COMMON_CPUID_INDEX_D_ECX_1
b1dca6
 
b1dca6
 /* COMMON_CPUID_INDEX_80000007.  */
b1dca6
 
b1dca6
@@ -763,6 +765,7 @@ extern const struct cpu_features *__get_cpu_features (void)
b1dca6
 #define reg_XSAVEC		eax
b1dca6
 #define reg_XGETBV_ECX_1	eax
b1dca6
 #define reg_XSAVES		eax
b1dca6
+#define reg_XFD			eax
b1dca6
 
b1dca6
 /* COMMON_CPUID_INDEX_80000007.  */
b1dca6
 
b1dca6
diff --git a/sysdeps/x86/tst-get-cpu-features.c b/sysdeps/x86/tst-get-cpu-features.c
b1dca6
index c4d91be3a48de886..c56f309ba0736c0d 100644
b1dca6
--- a/sysdeps/x86/tst-get-cpu-features.c
b1dca6
+++ b/sysdeps/x86/tst-get-cpu-features.c
b1dca6
@@ -212,6 +212,7 @@ do_test (void)
b1dca6
   CHECK_CPU_FEATURE (XSAVEC);
b1dca6
   CHECK_CPU_FEATURE (XGETBV_ECX_1);
b1dca6
   CHECK_CPU_FEATURE (XSAVES);
b1dca6
+  CHECK_CPU_FEATURE (XFD);
b1dca6
   CHECK_CPU_FEATURE (INVARIANT_TSC);
b1dca6
   CHECK_CPU_FEATURE (WBNOINVD);
b1dca6
   CHECK_CPU_FEATURE (AVX512_BF16);