[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v5 30/31] target/arm: Enable MTE for user-only
From: |
Richard Henderson |
Subject: |
[PATCH v5 30/31] target/arm: Enable MTE for user-only |
Date: |
Wed, 3 Feb 2021 09:00:09 -1000 |
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
target/arm/cpu.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/target/arm/cpu.c b/target/arm/cpu.c
index db81a12418..43933550c3 100644
--- a/target/arm/cpu.c
+++ b/target/arm/cpu.c
@@ -204,6 +204,21 @@ static void arm_cpu_reset(DeviceState *dev)
* Note that this must match useronly_clean_ptr.
*/
env->cp15.tcr_el[1].raw_tcr = (1ULL << 37);
+
+ /* Enable MTE */
+ if (cpu_isar_feature(aa64_mte, cpu)) {
+ /* Enable tag access, but leave TCF0 as No Effect (0). */
+ env->cp15.sctlr_el[1] |= SCTLR_ATA0;
+ /*
+ * Exclude all tags, so that tag 0 is always used.
+ * This corresponds to Linux current->thread.gcr_incl = 0.
+ *
+ * Set RRND, so that helper_irg() will generate a seed later.
+ * Here in cpu_reset(), the crypto subsystem has not yet been
+ * initialized.
+ */
+ env->cp15.gcr_el1 = 0x1ffff;
+ }
#else
/* Reset into the highest available EL */
if (arm_feature(env, ARM_FEATURE_EL3)) {
--
2.25.1
- Re: [PATCH v5 19/31] linux-user: Handle tags in lock_user/unlock_user, (continued)
- [PATCH v5 20/31] linux-user/aarch64: Implement PR_TAGGED_ADDR_ENABLE, Richard Henderson, 2021/02/03
- [PATCH v5 22/31] target/arm: Use the proper TBI settings for linux-user, Richard Henderson, 2021/02/03
- [PATCH v5 21/31] target/arm: Improve gen_top_byte_ignore, Richard Henderson, 2021/02/03
- [PATCH v5 26/31] linux-user/aarch64: Pass syndrome to EXC_*_ABORT, Richard Henderson, 2021/02/03
- [PATCH v5 23/31] linux-user/aarch64: Implement PR_MTE_TCF and PR_MTE_TAG, Richard Henderson, 2021/02/03
- [PATCH v5 25/31] target/arm: Split out syndrome.h from internals.h, Richard Henderson, 2021/02/03
- [PATCH v5 24/31] linux-user/aarch64: Implement PROT_MTE, Richard Henderson, 2021/02/03
- [PATCH v5 29/31] target/arm: Add allocation tag storage for user mode, Richard Henderson, 2021/02/03
- [PATCH v5 30/31] target/arm: Enable MTE for user-only,
Richard Henderson <=
- [PATCH v5 31/31] tests/tcg/aarch64: Add mte smoke tests, Richard Henderson, 2021/02/03
- Re: [PATCH v5 00/31] target-arm: Implement ARMv8.5-MemTag, user mode, no-reply, 2021/02/03