From be58c81aff4cd4c0ccf43dbd7998da4a6a08c03b Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 21 Apr 2024 19:43:51 +0200 Subject: Adding upstream version 2.10.0+dfsg. Signed-off-by: Daniel Baumann --- lib/extensions/trf/aarch64/trf.c | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 lib/extensions/trf/aarch64/trf.c (limited to 'lib/extensions/trf/aarch64/trf.c') diff --git a/lib/extensions/trf/aarch64/trf.c b/lib/extensions/trf/aarch64/trf.c new file mode 100644 index 0000000..83fbf85 --- /dev/null +++ b/lib/extensions/trf/aarch64/trf.c @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2021-2023, Arm Limited. All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#include +#include +#include +#include + +void trf_init_el3(void) +{ + u_register_t val; + + /* + * MDCR_EL3.STE = b0 + * Trace prohibited in Secure state unless overridden by the + * IMPLEMENTATION DEFINED authentication interface. + * + * MDCR_EL3.TTRF = b0 + * Allow access of trace filter control registers from NS-EL2 + * and NS-EL1 when NS-EL2 is implemented but not used + */ + val = read_mdcr_el3(); + val &= ~(MDCR_STE_BIT | MDCR_TTRF_BIT); + write_mdcr_el3(val); +} + +void trf_init_el2_unused(void) +{ + /* + * MDCR_EL2.TTRF: Set to zero so that access to Trace + * Filter Control register TRFCR_EL1 at EL1 is not + * trapped to EL2. This bit is RES0 in versions of + * the architecture earlier than ARMv8.4. + * + */ + write_mdcr_el2(read_mdcr_el2() & ~MDCR_EL2_TTRF); +} -- cgit v1.2.3