mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2026-06-06 17:21:22 +00:00
HV: io: unify vhm_request req and mem_io in vcpu
The current struct vcpu has two members, namely 'struct vhm_request req' and 'struct mem_io mmio', that hold similar info, including the address, direction, size, value and status of mmio reqeusts. As a step towards a unified framework for both MMIO/PIO, this patch unifies these two members by a tailored version of vhm_reqeust, mostly with the reserved fields dropped. The definitions to request types, directions and process status are reused. Handling errors during emulations will be revisited after the I/O emulation paths are unified. Thus for this patch the mmio.mmio_status in inherited by io_req.processed which is not yet properly processed. Signed-off-by: Junjie Mao <junjie.mao@intel.com> Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
@@ -243,7 +243,7 @@ encode_vmcs_seg_desc(enum cpu_reg_name seg,
|
||||
*
|
||||
*Post Condition:
|
||||
*In the non-general register names group (CPU_REG_CR0~CPU_REG_GDTR),
|
||||
*for register names CPU_REG_CR2, CPU_REG_IDTR and CPU_REG_GDTR,
|
||||
*for register names CPU_REG_CR2, CPU_REG_IDTR and CPU_REG_GDTR,
|
||||
*this function returns VMX_INVALID_VMCS_FIELD;
|
||||
*for other register names, it returns correspoding field index MACROs
|
||||
*in VMCS.
|
||||
@@ -319,7 +319,7 @@ static int mmio_read(struct vcpu *vcpu, __unused uint64_t gpa, uint64_t *rval,
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
*rval = vcpu->mmio.value;
|
||||
*rval = vcpu->req.reqs.mmio.value;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -330,7 +330,7 @@ static int mmio_write(struct vcpu *vcpu, __unused uint64_t gpa, uint64_t wval,
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
vcpu->mmio.value = wval;
|
||||
vcpu->req.reqs.mmio.value = wval;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -375,7 +375,7 @@ int emulate_instruction(struct vcpu *vcpu)
|
||||
struct emul_ctxt *emul_ctxt;
|
||||
struct vm_guest_paging *paging;
|
||||
int retval = 0;
|
||||
uint64_t gpa = vcpu->mmio.paddr;
|
||||
uint64_t gpa = vcpu->req.reqs.mmio.address;
|
||||
mem_region_read_t mread = mmio_read;
|
||||
mem_region_write_t mwrite = mmio_write;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user