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 /* version of ABI */
33 #define TMEM_SPEC_VERSION 1
34
35 /* Commands to HYPERVISOR_tmem_op() */
36 #define TMEM_CONTROL 0
37 #define TMEM_NEW_POOL 1
38 #define TMEM_DESTROY_POOL 2
39 #define TMEM_NEW_PAGE 3
40 #define TMEM_PUT_PAGE 4
41 #define TMEM_GET_PAGE 5
42 #define TMEM_FLUSH_PAGE 6
43 #define TMEM_FLUSH_OBJECT 7
44 #define TMEM_READ 8
45 #define TMEM_WRITE 9
46 #define TMEM_XCHG 10
47
48 /* Privileged commands to HYPERVISOR_tmem_op() */
49 #define TMEM_AUTH 101
50 #define TMEM_RESTORE_NEW 102
51
52 /* Subops for HYPERVISOR_tmem_op(TMEM_CONTROL) */
53 #define TMEMC_THAW 0
54 #define TMEMC_FREEZE 1
55 #define TMEMC_FLUSH 2
56 #define TMEMC_DESTROY 3
57 #define TMEMC_LIST 4
58 #define TMEMC_SET_WEIGHT 5
59 #define TMEMC_SET_CAP 6
60 #define TMEMC_SET_COMPRESS 7
61 #define TMEMC_QUERY_FREEABLE_MB 8
62 #define TMEMC_SAVE_BEGIN 10
63 #define TMEMC_SAVE_GET_VERSION 11
64 #define TMEMC_SAVE_GET_MAXPOOLS 12
65 #define TMEMC_SAVE_GET_CLIENT_WEIGHT 13
66 #define TMEMC_SAVE_GET_CLIENT_CAP 14
67 #define TMEMC_SAVE_GET_CLIENT_FLAGS 15
68 #define TMEMC_SAVE_GET_POOL_FLAGS 16
69 #define TMEMC_SAVE_GET_POOL_NPAGES 17
70 #define TMEMC_SAVE_GET_POOL_UUID 18
71 #define TMEMC_SAVE_GET_NEXT_PAGE 19
72 #define TMEMC_SAVE_GET_NEXT_INV 20
73 #define TMEMC_SAVE_END 21
74 #define TMEMC_RESTORE_BEGIN 30
75 #define TMEMC_RESTORE_PUT_PAGE 32
76 #define TMEMC_RESTORE_FLUSH_PAGE 33
77
78 /* Bits for HYPERVISOR_tmem_op(TMEM_NEW_POOL) */
79 #define TMEM_POOL_PERSIST 1
80 #define TMEM_POOL_SHARED 2
81 #define TMEM_POOL_PRECOMPRESSED 4
82 #define TMEM_POOL_PAGESIZE_SHIFT 4
83 #define TMEM_POOL_PAGESIZE_MASK 0xf
84 #define TMEM_POOL_VERSION_SHIFT 24
85 #define TMEM_POOL_VERSION_MASK 0xff
86 #define TMEM_POOL_RESERVED_BITS 0x00ffff00
87
88 /* Bits for client flags (save/restore) */
89 #define TMEM_CLIENT_COMPRESS 1
90 #define TMEM_CLIENT_FROZEN 2
91
92 /* Special errno values */
93 #define EFROZEN 1000
94 #define EEMPTY 1001
95
96
97 #ifndef __ASSEMBLY__
98 typedef xen_pfn_t tmem_cli_mfn_t;
99 typedef XEN_GUEST_HANDLE(char) tmem_cli_va_t;
100 struct tmem_op {
101 uint32_t cmd;
102 int32_t pool_id;
103 union {
104 struct {
105 uint64_t uuid[2];
106 uint32_t flags;
107 uint32_t arg1;
108 } creat; /* for cmd == TMEM_NEW_POOL, TMEM_AUTH, TMEM_RESTORE_NEW */
109 struct {
110 uint32_t subop;
111 uint32_t cli_id;
112 uint32_t arg1;
113 uint32_t arg2;
114 uint64_t oid[3];
115 tmem_cli_va_t buf;
116 } ctrl; /* for cmd == TMEM_CONTROL */
117 struct {
118
119 uint64_t oid[3];
120 uint32_t index;
121 uint32_t tmem_offset;
122 uint32_t pfn_offset;
123 uint32_t len;
124 tmem_cli_mfn_t cmfn; /* client machine page frame */
125 } gen; /* for all other cmd ("generic") */
126 } u;
127 };
128 typedef struct tmem_op tmem_op_t;
129 DEFINE_XEN_GUEST_HANDLE(tmem_op_t);
130
131 struct tmem_handle {
132 uint32_t pool_id;
133 uint32_t index;
134 uint64_t oid[3];
135 };
136 #endif
137
138 #endif /* __XEN_PUBLIC_TMEM_H__ */
139
140 /*
141 * Local variables:
142 * mode: C
143 * c-set-style: "BSD"
144 * c-basic-offset: 4
145 * tab-width: 4
146 * indent-tabs-mode: nil
147 * End:
148 */
Cache object: a45d1953737954d0095f5f2528744888
|