1 /* SPDX-License-Identifier: MIT */
3 * Copyright (c) 2007, Keir Fraser
6 #ifndef __XEN_PUBLIC_HVM_HVM_OP_H__
7 #define __XEN_PUBLIC_HVM_HVM_OP_H__
11 #include "../event_channel.h"
13 /* Get/set subcommands: extra argument == pointer to xen_hvm_param struct. */
14 #define HVMOP_set_param 0
15 #define HVMOP_get_param 1
16 struct xen_hvm_param
{
17 domid_t domid
; /* IN */
19 uint32_t index
; /* IN */
20 uint64_t value
; /* IN/OUT */
22 typedef struct xen_hvm_param xen_hvm_param_t
;
23 DEFINE_XEN_GUEST_HANDLE(xen_hvm_param_t
);
25 struct xen_hvm_altp2m_suppress_ve
{
27 uint8_t suppress_ve
; /* Boolean type. */
33 struct xen_hvm_altp2m_suppress_ve_multi
{
35 uint8_t suppress_ve
; /* Boolean type. */
37 int32_t first_error
; /* Should be set to 0. */
38 uint64_t first_gfn
; /* Value may be updated. */
40 uint64_t first_error_gfn
; /* Gfn of the first error. */
43 #if __XEN_INTERFACE_VERSION__ < 0x00040900
45 /* Set the logical level of one of a domain's PCI INTx wires. */
46 #define HVMOP_set_pci_intx_level 2
47 struct xen_hvm_set_pci_intx_level
{
48 /* Domain to be updated. */
50 /* PCI INTx identification in PCI topology (domain:bus:device:intx). */
51 uint8_t domain
, bus
, device
, intx
;
52 /* Assertion level (0 = unasserted, 1 = asserted). */
55 typedef struct xen_hvm_set_pci_intx_level xen_hvm_set_pci_intx_level_t
;
56 DEFINE_XEN_GUEST_HANDLE(xen_hvm_set_pci_intx_level_t
);
58 /* Set the logical level of one of a domain's ISA IRQ wires. */
59 #define HVMOP_set_isa_irq_level 3
60 struct xen_hvm_set_isa_irq_level
{
61 /* Domain to be updated. */
63 /* ISA device identification, by ISA IRQ (0-15). */
65 /* Assertion level (0 = unasserted, 1 = asserted). */
68 typedef struct xen_hvm_set_isa_irq_level xen_hvm_set_isa_irq_level_t
;
69 DEFINE_XEN_GUEST_HANDLE(xen_hvm_set_isa_irq_level_t
);
71 #define HVMOP_set_pci_link_route 4
72 struct xen_hvm_set_pci_link_route
{
73 /* Domain to be updated. */
75 /* PCI link identifier (0-3). */
77 /* ISA IRQ (1-15), or 0 (disable link). */
80 typedef struct xen_hvm_set_pci_link_route xen_hvm_set_pci_link_route_t
;
81 DEFINE_XEN_GUEST_HANDLE(xen_hvm_set_pci_link_route_t
);
83 #endif /* __XEN_INTERFACE_VERSION__ < 0x00040900 */
85 /* Flushes all VCPU TLBs: @arg must be NULL. */
86 #define HVMOP_flush_tlbs 5
89 * hvmmem_type_t should not be defined when generating the corresponding
90 * compat header. This will ensure that the improperly named HVMMEM_(*)
91 * values are defined only once.
93 #ifndef XEN_GENERATING_COMPAT_HEADERS
96 HVMMEM_ram_rw
, /* Normal read/write guest RAM */
97 HVMMEM_ram_ro
, /* Read-only; writes are discarded */
98 HVMMEM_mmio_dm
, /* Reads and write go to the device model */
99 #if __XEN_INTERFACE_VERSION__ < 0x00040700
100 HVMMEM_mmio_write_dm
, /* Read-only; writes go to the device model */
102 HVMMEM_unused
, /* Placeholder; setting memory to this type
103 will fail for code after 4.7.0 */
105 HVMMEM_ioreq_server
/* Memory type claimed by an ioreq server; type
106 changes to this value are only allowed after
107 an ioreq server has claimed its ownership.
108 Only pages with HVMMEM_ram_rw are allowed to
109 change to this type; conversely, pages with
110 this type are only allowed to be changed back
114 #endif /* XEN_GENERATING_COMPAT_HEADERS */
116 /* Hint from PV drivers for pagetable destruction. */
117 #define HVMOP_pagetable_dying 9
118 struct xen_hvm_pagetable_dying
{
119 /* Domain with a pagetable about to be destroyed. */
121 uint16_t pad
[3]; /* align next field on 8-byte boundary */
122 /* guest physical address of the toplevel pagetable dying */
125 typedef struct xen_hvm_pagetable_dying xen_hvm_pagetable_dying_t
;
126 DEFINE_XEN_GUEST_HANDLE(xen_hvm_pagetable_dying_t
);
128 /* Get the current Xen time, in nanoseconds since system boot. */
129 #define HVMOP_get_time 10
130 struct xen_hvm_get_time
{
131 uint64_t now
; /* OUT */
133 typedef struct xen_hvm_get_time xen_hvm_get_time_t
;
134 DEFINE_XEN_GUEST_HANDLE(xen_hvm_get_time_t
);
136 #define HVMOP_xentrace 11
137 struct xen_hvm_xentrace
{
138 uint16_t event
, extra_bytes
;
139 uint8_t extra
[TRACE_EXTRA_MAX
* sizeof(uint32_t)];
141 typedef struct xen_hvm_xentrace xen_hvm_xentrace_t
;
142 DEFINE_XEN_GUEST_HANDLE(xen_hvm_xentrace_t
);
144 /* Following tools-only interfaces may change in future. */
145 #if defined(__XEN__) || defined(__XEN_TOOLS__)
147 /* Deprecated by XENMEM_access_op_set_access */
148 #define HVMOP_set_mem_access 12
150 /* Deprecated by XENMEM_access_op_get_access */
151 #define HVMOP_get_mem_access 13
153 #endif /* defined(__XEN__) || defined(__XEN_TOOLS__) */
155 #define HVMOP_get_mem_type 15
156 /* Return hvmmem_type_t for the specified pfn. */
157 struct xen_hvm_get_mem_type
{
158 /* Domain to be queried. */
162 uint16_t pad
[2]; /* align next field on 8-byte boundary */
166 typedef struct xen_hvm_get_mem_type xen_hvm_get_mem_type_t
;
167 DEFINE_XEN_GUEST_HANDLE(xen_hvm_get_mem_type_t
);
169 /* Following tools-only interfaces may change in future. */
170 #if defined(__XEN__) || defined(__XEN_TOOLS__)
173 * Definitions relating to DMOP_create_ioreq_server. (Defined here for
174 * backwards compatibility).
177 #define HVM_IOREQSRV_BUFIOREQ_OFF 0
178 #define HVM_IOREQSRV_BUFIOREQ_LEGACY 1
180 * Use this when read_pointer gets updated atomically and
181 * the pointer pair gets read atomically:
183 #define HVM_IOREQSRV_BUFIOREQ_ATOMIC 2
185 #endif /* defined(__XEN__) || defined(__XEN_TOOLS__) */
187 #if defined(__i386__) || defined(__x86_64__)
190 * HVMOP_set_evtchn_upcall_vector: Set a <vector> that should be used for event
191 * channel upcalls on the specified <vcpu>. If set,
192 * this vector will be used in preference to the
193 * domain global callback via (see
194 * HVM_PARAM_CALLBACK_IRQ).
196 #define HVMOP_set_evtchn_upcall_vector 23
197 struct xen_hvm_evtchn_upcall_vector
{
201 typedef struct xen_hvm_evtchn_upcall_vector xen_hvm_evtchn_upcall_vector_t
;
202 DEFINE_XEN_GUEST_HANDLE(xen_hvm_evtchn_upcall_vector_t
);
204 #endif /* defined(__i386__) || defined(__x86_64__) */
206 #define HVMOP_guest_request_vm_event 24
208 /* HVMOP_altp2m: perform altp2m state operations */
209 #define HVMOP_altp2m 25
211 #define HVMOP_ALTP2M_INTERFACE_VERSION 0x00000001
213 struct xen_hvm_altp2m_domain_state
{
214 /* IN or OUT variable on/off */
217 typedef struct xen_hvm_altp2m_domain_state xen_hvm_altp2m_domain_state_t
;
218 DEFINE_XEN_GUEST_HANDLE(xen_hvm_altp2m_domain_state_t
);
220 struct xen_hvm_altp2m_vcpu_enable_notify
{
223 /* #VE info area gfn */
226 typedef struct xen_hvm_altp2m_vcpu_enable_notify xen_hvm_altp2m_vcpu_enable_notify_t
;
227 DEFINE_XEN_GUEST_HANDLE(xen_hvm_altp2m_vcpu_enable_notify_t
);
229 struct xen_hvm_altp2m_vcpu_disable_notify
{
232 typedef struct xen_hvm_altp2m_vcpu_disable_notify xen_hvm_altp2m_vcpu_disable_notify_t
;
233 DEFINE_XEN_GUEST_HANDLE(xen_hvm_altp2m_vcpu_disable_notify_t
);
235 struct xen_hvm_altp2m_view
{
236 /* IN/OUT variable */
238 uint16_t hvmmem_default_access
; /* xenmem_access_t */
240 typedef struct xen_hvm_altp2m_view xen_hvm_altp2m_view_t
;
241 DEFINE_XEN_GUEST_HANDLE(xen_hvm_altp2m_view_t
);
243 #if __XEN_INTERFACE_VERSION__ < 0x00040a00
244 struct xen_hvm_altp2m_set_mem_access
{
248 uint16_t access
; /* xenmem_access_t */
253 typedef struct xen_hvm_altp2m_set_mem_access xen_hvm_altp2m_set_mem_access_t
;
254 DEFINE_XEN_GUEST_HANDLE(xen_hvm_altp2m_set_mem_access_t
);
255 #endif /* __XEN_INTERFACE_VERSION__ < 0x00040a00 */
257 struct xen_hvm_altp2m_mem_access
{
261 uint16_t access
; /* xenmem_access_t */
266 typedef struct xen_hvm_altp2m_mem_access xen_hvm_altp2m_mem_access_t
;
267 DEFINE_XEN_GUEST_HANDLE(xen_hvm_altp2m_mem_access_t
);
269 struct xen_hvm_altp2m_set_mem_access_multi
{
273 /* Number of pages */
276 * Used for continuation purposes.
277 * Must be set to zero upon initial invocation.
280 /* List of pfns to set access for */
281 XEN_GUEST_HANDLE(const_uint64
) pfn_list
;
282 /* Corresponding list of access settings for pfn_list */
283 XEN_GUEST_HANDLE(const_uint8
) access_list
;
286 struct xen_hvm_altp2m_change_gfn
{
293 /* new gfn, INVALID_GFN (~0UL) means revert */
296 typedef struct xen_hvm_altp2m_change_gfn xen_hvm_altp2m_change_gfn_t
;
297 DEFINE_XEN_GUEST_HANDLE(xen_hvm_altp2m_change_gfn_t
);
299 struct xen_hvm_altp2m_get_vcpu_p2m_idx
{
304 struct xen_hvm_altp2m_set_visibility
{
310 struct xen_hvm_altp2m_op
{
311 uint32_t version
; /* HVMOP_ALTP2M_INTERFACE_VERSION */
313 /* Get/set the altp2m state for a domain */
314 #define HVMOP_altp2m_get_domain_state 1
315 #define HVMOP_altp2m_set_domain_state 2
316 /* Set a given VCPU to receive altp2m event notifications */
317 #define HVMOP_altp2m_vcpu_enable_notify 3
318 /* Create a new view */
319 #define HVMOP_altp2m_create_p2m 4
321 #define HVMOP_altp2m_destroy_p2m 5
322 /* Switch view for an entire domain */
323 #define HVMOP_altp2m_switch_p2m 6
324 /* Notify that a page of memory is to have specific access types */
325 #define HVMOP_altp2m_set_mem_access 7
326 /* Change a p2m entry to have a different gfn->mfn mapping */
327 #define HVMOP_altp2m_change_gfn 8
328 /* Set access for an array of pages */
329 #define HVMOP_altp2m_set_mem_access_multi 9
330 /* Set the "Suppress #VE" bit on a page */
331 #define HVMOP_altp2m_set_suppress_ve 10
332 /* Get the "Suppress #VE" bit of a page */
333 #define HVMOP_altp2m_get_suppress_ve 11
334 /* Get the access of a page of memory from a certain view */
335 #define HVMOP_altp2m_get_mem_access 12
336 /* Disable altp2m event notifications for a given VCPU */
337 #define HVMOP_altp2m_vcpu_disable_notify 13
338 /* Get the active vcpu p2m index */
339 #define HVMOP_altp2m_get_p2m_idx 14
340 /* Set the "Supress #VE" bit for a range of pages */
341 #define HVMOP_altp2m_set_suppress_ve_multi 15
342 /* Set visibility for a given altp2m view */
343 #define HVMOP_altp2m_set_visibility 16
348 struct xen_hvm_altp2m_domain_state domain_state
;
349 struct xen_hvm_altp2m_vcpu_enable_notify enable_notify
;
350 struct xen_hvm_altp2m_view view
;
351 #if __XEN_INTERFACE_VERSION__ < 0x00040a00
352 struct xen_hvm_altp2m_set_mem_access set_mem_access
;
353 #endif /* __XEN_INTERFACE_VERSION__ < 0x00040a00 */
354 struct xen_hvm_altp2m_mem_access mem_access
;
355 struct xen_hvm_altp2m_change_gfn change_gfn
;
356 struct xen_hvm_altp2m_set_mem_access_multi set_mem_access_multi
;
357 struct xen_hvm_altp2m_suppress_ve suppress_ve
;
358 struct xen_hvm_altp2m_suppress_ve_multi suppress_ve_multi
;
359 struct xen_hvm_altp2m_vcpu_disable_notify disable_notify
;
360 struct xen_hvm_altp2m_get_vcpu_p2m_idx get_vcpu_p2m_idx
;
361 struct xen_hvm_altp2m_set_visibility set_visibility
;
365 typedef struct xen_hvm_altp2m_op xen_hvm_altp2m_op_t
;
366 DEFINE_XEN_GUEST_HANDLE(xen_hvm_altp2m_op_t
);
368 #endif /* __XEN_PUBLIC_HVM_HVM_OP_H__ */
373 * c-file-style: "BSD"
376 * indent-tabs-mode: nil