public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Szabolcs Nagy <nsz@sourceware.org>
To: glibc-cvs@sourceware.org
Subject: [glibc/arm/morello/main] TODO(drop): aarch64: morello: CPU feature detection for Morello
Date: Fri,  5 Aug 2022 19:38:22 +0000 (GMT)	[thread overview]
Message-ID: <20220805193822.9B65638582A3@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=2f3bf4cf639b49fd5a37ea300d84b638af8cde46

commit 2f3bf4cf639b49fd5a37ea300d84b638af8cde46
Author: Carlos Eduardo Seo <carlos.seo@arm.com>
Date:   Fri Nov 13 16:33:07 2020 -0300

    TODO(drop): aarch64: morello: CPU feature detection for Morello
    
    Initial detection of Arm Morello architecture from the HWCAP2 bit and CPU
    identification from MIDR_EL0.
    
    TODO: not needed?
    - lp64 does not have to detect
    - purecap can assume morello

Diff:
---
 sysdeps/aarch64/multiarch/init-arch.h          | 4 +++-
 sysdeps/unix/sysv/linux/aarch64/cpu-features.c | 3 +++
 sysdeps/unix/sysv/linux/aarch64/cpu-features.h | 6 ++++++
 3 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/sysdeps/aarch64/multiarch/init-arch.h b/sysdeps/aarch64/multiarch/init-arch.h
index a4dcac0019..d5219186be 100644
--- a/sysdeps/aarch64/multiarch/init-arch.h
+++ b/sysdeps/aarch64/multiarch/init-arch.h
@@ -35,4 +35,6 @@
   bool __attribute__((unused)) mte =					      \
     MTE_ENABLED ();							      \
   bool __attribute__((unused)) sve =					      \
-    GLRO(dl_aarch64_cpu_features).sve;
+    GLRO(dl_aarch64_cpu_features).sve;					      \
+  bool __attribute__((unused)) morello =				      \
+    GLRO(dl_hwcap2) & HWCAP2_MORELLO;
diff --git a/sysdeps/unix/sysv/linux/aarch64/cpu-features.c b/sysdeps/unix/sysv/linux/aarch64/cpu-features.c
index d14c0f4e1f..3d95815d5f 100644
--- a/sysdeps/unix/sysv/linux/aarch64/cpu-features.c
+++ b/sysdeps/unix/sysv/linux/aarch64/cpu-features.c
@@ -126,4 +126,7 @@ init_cpu_features (struct cpu_features *cpu_features)
 
   /* Check if SVE is supported.  */
   cpu_features->sve = GLRO (dl_hwcap) & HWCAP_SVE;
+
+  /* Check if Morello is supported.  */
+  cpu_features->morello = GLRO (dl_hwcap2) & HWCAP2_MORELLO;
 }
diff --git a/sysdeps/unix/sysv/linux/aarch64/cpu-features.h b/sysdeps/unix/sysv/linux/aarch64/cpu-features.h
index 391165a99c..0742ac1409 100644
--- a/sysdeps/unix/sysv/linux/aarch64/cpu-features.h
+++ b/sysdeps/unix/sysv/linux/aarch64/cpu-features.h
@@ -68,6 +68,11 @@
 #define IS_A64FX(midr) (MIDR_IMPLEMENTOR(midr) == 'F'			      \
 			&& MIDR_PARTNUM(midr) == 0x001)
 
+/* TODO: This is based on the Morello Fast Model.
+	 Will MIDR_IMPLEMENTOR change to 'A'?  */
+#define IS_MORELLO(midr) (MIDR_IMPLEMENTOR(midr) == 0x3f       \
+                         && MIDR_PARTNUM(midr) == 0x412)
+
 struct cpu_features
 {
   uint64_t midr_el1;
@@ -76,6 +81,7 @@ struct cpu_features
   /* Currently, the GLIBC memory tagging tunable only defines 8 bits.  */
   uint8_t mte_state;
   bool sve;
+  bool morello;
 };
 
 #endif /* _CPU_FEATURES_AARCH64_H  */


                 reply	other threads:[~2022-08-05 19:38 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220805193822.9B65638582A3@sourceware.org \
    --to=nsz@sourceware.org \
    --cc=glibc-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).