test(ff-a v1.2): ffa_run to zero extended registers

FF-A v1.2 introduces an extended set of available registers
for its interfaces. When a partition that is handling a
direct request yields, it may be resumed by ffa_run. In order
to maintain the full extended register state when passing execution
back to the yielding partition, allow ffa_run to zero the extended
register set to preseve runtime state of the calling partition.

Patch also includes tests demonstrating this use case.

Signed-off-by: Kathleen Capella <kathleen.capella@arm.com>
Change-Id: I27a01ab40f9f74867536812c24a0d665e782754f
diff --git a/src/arch/aarch64/hypervisor/handler.c b/src/arch/aarch64/hypervisor/handler.c
index 96ee63c..7bdef48 100644
--- a/src/arch/aarch64/hypervisor/handler.c
+++ b/src/arch/aarch64/hypervisor/handler.c
@@ -602,6 +602,16 @@
 	}
 #endif
 	case FFA_RUN_32:
+		/**
+		 * Ensure that an FF-A v1.2 endpoint preserves the
+		 * runtime state of the calling partition by setting
+		 * the extended registers (x8-x17) to zero.
+		 */
+		if (current->vm->ffa_version >= MAKE_FFA_VERSION(1, 2) &&
+		    !api_extended_args_are_zero(args)) {
+			*args = ffa_error(FFA_INVALID_PARAMETERS);
+			return false;
+		}
 		*args = api_ffa_run(ffa_vm_id(*args), ffa_vcpu_index(*args),
 				    current, next);
 		return true;