AArch64: Add support for sve2 ifuncs

Message ID PAWPR08MB8982DDD0E9306DED9F547CCC833F2@PAWPR08MB8982.eurprd08.prod.outlook.com (mailing list archive)
State Accepted
Headers
Series AArch64: Add support for sve2 ifuncs |

Checks

Context Check Description
redhat-pt-bot/TryBot-apply_patch success Patch applied to master at the time it was sent
redhat-pt-bot/TryBot-32bit success Build for i686
linaro-tcwg-bot/tcwg_glibc_build--master-arm success Build passed
linaro-tcwg-bot/tcwg_glibc_build--master-aarch64 success Build passed
linaro-tcwg-bot/tcwg_glibc_check--master-aarch64 success Test passed

Commit Message

Wilco Dijkstra May 6, 2026, 3:34 p.m. UTC
  Add support for sve2 in cpu-features. Minor cleanup of init-arch.h.

OK for commit?

---
  

Comments

Adhemerval Zanella Netto May 7, 2026, 1:42 p.m. UTC | #1
On 06/05/26 12:34, Wilco Dijkstra wrote:
> 
> Add support for sve2 in cpu-features. Minor cleanup of init-arch.h.
> 
> OK for commit?
> 

I would prefer to add required machinery when we actually need them.

> ---
> 
> diff --git a/sysdeps/aarch64/cpu-features.h b/sysdeps/aarch64/cpu-features.h
> index d6367a4596bdfb348d9de3a021c680f8d1348547..d1377c0dcaf5bdb2d6b9010947af521d88e88734 100644
> --- a/sysdeps/aarch64/cpu-features.h
> +++ b/sysdeps/aarch64/cpu-features.h
> @@ -69,6 +69,7 @@ struct cpu_features
>    bool sve;
>    bool unused;
>    bool mops;
> +  bool sve2;
>  };
>  
>  #endif /* _CPU_FEATURES_AARCH64_H  */
> diff --git a/sysdeps/aarch64/multiarch/init-arch.h b/sysdeps/aarch64/multiarch/init-arch.h
> index 8afd91164fadb683367229a424612224c5f5ee20..e00d1746d864ecb72a6f0e4730cb162ee3ec33bb 100644
> --- a/sysdeps/aarch64/multiarch/init-arch.h
> +++ b/sysdeps/aarch64/multiarch/init-arch.h
> @@ -19,22 +19,13 @@
>  #include <ldsodefs.h>
>  #include <sys/auxv.h>
>  
> -/* Make glibc MTE-safe on a system that supports MTE in case user code
> -   enables tag checks independently of the mte_status of glibc.  There
> -   is currently no ABI contract for enabling tag checks in user code,
> -   but this can be useful for debugging with MTE.  */
> -#define MTE_ENABLED() (GLRO(dl_hwcap2) & HWCAP2_MTE)
> -
>  #define INIT_ARCH()							      \
>    uint64_t __attribute__((unused)) midr =				      \
>      GLRO(dl_aarch64_cpu_features).midr_el1;				      \
>    unsigned __attribute__((unused)) zva_size =				      \
>      GLRO(dl_aarch64_cpu_features).zva_size;				      \
> -  bool __attribute__((unused)) bti =					      \
> -    GLRO(dl_aarch64_cpu_features).bti;					      \
> -  bool __attribute__((unused)) mte =					      \
> -    MTE_ENABLED ();							      \
> -  bool __attribute__((unused)) sve =					      \
> -    GLRO(dl_aarch64_cpu_features).sve;					      \
> -  bool __attribute__((unused)) mops =					      \
> -    GLRO(dl_aarch64_cpu_features).mops;
> +  bool __attribute__((unused)) bti = GLRO(dl_aarch64_cpu_features).bti;	      \
> +  bool __attribute__((unused)) mte = GLRO(dl_hwcap2) & HWCAP2_MTE;	      \
> +  bool __attribute__((unused)) sve = GLRO(dl_aarch64_cpu_features).sve;	      \
> +  bool __attribute__((unused)) sve2 = GLRO(dl_aarch64_cpu_features).sve2;     \
> +  bool __attribute__((unused)) mops = GLRO(dl_aarch64_cpu_features).mops;
> diff --git a/sysdeps/unix/sysv/linux/aarch64/cpu-features.c b/sysdeps/unix/sysv/linux/aarch64/cpu-features.c
> index 36bd72bb12d989bccafa5a9dd5ce1ac7c702a86f..2e8887ce23fb0d3283dd3bc19e2b642ccefbac48 100644
> --- a/sysdeps/unix/sysv/linux/aarch64/cpu-features.c
> +++ b/sysdeps/unix/sysv/linux/aarch64/cpu-features.c
> @@ -125,6 +125,7 @@ init_cpu_features (struct cpu_features *cpu_features)
>  
>    /* Check if SVE is supported.  */
>    cpu_features->sve = GLRO (dl_hwcap) & HWCAP_SVE;
> +  cpu_features->sve2 = GLRO (dl_hwcap2) & HWCAP2_SVE2;
>  
>    /* Check if MOPS is supported.  */
>    cpu_features->mops = GLRO (dl_hwcap2) & HWCAP2_MOPS;
>
  
