Merge "test(spm): using SRI delay flag from NWd"
diff --git a/tftf/tests/runtime_services/secure_service/test_ffa_notifications.c b/tftf/tests/runtime_services/secure_service/test_ffa_notifications.c
index ca6c75a..af338fb 100644
--- a/tftf/tests/runtime_services/secure_service/test_ffa_notifications.c
+++ b/tftf/tests/runtime_services/secure_service/test_ffa_notifications.c
@@ -710,15 +710,9 @@
  */
 static test_result_t base_test_global_notifications_signal_sp(
 	const ffa_id_t sender, const ffa_id_t receiver,
-	const ffa_notification_bitmap_t notifications, const uint32_t flags_get)
+	const ffa_notification_bitmap_t notifications, const uint32_t flags_get,
+	const uint32_t flags_set)
 {
-	CHECK_SPMC_TESTING_SETUP(1, 1, expected_sp_uuids);
-
-	if (!IS_SP_ID(receiver)) {
-		ERROR("Receiver is expected to be an SP ID!\n");
-		return TEST_RESULT_FAIL;
-	}
-
 	/* Variables to validate calls to FFA_NOTIFICATION_INFO_GET. */
 	uint16_t ids[FFA_NOTIFICATIONS_INFO_GET_MAX_IDS] = {0};
 	uint32_t lists_count;
@@ -726,10 +720,15 @@
 
 	CHECK_SPMC_TESTING_SETUP(1, 1, expected_sp_uuids);
 
+	if (!IS_SP_ID(receiver)) {
+		ERROR("Receiver is expected to be an SP ID!\n");
+		return TEST_RESULT_FAIL;
+	}
+
 	schedule_receiver_interrupt_init();
 
 	if (!notification_bind_and_set(sender, receiver, notifications,
-				       FFA_NOTIFICATIONS_FLAG_DELAY_SRI)) {
+				       flags_set)) {
 		return TEST_RESULT_FAIL;
 	}
 
@@ -772,7 +771,37 @@
 {
 	return base_test_global_notifications_signal_sp(
 		1, SP_ID(1), FFA_NOTIFICATION(1) | FFA_NOTIFICATION(60),
-		FFA_NOTIFICATIONS_FLAG_BITMAP_VM);
+		FFA_NOTIFICATIONS_FLAG_BITMAP_VM, 0);
+}
+
+test_result_t test_ffa_notifications_vm_signals_sp_delay_sri_fail(void)
+{
+	const ffa_id_t sender = 1;
+	const ffa_id_t receiver = SP_ID(1);
+	const ffa_notification_bitmap_t notif = (1LU << 34);
+	struct ffa_value ret;
+
+	CHECK_SPMC_TESTING_SETUP(1, 1, expected_sp_uuids);
+
+	if (!request_notification_bind(receiver, receiver,
+				       sender, notif, 0,
+				       CACTUS_SUCCESS, 0)) {
+		return TEST_RESULT_FAIL;
+	}
+
+	ret = ffa_notification_set(sender, receiver,
+				   FFA_NOTIFICATIONS_FLAG_DELAY_SRI, notif);
+
+	if (!is_expected_ffa_error(ret, FFA_ERROR_INVALID_PARAMETER)) {
+		return TEST_RESULT_FAIL;
+	}
+
+	if (!request_notification_unbind(receiver, receiver, sender,
+					 notif, CACTUS_SUCCESS, 0)) {
+		return TEST_RESULT_FAIL;
+	}
+
+	return TEST_RESULT_SUCCESS;
 }
 
 /**
@@ -782,7 +811,8 @@
 {
 	return base_test_global_notifications_signal_sp(
 		SP_ID(1), SP_ID(2), g_notifications,
-		FFA_NOTIFICATIONS_FLAG_BITMAP_SP);
+		FFA_NOTIFICATIONS_FLAG_BITMAP_SP,
+		FFA_NOTIFICATIONS_FLAG_DELAY_SRI);
 }
 
 /**
@@ -1070,10 +1100,13 @@
 	for (unsigned int i = 0; i < PLATFORM_CORE_COUNT; i++) {
 		notifications_to_unbind |= FFA_NOTIFICATION(i);
 
-		uint32_t flags = FFA_NOTIFICATIONS_FLAG_DELAY_SRI |
-				 FFA_NOTIFICATIONS_FLAG_PER_VCPU  |
+		uint32_t flags = FFA_NOTIFICATIONS_FLAG_PER_VCPU  |
 				 FFA_NOTIFICATIONS_FLAGS_VCPU_ID((uint16_t)i);
 
+		flags |= (IS_SP_ID(sender))
+				? FFA_NOTIFICATIONS_FLAG_DELAY_SRI
+				: 0;
+
 		if (!notification_bind_and_set(sender,
 					       receiver,
 					       FFA_NOTIFICATION(i),
diff --git a/tftf/tests/tests-spm.xml b/tftf/tests/tests-spm.xml
index 7c5a8c3..30449cd 100644
--- a/tftf/tests/tests-spm.xml
+++ b/tftf/tests/tests-spm.xml
@@ -239,6 +239,8 @@
                function="test_ffa_notifications_sp_signals_sp_per_vcpu" />
      <testcase name="Notifications SP signals VM per-vCPU"
                function="test_ffa_notifications_sp_signals_vm_per_vcpu" />
+     <testcase name="Notifications VM signals SP, with SRI flag set and fail"
+               function="test_ffa_notifications_vm_signals_sp_delay_sri_fail" />
   </testsuite>
 
   <testsuite name="FF-A Indirect Messaging"