aspeed: introduce a configurable number of CPU per machine
[qemu/rayw.git] / include / hw / hyperv / hyperv.h
blob597381cb0100af9d18cd09571b949fd08d802f8e
1 /*
2 * Hyper-V guest/hypervisor interaction
4 * Copyright (c) 2015-2018 Virtuozzo International GmbH.
6 * This work is licensed under the terms of the GNU GPL, version 2 or later.
7 * See the COPYING file in the top-level directory.
8 */
10 #ifndef HW_HYPERV_HYPERV_H
11 #define HW_HYPERV_HYPERV_H
13 #include "cpu-qom.h"
14 #include "hw/hyperv/hyperv-proto.h"
16 typedef struct HvSintRoute HvSintRoute;
19 * Callback executed in a bottom-half when the status of posting the message
20 * becomes known, before unblocking the connection for further messages
22 typedef void (*HvSintMsgCb)(void *data, int status);
24 HvSintRoute *hyperv_sint_route_new(uint32_t vp_index, uint32_t sint,
25 HvSintMsgCb cb, void *cb_data);
26 void hyperv_sint_route_ref(HvSintRoute *sint_route);
27 void hyperv_sint_route_unref(HvSintRoute *sint_route);
29 int hyperv_sint_route_set_sint(HvSintRoute *sint_route);
32 * Submit a message to be posted in vcpu context. If the submission succeeds,
33 * the status of posting the message is reported via the callback associated
34 * with the @sint_route; until then no more messages are accepted.
36 int hyperv_post_msg(HvSintRoute *sint_route, struct hyperv_message *msg);
38 * Set event flag @eventno, and signal the SINT if the flag has changed.
40 int hyperv_set_event_flag(HvSintRoute *sint_route, unsigned eventno);
43 * Handler for messages arriving from the guest via HV_POST_MESSAGE hypercall.
44 * Executed in vcpu context.
46 typedef uint16_t (*HvMsgHandler)(const struct hyperv_post_message_input *msg,
47 void *data);
49 * Associate @handler with the message connection @conn_id, such that @handler
50 * is called with @data when the guest executes HV_POST_MESSAGE hypercall on
51 * @conn_id. If @handler is NULL clear the association.
53 int hyperv_set_msg_handler(uint32_t conn_id, HvMsgHandler handler, void *data);
55 * Associate @notifier with the event connection @conn_id, such that @notifier
56 * is signaled when the guest executes HV_SIGNAL_EVENT hypercall on @conn_id.
57 * If @notifier is NULL clear the association.
59 int hyperv_set_event_flag_handler(uint32_t conn_id, EventNotifier *notifier);
62 * Process HV_POST_MESSAGE hypercall: parse the data in the guest memory as
63 * specified in @param, and call the HvMsgHandler associated with the
64 * connection on the message contained therein.
66 uint16_t hyperv_hcall_post_message(uint64_t param, bool fast);
68 * Process HV_SIGNAL_EVENT hypercall: signal the EventNotifier associated with
69 * the connection as specified in @param.
71 uint16_t hyperv_hcall_signal_event(uint64_t param, bool fast);
73 static inline uint32_t hyperv_vp_index(CPUState *cs)
75 return cs->cpu_index;
78 void hyperv_synic_add(CPUState *cs);
79 void hyperv_synic_reset(CPUState *cs);
80 void hyperv_synic_update(CPUState *cs, bool enable,
81 hwaddr msg_page_addr, hwaddr event_page_addr);
83 #endif