fix(memory share): fix behaviour of relinquish clear flag
The `Zero memory after relinquish` flag set in a relinquish
request should take priority over the value of the
`Zero memory flag` set in the retrieve request previously.
This is not currently the case and this patch corrects that.
We also correct the tests to reflect this as well as adding some
additional tests to ensure in cases where the flag's value during
the retrieve request does not match the flag during the relinquish
request, the behaviour that occurs is dictated by the relinquish
request.
Signed-off-by: Daniel Boulby <daniel.boulby@arm.com>
Change-Id: I770362374da9c333952249f30e17bf34edd83d6c
diff --git a/src/ffa_memory.c b/src/ffa_memory.c
index 504308c..07a3fd5 100644
--- a/src/ffa_memory.c
+++ b/src/ffa_memory.c
@@ -2898,10 +2898,6 @@
share_state->retrieved_fragment_count[receiver_index] ==
share_state->fragment_count;
- share_state->clear_after_relinquish =
- (retrieve_request->flags &
- FFA_MEMORY_REGION_FLAG_CLEAR_RELINQUISH) != 0U;
-
/* VMs acquire the RX buffer from SPMC. */
CHECK(plat_ffa_acquire_receiver_rx(to_locked, &ret));
@@ -3390,9 +3386,8 @@
}
clear = receivers_relinquished_memory &&
- (share_state->clear_after_relinquish ||
- (relinquish_request->flags & FFA_MEMORY_REGION_FLAG_CLEAR) !=
- 0U);
+ ((relinquish_request->flags & FFA_MEMORY_REGION_FLAG_CLEAR) !=
+ 0U);
/*
* Clear is not allowed for memory that was shared, as the