feat(rmm): update API of RSI_IPA_STATE_SET command

This patch makes the changes listed below:
- API of RSI_IPA_STATE_SET command is updated as
  per RMM Specification 1.0-eac2 by adding "flags"
  parameter passed in X4;
- Added "change_destroyed" member in "set_ripas"
  structure;
- Removed *rtt_level parameter of realm_ipa_get_ripas()
  function, which now returns WALK_FAIL if
  the entry does not have a valid ripas value.
- Function handle_rsi_ipa_state_get() always
  returns to Realm for all cases of ripas values,
  including RIPAS_DESTROYED.

Signed-off-by: AlexeiFedorov <Alexei.Fedorov@arm.com>
Change-Id: I60d9be4aba17819ccd4af69dc8c19434f3b13ae2
diff --git a/lib/realm/include/realm.h b/lib/realm/include/realm.h
index e49d918..4389afe 100644
--- a/lib/realm/include/realm.h
+++ b/lib/realm/include/realm.h
@@ -260,6 +260,7 @@
 				    struct s2_walk_result *res);
 
 enum s2_walk_status realm_ipa_get_ripas(struct rec *rec, unsigned long ipa,
-					enum ripas *ripas_ptr,
-					unsigned long *rtt_level);
+					enum ripas *ripas_ptr);
+int realm_ipa_check_ripas_range(struct rec *rec, unsigned long base,
+				unsigned long top);
 #endif /* REALM_H */
diff --git a/lib/realm/include/rec.h b/lib/realm/include/rec.h
index 34cc31b..6b5b6a2 100644
--- a/lib/realm/include/rec.h
+++ b/lib/realm/include/rec.h
@@ -166,6 +166,7 @@
 		unsigned long top;
 		unsigned long addr;
 		enum ripas ripas_val;
+		enum ripas_change_destroyed change_destroyed;
 	} set_ripas;
 
 	/*
diff --git a/lib/realm/include/ripas.h b/lib/realm/include/ripas.h
index 53350c5..2143d8f 100644
--- a/lib/realm/include/ripas.h
+++ b/lib/realm/include/ripas.h
@@ -7,6 +7,7 @@
 #define RIPAS_H
 
 #include <smc-rmi.h>
+#include <smc-rsi.h>
 
 /*
  * The RmmRipas enumeration represents realm IPA state.
@@ -19,4 +20,19 @@
 	RIPAS_DESTROYED = RMI_DESTROYED	/* IPA is inaccessible to the Realm */
 };
 
+/*
+ * The RmmRipasChangeDestroyed enumeration represents whether a RIPAS change
+ * from DESTROYED should be permitted.
+ *
+ * Map RmmRipasChangeDestroyed to RsiRipasChangeDestroyed to simplify check
+ * operation.
+ */
+enum ripas_change_destroyed {
+	/* A RIPAS change from DESTROYED should not be permitted */
+	NO_CHANGE_DESTROYED = RSI_NO_CHANGE_DESTROYED,
+
+	/* A RIPAS change from DESTROYED should be permitted */
+	CHANGE_DESTROYED = RSI_CHANGE_DESTROYED
+};
+
 #endif /* RIPAS_H */