1
2
3
4
5#ifndef __ACRN_HSM_HYPERCALL_H
6#define __ACRN_HSM_HYPERCALL_H
7#include <asm/acrn.h>
8
9
10
11
12#define _HC_ID(x, y) (((x) << 24) | (y))
13
14#define HC_ID 0x80UL
15
16#define HC_ID_GEN_BASE 0x0UL
17#define HC_SOS_REMOVE_CPU _HC_ID(HC_ID, HC_ID_GEN_BASE + 0x01)
18
19#define HC_ID_VM_BASE 0x10UL
20#define HC_CREATE_VM _HC_ID(HC_ID, HC_ID_VM_BASE + 0x00)
21#define HC_DESTROY_VM _HC_ID(HC_ID, HC_ID_VM_BASE + 0x01)
22#define HC_START_VM _HC_ID(HC_ID, HC_ID_VM_BASE + 0x02)
23#define HC_PAUSE_VM _HC_ID(HC_ID, HC_ID_VM_BASE + 0x03)
24#define HC_RESET_VM _HC_ID(HC_ID, HC_ID_VM_BASE + 0x05)
25#define HC_SET_VCPU_REGS _HC_ID(HC_ID, HC_ID_VM_BASE + 0x06)
26
27#define HC_ID_IRQ_BASE 0x20UL
28#define HC_INJECT_MSI _HC_ID(HC_ID, HC_ID_IRQ_BASE + 0x03)
29#define HC_VM_INTR_MONITOR _HC_ID(HC_ID, HC_ID_IRQ_BASE + 0x04)
30#define HC_SET_IRQLINE _HC_ID(HC_ID, HC_ID_IRQ_BASE + 0x05)
31
32#define HC_ID_IOREQ_BASE 0x30UL
33#define HC_SET_IOREQ_BUFFER _HC_ID(HC_ID, HC_ID_IOREQ_BASE + 0x00)
34#define HC_NOTIFY_REQUEST_FINISH _HC_ID(HC_ID, HC_ID_IOREQ_BASE + 0x01)
35
36#define HC_ID_MEM_BASE 0x40UL
37#define HC_VM_SET_MEMORY_REGIONS _HC_ID(HC_ID, HC_ID_MEM_BASE + 0x02)
38
39#define HC_ID_PCI_BASE 0x50UL
40#define HC_SET_PTDEV_INTR _HC_ID(HC_ID, HC_ID_PCI_BASE + 0x03)
41#define HC_RESET_PTDEV_INTR _HC_ID(HC_ID, HC_ID_PCI_BASE + 0x04)
42#define HC_ASSIGN_PCIDEV _HC_ID(HC_ID, HC_ID_PCI_BASE + 0x05)
43#define HC_DEASSIGN_PCIDEV _HC_ID(HC_ID, HC_ID_PCI_BASE + 0x06)
44
45#define HC_ID_PM_BASE 0x80UL
46#define HC_PM_GET_CPU_STATE _HC_ID(HC_ID, HC_ID_PM_BASE + 0x00)
47
48
49
50
51
52
53
54static inline long hcall_sos_remove_cpu(u64 cpu)
55{
56 return acrn_hypercall1(HC_SOS_REMOVE_CPU, cpu);
57}
58
59
60
61
62
63
64
65static inline long hcall_create_vm(u64 vminfo)
66{
67 return acrn_hypercall1(HC_CREATE_VM, vminfo);
68}
69
70
71
72
73
74
75
76static inline long hcall_start_vm(u64 vmid)
77{
78 return acrn_hypercall1(HC_START_VM, vmid);
79}
80
81
82
83
84
85
86
87static inline long hcall_pause_vm(u64 vmid)
88{
89 return acrn_hypercall1(HC_PAUSE_VM, vmid);
90}
91
92
93
94
95
96
97
98static inline long hcall_destroy_vm(u64 vmid)
99{
100 return acrn_hypercall1(HC_DESTROY_VM, vmid);
101}
102
103
104
105
106
107
108
109static inline long hcall_reset_vm(u64 vmid)
110{
111 return acrn_hypercall1(HC_RESET_VM, vmid);
112}
113
114
115
116
117
118
119
120
121static inline long hcall_set_vcpu_regs(u64 vmid, u64 regs_state)
122{
123 return acrn_hypercall2(HC_SET_VCPU_REGS, vmid, regs_state);
124}
125
126
127
128
129
130
131
132
133static inline long hcall_inject_msi(u64 vmid, u64 msi)
134{
135 return acrn_hypercall2(HC_INJECT_MSI, vmid, msi);
136}
137
138
139
140
141
142
143
144
145static inline long hcall_vm_intr_monitor(u64 vmid, u64 addr)
146{
147 return acrn_hypercall2(HC_VM_INTR_MONITOR, vmid, addr);
148}
149
150
151
152
153
154
155
156
157static inline long hcall_set_irqline(u64 vmid, u64 op)
158{
159 return acrn_hypercall2(HC_SET_IRQLINE, vmid, op);
160}
161
162
163
164
165
166
167
168
169static inline long hcall_set_ioreq_buffer(u64 vmid, u64 buffer)
170{
171 return acrn_hypercall2(HC_SET_IOREQ_BUFFER, vmid, buffer);
172}
173
174
175
176
177
178
179
180
181static inline long hcall_notify_req_finish(u64 vmid, u64 vcpu)
182{
183 return acrn_hypercall2(HC_NOTIFY_REQUEST_FINISH, vmid, vcpu);
184}
185
186
187
188
189
190
191
192static inline long hcall_set_memory_regions(u64 regions_pa)
193{
194 return acrn_hypercall1(HC_VM_SET_MEMORY_REGIONS, regions_pa);
195}
196
197
198
199
200
201
202
203
204static inline long hcall_assign_pcidev(u64 vmid, u64 addr)
205{
206 return acrn_hypercall2(HC_ASSIGN_PCIDEV, vmid, addr);
207}
208
209
210
211
212
213
214
215
216static inline long hcall_deassign_pcidev(u64 vmid, u64 addr)
217{
218 return acrn_hypercall2(HC_DEASSIGN_PCIDEV, vmid, addr);
219}
220
221
222
223
224
225
226
227
228static inline long hcall_set_ptdev_intr(u64 vmid, u64 irq)
229{
230 return acrn_hypercall2(HC_SET_PTDEV_INTR, vmid, irq);
231}
232
233
234
235
236
237
238
239
240static inline long hcall_reset_ptdev_intr(u64 vmid, u64 irq)
241{
242 return acrn_hypercall2(HC_RESET_PTDEV_INTR, vmid, irq);
243}
244
245
246
247
248
249static inline long hcall_get_cpu_state(u64 cmd, u64 state)
250{
251 return acrn_hypercall2(HC_PM_GET_CPU_STATE, cmd, state);
252}
253
254#endif
255