feat: restrict `FFA_VERSION` calls

FF-A v1.2 restricts the use of the `FFA_VERSION` ABI. The FF-A version
can only be set by calls to `FFA_VERSION` before calls to any other
ABIs.

BREAKING CHANGE: Attempts to change the FF-A version after calls to
other FF-A ABIs will fail. Calls to `FFA_VERSION` that do not change the
version are still allowed.

Some tests are now failing because of this breaking change. They will be
fixed in future commits.

Change-Id: I3e24ff9c5f3eb6743c6373c97f378655fc8acbad
Signed-off-by: Karl Meakin <karl.meakin@arm.com>
diff --git a/inc/hf/vm.h b/inc/hf/vm.h
index 92bf3a4..fc13028 100644
--- a/inc/hf/vm.h
+++ b/inc/hf/vm.h
@@ -203,6 +203,14 @@
 	ffa_id_t id;
 	struct ffa_uuid uuids[PARTITION_MAX_UUIDS];
 	enum ffa_version ffa_version;
+
+	/*
+	 * Whether this FF-A instance has negotiated an FF-A version through a
+	 * call to FFA_VERSION. Once the version has been negotiated, it is an
+	 * error to attempt to change it through another call to FFA_VERSION.
+	 */
+	bool ffa_version_negotiated;
+
 	struct smc_whitelist smc_whitelist;
 
 	/** See api.c for the partial ordering on locks. */