From 14692ef60c5c173d62a0c284eeac1885b75b1d1d Mon Sep 17 00:00:00 2001 From: Mingqiang Chi Date: Wed, 4 Mar 2020 18:00:53 +0800 Subject: [PATCH] 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 Acked-by: Eddie Dong --- hypervisor/arch/x86/guest/pm.c | 2 +- hypervisor/arch/x86/guest/vm.c | 6 +++--- hypervisor/arch/x86/guest/vm_reset.c | 2 +- hypervisor/common/hypercall.c | 2 +- hypervisor/debug/shell.c | 4 ++-- hypervisor/include/arch/x86/guest/vm.h | 4 ++-- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/hypervisor/arch/x86/guest/pm.c b/hypervisor/arch/x86/guest/pm.c index 4827513e7..7f4ec36f1 100644 --- a/hypervisor/arch/x86/guest/pm.c +++ b/hypervisor/arch/x86/guest/pm.c @@ -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); } else { 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; } } diff --git a/hypervisor/arch/x86/guest/vm.c b/hypervisor/arch/x86/guest/vm.c index d7e8e1589..08b9bbc01 100644 --- a/hypervisor/arch/x86/guest/vm.c +++ b/hypervisor/arch/x86/guest/vm.c @@ -623,7 +623,7 @@ void start_vm(struct acrn_vm *vm) { struct acrn_vcpu *bsp = NULL; - vm->state = VM_STARTED; + vm->state = VM_RUNNING; /* Only start BSP (vid = 0) and let BSP start other APs */ 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 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) { 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); - vm->state = VM_STARTED; + vm->state = VM_RUNNING; reset_vcpu(bsp, POWER_ON_RESET); diff --git a/hypervisor/arch/x86/guest/vm_reset.c b/hypervisor/arch/x86/guest/vm_reset.c index 3e93facf1..18964dbf7 100644 --- a/hypervisor/arch/x86/guest/vm_reset.c +++ b/hypervisor/arch/x86/guest/vm_reset.c @@ -90,7 +90,7 @@ static bool handle_common_reset_reg_write(struct acrn_vm *vm, bool reset) ret = false; if (is_rt_vm(vm)) { - vm->state = VM_POWERING_OFF; + vm->state = VM_READY_TO_POWEROFF; } } else { /* diff --git a/hypervisor/common/hypercall.c b/hypervisor/common/hypercall.c index ad7d54d3b..538b343bd 100644 --- a/hypervisor/common/hypercall.c +++ b/hypervisor/common/hypercall.c @@ -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 */ 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) { pr_err("%s: Unable copy param to vm\n", __func__); } else if (vcpu_regs.vcpu_id >= MAX_VCPUS_PER_VM) { diff --git a/hypervisor/debug/shell.c b/hypervisor/debug/shell.c index 7b6e4c5ea..4fc87c0d0 100644 --- a/hypervisor/debug/shell.c +++ b/hypervisor/debug/shell.c @@ -601,8 +601,8 @@ static int32_t shell_list_vm(__unused int32_t argc, __unused char **argv) case VM_CREATED: (void)strncpy_s(state, 32U, "Created", 32U); break; - case VM_STARTED: - (void)strncpy_s(state, 32U, "Started", 32U); + case VM_RUNNING: + (void)strncpy_s(state, 32U, "Running", 32U); break; case VM_PAUSED: (void)strncpy_s(state, 32U, "Paused", 32U); diff --git a/hypervisor/include/arch/x86/guest/vm.h b/hypervisor/include/arch/x86/guest/vm.h index e2da7b0ff..2ddcd56b9 100644 --- a/hypervisor/include/arch/x86/guest/vm.h +++ b/hypervisor/include/arch/x86/guest/vm.h @@ -82,8 +82,8 @@ struct vm_pm_info { enum vm_state { VM_POWERED_OFF = 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_RUNNING, /* VM running */ + VM_READY_TO_POWEROFF, /* RTVM only, it is trying to poweroff by itself */ VM_PAUSED, /* VM paused */ };