FF-A: secondary EC cold boot
When the SPMC boots, all Secure Partitions are initialized
on their primary Execution Context. A Secure Partition calls
FFA_SECONDARY_EP_REGISTER at virtual FF-A instance from
its first EC passing the entry point address for secondary
ECs. A secondary EC is first resumed either upon invocation
of PSCI_CPU_ON from the NWd to which a SP is registered
(currently the first SP) or by ffa_run invocation.
Change-Id: Ic6050af16d4081ca31729744995fbb999b170e11
Signed-off-by: Max Shvetsov <maksims.svecovs@arm.com>
Signed-off-by: Olivier Deprez <olivier.deprez@arm.com>
diff --git a/src/arch/aarch64/hypervisor/psci_handler.c b/src/arch/aarch64/hypervisor/psci_handler.c
index 825ec9f..358c827 100644
--- a/src/arch/aarch64/hypervisor/psci_handler.c
+++ b/src/arch/aarch64/hypervisor/psci_handler.c
@@ -317,6 +317,8 @@
vcpu_id_to_index(target_cpu);
struct vm *vm = vcpu->vm;
struct vcpu *target_vcpu;
+ struct vcpu_locked vcpu_locked;
+ bool vcpu_was_off;
if (target_vcpu_index >= vm->vcpu_count) {
*ret = PSCI_ERROR_INVALID_PARAMETERS;
@@ -324,9 +326,12 @@
}
target_vcpu = vm_get_vcpu(vm, target_vcpu_index);
+ vcpu_locked = vcpu_lock(target_vcpu);
+ vcpu_was_off = vcpu_secondary_reset_and_start(
+ vcpu_locked, entry_point_address, context_id);
+ vcpu_unlock(&vcpu_locked);
- if (vcpu_secondary_reset_and_start(
- target_vcpu, entry_point_address, context_id)) {
+ if (vcpu_was_off) {
/*
* Tell the scheduler that it can start running the new
* vCPU now.