[RFC] Add Hygon Dhyana processor support

Message ID 20190515093457.35348-1-fanjinke51@yeah.net
State New, archived
Headers

Commit Message

Jinke Fan May 15, 2019, 9:34 a.m. UTC
  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).

gdb/ChangeLog:
	* go32-nat.c (go32_sysinfo): Add hygon_p.

The results of make check are no degradation:
  

Comments

Jinke Fan June 21, 2019, 3:07 a.m. UTC | #1
Hi,
   This patch is usefull, isn't it?

Best regards!
Jinke

On 2019/5/15 17:34, Jinke Fan wrote:
> 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).
> 
> gdb/ChangeLog:
> 	* go32-nat.c (go32_sysinfo): Add hygon_p.
> 
> The results of make check are no degradation:
> === binutils Summary ===
>   of expected passes            251
>   of unresolved testcases       1
>   of unsupported tests          1
> 
> Please let me know your comments.
> Thanks in advance.
> 
> Signed-off-by: Jinke Fan <fanjinke51@yeah.net>
> ---
>   gdb/go32-nat.c | 7 ++++---
>   1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/gdb/go32-nat.c b/gdb/go32-nat.c
> index ea0872363d..a4d1a5c9af 100644
> --- a/gdb/go32-nat.c
> +++ b/gdb/go32-nat.c
> @@ -1162,6 +1162,7 @@ go32_sysinfo (const char *arg, int from_tty)
>         unsigned brand_idx;
>         int intel_p = strcmp (cpuid_vendor, "GenuineIntel") == 0;
>         int amd_p = strcmp (cpuid_vendor, "AuthenticAMD") == 0;
> +      int hygon_p = strcmp (cpuid_vendor, "HygonGenuine") == 0;
>         unsigned cpu_family, cpu_model;
>   
>   #if 0
> @@ -1261,12 +1262,12 @@ go32_sysinfo (const char *arg, int from_tty)
>   	    }
>   	}
>         xsnprintf (cpu_string, sizeof (cpu_string), "%s%s Model %d Stepping %d",
> -	         intel_p ? "Pentium" : (amd_p ? "AMD" : "ix86"),
> +	         intel_p ? "Pentium" : (amd_p ? "AMD" : (hygon_p ? "Hygon" : "ix86")),
>   	         cpu_brand, cpu_model, cpuid_eax & 0xf);
>         printfi_filtered (31, "%s\n", cpu_string);
>         if (((cpuid_edx & (6 | (0x0d << 23))) != 0)
>   	  || ((cpuid_edx & 1) == 0)
> -	  || (amd_p && (cpuid_edx & (3 << 30)) != 0))
> +	  || ((amd_p || hygon_p) && (cpuid_edx & (3 << 30)) != 0))
>   	{
>   	  puts_filtered ("CPU Features...................");
>   	  /* We only list features which might be useful in the DPMI
> @@ -1285,7 +1286,7 @@ go32_sysinfo (const char *arg, int from_tty)
>   	    puts_filtered ("SSE ");
>   	  if ((cpuid_edx & (1 << 26)) != 0)
>   	    puts_filtered ("SSE2 ");
> -	  if (amd_p)
> +	  if (amd_p || hygon_p)
>   	    {
>   	      if ((cpuid_edx & (1 << 31)) != 0)
>   		puts_filtered ("3DNow! ");
>
  
Pedro Alves June 21, 2019, 5:49 p.m. UTC | #2
Eli, FYI, the subject doesn't suggest so, but this is
a DJGPP patch.

Thanks,
Pedro Alves

On 6/21/19 4:07 AM, Jinke Fan wrote:
> Hi,
>   This patch is usefull, isn't it?
> 
> Best regards!
> Jinke
> 
> On 2019/5/15 17:34, Jinke Fan wrote:
>> 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).
>>
>> gdb/ChangeLog:
>>     * go32-nat.c (go32_sysinfo): Add hygon_p.
>>
>> The results of make check are no degradation:
>> === binutils Summary ===
>>   of expected passes            251
>>   of unresolved testcases       1
>>   of unsupported tests          1
>>
>> Please let me know your comments.
>> Thanks in advance.
>>
>> Signed-off-by: Jinke Fan <fanjinke51@yeah.net>
>> ---
>>   gdb/go32-nat.c | 7 ++++---
>>   1 file changed, 4 insertions(+), 3 deletions(-)
>>
>> diff --git a/gdb/go32-nat.c b/gdb/go32-nat.c
>> index ea0872363d..a4d1a5c9af 100644
>> --- a/gdb/go32-nat.c
>> +++ b/gdb/go32-nat.c
>> @@ -1162,6 +1162,7 @@ go32_sysinfo (const char *arg, int from_tty)
>>         unsigned brand_idx;
>>         int intel_p = strcmp (cpuid_vendor, "GenuineIntel") == 0;
>>         int amd_p = strcmp (cpuid_vendor, "AuthenticAMD") == 0;
>> +      int hygon_p = strcmp (cpuid_vendor, "HygonGenuine") == 0;
>>         unsigned cpu_family, cpu_model;
>>     #if 0
>> @@ -1261,12 +1262,12 @@ go32_sysinfo (const char *arg, int from_tty)
>>           }
>>       }
>>         xsnprintf (cpu_string, sizeof (cpu_string), "%s%s Model %d Stepping %d",
>> -             intel_p ? "Pentium" : (amd_p ? "AMD" : "ix86"),
>> +             intel_p ? "Pentium" : (amd_p ? "AMD" : (hygon_p ? "Hygon" : "ix86")),
>>                cpu_brand, cpu_model, cpuid_eax & 0xf);
>>         printfi_filtered (31, "%s\n", cpu_string);
>>         if (((cpuid_edx & (6 | (0x0d << 23))) != 0)
>>         || ((cpuid_edx & 1) == 0)
>> -      || (amd_p && (cpuid_edx & (3 << 30)) != 0))
>> +      || ((amd_p || hygon_p) && (cpuid_edx & (3 << 30)) != 0))
>>       {
>>         puts_filtered ("CPU Features...................");
>>         /* We only list features which might be useful in the DPMI
>> @@ -1285,7 +1286,7 @@ go32_sysinfo (const char *arg, int from_tty)
>>           puts_filtered ("SSE ");
>>         if ((cpuid_edx & (1 << 26)) != 0)
>>           puts_filtered ("SSE2 ");
>> -      if (amd_p)
>> +      if (amd_p || hygon_p)
>>           {
>>             if ((cpuid_edx & (1 << 31)) != 0)
>>           puts_filtered ("3DNow! ");
>>
>
  
Eli Zaretskii June 21, 2019, 6:48 p.m. UTC | #3
> From: Pedro Alves <palves@redhat.com>
> Date: Fri, 21 Jun 2019 18:49:15 +0100
> 
> Eli, FYI, the subject doesn't suggest so, but this is
> a DJGPP patch.

Sorry for not paying attention.  This patch is OK, thanks.
  
Pedro Alves Aug. 21, 2019, 5:56 p.m. UTC | #4
Hi,

On 5/15/19 10:34 AM, Jinke Fan wrote:
> 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).
> 

I've finally merged this to master.  

> The results of make check are no degradation:
> === binutils Summary ===
>  of expected passes            251
>  of unresolved testcases       1
>  of unsupported tests          1

I removed this bit from the commit log though, because
the above are results of running the binutils testsuite,
not gdb's testsuite, so largely irrelevant for gdb.

Thanks,
Pedro Alves
  

Patch

=== binutils Summary ===
 of expected passes            251
 of unresolved testcases       1
 of unsupported tests          1

Please let me know your comments.
Thanks in advance.

Signed-off-by: Jinke Fan <fanjinke51@yeah.net>
---
 gdb/go32-nat.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/gdb/go32-nat.c b/gdb/go32-nat.c
index ea0872363d..a4d1a5c9af 100644
--- a/gdb/go32-nat.c
+++ b/gdb/go32-nat.c
@@ -1162,6 +1162,7 @@  go32_sysinfo (const char *arg, int from_tty)
       unsigned brand_idx;
       int intel_p = strcmp (cpuid_vendor, "GenuineIntel") == 0;
       int amd_p = strcmp (cpuid_vendor, "AuthenticAMD") == 0;
+      int hygon_p = strcmp (cpuid_vendor, "HygonGenuine") == 0;
       unsigned cpu_family, cpu_model;
 
 #if 0
@@ -1261,12 +1262,12 @@  go32_sysinfo (const char *arg, int from_tty)
 	    }
 	}
       xsnprintf (cpu_string, sizeof (cpu_string), "%s%s Model %d Stepping %d",
-	         intel_p ? "Pentium" : (amd_p ? "AMD" : "ix86"),
+	         intel_p ? "Pentium" : (amd_p ? "AMD" : (hygon_p ? "Hygon" : "ix86")),
 	         cpu_brand, cpu_model, cpuid_eax & 0xf);
       printfi_filtered (31, "%s\n", cpu_string);
       if (((cpuid_edx & (6 | (0x0d << 23))) != 0)
 	  || ((cpuid_edx & 1) == 0)
-	  || (amd_p && (cpuid_edx & (3 << 30)) != 0))
+	  || ((amd_p || hygon_p) && (cpuid_edx & (3 << 30)) != 0))
 	{
 	  puts_filtered ("CPU Features...................");
 	  /* We only list features which might be useful in the DPMI
@@ -1285,7 +1286,7 @@  go32_sysinfo (const char *arg, int from_tty)
 	    puts_filtered ("SSE ");
 	  if ((cpuid_edx & (1 << 26)) != 0)
 	    puts_filtered ("SSE2 ");
-	  if (amd_p)
+	  if (amd_p || hygon_p)
 	    {
 	      if ((cpuid_edx & (1 << 31)) != 0)
 		puts_filtered ("3DNow! ");