diff --git a/hypervisor/arch/x86/guest/vcpu.c b/hypervisor/arch/x86/guest/vcpu.c index da01e3b6c..4d7751a03 100755 --- a/hypervisor/arch/x86/guest/vcpu.c +++ b/hypervisor/arch/x86/guest/vcpu.c @@ -990,19 +990,6 @@ void vcpu_handle_pi_notification(uint32_t vcpu_index) } } -/* - * @brief Update the state of vCPU and state of vlapic - * - * The vlapic state of VM shall be updated for some vCPU - * state update cases, such as from VCPU_INIT to VCPU_RUNNING. - - * @pre (vcpu != NULL) - */ -void vcpu_set_state(struct acrn_vcpu *vcpu, enum vcpu_state new_state) -{ - vcpu->state = new_state; -} - /* TODO: Our goal is to have a vcpu_thread that is common. * Leave this to future optimization. */ diff --git a/hypervisor/common/vcpu.c b/hypervisor/common/vcpu.c index 964d8ff3d..e73c829f6 100644 --- a/hypervisor/common/vcpu.c +++ b/hypervisor/common/vcpu.c @@ -33,6 +33,19 @@ static void init_vcpu_thread(struct acrn_vcpu *vcpu, uint16_t pcpu_id) init_thread_data(&vcpu->thread_obj, &get_vm_config(vm->vm_id)->sched_params); } +/* + * @brief Update the state of vCPU and state of vlapic + * + * The vlapic state of VM shall be updated for some vCPU + * state update cases, such as from VCPU_INIT to VCPU_RUNNING. + + * @pre (vcpu != NULL) + */ +void vcpu_set_state(struct acrn_vcpu *vcpu, enum vcpu_state new_state) +{ + vcpu->state = new_state; +} + /** * @brief create a vcpu for the target vm * diff --git a/hypervisor/include/arch/x86/asm/guest/vcpu.h b/hypervisor/include/arch/x86/asm/guest/vcpu.h index 57673ea95..c7312bd1a 100644 --- a/hypervisor/include/arch/x86/asm/guest/vcpu.h +++ b/hypervisor/include/arch/x86/asm/guest/vcpu.h @@ -649,16 +649,6 @@ bool is_lapic_pt_enabled(struct acrn_vcpu *vcpu); */ void vcpu_handle_pi_notification(uint32_t vcpu_index); -/* - * @brief Update the state of vCPU and state of vlapic - * - * The vlapic state of VM shall be updated for some vCPU - * state update cases, such as from VCPU_INIT to VCPU_RUNNING. - - * @pre (vcpu != NULL) - */ -void vcpu_set_state(struct acrn_vcpu *vcpu, enum vcpu_state new_state); - /** * @} */ diff --git a/hypervisor/include/common/vcpu.h b/hypervisor/include/common/vcpu.h index 5afd59737..152833bd7 100644 --- a/hypervisor/include/common/vcpu.h +++ b/hypervisor/include/common/vcpu.h @@ -87,6 +87,16 @@ struct guest_mem_dump { uint64_t len; }; +/* + * @brief Update the state of vCPU and state of vlapic + * + * The vlapic state of VM shall be updated for some vCPU + * state update cases, such as from VCPU_INIT to VCPU_RUNNING. + + * @pre (vcpu != NULL) + */ +void vcpu_set_state(struct acrn_vcpu *vcpu, enum vcpu_state new_state); + uint16_t pcpuid_from_vcpu(const struct acrn_vcpu *vcpu); int32_t arch_init_vcpu(struct acrn_vcpu *vcpu);