test: disallow migrating a blocked SP to another CPU
This patch adds a test to make sure the vCPU of an UP SP cannot be
migrated from current CPU to a different physical CPU while the vCPU
is in BLOCKED state as part of an SP call chain.
This patch also adds a helper function to check if the receiver
endpoint is an UP SP. This helper is used as a precondition for the
newly introduced test.
Signed-off-by: Madhukar Pappireddy <madhukar.pappireddy@arm.com>
Change-Id: I018c152737dbd9abae7385e8858a8d231d5e82e8
diff --git a/test/vmapi/ffa_secure_partitions/secure_interrupts.c b/test/vmapi/ffa_secure_partitions/secure_interrupts.c
index d869f5b..319a9c5 100644
--- a/test/vmapi/ffa_secure_partitions/secure_interrupts.c
+++ b/test/vmapi/ffa_secure_partitions/secure_interrupts.c
@@ -6,44 +6,19 @@
* https://opensource.org/licenses/BSD-3-Clause.
*/
-#include "hf/arch/barriers.h"
#include "hf/arch/irq.h"
+#include "hf/arch/vm/delay.h"
#include "hf/arch/vm/interrupts_gicv3.h"
#include "hf/arch/vm/timer.h"
#include "ffa_secure_partitions.h"
#include "gicv3.h"
-#include "msr.h"
#include "partition_services.h"
#include "sp_helpers.h"
#define SP_SLEEP_TIME 400U
#define NS_SLEEP_TIME 200U
-static inline uint64_t syscounter_read(void)
-{
- isb();
- return read_msr(cntvct_el0);
-}
-
-static void waitus(uint64_t us)
-{
- uint64_t start_count_val = syscounter_read();
- uint64_t wait_cycles = (us * read_msr(cntfrq_el0)) / 1000000;
-
- while ((syscounter_read() - start_count_val) < wait_cycles) {
- /* Busy wait... */;
- }
-}
-
-static void waitms(uint64_t ms)
-{
- while (ms > 0) {
- waitus(1000);
- ms--;
- }
-}
-
static void configure_trusted_wdog_interrupt(ffa_vm_id_t source,
ffa_vm_id_t dest, bool enable)
{