fix(memory share): checks to allow VM to SP memory share

Fix check made to the memory region structure on memory share operation
to permit calls from the other world.

With the update:
- Hypervisor is allowed to forward the call to the SPMC and sender be a
VM.
- SPMC is allowed to handle call forwarded from the Hypervisor.
- Number of borrowers still limited to one if call to the other
world. This is temporary.
- Lender VM can now specify an FF-A ID belonging to an SP.

Change-Id: I5f740316a8f3d0e2749b8ac68e78c0d482634f8f
Signed-off-by: J-Alves <joao.alves@arm.com>
diff --git a/src/api.c b/src/api.c
index eb09499..705db71 100644
--- a/src/api.c
+++ b/src/api.c
@@ -2851,13 +2851,6 @@
 	}
 	memcpy_s(memory_region, MM_PPOOL_ENTRY_SIZE, from_msg, fragment_length);
 
-	/* The sender must match the caller. */
-	if (memory_region->sender != from->id) {
-		dlog_verbose("Memory region sender doesn't match caller.\n");
-		ret = ffa_error(FFA_DENIED);
-		goto out;
-	}
-
 	if (!api_memory_region_check_flags(memory_region, share_func)) {
 		dlog_verbose(
 			"Memory region reserved arguments must be zero.\n");
@@ -2923,8 +2916,9 @@
 
 	/* Allow for one memory region to be shared to the TEE. */
 	if (targets_other_world) {
-		assert(memory_region->receiver_count == 1 &&
-		       to->id == HF_TEE_VM_ID);
+		assert(memory_region->receiver_count == 1);
+		to = vm_find(HF_OTHER_WORLD_ID);
+
 		/*
 		 * The 'to' VM lock is only needed in the case that it is the
 		 * TEE VM.