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_mpam.c b/realm/realm_mpam.c
new file mode 100644
index 0000000..913e451
--- /dev/null
+++ b/realm/realm_mpam.c
@@ -0,0 +1,22 @@
+/*
+ * Copyright (c) 2025, Arm Limited. All rights reserved.
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#include <arch.h>
+#include <arch_helpers.h>
+#include <sync.h>
+#include <realm_helpers.h>
+
+/* Check if Realm gets undefined abort when it access MPAM registers */
+bool test_realm_mpam_undef_abort(void)
+{
+ realm_reset_undef_abort_count();
+
+ /* Install exception handler to catch undefined abort */
+ register_custom_sync_exception_handler(realm_sync_exception_handler);
+ write_mpam0_el1(0UL);
+ unregister_custom_sync_exception_handler();
+
+ return (realm_get_undef_abort_count() != 0UL);
+}