blob: ebc6e818351c9eeaad01b59a302d91bc3df6f04a [file] [log] [blame]
johpow01161f9a32021-11-11 16:13:32 -06001/*
2 * Copyright (c) 2021, Arm Limited. All rights reserved.
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
7#include <tftf_lib.h>
8#include <tftf.h>
9#include <arch_helpers.h>
10#include <arch_features.h>
11
12/* This very simple test just ensures that HCRX_EL2 access does not trap. */
13test_result_t test_feat_hcx_enabled(void)
14{
15#ifdef __aarch64__
16 /* Make sure FEAT_HCX is supported. */
17 if (!get_feat_hcx_support()) {
18 return TEST_RESULT_SKIPPED;
19 }
20
21 /* Attempt to read HCRX_EL2, if not enabled this should trap to EL3. */
22 read_hcrx_el2();
23
24 /* If we make it this far, the test was successful. */
25 return TEST_RESULT_SUCCESS;
26#else
27 /* Skip test if AArch32 */
28 return TEST_RESULT_SKIPPED;
29#endif
30}