fix(ff-a): memory reclaim after a donate
This change fixes the case in which memory reclaim is performed after
a successful memory donate. Prior to this change memory reclaim would
fail with FFA_DENIED.
Basic tests are added to make sure a memory reclaim can happen after
successful calls to any of the memory send interfaces.
Change-Id: I87ce3e113246bec8564dde6754a4d65cb6794170
Signed-off-by: J-Alves <joao.alves@arm.com>
diff --git a/src/ffa_memory.c b/src/ffa_memory.c
index bf2fe5f..51a73ec 100644
--- a/src/ffa_memory.c
+++ b/src/ffa_memory.c
@@ -667,10 +667,13 @@
MM_MODE_INVALID | MM_MODE_UNOWNED | MM_MODE_SHARED;
uint32_t orig_to_state = orig_to_mode & state_mask;
- if (orig_to_state != MM_MODE_INVALID &&
- orig_to_state != MM_MODE_SHARED) {
- return ffa_error(FFA_DENIED);
- }
+ /*
+ * If the original ffa memory send call has been processed
+ * successfully, it is expected the orig_to_mode would overlay
+ * with `state_mask`, as a result of the function
+ * `ffa_send_check_transition`.
+ */
+ assert(orig_to_state != 0U);
} else {
/*
* Ensure the retriever has the expected state. We don't care