mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-09-22 09:17:58 +00:00
HV: refine reset_vcpu api
The patch abstract a vcpu_reset_internal() api for internal usage, the function would not touch any vcpu state transition and just do vcpu reset processing. It will be called by create_vcpu() and reset_vcpu(). The reset_vcpu() will act as a public api and should be called only when vcpu receive INIT or vm reset/resume from S3. It should not be called when do shutdown_vm() or hcall_sos_offline_cpu(), so the patch remove reset_vcpu() in shutdown_vm() and hcall_sos_offline_cpu(). The patch also introduced reset_mode enum so that vcpu and vlapic could do different context operation according to different reset mode; Tracked-On: #4267 Signed-off-by: Victor Sun <victor.sun@intel.com> Reviewed-by: Jason Chen CJ <jason.cj.chen@intel.com> Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
@@ -146,6 +146,7 @@ enum vm_cpu_mode {
|
||||
CPU_MODE_64BIT, /* IA-32E mode (CS.L = 1) */
|
||||
};
|
||||
|
||||
enum reset_mode;
|
||||
|
||||
/* 2 worlds: 0 for Normal World, 1 for Secure World */
|
||||
#define NR_WORLD 2
|
||||
@@ -600,10 +601,11 @@ void offline_vcpu(struct acrn_vcpu *vcpu);
|
||||
* Reset all fields in a vCPU instance, the vCPU state is reset to VCPU_INIT.
|
||||
*
|
||||
* @param[inout] vcpu pointer to vcpu data structure
|
||||
* @param[in] mode the reset mode
|
||||
*
|
||||
* @return None
|
||||
*/
|
||||
void reset_vcpu(struct acrn_vcpu *vcpu);
|
||||
void reset_vcpu(struct acrn_vcpu *vcpu, enum reset_mode mode);
|
||||
|
||||
/**
|
||||
* @brief pause the vcpu and set new state
|
||||
|
@@ -30,6 +30,14 @@
|
||||
#include <hyperv.h>
|
||||
#endif
|
||||
|
||||
enum reset_mode {
|
||||
POWER_ON_RESET, /* reset by hardware Power-on */
|
||||
COLD_RESET, /* hardware cold reset */
|
||||
WARM_RESET, /* behavior slightly differ from cold reset, that some MSRs might be retained. */
|
||||
INIT_RESET, /* reset by INIT */
|
||||
SOFTWARE_RESET, /* reset by software disable<->enable */
|
||||
};
|
||||
|
||||
struct vm_hw_info {
|
||||
/* vcpu array of this VM */
|
||||
struct acrn_vcpu vcpu_array[MAX_VCPUS_PER_VM];
|
||||
|
Reference in New Issue
Block a user