mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-06-27 07:46:53 +00:00
HV: Set vm state as with VM_POWERING_OFF when RTVM poweroff by itself
We set the vm state as VM_POWERING_OFF when RTVM is trying to poweroff by itself. We will check it when trying to pause vCPUs of RTVM. Only if vm state equal to VM_POWERING_OFF, we take action to pause the vCPUs of RTVM. Otherwise, we will reject the pause request. Tracked-On: #2865 Signed-off-by: Kaige Fu <kaige.fu@intel.com>
This commit is contained in:
parent
83d11bbff8
commit
8ad5adced7
@ -220,10 +220,16 @@ static bool rt_vm_pm1a_io_read(__unused struct acrn_vm *vm, __unused struct acrn
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool rt_vm_pm1a_io_write(__unused struct acrn_vm *vm, __unused uint16_t addr,
|
||||
__unused size_t width, __unused uint32_t v)
|
||||
static bool rt_vm_pm1a_io_write(struct acrn_vm *vm, uint16_t addr, size_t width, uint32_t v)
|
||||
{
|
||||
/* TODO: Check if the vm is trying to powering off itself */
|
||||
if ((addr != RT_VM_PM1A_CNT_ADDR) || (width != 2U)) {
|
||||
pr_dbg("Invalid address (0x%x) or width (0x%x)", addr, width);
|
||||
} else {
|
||||
if (((v & RT_VM_PM1A_SLP_EN) && (((v & RT_VM_PM1A_SLP_TYP) >> 10U) == 5U)) != 0U) {
|
||||
vm->state = VM_POWERING_OFF;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -88,6 +88,7 @@ enum vm_state {
|
||||
VM_STATE_INVALID = 0,
|
||||
VM_CREATED, /* VM created / awaiting start (boot) */
|
||||
VM_STARTED, /* VM started (booted) */
|
||||
VM_POWERING_OFF, /* RTVM only, it is trying to poweroff by itself */
|
||||
VM_PAUSED, /* VM paused */
|
||||
};
|
||||
|
||||
|
@ -56,6 +56,8 @@
|
||||
|
||||
/* TODO: We may need to get this addr from guest ACPI instead of hardcode here */
|
||||
#define RT_VM_PM1A_CNT_ADDR 0x404U
|
||||
#define RT_VM_PM1A_SLP_TYP 0x1c00U
|
||||
#define RT_VM_PM1A_SLP_EN 0x2000U
|
||||
|
||||
/**
|
||||
* @brief Hypercall
|
||||
|
Loading…
Reference in New Issue
Block a user