1
2
3
4
5
6
7
8
9
10#ifndef HW_HYPERV_HYPERV_H
11#define HW_HYPERV_HYPERV_H
12
13#include "cpu-qom.h"
14#include "hw/hyperv/hyperv-proto.h"
15
16typedef struct HvSintRoute HvSintRoute;
17
18
19
20
21
22typedef void (*HvSintMsgCb)(void *data, int status);
23
24HvSintRoute *hyperv_sint_route_new(uint32_t vp_index, uint32_t sint,
25 HvSintMsgCb cb, void *cb_data);
26void hyperv_sint_route_ref(HvSintRoute *sint_route);
27void hyperv_sint_route_unref(HvSintRoute *sint_route);
28
29int hyperv_sint_route_set_sint(HvSintRoute *sint_route);
30
31
32
33
34
35
36int hyperv_post_msg(HvSintRoute *sint_route, struct hyperv_message *msg);
37
38
39
40int hyperv_set_event_flag(HvSintRoute *sint_route, unsigned eventno);
41
42
43
44
45
46typedef uint16_t (*HvMsgHandler)(const struct hyperv_post_message_input *msg,
47 void *data);
48
49
50
51
52
53int hyperv_set_msg_handler(uint32_t conn_id, HvMsgHandler handler, void *data);
54
55
56
57
58
59int hyperv_set_event_flag_handler(uint32_t conn_id, EventNotifier *notifier);
60
61
62
63
64
65
66uint16_t hyperv_hcall_post_message(uint64_t param, bool fast);
67
68
69
70
71uint16_t hyperv_hcall_signal_event(uint64_t param, bool fast);
72
73static inline uint32_t hyperv_vp_index(CPUState *cs)
74{
75 return cs->cpu_index;
76}
77
78void hyperv_synic_add(CPUState *cs);
79void hyperv_synic_reset(CPUState *cs);
80void hyperv_synic_update(CPUState *cs, bool enable,
81 hwaddr msg_page_addr, hwaddr event_page_addr);
82bool hyperv_is_synic_enabled(void);
83
84
85
86
87uint16_t hyperv_hcall_reset_dbg_session(uint64_t outgpa);
88
89
90
91uint16_t hyperv_hcall_retreive_dbg_data(uint64_t ingpa, uint64_t outgpa,
92 bool fast);
93
94
95
96uint16_t hyperv_hcall_post_dbg_data(uint64_t ingpa, uint64_t outgpa, bool fast);
97
98uint32_t hyperv_syndbg_send(uint64_t ingpa, uint32_t count);
99uint32_t hyperv_syndbg_recv(uint64_t ingpa, uint32_t count);
100void hyperv_syndbg_set_pending_page(uint64_t ingpa);
101uint64_t hyperv_syndbg_query_options(void);
102
103typedef enum HvSynthDbgMsgType {
104 HV_SYNDBG_MSG_CONNECTION_INFO,
105 HV_SYNDBG_MSG_SEND,
106 HV_SYNDBG_MSG_RECV,
107 HV_SYNDBG_MSG_SET_PENDING_PAGE,
108 HV_SYNDBG_MSG_QUERY_OPTIONS
109} HvDbgSynthMsgType;
110
111typedef struct HvSynDbgMsg {
112 HvDbgSynthMsgType type;
113 union {
114 struct {
115 uint32_t host_ip;
116 uint16_t host_port;
117 } connection_info;
118 struct {
119 uint64_t buf_gpa;
120 uint32_t count;
121 uint32_t pending_count;
122 bool is_raw;
123 } send;
124 struct {
125 uint64_t buf_gpa;
126 uint32_t count;
127 uint32_t options;
128 uint64_t timeout;
129 uint32_t retrieved_count;
130 bool is_raw;
131 } recv;
132 struct {
133 uint64_t buf_gpa;
134 } pending_page;
135 struct {
136 uint64_t options;
137 } query_options;
138 } u;
139} HvSynDbgMsg;
140typedef uint16_t (*HvSynDbgHandler)(void *context, HvSynDbgMsg *msg);
141void hyperv_set_syndbg_handler(HvSynDbgHandler handler, void *context);
142#endif
143