refactor: boot ordered vcpu list
Refactor vm_update_boot and vm_get_first_boot to vcpu_update_boot and
vcpu_get_boot_vcpu. Moved the functions from vm to vcpu module and
adapted to use the vcpu interface functions.
Change from building a boot ordered VM list to a vCPU list.
Signed-off-by: Olivier Deprez <olivier.deprez@arm.com>
Change-Id: If29b785d76fef3a94e752705abc003acb5f3cc66
diff --git a/src/main.c b/src/main.c
index 45624e5..4e13667 100644
--- a/src/main.c
+++ b/src/main.c
@@ -20,16 +20,15 @@
*/
struct vcpu *cpu_main(struct cpu *c)
{
- struct vm *first_boot;
+ struct vcpu *boot_vcpu = vcpu_get_boot_vcpu();
struct vcpu *vcpu;
/*
- * This returns the PVM in the normal world and the first
- * booted Secure Partition in the secure world.
+ * 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.
*/
- first_boot = vm_get_first_boot();
-
- vcpu = vm_get_vcpu(first_boot, cpu_index(c));
+ vcpu = vm_get_vcpu(boot_vcpu->vm, cpu_index(c));
vcpu->cpu = c;
@@ -42,7 +41,7 @@
/* Initialize SRI for running core. */
plat_ffa_sri_init(c);
- vm_set_boot_info_gp_reg(first_boot, vcpu);
+ vm_set_boot_info_gp_reg(vcpu->vm, vcpu);
return vcpu;
}