ioreq: only clear vcpu->req when io request needed

Signed-off-by: Jason Chen CJ <jason.cj.chen@intel.com>
This commit is contained in:
Jason Chen CJ 2018-03-21 21:15:38 +08:00 committed by Anthony Xu
parent 65233802f0
commit 95b6661540
2 changed files with 3 additions and 4 deletions

View File

@ -416,8 +416,6 @@ int ept_violation_handler(struct vcpu *vcpu)
/* Handle page fault from guest */
exit_qual = vcpu->arch_vcpu.exit_qualification;
memset(&vcpu->req, 0, sizeof(struct vhm_request));
/* Specify if read or write operation */
if (exit_qual & 0x2) {
/* Write operation */
@ -486,6 +484,8 @@ int ept_violation_handler(struct vcpu *vcpu)
* instruction emulation. For MMIO read, ask DM to run MMIO
* emulation at first.
*/
memset(&vcpu->req, 0, sizeof(struct vhm_request));
status = dm_emulate_mmio_pre(vcpu, exit_qual);
if (status != 0)
goto out;

View File

@ -103,8 +103,6 @@ int io_instr_handler(struct vcpu *vcpu)
direction = VM_EXIT_IO_INSTRUCTION_ACCESS_DIRECTION(exit_qual);
mask = 0xfffffffful >> (32 - 8 * sz);
memset(&vcpu->req, 0, sizeof(struct vhm_request));
TRACE_4I(TRC_VMEXIT_IO_INSTRUCTION, port, direction, sz,
cur_context_idx);
@ -149,6 +147,7 @@ int io_instr_handler(struct vcpu *vcpu)
if (status != 0) {
uint64_t *rax = &cur_context->guest_cpu_regs.regs.rax;
memset(&vcpu->req, 0, sizeof(struct vhm_request));
dm_emulate_pio_pre(vcpu, exit_qual, sz, *rax);
status = acrn_insert_request_wait(vcpu, &vcpu->req);
}