feat(idte3): add support to detect and test FEAT_IDTE3
Add new defines for ID_AA64MMFR2_EL1.IDS and SCR_EL3.TID3/TID5
to support FEAT_IDTE3 detection. A helper function is added to
check for this feature, and the SMCCC feature availability test
is updated to verify IDTE3 presence.
Change-Id: Ib9471a838381439214a61feeed96796e406a9cb7
Signed-off-by: Arvind Ram Prakash <arvind.ramprakash@arm.com>
diff --git a/include/lib/aarch64/arch.h b/include/lib/aarch64/arch.h
index 88d1f6b..0714bf5 100644
--- a/include/lib/aarch64/arch.h
+++ b/include/lib/aarch64/arch.h
@@ -493,6 +493,10 @@
/* ID_AA64MMFR2_EL1 definitions */
#define ID_AA64MMFR2_EL1 S3_0_C0_C7_2
+#define ID_AA64MMFR2_EL1_IDS_SHIFT U(36)
+#define ID_AA64MMFR2_EL1_IDS_MASK ULL(0xf)
+#define IDTE3_IMPLEMENTED ULL(0x2)
+
#define ID_AA64MMFR2_EL1_ST_SHIFT U(28)
#define ID_AA64MMFR2_EL1_ST_MASK ULL(0xf)
@@ -743,6 +747,9 @@
#define SCR_FGTEN_BIT (UL(1) << 27)
#define SCR_ATA_BIT (UL(1) << 26)
#define SCR_EnSCXT_BIT (UL(1) << 25)
+#define SCR_IDTE3_BITS (SCR_TID5_BIT | SCR_TID3_BIT)
+#define SCR_TID5_BIT (UL(1) << 23)
+#define SCR_TID3_BIT (UL(1) << 22)
#define SCR_FIEN_BIT (UL(1) << 21)
#define SCR_NMEA_BIT (UL(1) << 20)
#define SCR_EASE_BIT (UL(1) << 19)
diff --git a/include/lib/aarch64/arch_features.h b/include/lib/aarch64/arch_features.h
index c8cad18..8ded716 100644
--- a/include/lib/aarch64/arch_features.h
+++ b/include/lib/aarch64/arch_features.h
@@ -156,6 +156,12 @@
ID_AA64MMFR0_EL1_FGT_MASK) != 0U);
}
+static inline bool is_feat_idte3_present(void)
+{
+ return (((read_id_aa64mmfr2_el1() >> ID_AA64MMFR2_EL1_IDS_SHIFT) &
+ ID_AA64MMFR2_EL1_IDS_MASK) == IDTE3_IMPLEMENTED);
+}
+
static inline bool is_armv8_9_fgt2_present(void)
{
return ((read_id_aa64mmfr0_el1() >> ID_AA64MMFR0_EL1_FGT_SHIFT) &
diff --git a/tftf/tests/runtime_services/arm_arch_svc/smccc_feature_availability.c b/tftf/tests/runtime_services/arm_arch_svc/smccc_feature_availability.c
index e3cfa34..ac199fa 100644
--- a/tftf/tests/runtime_services/arm_arch_svc/smccc_feature_availability.c
+++ b/tftf/tests/runtime_services/arm_arch_svc/smccc_feature_availability.c
@@ -94,6 +94,7 @@
CHECK_BIT_SET(is_feat_twed_present, SCR_TWEDEn_BIT);
CHECK_BIT_SET(get_armv8_6_ecv_support, SCR_ECVEN_BIT);
CHECK_BIT_SET(is_armv8_6_fgt_present, SCR_FGTEN_BIT);
+ CHECK_BIT_SET(is_feat_idte3_present, SCR_IDTE3_BITS);
CHECK_BIT_SET(is_feat_mte2_present, SCR_ATA_BIT);
CHECK_BIT_SET(is_feat_csv2_2_present, SCR_EnSCXT_BIT);
CHECK_BIT_SET(is_armv8_3_pauth_present, SCR_APK_BIT);