mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-11-17 15:44:32 +00:00
This commit moves struct acrn_vm under common header vm.h, and move some x86-specific members of struct acrn_vm into arch_vm. This commit focuses on struct cleanup only. API cleanup will be in future patch series. The affected members are: e820_entry_num e820_entries wire_mode wbinvd_lock vlapic_mode_lock vcpuid_entry_nr vcpuid_level vcpuid_xlevel vcpuid_entries reset_control pm sworld_control sworld_snapshot intr_inject_delay_delta Moved to common vm.h: ept_lock -> rename to stg2pt_lock ept_pgtable -> rename to stg2_pgtable nworld_eptp -> rename to root_stg2ptp emul_mmio_lock nr_emul_mmio_regions emul_mmio emul_pio To avoid circular dependency, some in-header helpers are also moved into common vm.h. Tracked-On: #8830 Signed-off-by: Yifan Liu <yifan1.liu@intel.com> Reviewed-by: Fei Li <fei1.li@intel.com> Acked-by: Wang Yu1 <yu1.wang@intel.com>
47 lines
1.3 KiB
C
47 lines
1.3 KiB
C
/*
|
|
* Copyright (C) 2021-2022 Intel Corporation.
|
|
*
|
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
*/
|
|
|
|
#include <vm.h>
|
|
#include <vboot.h>
|
|
|
|
/**
|
|
* @pre vm != NULL
|
|
*/
|
|
static void load_rawimage(struct acrn_vm *vm)
|
|
{
|
|
struct sw_kernel_info *sw_kernel = &(vm->sw.kernel_info);
|
|
const struct acrn_vm_config *vm_config = get_vm_config(vm->vm_id);
|
|
uint64_t kernel_load_gpa;
|
|
|
|
/* TODO: GPA 0 load support */
|
|
kernel_load_gpa = vm_config->os_config.kernel_load_addr;
|
|
|
|
/* Copy the guest kernel image to its run-time location */
|
|
(void)copy_to_gpa(vm, sw_kernel->kernel_src_addr, kernel_load_gpa, sw_kernel->kernel_size);
|
|
|
|
sw_kernel->kernel_entry_addr = (void *)vm_config->os_config.kernel_entry_addr;
|
|
}
|
|
|
|
int32_t rawimage_loader(struct acrn_vm *vm)
|
|
{
|
|
int32_t ret = 0;
|
|
uint64_t vgdt_gpa = 0x800;
|
|
|
|
/*
|
|
* TODO:
|
|
* - We need to initialize the guest BSP(boot strap processor) registers according to
|
|
* guest boot mode (real mode vs protect mode)
|
|
* - The memory layout usage is unclear, only GDT might be needed as its boot param.
|
|
* currently we only support Zephyr which has no needs on cmdline/e820/efimmap/etc.
|
|
* hardcode the vGDT GPA to 0x800 where is not used by Zephyr so far;
|
|
*/
|
|
init_vcpu_protect_mode_regs(vcpu_from_vid(vm, BSP_CPU_ID), vgdt_gpa);
|
|
|
|
load_rawimage(vm);
|
|
|
|
return ret;
|
|
}
|