2 * Permission is hereby granted, free of charge, to any person obtaining a copy
3 * of this software and associated documentation files (the "Software"), to
4 * deal in the Software without restriction, including without limitation the
5 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
6 * sell copies of the Software, and to permit persons to whom the Software is
7 * furnished to do so, subject to the following conditions:
9 * The above copyright notice and this permission notice shall be included in
10 * all copies or substantial portions of the Software.
12 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
13 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
14 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
15 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
16 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
17 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
18 * DEALINGS IN THE SOFTWARE.
21 #ifndef __XEN_PUBLIC_HVM_HVM_OP_H__
22 #define __XEN_PUBLIC_HVM_HVM_OP_H__
27 /* Get/set subcommands: the second argument of the hypercall is a
28 * pointer to a xen_hvm_param struct. */
29 #define HVMOP_set_param 0
30 #define HVMOP_get_param 1
31 struct xen_hvm_param {
32 domid_t domid; /* IN */
33 uint32_t index; /* IN */
34 uint64_t value; /* IN/OUT */
36 DEFINE_GUEST_HANDLE_STRUCT(xen_hvm_param);
37 typedef struct xen_hvm_param xen_hvm_param_t;
38 DEFINE_XEN_GUEST_HANDLE(xen_hvm_param_t);
40 /* Set the logical level of one of a domain's PCI INTx wires. */
41 #define HVMOP_set_pci_intx_level 2
42 struct xen_hvm_set_pci_intx_level {
43 /* Domain to be updated. */
45 /* PCI INTx identification in PCI topology (domain:bus:device:intx). */
46 uint8_t domain, bus, device, intx;
47 /* Assertion level (0 = unasserted, 1 = asserted). */
50 typedef struct xen_hvm_set_pci_intx_level xen_hvm_set_pci_intx_level_t;
51 DEFINE_XEN_GUEST_HANDLE(xen_hvm_set_pci_intx_level_t);
53 /* Set the logical level of one of a domain's ISA IRQ wires. */
54 #define HVMOP_set_isa_irq_level 3
55 struct xen_hvm_set_isa_irq_level {
56 /* Domain to be updated. */
58 /* ISA device identification, by ISA IRQ (0-15). */
60 /* Assertion level (0 = unasserted, 1 = asserted). */
63 typedef struct xen_hvm_set_isa_irq_level xen_hvm_set_isa_irq_level_t;
64 DEFINE_XEN_GUEST_HANDLE(xen_hvm_set_isa_irq_level_t);
66 #define HVMOP_set_pci_link_route 4
67 struct xen_hvm_set_pci_link_route {
68 /* Domain to be updated. */
70 /* PCI link identifier (0-3). */
72 /* ISA IRQ (1-15), or 0 (disable link). */
75 typedef struct xen_hvm_set_pci_link_route xen_hvm_set_pci_link_route_t;
76 DEFINE_XEN_GUEST_HANDLE(xen_hvm_set_pci_link_route_t);
78 /* Flushes all VCPU TLBs: @arg must be NULL. */
79 #define HVMOP_flush_tlbs 5
82 HVMMEM_ram_rw, /* Normal read/write guest RAM */
83 HVMMEM_ram_ro, /* Read-only; writes are discarded */
84 HVMMEM_mmio_dm, /* Reads and write go to the device model */
87 /* Following tools-only interfaces may change in future. */
88 #if defined(__XEN__) || defined(__XEN_TOOLS__)
90 /* Track dirty VRAM. */
91 #define HVMOP_track_dirty_vram 6
92 struct xen_hvm_track_dirty_vram {
93 /* Domain to be tracked. */
95 /* First pfn to track. */
96 uint64_aligned_t first_pfn;
97 /* Number of pages to track. */
100 /* Dirty bitmap buffer. */
101 XEN_GUEST_HANDLE_64(uint8) dirty_bitmap;
103 typedef struct xen_hvm_track_dirty_vram xen_hvm_track_dirty_vram_t;
104 DEFINE_XEN_GUEST_HANDLE(xen_hvm_track_dirty_vram_t);
106 /* Notify that some pages got modified by the Device Model. */
107 #define HVMOP_modified_memory 7
108 struct xen_hvm_modified_memory {
109 /* Domain to be updated. */
112 uint64_aligned_t first_pfn;
113 /* Number of pages. */
116 typedef struct xen_hvm_modified_memory xen_hvm_modified_memory_t;
117 DEFINE_XEN_GUEST_HANDLE(xen_hvm_modified_memory_t);
119 #define HVMOP_set_mem_type 8
120 /* Notify that a region of memory is to be treated in a specific way. */
121 struct xen_hvm_set_mem_type {
122 /* Domain to be updated. */
125 uint16_t hvmmem_type;
126 /* Number of pages. */
129 uint64_aligned_t first_pfn;
131 typedef struct xen_hvm_set_mem_type xen_hvm_set_mem_type_t;
132 DEFINE_XEN_GUEST_HANDLE(xen_hvm_set_mem_type_t);
134 #endif /* defined(__XEN__) || defined(__XEN_TOOLS__) */
136 /* Hint from PV drivers for pagetable destruction. */
137 #define HVMOP_pagetable_dying 9
138 struct xen_hvm_pagetable_dying {
139 /* Domain with a pagetable about to be destroyed. */
141 uint16_t pad[3]; /* align next field on 8-byte boundary */
142 /* guest physical address of the toplevel pagetable dying */
145 DEFINE_GUEST_HANDLE_STRUCT(xen_hvm_pagetable_dying);
146 typedef struct xen_hvm_pagetable_dying xen_hvm_pagetable_dying_t;
147 DEFINE_XEN_GUEST_HANDLE(xen_hvm_pagetable_dying_t);
149 /* Get the current Xen time, in nanoseconds since system boot. */
150 #define HVMOP_get_time 10
151 struct xen_hvm_get_time {
152 uint64_t now; /* OUT */
154 typedef struct xen_hvm_get_time xen_hvm_get_time_t;
155 DEFINE_XEN_GUEST_HANDLE(xen_hvm_get_time_t);
157 #define HVMOP_xentrace 11
158 struct xen_hvm_xentrace {
159 uint16_t event, extra_bytes;
160 uint8_t extra[TRACE_EXTRA_MAX * sizeof(uint32_t)];
162 typedef struct xen_hvm_xentrace xen_hvm_xentrace_t;
163 DEFINE_XEN_GUEST_HANDLE(xen_hvm_xentrace_t);
165 /* Following tools-only interfaces may change in future. */
166 #if defined(__XEN__) || defined(__XEN_TOOLS__)
168 #define HVMOP_set_mem_access 12
178 HVMMEM_access_rx2rw, /* Page starts off as r-x, but automatically
179 * change to r-w on a write */
180 HVMMEM_access_n2rwx, /* Log access: starts off as n, automatically
181 * goes to rwx, generating an event without
182 * pausing the vcpu */
183 HVMMEM_access_default /* Take the domain default */
185 /* Notify that a region of memory is to have specific access types */
186 struct xen_hvm_set_mem_access {
187 /* Domain to be updated. */
190 uint16_t hvmmem_access; /* hvm_access_t */
191 /* Number of pages, ignored on setting default access */
193 /* First pfn, or ~0ull to set the default access for new pages */
194 uint64_aligned_t first_pfn;
196 typedef struct xen_hvm_set_mem_access xen_hvm_set_mem_access_t;
197 DEFINE_XEN_GUEST_HANDLE(xen_hvm_set_mem_access_t);
199 #define HVMOP_get_mem_access 13
200 /* Get the specific access type for that region of memory */
201 struct xen_hvm_get_mem_access {
202 /* Domain to be queried. */
204 /* Memory type: OUT */
205 uint16_t hvmmem_access; /* hvm_access_t */
206 /* pfn, or ~0ull for default access for new pages. IN */
207 uint64_aligned_t pfn;
209 typedef struct xen_hvm_get_mem_access xen_hvm_get_mem_access_t;
210 DEFINE_XEN_GUEST_HANDLE(xen_hvm_get_mem_access_t);
212 #define HVMOP_inject_trap 14
213 /* Inject a trap into a VCPU, which will get taken up on the next
214 * scheduling of it. Note that the caller should know enough of the
215 * state of the CPU before injecting, to know what the effect of
216 * injecting the trap will be.
218 struct xen_hvm_inject_trap {
219 /* Domain to be queried. */
225 /* Error code, or -1 to skip */
227 /* CR2 for page faults */
228 uint64_aligned_t cr2;
230 typedef struct xen_hvm_inject_trap xen_hvm_inject_trap_t;
231 DEFINE_XEN_GUEST_HANDLE(xen_hvm_inject_trap_t);
233 #endif /* defined(__XEN__) || defined(__XEN_TOOLS__) */
235 #define HVMOP_get_mem_type 15
236 /* Return hvmmem_type_t for the specified pfn. */
237 struct xen_hvm_get_mem_type {
238 /* Domain to be queried. */
242 uint16_t pad[2]; /* align next field on 8-byte boundary */
246 typedef struct xen_hvm_get_mem_type xen_hvm_get_mem_type_t;
247 DEFINE_XEN_GUEST_HANDLE(xen_hvm_get_mem_type_t);
249 /* Following tools-only interfaces may change in future. */
250 #if defined(__XEN__) || defined(__XEN_TOOLS__)
252 /* MSI injection for emulated devices */
253 #define HVMOP_inject_msi 16
254 struct xen_hvm_inject_msi {
255 /* Domain to be injected */
257 /* Data -- lower 32 bits */
259 /* Address (0xfeexxxxx) */
262 typedef struct xen_hvm_inject_msi xen_hvm_inject_msi_t;
263 DEFINE_XEN_GUEST_HANDLE(xen_hvm_inject_msi_t);
265 #endif /* defined(__XEN__) || defined(__XEN_TOOLS__) */
267 #endif /* __XEN_PUBLIC_HVM_HVM_OP_H__ */