GUI: Fix Tomato RAF theme for all builds. Compilation typo.
[tomato.git] / release / src-rt-6.x.4708 / linux / linux-2.6.36 / include / xen / interface / memory.h
blobd3938d3e71f822c01956cdb6fbe93bc90cfb1363
1 /******************************************************************************
2 * memory.h
4 * Memory reservation and information.
6 * Copyright (c) 2005, Keir Fraser <keir@xensource.com>
7 */
9 #ifndef __XEN_PUBLIC_MEMORY_H__
10 #define __XEN_PUBLIC_MEMORY_H__
12 #include <linux/spinlock.h>
15 * Increase or decrease the specified domain's memory reservation. Returns a
16 * -ve errcode on failure, or the # extents successfully allocated or freed.
17 * arg == addr of struct xen_memory_reservation.
19 #define XENMEM_increase_reservation 0
20 #define XENMEM_decrease_reservation 1
21 #define XENMEM_populate_physmap 6
22 struct xen_memory_reservation {
25 * XENMEM_increase_reservation:
26 * OUT: MFN (*not* GMFN) bases of extents that were allocated
27 * XENMEM_decrease_reservation:
28 * IN: GMFN bases of extents to free
29 * XENMEM_populate_physmap:
30 * IN: GPFN bases of extents to populate with memory
31 * OUT: GMFN bases of extents that were allocated
32 * (NB. This command also updates the mach_to_phys translation table)
34 GUEST_HANDLE(ulong) extent_start;
36 /* Number of extents, and size/alignment of each (2^extent_order pages). */
37 unsigned long nr_extents;
38 unsigned int extent_order;
41 * Maximum # bits addressable by the user of the allocated region (e.g.,
42 * I/O devices often have a 32-bit limitation even in 64-bit systems). If
43 * zero then the user has no addressing restriction.
44 * This field is not used by XENMEM_decrease_reservation.
46 unsigned int address_bits;
49 * Domain whose reservation is being changed.
50 * Unprivileged domains can specify only DOMID_SELF.
52 domid_t domid;
55 DEFINE_GUEST_HANDLE_STRUCT(xen_memory_reservation);
58 * An atomic exchange of memory pages. If return code is zero then
59 * @out.extent_list provides GMFNs of the newly-allocated memory.
60 * Returns zero on complete success, otherwise a negative error code.
61 * On complete success then always @nr_exchanged == @in.nr_extents.
62 * On partial success @nr_exchanged indicates how much work was done.
64 #define XENMEM_exchange 11
65 struct xen_memory_exchange {
67 * [IN] Details of memory extents to be exchanged (GMFN bases).
68 * Note that @in.address_bits is ignored and unused.
70 struct xen_memory_reservation in;
73 * [IN/OUT] Details of new memory extents.
74 * We require that:
75 * 1. @in.domid == @out.domid
76 * 2. @in.nr_extents << @in.extent_order ==
77 * @out.nr_extents << @out.extent_order
78 * 3. @in.extent_start and @out.extent_start lists must not overlap
79 * 4. @out.extent_start lists GPFN bases to be populated
80 * 5. @out.extent_start is overwritten with allocated GMFN bases
82 struct xen_memory_reservation out;
85 * [OUT] Number of input extents that were successfully exchanged:
86 * 1. The first @nr_exchanged input extents were successfully
87 * deallocated.
88 * 2. The corresponding first entries in the output extent list correctly
89 * indicate the GMFNs that were successfully exchanged.
90 * 3. All other input and output extents are untouched.
91 * 4. If not all input exents are exchanged then the return code of this
92 * command will be non-zero.
93 * 5. THIS FIELD MUST BE INITIALISED TO ZERO BY THE CALLER!
95 unsigned long nr_exchanged;
98 DEFINE_GUEST_HANDLE_STRUCT(xen_memory_exchange);
100 * Returns the maximum machine frame number of mapped RAM in this system.
101 * This command always succeeds (it never returns an error code).
102 * arg == NULL.
104 #define XENMEM_maximum_ram_page 2
107 * Returns the current or maximum memory reservation, in pages, of the
108 * specified domain (may be DOMID_SELF). Returns -ve errcode on failure.
109 * arg == addr of domid_t.
111 #define XENMEM_current_reservation 3
112 #define XENMEM_maximum_reservation 4
115 * Returns a list of MFN bases of 2MB extents comprising the machine_to_phys
116 * mapping table. Architectures which do not have a m2p table do not implement
117 * this command.
118 * arg == addr of xen_machphys_mfn_list_t.
120 #define XENMEM_machphys_mfn_list 5
121 struct xen_machphys_mfn_list {
123 * Size of the 'extent_start' array. Fewer entries will be filled if the
124 * machphys table is smaller than max_extents * 2MB.
126 unsigned int max_extents;
129 * Pointer to buffer to fill with list of extent starts. If there are
130 * any large discontiguities in the machine address space, 2MB gaps in
131 * the machphys table will be represented by an MFN base of zero.
133 GUEST_HANDLE(ulong) extent_start;
136 * Number of extents written to the above array. This will be smaller
137 * than 'max_extents' if the machphys table is smaller than max_e * 2MB.
139 unsigned int nr_extents;
141 DEFINE_GUEST_HANDLE_STRUCT(xen_machphys_mfn_list);
144 * Sets the GPFN at which a particular page appears in the specified guest's
145 * pseudophysical address space.
146 * arg == addr of xen_add_to_physmap_t.
148 #define XENMEM_add_to_physmap 7
149 struct xen_add_to_physmap {
150 /* Which domain to change the mapping for. */
151 domid_t domid;
153 /* Source mapping space. */
154 #define XENMAPSPACE_shared_info 0 /* shared info page */
155 #define XENMAPSPACE_grant_table 1 /* grant table page */
156 unsigned int space;
158 /* Index into source mapping space. */
159 unsigned long idx;
161 /* GPFN where the source mapping page should appear. */
162 unsigned long gpfn;
164 DEFINE_GUEST_HANDLE_STRUCT(xen_add_to_physmap);
167 * Translates a list of domain-specific GPFNs into MFNs. Returns a -ve error
168 * code on failure. This call only works for auto-translated guests.
170 #define XENMEM_translate_gpfn_list 8
171 struct xen_translate_gpfn_list {
172 /* Which domain to translate for? */
173 domid_t domid;
175 /* Length of list. */
176 unsigned long nr_gpfns;
178 /* List of GPFNs to translate. */
179 GUEST_HANDLE(ulong) gpfn_list;
182 * Output list to contain MFN translations. May be the same as the input
183 * list (in which case each input GPFN is overwritten with the output MFN).
185 GUEST_HANDLE(ulong) mfn_list;
187 DEFINE_GUEST_HANDLE_STRUCT(xen_translate_gpfn_list);
191 * Prevent the balloon driver from changing the memory reservation
192 * during a driver critical region.
194 extern spinlock_t xen_reservation_lock;
195 #endif /* __XEN_PUBLIC_MEMORY_H__ */