xref: /illumos-gate/usr/src/uts/common/xen/sys/privcmd.h (revision 2d6eb4a5)
1*843e1988Sjohnlev /*
2*843e1988Sjohnlev  * Copyright (c) 2003-2005, K A Fraser
3*843e1988Sjohnlev  *
4*843e1988Sjohnlev  * This file may be distributed separately from the Linux kernel, or
5*843e1988Sjohnlev  * incorporated into other software packages, subject to the following license:
6*843e1988Sjohnlev  *
7*843e1988Sjohnlev  * Permission is hereby granted, free of charge, to any person obtaining a copy
8*843e1988Sjohnlev  * of this source file (the "Software"), to deal in the Software without
9*843e1988Sjohnlev  * restriction, including without limitation the rights to use, copy, modify,
10*843e1988Sjohnlev  * merge, publish, distribute, sublicense, and/or sell copies of the Software,
11*843e1988Sjohnlev  * and to permit persons to whom the Software is furnished to do so, subject to
12*843e1988Sjohnlev  * the following conditions:
13*843e1988Sjohnlev  *
14*843e1988Sjohnlev  * The above copyright notice and this permission notice shall be included in
15*843e1988Sjohnlev  * all copies or substantial portions of the Software.
16*843e1988Sjohnlev  *
17*843e1988Sjohnlev  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18*843e1988Sjohnlev  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19*843e1988Sjohnlev  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20*843e1988Sjohnlev  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21*843e1988Sjohnlev  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22*843e1988Sjohnlev  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
23*843e1988Sjohnlev  * IN THE SOFTWARE.
24*843e1988Sjohnlev  */
25*843e1988Sjohnlev 
26*843e1988Sjohnlev /*
27*843e1988Sjohnlev  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
28*843e1988Sjohnlev  * Use is subject to license terms.
29*843e1988Sjohnlev  */
30*843e1988Sjohnlev 
31*843e1988Sjohnlev #ifndef	_XEN_SYS_PRIVCMD_H
32*843e1988Sjohnlev #define	_XEN_SYS_PRIVCMD_H
33*843e1988Sjohnlev 
34*843e1988Sjohnlev /*
35*843e1988Sjohnlev  * WARNING:
36*843e1988Sjohnlev  *	These numbers and structure are built into the ON privcmd
37*843e1988Sjohnlev  *	driver, as well as the low-level tools and libraries in
38*843e1988Sjohnlev  *	the Xen consolidation.
39*843e1988Sjohnlev  */
40*843e1988Sjohnlev 
41*843e1988Sjohnlev #include <sys/types.h>
42*843e1988Sjohnlev 
43*843e1988Sjohnlev #ifdef __cplusplus
44*843e1988Sjohnlev extern "C" {
45*843e1988Sjohnlev #endif
46*843e1988Sjohnlev 
47*843e1988Sjohnlev /*
48*843e1988Sjohnlev  * ioctl numbers and corresponding data structures
49*843e1988Sjohnlev  */
50*843e1988Sjohnlev 
51*843e1988Sjohnlev #define	__PRIVCMD_IOC			(('p'<<24)|('r'<<16)|('v'<<8))
52*843e1988Sjohnlev 
53*843e1988Sjohnlev #define	IOCTL_PRIVCMD_HYPERCALL		(__PRIVCMD_IOC|0)
54*843e1988Sjohnlev #define	IOCTL_PRIVCMD_MMAP		(__PRIVCMD_IOC|1)
55*843e1988Sjohnlev #define	IOCTL_PRIVCMD_MMAPBATCH		(__PRIVCMD_IOC|2)
56*843e1988Sjohnlev 
57*843e1988Sjohnlev typedef struct __privcmd_hypercall {
58*843e1988Sjohnlev 	unsigned long op;
59*843e1988Sjohnlev 	unsigned long arg[5];
60*843e1988Sjohnlev } privcmd_hypercall_t;
61*843e1988Sjohnlev 
62*843e1988Sjohnlev typedef struct __privcmd_mmap_entry {
63*843e1988Sjohnlev 	unsigned long va;
64*843e1988Sjohnlev 	unsigned long mfn;
65*843e1988Sjohnlev 	unsigned long npages;
66*843e1988Sjohnlev } privcmd_mmap_entry_t;
67*843e1988Sjohnlev 
68*843e1988Sjohnlev typedef struct __privcmd_mmap {
69*843e1988Sjohnlev 	int num;
70*843e1988Sjohnlev 	domid_t dom;	/* target domain */
71*843e1988Sjohnlev 	privcmd_mmap_entry_t *entry;
72*843e1988Sjohnlev } privcmd_mmap_t;
73*843e1988Sjohnlev 
74*843e1988Sjohnlev typedef struct __privcmd_mmapbatch {
75*843e1988Sjohnlev 	int num;	/* number of pages to populate */
76*843e1988Sjohnlev 	domid_t dom;	/* target domain */
77*843e1988Sjohnlev 	unsigned long addr;	  /* virtual address */
78*843e1988Sjohnlev 	unsigned long *arr;	  /* array of mfns - top nibble set on err */
79*843e1988Sjohnlev } privcmd_mmapbatch_t;
80*843e1988Sjohnlev 
81*843e1988Sjohnlev #ifdef __cplusplus
82*843e1988Sjohnlev }
83*843e1988Sjohnlev #endif
84*843e1988Sjohnlev 
85*843e1988Sjohnlev #endif /* _XEN_SYS_PRIVCMD_H */
86