Commit 5e8911a0 authored by Olivier Deprez's avatar Olivier Deprez Committed by TrustedFirmware Code Review
Browse files

Merge "Aarch64: Add support for FEAT_MTE3" into integration

parents 08886940 0563ab08
...@@ -266,9 +266,17 @@ ...@@ -266,9 +266,17 @@
#define ID_AA64PFR1_EL1_MTE_SHIFT U(8) #define ID_AA64PFR1_EL1_MTE_SHIFT U(8)
#define ID_AA64PFR1_EL1_MTE_MASK ULL(0xf) #define ID_AA64PFR1_EL1_MTE_MASK ULL(0xf)
#define MTE_UNIMPLEMENTED ULL(0) /* Memory Tagging Extension is not implemented */
#define MTE_IMPLEMENTED_EL0 ULL(1) /* MTE is only implemented at EL0 */ #define MTE_UNIMPLEMENTED U(0)
#define MTE_IMPLEMENTED_ELX ULL(2) /* MTE is implemented at all ELs */ /* FEAT_MTE: MTE instructions accessible at EL0 are implemented */
#define MTE_IMPLEMENTED_EL0 U(1)
/* FEAT_MTE2: Full MTE is implemented */
#define MTE_IMPLEMENTED_ELX U(2)
/*
* FEAT_MTE3: MTE is implemented with support for
* asymmetric Tag Check Fault handling
*/
#define MTE_IMPLEMENTED_ASY U(3)
#define ID_AA64PFR1_MPAM_FRAC_SHIFT ULL(16) #define ID_AA64PFR1_MPAM_FRAC_SHIFT ULL(16)
#define ID_AA64PFR1_MPAM_FRAC_MASK ULL(0xf) #define ID_AA64PFR1_MPAM_FRAC_MASK ULL(0xf)
......
...@@ -144,30 +144,33 @@ void cm_setup_context(cpu_context_t *ctx, const entry_point_info_t *ep) ...@@ -144,30 +144,33 @@ void cm_setup_context(cpu_context_t *ctx, const entry_point_info_t *ep)
scr_el3 |= SCR_API_BIT | SCR_APK_BIT; scr_el3 |= SCR_API_BIT | SCR_APK_BIT;
#endif /* !CTX_INCLUDE_PAUTH_REGS */ #endif /* !CTX_INCLUDE_PAUTH_REGS */
#if !CTX_INCLUDE_MTE_REGS || ENABLE_ASSERTIONS
/* Get Memory Tagging Extension support level */
unsigned int mte = get_armv8_5_mte_support();
#endif
/* /*
* Enable MTE support. Support is enabled unilaterally for the normal * Enable MTE support. Support is enabled unilaterally for the normal
* world, and only for the secure world when CTX_INCLUDE_MTE_REGS is * world, and only for the secure world when CTX_INCLUDE_MTE_REGS is
* set. * set.
*/ */
#if CTX_INCLUDE_MTE_REGS #if CTX_INCLUDE_MTE_REGS
assert(get_armv8_5_mte_support() == MTE_IMPLEMENTED_ELX); assert((mte == MTE_IMPLEMENTED_ELX) || (mte == MTE_IMPLEMENTED_ASY));
scr_el3 |= SCR_ATA_BIT; scr_el3 |= SCR_ATA_BIT;
#else #else
unsigned int mte = get_armv8_5_mte_support();
if (mte == MTE_IMPLEMENTED_EL0) {
/* /*
* Can enable MTE across both worlds as no MTE registers are * When MTE is only implemented at EL0, it can be enabled
* used * across both worlds as no MTE registers are used.
*/ */
scr_el3 |= SCR_ATA_BIT; if ((mte == MTE_IMPLEMENTED_EL0) ||
} else if (mte == MTE_IMPLEMENTED_ELX && security_state == NON_SECURE) {
/* /*
* Can only enable MTE in Non-Secure world without register * When MTE is implemented at all ELs, it can be only enabled
* saving * in Non-Secure world without register saving.
*/ */
(((mte == MTE_IMPLEMENTED_ELX) || (mte == MTE_IMPLEMENTED_ASY)) &&
(security_state == NON_SECURE))) {
scr_el3 |= SCR_ATA_BIT; scr_el3 |= SCR_ATA_BIT;
} }
#endif #endif /* CTX_INCLUDE_MTE_REGS */
#ifdef IMAGE_BL31 #ifdef IMAGE_BL31
/* /*
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment