This is an automated email from the ASF dual-hosted git repository.

xiaoxiang781216 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git


The following commit(s) were added to refs/heads/master by this push:
     new fdc7711b752 armv8-m: report concrete CPU model in cpuinfo
fdc7711b752 is described below

commit fdc7711b752d63c10c77542cdef11efb7e54c9ab
Author: chao an <[email protected]>
AuthorDate: Tue Oct 20 15:07:35 2026 +0800

    armv8-m: report concrete CPU model in cpuinfo
    
    The ARMv8-M cpuinfo output always used the generic ARMv8-M model string even
    when the selected architecture was a concrete Cortex-M CPU.  This makes
    Cortex-M85 targets appear less specific than the build configuration already
    knows them to be.
    
    Add compile-time model strings for the supported ARMv8-M Cortex-M variants 
and
    report Cortex-M55/Cortex-M85 as ARMv8.1-M cores.  Also advertise PACBTI in 
the
    feature list when CONFIG_ARM_PACBTI is enabled so /proc/cpuinfo reflects the
    selected branch protection capability.
    
    Signed-off-by: chao an <[email protected]>
---
 arch/arm/src/armv8-m/arm_cpuinfo.c | 37 ++++++++++++++++++++++++++++++++++++-
 arch/arm/src/common/hwcap.h        |  1 +
 2 files changed, 37 insertions(+), 1 deletion(-)

diff --git a/arch/arm/src/armv8-m/arm_cpuinfo.c 
b/arch/arm/src/armv8-m/arm_cpuinfo.c
index 19183d4b687..7dd9659cec7 100644
--- a/arch/arm/src/armv8-m/arm_cpuinfo.c
+++ b/arch/arm/src/armv8-m/arm_cpuinfo.c
@@ -34,6 +34,36 @@
 
 #if defined(CONFIG_FS_PROCFS) && !defined(CONFIG_FS_PROCFS_EXCLUDE_CPUINFO)
 
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+#if defined(CONFIG_ARCH_CORTEXM23)
+#  define ARMV8M_CPU_MODEL "ARM Cortex-M23"
+#  define ARMV8M_CPU_REV   "v8mb"
+#  define ARMV8M_CPU_ARCH  "8M"
+#elif defined(CONFIG_ARCH_CORTEXM33)
+#  define ARMV8M_CPU_MODEL "ARM Cortex-M33"
+#  define ARMV8M_CPU_REV   "v8ml"
+#  define ARMV8M_CPU_ARCH  "8M"
+#elif defined(CONFIG_ARCH_CORTEXM35P)
+#  define ARMV8M_CPU_MODEL "ARM Cortex-M35P"
+#  define ARMV8M_CPU_REV   "v8ml"
+#  define ARMV8M_CPU_ARCH  "8M"
+#elif defined(CONFIG_ARCH_CORTEXM55)
+#  define ARMV8M_CPU_MODEL "ARM Cortex-M55"
+#  define ARMV8M_CPU_REV   "v8.1m"
+#  define ARMV8M_CPU_ARCH  "8.1M"
+#elif defined(CONFIG_ARCH_CORTEXM85)
+#  define ARMV8M_CPU_MODEL "ARM Cortex-M85"
+#  define ARMV8M_CPU_REV   "v8.1m"
+#  define ARMV8M_CPU_ARCH  "8.1M"
+#else
+#  define ARMV8M_CPU_MODEL "ARMv8-M"
+#  define ARMV8M_CPU_REV   "v8ml"
+#  define ARMV8M_CPU_ARCH  "8M"
+#endif
+
 /****************************************************************************
  * Private Functions
  ****************************************************************************/
@@ -116,6 +146,10 @@ ssize_t up_show_cpuinfo(char *buf, size_t buf_size, off_t 
file_off)
       procfs_sprintf(buf, buf_size, &file_off, " %s", HWCAP_MVE);
 # endif
 
+# if defined(CONFIG_ARM_PACBTI)
+      procfs_sprintf(buf, buf_size, &file_off, " %s", HWCAP_PACBTI);
+# endif
+
       if (hwcap_extract_field(getreg32(NVIC_MVFR1), 20) == 1)
         {
           procfs_sprintf(buf, buf_size, &file_off, " %s", HWCAP_FPHP);
@@ -128,7 +162,8 @@ ssize_t up_show_cpuinfo(char *buf, size_t buf_size, off_t 
file_off)
       procfs_sprintf(buf, buf_size, &file_off,
                      "\nmodel name\t: %s rev %" PRIx32 " (%s)\n"
                      "CPU architecture: %s\n",
-                     "ARMv8-M", cpuid & 15, "v8ml", "8M");
+                     ARMV8M_CPU_MODEL, cpuid & 15, ARMV8M_CPU_REV,
+                     ARMV8M_CPU_ARCH);
 
       procfs_sprintf(buf, buf_size, &file_off,
                      "CPU implementer\t: 0x%02" PRIx32 "\n"
diff --git a/arch/arm/src/common/hwcap.h b/arch/arm/src/common/hwcap.h
index be032a10dbf..dad605e343f 100644
--- a/arch/arm/src/common/hwcap.h
+++ b/arch/arm/src/common/hwcap.h
@@ -60,6 +60,7 @@
 #define HWCAP_FPDP      "fpdp"      /* Double-precision instructions support */
 #define HWCAP_FPV5      "fpv5"      /* Floating-point extension version */
 #define HWCAP_MVE       "mve"       /* M-profile vector extension */
+#define HWCAP_PACBTI    "pacbti"    /* Pointer authentication and BTI */
 
 /* Hardware capabilities added form armv8 */
 

Reply via email to