direct-io.hg

view xen/include/public/memory.h @ 8736:8aeb417387ca

Fix some more pfn/mfn/gmfn/gpfn inconsistencies. Fix some direct
uses of max_page variable to use the mfn_valid() predicate.

Signed-off-by: Keir Fraser <keir@xensource.com>
author kaf24@firebug.cl.cam.ac.uk
date Thu Feb 02 12:18:28 2006 +0100 (2006-02-02)
parents 1db05e589fa0
children 0d10fac28427
line source
1 /******************************************************************************
2 * memory.h
3 *
4 * Memory reservation and information.
5 *
6 * Copyright (c) 2005, Keir Fraser <keir@xensource.com>
7 */
9 #ifndef __XEN_PUBLIC_MEMORY_H__
10 #define __XEN_PUBLIC_MEMORY_H__
12 /*
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.
16 */
17 #define XENMEM_increase_reservation 0
18 #define XENMEM_decrease_reservation 1
19 #define XENMEM_populate_physmap 6
20 typedef struct xen_memory_reservation {
22 /*
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)
31 */
32 unsigned long *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;
38 /*
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.
43 */
44 unsigned int address_bits;
46 /*
47 * Domain whose reservation is being changed.
48 * Unprivileged domains can specify only DOMID_SELF.
49 */
50 domid_t domid;
52 } xen_memory_reservation_t;
54 /*
55 * Returns the maximum machine frame number of mapped RAM in this system.
56 * This command always succeeds (it never returns an error code).
57 * arg == NULL.
58 */
59 #define XENMEM_maximum_ram_page 2
61 /*
62 * Returns the current or maximum memory reservation, in pages, of the
63 * specified domain (may be DOMID_SELF). Returns -ve errcode on failure.
64 * arg == addr of domid_t.
65 */
66 #define XENMEM_current_reservation 3
67 #define XENMEM_maximum_reservation 4
69 /*
70 * Returns a list of MFN bases of 2MB extents comprising the machine_to_phys
71 * mapping table. Architectures which do not have a m2p table do not implement
72 * this command.
73 * arg == addr of xen_machphys_mfn_list_t.
74 */
75 #define XENMEM_machphys_mfn_list 5
76 typedef struct xen_machphys_mfn_list {
77 /*
78 * Size of the 'extent_start' array. Fewer entries will be filled if the
79 * machphys table is smaller than max_extents * 2MB.
80 */
81 unsigned int max_extents;
83 /*
84 * Pointer to buffer to fill with list of extent starts. If there are
85 * any large discontiguities in the machine address space, 2MB gaps in
86 * the machphys table will be represented by an MFN base of zero.
87 */
88 unsigned long *extent_start;
90 /*
91 * Number of extents written to the above array. This will be smaller
92 * than 'max_extents' if the machphys table is smaller than max_e * 2MB.
93 */
94 unsigned int nr_extents;
95 } xen_machphys_mfn_list_t;
97 /*
98 * Returns the base and size of the specified reserved 'RAM hole' in the
99 * specified guest's pseudophysical address space.
100 * arg == addr of xen_reserved_phys_area_t.
101 */
102 #define XENMEM_reserved_phys_area 7
103 typedef struct xen_reserved_phys_area {
104 /* Which request to report about? */
105 domid_t domid;
107 /*
108 * Which reserved area to report? Out-of-range request reports
109 * -ESRCH. Currently no architecture will have more than one reserved area.
110 */
111 unsigned int idx;
113 /* Base and size of the specified reserved area. */
114 unsigned long first_gpfn, nr_gpfns;
115 } xen_reserved_phys_area_t;
117 #endif /* __XEN_PUBLIC_MEMORY_H__ */
119 /*
120 * Local variables:
121 * mode: C
122 * c-set-style: "BSD"
123 * c-basic-offset: 4
124 * tab-width: 4
125 * indent-tabs-mode: nil
126 * End:
127 */