[PATCH] PPC Add Power6x Support to dl-procinfo

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

[PATCH] PPC Add Power6x Support to dl-procinfo

Steven Munroe
The POWER6 processor includes addtional instructions beyond the 2.05 ISA
(Move Float to GRP, Move Float from GRP) which are available as the
default on unmanaged systems (single partition systems identified  by
the AT_PLATFORM="power6x"). For Partitioned systems those instructions
are disabled by default (AT_PLATFORM="power6"). Paul Mackerras recently
posted the power6, power6x kernel support:
http://patchwork.ozlabs.org/linuxppc/patch?id=7989

Also we need to add the hardware Decimal Floating Point feature to
AT_HWCAP and update the HWCAP_IMPORTANT to include PPC_FEATURE_HAS_DFP).





2006-11-11  Steven Munroe  <[hidden email]>

        * sysdeps/powerpc/dl-procinfo.c (_dl_powerpc_cap_flags): Add 3 new cap
        names to the beginning.
        (_dl_powerpc_platforms): Add "power6x".
        * sysdeps/powerpc/dl-procinfo.h (_DL_HWCAP_FIRST): Decrease.
        (HWCAP_IMPORTANT): Add PPC_FEATURE_HAS_DFP.
        (_DL_PLATFORMS_COUNT): Increase.
        (_dl_string_platform): Handle power6x case.
        * sysdeps/powerpc/sysdep.h (PPC_FEATURE_PA6T, PPC_FEATURE_HAS_DFP,
        PPC_FEATURE_POWER6_EXT): Define.
        (PPC_FEATURE_POWER5, PPC_FEATURE_POWER5_PLUS): Correct Comment.

diff -urN libc25-cvstip-20061111/sysdeps/powerpc/dl-procinfo.c libc25/sysdeps/powerpc/dl-procinfo.c
--- libc25-cvstip-20061111/sysdeps/powerpc/dl-procinfo.c 2006-09-15 02:47:28.000000000 -0500
+++ libc25/sysdeps/powerpc/dl-procinfo.c 2006-11-12 10:16:28.000000000 -0600
@@ -46,10 +46,11 @@
 #if !defined PROCINFO_DECL && defined SHARED
   ._dl_powerpc_cap_flags
 #else
-PROCINFO_CLASS const char _dl_powerpc_cap_flags[20][10]
+PROCINFO_CLASS const char _dl_powerpc_cap_flags[23][10]
 #endif
 #ifndef PROCINFO_DECL
 = {
+    "power6x", "dfp", "pa6t",
     "arch_2_05", "ic_snoop", "smt", "booke",
     "cellbe", "power5+", "power5", "power4",
     "notb", "efpdouble", "efpsingle", "spe",
@@ -66,11 +67,12 @@
 #if !defined PROCINFO_DECL && defined SHARED
   ._dl_powerpc_platforms
 #else
-PROCINFO_CLASS const char _dl_powerpc_platforms[6][12]
+PROCINFO_CLASS const char _dl_powerpc_platforms[7][12]
 #endif
 #ifndef PROCINFO_DECL
 = {
-    "power4", "ppc970", "power5", "power5+", "power6", "ppc-cell-be"
+    "power4", "ppc970", "power5", "power5+", "power6", "ppc-cell-be",
+    "power6x"
   }
 #endif
 #if !defined SHARED || defined PROCINFO_DECL
diff -urN libc25-cvstip-20061111/sysdeps/powerpc/dl-procinfo.h libc25/sysdeps/powerpc/dl-procinfo.h
--- libc25-cvstip-20061111/sysdeps/powerpc/dl-procinfo.h 2006-09-15 02:47:45.000000000 -0500
+++ libc25/sysdeps/powerpc/dl-procinfo.h 2006-11-12 10:17:20.000000000 -0600
@@ -24,13 +24,14 @@
 #include <sysdep.h> /* This defines the PPC_FEATURE_* macros.  */
 
 /* There are 20 bits used, but they are bits 12..31.  */
-#define _DL_HWCAP_FIRST 12
+#define _DL_HWCAP_FIRST 9
 #define _DL_HWCAP_COUNT 32
 
 /* These bits influence library search.  */
-#define HWCAP_IMPORTANT (PPC_FEATURE_HAS_ALTIVEC)
+#define HWCAP_IMPORTANT (PPC_FEATURE_HAS_ALTIVEC \
+ + PPC_FEATURE_HAS_DFP)
 
-#define _DL_PLATFORMS_COUNT 6
+#define _DL_PLATFORMS_COUNT 7
 
 #define _DL_FIRST_PLATFORM      32
 /* Mask to filter out platforms.  */
@@ -84,6 +85,8 @@
   break;
  case '6':
   ret = _DL_FIRST_PLATFORM + 4;
