about summary refs log tree commit diff
path: root/sysdeps/x86/include
diff options
context:
space:
mode:
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>2021-07-15 08:52:44 -0300
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>2021-07-19 14:12:29 -0300
commit469761eac842663365bba3dacd4cdf15a2ae328d (patch)
tree570826e6942f9bc0bb7eec6bb34dedec141e0d01 /sysdeps/x86/include
parent5adb0e14a5cc9e011e58a7aaf193b598ecbd7b07 (diff)
downloadglibc-469761eac842663365bba3dacd4cdf15a2ae328d.tar.gz
glibc-469761eac842663365bba3dacd4cdf15a2ae328d.tar.xz
glibc-469761eac842663365bba3dacd4cdf15a2ae328d.zip
elf: Fix tst-cpu-features-cpuinfo on some AMD systems (BZ #28090)
The SSBD feature is implemented in 2 different ways on AMD processors:
newer systems (Zen3) provides AMD_SSBD (function 8000_0008, EBX[24]),
while older system provides AMD_VIRT_SSBD (function 8000_0008, EBX[25]).
However for AMD_VIRT_SSBD, kernel shows both 'ssdb' and 'virt_ssdb' on
/proc/cpuinfo; while for AMD_SSBD only 'ssdb' is provided.

This now check is AMD_SSBD is set to check for 'ssbd', otherwise check
if AMD_VIRT_SSDB is set to check for 'virt_ssbd'.

Checked on x86_64-linux-gnu on a Ryzen 9 5900x.

Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
Diffstat (limited to 'sysdeps/x86/include')
-rw-r--r--sysdeps/x86/include/cpu-features.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/sysdeps/x86/include/cpu-features.h b/sysdeps/x86/include/cpu-features.h
index 59e01df543..a3f11baa7a 100644
--- a/sysdeps/x86/include/cpu-features.h
+++ b/sysdeps/x86/include/cpu-features.h
@@ -293,6 +293,7 @@ enum
 #define bit_cpu_AMD_IBRS	(1u << 14)
 #define bit_cpu_AMD_STIBP	(1u << 15)
 #define bit_cpu_AMD_SSBD	(1u << 24)
+#define bit_cpu_AMD_VIRT_SSBD	(1u << 25)
 
 /* CPUID_INDEX_7_ECX_1.  */
 
@@ -527,6 +528,7 @@ enum
 #define index_cpu_AMD_IBRS	CPUID_INDEX_80000008
 #define index_cpu_AMD_STIBP	CPUID_INDEX_80000008
 #define index_cpu_AMD_SSBD	CPUID_INDEX_80000008
+#define index_cpu_AMD_VIRT_SSBD	CPUID_INDEX_80000008
 
 /* CPUID_INDEX_7_ECX_1.  */
 
@@ -761,6 +763,7 @@ enum
 #define reg_AMD_IBRS		ebx
 #define reg_AMD_STIBP		ebx
 #define reg_AMD_SSBD		ebx
+#define reg_AMD_VIRT_SSBD	ebx
 
 /* CPUID_INDEX_7_ECX_1.  */