test(ipi): FFA_NOTIFICATION_INFO_GET reports pending IPI
Expand the waiting ipi tests to call FFA_NOTIFICATION_INFO_GET
and check that the correctly report the pending IPI.
Signed-off-by: Daniel Boulby <daniel.boulby@arm.com>
Change-Id: I6540ab413c9e2ab312a8cacf9bee7dd174a89f13
diff --git a/inc/vmapi/hf/ffa.h b/inc/vmapi/hf/ffa.h
index f5fa1ec..397fce6 100644
--- a/inc/vmapi/hf/ffa.h
+++ b/inc/vmapi/hf/ffa.h
@@ -1087,6 +1087,7 @@
#define FFA_NOTIFICATIONS_LISTS_COUNT_MASK 0x1fU
#define FFA_NOTIFICATIONS_LIST_SHIFT(l) (2 * ((l) - 1) + 12)
#define FFA_NOTIFICATIONS_LIST_SIZE_MASK 0x3U
+#define FFA_NOTIFICATIONS_LIST_MAX_SIZE 0x4U
static inline uint32_t ffa_notification_info_get_lists_count(
struct ffa_value args)
@@ -1107,6 +1108,11 @@
return (args.arg2 & FFA_NOTIFICATIONS_INFO_GET_FLAG_MORE_PENDING) != 0U;
}
+void ffa_notification_info_get_and_check(
+ const uint32_t expected_lists_count,
+ const uint32_t *const expected_lists_sizes,
+ const uint16_t *const expected_ids);
+
/**
* A set of contiguous pages which is part of a memory region. This corresponds
* to table 10.14 of the FF-A v1.1 EAC0 specification, "Constituent memory
diff --git a/test/vmapi/common/ffa.c b/test/vmapi/common/ffa.c
index 134328f..a6f4ad8 100644
--- a/test/vmapi/common/ffa.c
+++ b/test/vmapi/common/ffa.c
@@ -869,3 +869,29 @@
}
}
}
+
+/**
+ * Call FFA_NOTIFICATION_INFO_GET and check the reponse with the values
+ * expected.
+ */
+void ffa_notification_info_get_and_check(
+ const uint32_t expected_lists_count,
+ const uint32_t *const expected_lists_sizes,
+ const uint16_t *const expected_ids)
+{
+ struct ffa_value ret = ffa_notification_info_get();
+
+ EXPECT_EQ(ret.func, FFA_SUCCESS_64);
+ EXPECT_EQ(ffa_notification_info_get_lists_count(ret),
+ expected_lists_count);
+
+ for (uint32_t i = 0; i < expected_lists_count; i++) {
+ EXPECT_EQ(ffa_notification_info_get_list_size(ret, i + 1),
+ expected_lists_sizes[i]);
+ }
+
+ EXPECT_EQ(memcmp(&ret.arg3, expected_ids,
+ sizeof(expected_ids[0] *
+ FFA_NOTIFICATIONS_INFO_GET_MAX_IDS)),
+ 0);
+}
diff --git a/test/vmapi/primary_with_secondaries/secure_interrupts.c b/test/vmapi/primary_with_secondaries/secure_interrupts.c
index 5b04fe1..7437ae7 100644
--- a/test/vmapi/primary_with_secondaries/secure_interrupts.c
+++ b/test/vmapi/primary_with_secondaries/secure_interrupts.c
@@ -232,10 +232,11 @@
* vCPU0 terminates with FFA_MSG_WAIT, so it is in the waiting state.
* - Start CPU1 and within it, invoke test service to send IPI. Test service
* waits for state machine to transition into READY state.
- * - NWd waits for the Schedule Reciever Interrupt and then runs Service1 vCPU0
- * to handle the IPI.
+ * - NWd waits for the Schedule Reciever Interrupt, checks that Service1 vCPU0
+ * is reported by FFA_NOTIFICATION_INFO_GET as having an IPI pending
+ * and then runs Service1 vCPU0 to handle the IPI.
* - vCPU0 is resumed to handle the IPI virtual interrupt. It should attest
- * state transitions into HANDLED from the interrupt handler.
+ * state transitions into HANDLED from the interrupt handler.
*/
TEST_PRECONDITION(ipi, receive_ipi_waiting_vcpu_in_nwd, service1_is_mp_sp)
{
@@ -252,6 +253,8 @@
service1_info->vm_id,
};
uint32_t sri_id;
+ uint32_t expected_lists_sizes[FFA_NOTIFICATIONS_INFO_GET_MAX_IDS] = {0};
+ uint16_t expected_ids[FFA_NOTIFICATIONS_INFO_GET_MAX_IDS] = {0};
/* Get ready to handle SRI. */
sri_id = enable_sri();
@@ -297,6 +300,14 @@
interrupt_wait();
}
+ /* Check the target vCPU 0 is returned by FFA_NOTIFICATION_INFO_GET. */
+ expected_lists_sizes[0] = 1;
+ expected_ids[0] = service1_info->vm_id;
+ expected_ids[1] = 0;
+
+ ffa_notification_info_get_and_check(1, expected_lists_sizes,
+ expected_ids);
+
/* Resumes service1 in target vCPU 0 to handle IPI. */
ret = ffa_run(service1_info->vm_id, 0);
EXPECT_EQ(ret.func, FFA_YIELD_32);
@@ -321,10 +332,11 @@
* - Resume Service2 vCPU0 so execution is in the Secure World. At this point,
* Service2 transitions IPI state to READY, and waits for the IPI state to be
* Handled.
- * - NWd vCPU0 is resumed by the Schedule Reciever Interrupt and then runs
- * Service1 vCPU0 to handle the IPI.
- * - Service1 vCPU0 is resumed to handle the IPI virtual interrupt. It should
- * attest state transitions into HANDLED from the interrupt handler.
+ * - NWd vCPU0 is resumed by the Schedule Reciever Interrupt checks that
+ * Service1 vCPU0 is reported by FFA_NOTIFICATION_INFO_GET as having an IPI
+ * pending, and then runs Service1 vCPU0 to handle the IPI.
+ * - Service1 vCPU0 is resumed to handle the IPI virtual interrupt.
+ * It should attest state transitions into HANDLED from the interrupt handler.
* - Service2 vCPU0 is then run to check that it successfully runs and completes
* after being interrupted.
*/
@@ -344,6 +356,8 @@
service2_info->vm_id,
};
uint32_t sri_id;
+ uint32_t expected_lists_sizes[FFA_NOTIFICATIONS_INFO_GET_MAX_IDS] = {0};
+ uint16_t expected_ids[FFA_NOTIFICATIONS_INFO_GET_MAX_IDS] = {0};
/* Get ready to handle SRI. */
sri_id = enable_sri();
@@ -393,6 +407,14 @@
interrupt_wait();
}
+ /* Check the target vCPU 0 is returned by FFA_NOTIFICATION_INFO_GET. */
+ expected_lists_sizes[0] = 1;
+ expected_ids[0] = service1_info->vm_id;
+ expected_ids[1] = 0;
+
+ ffa_notification_info_get_and_check(1, expected_lists_sizes,
+ expected_ids);
+
/* Resumes service1 in target vCPU 0 to handle IPI. */
EXPECT_EQ(ffa_run(service1_info->vm_id, 0).func, FFA_YIELD_32);