mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-05-03 14:06:54 +00:00
The virtual pm port of RTVM is intercepted by HV. But the HV needs to inform the DM as well. So we will forward the virtual S5 request to DM too The handler in HV just set the pm state flag (VM_POWERING_OFF) which indicate that the RTVM is powering off by itself. Meanwhile, there are data resources in VHM and DM should be released once we handle the PM of RTVM in HV. So, return to DM to go through the entire VM destroy cycles to release the resources. During the cycles, the DM will try to pause vm through hypercall. In the hypercall handler in HV, we will check the pm state flag. If it is set, pause all the vCPUs of the vm. Otherwise, reject the request. In this way, we can make sure that RTVM can only trigger its s5 by itself. All other S5 request from external will be rejected. Here is sequence chart of RTVM s5. poweroff +-----------+ +----------+ +-----------+ +----------+ | vBSP | | vAPs | | HV | | DM | +-----+-----+ +----------+ +-----+-----+ +-----+----+ | | | | | Stop all other cpus | | | +----------------------------+ | | | | |Disable LAPIC | | | +<-+ | | | | | | | +--+ | | | | |HLT in | | | All other cpus stopped | |non-root mode | | +----------------------------+ | | | Call ACPI method to enter s5 | | +-------------------------+---------------------> | | | | Set s5 flag | | | | <---------------------+ | | | APs paused | Re-inject IOREQ TO DM | | +-------------------> +-------------------> + | | | Pause VM | | | Check S5 flag: | <-------------------+ | | - If set, pause vm | VM paused | | | - If no, reject | +-----------------> +--+ | | | Destroy VM | |Deinit works | | | <--------------------<-+ | | | VM destroyed | | | | +-----------------> | + + + + Tracked-On: #2865 Signed-off-by: Kaige Fu <kaige.fu@intel.com>
17 lines
442 B
C
17 lines
442 B
C
/*
|
|
* Copyright (C) 2018 Intel Corporation. All rights reserved.
|
|
*
|
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
*/
|
|
|
|
#ifndef GUEST_PM_H
|
|
#define GUEST_PM_H
|
|
|
|
void vm_setup_cpu_state(struct acrn_vm *vm);
|
|
int32_t vm_load_pm_s_state(struct acrn_vm *vm);
|
|
int32_t validate_pstate(const struct acrn_vm *vm, uint64_t perf_ctl);
|
|
void register_pm1ab_handler(struct acrn_vm *vm);
|
|
void register_rt_vm_pm1a_ctl_handler(struct acrn_vm *vm);
|
|
|
|
#endif /* PM_H */
|