]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
powerpc: Add space for HWCAP3/HWCAP4 in the TCB for future Power.
authorManjunath Matti <mmatti@linux.ibm.com>
Tue, 5 Dec 2023 12:38:47 +0000 (06:38 -0600)
committerRajalakshmi Srinivasaraghavan <rajis@linux.ibm.com>
Sat, 16 Dec 2023 02:20:14 +0000 (20:20 -0600)
This patch reserves space for HWCAP3/HWCAP4 in the TCB of powerpc.
These hardware capabilities bits will be used by future Power
architectures.

Versioned symbol '__parse_hwcap_3_4_and_convert_at_platform' advertises
the availability of the new HWCAP3/HWCAP4 data in the TCB.

This is an ABI change for GLIBC 2.39.

Suggested-by: Peter Bergner <bergner@linux.ibm.com>
Reviewed-by: Peter Bergner <bergner@linux.ibm.com>
sysdeps/powerpc/Versions
sysdeps/powerpc/hwcapinfo.c
sysdeps/powerpc/nptl/tcb-offsets.sym
sysdeps/powerpc/nptl/tls.h
sysdeps/unix/sysv/linux/powerpc/powerpc32/ld.abilist
sysdeps/unix/sysv/linux/powerpc/powerpc64/be/ld.abilist
sysdeps/unix/sysv/linux/powerpc/powerpc64/le/ld.abilist

index cca8fd2fc5abe6bcb31d7fdf466a5f66e1c07583..575f7317bf231543774d7eccb44d692c2f960fd4 100644 (file)
@@ -24,4 +24,9 @@ ld {
     # and AT_PLATFORM data should be stored into the TCB.
     __parse_hwcap_and_convert_at_platform;
   }
+  GLIBC_2.39 {
+    # Symbol used to version control when the ABI started to specify that
+    # HWCAP3 and HWCAP4 are stored in the TCB.
+    __parse_hwcap_3_4_and_convert_at_platform;
+  }
 }
index f2c473c55673f304a952f780511bac3964077148..a4d5aa1fa6cfc682f65136d146c710af73a94c79 100644 (file)
@@ -70,11 +70,14 @@ __tcb_parse_hwcap_and_convert_at_platform (void)
   /* Consolidate both HWCAP and HWCAP2 into a single doubleword so that
      we can read both in a single load later.  */
   __tcb.hwcap = (h1 << 32) | (h2 & 0xffffffff);
+  __tcb.hwcap_extn = 0x0;
 
 }
 #if IS_IN (rtld)
 versioned_symbol (ld, __tcb_parse_hwcap_and_convert_at_platform, \
                  __parse_hwcap_and_convert_at_platform, GLIBC_2_23);
