Jimmy Brisson | 90f1d5c | 2020-04-16 10:54:51 -0500 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2020, Arm Limited. All rights reserved. |
| 3 | * |
| 4 | * SPDX-License-Identifier: BSD-3-Clause |
| 5 | */ |
| 6 | |
| 7 | #include <test_helpers.h> |
| 8 | #include <tftf_lib.h> |
| 9 | #include <tftf.h> |
| 10 | #include <string.h> |
| 11 | #include <arch_helpers.h> |
| 12 | |
| 13 | /* |
| 14 | * TF-A is expected to allow access to ARMv8.6-FGT system registers from EL2. |
| 15 | * Reading these registers causes a trap to EL3 and crash when TF-A has not |
| 16 | * allowed access. |
| 17 | */ |
| 18 | test_result_t test_fgt_enabled(void) |
| 19 | { |
| 20 | SKIP_TEST_IF_AARCH32(); |
| 21 | |
| 22 | #ifdef __aarch64__ |
| 23 | SKIP_TEST_IF_FGT_NOT_SUPPORTED(); |
| 24 | read_hfgrtr_el2(); |
| 25 | read_hfgwtr_el2(); |
| 26 | read_hfgitr_el2(); |
| 27 | read_hdfgrtr_el2(); |
| 28 | read_hdfgwtr_el2(); |
| 29 | |
| 30 | return TEST_RESULT_SUCCESS; |
| 31 | #endif /* __aarch64__ */ |
| 32 | } |