mirror of
https://github.com/ARM-software/arm-trusted-firmware.git
synced 2025-04-08 05:43:53 +00:00
feat(mte): adds feature detection for MTE_PERM
Adds feature detection for v8.9 feature FEAT_MTE_PERM. Adds respective ID_AA64PFR2_EL1 definitions and ENABLE_FEAT_MTE_PERM define. Change-Id: If24b42f1207154e639016b0b840b2d91c6ee13d4 Signed-off-by: Maksims Svecovs <maksims.svecovs@arm.com> Signed-off-by: Harrison Mutai <harrison.mutai@arm.com>
This commit is contained in:
parent
d1b5ada888
commit
4d0b66323b
8 changed files with 48 additions and 1 deletions
2
Makefile
2
Makefile
|
@ -1245,6 +1245,7 @@ $(eval $(call assert_numerics,\
|
|||
ENABLE_FEAT_S1POE \
|
||||
ENABLE_FEAT_GCS \
|
||||
ENABLE_FEAT_VHE \
|
||||
ENABLE_FEAT_MTE_PERM \
|
||||
ENABLE_MPAM_FOR_LOWER_ELS \
|
||||
ENABLE_RME \
|
||||
ENABLE_SPE_FOR_NS \
|
||||
|
@ -1389,6 +1390,7 @@ $(eval $(call add_defines,\
|
|||
ENABLE_FEAT_S2POE \
|
||||
ENABLE_FEAT_S1POE \
|
||||
ENABLE_FEAT_GCS \
|
||||
ENABLE_FEAT_MTE_PERM \
|
||||
FEATURE_DETECTION \
|
||||
TWED_DELAY \
|
||||
ENABLE_FEAT_TWED \
|
||||
|
|
|
@ -213,6 +213,8 @@ void detect_arch_features(void)
|
|||
"S2POE", 1, 1);
|
||||
check_feature(ENABLE_FEAT_S1POE, read_feat_s1poe_id_field(),
|
||||
"S1POE", 1, 1);
|
||||
check_feature(ENABLE_FEAT_MTE_PERM, read_feat_mte_perm_id_field(),
|
||||
"MTE_PERM", 1, 1);
|
||||
|
||||
/* v9.0 features */
|
||||
check_feature(ENABLE_BRBE_FOR_NS, read_feat_brbe_id_field(),
|
||||
|
|
|
@ -308,6 +308,13 @@ Common build options
|
|||
flag can take the values 0 to 2, to align with the ``FEATURE_DETECTION``
|
||||
mechanism. Default value is ``0``.
|
||||
|
||||
- ``ENABLE_FEAT_MTE_PERM``: Numeric value to enable support for
|
||||
``FEAT_MTE_PERM``, which introduces Allocation tag access permission to
|
||||
memory region attributes. ``FEAT_MTE_PERM`` is a optional architectural
|
||||
feature available from v8.9 and upwards. This flag can take the values 0 to
|
||||
2, to align with the ``FEATURE_DETECTION`` mechanism. Default value is
|
||||
``0``.
|
||||
|
||||
- ``ENABLE_FEAT_PAN``: Numeric value to enable the ``FEAT_PAN`` (Privileged
|
||||
Access Never) extension. ``FEAT_PAN`` adds a bit to PSTATE, generating a
|
||||
permission fault for any privileged data access from EL1/EL2 to virtual
|
||||
|
|
|
@ -275,6 +275,9 @@
|
|||
/* ID_AA64ISAR2_EL1 definitions */
|
||||
#define ID_AA64ISAR2_EL1 S3_0_C0_C6_2
|
||||
|
||||
/* ID_AA64PFR2_EL1 definitions */
|
||||
#define ID_AA64PFR2_EL1 S3_0_C0_C4_2
|
||||
|
||||
#define ID_AA64ISAR2_GPA3_SHIFT U(8)
|
||||
#define ID_AA64ISAR2_GPA3_MASK ULL(0xf)
|
||||
|
||||
|
@ -402,6 +405,16 @@
|
|||
#define ID_AA64PFR1_EL1_RNG_TRAP_SUPPORTED ULL(0x1)
|
||||
#define ID_AA64PFR1_EL1_RNG_TRAP_NOT_SUPPORTED ULL(0x0)
|
||||
|
||||
/* ID_AA64PFR2_EL1 definitions */
|
||||
#define ID_AA64PFR2_EL1_MTEPERM_SHIFT U(0)
|
||||
#define ID_AA64PFR2_EL1_MTEPERM_MASK ULL(0xf)
|
||||
|
||||
#define ID_AA64PFR2_EL1_MTESTOREONLY_SHIFT U(4)
|
||||
#define ID_AA64PFR2_EL1_MTESTOREONLY_MASK ULL(0xf)
|
||||
|
||||
#define ID_AA64PFR2_EL1_MTEFAR_SHIFT U(8)
|
||||
#define ID_AA64PFR2_EL1_MTEFAR_MASK ULL(0xf)
|
||||
|
||||
#define VDISR_EL2 S3_4_C12_C1_1
|
||||
#define VSESR_EL2 S3_4_C5_C2_3
|
||||
|
||||
|
|
|
@ -148,6 +148,11 @@ static unsigned int read_feat_fgt_id_field(void)
|
|||
return ISOLATE_FIELD(read_id_aa64mmfr0_el1(), ID_AA64MMFR0_EL1_FGT);
|
||||
}
|
||||
|
||||
static unsigned int read_feat_mte_perm_id_field(void)
|
||||
{
|
||||
return ISOLATE_FIELD(read_id_aa64pfr2_el1(), ID_AA64PFR2_EL1_MTEPERM);
|
||||
}
|
||||
|
||||
static inline bool is_feat_fgt_supported(void)
|
||||
{
|
||||
if (ENABLE_FEAT_FGT == FEAT_STATE_DISABLED) {
|
||||
|
@ -161,6 +166,19 @@ static inline bool is_feat_fgt_supported(void)
|
|||
return read_feat_fgt_id_field() != 0U;
|
||||
}
|
||||
|
||||
static inline bool is_feat_mte_perm_supported(void)
|
||||
{
|
||||
if (ENABLE_FEAT_MTE_PERM == FEAT_STATE_DISABLED) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (ENABLE_FEAT_MTE_PERM == FEAT_STATE_ALWAYS) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return read_feat_mte_perm_id_field() != 0U;
|
||||
}
|
||||
|
||||
static unsigned int read_feat_ecv_id_field(void)
|
||||
{
|
||||
return ISOLATE_FIELD(read_id_aa64mmfr0_el1(), ID_AA64MMFR0_EL1_ECV);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2013-2022, Arm Limited and Contributors. All rights reserved.
|
||||
* Copyright (c) 2013-2023, Arm Limited and Contributors. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
@ -269,6 +269,7 @@ DEFINE_IDREG_READ_FUNC(id_aa64isar1_el1)
|
|||
DEFINE_RENAME_IDREG_READ_FUNC(id_aa64isar2_el1, ID_AA64ISAR2_EL1)
|
||||
DEFINE_IDREG_READ_FUNC(id_aa64pfr0_el1)
|
||||
DEFINE_IDREG_READ_FUNC(id_aa64pfr1_el1)
|
||||
DEFINE_RENAME_IDREG_READ_FUNC(id_aa64pfr2_el1, ID_AA64PFR2_EL1)
|
||||
DEFINE_IDREG_READ_FUNC(id_aa64dfr0_el1)
|
||||
DEFINE_IDREG_READ_FUNC(id_afr0_el1)
|
||||
DEFINE_SYSREG_READ_FUNC(CurrentEl)
|
||||
|
|
|
@ -191,6 +191,9 @@ ENABLE_FEAT_S1POE := 0
|
|||
# Flag to enable access to Guarded Control Stack (FEAT_GCS)
|
||||
ENABLE_FEAT_GCS := 0
|
||||
|
||||
# Flag to enable NoTagAccess memory region attribute for stage 2 of translation.
|
||||
ENABLE_FEAT_MTE_PERM := 0
|
||||
|
||||
# By default BL31 encryption disabled
|
||||
ENCRYPT_BL31 := 0
|
||||
|
||||
|
|
|
@ -80,6 +80,7 @@ ENABLE_SYS_REG_TRACE_FOR_NS := 2
|
|||
ENABLE_FEAT_CSV2_2 := 2
|
||||
ENABLE_FEAT_DIT := 2
|
||||
ENABLE_FEAT_PAN := 2
|
||||
ENABLE_FEAT_MTE_PERM := 2
|
||||
ENABLE_FEAT_VHE := 2
|
||||
CTX_INCLUDE_NEVE_REGS := 2
|
||||
ENABLE_FEAT_SEL2 := 2
|
||||
|
|
Loading…
Add table
Reference in a new issue