]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
arm64/hwcap: Add hwcap for GCS
authorMark Brown <broonie@kernel.org>
Tue, 1 Oct 2024 22:58:57 +0000 (23:58 +0100)
committerCatalin Marinas <catalin.marinas@arm.com>
Fri, 4 Oct 2024 11:04:37 +0000 (12:04 +0100)
Provide a hwcap to enable userspace to detect support for GCS.

Signed-off-by: Mark Brown <broonie@kernel.org>
Acked-by: Yury Khrustalev <yury.khrustalev@arm.com>
Link: https://lore.kernel.org/r/20241001-arm64-gcs-v13-18-222b78d87eee@kernel.org
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Documentation/arch/arm64/elf_hwcaps.rst
arch/arm64/include/asm/hwcap.h
arch/arm64/include/uapi/asm/hwcap.h
arch/arm64/kernel/cpufeature.c
arch/arm64/kernel/cpuinfo.c

index 694f67fa07d196816b1292e896ebe6a1b599c125..25b41ff74fa0dc3b7e780558a65c28ac11733e2d 100644 (file)
@@ -170,6 +170,10 @@ HWCAP_PACG
     ID_AA64ISAR1_EL1.GPI == 0b0001, as described by
     Documentation/arch/arm64/pointer-authentication.rst.
 
+HWCAP_GCS
+    Functionality implied by ID_AA64PFR1_EL1.GCS == 0b1, as
+    described by Documentation/arch/arm64/gcs.rst.
+
 HWCAP2_DCPODP
     Functionality implied by ID_AA64ISAR1_EL1.DPB == 0b0010.
 
index a775adddecf25633e87d58fb9ac9e6293beac1b3..7bcf1347ca0b5161109839f92579265c5641d6c0 100644 (file)
@@ -92,6 +92,7 @@
 #define KERNEL_HWCAP_SB                        __khwcap_feature(SB)
 #define KERNEL_HWCAP_PACA              __khwcap_feature(PACA)
 #define KERNEL_HWCAP_PACG              __khwcap_feature(PACG)
+#define KERNEL_HWCAP_GCS               __khwcap_feature(GCS)
 
 #define __khwcap2_feature(x)           (const_ilog2(HWCAP2_ ## x) + 64)
 #define KERNEL_HWCAP_DCPODP            __khwcap2_feature(DCPODP)
index 055381b2c61595361c2d57d38be936c2dfeaa195..675642ec4d9171e35b6be7ce26f582fcf0a15781 100644 (file)
@@ -21,7 +21,7 @@
  * HWCAP flags - for AT_HWCAP
  *
  * Bits 62 and 63 are reserved for use by libc.
- * Bits 32-61 are unallocated for potential use by libc.
+ * Bits 33-61 are unallocated for potential use by libc.
  */
 #define HWCAP_FP               (1 << 0)
 #define HWCAP_ASIMD            (1 << 1)
@@ -55,6 +55,7 @@
 #define HWCAP_SB               (1 << 29)
 #define HWCAP_PACA             (1 << 30)
 #define HWCAP_PACG             (1UL << 31)
+#define HWCAP_GCS              (1UL << 32)
 
 /*
  * HWCAP2 flags - for AT_HWCAP2
index d1e758e99e0a70e120ed5b53f862b15fac66da44..b8655d55f318003f1e2aa81e6a830aeea1ad7b93 100644 (file)
@@ -3025,6 +3025,9 @@ static const struct arm64_cpu_capabilities arm64_elf_hwcaps[] = {
        HWCAP_CAP(ID_AA64ZFR0_EL1, I8MM, IMP, CAP_HWCAP, KERNEL_HWCAP_SVEI8MM),
        HWCAP_CAP(ID_AA64ZFR0_EL1, F32MM, IMP, CAP_HWCAP, KERNEL_HWCAP_SVEF32MM),
        HWCAP_CAP(ID_AA64ZFR0_EL1, F64MM, IMP, CAP_HWCAP, KERNEL_HWCAP_SVEF64MM),
+#endif
+#ifdef CONFIG_ARM64_GCS
+       HWCAP_CAP(ID_AA64PFR1_EL1, GCS, IMP, CAP_HWCAP, KERNEL_HWCAP_GCS),
 #endif
        HWCAP_CAP(ID_AA64PFR1_EL1, SSBS, SSBS2, CAP_HWCAP, KERNEL_HWCAP_SSBS),
 #ifdef CONFIG_ARM64_BTI
index 44718d0482b3b43175a1673ccbebc70cf16ddcb2..f2f92c6b1c850fa28145e6828d7fd42936482c1a 100644 (file)
@@ -80,6 +80,7 @@ static const char *const hwcap_str[] = {
        [KERNEL_HWCAP_SB]               = "sb",
        [KERNEL_HWCAP_PACA]             = "paca",
        [KERNEL_HWCAP_PACG]             = "pacg",
+       [KERNEL_HWCAP_GCS]              = "gcs",
        [KERNEL_HWCAP_DCPODP]           = "dcpodp",
        [KERNEL_HWCAP_SVE2]             = "sve2",
        [KERNEL_HWCAP_SVEAES]           = "sveaes",