HV: rename 'type' in struct io_request

Rename 'type' in struct io_request to 'io_type' to be more readable.

Tracked-On: #3061
Signed-off-by: Conghui Chen <conghui.chen@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
Conghui Chen 2019-05-06 14:43:27 +08:00 committed by wenlingz
parent 94e1e362fb
commit dd86a78e75
4 changed files with 19 additions and 19 deletions

View File

@ -35,7 +35,7 @@ void arch_fire_vhm_interrupt(void)
/** /**
* @brief General complete-work for port I/O emulation * @brief General complete-work for port I/O emulation
* *
* @pre io_req->type == REQ_PORTIO * @pre io_req->io_type == REQ_PORTIO
* *
* @remark This function must be called when \p io_req is completed, after * @remark This function must be called when \p io_req is completed, after
* either a previous call to emulate_io() returning 0 or the corresponding VHM * either a previous call to emulate_io() returning 0 or the corresponding VHM
@ -73,7 +73,7 @@ int32_t pio_instr_vmexit_handler(struct acrn_vcpu *vcpu)
exit_qual = vcpu->arch.exit_qualification; exit_qual = vcpu->arch.exit_qualification;
io_req->type = REQ_PORTIO; io_req->io_type = REQ_PORTIO;
pio_req->size = vm_exit_io_instruction_size(exit_qual) + 1UL; pio_req->size = vm_exit_io_instruction_size(exit_qual) + 1UL;
pio_req->address = vm_exit_io_instruction_port_number(exit_qual); pio_req->address = vm_exit_io_instruction_port_number(exit_qual);
if (vm_exit_io_instruction_access_direction(exit_qual) == 0UL) { if (vm_exit_io_instruction_access_direction(exit_qual) == 0UL) {
@ -106,7 +106,7 @@ int32_t ept_violation_vmexit_handler(struct acrn_vcpu *vcpu)
/* Handle page fault from guest */ /* Handle page fault from guest */
exit_qual = vcpu->arch.exit_qualification; exit_qual = vcpu->arch.exit_qualification;
io_req->type = REQ_MMIO; io_req->io_type = REQ_MMIO;
/* Specify if read or write operation */ /* Specify if read or write operation */
if ((exit_qual & 0x2UL) != 0UL) { if ((exit_qual & 0x2UL) != 0UL) {
@ -116,7 +116,7 @@ int32_t ept_violation_vmexit_handler(struct acrn_vcpu *vcpu)
/* XXX: write access while EPT perm RX -> WP */ /* XXX: write access while EPT perm RX -> WP */
if ((exit_qual & 0x38UL) == 0x28UL) { if ((exit_qual & 0x38UL) == 0x28UL) {
io_req->type = REQ_WP; io_req->io_type = REQ_WP;
} }
} else { } else {
/* Read operation */ /* Read operation */

View File

@ -96,7 +96,7 @@ int32_t acrn_insert_request(struct acrn_vcpu *vcpu, const struct io_request *io_
stac(); stac();
vhm_req = &req_buf->req_queue[cur]; vhm_req = &req_buf->req_queue[cur];
/* ACRN insert request to VHM and inject upcall */ /* ACRN insert request to VHM and inject upcall */
vhm_req->type = io_req->type; vhm_req->type = io_req->io_type;
(void)memcpy_s(&vhm_req->reqs, sizeof(union vhm_io_request), (void)memcpy_s(&vhm_req->reqs, sizeof(union vhm_io_request),
&io_req->reqs, sizeof(union vhm_io_request)); &io_req->reqs, sizeof(union vhm_io_request));
if (vcpu->vm->sw.is_completion_polling) { if (vcpu->vm->sw.is_completion_polling) {
@ -205,7 +205,7 @@ uint32_t get_vhm_notification_vector(void)
* @param vcpu The virtual CPU that triggers the MMIO access * @param vcpu The virtual CPU that triggers the MMIO access
* @param io_req The I/O request holding the details of the MMIO access * @param io_req The I/O request holding the details of the MMIO access
* *
* @pre io_req->type == REQ_MMIO * @pre io_req->io_type == REQ_MMIO
* *
* @remark This function must be called when \p io_req is completed, after * @remark This function must be called when \p io_req is completed, after
* either a previous call to emulate_io() returning 0 or the corresponding VHM * either a previous call to emulate_io() returning 0 or the corresponding VHM
@ -231,7 +231,7 @@ static void complete_ioreq(struct acrn_vcpu *vcpu, struct io_request *io_req)
stac(); stac();
vhm_req = &req_buf->req_queue[vcpu->vcpu_id]; vhm_req = &req_buf->req_queue[vcpu->vcpu_id];
if (io_req != NULL) { if (io_req != NULL) {
switch (vcpu->req.type) { switch (vcpu->req.io_type) {
case REQ_PORTIO: case REQ_PORTIO:
io_req->reqs.pio.value = vhm_req->reqs.pio.value; io_req->reqs.pio.value = vhm_req->reqs.pio.value;
break; break;
@ -252,7 +252,7 @@ static void complete_ioreq(struct acrn_vcpu *vcpu, struct io_request *io_req)
/** /**
* @brief Complete-work of VHM requests for port I/O emulation * @brief Complete-work of VHM requests for port I/O emulation
* *
* @pre vcpu->req.type == REQ_PORTIO * @pre vcpu->req.io_type == REQ_PORTIO
* *
* @remark This function must be called after the VHM request corresponding to * @remark This function must be called after the VHM request corresponding to
* \p vcpu being transferred to the COMPLETE state. * \p vcpu being transferred to the COMPLETE state.
@ -271,7 +271,7 @@ static void dm_emulate_pio_complete(struct acrn_vcpu *vcpu)
* *
* @param vcpu The virtual CPU that triggers the MMIO access * @param vcpu The virtual CPU that triggers the MMIO access
* *
* @pre vcpu->req.type == REQ_MMIO * @pre vcpu->req.io_type == REQ_MMIO
* *
* @remark This function must be called after the VHM request corresponding to * @remark This function must be called after the VHM request corresponding to
* \p vcpu being transferred to the COMPLETE state. * \p vcpu being transferred to the COMPLETE state.
@ -300,7 +300,7 @@ static void dm_emulate_io_complete(struct acrn_vcpu *vcpu)
if (vcpu->state == VCPU_ZOMBIE) { if (vcpu->state == VCPU_ZOMBIE) {
complete_ioreq(vcpu, NULL); complete_ioreq(vcpu, NULL);
} else { } else {
switch (vcpu->req.type) { switch (vcpu->req.io_type) {
case REQ_MMIO: case REQ_MMIO:
dm_emulate_mmio_complete(vcpu); dm_emulate_mmio_complete(vcpu);
break; break;
@ -385,7 +385,7 @@ static int32_t mmio_default_access_handler(struct io_request *io_req,
* Try handling the given request by any port I/O handler registered in the * Try handling the given request by any port I/O handler registered in the
* hypervisor. * hypervisor.
* *
* @pre io_req->type == REQ_PORTIO * @pre io_req->io_type == REQ_PORTIO
* *
* @retval 0 Successfully emulated by registered handlers. * @retval 0 Successfully emulated by registered handlers.
* @retval -ENODEV No proper handler found. * @retval -ENODEV No proper handler found.
@ -444,7 +444,7 @@ hv_emulate_pio(struct acrn_vcpu *vcpu, struct io_request *io_req)
* Use registered MMIO handlers on the given request if it falls in the range of * Use registered MMIO handlers on the given request if it falls in the range of
* any of them. * any of them.
* *
* @pre io_req->type == REQ_MMIO * @pre io_req->io_type == REQ_MMIO
* *
* @retval 0 Successfully emulated by registered handlers. * @retval 0 Successfully emulated by registered handlers.
* @retval -ENODEV No proper handler found. * @retval -ENODEV No proper handler found.
@ -514,7 +514,7 @@ hv_emulate_mmio(struct acrn_vcpu *vcpu, struct io_request *io_req)
* @retval 0 Successfully emulated by registered handlers. * @retval 0 Successfully emulated by registered handlers.
* @retval IOREQ_PENDING The I/O request is delivered to VHM. * @retval IOREQ_PENDING The I/O request is delivered to VHM.
* @retval -EIO The request spans multiple devices and cannot be emulated. * @retval -EIO The request spans multiple devices and cannot be emulated.
* @retval -EINVAL \p io_req has an invalid type. * @retval -EINVAL \p io_req has an invalid io_type.
* @retval <0 on other errors during emulation. * @retval <0 on other errors during emulation.
*/ */
int32_t int32_t
@ -525,7 +525,7 @@ emulate_io(struct acrn_vcpu *vcpu, struct io_request *io_req)
vm_config = get_vm_config(vcpu->vm->vm_id); vm_config = get_vm_config(vcpu->vm->vm_id);
switch (io_req->type) { switch (io_req->io_type) {
case REQ_PORTIO: case REQ_PORTIO:
status = hv_emulate_pio(vcpu, io_req); status = hv_emulate_pio(vcpu, io_req);
if (status == 0) { if (status == 0) {
@ -540,7 +540,7 @@ emulate_io(struct acrn_vcpu *vcpu, struct io_request *io_req)
} }
break; break;
default: default:
/* Unknown I/O request type */ /* Unknown I/O request io_type */
status = -EINVAL; status = -EINVAL;
break; break;
} }
@ -560,9 +560,9 @@ emulate_io(struct acrn_vcpu *vcpu, struct io_request *io_req)
*/ */
struct pio_request *pio_req = &io_req->reqs.pio; struct pio_request *pio_req = &io_req->reqs.pio;
pr_fatal("%s Err: access dir %d, type %d, " pr_fatal("%s Err: access dir %d, io_type %d, "
"addr = 0x%llx, size=%lu", __func__, "addr = 0x%llx, size=%lu", __func__,
pio_req->direction, io_req->type, pio_req->direction, io_req->io_type,
pio_req->address, pio_req->size); pio_req->address, pio_req->size);
} }
} }

View File

@ -46,7 +46,7 @@ int32_t ept_violation_vmexit_handler(struct acrn_vcpu *vcpu);
/** /**
* @brief General complete-work for port I/O emulation * @brief General complete-work for port I/O emulation
* *
* @pre io_req->type == REQ_PORTIO * @pre io_req->io_type == REQ_PORTIO
* *
* @remark This function must be called when \p io_req is completed, after * @remark This function must be called when \p io_req is completed, after
* either a previous call to emulate_io() returning 0 or the corresponding VHM * either a previous call to emulate_io() returning 0 or the corresponding VHM

View File

@ -27,7 +27,7 @@ struct io_request {
* *
* Refer to vhm_request for detailed description of I/O request types. * Refer to vhm_request for detailed description of I/O request types.
*/ */
uint32_t type; uint32_t io_type;
/** /**
* @brief Details of this request in the same format as vhm_request. * @brief Details of this request in the same format as vhm_request.