1 /******************************************************************************
4 * Guest OS interface to Xen Transcendent Memory.
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:
13 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software.
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.
24 * Copyright (c) 2004, K A Fraser
27 #ifndef __XEN_PUBLIC_TMEM_H__
28 #define __XEN_PUBLIC_TMEM_H__
33 #define TMEM_SPEC_VERSION 1
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
48 /* Privileged commands to HYPERVISOR_tmem_op() */
50 #define TMEM_RESTORE_NEW 102
52 /* Subops for HYPERVISOR_tmem_op(TMEM_CONTROL) */
54 #define TMEMC_FREEZE 1
56 #define TMEMC_DESTROY 3
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
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
88 /* Bits for client flags (save/restore) */
89 #define TMEM_CLIENT_COMPRESS 1
90 #define TMEM_CLIENT_FROZEN 2
92 /* Special errno values */
98 typedef xen_pfn_t tmem_cli_mfn_t;
99 typedef XEN_GUEST_HANDLE(char) tmem_cli_va_t;
108 } creat; /* for cmd == TMEM_NEW_POOL, TMEM_AUTH, TMEM_RESTORE_NEW */
116 } ctrl; /* for cmd == TMEM_CONTROL */
121 uint32_t tmem_offset;
124 tmem_cli_mfn_t cmfn; /* client machine page frame */
125 } gen; /* for all other cmd ("generic") */
128 typedef struct tmem_op tmem_op_t;
129 DEFINE_XEN_GUEST_HANDLE(tmem_op_t);
138 #endif /* __XEN_PUBLIC_TMEM_H__ */
146 * indent-tabs-mode: nil