+versioned_symbol (ld, __tcb_parse_hwcap_and_convert_at_platform, \
+                 __parse_hwcap_3_4_and_convert_at_platform, GLIBC_2_39);
 #endif
 
 /* Export __parse_hwcap_and_convert_at_platform in libc.a.  This is used by
@@ -83,4 +86,6 @@ versioned_symbol (ld, __tcb_parse_hwcap_and_convert_at_platform, \
 #ifndef SHARED
 weak_alias (__tcb_parse_hwcap_and_convert_at_platform, \
            __parse_hwcap_and_convert_at_platform);
+weak_alias (__tcb_parse_hwcap_and_convert_at_platform, \
+           __parse_hwcap_3_4_and_convert_at_platform);
 #endif
index 4c01615ad02c6fef0c38c9b617ec2366a8efc25a..9b29fe8d1a140741a17b0c7fb02139a108d0fcfe 100644 (file)
@@ -26,3 +26,4 @@ TCB_AT_PLATFORM                       (offsetof (tcbhead_t, at_platform) - TLS_TCB_OFFSET - sizeof(t
 PADDING                                (offsetof (tcbhead_t, padding) - TLS_TCB_OFFSET - sizeof(tcbhead_t))
 #endif
 TCB_HWCAP                      (offsetof (tcbhead_t, hwcap) - TLS_TCB_OFFSET - sizeof (tcbhead_t))
+TCB_HWCAP_EXTN                 (offsetof (tcbhead_t, hwcap_extn) - TLS_TCB_OFFSET - sizeof (tcbhead_t))
index a668798181ff7a5796291e22a2469a86c6c84576..3f8eca57b5670a2f605e25343ca1cfd9482acc7f 100644 (file)
@@ -64,6 +64,9 @@
    are private.  */
 typedef struct
 {
+  /* Reservation for HWCAP3 and HWCAP4 data.  To be accessed by GCC in
+     __builtin_cpu_supports(), so it is a part of the public ABI.  */
+  uint64_t hwcap_extn;
   /* Reservation for HWCAP data.  To be accessed by GCC in
      __builtin_cpu_supports(), so it is a part of public ABI.  */
   uint64_t hwcap;
@@ -138,6 +141,7 @@ typedef struct
   ({                                                                         \
     __thread_register = (void *) (tcbp) + TLS_TCB_OFFSET;                    \
     THREAD_SET_HWCAP (__tcb.hwcap);                                          \
+    THREAD_SET_HWCAP_EXTN (__tcb.hwcap_extn);                                \
     THREAD_SET_AT_PLATFORM (__tcb.at_platform);                                      \
     true;                                                                    \
   })
@@ -147,6 +151,8 @@ typedef struct
     void *tp = (void *) (pd) + TLS_TCB_OFFSET + TLS_PRE_TCB_SIZE;            \
     (((tcbhead_t *) ((char *) tp - TLS_TCB_OFFSET))[-1].hwcap) =             \
       THREAD_GET_HWCAP ();                                                   \
+    (((tcbhead_t *) ((char *) tp - TLS_TCB_OFFSET))[-1].hwcap_extn) =        \
+      THREAD_GET_HWCAP_EXTN ();                                                      \
     (((tcbhead_t *) ((char *) tp - TLS_TCB_OFFSET))[-1].at_platform) =       \
       THREAD_GET_AT_PLATFORM ();
 
@@ -189,12 +195,17 @@ typedef struct
                     + TLS_PRE_TCB_SIZE))[-1].pointer_guard                   \
      = THREAD_GET_POINTER_GUARD())
 
-/* hwcap field in TCB head.  */
+/* hwcap & hwcap_extn fields in TCB head.  */
 # define THREAD_GET_HWCAP() \
     (((tcbhead_t *) ((char *) __thread_register                                      \
                     - TLS_TCB_OFFSET))[-1].hwcap)
+# define THREAD_GET_HWCAP_EXTN() \
+    (((tcbhead_t *) ((char *) __thread_register                                      \
+                    - TLS_TCB_OFFSET))[-1].hwcap_extn)
 # define THREAD_SET_HWCAP(value) \
     (THREAD_GET_HWCAP () = (value))
+# define THREAD_SET_HWCAP_EXTN(value) \
+    (THREAD_GET_HWCAP_EXTN () = (value))
 
 /* at_platform field in TCB head.  */
 # define THREAD_GET_AT_PLATFORM() \
index 5a68aeb9eed338445ec18fdb9ef798baf6580bba..b1073f09420bdb3a44d5b575d08f54f9c41087f4 100644 (file)
@@ -8,3 +8,4 @@ GLIBC_2.34 __rtld_version_placeholder F
 GLIBC_2.35 __rseq_flags D 0x4
 GLIBC_2.35 __rseq_offset D 0x4
 GLIBC_2.35 __rseq_size D 0x4
+GLIBC_2.39 __parse_hwcap_3_4_and_convert_at_platform F
index 21f472e674299ab7927fa86e280813e248223bad..40942a2cc6112e1117dac8279e38e52dfcaca60e 100644 (file)
@@ -8,3 +8,4 @@ GLIBC_2.34 __rtld_version_placeholder F
 GLIBC_2.35 __rseq_flags D 0x4
 GLIBC_2.35 __rseq_offset D 0x8
 GLIBC_2.35 __rseq_size D 0x4
+GLIBC_2.39 __parse_hwcap_3_4_and_convert_at_platform F
index 9c9c40450d65188051e9f9b1b928567bd4e8bab3..01f2694a4d0f1cecdcf9457f3f3f8b7b4373ed4f 100644 (file)
@@ -8,3 +8,4 @@ GLIBC_2.34 __rtld_version_placeholder F
 GLIBC_2.35 __rseq_flags D 0x4
 GLIBC_2.35 __rseq_offset D 0x8
 GLIBC_2.35 __rseq_size D 0x4
+GLIBC_2.39 __parse_hwcap_3_4_and_convert_at_platform F