feat(hcx): test that HCRX_EL2 is accessible
On systems with FEAT_HCX support this CPU extension test attempts
to access HCRX_EL2, if it can then the test passes, if not the
system traps to EL3 and crashes. This tells us whether or not TF-A
has properly enabled access to the register. To enable this test,
compile TFTF with TESTS=hcx, this is done to prevent this test from
running automatically on systems which may support FEAT_HCX but do
not have it enabled in TFA.
Signed-off-by: John Powell <john.powell@arm.com>
Change-Id: If5787c3e947872169af3c9c3e57587cbcd41fd9e
diff --git a/include/lib/aarch64/arch_helpers.h b/include/lib/aarch64/arch_helpers.h
index 8287422..d4f0f9e 100644
--- a/include/lib/aarch64/arch_helpers.h
+++ b/include/lib/aarch64/arch_helpers.h
@@ -524,6 +524,9 @@
DEFINE_RENAME_SYSREG_RW_FUNCS(trcclaimclr, TRCCLAIMCLR)
DEFINE_RENAME_SYSREG_READ_FUNC(trcdevarch, TRCDEVARCH)
+/* FEAT_HCX HCRX_EL2 */
+DEFINE_RENAME_SYSREG_RW_FUNCS(hcrx_el2, HCRX_EL2)
+
#define IS_IN_EL(x) \
(GET_EL(read_CurrentEl()) == MODE_EL##x)