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

@@ -553,8 +553,9 @@ int32_t hcall_notify_ioreq_finish(uint16_t vmid, uint16_t vcpu_id)
} else {
vcpu = vcpu_from_vid(target_vm, vcpu_id);
if (!vcpu->vm->sw.is_completion_polling) {
ret = resume_vcpu(vcpu);
signal_event(&vcpu->events[VCPU_EVENT_IOREQ]);
}
ret = 0;
}
}