refactor(ff-a): interrupts
Some functions from `src/ffa/{hypervisor,spmc}.c` were missed in the
refactoring.
Move them to `src/ffa/{hypervisor,spmc}/interrupts.c`.
Change-Id: I97b80ce613964e43f58f52e8a9cff57cf63fedff
Signed-off-by: Karl Meakin <karl.meakin@arm.com>
diff --git a/src/ffa/hypervisor.c b/src/ffa/hypervisor.c
index cfb6916..1b87bca 100644
--- a/src/ffa/hypervisor.c
+++ b/src/ffa/hypervisor.c
@@ -117,17 +117,6 @@
dlog_verbose("TEE finished setting up buffers.\n");
}
-bool ffa_interrupts_intercept_call(struct vcpu_locked current_locked,
- struct vcpu_locked next_locked,
- struct ffa_value *signal_interrupt)
-{
- (void)current_locked;
- (void)next_locked;
- (void)signal_interrupt;
-
- return false;
-}
-
bool plat_ffa_is_spmd_lp_id(ffa_id_t vm_id)
{
(void)vm_id;
diff --git a/src/ffa/hypervisor/interrupts.c b/src/ffa/hypervisor/interrupts.c
index 21d89ed..9bae658 100644
--- a/src/ffa/hypervisor/interrupts.c
+++ b/src/ffa/hypervisor/interrupts.c
@@ -56,3 +56,14 @@
{
return api_interrupt_get(current_locked);
}
+
+bool ffa_interrupts_intercept_call(struct vcpu_locked current_locked,
+ struct vcpu_locked next_locked,
+ struct ffa_value *signal_interrupt)
+{
+ (void)current_locked;
+ (void)next_locked;
+ (void)signal_interrupt;
+
+ return false;
+}
diff --git a/src/ffa/spmc.c b/src/ffa/spmc.c
index b976f17..6d28b77 100644
--- a/src/ffa/spmc.c
+++ b/src/ffa/spmc.c
@@ -92,61 +92,6 @@
plat_interrupts_set_priority_mask(current->prev_interrupt_priority);
}
-/**
- * Run the vCPU in SPMC schedule mode under the runtime model for secure
- * interrupt handling.
- */
-static void plat_ffa_run_in_sec_interrupt_rtm(
- struct vcpu_locked target_vcpu_locked)
-{
- struct vcpu *target_vcpu;
-
- target_vcpu = target_vcpu_locked.vcpu;
-
- /* Mark the registers as unavailable now. */
- target_vcpu->regs_available = false;
- target_vcpu->scheduling_mode = SPMC_MODE;
- target_vcpu->rt_model = RTM_SEC_INTERRUPT;
- target_vcpu->state = VCPU_STATE_RUNNING;
- target_vcpu->requires_deactivate_call = false;
-}
-
-bool ffa_interrupts_intercept_call(struct vcpu_locked current_locked,
- struct vcpu_locked next_locked,
- struct ffa_value *signal_interrupt)
-{
- uint32_t intid;
-
- /*
- * Check if there are any pending virtual secure interrupts to be
- * handled.
- */
- if (vcpu_interrupt_queue_peek(current_locked, &intid)) {
- /*
- * Prepare to signal virtual secure interrupt to S-EL0/S-EL1 SP
- * in WAITING state. Refer to FF-A v1.2 Table 9.1 and Table 9.2
- * case 1.
- */
- *signal_interrupt = api_ffa_interrupt_return(intid);
-
- /*
- * Prepare to resume this partition's vCPU in SPMC
- * schedule mode to handle virtual secure interrupt.
- */
- plat_ffa_run_in_sec_interrupt_rtm(current_locked);
-
- current_locked.vcpu->preempted_vcpu = next_locked.vcpu;
- next_locked.vcpu->state = VCPU_STATE_PREEMPTED;
-
- dlog_verbose("%s: Pending interrup, intercepting FF-A call.\n",
- __func__);
-
- return true;
- }
-
- return false;
-}
-
/*
* Start winding the call chain or continue to wind the present one upon the
* invocation of FFA_MSG_SEND_DIRECT_REQ or FFA_MSG_SEND_DIRECT_REQ2 (FF-A v1.2)
diff --git a/src/ffa/spmc/interrupts.c b/src/ffa/spmc/interrupts.c
index 43ad349..4983e25 100644
--- a/src/ffa/spmc/interrupts.c
+++ b/src/ffa/spmc/interrupts.c
@@ -889,3 +889,58 @@
return api_interrupt_get(current_locked);
}
+
+/**
+ * Run the vCPU in SPMC schedule mode under the runtime model for secure
+ * interrupt handling.
+ */
+static void plat_ffa_run_in_sec_interrupt_rtm(
+ struct vcpu_locked target_vcpu_locked)
+{
+ struct vcpu *target_vcpu;
+
+ target_vcpu = target_vcpu_locked.vcpu;
+
+ /* Mark the registers as unavailable now. */
+ target_vcpu->regs_available = false;
+ target_vcpu->scheduling_mode = SPMC_MODE;
+ target_vcpu->rt_model = RTM_SEC_INTERRUPT;
+ target_vcpu->state = VCPU_STATE_RUNNING;
+ target_vcpu->requires_deactivate_call = false;
+}
+
+bool ffa_interrupts_intercept_call(struct vcpu_locked current_locked,
+ struct vcpu_locked next_locked,
+ struct ffa_value *signal_interrupt)
+{
+ uint32_t intid;
+
+ /*
+ * Check if there are any pending virtual secure interrupts to be
+ * handled.
+ */
+ if (vcpu_interrupt_queue_peek(current_locked, &intid)) {
+ /*
+ * Prepare to signal virtual secure interrupt to S-EL0/S-EL1 SP
+ * in WAITING state. Refer to FF-A v1.2 Table 9.1 and Table 9.2
+ * case 1.
+ */
+ *signal_interrupt = api_ffa_interrupt_return(intid);
+
+ /*
+ * Prepare to resume this partition's vCPU in SPMC
+ * schedule mode to handle virtual secure interrupt.
+ */
+ plat_ffa_run_in_sec_interrupt_rtm(current_locked);
+
+ current_locked.vcpu->preempted_vcpu = next_locked.vcpu;
+ next_locked.vcpu->state = VCPU_STATE_PREEMPTED;
+
+ dlog_verbose("%s: Pending interrup, intercepting FF-A call.\n",
+ __func__);
+
+ return true;
+ }
+
+ return false;
+}