feat(rme): update FEAT_MPAM tests on Realms

Currently, to test that accessing a FEAT_MPAM register from a Realm
causes an undefined abort injected back to the Realm, we only test
by accessing a single register.

This patches updates the test by trying to access all MPAM registers
from the Realm to validate that an undefined abort is taken to the
Realm for all the registers.

Signed-off-by: Javier Almansa Sobrino <javier.almansasobrino@arm.com>
Change-Id: I16c88d467eb2a49342694536a1c7b6358416dc34
diff --git a/realm/realm_mpam.c b/realm/realm_mpam.c
index 913e451..e38d045 100644
--- a/realm/realm_mpam.c
+++ b/realm/realm_mpam.c
@@ -7,16 +7,27 @@
 #include <arch_helpers.h>
 #include <sync.h>
 #include <realm_helpers.h>
+#include <utils_def.h>
 
 /* Check if Realm gets undefined abort when it access MPAM registers */
 bool test_realm_mpam_undef_abort(void)
 {
+	void (*write_reg[])(u_register_t) = {write_mpam0_el1,
+					     write_mpam1_el1,
+					     write_mpamsm_el1,
+					     write_mpamidr_el1};
+	unsigned int n_access = ARRAY_SIZE(write_reg);
+
 	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);
+
+	for (unsigned int i = 0U; i < n_access; i++) {
+		write_reg[i](0UL);
+	}
+
 	unregister_custom_sync_exception_handler();
 
-	return (realm_get_undef_abort_count() != 0UL);
+	return (realm_get_undef_abort_count() == (unsigned long)n_access);
 }