HV: Refine 'hv_main()' function usage

'hv_main()' wraps several logic which has no dependencies
   each other(enable VMX, prepare to create service os VM..),
   in this case, split this function to make code logic clear.

   remove 'is_vm0_bsp()' & 'hv_main()'
Signed-off-by: Yonghua Huang <yonghua.huang@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
Yonghua Huang
2018-08-03 21:58:02 +08:00
committed by lijinxia
parent 9d9c97d668
commit 2299926a88
5 changed files with 11 additions and 57 deletions

View File

@@ -546,10 +546,11 @@ static void bsp_boot_post(void)
console_setup_timer();
/* Start initializing the VM for this CPU */
if (hv_main(BOOT_CPU_ID) != 0) {
panic("failed to start VM for bsp\n");
}
exec_vmxon_instr(BOOT_CPU_ID);
prepare_vm0();
default_idle();
/* Control should not come here */
cpu_dead(BOOT_CPU_ID);
@@ -621,13 +622,12 @@ static void cpu_secondary_post(void)
/* Wait for boot processor to signal all secondary cores to continue */
pcpu_sync_sleep(&pcpu_sync, 0UL);
ret = hv_main(get_cpu_id());
if (ret != 0) {
panic("hv_main ret = %d\n", ret);
}
exec_vmxon_instr(get_cpu_id());
/* Control will only come here for secondary CPUs not configured for
* use or if an error occurs in hv_main
default_idle();
/* Control will only come here for secondary
* CPUs not configured for use.
*/
cpu_dead(get_cpu_id());
}

View File

@@ -393,7 +393,7 @@ external_interrupt_save_frame:
/*
* We disable softirq path from interrupt IRET, since right now all IRQ
* are for Guest, and we can execute softirq in hv_main() loop
* are for Guest.
*/
popq %rax