aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlivier Deprez <olivier.deprez@arm.com>2020-07-22 10:20:11 +0200
committerOlivier Deprez <olivier.deprez@arm.com>2020-07-22 14:35:24 +0200
commit1ad6a68030722af6c06c98d39d687b73ca5ac7a6 (patch)
treeae93e9b39f98ebd3b439a18eac097582f6aa8bbb
parent3908b29cdc1c9e4a5b337d71dbea16f706b76f31 (diff)
downloadhafnium-1ad6a68030722af6c06c98d39d687b73ca5ac7a6.tar.gz
tests: busy_secondary: enable timer just before ffa_run
The busy_secondary.physical_timer test sometimes fails after being migrated to jenkins VM. It was not unstable in prior hosting infrastructure. The timer might not leave enough time to prepare and send an FF-A indirect message and for the secondary VM to be scheduled. The failure happens because the timer fires too early while still running the PVM. Also increase the timer timeout value to 3ms from 1ms to be on the safe side. Apply the same change to busy_secondary.virtual_timer. Change-Id: Id139545510c7043adf10c506ac1d394ee0a22c7e Signed-off-by: Olivier Deprez <olivier.deprez@arm.com>
-rw-r--r--test/vmapi/arch/aarch64/gicv3/busy_secondary.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/test/vmapi/arch/aarch64/gicv3/busy_secondary.c b/test/vmapi/arch/aarch64/gicv3/busy_secondary.c
index 28f7af1..06eeda0 100644
--- a/test/vmapi/arch/aarch64/gicv3/busy_secondary.c
+++ b/test/vmapi/arch/aarch64/gicv3/busy_secondary.c
@@ -65,11 +65,6 @@ TEST(busy_secondary, virtual_timer)
EXPECT_EQ(io_read32_array(GICD_ISACTIVER, 0), 0);
EXPECT_EQ(io_read32(GICR_ISACTIVER0), 0);
- dlog("Starting timer\n");
- /* Set virtual timer for 1 mS and enable. */
- write_msr(CNTV_TVAL_EL0, ns_to_ticks(1000000));
- write_msr(CNTV_CTL_EL0, 0x00000001);
-
/* Let secondary start looping. */
dlog("Telling secondary to loop.\n");
memcpy_s(send_buffer, FFA_MSG_PAYLOAD_MAX, message, sizeof(message));
@@ -77,6 +72,12 @@ TEST(busy_secondary, virtual_timer)
ffa_msg_send(HF_PRIMARY_VM_ID, SERVICE_VM1, sizeof(message), 0)
.func,
FFA_SUCCESS_32);
+
+ dlog("Starting timer\n");
+ /* Set virtual timer for 3 mS and enable. */
+ write_msr(CNTV_TVAL_EL0, ns_to_ticks(3000000));
+ write_msr(CNTV_CTL_EL0, 0x00000001);
+
run_res = ffa_run(SERVICE_VM1, 0);
EXPECT_EQ(run_res.func, FFA_INTERRUPT_32);
@@ -123,11 +124,6 @@ TEST(busy_secondary, physical_timer)
EXPECT_EQ(io_read32_array(GICD_ISACTIVER, 0), 0);
EXPECT_EQ(io_read32(GICR_ISACTIVER0), 0);
- dlog("Starting timer\n");
- /* Set physical timer for 1 ms and enable. */
- write_msr(CNTP_TVAL_EL0, ns_to_ticks(1000000));
- write_msr(CNTP_CTL_EL0, 0x00000001);
-
/* Let secondary start looping. */
dlog("Telling secondary to loop.\n");
memcpy_s(send_buffer, FFA_MSG_PAYLOAD_MAX, message, sizeof(message));
@@ -135,6 +131,12 @@ TEST(busy_secondary, physical_timer)
ffa_msg_send(HF_PRIMARY_VM_ID, SERVICE_VM1, sizeof(message), 0)
.func,
FFA_SUCCESS_32);
+
+ dlog("Starting timer\n");
+ /* Set physical timer for 3 ms and enable. */
+ write_msr(CNTP_TVAL_EL0, ns_to_ticks(3000000));
+ write_msr(CNTP_CTL_EL0, 0x00000001);
+
run_res = ffa_run(SERVICE_VM1, 0);
EXPECT_EQ(run_res.func, FFA_INTERRUPT_32);