feat(rme): add tests for FEAT_MPAM on Realms
Signed-off-by: Javier Almansa Sobrino <javier.almansasobrino@arm.com>
Change-Id: I6e138cbf121793bdaaa3a44824c0dbff74daced1
diff --git a/realm/realm_helpers.c b/realm/realm_helpers.c
index bf47efc..f11e2f3 100644
--- a/realm/realm_helpers.c
+++ b/realm/realm_helpers.c
@@ -1,15 +1,19 @@
/*
- * Copyright (c) 2024, Arm Limited. All rights reserved.
+ * Copyright (c) 2024-2025, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
+#include <debug.h>
#include <stdlib.h>
+
#include <realm_helpers.h>
#include <realm_psi.h>
#include <realm_rsi.h>
#include <smccc.h>
+static unsigned int volatile realm_got_undef_abort;
+
/* Generate 64-bit random number */
unsigned long long realm_rand64(void)
{
@@ -39,3 +43,27 @@
return host_cal.gprs[0];
}
+
+bool realm_sync_exception_handler(void)
+{
+ uint64_t esr_el1 = read_esr_el1();
+
+ if (EC_BITS(esr_el1) == EC_UNKNOWN) {
+ realm_printf("received undefined abort. "
+ "ESR_EL1: 0x%llx ELR_EL1: 0x%llx\n",
+ esr_el1, read_elr_el1());
+ realm_got_undef_abort++;
+ }
+
+ return true;
+}
+
+void realm_reset_undef_abort_count(void)
+{
+ realm_got_undef_abort = 0U;
+}
+
+unsigned int realm_get_undef_abort_count(void)
+{
+ return realm_got_undef_abort;
+}