refactor(ffa): change the runtime states of an ..
endpoint execution context based on FF-A v1.1. Allow FFA_RUN from SP.
The various state enumerations defined in the specification along
with few other auxiliary states needed for state transitions, such
as VCPU_STATE_OFF and VCPU_STATE_ABORTED, are described as follows:
/** The vCPU is switched off. */
VCPU_STATE_OFF,
/** The vCPU is currently running. */
VCPU_STATE_RUNNING,
/** The vCPU is waiting to be allocated CPU cycles to do work.*/
VCPU_STATE_WAITING,
/** The vCPU is blocked and waiting for some work to complete
on its behalf. */
VCPU_STATE_BLOCKED,
/** The vCPU has been preempted by an interrupt. */
VCPU_STATE_PREEMPTED,
/** The vCPU is waiting for an interrupt. */
VCPU_STATE_BLOCKED_INTERRUPT,
/** The vCPU has aborted. */
VCPU_STATE_ABORTED,
Moreover, this patch also removes the constraint on FFA_RUN. As per
FF-A v1.1 spec, any SP can invoke FFA_RUN. We leverage this capability
for secure interrupt signal completion in further patches.
Change-Id: I3801b4a053df56a4b5a2803e74d4cbf743ad2678
Signed-off-by: Madhukar Pappireddy <madhukar.pappireddy@arm.com>
diff --git a/src/arch/aarch64/hypervisor/handler.c b/src/arch/aarch64/hypervisor/handler.c
index 587cf95..5e8221e 100644
--- a/src/arch/aarch64/hypervisor/handler.c
+++ b/src/arch/aarch64/hypervisor/handler.c
@@ -328,12 +328,14 @@
current_vm_locked = vm_lock(current->vm);
if (current_vm_locked.vm->initialized == false) {
current_vm_locked.vm->initialized = true;
+ current->is_bootstrapped = true;
dlog_verbose("Initialized VM: %#x, boot_order: %u\n",
current_vm_locked.vm->id,
current_vm_locked.vm->boot_order);
if (current_vm_locked.vm->next_boot != NULL) {
- current->state = VCPU_STATE_BLOCKED_MAILBOX;
+ /* Refer FF-A v1.1 Beta0 section 7.5 Rule 2. */
+ current->state = VCPU_STATE_WAITING;
vm_next = current_vm_locked.vm->next_boot;
CHECK(vm_next->initialized == false);
*next = vm_get_vcpu(vm_next, vcpu_index(current));