diff --git a/hypervisor/arch/x86/io.c b/hypervisor/arch/x86/io.c index a7ca57115..660640c25 100644 --- a/hypervisor/arch/x86/io.c +++ b/hypervisor/arch/x86/io.c @@ -10,7 +10,6 @@ static void complete_ioreq(struct vhm_request *vhm_req) { - vhm_req->valid = 0; atomic_store32(&vhm_req->processed, REQ_STATE_FREE); } @@ -140,8 +139,7 @@ void emulate_io_post(struct acrn_vcpu *vcpu) req_buf = (union vhm_request_buffer *)vcpu->vm->sw.io_shared_page; vhm_req = &req_buf->req_queue[vcpu->vcpu_id]; - if ((vhm_req->valid == 0) || - (atomic_load32(&vhm_req->processed) != REQ_STATE_COMPLETE)) { + if (atomic_load32(&vhm_req->processed) != REQ_STATE_COMPLETE) { return; } diff --git a/hypervisor/common/io_request.c b/hypervisor/common/io_request.c index 92aaaf386..c94a75d92 100644 --- a/hypervisor/common/io_request.c +++ b/hypervisor/common/io_request.c @@ -69,7 +69,6 @@ void reset_vm_ioreqs(struct acrn_vm *vm) req_buf = vm->sw.io_shared_page; for (i = 0U; i < VHM_REQUEST_MAX; i++) { - req_buf->req_queue[i].valid = 0U; atomic_store32(&req_buf->req_queue[i].processed, REQ_STATE_FREE); } } @@ -84,11 +83,8 @@ static bool has_complete_ioreq(struct acrn_vcpu *vcpu) req_buf = (union vhm_request_buffer *)vm->sw.io_shared_page; if (req_buf != NULL) { vhm_req = &req_buf->req_queue[vcpu->vcpu_id]; - if (vhm_req->valid && - atomic_load32(&vhm_req->processed) - == REQ_STATE_COMPLETE) { + if (atomic_load32(&vhm_req->processed) == REQ_STATE_COMPLETE) { return true; - } } @@ -153,7 +149,7 @@ int32_t acrn_insert_request_wait(struct acrn_vcpu *vcpu, const struct io_request /* pause vcpu, wait for VHM to handle the MMIO request. * TODO: when pause_vcpu changed to switch vcpu out directlly, we - * should fix the race issue between req.valid = true and vcpu pause + * should fix the race issue between req.processed update and vcpu pause */ pause_vcpu(vcpu, VCPU_PAUSED); @@ -162,7 +158,6 @@ int32_t acrn_insert_request_wait(struct acrn_vcpu *vcpu, const struct io_request * before we perform upcall. * because VHM can work in pulling mode without wait for upcall */ - vhm_req->valid = 1; atomic_store32(&vhm_req->processed, REQ_STATE_PENDING); acrn_print_request(vcpu->vcpu_id, vhm_req); diff --git a/hypervisor/include/public/acrn_common.h b/hypervisor/include/public/acrn_common.h index 073a155df..b280a29c7 100644 --- a/hypervisor/include/public/acrn_common.h +++ b/hypervisor/include/public/acrn_common.h @@ -261,7 +261,7 @@ union vhm_io_request { */ struct vhm_request { /** - * Type of this request. + * @brief Type of this request. * * Byte offset: 0. */ @@ -275,14 +275,16 @@ struct vhm_request { uint32_t completion_polling; /** - * Reserved. + * @brief Reserved. * * Byte offset: 8. */ uint32_t reserved0[14]; /** - * Details about this request. For REQ_PORTIO, this has type + * @brief Details about this request. + * + * For REQ_PORTIO, this has type * pio_request. For REQ_MMIO and REQ_WP, this has type mmio_request. For * REQ_PCICFG, this has type pci_request. * @@ -291,25 +293,25 @@ struct vhm_request { union vhm_io_request reqs; /** - * Whether this request is valid for processing. ACRN write, VHM read - * only. - * - * Warning; this field is obsolete and will be removed soon. + * @brief Reserved. * * Byte offset: 128. */ - int32_t valid; + uint32_t reserved1; /** - * The client which is distributed to handle this request. Accessed by - * VHM only. + * @brief The client which is distributed to handle this request. + * + * Accessed by VHM only. * * Byte offset: 132. */ int32_t client; /** - * The status of this request, taking REQ_STATE_xxx as values. + * @brief The status of this request. + * + * Taking REQ_STATE_xxx as values. * * Byte offset: 136. */