Skip to content

Commit 85bec0d

Browse files
fyin1wenlingz
authored andcommitted
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>
1 parent 4f19b3b commit 85bec0d

File tree

2 files changed

+15
-9
lines changed

2 files changed

+15
-9
lines changed

hypervisor/arch/x86/guest/vcpu.c

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -598,14 +598,6 @@ int prepare_vcpu(struct vm *vm, uint16_t pcpu_id)
598598
return ret;
599599
}
600600

601-
if (!vm_sw_loader) {
602-
vm_sw_loader = general_sw_loader;
603-
}
604-
605-
if (is_vm0(vm)) {
606-
vm_sw_loader(vm);
607-
}
608-
609601
/* init_vmcs is delayed to vcpu vmcs launch first time */
610602
/* initialize the vcpu tsc aux */
611603
vcpu->msr_tsc_aux_guest = vcpu->vcpu_id;

hypervisor/arch/x86/guest/vm.c

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ int reset_vm(struct vm *vm)
272272
}
273273

274274
if (is_vm0(vm)) {
275-
vm_sw_loader(vm);
275+
(void )vm_sw_loader(vm);
276276
}
277277

278278
vioapic_reset(vm_ioapic(vm));
@@ -372,6 +372,12 @@ int prepare_vm(uint16_t pcpu_id)
372372
for (i = 1U; i < vm_desc->vm_hw_num_cores; i++)
373373
prepare_vcpu(vm, vm_desc->vm_pcpu_ids[i]);
374374

375+
if (!vm_sw_loader) {
376+
vm_sw_loader = general_sw_loader;
377+
}
378+
379+
(void )vm_sw_loader(vm);
380+
375381
/* start vm BSP automatically */
376382
start_vm(vm);
377383

@@ -407,6 +413,14 @@ int prepare_vm0(void)
407413
}
408414
}
409415

416+
if (!vm_sw_loader) {
417+
vm_sw_loader = general_sw_loader;
418+
}
419+
420+
if (is_vm0(vm)) {
421+
(void )vm_sw_loader(vm);
422+
}
423+
410424
/* start vm0 BSP automatically */
411425
err = start_vm(vm);
412426

0 commit comments

Comments
 (0)