test(memory share): lend device memory region to sp
Add test to check that a device memory region can be successfully
lent to an sp.
This requires some refactoring of the memory sharing test flow so
as to use the correct memory type and cachebility attributes for
the memory being lent. Also limit the words being written to 1
word for device memory so we only write to the data register of the
device.
Also only map device regions from UART2 so that UART0 can be used
by TFTF in the device sharing test.
Signed-off-by: Daniel Boulby <daniel.boulby@arm.com>
Change-Id: I9f31769679883f34e0444db75a873765776a85e9
diff --git a/include/runtime_services/cactus_test_cmds.h b/include/runtime_services/cactus_test_cmds.h
index 0630753..282cfbe 100644
--- a/include/runtime_services/cactus_test_cmds.h
+++ b/include/runtime_services/cactus_test_cmds.h
@@ -201,10 +201,12 @@
static inline struct ffa_value cactus_mem_send_cmd(
ffa_id_t source, ffa_id_t dest, uint32_t mem_func,
ffa_memory_handle_t handle, ffa_memory_region_flags_t retrieve_flags,
- uint16_t word_to_write, bool expect_exception)
+ uint16_t word_to_write, bool expect_exception, bool is_normal_memory)
{
uint64_t _expect_exception = expect_exception ? (1ULL << 32) : 0;
- uint64_t packed = (uint64_t)word_to_write | _expect_exception;
+ uint64_t _is_normal_memory = is_normal_memory ? (1ULL << 33) : 0;
+ uint64_t packed = (uint64_t)word_to_write | _expect_exception |
+ _is_normal_memory;
return cactus_send_cmd(source, dest, CACTUS_MEM_SEND_CMD, mem_func,
handle, retrieve_flags, packed);
@@ -229,7 +231,12 @@
static inline bool cactus_mem_send_expect_exception(struct ffa_value ret)
{
- return (bool)(ret.arg7 >> 32);
+ return (bool)((ret.arg7 >> 32) & 0x1);
+}
+
+static inline bool cactus_mem_send_is_normal_memory(struct ffa_value ret)
+{
+ return (bool)((ret.arg7 >> 33) & 0x1);
}
/**