mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-09-04 02:14:45 +00:00
hv: implement NEED_SHUTDOWN_VM request to idle thread
For pre-launched VMs and SOS, VM shutdown should not be executed in the current VM context. - implement NEED_SHUTDOWN_VM request so that the BSP of the target VM can shut down the guest in idle thread. - implement shutdown_vm_from_idle() to shut down target VM. Tracked-On: #2700 Signed-off-by: Zide Chen <zide.chen@intel.com> Signed-off-by: Sainath Grandhi <sainath.grandhi@intel.com> Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
19
hypervisor/arch/x86/guest/vm_reset.c
Normal file
19
hypervisor/arch/x86/guest/vm_reset.c
Normal file
@@ -0,0 +1,19 @@
|
||||
/*
|
||||
* Copyright (C) 2019 Intel Corporation. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#include <vm.h>
|
||||
#include <vm_reset.h>
|
||||
#include <per_cpu.h>
|
||||
|
||||
void shutdown_vm_from_idle(uint16_t pcpu_id)
|
||||
{
|
||||
struct acrn_vm *vm = get_vm_from_vmid(per_cpu(shutdown_vm_id, pcpu_id));
|
||||
const struct acrn_vcpu *vcpu = vcpu_from_vid(vm, BOOT_CPU_ID);
|
||||
|
||||
if (vcpu->pcpu_id == pcpu_id) {
|
||||
(void)shutdown_vm(vm);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user