Skip to content

Commit eefc987

Browse files
brooniectmarinas
authored andcommitted
arm64/hwcap: Add hwcap for GCS
Provide a hwcap to enable userspace to detect support for GCS. Signed-off-by: Mark Brown <[email protected]> Acked-by: Yury Khrustalev <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Catalin Marinas <[email protected]>
1 parent a944521 commit eefc987

File tree

5 files changed

+11
-1
lines changed

5 files changed

+11
-1
lines changed

Documentation/arch/arm64/elf_hwcaps.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,10 @@ HWCAP_PACG
170170
ID_AA64ISAR1_EL1.GPI == 0b0001, as described by
171171
Documentation/arch/arm64/pointer-authentication.rst.
172172

173+
HWCAP_GCS
174+
Functionality implied by ID_AA64PFR1_EL1.GCS == 0b1, as
175+
described by Documentation/arch/arm64/gcs.rst.
176+
173177
HWCAP2_DCPODP
174178
Functionality implied by ID_AA64ISAR1_EL1.DPB == 0b0010.
175179

arch/arm64/include/asm/hwcap.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@
9292
#define KERNEL_HWCAP_SB __khwcap_feature(SB)
9393
#define KERNEL_HWCAP_PACA __khwcap_feature(PACA)
9494
#define KERNEL_HWCAP_PACG __khwcap_feature(PACG)
95+
#define KERNEL_HWCAP_GCS __khwcap_feature(GCS)
9596

9697
#define __khwcap2_feature(x) (const_ilog2(HWCAP2_ ## x) + 64)
9798
#define KERNEL_HWCAP_DCPODP __khwcap2_feature(DCPODP)

arch/arm64/include/uapi/asm/hwcap.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
* HWCAP flags - for AT_HWCAP
2222
*
2323
* Bits 62 and 63 are reserved for use by libc.
24-
* Bits 32-61 are unallocated for potential use by libc.
24+
* Bits 33-61 are unallocated for potential use by libc.
2525
*/
2626
#define HWCAP_FP (1 << 0)
2727
#define HWCAP_ASIMD (1 << 1)
@@ -55,6 +55,7 @@
5555
#define HWCAP_SB (1 << 29)
5656
#define HWCAP_PACA (1 << 30)
5757
#define HWCAP_PACG (1UL << 31)
58+
#define HWCAP_GCS (1UL << 32)
5859

5960
/*
6061
* HWCAP2 flags - for AT_HWCAP2

arch/arm64/kernel/cpufeature.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3025,6 +3025,9 @@ static const struct arm64_cpu_capabilities arm64_elf_hwcaps[] = {
30253025
HWCAP_CAP(ID_AA64ZFR0_EL1, I8MM, IMP, CAP_HWCAP, KERNEL_HWCAP_SVEI8MM),
30263026
HWCAP_CAP(ID_AA64ZFR0_EL1, F32MM, IMP, CAP_HWCAP, KERNEL_HWCAP_SVEF32MM),
30273027
HWCAP_CAP(ID_AA64ZFR0_EL1, F64MM, IMP, CAP_HWCAP, KERNEL_HWCAP_SVEF64MM),
3028+
#endif
3029+
#ifdef CONFIG_ARM64_GCS
3030+
HWCAP_CAP(ID_AA64PFR1_EL1, GCS, IMP, CAP_HWCAP, KERNEL_HWCAP_GCS),
30283031
#endif
30293032
HWCAP_CAP(ID_AA64PFR1_EL1, SSBS, SSBS2, CAP_HWCAP, KERNEL_HWCAP_SSBS),
30303033
#ifdef CONFIG_ARM64_BTI

arch/arm64/kernel/cpuinfo.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ static const char *const hwcap_str[] = {
8080
[KERNEL_HWCAP_SB] = "sb",
8181
[KERNEL_HWCAP_PACA] = "paca",
8282
[KERNEL_HWCAP_PACG] = "pacg",
83+
[KERNEL_HWCAP_GCS] = "gcs",
8384
[KERNEL_HWCAP_DCPODP] = "dcpodp",
8485
[KERNEL_HWCAP_SVE2] = "sve2",
8586
[KERNEL_HWCAP_SVEAES] = "sveaes",

0 commit comments

Comments
 (0)