test(cactus): add test for NS memory sharing between SPs
Define a new shared memory region in 48-bit address range
(configured as NS in the TZC) in cactus-tertiary's manifest.
Since SPs can share either secure or non-secure memory, propagate the
security information in the relevant cactus commands:
CACTUS_REQ_MEM_SEND_CMD and CACTUS_MEM_SEND_CMD.
Change-Id: I10af24c96ff8fc0d13c80a52b0264a1482a5cf56
Signed-off-by: Federico Recanati <federico.recanati@arm.com>
diff --git a/include/common/test_helpers.h b/include/common/test_helpers.h
index 78f1c58..a69eb72 100644
--- a/include/common/test_helpers.h
+++ b/include/common/test_helpers.h
@@ -290,6 +290,7 @@
} \
} while (false)
+#ifdef __aarch64__
#define SKIP_TEST_IF_PA_SIZE_LESS_THAN(n) \
do { \
static const unsigned int pa_range_bits_arr[] = { \
@@ -301,6 +302,12 @@
return TEST_RESULT_SKIPPED; \
} \
} while (false)
+#else
+#define SKIP_TEST_IF_PA_SIZE_LESS_THAN(n) \
+ do { \
+ return TEST_RESULT_SKIPPED; \
+ } while (false)
+#endif
/* Helper macro to verify if system suspend API is supported */
#define is_psci_sys_susp_supported() \
diff --git a/include/runtime_services/cactus_test_cmds.h b/include/runtime_services/cactus_test_cmds.h
index 130cfa5..3bffb7b 100644
--- a/include/runtime_services/cactus_test_cmds.h
+++ b/include/runtime_services/cactus_test_cmds.h
@@ -197,10 +197,15 @@
static inline smc_ret_values 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,
- uint32_t word_to_write)
+ bool non_secure, uint16_t word_to_write)
{
+ /*
+ * `non_secure` and `word_to_write` are packed in the same register.
+ * Packed in a 32-bit value to support AArch32 platforms (eg Juno).
+ */
+ uint32_t val3 = ((uint32_t)non_secure << 16) | word_to_write;
return cactus_send_cmd(source, dest, CACTUS_MEM_SEND_CMD, mem_func,
- handle, retrieve_flags, word_to_write);
+ handle, retrieve_flags, val3);
}
static inline ffa_memory_handle_t cactus_mem_send_get_handle(smc_ret_values ret)
@@ -214,9 +219,14 @@
return (ffa_memory_region_flags_t)ret.ret6;
}
-static inline uint32_t cactus_mem_send_words_to_write(smc_ret_values ret)
+static inline uint16_t cactus_mem_send_words_to_write(smc_ret_values ret)
{
- return (uint32_t)ret.ret7;
+ return (uint16_t)ret.ret7;
+}
+
+static inline bool cactus_mem_send_get_non_secure(smc_ret_values ret)
+{
+ return (bool)(ret.ret7 >> 16);
}
/**
@@ -230,10 +240,10 @@
static inline smc_ret_values cactus_req_mem_send_send_cmd(
ffa_id_t source, ffa_id_t dest, uint32_t mem_func,
- ffa_id_t receiver)
+ ffa_id_t receiver, bool non_secure)
{
return cactus_send_cmd(source, dest, CACTUS_REQ_MEM_SEND_CMD, mem_func,
- receiver, 0, 0);
+ receiver, non_secure, 0);
}
static inline uint32_t cactus_req_mem_send_get_mem_func(smc_ret_values ret)
@@ -246,6 +256,11 @@
return (ffa_id_t)ret.ret5;
}
+static inline bool cactus_req_mem_send_get_non_secure(smc_ret_values ret)
+{
+ return (bool)ret.ret6;
+}
+
/**
* Request to fill SIMD vectors with dummy values with purpose to check a
* save/restore routine during the context switches between secure world and