hv: Move the guest_sw_loader() call from vcpu to vm

guest software loading is per VM instead of vcpu. So we move it
from prepare_vcpu to prepare_vm. And make sure it's called for
all VMs for partition mode.

Tracked-On: #1565
Signed-off-by: Yin Fengwei <fengwei.yin@intel.com>
Acked-by: Anthony Xu <anthony.xu@intel.com>
This commit is contained in:
Yin Fengwei 2018-10-23 15:53:23 +08:00 committed by wenlingz
parent 4f19b3b875
commit 85bec0d0d1
2 changed files with 15 additions and 9 deletions

View File

@ -598,14 +598,6 @@ int prepare_vcpu(struct vm *vm, uint16_t pcpu_id)
return ret;
}
if (!vm_sw_loader) {
vm_sw_loader = general_sw_loader;
}
if (is_vm0(vm)) {
vm_sw_loader(vm);
}
/* init_vmcs is delayed to vcpu vmcs launch first time */
/* initialize the vcpu tsc aux */
vcpu->msr_tsc_aux_guest = vcpu->vcpu_id;

View File

@ -272,7 +272,7 @@ int reset_vm(struct vm *vm)
}
if (is_vm0(vm)) {
vm_sw_loader(vm);
(void )vm_sw_loader(vm);
}
vioapic_reset(vm_ioapic(vm));
@ -372,6 +372,12 @@ int prepare_vm(uint16_t pcpu_id)
for (i = 1U; i < vm_desc->vm_hw_num_cores; i++)
prepare_vcpu(vm, vm_desc->vm_pcpu_ids[i]);
if (!vm_sw_loader) {
vm_sw_loader = general_sw_loader;
}
(void )vm_sw_loader(vm);
/* start vm BSP automatically */
start_vm(vm);
@ -407,6 +413,14 @@ int prepare_vm0(void)
}
}
if (!vm_sw_loader) {
vm_sw_loader = general_sw_loader;
}
if (is_vm0(vm)) {
(void )vm_sw_loader(vm);
}
/* start vm0 BSP automatically */
err = start_vm(vm);