1 /******************************************************************************
4 * Memory reservation and information.
6 * Copyright (c) 2005, Keir Fraser <keir@xensource.com>
9 #ifndef __XEN_PUBLIC_MEMORY_H__
10 #define __XEN_PUBLIC_MEMORY_H__
13 * Increase or decrease the specified domain's memory reservation. Returns a
14 * -ve errcode on failure, or the # extents successfully allocated or freed.
15 * arg == addr of struct xen_memory_reservation.
17 #define XENMEM_increase_reservation 0
18 #define XENMEM_decrease_reservation 1
19 #define XENMEM_populate_physmap 6
20 struct xen_memory_reservation {
23 * XENMEM_increase_reservation:
24 * OUT: MFN (*not* GMFN) bases of extents that were allocated
25 * XENMEM_decrease_reservation:
26 * IN: GMFN bases of extents to free
27 * XENMEM_populate_physmap:
28 * IN: GPFN bases of extents to populate with memory
29 * OUT: GMFN bases of extents that were allocated
30 * (NB. This command also updates the mach_to_phys translation table)
32 GUEST_HANDLE(ulong) extent_start;
34 /* Number of extents, and size/alignment of each (2^extent_order pages). */
35 unsigned long nr_extents;
36 unsigned int extent_order;
39 * Maximum # bits addressable by the user of the allocated region (e.g.,
40 * I/O devices often have a 32-bit limitation even in 64-bit systems). If
41 * zero then the user has no addressing restriction.
42 * This field is not used by XENMEM_decrease_reservation.
44 unsigned int address_bits;
47 * Domain whose reservation is being changed.
48 * Unprivileged domains can specify only DOMID_SELF.
53 DEFINE_GUEST_HANDLE_STRUCT(xen_memory_reservation);
56 * Returns the maximum machine frame number of mapped RAM in this system.
57 * This command always succeeds (it never returns an error code).
60 #define XENMEM_maximum_ram_page 2
63 * Returns the current or maximum memory reservation, in pages, of the
64 * specified domain (may be DOMID_SELF). Returns -ve errcode on failure.
65 * arg == addr of domid_t.
67 #define XENMEM_current_reservation 3
68 #define XENMEM_maximum_reservation 4
71 * Returns a list of MFN bases of 2MB extents comprising the machine_to_phys
72 * mapping table. Architectures which do not have a m2p table do not implement
74 * arg == addr of xen_machphys_mfn_list_t.
76 #define XENMEM_machphys_mfn_list 5
77 struct xen_machphys_mfn_list {
79 * Size of the 'extent_start' array. Fewer entries will be filled if the
80 * machphys table is smaller than max_extents * 2MB.
82 unsigned int max_extents;
85 * Pointer to buffer to fill with list of extent starts. If there are
86 * any large discontiguities in the machine address space, 2MB gaps in
87 * the machphys table will be represented by an MFN base of zero.
89 GUEST_HANDLE(ulong) extent_start;
92 * Number of extents written to the above array. This will be smaller
93 * than 'max_extents' if the machphys table is smaller than max_e * 2MB.
95 unsigned int nr_extents;
97 DEFINE_GUEST_HANDLE_STRUCT(xen_machphys_mfn_list);
100 * Sets the GPFN at which a particular page appears in the specified guest's
101 * pseudophysical address space.
102 * arg == addr of xen_add_to_physmap_t.
104 #define XENMEM_add_to_physmap 7
105 struct xen_add_to_physmap {
106 /* Which domain to change the mapping for. */
109 /* Source mapping space. */
110 #define XENMAPSPACE_shared_info 0 /* shared info page */
111 #define XENMAPSPACE_grant_table 1 /* grant table page */
114 /* Index into source mapping space. */
117 /* GPFN where the source mapping page should appear. */
120 DEFINE_GUEST_HANDLE_STRUCT(xen_add_to_physmap);
123 * Translates a list of domain-specific GPFNs into MFNs. Returns a -ve error
124 * code on failure. This call only works for auto-translated guests.
126 #define XENMEM_translate_gpfn_list 8
127 struct xen_translate_gpfn_list {
128 /* Which domain to translate for? */
131 /* Length of list. */
132 unsigned long nr_gpfns;
134 /* List of GPFNs to translate. */
135 GUEST_HANDLE(ulong) gpfn_list;
138 * Output list to contain MFN translations. May be the same as the input
139 * list (in which case each input GPFN is overwritten with the output MFN).
141 GUEST_HANDLE(ulong) mfn_list;
143 DEFINE_GUEST_HANDLE_STRUCT(xen_translate_gpfn_list);
145 #endif /* __XEN_PUBLIC_MEMORY_H__ */