+  if (str[1] == 'x')
+    ret+=2, ++str;
   break;
  default:
   return -1;
diff -urN libc25-cvstip-20061111/sysdeps/powerpc/sysdep.h libc25/sysdeps/powerpc/sysdep.h
--- libc25-cvstip-20061111/sysdeps/powerpc/sysdep.h 2006-09-15 02:48:04.000000000 -0500
+++ libc25/sysdeps/powerpc/sysdep.h 2006-11-12 15:39:42.000000000 -0600
@@ -34,13 +34,16 @@
 #define PPC_FEATURE_HAS_EFP_DOUBLE 0x00200000 /* SPE Double.  */
 #define PPC_FEATURE_NO_TB 0x00100000 /* 601/403gx have no timebase */
 #define PPC_FEATURE_POWER4 0x00080000 /* POWER4 ISA 2.00 */
-#define PPC_FEATURE_POWER5 0x00040000 /* POWER5 ISA 2.01 */
-#define PPC_FEATURE_POWER5_PLUS 0x00020000 /* POWER5+ ISA 2.02 */
+#define PPC_FEATURE_POWER5 0x00040000 /* POWER5 ISA 2.02 */
+#define PPC_FEATURE_POWER5_PLUS 0x00020000 /* POWER5+ ISA 2.03 */
 #define PPC_FEATURE_CELL_BE 0x00010000 /* CELL Broadband Engine */
 #define PPC_FEATURE_BOOKE 0x00008000
-#define PPC_FEATURE_SMT 0x00004000
+#define PPC_FEATURE_SMT 0x00004000 /* Simultaneous Multi-Threading */
 #define PPC_FEATURE_ICACHE_SNOOP 0x00002000
 #define PPC_FEATURE_ARCH_2_05 0x00001000 /* ISA 2.05 */
+#define PPC_FEATURE_PA6T 0x00000800 /* PA Semi 6T Core */
+#define PPC_FEATURE_HAS_DFP 0x00000400 /* Decimal FP Unit */
+#define PPC_FEATURE_POWER6_EXT 0x00000200 /* P6 + mffgpr/mftgpr */
 #define PPC_FEATURE_970 (PPC_FEATURE_POWER4 + PPC_FEATURE_HAS_ALTIVEC)
 
 #ifdef __ASSEMBLER__
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] PPC Add Power6x Support to dl-procinfo

Jakub Jelinek
On Sun, Nov 12, 2006 at 11:22:33PM -0600, Steven Munroe wrote:
> The POWER6 processor includes addtional instructions beyond the 2.05 ISA
> (Move Float to GRP, Move Float from GRP) which are available as the
> default on unmanaged systems (single partition systems identified  by
> the AT_PLATFORM="power6x"). For Partitioned systems those instructions
> are disabled by default (AT_PLATFORM="power6"). Paul Mackerras recently
> posted the power6, power6x kernel support:
> http://patchwork.ozlabs.org/linuxppc/patch?id=7989

Shouldn't arch_2_05 and PPC_FEATURE_ARCH_2_05 be renamed to
power6 and PPC_FEATURE_POWER6 respectively?

        Jakub
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] PPC Add Power6x Support to dl-procinfo

Steven Munroe
Jakub Jelinek wrote:

>On Sun, Nov 12, 2006 at 11:22:33PM -0600, Steven Munroe wrote:
>  
>>The POWER6 processor includes addtional instructions beyond the 2.05 ISA
>>(Move Float to GRP, Move Float from GRP) which are available as the
>>default on unmanaged systems (single partition systems identified  by
>>the AT_PLATFORM="power6x"). For Partitioned systems those instructions
>>are disabled by default (AT_PLATFORM="power6"). Paul Mackerras recently
>>posted the power6, power6x kernel support:
>>http://patchwork.ozlabs.org/linuxppc/patch?id=7989
>>    
>
>Shouldn't arch_2_05 and PPC_FEATURE_ARCH_2_05 be renamed to
>power6 and PPC_FEATURE_POWER6 respectively?
>
>  
Not really power6x is a special case. We got off to a bad start with
PPC_FEATURE_POWER4/5/5+, before Uli pushed us to use AT_PLATFORM for
hardware/chip differences. In the new scheme PPC_FEATURE_POWER4,
PPC_FEATURE_POWER5, PPC_FEATURE_POWER5+ should be renamed to
PPC_FEATURE_ARCH_2_0 PPC_FEATURE_ARCH_2_02 and PPC_FEATURE_ARCH_2_03
respectively.  These correspond to versions of "The PowerPC Architecure"
(each level adds new instructions).

