feat(realm): add test case for FEAT_DoubleFault2 support on TF-RMM
When FEAT_DoubleFault2 is supported, TF-RMM must take into
account bit SCTLR2_EL1.EASE in order to decide whether to inject
a SEA into the sync exception vector or into the serror one.
The test on this patch verifies that TF-RMM injects the SEA
to the right vector depending on SCTLR2.EASE bit.
Signed-off-by: Javier Almansa Sobrino <javier.almansasobrino@arm.com>
Change-Id: I6c976fecb04d123e3efb96c5973b1466e241097f
diff --git a/lib/exceptions/aarch64/serror.c b/lib/exceptions/aarch64/serror.c
index 9c35712..437c5d0 100644
--- a/lib/exceptions/aarch64/serror.c
+++ b/lib/exceptions/aarch64/serror.c
@@ -23,9 +23,28 @@
bool tftf_serror_handler(void)
{
+ uint64_t elr_elx = IS_IN_EL2() ? read_elr_el2() : read_elr_el1();
+ bool resume = false;
+
if (custom_serror_handler == NULL) {
return false;
}
- return custom_serror_handler();
+ resume = custom_serror_handler();
+
+ /*
+ * TODO: if there is a test exepecting an Aync EA and expects to resume,
+ * then there needs to be additional info from test handler as to whether
+ * elr can be incremented or not.
+ */
+ if (resume) {
+ /* Move ELR to next instruction to allow tftf to continue */
+ if (IS_IN_EL2()) {
+ write_elr_el2(elr_elx + 4U);
+ } else {
+ write_elr_el1(elr_elx + 4U);
+ }
+ }
+
+ return resume;
}