hyperv: process POST_MESSAGE hypercall

Add handling of POST_MESSAGE hypercall.  For that, add an interface to
regsiter a handler for the messages arrived from the guest on a
particular connection id (IOW set up a message connection in Hyper-V
speak).

Signed-off-by: Roman Kagan <rkagan@virtuozzo.com>
Message-Id: <20180921082217.29481-10-rkagan@virtuozzo.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
Roman Kagan 2018-09-21 11:22:16 +03:00 committed by Paolo Bonzini
parent 8d3bc0b753
commit 76036a5fc7
3 changed files with 105 additions and 0 deletions

View file

@ -39,6 +39,18 @@ int hyperv_post_msg(HvSintRoute *sint_route, struct hyperv_message *msg);
*/
int hyperv_set_event_flag(HvSintRoute *sint_route, unsigned eventno);
/*
* Handler for messages arriving from the guest via HV_POST_MESSAGE hypercall.
* Executed in vcpu context.
*/
typedef uint16_t (*HvMsgHandler)(const struct hyperv_post_message_input *msg,
void *data);
/*
* Associate @handler with the message connection @conn_id, such that @handler
* is called with @data when the guest executes HV_POST_MESSAGE hypercall on
* @conn_id. If @handler is NULL clear the association.
*/
int hyperv_set_msg_handler(uint32_t conn_id, HvMsgHandler handler, void *data);
/*
* Associate @notifier with the event connection @conn_id, such that @notifier
* is signaled when the guest executes HV_SIGNAL_EVENT hypercall on @conn_id.
@ -46,6 +58,12 @@ int hyperv_set_event_flag(HvSintRoute *sint_route, unsigned eventno);
*/
int hyperv_set_event_flag_handler(uint32_t conn_id, EventNotifier *notifier);
/*
* Process HV_POST_MESSAGE hypercall: parse the data in the guest memory as
* specified in @param, and call the HvMsgHandler associated with the
* connection on the message contained therein.
*/
uint16_t hyperv_hcall_post_message(uint64_t param, bool fast);
/*
* Process HV_SIGNAL_EVENT hypercall: signal the EventNotifier associated with
* the connection as specified in @param.