hv: vcpu: wait and signal vcpu event support

Introduce two kinds of events for each vcpu,
  VCPU_EVENT_IOREQ: for vcpu waiting for IO request completion
  VCPU_EVENT_VIRTUAL_INTERRUPT: for vcpu waiting for virtual interrupts events
vcpu can wait for such events, and resume to run when the
event get signalled.

This patch also change IO request waiting/notifying to this way.

Tracked-On: #4329
Signed-off-by: Shuo A Liu <shuo.a.liu@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
Shuo A Liu
2019-12-31 13:00:13 +08:00
committed by wenlingz
parent 1f23fe3fd8
commit e3c303363b
4 changed files with 14 additions and 13 deletions

View File

@@ -103,14 +103,6 @@ int32_t acrn_insert_request(struct acrn_vcpu *vcpu, const struct io_request *io_
}
clac();
/* pause vcpu in notification mode , 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.processed update and vcpu pause
*/
if (!is_polling) {
pause_vcpu(vcpu, VCPU_PAUSED);
}
/* Before updating the vhm_req state, enforce all fill vhm_req operations done */
cpu_write_memory_barrier();
@@ -136,10 +128,8 @@ int32_t acrn_insert_request(struct acrn_vcpu *vcpu, const struct io_request *io_
schedule();
}
}
} else if (need_reschedule(pcpuid_from_vcpu(vcpu))) {
schedule();
} else {
ret = -EINVAL;
wait_event(&vcpu->events[VCPU_EVENT_IOREQ]);
}
} else {
ret = -EINVAL;