hyperv: process SIGNAL_EVENT hypercall

Add handling of SIGNAL_EVENT hypercall.  For that, provide an interface
to associate an EventNotifier with an event connection number, so that
it's signaled when the SIGNAL_EVENT hypercall with the matching
connection ID is called by the guest.

Support for using KVM functionality for this will be added in a followup
patch.

Signed-off-by: Roman Kagan <rkagan@virtuozzo.com>
Message-Id: <20180921082217.29481-8-rkagan@virtuozzo.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
Roman Kagan 2018-09-21 11:22:14 +03:00 committed by Paolo Bonzini
parent f5642f8b45
commit e6ea9f45b7
4 changed files with 113 additions and 4 deletions

View file

@ -79,16 +79,18 @@ int kvm_hv_handle_exit(X86CPU *cpu, struct kvm_hyperv_exit *exit)
return 0;
case KVM_EXIT_HYPERV_HCALL: {
uint16_t code;
uint16_t code = exit->u.hcall.input & 0xffff;
bool fast = exit->u.hcall.input & HV_HYPERCALL_FAST;
uint64_t param = exit->u.hcall.params[0];
code = exit->u.hcall.input & 0xffff;
switch (code) {
case HV_POST_MESSAGE:
case HV_SIGNAL_EVENT:
exit->u.hcall.result = hyperv_hcall_signal_event(param, fast);
break;
default:
exit->u.hcall.result = HV_STATUS_INVALID_HYPERCALL_CODE;
return 0;
}
return 0;
}
default:
return -1;