[PATCH v2 09/11] test: dm: add sandbox FF-A runtime transport tests
Simon Glass
sjg at chromium.org
Fri May 15 20:27:27 CEST 2026
Hi Harsimran,
On 2026-05-14T12:49:13, Harsimran Singh Tungal
<harsimransingh.tungal at arm.com> wrote:
> test: dm: add sandbox FF-A runtime transport tests
>
> Exercise FF-A runtime helpers via sandbox DM tests
>
> Test the successful runtime direct-message round trip and the invalid
> destination-partition case, using the shared FF-A prepare step so the
> sandbox emulator has initialized partition state before exercising the
> runtime-only messaging helpers.
> Add a dedicated no-context test that calls
> ffa_sync_send_receive_runtime() before enabling the runtime context and
> checks that it returns -EPERM. Reset the resident FF-A runtime context
> around the transport tests so the runtime flag and private data do not
> leak across test cases.
> Split the ffa_to_std_errno() checks into a separate DM test so
> error-mapping regressions are reported independently from transport
> failures. Cover both the valid mappings and the boundary inputs that
> must return -EINVAL.
>
> Replace the hard-coded synthetic partition execution-context and
> property values in ffa-emul-uclass.c with the shared
> [...]
>
> arch/sandbox/include/asm/sandbox_arm_ffa.h | 16 +++-
> drivers/firmware/arm-ffa/ffa-emul-uclass.c | 36 +++++---
> test/dm/Makefile | 3 +-
> test/dm/ffa_runtime.c | 129 +++++++++++++++++++++++++++++
> 4 files changed, 172 insertions(+), 12 deletions(-)
Reviewed-by: Simon Glass <sjg at chromium.org>
> diff --git a/test/dm/ffa_runtime.c b/test/dm/ffa_runtime.c
> @@ -0,0 +1,129 @@
> +static int dm_test_ffa_to_std_errno(struct unit_test_state *uts)
> +{
> + (void)uts;
> +
> + ut_asserteq(-EINVAL, ffa_to_std_errno(0));
(void)uts is incorrect - uts is used by the ut_asserteq() macro
expansions. Please drop it.
> diff --git a/test/dm/ffa_runtime.c b/test/dm/ffa_runtime.c
> @@ -0,0 +1,129 @@
> + ffa_copy_runtime_priv(&(struct ffa_priv_runtime){
> + .id = NS_PHYS_ENDPOINT_ID,
> + });
> + ffa_enable_runtime_context();
Twice you do reset + prepare + copy + enable + assert + reset. Please
pull this into a small helper (e.g. ffa_runtime_setup()) with matching
teardown, so the two tests can't drift and a failed assertion mid-test
doesn't leak the runtime flag into later tests.
> diff --git a/test/dm/ffa_runtime.c b/test/dm/ffa_runtime.c
> @@ -0,0 +1,129 @@
> + /* Invalid partition IDs must be rejected and mapped to -EINVAL */
> + ut_asserteq(-EINVAL, ffa_sync_send_receive_runtime(0, &msg, true));
Just to clarify, this works because NS_PHYS_ENDPOINT_ID happens to be
0, so the emulator's self-ID check trips first rather than the SP
validity check. Please pick a clearly-invalid partition ID (e.g.
0xffff) so the test exercises the intended rejection path.
> diff --git a/drivers/firmware/arm-ffa/ffa-emul-uclass.c b/drivers/firmware/arm-ffa/ffa-emul-uclass.c
> @@ -19,41 +19,57 @@
> /* The partitions (SPs) table */
> static struct ffa_partition_desc sandbox_partitions[SANDBOX_PARTITIONS_CNT] = {
> {
> - .info = { .id = SANDBOX_SP1_ID, .exec_ctxt = 0x5687, .properties = 0x89325621 },
> + .info = {
> + .id = SANDBOX_SP1_ID,
> + .exec_ctxt = SANDBOX_SP1_EXEC_CTXT,
> + .properties = SANDBOX_SP1_PROPERTIES,
> + },
This refactor (lifting exec_ctxt/properties into SANDBOX_SP*_EXEC_CTXT
/ SANDBOX_SP*_PROPERTIES) is unrelated to the runtime tests - none of
the new tests reference these macros. Please split it into a
preparatory patch.
> diff --git a/drivers/firmware/arm-ffa/ffa-emul-uclass.c b/drivers/firmware/arm-ffa/ffa-emul-uclass.c
> @@ -19,41 +19,57 @@
> - }
> - }
> + },
> + },
>
> };
Stray blank line between the last entry and the closing }; — while you
are reflowing this table, please drop it.
Regards,
Simon
More information about the U-Boot
mailing list