iPXE
hvm_op.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: MIT */
2 /*
3  * Copyright (c) 2007, Keir Fraser
4  */
5 
6 #ifndef __XEN_PUBLIC_HVM_HVM_OP_H__
7 #define __XEN_PUBLIC_HVM_HVM_OP_H__
8 
9 FILE_LICENCE ( MIT );
10 
11 #include "../xen.h"
12 #include "../trace.h"
13 #include "../event_channel.h"
14 
15 /* Get/set subcommands: extra argument == pointer to xen_hvm_param struct. */
16 #define HVMOP_set_param 0
17 #define HVMOP_get_param 1
18 struct xen_hvm_param {
19  domid_t domid; /* IN */
21  uint32_t index; /* IN */
22  uint64_t value; /* IN/OUT */
23 };
26 
29  uint8_t suppress_ve; /* Boolean type. */
33 };
34 
37  uint8_t suppress_ve; /* Boolean type. */
39  int32_t first_error; /* Should be set to 0. */
40  uint64_t first_gfn; /* Value may be updated. */
42  uint64_t first_error_gfn; /* Gfn of the first error. */
43 };
44 
45 #if __XEN_INTERFACE_VERSION__ < 0x00040900
46 
47 /* Set the logical level of one of a domain's PCI INTx wires. */
48 #define HVMOP_set_pci_intx_level 2
50  /* Domain to be updated. */
52  /* PCI INTx identification in PCI topology (domain:bus:device:intx). */
54  /* Assertion level (0 = unasserted, 1 = asserted). */
56 };
59 
60 /* Set the logical level of one of a domain's ISA IRQ wires. */
61 #define HVMOP_set_isa_irq_level 3
63  /* Domain to be updated. */
65  /* ISA device identification, by ISA IRQ (0-15). */
67  /* Assertion level (0 = unasserted, 1 = asserted). */
69 };
72 
73 #define HVMOP_set_pci_link_route 4
75  /* Domain to be updated. */
77  /* PCI link identifier (0-3). */
79  /* ISA IRQ (1-15), or 0 (disable link). */
81 };
84 
85 #endif /* __XEN_INTERFACE_VERSION__ < 0x00040900 */
86 
87 /* Flushes all VCPU TLBs: @arg must be NULL. */
88 #define HVMOP_flush_tlbs 5
89 
90 /*
91  * hvmmem_type_t should not be defined when generating the corresponding
92  * compat header. This will ensure that the improperly named HVMMEM_(*)
93  * values are defined only once.
94  */
95 #ifndef XEN_GENERATING_COMPAT_HEADERS
96 
97 typedef enum {
98  HVMMEM_ram_rw, /* Normal read/write guest RAM */
99  HVMMEM_ram_ro, /* Read-only; writes are discarded */
100  HVMMEM_mmio_dm, /* Reads and write go to the device model */
101 #if __XEN_INTERFACE_VERSION__ < 0x00040700
102  HVMMEM_mmio_write_dm, /* Read-only; writes go to the device model */
103 #else
104  HVMMEM_unused, /* Placeholder; setting memory to this type
105  will fail for code after 4.7.0 */
106 #endif
107  HVMMEM_ioreq_server /* Memory type claimed by an ioreq server; type
108  changes to this value are only allowed after
109  an ioreq server has claimed its ownership.
110  Only pages with HVMMEM_ram_rw are allowed to
111  change to this type; conversely, pages with
112  this type are only allowed to be changed back
113  to HVMMEM_ram_rw. */
114 } hvmmem_type_t;
115 
116 #endif /* XEN_GENERATING_COMPAT_HEADERS */
117 
118 /* Hint from PV drivers for pagetable destruction. */
119 #define HVMOP_pagetable_dying 9
121  /* Domain with a pagetable about to be destroyed. */
123  uint16_t pad[3]; /* align next field on 8-byte boundary */
124  /* guest physical address of the toplevel pagetable dying */
126 };
129 
130 /* Get the current Xen time, in nanoseconds since system boot. */
131 #define HVMOP_get_time 10
133  uint64_t now; /* OUT */
134 };
137 
138 #define HVMOP_xentrace 11
142 };
145 
146 /* Following tools-only interfaces may change in future. */
147 #if defined(__XEN__) || defined(__XEN_TOOLS__)
148 
149 /* Deprecated by XENMEM_access_op_set_access */
150 #define HVMOP_set_mem_access 12
151 
152 /* Deprecated by XENMEM_access_op_get_access */
153 #define HVMOP_get_mem_access 13
154 
155 #endif /* defined(__XEN__) || defined(__XEN_TOOLS__) */
156 
157 #define HVMOP_get_mem_type 15
158 /* Return hvmmem_type_t for the specified pfn. */
160  /* Domain to be queried. */
162  /* OUT variable. */
164  uint16_t pad[2]; /* align next field on 8-byte boundary */
165  /* IN variable. */
167 };
170 
171 /* Following tools-only interfaces may change in future. */
172 #if defined(__XEN__) || defined(__XEN_TOOLS__)
173 
174 /*
175  * Definitions relating to DMOP_create_ioreq_server. (Defined here for
176  * backwards compatibility).
177  */
178 
179 #define HVM_IOREQSRV_BUFIOREQ_OFF 0
180 #define HVM_IOREQSRV_BUFIOREQ_LEGACY 1
181 /*
182  * Use this when read_pointer gets updated atomically and
183  * the pointer pair gets read atomically:
184  */
185 #define HVM_IOREQSRV_BUFIOREQ_ATOMIC 2
186 
187 #endif /* defined(__XEN__) || defined(__XEN_TOOLS__) */
188 
189 #if defined(__i386__) || defined(__x86_64__)
190 
191 /*
192  * HVMOP_set_evtchn_upcall_vector: Set a <vector> that should be used for event
193  * channel upcalls on the specified <vcpu>. If set,
194  * this vector will be used in preference to the
195  * domain global callback via (see
196  * HVM_PARAM_CALLBACK_IRQ).
197  */
198 #define HVMOP_set_evtchn_upcall_vector 23
199 struct xen_hvm_evtchn_upcall_vector {
200  uint32_t vcpu;
201  uint8_t vector;
202 };
203 typedef struct xen_hvm_evtchn_upcall_vector xen_hvm_evtchn_upcall_vector_t;
204 DEFINE_XEN_GUEST_HANDLE(xen_hvm_evtchn_upcall_vector_t);
205 
206 #endif /* defined(__i386__) || defined(__x86_64__) */
207 
208 #define HVMOP_guest_request_vm_event 24
209 
210 /* HVMOP_altp2m: perform altp2m state operations */
211 #define HVMOP_altp2m 25
212 
213 #define HVMOP_ALTP2M_INTERFACE_VERSION 0x00000001
214 
216  /* IN or OUT variable on/off */
218 };
221 
225  /* #VE info area gfn */
227 };
230 
233 };
236 
238  /* IN/OUT variable */
240  uint16_t hvmmem_default_access; /* xenmem_access_t */
241 };
244 
245 #if __XEN_INTERFACE_VERSION__ < 0x00040a00
247  /* view */
249  /* Memory type */
250  uint16_t access; /* xenmem_access_t */
252  /* gfn */
254 };
257 #endif /* __XEN_INTERFACE_VERSION__ < 0x00040a00 */
258 
260  /* view */
262  /* Memory type */
263  uint16_t access; /* xenmem_access_t */
265  /* gfn */
267 };
270 
272  /* view */
275  /* Number of pages */
277  /*
278  * Used for continuation purposes.
279  * Must be set to zero upon initial invocation.
280  */
282  /* List of pfns to set access for */
283  XEN_GUEST_HANDLE(const_uint64) pfn_list;
284  /* Corresponding list of access settings for pfn_list */
285  XEN_GUEST_HANDLE(const_uint8) access_list;
286 };
287 
289  /* view */
293  /* old gfn */
295  /* new gfn, INVALID_GFN (~0UL) means revert */
297 };
300 
304 };
305 
310 };
311 
313  uint32_t version; /* HVMOP_ALTP2M_INTERFACE_VERSION */
315 /* Get/set the altp2m state for a domain */
316 #define HVMOP_altp2m_get_domain_state 1
317 #define HVMOP_altp2m_set_domain_state 2
318 /* Set a given VCPU to receive altp2m event notifications */
319 #define HVMOP_altp2m_vcpu_enable_notify 3
320 /* Create a new view */
321 #define HVMOP_altp2m_create_p2m 4
322 /* Destroy a view */
323 #define HVMOP_altp2m_destroy_p2m 5
324 /* Switch view for an entire domain */
325 #define HVMOP_altp2m_switch_p2m 6
326 /* Notify that a page of memory is to have specific access types */
327 #define HVMOP_altp2m_set_mem_access 7
328 /* Change a p2m entry to have a different gfn->mfn mapping */
329 #define HVMOP_altp2m_change_gfn 8
330 /* Set access for an array of pages */
331 #define HVMOP_altp2m_set_mem_access_multi 9
332 /* Set the "Suppress #VE" bit on a page */
333 #define HVMOP_altp2m_set_suppress_ve 10
334 /* Get the "Suppress #VE" bit of a page */
335 #define HVMOP_altp2m_get_suppress_ve 11
336 /* Get the access of a page of memory from a certain view */
337 #define HVMOP_altp2m_get_mem_access 12
338 /* Disable altp2m event notifications for a given VCPU */
339 #define HVMOP_altp2m_vcpu_disable_notify 13
340 /* Get the active vcpu p2m index */
341 #define HVMOP_altp2m_get_p2m_idx 14
342 /* Set the "Supress #VE" bit for a range of pages */
343 #define HVMOP_altp2m_set_suppress_ve_multi 15
344 /* Set visibility for a given altp2m view */
345 #define HVMOP_altp2m_set_visibility 16
349  union {
353 #if __XEN_INTERFACE_VERSION__ < 0x00040a00
355 #endif /* __XEN_INTERFACE_VERSION__ < 0x00040a00 */
365  } u;
366 };
369 
370 #endif /* __XEN_PUBLIC_HVM_HVM_OP_H__ */
371 
372 /*
373  * Local variables:
374  * mode: C
375  * c-file-style: "BSD"
376  * c-basic-offset: 4
377  * tab-width: 4
378  * indent-tabs-mode: nil
379  * End:
380  */
struct xen_hvm_altp2m_view view
Definition: hvm_op.h:352
unsigned short uint16_t
Definition: stdint.h:11
uint16_t domid_t
Definition: xen.h:608
union xen_hvm_altp2m_op::@608 u
uint32_t vector
MSI-X vector.
Definition: ena.h:20
struct xen_hvm_altp2m_mem_access mem_access
Definition: hvm_op.h:356
uint16_t mem_type
Definition: hvm_op.h:163
uint16_t pad[2]
Definition: hvm_op.h:164
uint32_t index
Definition: hvm_op.h:21
unsigned long long uint64_t
Definition: stdint.h:13
DEFINE_XEN_GUEST_HANDLE(xen_hvm_param_t)
FILE_LICENCE(MIT)
uint16_t view
Definition: hvm_op.h:239
struct xen_hvm_altp2m_vcpu_disable_notify disable_notify
Definition: hvm_op.h:361
uint64_t now
Definition: hvm_op.h:133
uint64_t value
Definition: hvm_op.h:22
domid_t domid
Definition: hvm_op.h:19
struct xen_hvm_altp2m_set_visibility set_visibility
Definition: hvm_op.h:363
uint32_t version
Definition: hvm_op.h:313
uint16_t pad
Definition: hvm_op.h:20
uint16_t extra_bytes
Definition: hvm_op.h:140
uint8_t pad[64]
Definition: hvm_op.h:364
struct xen_hvm_altp2m_vcpu_enable_notify enable_notify
Definition: hvm_op.h:351
uint16_t hvmmem_default_access
Definition: hvm_op.h:240
struct xen_hvm_altp2m_change_gfn change_gfn
Definition: hvm_op.h:357
struct xen_hvm_altp2m_suppress_ve_multi suppress_ve_multi
Definition: hvm_op.h:360
unsigned char uint8_t
Definition: stdint.h:10
struct xen_hvm_altp2m_suppress_ve suppress_ve
Definition: hvm_op.h:359
hvmmem_type_t
Definition: hvm_op.h:97
unsigned int uint32_t
Definition: stdint.h:12
uint16_t pad[3]
Definition: hvm_op.h:123
struct xen_hvm_altp2m_set_mem_access_multi set_mem_access_multi
Definition: hvm_op.h:358
XEN_GUEST_HANDLE(const_uint64) pfn_list
uint16_t pad1
Definition: hvm_op.h:347
signed int int32_t
Definition: stdint.h:17
struct xen_hvm_altp2m_get_vcpu_p2m_idx get_vcpu_p2m_idx
Definition: hvm_op.h:362
uint8_t extra[TRACE_EXTRA_MAX *sizeof(uint32_t)]
Definition: hvm_op.h:141
uint32_t cmd
Definition: hvm_op.h:314
struct xen_hvm_altp2m_domain_state domain_state
Definition: hvm_op.h:350
domid_t domain
Definition: hvm_op.h:346
struct xen_hvm_altp2m_set_mem_access set_mem_access
Definition: hvm_op.h:354
#define TRACE_EXTRA_MAX
Definition: trace.h:14
uint16_t event
Definition: hvm_op.h:140
uint32_t pad2
Definition: hvm_op.h:348