The current thinking is to use AT_PLATFORM for
hardware/chip/micro-architecure differences (970 vs power5 vs power6)
and AT_HWCAP for Hardware facilities (FPU, ALTIVEC, DFP) and Instruction
Set Architecture levels (ARCH_2_05).

power6x is odd because two instruction where retroactively removed from
ARCH_2_05. Perhaps we should change PPC_FEATURE_POWER6_EXT to
PPC_FEATURE_HAS_MFTGPR (move float to/from gpr) which is more inline
with a instruction set facility.
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] PPC Add Power6x Support to dl-procinfo

Jakub Jelinek
In reply to this post by Steven Munroe
On Sun, Nov 12, 2006 at 11:22:33PM -0600, Steven Munroe wrote:

> The POWER6 processor includes addtional instructions beyond the 2.05 ISA
> (Move Float to GRP, Move Float from GRP) which are available as the
> default on unmanaged systems (single partition systems identified  by
> the AT_PLATFORM="power6x"). For Partitioned systems those instructions
> are disabled by default (AT_PLATFORM="power6"). Paul Mackerras recently
> posted the power6, power6x kernel support:
> http://patchwork.ozlabs.org/linuxppc/patch?id=7989
>
> Also we need to add the hardware Decimal Floating Point feature to
> AT_HWCAP and update the HWCAP_IMPORTANT to include PPC_FEATURE_HAS_DFP).

Ulrich asked me to avoid using hardcoded constants for the platform bits
and instead use macros, here is a patch that does that on top of
your 2006-11-11 patch.

But, before both can be applied I guess we need the
http://patchwork.ozlabs.org/linuxppc/patch?id=7989
patch to hit Linus' tree, any ETA when that will happen?

2006-11-28  Jakub Jelinek  <[hidden email]>

        * elf/dl-support.c: Include dl-procinfo.h.
        * sysdeps/powerpc/dl-procinfo.h (PPC_PLATFORM_POWER4,
        PPC_PLATFORM_PPC970, PPC_PLATFORM_POWER5, PPC_PLATFORM_POWER5_PLUS,
        PPC_PLATFORM_POWER6, PPC_PLATFORM_CELL_BE, PPC_PLATFORM_POWER6X):
        Define.
        (_dl_string_platform): Use PPC_PLATFORM_* macros instead of
        hardcoded constants.
        * sysdeps/powerpc/dl-procinfo.c (_dl_powerpc_platform): Use
        PPC_PLATFORM_* macros for array designators.

--- libc/elf/dl-support.c.jj 2006-11-28 11:25:13.000000000 +0100
+++ libc/elf/dl-support.c 2006-11-28 23:25:05.000000000 +0100
@@ -29,6 +29,7 @@
 #include <bits/libc-lock.h>
 #include <dl-cache.h>
 #include <dl-librecon.h>
+#include <dl-procinfo.h>
 #include <unsecvars.h>
 #include <hp-timing.h>
 
--- libc/sysdeps/powerpc/dl-procinfo.c.jj 2006-11-28 23:01:45.000000000 +0100
+++ libc/sysdeps/powerpc/dl-procinfo.c 2006-11-28 23:01:50.000000000 +0100
@@ -71,8 +71,13 @@ PROCINFO_CLASS const char _dl_powerpc_pl
 #endif
 #ifndef PROCINFO_DECL
 = {
-    "power4", "ppc970", "power5", "power5+", "power6", "ppc-cell-be",
-    "power6x"
+    [PPC_PLATFORM_POWER4] = "power4",
+    [PPC_PLATFORM_PPC970] = "ppc970",
+    [PPC_PLATFORM_POWER5] = "power5",
+    [PPC_PLATFORM_POWER5_PLUS] = "power5+",
+    [PPC_PLATFORM_POWER6] = "power6",
+    [PPC_PLATFORM_CELL_BE] = "ppc-cell-be",
+    [PPC_PLATFORM_POWER6X] = "power6x"
   }
 #endif
 #if !defined SHARED || defined PROCINFO_DECL
--- libc/sysdeps/powerpc/dl-procinfo.h.jj 2006-11-28 23:01:45.000000000 +0100
+++ libc/sysdeps/powerpc/dl-procinfo.h 2006-11-28 23:23:45.000000000 +0100
@@ -38,6 +38,15 @@
 #define _DL_HWCAP_PLATFORM      (((1ULL << _DL_PLATFORMS_COUNT) - 1) \
                                  << _DL_FIRST_PLATFORM)
 
+/* Platform bits (relative to _DL_FIRST_PLATFORM).  */
+#define PPC_PLATFORM_POWER4 0
+#define PPC_PLATFORM_PPC970 1
+#define PPC_PLATFORM_POWER5 2
+#define PPC_PLATFORM_POWER5_PLUS 3
+#define PPC_PLATFORM_POWER6 4
+#define PPC_PLATFORM_CELL_BE 5
+#define PPC_PLATFORM_POWER6X 6
+
 static inline const char *
 __attribute__ ((unused))
 _dl_hwcap_string (int idx)