Yury Khrustalev May 19, 2026, 2:42 p.m. UTC | #2
On Wed, May 06, 2026 at 03:34:39PM +0000, Wilco Dijkstra wrote:
> 
> Add support for sve2 in cpu-features. Minor cleanup of init-arch.h.

LGTM. Reviewed-by: Yury Khrustalev <yury.khrustalev@arm.com>

Thanks,
Yury
  

Patch

diff --git a/sysdeps/aarch64/cpu-features.h b/sysdeps/aarch64/cpu-features.h
index d6367a4596bdfb348d9de3a021c680f8d1348547..d1377c0dcaf5bdb2d6b9010947af521d88e88734 100644
--- a/sysdeps/aarch64/cpu-features.h
+++ b/sysdeps/aarch64/cpu-features.h
@@ -69,6 +69,7 @@  struct cpu_features
   bool sve;
   bool unused;
   bool mops;
+  bool sve2;
 };
 
 #endif /* _CPU_FEATURES_AARCH64_H  */
diff --git a/sysdeps/aarch64/multiarch/init-arch.h b/sysdeps/aarch64/multiarch/init-arch.h
index 8afd91164fadb683367229a424612224c5f5ee20..e00d1746d864ecb72a6f0e4730cb162ee3ec33bb 100644
--- a/sysdeps/aarch64/multiarch/init-arch.h
+++ b/sysdeps/aarch64/multiarch/init-arch.h
@@ -19,22 +19,13 @@ 
 #include <ldsodefs.h>
 #include <sys/auxv.h>
 
-/* Make glibc MTE-safe on a system that supports MTE in case user code
-   enables tag checks independently of the mte_status of glibc.  There
-   is currently no ABI contract for enabling tag checks in user code,
-   but this can be useful for debugging with MTE.  */
-#define MTE_ENABLED() (GLRO(dl_hwcap2) & HWCAP2_MTE)
-
 #define INIT_ARCH()							      \
   uint64_t __attribute__((unused)) midr =				      \
     GLRO(dl_aarch64_cpu_features).midr_el1;				      \
   unsigned __attribute__((unused)) zva_size =				      \
     GLRO(dl_aarch64_cpu_features).zva_size;				      \
-  bool __attribute__((unused)) bti =					      \
-    GLRO(dl_aarch64_cpu_features).bti;					      \
-  bool __attribute__((unused)) mte =					      \
-    MTE_ENABLED ();							      \
-  bool __attribute__((unused)) sve =					      \
-    GLRO(dl_aarch64_cpu_features).sve;					      \
-  bool __attribute__((unused)) mops =					      \
-    GLRO(dl_aarch64_cpu_features).mops;
+  bool __attribute__((unused)) bti = GLRO(dl_aarch64_cpu_features).bti;	      \
+  bool __attribute__((unused)) mte = GLRO(dl_hwcap2) & HWCAP2_MTE;	      \
+  bool __attribute__((unused)) sve = GLRO(dl_aarch64_cpu_features).sve;	      \
+  bool __attribute__((unused)) sve2 = GLRO(dl_aarch64_cpu_features).sve2;     \
+  bool __attribute__((unused)) mops = GLRO(dl_aarch64_cpu_features).mops;
diff --git a/sysdeps/unix/sysv/linux/aarch64/cpu-features.c b/sysdeps/unix/sysv/linux/aarch64/cpu-features.c
index 36bd72bb12d989bccafa5a9dd5ce1ac7c702a86f..2e8887ce23fb0d3283dd3bc19e2b642ccefbac48 100644
--- a/sysdeps/unix/sysv/linux/aarch64/cpu-features.c
+++ b/sysdeps/unix/sysv/linux/aarch64/cpu-features.c
@@ -125,6 +125,7 @@  init_cpu_features (struct cpu_features *cpu_features)
 
   /* Check if SVE is supported.  */
   cpu_features->sve = GLRO (dl_hwcap) & HWCAP_SVE;
+  cpu_features->sve2 = GLRO (dl_hwcap2) & HWCAP2_SVE2;
 
   /* Check if MOPS is supported.  */
   cpu_features->mops = GLRO (dl_hwcap2) & HWCAP2_MOPS;