@@ -179,6 +179,27 @@ static int test_ffa_memory_share(bool test_ack, struct unit_test_state *uts)
return 0;
}
+static int test_ffa_memory_reclaim(bool test_ack, struct unit_test_state *uts)
+{
+ int ret;
+ u64 g_handle;
+ struct udevice *dev;
+
+ ut_assertok(uclass_first_device_err(UCLASS_FFA, &dev));
+
+ if (test_ack) {
+ g_handle = PACK_HANDLE(SANDBOX_MEM_HANDLE, SANDBOX_MEM_HANDLE);
+ ut_assertok(ffa_memory_reclaim(dev, g_handle, 0));
+ } else {
+ /* Provide a wrong handle */
+ g_handle = PACK_HANDLE(SANDBOX_MEM_HANDLE, 0);
+ ret = ffa_memory_reclaim(dev, g_handle, 0);
+ ut_asserteq(-EINVAL, ret);
+ }
+
+ return 0;
+}
+
static int dm_test_ffa_ack(struct unit_test_state *uts)
{
struct ffa_priv *uc_priv;
@@ -236,6 +257,9 @@ static int dm_test_ffa_ack(struct unit_test_state *uts)
/* Test FFA_MEM_SHARE */
test_ffa_memory_share(true, uts);
+ /* Test FFA_MEM_RECLAIM */
+ test_ffa_memory_reclaim(true, uts);
+
return 0;
}
DM_TEST(dm_test_ffa_ack, UTF_SCAN_FDT | UTF_CONSOLE);
@@ -297,6 +321,9 @@ static int dm_test_ffa_nack(struct unit_test_state *uts)
/* Test FFA_MEM_SHARE */
test_ffa_memory_share(false, uts);
+ /* Test FFA_MEM_RECLAIM */
+ test_ffa_memory_reclaim(false, uts);
+
return 0;
}
DM_TEST(dm_test_ffa_nack, UTF_SCAN_FDT | UTF_CONSOLE);