diff mbox

[i386] Handle extended family cpuid info for AMD

Message ID CAFULd4aoB070f4rTZ9RsR4x4K89QZFaHmBKdMhmZQFf09M8DVQ@mail.gmail.com
State New
Headers show

Commit Message

Uros Bizjak July 31, 2014, 11:50 a.m. UTC
On Thu, Jul 31, 2014 at 1:46 PM, Gopalasubramanian, Ganesh
<Ganesh.Gopalasubramanian@amd.com> wrote:
>> But, looking to processor_alias_table in config/i386/i386.c, only
>> PROCESSOR_BTVER2 defines PTA_MOVBE. According to this, the logic is already correct, so the patch is not needed.
>
> We are evaluating bdver4 cpu. Bdver4 also supports MOVBE. I will submit patch for bdver4 PTA after our evaluation.

Then just use:

--cut here--
--cut here--

Uros.

Comments

Gopalasubramanian, Ganesh July 31, 2014, 11:54 a.m. UTC | #1
> Then just use:


> +      else if (has_avx2)

> +        processor = PROCESSOR_BDVER4;

>       else if (has_movbe)

>        processor = PROCESSOR_BTVER2;

>-      else if (has_avx2)

>-        processor = PROCESSOR_BDVER4;

>      else if (has_xsaveopt)


In that case, with earlier GCC versions where we don’t have bdver4 added, the fall back would be BTVER2, 
whereas a BD variant is more desirable.

Ganesh
Uros Bizjak July 31, 2014, 12:37 p.m. UTC | #2
On Thu, Jul 31, 2014 at 1:54 PM, Gopalasubramanian, Ganesh
<Ganesh.Gopalasubramanian@amd.com> wrote:
>> Then just use:
>
>> +      else if (has_avx2)
>> +        processor = PROCESSOR_BDVER4;
>>       else if (has_movbe)
>>        processor = PROCESSOR_BTVER2;
>>-      else if (has_avx2)
>>-        processor = PROCESSOR_BDVER4;
>>      else if (has_xsaveopt)
>
> In that case, with earlier GCC versions where we don’t have bdver4 added, the fall back would be BTVER2,
> whereas a BD variant is more desirable.

I would like to have a check for a family at the beginning, something like:

      if (name == signature_NSC_ebx)
    processor = PROCESSOR_GEODE;
      else if (family == 22)
    {
      if (has_movbe)
        processor = PROCESSOR_BTVER2;
      else
        processor = PROCESSOR_BTVER1;
    }
      else if (has_avx2)
        processor = PROCESSOR_BDVER4;
      else if (has_xsaveopt)

Please also fix ChangeLog entry.

Uros.
Gopalasubramanian, Ganesh Aug. 1, 2014, 6:18 a.m. UTC | #3
Uros!

> I would like to have a check for a family at the beginning, something like:


>      if (name == signature_NSC_ebx)

>    processor = PROCESSOR_GEODE;

>      else if (family == 22)

>    {

>      if (has_movbe)


I get your idea of having the family checked first and then differentiating with cpuid info later.
But, this case is getting interesting because, BTVER1 and BTVER2 are two variants but don't really have same family numbers.
BTVER1 is family 14h and BTVER2 is family 16h. I don't see near term plans for any additional cpus to either 14h or 16h.
Given that fact, this particular check is applicable only for BTVER2.
In that case, having 

      else if (family == 22)
        if (has_movbe)
           processor = PROCESSOR_BTVER2;

looks odd. 

Regards
Ganesh
Uros Bizjak Aug. 1, 2014, 7:59 a.m. UTC | #4
On Fri, Aug 1, 2014 at 8:18 AM, Gopalasubramanian, Ganesh
<Ganesh.Gopalasubramanian@amd.com> wrote:

>> I would like to have a check for a family at the beginning, something like:
>
>>      if (name == signature_NSC_ebx)
>>    processor = PROCESSOR_GEODE;
>>      else if (family == 22)
>>    {
>>      if (has_movbe)
>
> I get your idea of having the family checked first and then differentiating with cpuid info later.
> But, this case is getting interesting because, BTVER1 and BTVER2 are two variants but don't really have same family numbers.
> BTVER1 is family 14h and BTVER2 is family 16h. I don't see near term plans for any additional cpus to either 14h or 16h.
> Given that fact, this particular check is applicable only for BTVER2.
> In that case, having
>
>       else if (family == 22)
>         if (has_movbe)
>            processor = PROCESSOR_BTVER2;
>
> looks odd.

In this case, having only check for family ID should be enough. If
BTVER1 and BTVER2 can be uniquely determined by their family IDs ,
then:

... (signature checks)
else if (family == 0x16h)
  processor = PROCESSOR_BTVER2;
else if (family == 0x14h)
  processor = PROCESSOR_BTVER1;
else
  ... (detect processor in a generic way by its cpuid features.)

IMO, this would be the most future-proof approach. Signature checks
will override family id checks which will override cpuid checks.

Uros.
diff mbox

Patch

Index: driver-i386.c
===================================================================
--- driver-i386.c       (revision 213342)
+++ driver-i386.c       (working copy)
@@ -576,10 +576,10 @@  const char *host_detect_local_cpu (int argc, const

       if (name == signature_NSC_ebx)
        processor = PROCESSOR_GEODE;
+      else if (has_avx2)
+        processor = PROCESSOR_BDVER4;
       else if (has_movbe)
        processor = PROCESSOR_BTVER2;
-      else if (has_avx2)
-        processor = PROCESSOR_BDVER4;
       else if (has_xsaveopt)
         processor = PROCESSOR_BDVER3;
       else if (has_bmi)