xref: /onnv-gate/usr/src/uts/common/xen/public/hvm/hvm_op.h (revision 10175:dd9708d1f561)
16144Srab /*
26144Srab  * Permission is hereby granted, free of charge, to any person obtaining a copy
36144Srab  * of this software and associated documentation files (the "Software"), to
46144Srab  * deal in the Software without restriction, including without limitation the
56144Srab  * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
66144Srab  * sell copies of the Software, and to permit persons to whom the Software is
76144Srab  * furnished to do so, subject to the following conditions:
86144Srab  *
96144Srab  * The above copyright notice and this permission notice shall be included in
106144Srab  * all copies or substantial portions of the Software.
116144Srab  *
126144Srab  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
136144Srab  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
146144Srab  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
156144Srab  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
166144Srab  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
176144Srab  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
186144Srab  * DEALINGS IN THE SOFTWARE.
196144Srab  */
206144Srab 
215084Sjohnlev #ifndef __XEN_PUBLIC_HVM_HVM_OP_H__
225084Sjohnlev #define __XEN_PUBLIC_HVM_HVM_OP_H__
235084Sjohnlev 
245084Sjohnlev /* Get/set subcommands: extra argument == pointer to xen_hvm_param struct. */
255084Sjohnlev #define HVMOP_set_param           0
265084Sjohnlev #define HVMOP_get_param           1
275084Sjohnlev struct xen_hvm_param {
285084Sjohnlev     domid_t  domid;    /* IN */
295084Sjohnlev     uint32_t index;    /* IN */
305084Sjohnlev     uint64_t value;    /* IN/OUT */
315084Sjohnlev };
325084Sjohnlev typedef struct xen_hvm_param xen_hvm_param_t;
335084Sjohnlev DEFINE_XEN_GUEST_HANDLE(xen_hvm_param_t);
345084Sjohnlev 
355084Sjohnlev /* Set the logical level of one of a domain's PCI INTx wires. */
365084Sjohnlev #define HVMOP_set_pci_intx_level  2
375084Sjohnlev struct xen_hvm_set_pci_intx_level {
385084Sjohnlev     /* Domain to be updated. */
395084Sjohnlev     domid_t  domid;
405084Sjohnlev     /* PCI INTx identification in PCI topology (domain:bus:device:intx). */
415084Sjohnlev     uint8_t  domain, bus, device, intx;
425084Sjohnlev     /* Assertion level (0 = unasserted, 1 = asserted). */
435084Sjohnlev     uint8_t  level;
445084Sjohnlev };
455084Sjohnlev typedef struct xen_hvm_set_pci_intx_level xen_hvm_set_pci_intx_level_t;
465084Sjohnlev DEFINE_XEN_GUEST_HANDLE(xen_hvm_set_pci_intx_level_t);
475084Sjohnlev 
485084Sjohnlev /* Set the logical level of one of a domain's ISA IRQ wires. */
495084Sjohnlev #define HVMOP_set_isa_irq_level   3
505084Sjohnlev struct xen_hvm_set_isa_irq_level {
515084Sjohnlev     /* Domain to be updated. */
525084Sjohnlev     domid_t  domid;
535084Sjohnlev     /* ISA device identification, by ISA IRQ (0-15). */
545084Sjohnlev     uint8_t  isa_irq;
555084Sjohnlev     /* Assertion level (0 = unasserted, 1 = asserted). */
565084Sjohnlev     uint8_t  level;
575084Sjohnlev };
585084Sjohnlev typedef struct xen_hvm_set_isa_irq_level xen_hvm_set_isa_irq_level_t;
595084Sjohnlev DEFINE_XEN_GUEST_HANDLE(xen_hvm_set_isa_irq_level_t);
605084Sjohnlev 
615084Sjohnlev #define HVMOP_set_pci_link_route  4
625084Sjohnlev struct xen_hvm_set_pci_link_route {
635084Sjohnlev     /* Domain to be updated. */
645084Sjohnlev     domid_t  domid;
655084Sjohnlev     /* PCI link identifier (0-3). */
665084Sjohnlev     uint8_t  link;
675084Sjohnlev     /* ISA IRQ (1-15), or 0 (disable link). */
685084Sjohnlev     uint8_t  isa_irq;
695084Sjohnlev };
705084Sjohnlev typedef struct xen_hvm_set_pci_link_route xen_hvm_set_pci_link_route_t;
715084Sjohnlev DEFINE_XEN_GUEST_HANDLE(xen_hvm_set_pci_link_route_t);
725084Sjohnlev 
736144Srab /* Flushes all VCPU TLBs: @arg must be NULL. */
746144Srab #define HVMOP_flush_tlbs          5
756144Srab 
76*10175SStuart.Maybee@Sun.COM /* Following tools-only interfaces may change in future. */
77*10175SStuart.Maybee@Sun.COM #if defined(__XEN__) || defined(__XEN_TOOLS__)
78*10175SStuart.Maybee@Sun.COM 
79*10175SStuart.Maybee@Sun.COM /* Track dirty VRAM. */
80*10175SStuart.Maybee@Sun.COM #define HVMOP_track_dirty_vram    6
81*10175SStuart.Maybee@Sun.COM struct xen_hvm_track_dirty_vram {
82*10175SStuart.Maybee@Sun.COM     /* Domain to be tracked. */
83*10175SStuart.Maybee@Sun.COM     domid_t  domid;
84*10175SStuart.Maybee@Sun.COM     /* First pfn to track. */
85*10175SStuart.Maybee@Sun.COM     uint64_aligned_t first_pfn;
86*10175SStuart.Maybee@Sun.COM     /* Number of pages to track. */
87*10175SStuart.Maybee@Sun.COM     uint64_aligned_t nr;
88*10175SStuart.Maybee@Sun.COM     /* OUT variable. */
89*10175SStuart.Maybee@Sun.COM     /* Dirty bitmap buffer. */
90*10175SStuart.Maybee@Sun.COM     XEN_GUEST_HANDLE_64(uint8) dirty_bitmap;
91*10175SStuart.Maybee@Sun.COM };
92*10175SStuart.Maybee@Sun.COM typedef struct xen_hvm_track_dirty_vram xen_hvm_track_dirty_vram_t;
93*10175SStuart.Maybee@Sun.COM DEFINE_XEN_GUEST_HANDLE(xen_hvm_track_dirty_vram_t);
94*10175SStuart.Maybee@Sun.COM 
95*10175SStuart.Maybee@Sun.COM /* Notify that some pages got modified by the Device Model. */
96*10175SStuart.Maybee@Sun.COM #define HVMOP_modified_memory    7
97*10175SStuart.Maybee@Sun.COM struct xen_hvm_modified_memory {
98*10175SStuart.Maybee@Sun.COM     /* Domain to be updated. */
99*10175SStuart.Maybee@Sun.COM     domid_t  domid;
100*10175SStuart.Maybee@Sun.COM     /* First pfn. */
101*10175SStuart.Maybee@Sun.COM     uint64_aligned_t first_pfn;
102*10175SStuart.Maybee@Sun.COM     /* Number of pages. */
103*10175SStuart.Maybee@Sun.COM     uint64_aligned_t nr;
104*10175SStuart.Maybee@Sun.COM };
105*10175SStuart.Maybee@Sun.COM typedef struct xen_hvm_modified_memory xen_hvm_modified_memory_t;
106*10175SStuart.Maybee@Sun.COM DEFINE_XEN_GUEST_HANDLE(xen_hvm_modified_memory_t);
107*10175SStuart.Maybee@Sun.COM 
108*10175SStuart.Maybee@Sun.COM #define HVMOP_set_mem_type    8
109*10175SStuart.Maybee@Sun.COM typedef enum {
110*10175SStuart.Maybee@Sun.COM     HVMMEM_ram_rw,             /* Normal read/write guest RAM */
111*10175SStuart.Maybee@Sun.COM     HVMMEM_ram_ro,             /* Read-only; writes are discarded */
112*10175SStuart.Maybee@Sun.COM     HVMMEM_mmio_dm,            /* Reads and write go to the device model */
113*10175SStuart.Maybee@Sun.COM } hvmmem_type_t;
114*10175SStuart.Maybee@Sun.COM /* Notify that a region of memory is to be treated in a specific way. */
115*10175SStuart.Maybee@Sun.COM struct xen_hvm_set_mem_type {
116*10175SStuart.Maybee@Sun.COM     /* Domain to be updated. */
117*10175SStuart.Maybee@Sun.COM     domid_t domid;
118*10175SStuart.Maybee@Sun.COM     /* Memory type */
119*10175SStuart.Maybee@Sun.COM     hvmmem_type_t hvmmem_type;
120*10175SStuart.Maybee@Sun.COM     /* First pfn. */
121*10175SStuart.Maybee@Sun.COM     uint64_aligned_t first_pfn;
122*10175SStuart.Maybee@Sun.COM     /* Number of pages. */
123*10175SStuart.Maybee@Sun.COM     uint64_aligned_t nr;
124*10175SStuart.Maybee@Sun.COM };
125*10175SStuart.Maybee@Sun.COM typedef struct xen_hvm_set_mem_type xen_hvm_set_mem_type_t;
126*10175SStuart.Maybee@Sun.COM DEFINE_XEN_GUEST_HANDLE(xen_hvm_set_mem_type_t);
127*10175SStuart.Maybee@Sun.COM 
128*10175SStuart.Maybee@Sun.COM 
129*10175SStuart.Maybee@Sun.COM #endif /* defined(__XEN__) || defined(__XEN_TOOLS__) */
130*10175SStuart.Maybee@Sun.COM 
1315084Sjohnlev #endif /* __XEN_PUBLIC_HVM_HVM_OP_H__ */
132