feat(hcx): modified test to also check for reset value

Previous test only checked for the presence of FEAT_HCX.
However, as register HCRX_EL2 is initialized in EL3,
the value read from it should be its reset value.

As the test already existed, there is no new CI config.
It can be run by using test group:
tftf-l2-fvp/fvp-hcx-aarch64-only,fvp-hcx:fvp-tftf-fip.tftf-foundationv8

Signed-off-by: Juan Pablo Conde <juanpablo.conde@arm.com>
Change-Id: I7fcd3d868fa4a7b4aee53fe3b141e8da1f670c0a
diff --git a/tftf/tests/extensions/hcx/test_hcx.c b/tftf/tests/extensions/hcx/test_hcx.c
index ebc6e81..3621f21 100644
--- a/tftf/tests/extensions/hcx/test_hcx.c
+++ b/tftf/tests/extensions/hcx/test_hcx.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2021, Arm Limited. All rights reserved.
+ * Copyright (c) 2021-2023, Arm Limited. All rights reserved.
  *
  * SPDX-License-Identifier: BSD-3-Clause
  */
@@ -13,16 +13,32 @@
 test_result_t test_feat_hcx_enabled(void)
 {
 #ifdef __aarch64__
+	u_register_t hcrx_el2;
+
 	/* Make sure FEAT_HCX is supported. */
 	if (!get_feat_hcx_support()) {
 		return TEST_RESULT_SKIPPED;
 	}
 
 	/* Attempt to read HCRX_EL2, if not enabled this should trap to EL3. */
-	read_hcrx_el2();
+	hcrx_el2 = read_hcrx_el2();
 
-	/* If we make it this far, the test was successful. */
-	return TEST_RESULT_SUCCESS;
+	/*
+	 * If we make it this far, access to HCRX_EL2 was not trapped, and
+	 * therefore FEAT_HCX is supported.
+	 */
+	if (hcrx_el2 == HCRX_EL2_INIT_VAL) {
+		/*
+		 * If the value of the register is the reset value, the test
+		 * passed.
+		 */
+		return TEST_RESULT_SUCCESS;
+	}
+	/*
+	 * Otherwise, the test fails, as the HCRX_EL2 register has
+	 * not been initialized properly.
+	 */
+	return TEST_RESULT_FAIL;
 #else
 	/* Skip test if AArch32 */
 	return TEST_RESULT_SKIPPED;