mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-09-24 10:17:28 +00:00
HV: io: refine state transitions of VHM requests
Instead of using two members for maintaining the state of a VHM request, this patch replaces the transitions with a single state. Basically the lifecycle of a VHM request shall be: FREE -> PENDING -> PROCESSING -> COMPLETE -> FREE -> ... The structure header of vhm_request has more details of the transitions access limitations under different states. Also drop the set but unused member vcpu.ioreq_pending. For backward-compatibility, the obsolete 'valid' member is still kept and maintained before SOS and DM adapts to the new state transitions. v2 -> v3: * Use complete_ioreq to mark an I/O request finished in dm_emulate_(pio|mmio)_post. Signed-off-by: Junjie Mao <junjie.mao@intel.com> Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
@@ -117,7 +117,6 @@ int create_vcpu(uint16_t pcpu_id, struct vm *vm, struct vcpu **rtn_vcpu_handle)
|
||||
vcpu->launched = false;
|
||||
vcpu->paused_cnt = 0U;
|
||||
vcpu->running = 0;
|
||||
vcpu->ioreq_pending = 0;
|
||||
vcpu->arch_vcpu.nr_sipi = 0;
|
||||
vcpu->pending_pre_work = 0U;
|
||||
vcpu->state = VCPU_INIT;
|
||||
@@ -277,7 +276,6 @@ void reset_vcpu(struct vcpu *vcpu)
|
||||
vcpu->launched = false;
|
||||
vcpu->paused_cnt = 0U;
|
||||
vcpu->running = 0;
|
||||
vcpu->ioreq_pending = 0;
|
||||
vcpu->arch_vcpu.nr_sipi = 0;
|
||||
vcpu->pending_pre_work = 0U;
|
||||
|
||||
|
@@ -613,12 +613,10 @@ int vioapic_mmio_access_handler(struct vcpu *vcpu, struct io_request *io_req,
|
||||
gpa,
|
||||
&data);
|
||||
mmio->value = (uint64_t)data;
|
||||
io_req->processed = REQ_STATE_SUCCESS;
|
||||
} else if (mmio->direction == REQUEST_WRITE) {
|
||||
vioapic_mmio_write(vm,
|
||||
gpa,
|
||||
data);
|
||||
io_req->processed = REQ_STATE_SUCCESS;
|
||||
} else {
|
||||
/* Can never happen due to the range of direction. */
|
||||
}
|
||||
@@ -627,6 +625,7 @@ int vioapic_mmio_access_handler(struct vcpu *vcpu, struct io_request *io_req,
|
||||
ret = -EINVAL;
|
||||
}
|
||||
|
||||
io_req->processed = REQ_STATE_COMPLETE;
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@@ -2069,17 +2069,16 @@ int vlapic_mmio_access_handler(struct vcpu *vcpu, struct io_request *io_req,
|
||||
gpa,
|
||||
&mmio_req->value,
|
||||
mmio_req->size);
|
||||
io_req->processed = REQ_STATE_SUCCESS;
|
||||
} else if (mmio_req->direction == REQUEST_WRITE) {
|
||||
ret = vlapic_write_mmio_reg(vcpu,
|
||||
gpa,
|
||||
mmio_req->value,
|
||||
mmio_req->size);
|
||||
io_req->processed = REQ_STATE_SUCCESS;
|
||||
} else {
|
||||
/* Can never happen due to the range of mmio_req->direction. */
|
||||
}
|
||||
|
||||
io_req->processed = REQ_STATE_COMPLETE;
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user