@@ -69,24 +78,24 @@ _dl_string_platform (const char *str)
   if (str == NULL)
     return -1;
 
-  if (strncmp (str, GLRO(dl_powerpc_platforms)[0], 5) == 0)
+  if (strncmp (str, GLRO(dl_powerpc_platforms)[PPC_PLATFORM_POWER4], 5) == 0)
     {
       int ret;
       str += 5;
       switch (*str)
  {
  case '4':
-  ret = _DL_FIRST_PLATFORM + 0;
+  ret = _DL_FIRST_PLATFORM + PPC_PLATFORM_POWER4;
   break;
  case '5':
-  ret = _DL_FIRST_PLATFORM + 2;
+  ret = _DL_FIRST_PLATFORM + PPC_PLATFORM_POWER5;
   if (str[1] == '+')
-    ++ret, ++str;
+    ret = _DL_FIRST_PLATFORM + PPC_PLATFORM_POWER5_PLUS, ++str;
   break;
  case '6':
-  ret = _DL_FIRST_PLATFORM + 4;
+  ret = _DL_FIRST_PLATFORM + PPC_PLATFORM_POWER6;
   if (str[1] == 'x')
-    ret+=2, ++str;
+    ret = _DL_FIRST_PLATFORM + PPC_PLATFORM_POWER6X, ++str;
   break;
  default:
   return -1;
@@ -94,12 +103,16 @@ _dl_string_platform (const char *str)
       if (str[1] == '\0')
  return ret;
     }
-  else if (strncmp (str, GLRO(dl_powerpc_platforms)[1], 3) == 0)
+  else if (strncmp (str, GLRO(dl_powerpc_platforms)[PPC_PLATFORM_PPC970],
+    3) == 0)
     {
-      if (strcmp (str + 3, GLRO(dl_powerpc_platforms)[1] + 3) == 0)
- return _DL_FIRST_PLATFORM + 1;
-      else if (strcmp (str + 3, GLRO(dl_powerpc_platforms)[5] + 3) == 0)
- return _DL_FIRST_PLATFORM + 5;
+      if (strcmp (str + 3, GLRO(dl_powerpc_platforms)[PPC_PLATFORM_PPC970]
+   + 3) == 0)
+ return _DL_FIRST_PLATFORM + PPC_PLATFORM_PPC970;
+      else if (strcmp (str + 3,
+       GLRO(dl_powerpc_platforms)[PPC_PLATFORM_CELL_BE] + 3)
+       == 0)
+ return _DL_FIRST_PLATFORM + PPC_PLATFORM_CELL_BE;
     }
 
   return -1;


        Jakub
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] PPC Add Power6x Support to dl-procinfo

Paul Mackerras
Jakub Jelinek writes:

> But, before both can be applied I guess we need the
> http://patchwork.ozlabs.org/linuxppc/patch?id=7989
> patch to hit Linus' tree, any ETA when that will happen?

It's in the queue to go in for 2.6.20, i.e. in the merge window after
2.6.19 is released.

Paul.
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] PPC Add Power6x Support to dl-procinfo

Ulrich Drepper
Paul Mackerras wrote:
> It's in the queue to go in for 2.6.20, i.e. in the merge window after
> 2.6.19 is released.

Then the libc patch has to wait until 2.6.20, too.

--
➧ Ulrich Drepper ➧ Red Hat, Inc. ➧ 444 Castro St ➧ Mountain View, CA ❖
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] PPC Add Power6x Support to dl-procinfo

Paul Mackerras
Ulrich Drepper writes:

> Paul Mackerras wrote:
> > It's in the queue to go in for 2.6.20, i.e. in the merge window after
> > 2.6.19 is released.
>
> Then the libc patch has to wait until 2.6.20, too.

I don't see why there has to be a linkage.  The patch is only adding
new AT_HWCAP bits and AT_PLATFORM values.  No earlier kernel will set
those AT_HWCAP bits or use those AT_PLATFORM values, so there is no
backward compatibility problem.  In other words the libc patch could
go in now without any possibility of incorrect behaviour.

Paul.
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] PPC Add Power6x Support to dl-procinfo

Ulrich Drepper
Paul Mackerras wrote:
> I don't see why there has to be a linkage.

You don't have to, it's not your call.

I never check in anything which is not supported by the upstream kernel.

--
➧ Ulrich Drepper ➧ Red Hat, Inc. ➧ 444 Castro St ➧ Mountain View, CA ❖