feat(scheduled mode): wind call chain for FFA_MSG_SEND_DIRECT_REQ
This patch performs the action of winding the SP call chain upon
FFA_MSG_SEND_DIRECT_REQ invocation.
Change-Id: I139a8d0508d97841aaa8f26c8a1e7a0129901b5e
Signed-off-by: Madhukar Pappireddy <madhukar.pappireddy@arm.com>
diff --git a/src/api.c b/src/api.c
index ceb7934..ab9aa5b 100644
--- a/src/api.c
+++ b/src/api.c
@@ -2599,6 +2599,9 @@
assert(next_state == VCPU_STATE_BLOCKED);
current->state = VCPU_STATE_BLOCKED;
+ plat_ffa_wind_call_chain_ffa_direct_req(vcpus_locked.vcpu2,
+ vcpus_locked.vcpu1);
+
/* Switch to receiver vCPU targeted to by direct msg request */
*next = receiver_vcpu;
diff --git a/src/arch/aarch64/plat/ffa/absent.c b/src/arch/aarch64/plat/ffa/absent.c
index 47db621..6825931 100644
--- a/src/arch/aarch64/plat/ffa/absent.c
+++ b/src/arch/aarch64/plat/ffa/absent.c
@@ -470,3 +470,11 @@
return true;
}
+
+void plat_ffa_wind_call_chain_ffa_direct_req(
+ struct vcpu_locked current_locked,
+ struct vcpu_locked receiver_vcpu_locked)
+{
+ (void)current_locked;
+ (void)receiver_vcpu_locked;
+}
diff --git a/src/arch/aarch64/plat/ffa/hypervisor.c b/src/arch/aarch64/plat/ffa/hypervisor.c
index bc2a359..8ca0321 100644
--- a/src/arch/aarch64/plat/ffa/hypervisor.c
+++ b/src/arch/aarch64/plat/ffa/hypervisor.c
@@ -973,3 +973,12 @@
return false;
}
}
+
+void plat_ffa_wind_call_chain_ffa_direct_req(
+ struct vcpu_locked current_locked,
+ struct vcpu_locked receiver_vcpu_locked)
+{
+ /* Calls chains not supported in the Hypervisor/VMs. */
+ (void)current_locked;
+ (void)receiver_vcpu_locked;
+}
diff --git a/src/arch/aarch64/plat/ffa/spmc.c b/src/arch/aarch64/plat/ffa/spmc.c
index 4a8833f..c1e46da 100644
--- a/src/arch/aarch64/plat/ffa/spmc.c
+++ b/src/arch/aarch64/plat/ffa/spmc.c
@@ -1875,3 +1875,32 @@
return false;
}
+
+/*
+ * Start winding the call chain or continue to wind the present one upon the
+ * invocation of FFA_MSG_SEND_DIRECT_REQ ABI.
+ */
+void plat_ffa_wind_call_chain_ffa_direct_req(
+ struct vcpu_locked current_locked,
+ struct vcpu_locked receiver_vcpu_locked)
+{
+ struct vcpu *current = current_locked.vcpu;
+ struct vcpu *receiver_vcpu = receiver_vcpu_locked.vcpu;
+ ffa_vm_id_t sender_vm_id = current->vm->id;
+
+ CHECK(receiver_vcpu->scheduling_mode == NONE);
+ CHECK(receiver_vcpu->call_chain.prev_node == NULL);
+ CHECK(receiver_vcpu->call_chain.next_node == NULL);
+ CHECK(receiver_vcpu->rt_model == RTM_NONE);
+
+ receiver_vcpu->rt_model = RTM_FFA_DIR_REQ;
+
+ if (!vm_id_is_current_world(sender_vm_id)) {
+ /* Start of NWd scheduled call chain. */
+ receiver_vcpu->scheduling_mode = NWD_MODE;
+ } else {
+ /* Adding a new node to an existing call chain. */
+ vcpu_call_chain_extend(current, receiver_vcpu);
+ receiver_vcpu->scheduling_mode = current->scheduling_mode;
+ }
+}
diff --git a/src/arch/fake/hypervisor/ffa.c b/src/arch/fake/hypervisor/ffa.c
index b5ea9ae..3a9e8dd 100644
--- a/src/arch/fake/hypervisor/ffa.c
+++ b/src/arch/fake/hypervisor/ffa.c
@@ -440,3 +440,12 @@
return true;
}
+
+void plat_ffa_wind_call_chain_ffa_direct_req(
+ struct vcpu_locked current_locked,
+ struct vcpu_locked receiver_vcpu_locked)
+{
+ /* Calls chains not supported in the Hypervisor/VMs. */
+ (void)current_locked;
+ (void)receiver_vcpu_locked;
+}