blob: c3f57b8c9096d20094b2ba880a9d24c184c4e8f3 [file] [log] [blame]
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +02001/*
Ambroise Vincentfae77722019-03-07 10:17:15 +00002 * Copyright (c) 2018-2019, Arm Limited. All rights reserved.
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +02003 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
7#include <arch_helpers.h>
8
9void tftf_arch_setup(void)
10{
11 /* Do not try to configure EL2 if TFTF is running at NS-EL1 */
12 if (IS_IN_EL2()) {
Sandrine Bailleuxdddec6b2018-12-18 15:45:01 +010013 /*
14 * Route physical interrupts to EL2 regardless of the value of
15 * the IMO/FMO bits. Without this, interrupts would not be taken
16 * and would remain pending, regardless of the PSTATE.{A, I, F}
17 * interrupt masks.
18 */
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +020019 write_hcr_el2(HCR_TGE_BIT);
Ambroise Vincentfae77722019-03-07 10:17:15 +000020
21 /*
22 * Disable trap of SVE instructions to EL2.
23 * The fields of the CPTR_EL2 register reset to an
24 * architecturally UNKNOWN value.
25 */
26 write_cptr_el2(CPTR_EL2_RES1);
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +020027 isb();
28 }
29}