- supported.conf: Added sparse_keymap (eeepc_laptop depends on it)
[linux-flexiantxendom0-3.2.10.git] / include / xen / interface / tmem.h
1 /******************************************************************************
2  * tmem.h
3  * 
4  * Guest OS interface to Xen Transcendent Memory.
5  * 
6  * Permission is hereby granted, free of charge, to any person obtaining a copy
7  * of this software and associated documentation files (the "Software"), to
8  * deal in the Software without restriction, including without limitation the
9  * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
10  * sell copies of the Software, and to permit persons to whom the Software is
11  * furnished to do so, subject to the following conditions:
12  *
13  * The above copyright notice and this permission notice shall be included in
14  * all copies or substantial portions of the Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22  * DEALINGS IN THE SOFTWARE.
23  *
24  * Copyright (c) 2004, K A Fraser
25  */
26
27 #ifndef __XEN_PUBLIC_TMEM_H__
28 #define __XEN_PUBLIC_TMEM_H__
29
30 #include "xen.h"
31
32 /* Commands to HYPERVISOR_tmem_op() */
33 #define TMEM_CONTROL               0
34 #define TMEM_NEW_POOL              1
35 #define TMEM_DESTROY_POOL          2
36 #define TMEM_NEW_PAGE              3
37 #define TMEM_PUT_PAGE              4
38 #define TMEM_GET_PAGE              5
39 #define TMEM_FLUSH_PAGE            6
40 #define TMEM_FLUSH_OBJECT          7
41 #define TMEM_READ                  8
42 #define TMEM_WRITE                 9
43 #define TMEM_XCHG                 10
44
45 /* Privileged commands to HYPERVISOR_tmem_op() */
46 #define TMEM_AUTH                 101 
47 #define TMEM_RESTORE_NEW          102
48
49 /* Subops for HYPERVISOR_tmem_op(TMEM_CONTROL) */
50 #define TMEMC_THAW                   0
51 #define TMEMC_FREEZE                 1
52 #define TMEMC_FLUSH                  2
53 #define TMEMC_DESTROY                3
54 #define TMEMC_LIST                   4
55 #define TMEMC_SET_WEIGHT             5
56 #define TMEMC_SET_CAP                6
57 #define TMEMC_SET_COMPRESS           7
58 #define TMEMC_QUERY_FREEABLE_MB      8
59 #define TMEMC_SAVE_BEGIN             10
60 #define TMEMC_SAVE_GET_VERSION       11
61 #define TMEMC_SAVE_GET_MAXPOOLS      12
62 #define TMEMC_SAVE_GET_CLIENT_WEIGHT 13
63 #define TMEMC_SAVE_GET_CLIENT_CAP    14
64 #define TMEMC_SAVE_GET_CLIENT_FLAGS  15
65 #define TMEMC_SAVE_GET_POOL_FLAGS    16
66 #define TMEMC_SAVE_GET_POOL_NPAGES   17
67 #define TMEMC_SAVE_GET_POOL_UUID     18
68 #define TMEMC_SAVE_GET_NEXT_PAGE     19
69 #define TMEMC_SAVE_GET_NEXT_INV      20
70 #define TMEMC_SAVE_END               21
71 #define TMEMC_RESTORE_BEGIN          30
72 #define TMEMC_RESTORE_PUT_PAGE       32
73 #define TMEMC_RESTORE_FLUSH_PAGE     33
74
75 /* Bits for HYPERVISOR_tmem_op(TMEM_NEW_POOL) */
76 #define TMEM_POOL_PERSIST          1
77 #define TMEM_POOL_SHARED           2
78 #define TMEM_POOL_PAGESIZE_SHIFT   4
79 #define TMEM_POOL_PAGESIZE_MASK  0xf
80 #define TMEM_POOL_VERSION_SHIFT   24
81 #define TMEM_POOL_VERSION_MASK  0xff
82
83 /* Bits for client flags (save/restore) */
84 #define TMEM_CLIENT_COMPRESS       1
85 #define TMEM_CLIENT_FROZEN         2
86
87 /* Special errno values */
88 #define EFROZEN                 1000
89 #define EEMPTY                  1001
90
91
92 #ifndef __ASSEMBLY__
93 typedef xen_pfn_t tmem_cli_mfn_t;
94 typedef XEN_GUEST_HANDLE(char) tmem_cli_va_t;
95 struct tmem_op {
96     uint32_t cmd;
97     int32_t pool_id;
98     union {
99         struct {
100             uint64_t uuid[2];
101             uint32_t flags;
102             uint32_t arg1;
103         } new; /* for cmd == TMEM_NEW_POOL, TMEM_AUTH, TMEM_RESTORE_NEW */
104         struct { 
105             uint32_t subop;
106             uint32_t cli_id;
107             uint32_t arg1;
108             uint32_t arg2;
109             uint64_t arg3;
110             tmem_cli_va_t buf;
111         } ctrl; /* for cmd == TMEM_CONTROL */
112         struct {
113             
114             uint64_t object;
115             uint32_t index;
116             uint32_t tmem_offset;
117             uint32_t pfn_offset;
118             uint32_t len;
119             tmem_cli_mfn_t cmfn; /* client machine page frame */
120         } gen; /* for all other cmd ("generic") */
121     } u;
122 };
123 typedef struct tmem_op tmem_op_t;
124 DEFINE_XEN_GUEST_HANDLE(tmem_op_t);
125
126 struct tmem_handle {
127     uint32_t pool_id;
128     uint32_t index;
129     uint64_t oid;
130 };
131
132 #endif
133
134 #endif /* __XEN_PUBLIC_TMEM_H__ */
135
136 /*
137  * Local variables:
138  * mode: C
139  * c-set-style: "BSD"
140  * c-basic-offset: 4
141  * tab-width: 4
142  * indent-tabs-mode: nil
143  * End:
144  */