feat(memory share): share memory with the other world

The Hypervisor keeps its implementation, forwarding memory share to
the SPMC, which shall validate the request against the 'other_world_vm'
configured memory permissions, track the memory operation in its internal
'share_state' variables, allocate a handle and return the result to the
Hypervisor.

The SPMC doesn't forward the request to the hypervisor. It validates
the memory sharing operation internally, and returns the handle to the
caller endpoint.

Created 'ffa_memory_internal.h' header to declare private functions and
symbols to the ffa_memory module. With this patch, some functionality
was made hypervisor specific. Creating this header, allows for the
hypervisor implementation to reference functions it needs, whilst
seperating declaration from ffa_memory module's public interface used in
'api.c'.

Change-Id: Ia9c14cf112f0143869ac4a7ba9b495b08e38f9bb
Signed-off-by: J-Alves <joao.alves@arm.com>
diff --git a/src/api.c b/src/api.c
index fcbdc06..8421449 100644
--- a/src/api.c
+++ b/src/api.c
@@ -2905,33 +2905,10 @@
 		}
 	}
 
-	/* Allow for one memory region to be shared to the other world. */
 	if (targets_other_world) {
-		to = vm_find(HF_OTHER_WORLD_ID);
-
-		/*
-		 * The 'to' VM lock is only needed in the case that it is the
-		 * other world VM.
-		 */
-		struct two_vm_locked vm_to_from_lock = vm_lock_both(to, from);
-
-		if (vm_is_mailbox_busy(vm_to_from_lock.vm1)) {
-			ret = ffa_error(FFA_BUSY);
-			goto out_unlock;
-		}
-
-		ret = ffa_memory_other_world_send(
-			vm_to_from_lock.vm2, vm_to_from_lock.vm1, memory_region,
-			length, fragment_length, share_func, &api_page_pool);
-		/*
-		 * ffa_other_world_memory_send takes ownership of the
-		 * memory_region, so make sure we don't free it.
-		 */
-		memory_region = NULL;
-
-	out_unlock:
-		vm_unlock(&vm_to_from_lock.vm1);
-		vm_unlock(&vm_to_from_lock.vm2);
+		ret = plat_ffa_other_world_mem_send(
+			from, share_func, &memory_region, length,
+			fragment_length, &api_page_pool);
 	} else {
 		struct vm_locked from_locked = vm_lock(from);