hv:Rename two VM states

Rename:
  VM_STARTED --> VM_RUNNING
  VM_POWERING_OFF --> VM_READY_TO_POWEROFF

Tracked-On: #4320
Signed-off-by: Mingqiang Chi <mingqiang.chi@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
Mingqiang Chi 2020-03-04 18:00:53 +08:00 committed by wenlingz
parent a5f9ef402e
commit 14692ef60c
6 changed files with 10 additions and 10 deletions

View File

@ -282,7 +282,7 @@ static bool rt_vm_pm1a_io_write(struct acrn_vcpu *vcpu, uint16_t addr, size_t wi
pr_dbg("Invalid address (0x%x) or width (0x%x)", addr, width); pr_dbg("Invalid address (0x%x) or width (0x%x)", addr, width);
} else { } else {
if ((((v & VIRTUAL_PM1A_SLP_EN) != 0U) && (((v & VIRTUAL_PM1A_SLP_TYP) >> 10U) == 5U)) != 0U) { if ((((v & VIRTUAL_PM1A_SLP_EN) != 0U) && (((v & VIRTUAL_PM1A_SLP_TYP) >> 10U) == 5U)) != 0U) {
vcpu->vm->state = VM_POWERING_OFF; vcpu->vm->state = VM_READY_TO_POWEROFF;
} }
} }

View File

@ -623,7 +623,7 @@ void start_vm(struct acrn_vm *vm)
{ {
struct acrn_vcpu *bsp = NULL; struct acrn_vcpu *bsp = NULL;
vm->state = VM_STARTED; vm->state = VM_RUNNING;
/* Only start BSP (vid = 0) and let BSP start other APs */ /* Only start BSP (vid = 0) and let BSP start other APs */
bsp = vcpu_from_vid(vm, BSP_CPU_ID); bsp = vcpu_from_vid(vm, BSP_CPU_ID);
@ -687,7 +687,7 @@ void pause_vm(struct acrn_vm *vm)
* - It is powering off by itself * - It is powering off by itself
* - It is created but doesn't start * - It is created but doesn't start
*/ */
if ((vm->state == VM_POWERING_OFF) || (vm->state == VM_CREATED)) { if ((vm->state == VM_READY_TO_POWEROFF) || (vm->state == VM_CREATED)) {
foreach_vcpu(i, vm, vcpu) { foreach_vcpu(i, vm, vcpu) {
pause_vcpu(vcpu, VCPU_ZOMBIE); pause_vcpu(vcpu, VCPU_ZOMBIE);
} }
@ -722,7 +722,7 @@ void resume_vm_from_s3(struct acrn_vm *vm, uint32_t wakeup_vec)
{ {
struct acrn_vcpu *bsp = vcpu_from_vid(vm, BSP_CPU_ID); struct acrn_vcpu *bsp = vcpu_from_vid(vm, BSP_CPU_ID);
vm->state = VM_STARTED; vm->state = VM_RUNNING;
reset_vcpu(bsp, POWER_ON_RESET); reset_vcpu(bsp, POWER_ON_RESET);

View File

@ -90,7 +90,7 @@ static bool handle_common_reset_reg_write(struct acrn_vm *vm, bool reset)
ret = false; ret = false;
if (is_rt_vm(vm)) { if (is_rt_vm(vm)) {
vm->state = VM_POWERING_OFF; vm->state = VM_READY_TO_POWEROFF;
} }
} else { } else {
/* /*

View File

@ -313,7 +313,7 @@ int32_t hcall_set_vcpu_regs(struct acrn_vm *vm, uint16_t vmid, uint64_t param)
/* Only allow setup init ctx while target_vm is inactive */ /* Only allow setup init ctx while target_vm is inactive */
if ((!is_poweroff_vm(target_vm)) && (param != 0U) && (is_postlaunched_vm(target_vm)) && if ((!is_poweroff_vm(target_vm)) && (param != 0U) && (is_postlaunched_vm(target_vm)) &&
(target_vm->state != VM_STARTED)) { (target_vm->state != VM_RUNNING)) {
if (copy_from_gpa(vm, &vcpu_regs, param, sizeof(vcpu_regs)) != 0) { if (copy_from_gpa(vm, &vcpu_regs, param, sizeof(vcpu_regs)) != 0) {
pr_err("%s: Unable copy param to vm\n", __func__); pr_err("%s: Unable copy param to vm\n", __func__);
} else if (vcpu_regs.vcpu_id >= MAX_VCPUS_PER_VM) { } else if (vcpu_regs.vcpu_id >= MAX_VCPUS_PER_VM) {

View File

@ -601,8 +601,8 @@ static int32_t shell_list_vm(__unused int32_t argc, __unused char **argv)
case VM_CREATED: case VM_CREATED:
(void)strncpy_s(state, 32U, "Created", 32U); (void)strncpy_s(state, 32U, "Created", 32U);
break; break;
case VM_STARTED: case VM_RUNNING:
(void)strncpy_s(state, 32U, "Started", 32U); (void)strncpy_s(state, 32U, "Running", 32U);
break; break;
case VM_PAUSED: case VM_PAUSED:
(void)strncpy_s(state, 32U, "Paused", 32U); (void)strncpy_s(state, 32U, "Paused", 32U);

View File

@ -82,8 +82,8 @@ struct vm_pm_info {
enum vm_state { enum vm_state {
VM_POWERED_OFF = 0, VM_POWERED_OFF = 0,
VM_CREATED, /* VM created / awaiting start (boot) */ VM_CREATED, /* VM created / awaiting start (boot) */
VM_STARTED, /* VM started (booted) */ VM_RUNNING, /* VM running */
VM_POWERING_OFF, /* RTVM only, it is trying to poweroff by itself */ VM_READY_TO_POWEROFF, /* RTVM only, it is trying to poweroff by itself */
VM_PAUSED, /* VM paused */ VM_PAUSED, /* VM paused */
}; };