mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-09-24 02:08:04 +00:00
hv: add function to return to VM0
Emulate VM0 resume from S3 state: - reset BSP of VM0 - set the BSP entry to saved VM0 wakeup vec and set BSP to real mode - start BSP To match trampoline_spinlock release on ACRN Sx resume path, acquire trampoline_spinlock if ACRN Sx enter fails. Signed-off-by: Yin Fengwei <fengwei.yin@intel.com> Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
@@ -285,6 +285,28 @@ void resume_vm(struct vm *vm)
|
||||
vm->state = VM_STARTED;
|
||||
}
|
||||
|
||||
/* Resume vm from S3 state
|
||||
*
|
||||
* To resume vm after guest enter S3 state:
|
||||
* - reset BSP
|
||||
* - BSP will be put to real mode with entry set as wakeup_vec
|
||||
* - init_vmcs BSP. We could call init_vmcs here because we know current
|
||||
* pcpu is mapped to BSP of vm.
|
||||
*/
|
||||
void resume_vm_from_s3(struct vm *vm, uint32_t wakeup_vec)
|
||||
{
|
||||
struct vcpu *bsp = vcpu_from_vid(vm, 0);
|
||||
|
||||
vm->state = VM_STARTED;
|
||||
|
||||
reset_vcpu(bsp);
|
||||
bsp->entry_addr = (void *)(uint64_t)wakeup_vec;
|
||||
bsp->arch_vcpu.cpu_mode = CPU_MODE_REAL;
|
||||
init_vmcs(bsp);
|
||||
|
||||
schedule_vcpu(bsp);
|
||||
}
|
||||
|
||||
/* Create vm/vcpu for vm0 */
|
||||
int prepare_vm0(void)
|
||||
{
|
||||
|
Reference in New Issue
Block a user