aboutsummaryrefslogtreecommitdiff
path: root/tftf/framework/aarch64/arch.c
blob: c3f57b8c9096d20094b2ba880a9d24c184c4e8f3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/*
 * Copyright (c) 2018-2019, Arm Limited. All rights reserved.
 *
 * SPDX-License-Identifier: BSD-3-Clause
 */

#include <arch_helpers.h>

void tftf_arch_setup(void)
{
	/* Do not try to configure EL2 if TFTF is running at NS-EL1 */
	if (IS_IN_EL2()) {
		/*
		 * Route physical interrupts to EL2 regardless of the value of
		 * the IMO/FMO bits. Without this, interrupts would not be taken
		 * and would remain pending, regardless of the PSTATE.{A, I, F}
		 * interrupt masks.
		 */
		write_hcr_el2(HCR_TGE_BIT);

		/*
		 * Disable trap of SVE instructions to EL2.
		 * The fields of the CPTR_EL2 register reset to an
		 * architecturally UNKNOWN value.
		 */
		write_cptr_el2(CPTR_EL2_RES1);
		isb();
	}
}