mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-09-23 17:58:30 +00:00
io_emul: reshuffle io emulation path
This is the following patch after removing pending_pre_work, it make sure all io emulation is done on its own cpu. For hv emulated request, it follows the steps: hv_emulate_pio->emulate_pio_complete hv_emulate_mmio->emulate_mmio_complete For dm emulated request, it follows the steps: acrn_insert_request->dm_emulate_io_complete while in acrn_insert_request, it could trigger scheduling out then resume by hcall_notify_ioreq_finish, or busy wait for ioreq completion if polling mode is enabled. Tracked-On: #2394 Signed-off-by: Jason Chen CJ <jason.cj.chen@intel.com> Acked-by: Xu, Anthony <anthony.xu@intel.com>
This commit is contained in:
@@ -489,7 +489,9 @@ int32_t hcall_notify_ioreq_finish(uint16_t vmid, uint16_t vcpu_id)
|
||||
ret = -EINVAL;
|
||||
} else {
|
||||
vcpu = vcpu_from_vid(target_vm, vcpu_id);
|
||||
emulate_io_post(vcpu);
|
||||
if (!vcpu->vm->sw.is_completion_polling) {
|
||||
resume_vcpu(vcpu);
|
||||
}
|
||||
ret = 0;
|
||||
}
|
||||
}
|
||||
|
@@ -87,12 +87,12 @@ static inline bool has_complete_ioreq(const struct acrn_vcpu *vcpu)
|
||||
*
|
||||
* @pre vcpu != NULL && io_req != NULL
|
||||
*/
|
||||
int32_t acrn_insert_request_wait(struct acrn_vcpu *vcpu, const struct io_request *io_req)
|
||||
int32_t acrn_insert_request(struct acrn_vcpu *vcpu, const struct io_request *io_req)
|
||||
{
|
||||
union vhm_request_buffer *req_buf = NULL;
|
||||
struct vhm_request *vhm_req;
|
||||
bool is_polling = false;
|
||||
int32_t ret;
|
||||
int32_t ret = 0;
|
||||
uint16_t cur;
|
||||
|
||||
if (vcpu->vm->sw.io_shared_page != NULL) {
|
||||
@@ -149,20 +149,19 @@ int32_t acrn_insert_request_wait(struct acrn_vcpu *vcpu, const struct io_request
|
||||
while (!need_reschedule(vcpu->pcpu_id)) {
|
||||
if (has_complete_ioreq(vcpu)) {
|
||||
/* we have completed ioreq pending */
|
||||
emulate_io_post(vcpu);
|
||||
break;
|
||||
}
|
||||
asm_pause();
|
||||
}
|
||||
} else if (need_reschedule(vcpu->pcpu_id)) {
|
||||
schedule();
|
||||
} else {
|
||||
ret = -EINVAL;
|
||||
}
|
||||
ret = 0;
|
||||
} else {
|
||||
ret = -EINVAL;
|
||||
}
|
||||
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user