refactor: pass boot information blob to vCPU
Rename vm_set_boot_info_gp_reg to vcpu_set_boot_info_gp_reg and get
only the vCPU as parameter.
Signed-off-by: Olivier Deprez <olivier.deprez@arm.com>
Change-Id: I4b32205e32b971356e7f54936ec91dc716168dae
diff --git a/src/arch/aarch64/plat/ffa/spmc.c b/src/arch/aarch64/plat/ffa/spmc.c
index 4e9f684..e61d7cd 100644
--- a/src/arch/aarch64/plat/ffa/spmc.c
+++ b/src/arch/aarch64/plat/ffa/spmc.c
@@ -2025,7 +2025,7 @@
vcpu_next->state = VCPU_STATE_RUNNING;
vcpu_next->regs_available = false;
vcpu_set_phys_core_idx(vcpu_next);
- vm_set_boot_info_gp_reg(vcpu_next->vm, vcpu_next);
+ vcpu_set_boot_info_gp_reg(vcpu_next);
*next = vcpu_next;
diff --git a/src/main.c b/src/main.c
index 4e13667..3c14329 100644
--- a/src/main.c
+++ b/src/main.c
@@ -41,7 +41,7 @@
/* Initialize SRI for running core. */
plat_ffa_sri_init(c);
- vm_set_boot_info_gp_reg(vcpu->vm, vcpu);
+ vcpu_set_boot_info_gp_reg(vcpu);
return vcpu;
}
diff --git a/src/vcpu.c b/src/vcpu.c
index 37561a7..1875974 100644
--- a/src/vcpu.c
+++ b/src/vcpu.c
@@ -213,6 +213,22 @@
}
/**
+ * Sets the designated GP register through which the vCPU expects to receive the
+ * boot info's address.
+ */
+void vcpu_set_boot_info_gp_reg(struct vcpu *vcpu)
+{
+ struct vm *vm = vcpu->vm;
+ uint32_t gp_register_num = vm->boot_info.gp_register_num;
+
+ if (vm->boot_info.blob_addr.ipa != 0U) {
+ arch_regs_set_gp_reg(&vcpu->regs,
+ ipa_addr(vm->boot_info.blob_addr),
+ gp_register_num);
+ }
+}
+
+/**
* Gets the first partition to boot, according to Boot Protocol from FFA spec.
*/
struct vcpu *vcpu_get_boot_vcpu(void)