fix(unittests): sysregs status might be inconsistent between runs

Current implementation of test_helpers_rmm_start() in the
test_helpers library performs an initialization of the RMM runtime
for the host build on the first call. Subsequent calls are just
ignored after the first initialization.

This can cause a number of problems due to the sysregs left in
an undetermined status. For instance, a test using the RMM
runtime will leave the sysreg in an inconsistent state and cause
problems for the next test one. Hence it is essential for the
next test to reset to a previous known state as part of
initialization. Any test  using the RMM runtime will need to
restore the sysregs status and callbacks before running any new test.

This patch adds support to save the sysreg state after RMM
initialization in test_helpers_rmm_start() and restores this
state for any subsequent call to test_helpers_rmm_start().

Signed-off-by: Javier Almansa Sobrino <javier.almansasobrino@arm.com>
Change-Id: Ifb705380f079308576e7f59b475be6984447f045
diff --git a/plat/host/common/include/host_utils.h b/plat/host/common/include/host_utils.h
index 8f69486..b32187f 100644
--- a/plat/host/common/include/host_utils.h
+++ b/plat/host/common/include/host_utils.h
@@ -6,6 +6,7 @@
 #ifndef HOST_UTILS_H
 #define HOST_UTILS_H
 
+#include <stddef.h>
 #include <types.h>
 
 /***********************************************************************
@@ -113,9 +114,23 @@
 int host_util_set_default_sysreg_cb(char *name, u_register_t init);
 
 /*
- * Clear the list of sysreg callbacks.
+ * Save the sysreg state across all PEs in the system along with registered
+ * callbacks. This function must only be used during RMM runtime bring-up,
+ * at a point wherein the system is initialized properly and can restored
+ * for later test iterations.
  */
-void host_util_reset_all_sysreg_cb(void);
+void host_util_take_sysreg_snapshot(void);
+
+/*
+ * Restore a saved sysreg state and associated callbacks. The state is already
+ * assumed to be saved prior to calling this API.
+ */
+void host_util_restore_sysreg_snapshot(void);
+
+/*
+ * Zero all sysreg values and unregister all sysreg callbacks.
+ */
+void host_util_zero_sysregs_and_cbs(void);
 
 /*
  * Return the configured address for the granule base.