win-pvdrivers

annotate common/include/public/memory.h @ 62:edd4a2ad5b44

Removed old inf files
author James Harper <james.harper@bendigoit.com.au>
date Wed Dec 19 10:22:50 2007 +1100 (2007-12-19)
parents 5712dede5a1b
children b4f7d75fbe24
rev   line source
andy@12 1 /******************************************************************************
andy@12 2 * memory.h
andy@12 3 *
andy@12 4 * Memory reservation and information.
andy@12 5 *
andy@12 6 * Permission is hereby granted, free of charge, to any person obtaining a copy
andy@12 7 * of this software and associated documentation files (the "Software"), to
andy@12 8 * deal in the Software without restriction, including without limitation the
andy@12 9 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
andy@12 10 * sell copies of the Software, and to permit persons to whom the Software is
andy@12 11 * furnished to do so, subject to the following conditions:
andy@12 12 *
andy@12 13 * The above copyright notice and this permission notice shall be included in
andy@12 14 * all copies or substantial portions of the Software.
andy@12 15 *
andy@12 16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
andy@12 17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
andy@12 18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
andy@12 19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
andy@12 20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
andy@12 21 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
andy@12 22 * DEALINGS IN THE SOFTWARE.
andy@12 23 *
andy@12 24 * Copyright (c) 2005, Keir Fraser <keir@xensource.com>
andy@12 25 */
andy@12 26
andy@12 27 #ifndef __XEN_PUBLIC_MEMORY_H__
andy@12 28 #define __XEN_PUBLIC_MEMORY_H__
andy@12 29
andy@12 30 /*
andy@12 31 * Increase or decrease the specified domain's memory reservation. Returns the
andy@12 32 * number of extents successfully allocated or freed.
andy@12 33 * arg == addr of struct xen_memory_reservation.
andy@12 34 */
andy@12 35 #define XENMEM_increase_reservation 0
andy@12 36 #define XENMEM_decrease_reservation 1
andy@12 37 #define XENMEM_populate_physmap 6
andy@12 38 struct xen_memory_reservation {
andy@12 39
andy@12 40 /*
andy@12 41 * XENMEM_increase_reservation:
andy@12 42 * OUT: MFN (*not* GMFN) bases of extents that were allocated
andy@12 43 * XENMEM_decrease_reservation:
andy@12 44 * IN: GMFN bases of extents to free
andy@12 45 * XENMEM_populate_physmap:
andy@12 46 * IN: GPFN bases of extents to populate with memory
andy@12 47 * OUT: GMFN bases of extents that were allocated
andy@12 48 * (NB. This command also updates the mach_to_phys translation table)
andy@12 49 */
andy@12 50 XEN_GUEST_HANDLE(xen_pfn_t) extent_start;
andy@12 51
andy@12 52 /* Number of extents, and size/alignment of each (2^extent_order pages). */
andy@12 53 xen_ulong_t nr_extents;
andy@12 54 unsigned int extent_order;
andy@12 55
andy@12 56 /*
andy@12 57 * Maximum # bits addressable by the user of the allocated region (e.g.,
andy@12 58 * I/O devices often have a 32-bit limitation even in 64-bit systems). If
andy@12 59 * zero then the user has no addressing restriction.
andy@12 60 * This field is not used by XENMEM_decrease_reservation.
andy@12 61 */
andy@12 62 unsigned int address_bits;
andy@12 63
andy@12 64 /*
andy@12 65 * Domain whose reservation is being changed.
andy@12 66 * Unprivileged domains can specify only DOMID_SELF.
andy@12 67 */
andy@12 68 domid_t domid;
andy@12 69 };
andy@12 70 typedef struct xen_memory_reservation xen_memory_reservation_t;
andy@12 71 DEFINE_XEN_GUEST_HANDLE(xen_memory_reservation_t);
andy@12 72
andy@12 73 /*
andy@12 74 * An atomic exchange of memory pages. If return code is zero then
andy@12 75 * @out.extent_list provides GMFNs of the newly-allocated memory.
andy@12 76 * Returns zero on complete success, otherwise a negative error code.
andy@12 77 * On complete success then always @nr_exchanged == @in.nr_extents.
andy@12 78 * On partial success @nr_exchanged indicates how much work was done.
andy@12 79 */
andy@12 80 #define XENMEM_exchange 11
andy@12 81 struct xen_memory_exchange {
andy@12 82 /*
andy@12 83 * [IN] Details of memory extents to be exchanged (GMFN bases).
andy@12 84 * Note that @in.address_bits is ignored and unused.
andy@12 85 */
andy@12 86 struct xen_memory_reservation in;
andy@12 87
andy@12 88 /*
andy@12 89 * [IN/OUT] Details of new memory extents.
andy@12 90 * We require that:
andy@12 91 * 1. @in.domid == @out.domid
andy@12 92 * 2. @in.nr_extents << @in.extent_order ==
andy@12 93 * @out.nr_extents << @out.extent_order
andy@12 94 * 3. @in.extent_start and @out.extent_start lists must not overlap
andy@12 95 * 4. @out.extent_start lists GPFN bases to be populated
andy@12 96 * 5. @out.extent_start is overwritten with allocated GMFN bases
andy@12 97 */
andy@12 98 struct xen_memory_reservation out;
andy@12 99
andy@12 100 /*
andy@12 101 * [OUT] Number of input extents that were successfully exchanged:
andy@12 102 * 1. The first @nr_exchanged input extents were successfully
andy@12 103 * deallocated.
andy@12 104 * 2. The corresponding first entries in the output extent list correctly
andy@12 105 * indicate the GMFNs that were successfully exchanged.
andy@12 106 * 3. All other input and output extents are untouched.
andy@12 107 * 4. If not all input exents are exchanged then the return code of this
andy@12 108 * command will be non-zero.
andy@12 109 * 5. THIS FIELD MUST BE INITIALISED TO ZERO BY THE CALLER!
andy@12 110 */
andy@12 111 xen_ulong_t nr_exchanged;
andy@12 112 };
andy@12 113 typedef struct xen_memory_exchange xen_memory_exchange_t;
andy@12 114 DEFINE_XEN_GUEST_HANDLE(xen_memory_exchange_t);
andy@12 115
andy@12 116 /*
andy@12 117 * Returns the maximum machine frame number of mapped RAM in this system.
andy@12 118 * This command always succeeds (it never returns an error code).
andy@12 119 * arg == NULL.
andy@12 120 */
andy@12 121 #define XENMEM_maximum_ram_page 2
andy@12 122
andy@12 123 /*
andy@12 124 * Returns the current or maximum memory reservation, in pages, of the
andy@12 125 * specified domain (may be DOMID_SELF). Returns -ve errcode on failure.
andy@12 126 * arg == addr of domid_t.
andy@12 127 */
andy@12 128 #define XENMEM_current_reservation 3
andy@12 129 #define XENMEM_maximum_reservation 4
andy@12 130
andy@12 131 /*
andy@12 132 * Returns the maximum GPFN in use by the guest, or -ve errcode on failure.
andy@12 133 */
andy@12 134 #define XENMEM_maximum_gpfn 14
andy@12 135
andy@12 136 /*
andy@12 137 * Returns a list of MFN bases of 2MB extents comprising the machine_to_phys
andy@12 138 * mapping table. Architectures which do not have a m2p table do not implement
andy@12 139 * this command.
andy@12 140 * arg == addr of xen_machphys_mfn_list_t.
andy@12 141 */
andy@12 142 #define XENMEM_machphys_mfn_list 5
andy@12 143 struct xen_machphys_mfn_list {
andy@12 144 /*
andy@12 145 * Size of the 'extent_start' array. Fewer entries will be filled if the
andy@12 146 * machphys table is smaller than max_extents * 2MB.
andy@12 147 */
andy@12 148 unsigned int max_extents;
andy@12 149
andy@12 150 /*
andy@12 151 * Pointer to buffer to fill with list of extent starts. If there are
andy@12 152 * any large discontiguities in the machine address space, 2MB gaps in
andy@12 153 * the machphys table will be represented by an MFN base of zero.
andy@12 154 */
andy@12 155 XEN_GUEST_HANDLE(xen_pfn_t) extent_start;
andy@12 156
andy@12 157 /*
andy@12 158 * Number of extents written to the above array. This will be smaller
andy@12 159 * than 'max_extents' if the machphys table is smaller than max_e * 2MB.
andy@12 160 */
andy@12 161 unsigned int nr_extents;
andy@12 162 };
andy@12 163 typedef struct xen_machphys_mfn_list xen_machphys_mfn_list_t;
andy@12 164 DEFINE_XEN_GUEST_HANDLE(xen_machphys_mfn_list_t);
andy@12 165
andy@12 166 /*
andy@12 167 * Returns the location in virtual address space of the machine_to_phys
andy@12 168 * mapping table. Architectures which do not have a m2p table, or which do not
andy@12 169 * map it by default into guest address space, do not implement this command.
andy@12 170 * arg == addr of xen_machphys_mapping_t.
andy@12 171 */
andy@12 172 #define XENMEM_machphys_mapping 12
andy@12 173 struct xen_machphys_mapping {
andy@12 174 xen_ulong_t v_start, v_end; /* Start and end virtual addresses. */
andy@12 175 xen_ulong_t max_mfn; /* Maximum MFN that can be looked up. */
andy@12 176 };
andy@12 177 typedef struct xen_machphys_mapping xen_machphys_mapping_t;
andy@12 178 DEFINE_XEN_GUEST_HANDLE(xen_machphys_mapping_t);
andy@12 179
andy@12 180 /*
andy@12 181 * Sets the GPFN at which a particular page appears in the specified guest's
andy@12 182 * pseudophysical address space.
andy@12 183 * arg == addr of xen_add_to_physmap_t.
andy@12 184 */
andy@12 185 #define XENMEM_add_to_physmap 7
andy@12 186 struct xen_add_to_physmap {
andy@12 187 /* Which domain to change the mapping for. */
andy@12 188 domid_t domid;
andy@12 189
andy@12 190 /* Source mapping space. */
andy@12 191 #define XENMAPSPACE_shared_info 0 /* shared info page */
andy@12 192 #define XENMAPSPACE_grant_table 1 /* grant table page */
andy@12 193 unsigned int space;
andy@12 194
andy@12 195 /* Index into source mapping space. */
andy@12 196 xen_ulong_t idx;
andy@12 197
andy@12 198 /* GPFN where the source mapping page should appear. */
andy@12 199 xen_pfn_t gpfn;
andy@12 200 };
andy@12 201 typedef struct xen_add_to_physmap xen_add_to_physmap_t;
andy@12 202 DEFINE_XEN_GUEST_HANDLE(xen_add_to_physmap_t);
andy@12 203
andy@12 204 /*
andy@12 205 * Translates a list of domain-specific GPFNs into MFNs. Returns a -ve error
andy@12 206 * code on failure. This call only works for auto-translated guests.
andy@12 207 */
andy@12 208 #define XENMEM_translate_gpfn_list 8
andy@12 209 struct xen_translate_gpfn_list {
andy@12 210 /* Which domain to translate for? */
andy@12 211 domid_t domid;
andy@12 212
andy@12 213 /* Length of list. */
andy@12 214 xen_ulong_t nr_gpfns;
andy@12 215
andy@12 216 /* List of GPFNs to translate. */
andy@12 217 XEN_GUEST_HANDLE(xen_pfn_t) gpfn_list;
andy@12 218
andy@12 219 /*
andy@12 220 * Output list to contain MFN translations. May be the same as the input
andy@12 221 * list (in which case each input GPFN is overwritten with the output MFN).
andy@12 222 */
andy@12 223 XEN_GUEST_HANDLE(xen_pfn_t) mfn_list;
andy@12 224 };
andy@12 225 typedef struct xen_translate_gpfn_list xen_translate_gpfn_list_t;
andy@12 226 DEFINE_XEN_GUEST_HANDLE(xen_translate_gpfn_list_t);
andy@12 227
andy@12 228 /*
andy@12 229 * Returns the pseudo-physical memory map as it was when the domain
andy@12 230 * was started (specified by XENMEM_set_memory_map).
andy@12 231 * arg == addr of xen_memory_map_t.
andy@12 232 */
andy@12 233 #define XENMEM_memory_map 9
andy@12 234 struct xen_memory_map {
andy@12 235 /*
andy@12 236 * On call the number of entries which can be stored in buffer. On
andy@12 237 * return the number of entries which have been stored in
andy@12 238 * buffer.
andy@12 239 */
andy@12 240 unsigned int nr_entries;
andy@12 241
andy@12 242 /*
andy@12 243 * Entries in the buffer are in the same format as returned by the
andy@12 244 * BIOS INT 0x15 EAX=0xE820 call.
andy@12 245 */
andy@12 246 XEN_GUEST_HANDLE(void) buffer;
andy@12 247 };
andy@12 248 typedef struct xen_memory_map xen_memory_map_t;
andy@12 249 DEFINE_XEN_GUEST_HANDLE(xen_memory_map_t);
andy@12 250
andy@12 251 /*
andy@12 252 * Returns the real physical memory map. Passes the same structure as
andy@12 253 * XENMEM_memory_map.
andy@12 254 * arg == addr of xen_memory_map_t.
andy@12 255 */
andy@12 256 #define XENMEM_machine_memory_map 10
andy@12 257
andy@12 258 /*
andy@12 259 * Set the pseudo-physical memory map of a domain, as returned by
andy@12 260 * XENMEM_memory_map.
andy@12 261 * arg == addr of xen_foreign_memory_map_t.
andy@12 262 */
andy@12 263 #define XENMEM_set_memory_map 13
andy@12 264 struct xen_foreign_memory_map {
andy@12 265 domid_t domid;
andy@12 266 struct xen_memory_map map;
andy@12 267 };
andy@12 268 typedef struct xen_foreign_memory_map xen_foreign_memory_map_t;
andy@12 269 DEFINE_XEN_GUEST_HANDLE(xen_foreign_memory_map_t);
andy@12 270
andy@12 271 #endif /* __XEN_PUBLIC_MEMORY_H__ */
andy@12 272
andy@12 273 /*
andy@12 274 * Local variables:
andy@12 275 * mode: C
andy@12 276 * c-set-style: "BSD"
andy@12 277 * c-basic-offset: 4
andy@12 278 * tab-width: 4
andy@12 279 * indent-tabs-mode: nil
andy@12 280 * End:
andy@12 281 */