feat: power management messages subscription
Move PE cold and warm boot code paths to arch and platform specific
functions. Hypervisor and SPMC implement different flows for PE power
up/down by two flavors of the plat_psci_cpu_resume function.
SPMC leverages vcpu_secondary_reset_and_start when notified by SPMD of a
PE being brought out of reset.
Consume the power management field in partition manifests. For now it
permits entering a partition after warm boot (or restricting it e.g. for
UP SP partitions when queried). If the power management field is omitted
in the manifest, then it defaults to entering the first partition vCPU
on warm boots (legacy behavior maintained for MP SPs).
Provide an early normal world exit path for the SPMC when a partition
doesn't require handling warm reboot events (api_switch_to_other_world
then other_world_exit). Other minor refactorings:
plat_ffa_sri_init is only called by the SPMC on a PE boot up (the
Hypervisor shouldn't have to call it as done currently).
Signed-off-by: Olivier Deprez <olivier.deprez@arm.com>
Change-Id: I144341cd542387214697dfc4ae2f487dd260fe7b
diff --git a/src/main.c b/src/main.c
index 3c14329..6cb2e50 100644
--- a/src/main.c
+++ b/src/main.c
@@ -6,13 +6,7 @@
* https://opensource.org/licenses/BSD-3-Clause.
*/
-#include "hf/arch/plat/ffa.h"
-
#include "hf/cpu.h"
-#include "hf/dlog.h"
-#include "hf/vm.h"
-
-#include "vmapi/hf/ffa.h"
/**
* The entry point of CPUs when they are turned on. It is supposed to initialise
@@ -20,28 +14,5 @@
*/
struct vcpu *cpu_main(struct cpu *c)
{
- struct vcpu *boot_vcpu = vcpu_get_boot_vcpu();
- struct vcpu *vcpu;
-
- /*
- * Get the pinned vCPU from which Hafnium booted.
- * This is the boot vCPU from PVM in the normal world and
- * the first booted Secure Partition in the secure world.
- */
- vcpu = vm_get_vcpu(boot_vcpu->vm, cpu_index(c));
-
- vcpu->cpu = c;
-
- /* Reset the registers to give a clean start for vCPU. */
- vcpu_reset(vcpu);
-
- /* Set the designated GP with the physical core index. */
- vcpu_set_phys_core_idx(vcpu);
-
- /* Initialize SRI for running core. */
- plat_ffa_sri_init(c);
-
- vcpu_set_boot_info_gp_reg(vcpu);
-
- return vcpu;
+ return arch_vcpu_resume(c);
}