ia64/xen-unstable

view xen/include/public/memory.h @ 19848:5839491bbf20

[IA64] replace MAX_VCPUS with d->max_vcpus where necessary.

don't use MAX_VCPUS, and use vcpu::max_vcpus.
The changeset of 2f9e1348aa98 introduced max_vcpus to allow more vcpus
per guest. This patch is ia64 counter part.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
author Isaku Yamahata <yamahata@valinux.co.jp>
date Mon Jun 29 11:26:05 2009 +0900 (2009-06-29)
parents aaab04808ee7
children
line source
1 /******************************************************************************
2 * memory.h
3 *
4 * Memory reservation and information.
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) 2005, Keir Fraser <keir@xensource.com>
25 */
27 #ifndef __XEN_PUBLIC_MEMORY_H__
28 #define __XEN_PUBLIC_MEMORY_H__
30 #include "xen.h"
32 /*
33 * Increase or decrease the specified domain's memory reservation. Returns the
34 * number of extents successfully allocated or freed.
35 * arg == addr of struct xen_memory_reservation.
36 */
37 #define XENMEM_increase_reservation 0
38 #define XENMEM_decrease_reservation 1
39 #define XENMEM_populate_physmap 6
41 #if __XEN_INTERFACE_VERSION__ >= 0x00030209
42 /*
43 * Maximum # bits addressable by the user of the allocated region (e.g., I/O
44 * devices often have a 32-bit limitation even in 64-bit systems). If zero
45 * then the user has no addressing restriction. This field is not used by
46 * XENMEM_decrease_reservation.
47 */
48 #define XENMEMF_address_bits(x) (x)
49 #define XENMEMF_get_address_bits(x) ((x) & 0xffu)
50 /* NUMA node to allocate from. */
51 #define XENMEMF_node(x) (((x) + 1) << 8)
52 #define XENMEMF_get_node(x) ((((x) >> 8) - 1) & 0xffu)
53 /* Flag to populate physmap with populate-on-demand entries */
54 #define XENMEMF_populate_on_demand (1<<16)
55 #endif
57 struct xen_memory_reservation {
59 /*
60 * XENMEM_increase_reservation:
61 * OUT: MFN (*not* GMFN) bases of extents that were allocated
62 * XENMEM_decrease_reservation:
63 * IN: GMFN bases of extents to free
64 * XENMEM_populate_physmap:
65 * IN: GPFN bases of extents to populate with memory
66 * OUT: GMFN bases of extents that were allocated
67 * (NB. This command also updates the mach_to_phys translation table)
68 */
69 XEN_GUEST_HANDLE(xen_pfn_t) extent_start;
71 /* Number of extents, and size/alignment of each (2^extent_order pages). */
72 xen_ulong_t nr_extents;
73 unsigned int extent_order;
75 #if __XEN_INTERFACE_VERSION__ >= 0x00030209
76 /* XENMEMF flags. */
77 unsigned int mem_flags;
78 #else
79 unsigned int address_bits;
80 #endif
82 /*
83 * Domain whose reservation is being changed.
84 * Unprivileged domains can specify only DOMID_SELF.
85 */
86 domid_t domid;
87 };
88 typedef struct xen_memory_reservation xen_memory_reservation_t;
89 DEFINE_XEN_GUEST_HANDLE(xen_memory_reservation_t);
91 /*
92 * An atomic exchange of memory pages. If return code is zero then
93 * @out.extent_list provides GMFNs of the newly-allocated memory.
94 * Returns zero on complete success, otherwise a negative error code.
95 * On complete success then always @nr_exchanged == @in.nr_extents.
96 * On partial success @nr_exchanged indicates how much work was done.
97 */
98 #define XENMEM_exchange 11
99 struct xen_memory_exchange {
100 /*
101 * [IN] Details of memory extents to be exchanged (GMFN bases).
102 * Note that @in.address_bits is ignored and unused.
103 */
104 struct xen_memory_reservation in;
106 /*
107 * [IN/OUT] Details of new memory extents.
108 * We require that:
109 * 1. @in.domid == @out.domid
110 * 2. @in.nr_extents << @in.extent_order ==
111 * @out.nr_extents << @out.extent_order
112 * 3. @in.extent_start and @out.extent_start lists must not overlap
113 * 4. @out.extent_start lists GPFN bases to be populated
114 * 5. @out.extent_start is overwritten with allocated GMFN bases
115 */
116 struct xen_memory_reservation out;
118 /*
119 * [OUT] Number of input extents that were successfully exchanged:
120 * 1. The first @nr_exchanged input extents were successfully
121 * deallocated.
122 * 2. The corresponding first entries in the output extent list correctly
123 * indicate the GMFNs that were successfully exchanged.
124 * 3. All other input and output extents are untouched.
125 * 4. If not all input exents are exchanged then the return code of this
126 * command will be non-zero.
127 * 5. THIS FIELD MUST BE INITIALISED TO ZERO BY THE CALLER!
128 */
129 xen_ulong_t nr_exchanged;
130 };
131 typedef struct xen_memory_exchange xen_memory_exchange_t;
132 DEFINE_XEN_GUEST_HANDLE(xen_memory_exchange_t);
134 /*
135 * Returns the maximum machine frame number of mapped RAM in this system.
136 * This command always succeeds (it never returns an error code).
137 * arg == NULL.
138 */
139 #define XENMEM_maximum_ram_page 2
141 /*
142 * Returns the current or maximum memory reservation, in pages, of the
143 * specified domain (may be DOMID_SELF). Returns -ve errcode on failure.
144 * arg == addr of domid_t.
145 */
146 #define XENMEM_current_reservation 3
147 #define XENMEM_maximum_reservation 4
149 /*
150 * Returns the maximum GPFN in use by the guest, or -ve errcode on failure.
151 */
152 #define XENMEM_maximum_gpfn 14
154 /*
155 * Returns a list of MFN bases of 2MB extents comprising the machine_to_phys
156 * mapping table. Architectures which do not have a m2p table do not implement
157 * this command.
158 * arg == addr of xen_machphys_mfn_list_t.
159 */
160 #define XENMEM_machphys_mfn_list 5
161 struct xen_machphys_mfn_list {
162 /*
163 * Size of the 'extent_start' array. Fewer entries will be filled if the
164 * machphys table is smaller than max_extents * 2MB.
165 */
166 unsigned int max_extents;
168 /*
169 * Pointer to buffer to fill with list of extent starts. If there are
170 * any large discontiguities in the machine address space, 2MB gaps in
171 * the machphys table will be represented by an MFN base of zero.
172 */
173 XEN_GUEST_HANDLE(xen_pfn_t) extent_start;
175 /*
176 * Number of extents written to the above array. This will be smaller
177 * than 'max_extents' if the machphys table is smaller than max_e * 2MB.
178 */
179 unsigned int nr_extents;
180 };
181 typedef struct xen_machphys_mfn_list xen_machphys_mfn_list_t;
182 DEFINE_XEN_GUEST_HANDLE(xen_machphys_mfn_list_t);
184 /*
185 * Returns the location in virtual address space of the machine_to_phys
186 * mapping table. Architectures which do not have a m2p table, or which do not
187 * map it by default into guest address space, do not implement this command.
188 * arg == addr of xen_machphys_mapping_t.
189 */
190 #define XENMEM_machphys_mapping 12
191 struct xen_machphys_mapping {
192 xen_ulong_t v_start, v_end; /* Start and end virtual addresses. */
193 xen_ulong_t max_mfn; /* Maximum MFN that can be looked up. */
194 };
195 typedef struct xen_machphys_mapping xen_machphys_mapping_t;
196 DEFINE_XEN_GUEST_HANDLE(xen_machphys_mapping_t);
198 /*
199 * Sets the GPFN at which a particular page appears in the specified guest's
200 * pseudophysical address space.
201 * arg == addr of xen_add_to_physmap_t.
202 */
203 #define XENMEM_add_to_physmap 7
204 struct xen_add_to_physmap {
205 /* Which domain to change the mapping for. */
206 domid_t domid;
208 /* Source mapping space. */
209 #define XENMAPSPACE_shared_info 0 /* shared info page */
210 #define XENMAPSPACE_grant_table 1 /* grant table page */
211 #define XENMAPSPACE_gmfn 2 /* GMFN */
212 unsigned int space;
214 /* Index into source mapping space. */
215 xen_ulong_t idx;
217 /* GPFN where the source mapping page should appear. */
218 xen_pfn_t gpfn;
219 };
220 typedef struct xen_add_to_physmap xen_add_to_physmap_t;
221 DEFINE_XEN_GUEST_HANDLE(xen_add_to_physmap_t);
223 /*** REMOVED ***/
224 /*#define XENMEM_translate_gpfn_list 8*/
226 /*
227 * Returns the pseudo-physical memory map as it was when the domain
228 * was started (specified by XENMEM_set_memory_map).
229 * arg == addr of xen_memory_map_t.
230 */
231 #define XENMEM_memory_map 9
232 struct xen_memory_map {
233 /*
234 * On call the number of entries which can be stored in buffer. On
235 * return the number of entries which have been stored in
236 * buffer.
237 */
238 unsigned int nr_entries;
240 /*
241 * Entries in the buffer are in the same format as returned by the
242 * BIOS INT 0x15 EAX=0xE820 call.
243 */
244 XEN_GUEST_HANDLE(void) buffer;
245 };
246 typedef struct xen_memory_map xen_memory_map_t;
247 DEFINE_XEN_GUEST_HANDLE(xen_memory_map_t);
249 /*
250 * Returns the real physical memory map. Passes the same structure as
251 * XENMEM_memory_map.
252 * arg == addr of xen_memory_map_t.
253 */
254 #define XENMEM_machine_memory_map 10
256 /*
257 * Set the pseudo-physical memory map of a domain, as returned by
258 * XENMEM_memory_map.
259 * arg == addr of xen_foreign_memory_map_t.
260 */
261 #define XENMEM_set_memory_map 13
262 struct xen_foreign_memory_map {
263 domid_t domid;
264 struct xen_memory_map map;
265 };
266 typedef struct xen_foreign_memory_map xen_foreign_memory_map_t;
267 DEFINE_XEN_GUEST_HANDLE(xen_foreign_memory_map_t);
269 #define XENMEM_set_pod_target 16
270 #define XENMEM_get_pod_target 17
271 struct xen_pod_target {
272 /* IN */
273 uint64_t target_pages;
274 /* OUT */
275 uint64_t tot_pages;
276 uint64_t pod_cache_pages;
277 uint64_t pod_entries;
278 /* IN */
279 domid_t domid;
280 };
281 typedef struct xen_pod_target xen_pod_target_t;
282 #endif /* __XEN_PUBLIC_MEMORY_H__ */
284 /*
285 * Local variables:
286 * mode: C
287 * c-set-style: "BSD"
288 * c-basic-offset: 4
289 * tab-width: 4
290 * indent-tabs-mode: nil
291 * End:
292 */