aboutsummaryrefslogtreecommitdiff
path: root/tftf/tests/extensions/fgt/test_fgt.c
blob: 6213d4bf5079abe3e3785c513adab1c79651557c (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
30
31
32
/*
 * Copyright (c) 2020, Arm Limited. All rights reserved.
 *
 * SPDX-License-Identifier: BSD-3-Clause
 */

#include <test_helpers.h>
#include <tftf_lib.h>
#include <tftf.h>
#include <string.h>
#include <arch_helpers.h>

/*
 * TF-A is expected to allow access to ARMv8.6-FGT system registers from EL2.
 * Reading these registers causes a trap to EL3 and crash when TF-A has not
 * allowed access.
 */
test_result_t test_fgt_enabled(void)
{
	SKIP_TEST_IF_AARCH32();

#ifdef __aarch64__
	SKIP_TEST_IF_FGT_NOT_SUPPORTED();
	read_hfgrtr_el2();
	read_hfgwtr_el2();
	read_hfgitr_el2();
	read_hdfgrtr_el2();
	read_hdfgwtr_el2();

	return TEST_RESULT_SUCCESS;
#endif	/* __aarch64__ */
}