Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 1 | /* |
Ambroise Vincent | fae7772 | 2019-03-07 10:17:15 +0000 | [diff] [blame] | 2 | * Copyright (c) 2018-2019, Arm Limited. All rights reserved. |
Varun Wadekar | 8900d8c | 2020-07-10 15:45:39 -0700 | [diff] [blame] | 3 | * Copyright (c) 2020, NVIDIA Corporation. All rights reserved. |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 4 | * |
| 5 | * SPDX-License-Identifier: BSD-3-Clause |
| 6 | */ |
| 7 | |
| 8 | #include <arch_helpers.h> |
| 9 | |
| 10 | void tftf_arch_setup(void) |
| 11 | { |
| 12 | /* Do not try to configure EL2 if TFTF is running at NS-EL1 */ |
| 13 | if (IS_IN_EL2()) { |
Varun Wadekar | 8900d8c | 2020-07-10 15:45:39 -0700 | [diff] [blame] | 14 | /* Enable asynchronous SError aborts to EL2 */ |
| 15 | enable_serror(); |
| 16 | |
Sandrine Bailleux | dddec6b | 2018-12-18 15:45:01 +0100 | [diff] [blame] | 17 | /* |
| 18 | * Route physical interrupts to EL2 regardless of the value of |
| 19 | * the IMO/FMO bits. Without this, interrupts would not be taken |
| 20 | * and would remain pending, regardless of the PSTATE.{A, I, F} |
| 21 | * interrupt masks. |
| 22 | */ |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 23 | write_hcr_el2(HCR_TGE_BIT); |
Ambroise Vincent | fae7772 | 2019-03-07 10:17:15 +0000 | [diff] [blame] | 24 | |
| 25 | /* |
| 26 | * Disable trap of SVE instructions to EL2. |
| 27 | * The fields of the CPTR_EL2 register reset to an |
| 28 | * architecturally UNKNOWN value. |
| 29 | */ |
| 30 | write_cptr_el2(CPTR_EL2_RES1); |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 31 | isb(); |
| 32 | } |
| 33 | } |