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