hv:cleanup vcpu state

-- remove VCPU_PAUSED and resume_vcpu
-- remove vcpu->prev_state in vcpu structure
-- rename pause_vcpu to zombie_vcpu

Tracked-On: #4320
Signed-off-by: Mingqiang Chi <mingqiang.chi@intel.com>
This commit is contained in:
Mingqiang Chi
2020-05-19 15:59:51 +08:00
committed by wenlingz
parent 8287cfac6c
commit f994b5ffaf
8 changed files with 12 additions and 47 deletions

View File

@@ -136,7 +136,6 @@ enum vcpu_state {
VCPU_OFFLINE = 0U,
VCPU_INIT,
VCPU_RUNNING,
VCPU_PAUSED,
VCPU_ZOMBIE,
};
@@ -256,8 +255,6 @@ struct acrn_vcpu {
uint16_t vcpu_id; /* virtual identifier for VCPU */
struct acrn_vm *vm; /* Reference to the VM this VCPU belongs to */
/* State of this VCPU before suspend */
volatile enum vcpu_state prev_state;
volatile enum vcpu_state state; /* State of this VCPU */
struct thread_object thread_obj;
@@ -634,25 +631,14 @@ void reset_vcpu(struct acrn_vcpu *vcpu, enum reset_mode mode);
/**
* @brief pause the vcpu and set new state
*
* Change a vCPU state to VCPU_PAUSED or VCPU_ZOMBIE, and make a reschedule request for it.
* Change a vCPU state to VCPU_ZOMBIE, and make a reschedule request for it.
*
* @param[inout] vcpu pointer to vcpu data structure
* @param[in] new_state the state to set vcpu
*
* @return None
*/
void pause_vcpu(struct acrn_vcpu *vcpu, enum vcpu_state new_state);
/**
* @brief resume the vcpu
*
* Change a vCPU state to VCPU_RUNNING, and make a reschedule request for it.
*
* @param[inout] vcpu pointer to vcpu data structure
*
* @return 0 on success, -1 on failure.
*/
int32_t resume_vcpu(struct acrn_vcpu *vcpu);
void zombie_vcpu(struct acrn_vcpu *vcpu, enum vcpu_state new_state);
/**
* @brief set the vcpu to running state, then it will be scheculed.