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_PHYSDEV_H__
22 #define __XEN_PUBLIC_PHYSDEV_H__
27 * Prototype for this hypercall is:
28 * int physdev_op(int cmd, void *args)
29 * @cmd == PHYSDEVOP_??? (physdev operation).
30 * @args == Operation-specific extra arguments (NULL if none).
34 * Notify end-of-interrupt (EOI) for the specified IRQ.
35 * @arg == pointer to physdev_eoi structure.
37 #define PHYSDEVOP_eoi 12
42 typedef struct physdev_eoi physdev_eoi_t;
43 DEFINE_XEN_GUEST_HANDLE(physdev_eoi_t);
46 * Register a shared page for the hypervisor to indicate whether the guest
47 * must issue PHYSDEVOP_eoi. The semantics of PHYSDEVOP_eoi change slightly
48 * once the guest used this function in that the associated event channel
49 * will automatically get unmasked. The page registered is used as a bit
50 * array indexed by Xen's PIRQ value.
52 #define PHYSDEVOP_pirq_eoi_gmfn_v1 17
54 * Register a shared page for the hypervisor to indicate whether the
55 * guest must issue PHYSDEVOP_eoi. This hypercall is very similar to
56 * PHYSDEVOP_pirq_eoi_gmfn_v1 but it doesn't change the semantics of
57 * PHYSDEVOP_eoi. The page registered is used as a bit array indexed by
60 #define PHYSDEVOP_pirq_eoi_gmfn_v2 28
61 struct physdev_pirq_eoi_gmfn {
65 typedef struct physdev_pirq_eoi_gmfn physdev_pirq_eoi_gmfn_t;
66 DEFINE_XEN_GUEST_HANDLE(physdev_pirq_eoi_gmfn_t);
69 * Query the status of an IRQ line.
70 * @arg == pointer to physdev_irq_status_query structure.
72 #define PHYSDEVOP_irq_status_query 5
73 struct physdev_irq_status_query {
77 uint32_t flags; /* XENIRQSTAT_* */
79 typedef struct physdev_irq_status_query physdev_irq_status_query_t;
80 DEFINE_XEN_GUEST_HANDLE(physdev_irq_status_query_t);
82 /* Need to call PHYSDEVOP_eoi when the IRQ has been serviced? */
83 #define _XENIRQSTAT_needs_eoi (0)
84 #define XENIRQSTAT_needs_eoi (1U<<_XENIRQSTAT_needs_eoi)
86 /* IRQ shared by multiple guests? */
87 #define _XENIRQSTAT_shared (1)
88 #define XENIRQSTAT_shared (1U<<_XENIRQSTAT_shared)
91 * Set the current VCPU's I/O privilege level.
92 * @arg == pointer to physdev_set_iopl structure.
94 #define PHYSDEVOP_set_iopl 6
95 struct physdev_set_iopl {
99 typedef struct physdev_set_iopl physdev_set_iopl_t;
100 DEFINE_XEN_GUEST_HANDLE(physdev_set_iopl_t);
103 * Set the current VCPU's I/O-port permissions bitmap.
104 * @arg == pointer to physdev_set_iobitmap structure.
106 #define PHYSDEVOP_set_iobitmap 7
107 struct physdev_set_iobitmap {
109 #if __XEN_INTERFACE_VERSION__ >= 0x00030205
110 XEN_GUEST_HANDLE(uint8) bitmap;
116 typedef struct physdev_set_iobitmap physdev_set_iobitmap_t;
117 DEFINE_XEN_GUEST_HANDLE(physdev_set_iobitmap_t);
120 * Read or write an IO-APIC register.
121 * @arg == pointer to physdev_apic structure.
123 #define PHYSDEVOP_apic_read 8
124 #define PHYSDEVOP_apic_write 9
125 struct physdev_apic {
127 unsigned long apic_physbase;
132 typedef struct physdev_apic physdev_apic_t;
133 DEFINE_XEN_GUEST_HANDLE(physdev_apic_t);
136 * Allocate or free a physical upcall vector for the specified IRQ line.
137 * @arg == pointer to physdev_irq structure.
139 #define PHYSDEVOP_alloc_irq_vector 10
140 #define PHYSDEVOP_free_irq_vector 11
147 typedef struct physdev_irq physdev_irq_t;
148 DEFINE_XEN_GUEST_HANDLE(physdev_irq_t);
150 #define MAP_PIRQ_TYPE_MSI 0x0
151 #define MAP_PIRQ_TYPE_GSI 0x1
152 #define MAP_PIRQ_TYPE_UNKNOWN 0x2
153 #define MAP_PIRQ_TYPE_MSI_SEG 0x3
155 #define PHYSDEVOP_map_pirq 13
156 struct physdev_map_pirq {
164 /* IN - high 16 bits hold segment for MAP_PIRQ_TYPE_MSI_SEG */
173 typedef struct physdev_map_pirq physdev_map_pirq_t;
174 DEFINE_XEN_GUEST_HANDLE(physdev_map_pirq_t);
176 #define PHYSDEVOP_unmap_pirq 14
177 struct physdev_unmap_pirq {
182 typedef struct physdev_unmap_pirq physdev_unmap_pirq_t;
183 DEFINE_XEN_GUEST_HANDLE(physdev_unmap_pirq_t);
185 #define PHYSDEVOP_manage_pci_add 15
186 #define PHYSDEVOP_manage_pci_remove 16
187 struct physdev_manage_pci {
192 typedef struct physdev_manage_pci physdev_manage_pci_t;
193 DEFINE_XEN_GUEST_HANDLE(physdev_manage_pci_t);
195 #define PHYSDEVOP_restore_msi 19
196 struct physdev_restore_msi {
201 typedef struct physdev_restore_msi physdev_restore_msi_t;
202 DEFINE_XEN_GUEST_HANDLE(physdev_restore_msi_t);
204 #define PHYSDEVOP_manage_pci_add_ext 20
205 struct physdev_manage_pci_ext {
216 typedef struct physdev_manage_pci_ext physdev_manage_pci_ext_t;
217 DEFINE_XEN_GUEST_HANDLE(physdev_manage_pci_ext_t);
220 * Argument to physdev_op_compat() hypercall. Superceded by new physdev_op()
221 * hypercall since 0x00030202.
226 struct physdev_irq_status_query irq_status_query;
227 struct physdev_set_iopl set_iopl;
228 struct physdev_set_iobitmap set_iobitmap;
229 struct physdev_apic apic_op;
230 struct physdev_irq irq_op;
233 typedef struct physdev_op physdev_op_t;
234 DEFINE_XEN_GUEST_HANDLE(physdev_op_t);
236 #define PHYSDEVOP_setup_gsi 21
237 struct physdev_setup_gsi {
245 typedef struct physdev_setup_gsi physdev_setup_gsi_t;
246 DEFINE_XEN_GUEST_HANDLE(physdev_setup_gsi_t);
248 /* leave PHYSDEVOP 22 free */
250 /* type is MAP_PIRQ_TYPE_GSI or MAP_PIRQ_TYPE_MSI
251 * the hypercall returns a free pirq */
252 #define PHYSDEVOP_get_free_pirq 23
253 struct physdev_get_free_pirq {
259 typedef struct physdev_get_free_pirq physdev_get_free_pirq_t;
260 DEFINE_XEN_GUEST_HANDLE(physdev_get_free_pirq_t);
262 #define XEN_PCI_MMCFG_RESERVED 0x1
264 #define PHYSDEVOP_pci_mmcfg_reserved 24
265 struct physdev_pci_mmcfg_reserved {
272 typedef struct physdev_pci_mmcfg_reserved physdev_pci_mmcfg_reserved_t;
273 DEFINE_XEN_GUEST_HANDLE(physdev_pci_mmcfg_reserved_t);
275 #define XEN_PCI_DEV_EXTFN 0x1
276 #define XEN_PCI_DEV_VIRTFN 0x2
277 #define XEN_PCI_DEV_PXM 0x4
279 #define PHYSDEVOP_pci_device_add 25
280 struct physdev_pci_device_add {
290 #if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
292 #elif defined(__GNUC__)
296 typedef struct physdev_pci_device_add physdev_pci_device_add_t;
297 DEFINE_XEN_GUEST_HANDLE(physdev_pci_device_add_t);
299 #define PHYSDEVOP_pci_device_remove 26
300 #define PHYSDEVOP_restore_msi_ext 27
301 struct physdev_pci_device {
307 typedef struct physdev_pci_device physdev_pci_device_t;
308 DEFINE_XEN_GUEST_HANDLE(physdev_pci_device_t);
311 * Notify that some PIRQ-bound event channels have been unmasked.
312 * ** This command is obsolete since interface version 0x00030202 and is **
313 * ** unsupported by newer versions of Xen. **
315 #define PHYSDEVOP_IRQ_UNMASK_NOTIFY 4
318 * These all-capitals physdev operation names are superceded by the new names
319 * (defined above) since interface version 0x00030202.
321 #define PHYSDEVOP_IRQ_STATUS_QUERY PHYSDEVOP_irq_status_query
322 #define PHYSDEVOP_SET_IOPL PHYSDEVOP_set_iopl
323 #define PHYSDEVOP_SET_IOBITMAP PHYSDEVOP_set_iobitmap
324 #define PHYSDEVOP_APIC_READ PHYSDEVOP_apic_read
325 #define PHYSDEVOP_APIC_WRITE PHYSDEVOP_apic_write
326 #define PHYSDEVOP_ASSIGN_VECTOR PHYSDEVOP_alloc_irq_vector
327 #define PHYSDEVOP_FREE_VECTOR PHYSDEVOP_free_irq_vector
328 #define PHYSDEVOP_IRQ_NEEDS_UNMASK_NOTIFY XENIRQSTAT_needs_eoi
329 #define PHYSDEVOP_IRQ_SHARED XENIRQSTAT_shared
331 #if __XEN_INTERFACE_VERSION__ < 0x00040200
332 #define PHYSDEVOP_pirq_eoi_gmfn PHYSDEVOP_pirq_eoi_gmfn_v1
334 #define PHYSDEVOP_pirq_eoi_gmfn PHYSDEVOP_pirq_eoi_gmfn_v2
337 #endif /* __XEN_PUBLIC_PHYSDEV_H__ */