hv: merge SBL and UEFI related stuff under boot

This patch mainly unifies init_vm_boot_info's implementation between SBL and
UEFI.

Tracked-On: #2708
Signed-off-by: Tw <wei.tan@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
Tw
2019-03-04 13:51:41 +08:00
committed by wenlingz
parent 56d8b08b78
commit 9b24620e16
13 changed files with 29 additions and 19 deletions

View File

@@ -28,6 +28,7 @@
*/
#include <hypervisor.h>
#include <firmware.h>
#include "acpi_priv.h"
#include "acpi.h"

View File

@@ -111,7 +111,7 @@ static void *get_kernel_load_addr(void *kernel_src_addr)
* @pre vm != NULL
* @pre is_sos_vm(vm) == true
*/
int32_t init_vm_boot_info(struct acrn_vm *vm)
int32_t sbl_init_vm_boot_info(struct acrn_vm *vm)
{
struct multiboot_module *mods = NULL;
struct multiboot_info *mbi = NULL;

View File

@@ -7,7 +7,7 @@
#include <hypervisor.h>
#include <multiboot.h>
#include <boot_context.h>
#include <uefi.h>
#include <firmware_uefi.h>
static int32_t uefi_sw_loader(struct acrn_vm *vm)
{
@@ -15,23 +15,23 @@ static int32_t uefi_sw_loader(struct acrn_vm *vm)
/* get primary vcpu */
struct acrn_vcpu *vcpu = vcpu_from_vid(vm, BOOT_CPU_ID);
struct acrn_vcpu_regs *vcpu_regs = &boot_context;
const struct efi_context *efi_ctx = get_efi_ctx();
const struct lapic_regs *uefi_lapic_regs = get_efi_lapic_regs();
const struct uefi_context *uefi_ctx = get_uefi_ctx();
const struct lapic_regs *uefi_lapic_regs = get_uefi_lapic_regs();
pr_dbg("Loading guest to run-time location");
vlapic_restore(vcpu_vlapic(vcpu), uefi_lapic_regs);
/* For UEFI platform, the bsp init regs come from two places:
* 1. saved in efi_boot: gpregs, rip
* 1. saved in uefi_boot: gpregs, rip
* 2. saved when HV started: other registers
* We copy the info saved in efi_boot to boot_context and
* We copy the info saved in uefi_boot to boot_context and
* init bsp with boot_context.
*/
memcpy_s(&(vcpu_regs->gprs), sizeof(struct acrn_gp_regs),
&(efi_ctx->vcpu_regs.gprs), sizeof(struct acrn_gp_regs));
&(uefi_ctx->vcpu_regs.gprs), sizeof(struct acrn_gp_regs));
vcpu_regs->rip = efi_ctx->vcpu_regs.rip;
vcpu_regs->rip = uefi_ctx->vcpu_regs.rip;
set_vcpu_regs(vcpu, vcpu_regs);
/* defer irq enabling till vlapic is ready */
@@ -40,7 +40,7 @@ static int32_t uefi_sw_loader(struct acrn_vm *vm)
return ret;
}
int32_t init_vm_boot_info(__unused struct acrn_vm *vm)
int32_t uefi_init_vm_boot_info(__unused struct acrn_vm *vm)
{
vm_sw_loader = uefi_sw_loader;