HV: io: refactoring vmexit handler on EPT violation

This is the counterpart to the PIO emulation side.

1. ept_violation_vmexit_handler (entry point for handling vmexit on EPT instruction):

    Extract mmio address, size, direction and value (for write only), fill in an
    I/O request, invoke do_io to handle that and emulate_pio_post for
    post-processing.

2. emulate_io

    Handle the given I/O request, either completed by registered MMIO handlers
    or sent to VHM.

3. emulate_mmio_post:

    Update guest registers after the emulation is done.

v2 -> v3:

    * Rename: emulate_mmio_by_handler -> hv_emulate_mmio.
    * Inline the original hv_emulate_mmio.
    * No longer check alignment. The handlers are responsible for handling
      unaligned accesses.

v1 -> v2:

    * Rename: do_io -> emulate_io.

Signed-off-by: Junjie Mao <junjie.mao@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
Junjie Mao
2018-07-25 05:16:40 +08:00
committed by lijinxia
parent 50e4bc1758
commit b21b172347
3 changed files with 142 additions and 129 deletions

View File

@@ -122,7 +122,10 @@ int register_mmio_emulation_handler(struct vm *vm,
uint64_t end, void *handler_private_data);
void unregister_mmio_emulation_handler(struct vm *vm, uint64_t start,
uint64_t end);
int dm_emulate_mmio_post(struct vcpu *vcpu);
int32_t emulate_mmio_post(struct vcpu *vcpu, struct io_request *io_req);
int32_t dm_emulate_mmio_post(struct vcpu *vcpu);
int32_t emulate_io(struct vcpu *vcpu, struct io_request *io_req);
int32_t acrn_insert_request_wait(struct vcpu *vcpu, struct io_request *req);