From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1969) id 17E923858424; Sat, 16 Dec 2023 02:56:45 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 17E923858424 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1702695405; bh=6IpZtYD8ljJmS+bvADWFvdufoHTI2yvRIt/7Mkun5FQ=; h=From:To:Subject:Date:From; b=ldIdFvyJHW3wiH7Lk6k3+Z3HypNdvXfc6UOke9CdT1d2n3BbG8NRKilRlE/hLxM/f lqRnPHtdv/OblLtpHBsfrWITue/8hbT2KGHqRjAf5wwEr/umvUqfaHfLWShh1MGYMZ xDGPZejk3+GA0Vpf89rO3OjdUZuwAelbogxqUKE0= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Rajalakshmi Srinivasaraghavan To: glibc-cvs@sourceware.org Subject: [glibc] powerpc: Add space for HWCAP3/HWCAP4 in the TCB for future Power. X-Act-Checkin: glibc X-Git-Author: Manjunath Matti X-Git-Refname: refs/heads/master X-Git-Oldrev: 90bcc8721ef82b7378d2b080141228660e862d56 X-Git-Newrev: 93a739d4a1c34c9dbb96ced4fbeaa18e02000b6a Message-Id: <20231216025645.17E923858424@sourceware.org> Date: Sat, 16 Dec 2023 02:56:45 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=93a739d4a1c34c9dbb96ced4fbeaa18e02000b6a commit 93a739d4a1c34c9dbb96ced4fbeaa18e02000b6a Author: Manjunath Matti Date: Tue Dec 5 06:38:47 2023 -0600 powerpc: Add space for HWCAP3/HWCAP4 in the TCB for future Power. 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 Reviewed-by: Peter Bergner Diff: --- sysdeps/powerpc/Versions | 5 +++++ sysdeps/powerpc/hwcapinfo.c | 5 +++++ sysdeps/powerpc/nptl/tcb-offsets.sym | 1 + sysdeps/powerpc/nptl/tls.h | 13 ++++++++++++- sysdeps/unix/sysv/linux/powerpc/powerpc32/ld.abilist | 1 + sysdeps/unix/sysv/linux/powerpc/powerpc64/be/ld.abilist | 1 + sysdeps/unix/sysv/linux/powerpc/powerpc64/le/ld.abilist | 1 + 7 files changed, 26 insertions(+), 1 deletion(-) diff --git a/sysdeps/powerpc/Versions b/sysdeps/powerpc/Versions index cca8fd2fc5..575f7317bf 100644 --- a/sysdeps/powerpc/Versions +++ b/sysdeps/powerpc/Versions @@ -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; + } } diff --git a/sysdeps/powerpc/hwcapinfo.c b/sysdeps/powerpc/hwcapinfo.c index f2c473c556..a4d5aa1fa6 100644 --- a/sysdeps/powerpc/hwcapinfo.c +++ b/sysdeps/powerpc/hwcapinfo.c @@ -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 diff --git a/sysdeps/powerpc/nptl/tcb-offsets.sym b/sysdeps/powerpc/nptl/tcb-offsets.sym index 4c01615ad0..9b29fe8d1a 100644 --- a/sysdeps/powerpc/nptl/tcb-offsets.sym +++ b/sysdeps/powerpc/nptl/tcb-offsets.sym @@ -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)) diff --git a/sysdeps/powerpc/nptl/tls.h b/sysdeps/powerpc/nptl/tls.h index a668798181..3f8eca57b5 100644 --- a/sysdeps/powerpc/nptl/tls.h +++ b/sysdeps/powerpc/nptl/tls.h @@ -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() \ diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/ld.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc32/ld.abilist index 5a68aeb9ee..b1073f0942 100644 --- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/ld.abilist +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/ld.abilist @@ -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 diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/ld.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/ld.abilist index 21f472e674..40942a2cc6 100644 --- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/ld.abilist +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/ld.abilist @@ -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 diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/ld.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/ld.abilist index 9c9c40450d..01f2694a4d 100644 --- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/ld.abilist +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/ld.abilist @@ -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