feat: allow to yield cycles obtained through direct request

FF-A v1.2 spec allows an endpoint context to yield CPU cycles
obtained through FFA_MSG_SEND_DIRECT_REQ.

Signed-off-by: Madhukar Pappireddy <madhukar.pappireddy@arm.com>
Change-Id: I44d0c9a4435507a7dd90545c412122d8ac0b2b1c
diff --git a/src/api.c b/src/api.c
index c36fb3c..073e011 100644
--- a/src/api.c
+++ b/src/api.c
@@ -120,10 +120,8 @@
  * - UP migratable.
  * - MP with pinned Execution Contexts.
  */
-static struct vcpu *api_switch_to_vm(struct vcpu *current,
-				     struct ffa_value to_ret,
-				     enum vcpu_state vcpu_state,
-				     ffa_vm_id_t to_id)
+struct vcpu *api_switch_to_vm(struct vcpu *current, struct ffa_value to_ret,
+			      enum vcpu_state vcpu_state, ffa_vm_id_t to_id)
 {
 	struct vm *to_vm = vm_find(to_id);
 	struct vcpu *next = api_ffa_get_vm_vcpu(to_vm, current);
@@ -300,15 +298,7 @@
 
 	assert(next_state == VCPU_STATE_BLOCKED);
 
-	plat_ffa_yield_prepare(current);
-	*next = api_switch_to_primary(
-		current,
-		(struct ffa_value){.func = FFA_YIELD_32,
-				   .arg1 = ffa_vm_vcpu(current->vm->id,
-						       vcpu_index(current))},
-		next_state);
-
-	return ret;
+	return plat_ffa_yield_prepare(current, next);
 }
 
 /**