From 688ab57b9349adb19277d88f2469ceeadb8ba083 Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Tue, 14 Mar 2023 21:33:04 +0000 Subject: feat(gcs): support guarded control stack Arm v9.4 introduces support for Guarded Control Stack, providing mitigations against some forms of RPO attacks and an efficient mechanism for obtaining the current call stack without requiring a full stack unwind. Enable access to this feature for EL2 and below, context switching the newly added EL2 registers as appropriate. Change the FVP platform to default to handling this as a dynamic option so the right decision can be made by the code at runtime. Signed-off-by: Mark Brown Change-Id: I691aa7c22e3547bb3abe98d96993baf18c5f0e7b --- include/arch/aarch64/arch.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'include/arch/aarch64/arch.h') diff --git a/include/arch/aarch64/arch.h b/include/arch/aarch64/arch.h index 89f4b40bd..9e061bfb4 100644 --- a/include/arch/aarch64/arch.h +++ b/include/arch/aarch64/arch.h @@ -371,6 +371,9 @@ #define ID_AA64MMFR3_EL1_TCRX_MASK ULL(0xf) /* ID_AA64PFR1_EL1 definitions */ +#define ID_AA64PFR1_EL1_GCS_SHIFT U(44) +#define ID_AA64PFR1_EL1_GCS_MASK ULL(0xf) + #define ID_AA64PFR1_EL1_SSBS_SHIFT U(4) #define ID_AA64PFR1_EL1_SSBS_MASK ULL(0xf) @@ -527,6 +530,7 @@ #define SCR_PIEN_BIT (UL(1) << 45) #define SCR_TCR2EN_BIT (UL(1) << 43) #define SCR_TRNDR_BIT (UL(1) << 40) +#define SCR_GCSEn_BIT (UL(1) << 39) #define SCR_HXEn_BIT (UL(1) << 38) #define SCR_ENTP2_SHIFT U(41) #define SCR_ENTP2_BIT (UL(1) << SCR_ENTP2_SHIFT) @@ -1350,6 +1354,12 @@ #define POR_EL2 S3_4_C10_C2_4 #define S2PIR_EL2 S3_4_C10_C2_5 +/******************************************************************************* + * FEAT_GCS - Guarded Control Stack Registers + ******************************************************************************/ +#define GCSCR_EL2 S3_4_C2_C5_0 +#define GCSPR_EL2 S3_4_C2_C5_1 + /******************************************************************************* * Definitions for DynamicIQ Shared Unit registers ******************************************************************************/ -- cgit v1.2.1