mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-06-19 12:12:16 +00:00
revise type of 'exit_reason' and 'inst_len' in vcpu_arch
SDM 24.9.1 Volume3: - 'Exit reason' field in VMCS is 32 bits. SDM 24.9.4 in Volume3 - 'VM-exit instruction length' field in VMCS is 32 bits. This patch is to redefine the data types of above fields in 'struct vcpu_arch' and udpate the code using these two fields. Signed-off-by: Yonghua Huang <yonghua.huang@intel.com>
This commit is contained in:
parent
96085d960f
commit
11d0e59b3e
@ -1665,9 +1665,9 @@ vie_calculate_gla(enum vm_cpu_mode cpu_mode, enum vm_reg_name seg,
|
||||
}
|
||||
|
||||
void
|
||||
vie_init(struct vie *vie, const char *inst_bytes, int inst_length)
|
||||
vie_init(struct vie *vie, const char *inst_bytes, uint32_t inst_length)
|
||||
{
|
||||
ASSERT(inst_length >= 0 && inst_length <= VIE_INST_SIZE,
|
||||
ASSERT(inst_length <= VIE_INST_SIZE,
|
||||
"%s: invalid instruction length (%d)", __func__, inst_length);
|
||||
|
||||
memset(vie, 0, sizeof(struct vie));
|
||||
|
@ -72,7 +72,7 @@ int vie_calculate_gla(enum vm_cpu_mode cpu_mode, enum vm_reg_name seg,
|
||||
struct seg_desc *desc, uint64_t off, int length, int addrsize, int prot,
|
||||
uint64_t *gla);
|
||||
|
||||
void vie_init(struct vie *vie, const char *inst_bytes, int inst_length);
|
||||
void vie_init(struct vie *vie, const char *inst_bytes, uint32_t inst_length);
|
||||
|
||||
/*
|
||||
* Decode the instruction fetched into 'vie' so it can be emulated.
|
||||
|
@ -136,7 +136,8 @@ int create_vcpu(int cpu_id, struct vm *vm, struct vcpu **rtn_vcpu_handle)
|
||||
|
||||
int start_vcpu(struct vcpu *vcpu)
|
||||
{
|
||||
uint64_t rip, instlen;
|
||||
uint32_t instlen;
|
||||
uint64_t rip;
|
||||
struct run_context *cur_context =
|
||||
&vcpu->arch_vcpu.contexts[vcpu->arch_vcpu.cur_context];
|
||||
int64_t status = 0;
|
||||
|
@ -50,13 +50,12 @@ static void run_vcpu_pre_work(struct vcpu *vcpu)
|
||||
|
||||
void vcpu_thread(struct vcpu *vcpu)
|
||||
{
|
||||
uint64_t vmexit_begin, vmexit_end;
|
||||
uint16_t exit_reason;
|
||||
uint64_t vmexit_begin = 0, vmexit_end = 0;
|
||||
uint16_t basic_exit_reason = 0;
|
||||
uint64_t tsc_aux_hyp_cpu = vcpu->pcpu_id;
|
||||
struct vm_exit_dispatch *vmexit_hdlr;
|
||||
int ret = 0;
|
||||
|
||||
vmexit_begin = vmexit_end = exit_reason = 0;
|
||||
/* If vcpu is not launched, we need to do init_vmcs first */
|
||||
if (!vcpu->launched)
|
||||
init_vmcs(vcpu);
|
||||
@ -87,7 +86,7 @@ void vcpu_thread(struct vcpu *vcpu)
|
||||
|
||||
vmexit_end = rdtsc();
|
||||
if (vmexit_begin > 0)
|
||||
per_cpu(vmexit_time, vcpu->pcpu_id)[exit_reason]
|
||||
per_cpu(vmexit_time, vcpu->pcpu_id)[basic_exit_reason]
|
||||
+= (vmexit_end - vmexit_begin);
|
||||
TRACE_2L(TRACE_VM_ENTER, 0, 0);
|
||||
|
||||
@ -114,12 +113,12 @@ void vcpu_thread(struct vcpu *vcpu)
|
||||
ASSERT(vmexit_hdlr != 0,
|
||||
"Unable to dispatch VM exit handler!");
|
||||
|
||||
exit_reason = vcpu->arch_vcpu.exit_reason & 0xFFFF;
|
||||
per_cpu(vmexit_cnt, vcpu->pcpu_id)[exit_reason]++;
|
||||
TRACE_2L(TRACE_VM_EXIT, exit_reason,
|
||||
basic_exit_reason = vcpu->arch_vcpu.exit_reason & 0xFFFF;
|
||||
per_cpu(vmexit_cnt, vcpu->pcpu_id)[basic_exit_reason]++;
|
||||
TRACE_2L(TRACE_VM_EXIT, basic_exit_reason,
|
||||
vcpu->arch_vcpu.contexts[vcpu->arch_vcpu.cur_context].rip);
|
||||
|
||||
if (exit_reason == VMX_EXIT_REASON_EXTERNAL_INTERRUPT) {
|
||||
if (basic_exit_reason == VMX_EXIT_REASON_EXTERNAL_INTERRUPT) {
|
||||
/* Handling external_interrupt
|
||||
* should disable intr
|
||||
*/
|
||||
|
@ -214,10 +214,10 @@ struct vcpu_arch {
|
||||
uint64_t msr_tsc_aux;
|
||||
|
||||
/* VCPU context state information */
|
||||
uint64_t exit_reason;
|
||||
uint32_t exit_reason;
|
||||
uint64_t exit_interrupt_info;
|
||||
uint64_t exit_qualification;
|
||||
uint8_t inst_len;
|
||||
uint32_t inst_len;
|
||||
|
||||
/* Information related to secondary / AP VCPU start-up */
|
||||
uint8_t cpu_mode;
|
||||
|
Loading…
Reference in New Issue
Block a user