From patchwork Wed Dec 12 14:31:33 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Carlos O'Donell X-Patchwork-Id: 30646 Received: (qmail 122118 invoked by alias); 12 Dec 2018 14:31:45 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 122105 invoked by uid 89); 12 Dec 2018 14:31:44 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 spammy=fan, Fan, CoLtd, Co., Ltd X-HELO: mail-qt1-f171.google.com Return-Path: Subject: Re: [PATCH] x86: Add Hygon Dhyana support. To: Jinke Fan , "libc-alpha@sourceware.org" , "Pawar, Amit" Cc: "H.J. Lu" References: <20181210102609.28819-1-fanjinke@hygon.cn> <7cca34e9-2ef9-50f8-173b-63f47313435a@redhat.com> From: Carlos O'Donell Openpgp: preference=signencrypt Message-ID: Date: Wed, 12 Dec 2018 09:31:33 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.3.0 MIME-Version: 1.0 In-Reply-To: On 12/12/18 2:21 AM, Jinke Fan wrote: > Thank you for your reply and reminder. > > The copyright issue is already under processing. Jinke, Please review the attached patch. It is what I plan to commit for you. I notice you use 'fanjinke' as your ChangeLog name, is that correct? I added a 'Signed-off-by' for you in the commit message, is that OK? The only changes I made to your patch: * Finished the ChangeLog entry which was missing text after the identified function change. * Added space after '.' in comment in cpu-features.c (two spaces after period is GNU coding convention). If everything looks OK to you I will commit this for you. From d72bfb3ef2c1a0ef94c7ee06c79cd013d529670c Mon Sep 17 00:00:00 2001 From: Carlos O'Donell Date: Wed, 12 Dec 2018 09:24:17 -0500 Subject: [PATCH] x86: Add Hygon Dhyana support. This patch fix Hygon Dhyana processor CPU Vendor ID detection problem in glibc sysdep module, current glibc codes doesn't recognize Dhyana CPU Vendor ID("HygonGenuine") and set kind to arch_kind_other, which result to incorrect zero value for __cache_sysconf() syscall. As Hygon Dhyana share most architecture feature as AMD Family 17h, this patch add Hygon CPU Vendor ID check and setup kind to arch_kind_amd and reuse AMD code path, which lead to correct return value in __cache_sysconf() syscall. we run the glibc test suite for both Hygon Dhyana and AMD EPYC and found no failure case. Background: Chengdu Haiguang IC Design Co., Ltd (Hygon) is a Joint Venture between AMD and Haiguang Information Technology Co.,Ltd., aims at providing high performance x86 processor for China server market. Its first generation processor codename is Dhyana, which originates from AMD technology and shares most of the architecture with AMD's family 17h, but with different CPU Vendor ID("HygonGenuine")/Family series number(Family 18h). Related Hygon kernel patch can be found on http://lkml.kernel.org/r/5ce86123a7b9dad925ac583d88d2f921040e859b.1538583282.git.puwen@hygon.cn Signed-off-by: fanjinke Reviewed-by: Carlos O'Donell --- ChangeLog | 5 +++++ sysdeps/x86/cpu-features.c | 5 +++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 07dfe69dc3..e1e828d52c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2018-12-12 fanjinke + + * sysdeps/x86/cpu-features.c (init_cpu_features): Check for + "HygonGenuine". + 2018-12-12 Tulio Magno Quites Machado Filho [BZ #23614] diff --git a/sysdeps/x86/cpu-features.c b/sysdeps/x86/cpu-features.c index 5f9eefd408..af7ac4bb4e 100644 --- a/sysdeps/x86/cpu-features.c +++ b/sysdeps/x86/cpu-features.c @@ -425,8 +425,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; -- 2.19.2