hv: vcpu: Move launch_vcpu to common scope

Tracked-On: #8830
Signed-off-by: Yifan Liu <yifan1.liu@intel.com>
Reviewed-by: Fei Li <fei1.li@intel.com>
Acked-by: Wang Yu1 <yu1.wang@intel.com>
This commit is contained in:
Yifan Liu
2025-10-20 09:31:31 +00:00
committed by acrnsi-robot
parent 62d07897e2
commit 1a5bc2aae1
4 changed files with 22 additions and 26 deletions

View File

@@ -910,21 +910,6 @@ void arch_context_switch_in(struct thread_object *next)
rstore_xsave_area(vcpu, ectx);
}
/**
* @pre vcpu != NULL
* @pre vcpu->state == VCPU_INIT
*/
void launch_vcpu(struct acrn_vcpu *vcpu)
{
uint16_t pcpu_id = pcpuid_from_vcpu(vcpu);
pr_dbg("vcpu%hu scheduled on pcpu%hu", vcpu->vcpu_id, pcpu_id);
vcpu_set_state(vcpu, VCPU_RUNNING);
wake_thread(&vcpu->thread_obj);
}
/**
* @pre vcpu != NULL
*/

View File

@@ -147,3 +147,14 @@ void destroy_vcpu(struct acrn_vcpu *vcpu)
vcpu_set_state(vcpu, VCPU_OFFLINE);
}
void launch_vcpu(struct acrn_vcpu *vcpu)
{
uint16_t pcpu_id = pcpuid_from_vcpu(vcpu);
pr_dbg("vcpu%hu scheduled on pcpu%hu", vcpu->vcpu_id, pcpu_id);
vcpu_set_state(vcpu, VCPU_RUNNING);
wake_thread(&vcpu->thread_obj);
}

View File

@@ -571,17 +571,6 @@ void reset_vcpu(struct acrn_vcpu *vcpu, enum reset_mode mode);
*/
void zombie_vcpu(struct acrn_vcpu *vcpu, enum vcpu_state new_state);
/**
* @brief set the vcpu to running state, then it will be scheculed.
*
* Adds a vCPU into the run queue and make a reschedule request for it. It sets the vCPU state to VCPU_RUNNING.
*
* @param[inout] vcpu pointer to vcpu data structure
* @pre vcpu != NULL
* @pre vcpu->state == VCPU_INIT
*/
void launch_vcpu(struct acrn_vcpu *vcpu);
/**
* @brief kick the vcpu and let it handle pending events
*

View File

@@ -129,6 +129,17 @@ int32_t create_vcpu(struct acrn_vm *vm, uint16_t pcpu_id);
*/
void destroy_vcpu(struct acrn_vcpu *vcpu);
/**
* @brief set the vcpu to running state, then it will be scheculed.
*
* Adds a vCPU into the run queue and make a reschedule request for it. It sets the vCPU state to VCPU_RUNNING.
*
* @param[inout] vcpu pointer to vcpu data structure
* @pre vcpu != NULL
* @pre vcpu->state == VCPU_INIT
*/
void launch_vcpu(struct acrn_vcpu *vcpu);
/**
* @}
*/