mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-06-22 13:37:10 +00:00
hv: remove the vm loader for UOS in hv.
Now, we make UOS to set BSP init state by using hypercall. We could drop the old UOS loader in HV and make vm loader in HV only for SOS. Tracked-On: #1231 Signed-off-by: Yin Fengwei <fengwei.yin@intel.com> Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
parent
fc575460a3
commit
b454a067be
@ -661,6 +661,7 @@ int prepare_vcpu(struct vm *vm, uint16_t pcpu_id)
|
||||
} else {
|
||||
return -EINVAL;
|
||||
}
|
||||
vm_sw_loader(vm);
|
||||
} else {
|
||||
#ifdef CONFIG_EFI_STUB
|
||||
/* currently non-vm0 will boot kernel directly */
|
||||
@ -670,7 +671,6 @@ int prepare_vcpu(struct vm *vm, uint16_t pcpu_id)
|
||||
#endif
|
||||
}
|
||||
#endif //CONFIG_PARTITION_MODE
|
||||
vm_sw_loader(vm, vcpu);
|
||||
} else {
|
||||
vcpu->arch_vcpu.cpu_mode = CPU_MODE_REAL;
|
||||
}
|
||||
|
@ -304,11 +304,11 @@ int reset_vm(struct vm *vm)
|
||||
|
||||
foreach_vcpu(i, vm, vcpu) {
|
||||
reset_vcpu(vcpu);
|
||||
|
||||
vcpu->arch_vcpu.cpu_mode = CPU_MODE_REAL;
|
||||
if (is_vcpu_bsp(vcpu)) {
|
||||
vm_sw_loader(vm, vcpu);
|
||||
}
|
||||
}
|
||||
|
||||
if (is_vm0(vm)) {
|
||||
vm_sw_loader(vm);
|
||||
}
|
||||
|
||||
vioapic_reset(vm_ioapic(vm));
|
||||
|
@ -36,18 +36,16 @@ void efi_spurious_handler(int vector)
|
||||
return;
|
||||
}
|
||||
|
||||
int uefi_sw_loader(struct vm *vm, struct vcpu *vcpu)
|
||||
int uefi_sw_loader(struct vm *vm)
|
||||
{
|
||||
int ret = 0;
|
||||
struct vcpu *vcpu = get_primary_vcpu(vm);
|
||||
struct acrn_vcpu_regs *vcpu_regs = &vm0_boot_context;
|
||||
|
||||
ASSERT(vm != NULL, "Incorrect argument");
|
||||
|
||||
pr_dbg("Loading guest to run-time location");
|
||||
|
||||
if (!is_vm0(vm))
|
||||
return load_guest(vm, vcpu);
|
||||
|
||||
vlapic_restore(vcpu_vlapic(vcpu), &uefi_lapic_regs);
|
||||
|
||||
/* For UEFI platform, the bsp init regs come from two places:
|
||||
|
@ -85,41 +85,7 @@ static uint64_t create_zero_page(struct vm *vm)
|
||||
return gpa;
|
||||
}
|
||||
|
||||
int load_guest(struct vm *vm, struct vcpu *vcpu)
|
||||
{
|
||||
int32_t ret = 0;
|
||||
void *hva;
|
||||
uint64_t lowmem_gpa_top;
|
||||
|
||||
hva = gpa2hva(vm, GUEST_CFG_OFFSET);
|
||||
lowmem_gpa_top = *(uint64_t *)hva;
|
||||
|
||||
hva = gpa2hva(vm, lowmem_gpa_top -
|
||||
MEM_4K - MEM_2K);
|
||||
vcpu->entry_addr = (void *)(*((uint64_t *)hva));
|
||||
|
||||
if (get_vcpu_mode(vcpu) == CPU_MODE_REAL) {
|
||||
set_bsp_real_mode_entry(vcpu);
|
||||
} else {
|
||||
set_bsp_protect_mode_regs(vcpu);
|
||||
}
|
||||
|
||||
vcpu_set_gpreg(vcpu, CPU_REG_RSI, lowmem_gpa_top - MEM_4K);
|
||||
|
||||
pr_info("%s, Set config according to predefined offset:",
|
||||
__func__);
|
||||
pr_info("VCPU%hu Entry: 0x%llx, RSI: 0x%016llx, cr3: 0x%016llx",
|
||||
vcpu->vcpu_id, vcpu->entry_addr,
|
||||
vcpu_get_gpreg(vcpu, CPU_REG_RSI),
|
||||
vm->arch_vm.guest_init_pml4);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
* @pre vm != NULL
|
||||
*/
|
||||
int general_sw_loader(struct vm *vm, struct vcpu *vcpu)
|
||||
int general_sw_loader(struct vm *vm)
|
||||
{
|
||||
int32_t ret = 0;
|
||||
void *hva;
|
||||
@ -128,17 +94,10 @@ int general_sw_loader(struct vm *vm, struct vcpu *vcpu)
|
||||
struct zero_page *zeropage;
|
||||
struct sw_linux *sw_linux = &(vm->sw.linux_info);
|
||||
struct sw_kernel_info *sw_kernel = &(vm->sw.kernel_info);
|
||||
struct vcpu *vcpu = get_primary_vcpu(vm);
|
||||
|
||||
pr_dbg("Loading guest to run-time location");
|
||||
|
||||
/* ACRN in partiton mode boots all VMs without devicemodel */
|
||||
#ifndef CONFIG_PARTITION_MODE
|
||||
/* FIXME: set config according to predefined offset */
|
||||
if (!is_vm0(vm)) {
|
||||
return load_guest(vm, vcpu);
|
||||
}
|
||||
#endif
|
||||
|
||||
set_vcpu_regs(vcpu, &vm0_boot_context);
|
||||
|
||||
/* calculate the kernel entry point */
|
||||
|
@ -135,10 +135,9 @@ void init_msr_emulation(struct vcpu *vcpu);
|
||||
struct run_context;
|
||||
int vmx_vmrun(struct run_context *context, int ops, int ibrs);
|
||||
|
||||
int load_guest(struct vm *vm, struct vcpu *vcpu);
|
||||
int general_sw_loader(struct vm *vm, struct vcpu *vcpu);
|
||||
int general_sw_loader(struct vm *vm);
|
||||
|
||||
typedef int (*vm_sw_loader_t)(struct vm *vm, struct vcpu *vcpu);
|
||||
typedef int (*vm_sw_loader_t)(struct vm *vm);
|
||||
extern vm_sw_loader_t vm_sw_loader;
|
||||
|
||||
/* @pre Caller(Guest) should make sure gpa is continuous.
|
||||
|
Loading…
Reference in New Issue
Block a user