glibc/backport-x86-Add-Hygon-support.patch
Feifei Wang1994 8dee2397c0 x86: backport x86 optimization patches
Backport 3 x86 optimization patches.

The first one 'Reversing calculation of __x86_shared_non_temporal_threshold'
patch reverse calculation of __x86_shared_non_temporal_threshold from
3/4 of the entire shared cache size of a multi-threaded system to
3/4 of one thread's share of the cache size, and then improve the memcpy
performance.

The second patch 'Optimizing memcpy for AMD Zen architecture' recomputing
the shareable cache as 'L3 per CCX(Core-Complex)' and improve performance
for amd.

The third patch 'Add Hygon Dhyana support' fix Hygon Dhyana processor CPU
Vendor ID detection problem in glibc sysdep module.
2024-09-04 06:01:47 +00:00

39 lines
1.5 KiB
Diff

From 2b46bc9b5a148f6da198321a8396a6c2c6a1b070 Mon Sep 17 00:00:00 2001
From: Feifei Wang1994 <wangfeifei@hygon.cn>
Date: Tue, 3 Sep 2024 08:30:43 +0000
Subject: [PATCH] backport-x86-Add-Hygon-support
This patch fix Hygon processor CPU Vendor ID detection problem
in glibc sysdep module, current glibc-2.28 doesn't recognize
Hygon CPU Vendor ID("HygonGenuine") and sets kind to arch_kind_other,
which result in incorrect zero value for __cache_sysconf() syscall.
This patch add Hygon CPU Vendor ID check, setup kind to arch_kind_amd
and reuse AMD code path, which lead to correct return value in __cache_sysconf() syscall.
Test case shows no failure with this patch in Hygon arch.
Signed-off-by: Feifei Wang <wangfeifei@hygon.cn>
---
sysdeps/x86/cpu-features.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/sysdeps/x86/cpu-features.c b/sysdeps/x86/cpu-features.c
index ea0b64fd..4b1a0169 100644
--- a/sysdeps/x86/cpu-features.c
+++ b/sysdeps/x86/cpu-features.c
@@ -344,8 +344,9 @@ init_cpu_features (struct cpu_features *cpu_features)
cpu_features->feature[index_arch_Prefer_No_AVX512]
|= bit_arch_Prefer_No_AVX512;
}
- /* This spells out "AuthenticAMD". */
- else if (ebx == 0x68747541 && ecx == 0x444d4163 && edx == 0x69746e65)
+ /* This spells out "AuthenticAMD" or "HygonGenuine". */
+ else if ((ebx == 0x68747541 && ecx == 0x444d4163 && edx == 0x69746e65)
+ || (ebx == 0x6f677948 && ecx == 0x656e6975 && edx == 0x6e65476e))
{
unsigned int extended_model, stepping;
--
2.27.0