<bits/platform/x86.h>: Correct x86_cpu_TBM

Message ID 20210202150139.GA545211@gmail.com
State Committed
Commit ba230b6387fc0ccba60d2ff6759f7e326ba7bf3e
Headers
Series <bits/platform/x86.h>: Correct x86_cpu_TBM |

Commit Message

H.J. Lu Feb. 2, 2021, 3:01 p.m. UTC
  On Tue, Feb 02, 2021 at 12:07:55PM +0100, Andreas Schwab wrote:
> ------ FAIL: elf/tst-cpu-features-cpuinfo ------
> Checking HAS_CPU_FEATURE (SSBD):
>   HAS_CPU_FEATURE (SSBD): 0
>   cpuinfo (ssbd): 1
>  *** failure ***

This should be fixed by

https://sourceware.org/pipermail/libc-alpha/2021-February/122244.html

> Checking HAS_CPU_FEATURE (TBM):
>   HAS_CPU_FEATURE (TBM): 0
>   cpuinfo (tbm): 1
>  *** failure ***

Please try th patch enclosed here.

> 2 differences between /proc/cpuinfo and glibc code.
> 

Thanks.

H.J.
---
x86_cpu_TBM should be x86_cpu_index_80000001_ecx + 21.
---
 sysdeps/x86/bits/platform/x86.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Florian Weimer Feb. 22, 2021, 9:49 a.m. UTC | #1
* H. J. Lu via Libc-alpha:

>> Checking HAS_CPU_FEATURE (TBM):
>>   HAS_CPU_FEATURE (TBM): 0
>>   cpuinfo (tbm): 1
>>  *** failure ***
>
> Please try th patch enclosed here.
>
>> 2 differences between /proc/cpuinfo and glibc code.
>> 
>
> Thanks.
>
> H.J.
> ---
> x86_cpu_TBM should be x86_cpu_index_80000001_ecx + 21.
> ---
>  sysdeps/x86/bits/platform/x86.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/sysdeps/x86/bits/platform/x86.h b/sysdeps/x86/bits/platform/x86.h
> index 8f423ae721..dd59224b7f 100644
> --- a/sysdeps/x86/bits/platform/x86.h
> +++ b/sysdeps/x86/bits/platform/x86.h
> @@ -244,7 +244,7 @@ enum
>    x86_cpu_XOP			= x86_cpu_index_80000001_ecx + 11,
>    x86_cpu_LWP			= x86_cpu_index_80000001_ecx + 15,
>    x86_cpu_FMA4			= x86_cpu_index_80000001_ecx + 16,
> -  x86_cpu_TBM			= x86_cpu_index_80000001_ecx + 20,
> +  x86_cpu_TBM			= x86_cpu_index_80000001_ecx + 21,
>  
>    x86_cpu_index_80000001_edx
>      = (CPUID_INDEX_80000001 * 8 * 4 * sizeof (unsigned int)

I've verified this works works on a system with tbm in /proc/cpuinfo.
the bit offset also matches what's documented elsewhere.  Looks good to
me.

Thanks,
Florian
  
H.J. Lu Feb. 17, 2022, 12:10 a.m. UTC | #2
On Mon, Feb 22, 2021 at 1:49 AM Florian Weimer <fweimer@redhat.com> wrote:
>
> * H. J. Lu via Libc-alpha:
>
> >> Checking HAS_CPU_FEATURE (TBM):
> >>   HAS_CPU_FEATURE (TBM): 0
> >>   cpuinfo (tbm): 1
> >>  *** failure ***
> >
> > Please try th patch enclosed here.
> >
> >> 2 differences between /proc/cpuinfo and glibc code.
> >>
> >
> > Thanks.
> >
> > H.J.
> > ---
> > x86_cpu_TBM should be x86_cpu_index_80000001_ecx + 21.
> > ---
> >  sysdeps/x86/bits/platform/x86.h | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/sysdeps/x86/bits/platform/x86.h b/sysdeps/x86/bits/platform/x86.h
> > index 8f423ae721..dd59224b7f 100644
> > --- a/sysdeps/x86/bits/platform/x86.h
> > +++ b/sysdeps/x86/bits/platform/x86.h
> > @@ -244,7 +244,7 @@ enum
> >    x86_cpu_XOP                        = x86_cpu_index_80000001_ecx + 11,
> >    x86_cpu_LWP                        = x86_cpu_index_80000001_ecx + 15,
> >    x86_cpu_FMA4                       = x86_cpu_index_80000001_ecx + 16,
> > -  x86_cpu_TBM                        = x86_cpu_index_80000001_ecx + 20,
> > +  x86_cpu_TBM                        = x86_cpu_index_80000001_ecx + 21,
> >
> >    x86_cpu_index_80000001_edx
> >      = (CPUID_INDEX_80000001 * 8 * 4 * sizeof (unsigned int)
>
> I've verified this works works on a system with tbm in /proc/cpuinfo.
> the bit offset also matches what's documented elsewhere.  Looks good to
> me.
>
> Thanks,
> Florian
>

I am backporting this to 2.33 branch.
  

Patch

diff --git a/sysdeps/x86/bits/platform/x86.h b/sysdeps/x86/bits/platform/x86.h
index 8f423ae721..dd59224b7f 100644
--- a/sysdeps/x86/bits/platform/x86.h
+++ b/sysdeps/x86/bits/platform/x86.h
@@ -244,7 +244,7 @@  enum
   x86_cpu_XOP			= x86_cpu_index_80000001_ecx + 11,
   x86_cpu_LWP			= x86_cpu_index_80000001_ecx + 15,
   x86_cpu_FMA4			= x86_cpu_index_80000001_ecx + 16,
-  x86_cpu_TBM			= x86_cpu_index_80000001_ecx + 20,
+  x86_cpu_TBM			= x86_cpu_index_80000001_ecx + 21,
 
   x86_cpu_index_80000001_edx
     = (CPUID_INDEX_80000001 * 8 * 4 * sizeof (unsigned int)