mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-06-23 14:07:42 +00:00
HV: io: obsolete the valid field in vhm requests
As SOS has already adapted to the new state transition of VHM requests for a month, the old `valid` field can now be safely obsoleted. This patch changes the `valid` field as reserved and drops all the code that reads or modifies this field for backward compatibility. The embedded comments are updated accordingly, following the doxygen style. Tracked-On: #875 Signed-off-by: Junjie Mao <junjie.mao@intel.com> Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
parent
db3c5746f3
commit
10afa9bbbf
@ -10,7 +10,6 @@
|
|||||||
|
|
||||||
static void complete_ioreq(struct vhm_request *vhm_req)
|
static void complete_ioreq(struct vhm_request *vhm_req)
|
||||||
{
|
{
|
||||||
vhm_req->valid = 0;
|
|
||||||
atomic_store32(&vhm_req->processed, REQ_STATE_FREE);
|
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;
|
req_buf = (union vhm_request_buffer *)vcpu->vm->sw.io_shared_page;
|
||||||
vhm_req = &req_buf->req_queue[vcpu->vcpu_id];
|
vhm_req = &req_buf->req_queue[vcpu->vcpu_id];
|
||||||
|
|
||||||
if ((vhm_req->valid == 0) ||
|
if (atomic_load32(&vhm_req->processed) != REQ_STATE_COMPLETE) {
|
||||||
(atomic_load32(&vhm_req->processed) != REQ_STATE_COMPLETE)) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -69,7 +69,6 @@ void reset_vm_ioreqs(struct acrn_vm *vm)
|
|||||||
|
|
||||||
req_buf = vm->sw.io_shared_page;
|
req_buf = vm->sw.io_shared_page;
|
||||||
for (i = 0U; i < VHM_REQUEST_MAX; i++) {
|
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);
|
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;
|
req_buf = (union vhm_request_buffer *)vm->sw.io_shared_page;
|
||||||
if (req_buf != NULL) {
|
if (req_buf != NULL) {
|
||||||
vhm_req = &req_buf->req_queue[vcpu->vcpu_id];
|
vhm_req = &req_buf->req_queue[vcpu->vcpu_id];
|
||||||
if (vhm_req->valid &&
|
if (atomic_load32(&vhm_req->processed) == REQ_STATE_COMPLETE) {
|
||||||
atomic_load32(&vhm_req->processed)
|
|
||||||
== REQ_STATE_COMPLETE) {
|
|
||||||
return true;
|
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.
|
/* pause vcpu, wait for VHM to handle the MMIO request.
|
||||||
* TODO: when pause_vcpu changed to switch vcpu out directlly, we
|
* 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);
|
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.
|
* before we perform upcall.
|
||||||
* because VHM can work in pulling mode without wait for upcall
|
* because VHM can work in pulling mode without wait for upcall
|
||||||
*/
|
*/
|
||||||
vhm_req->valid = 1;
|
|
||||||
atomic_store32(&vhm_req->processed, REQ_STATE_PENDING);
|
atomic_store32(&vhm_req->processed, REQ_STATE_PENDING);
|
||||||
|
|
||||||
acrn_print_request(vcpu->vcpu_id, vhm_req);
|
acrn_print_request(vcpu->vcpu_id, vhm_req);
|
||||||
|
@ -261,7 +261,7 @@ union vhm_io_request {
|
|||||||
*/
|
*/
|
||||||
struct vhm_request {
|
struct vhm_request {
|
||||||
/**
|
/**
|
||||||
* Type of this request.
|
* @brief Type of this request.
|
||||||
*
|
*
|
||||||
* Byte offset: 0.
|
* Byte offset: 0.
|
||||||
*/
|
*/
|
||||||
@ -275,14 +275,16 @@ struct vhm_request {
|
|||||||
uint32_t completion_polling;
|
uint32_t completion_polling;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reserved.
|
* @brief Reserved.
|
||||||
*
|
*
|
||||||
* Byte offset: 8.
|
* Byte offset: 8.
|
||||||
*/
|
*/
|
||||||
uint32_t reserved0[14];
|
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
|
* pio_request. For REQ_MMIO and REQ_WP, this has type mmio_request. For
|
||||||
* REQ_PCICFG, this has type pci_request.
|
* REQ_PCICFG, this has type pci_request.
|
||||||
*
|
*
|
||||||
@ -291,25 +293,25 @@ struct vhm_request {
|
|||||||
union vhm_io_request reqs;
|
union vhm_io_request reqs;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Whether this request is valid for processing. ACRN write, VHM read
|
* @brief Reserved.
|
||||||
* only.
|
|
||||||
*
|
|
||||||
* Warning; this field is obsolete and will be removed soon.
|
|
||||||
*
|
*
|
||||||
* Byte offset: 128.
|
* Byte offset: 128.
|
||||||
*/
|
*/
|
||||||
int32_t valid;
|
uint32_t reserved1;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The client which is distributed to handle this request. Accessed by
|
* @brief The client which is distributed to handle this request.
|
||||||
* VHM only.
|
*
|
||||||
|
* Accessed by VHM only.
|
||||||
*
|
*
|
||||||
* Byte offset: 132.
|
* Byte offset: 132.
|
||||||
*/
|
*/
|
||||||
int32_t client;
|
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.
|
* Byte offset: 136.
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user