static void vm_suspend_resume(struct vmctx *ctx) { /* * If we get warm reboot request, we don't want to exit the * vcpu_loop/vm_loop/mevent_loop. So we do: * 1. pause VM * 2. flush and clear ioreqs * 3. stop vm watchdog * 4. wait for resume signal * 5. reset vm watchdog * 6. hypercall restart vm */ vm_pause(ctx); vm_clear_ioreq(ctx); vm_stop_watchdog(ctx); wait_for_resume(ctx); pm_backto_wakeup(ctx); vm_reset_watchdog(ctx); vm_reset(ctx); /* set the BSP init state */ vm_set_vcpu_regs(ctx, &ctx->bsp_regs); vm_run(ctx); }
static void vm_system_reset(struct vmctx *ctx) { /* * If we get system reset request, we don't want to exit the * vcpu_loop/vm_loop/mevent_loop. So we do: * 1. pause VM * 2. flush and clear ioreqs * 3. reset virtual devices * 4. load software for UOS * 5. hypercall reset vm * 6. reset suspend mode to VM_SUSPEND_NONE */ vm_pause(ctx); /* * After vm_pause, there should be no new coming ioreq. * * Unless under emergency mode, the vcpu writing to the ACPI PM * CR should be the only vcpu of that VM that is still * running. In this case there should be only one completed * request which is the APIC PM CR write. VM reset will reset it * * When handling emergency mode triggered by one vcpu without * offlining any other vcpus, there can be multiple VHM requests * with various states. We should be careful on potential races * when resetting especially in SMP SOS. vm_clear_ioreq can be used * to clear all ioreq status in VHM after VM pause, then let VM * reset in hypervisor reset all ioreqs. */ vm_clear_ioreq(ctx); vm_reset_vdevs(ctx); vm_reset(ctx); vm_set_suspend_mode(VM_SUSPEND_NONE); /* set the BSP init state */ acrn_sw_load(ctx); vm_set_vcpu_regs(ctx, &ctx->bsp_regs); vm_run(ctx); }
boolean vm_reset_wrap(void* userData) { vm_reset(); return true; }
/** * Resets the SCN 2.0 library. * Called when the app starts a new scene or animation frame. */ int scn20_reset(void) { vm_reset(); return 1; }