- Update to 2.6.25-rc3.
[linux-flexiantxendom0-3.2.10.git] / include / xen / interface / memory.h
index 1fc73cb..af36ead 100644 (file)
@@ -1,25 +1,7 @@
 /******************************************************************************
  * memory.h
- * 
- * Memory reservation and information.
- * 
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to
- * deal in the Software without restriction, including without limitation the
- * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
  *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
+ * Memory reservation and information.
  *
  * Copyright (c) 2005, Keir Fraser <keir@xensource.com>
  */
@@ -28,8 +10,8 @@
 #define __XEN_PUBLIC_MEMORY_H__
 
 /*
- * Increase or decrease the specified domain's memory reservation. Returns the
- * number of extents successfully allocated or freed.
+ * Increase or decrease the specified domain's memory reservation. Returns a
+ * -ve errcode on failure, or the # extents successfully allocated or freed.
  * arg == addr of struct xen_memory_reservation.
  */
 #define XENMEM_increase_reservation 0
@@ -47,15 +29,15 @@ struct xen_memory_reservation {
      *   OUT: GMFN bases of extents that were allocated
      *   (NB. This command also updates the mach_to_phys translation table)
      */
-    XEN_GUEST_HANDLE(xen_pfn_t) extent_start;
+    GUEST_HANDLE(ulong) extent_start;
 
     /* Number of extents, and size/alignment of each (2^extent_order pages). */
-    xen_ulong_t    nr_extents;
+    unsigned long  nr_extents;
     unsigned int   extent_order;
 
     /*
-     * Maximum # bits addressable by the user of the allocated region (e.g., 
-     * I/O devices often have a 32-bit limitation even in 64-bit systems). If 
+     * Maximum # bits addressable by the user of the allocated region (e.g.,
+     * I/O devices often have a 32-bit limitation even in 64-bit systems). If
      * zero then the user has no addressing restriction.
      * This field is not used by XENMEM_decrease_reservation.
      */
@@ -66,53 +48,9 @@ struct xen_memory_reservation {
      * Unprivileged domains can specify only DOMID_SELF.
      */
     domid_t        domid;
-};
-DEFINE_XEN_GUEST_HANDLE_STRUCT(xen_memory_reservation);
-typedef struct xen_memory_reservation xen_memory_reservation_t;
-DEFINE_XEN_GUEST_HANDLE(xen_memory_reservation_t);
 
-/*
- * An atomic exchange of memory pages. If return code is zero then
- * @out.extent_list provides GMFNs of the newly-allocated memory.
- * Returns zero on complete success, otherwise a negative error code.
- * On complete success then always @nr_exchanged == @in.nr_extents.
- * On partial success @nr_exchanged indicates how much work was done.
- */
-#define XENMEM_exchange             11
-struct xen_memory_exchange {
-    /*
-     * [IN] Details of memory extents to be exchanged (GMFN bases).
-     * Note that @in.address_bits is ignored and unused.
-     */
-    struct xen_memory_reservation in;
-
-    /*
-     * [IN/OUT] Details of new memory extents.
-     * We require that:
-     *  1. @in.domid == @out.domid
-     *  2. @in.nr_extents  << @in.extent_order == 
-     *     @out.nr_extents << @out.extent_order
-     *  3. @in.extent_start and @out.extent_start lists must not overlap
-     *  4. @out.extent_start lists GPFN bases to be populated
-     *  5. @out.extent_start is overwritten with allocated GMFN bases
-     */
-    struct xen_memory_reservation out;
-
-    /*
-     * [OUT] Number of input extents that were successfully exchanged:
-     *  1. The first @nr_exchanged input extents were successfully
-     *     deallocated.
-     *  2. The corresponding first entries in the output extent list correctly
-     *     indicate the GMFNs that were successfully exchanged.
-     *  3. All other input and output extents are untouched.
-     *  4. If not all input exents are exchanged then the return code of this
-     *     command will be non-zero.
-     *  5. THIS FIELD MUST BE INITIALISED TO ZERO BY THE CALLER!
-     */
-    xen_ulong_t nr_exchanged;
 };
-typedef struct xen_memory_exchange xen_memory_exchange_t;
-DEFINE_XEN_GUEST_HANDLE(xen_memory_exchange_t);
+DEFINE_GUEST_HANDLE_STRUCT(xen_memory_reservation);
 
 /*
  * Returns the maximum machine frame number of mapped RAM in this system.
@@ -130,11 +68,6 @@ DEFINE_XEN_GUEST_HANDLE(xen_memory_exchange_t);
 #define XENMEM_maximum_reservation  4
 
 /*
- * Returns the maximum GPFN in use by the guest, or -ve errcode on failure.
- */
-#define XENMEM_maximum_gpfn         14
-
-/*
  * Returns a list of MFN bases of 2MB extents comprising the machine_to_phys
  * mapping table. Architectures which do not have a m2p table do not implement
  * this command.
@@ -153,7 +86,7 @@ struct xen_machphys_mfn_list {
      * any large discontiguities in the machine address space, 2MB gaps in
      * the machphys table will be represented by an MFN base of zero.
      */
-    XEN_GUEST_HANDLE(xen_pfn_t) extent_start;
+    GUEST_HANDLE(ulong) extent_start;
 
     /*
      * Number of extents written to the above array. This will be smaller
@@ -161,23 +94,7 @@ struct xen_machphys_mfn_list {
      */
     unsigned int nr_extents;
 };
-DEFINE_XEN_GUEST_HANDLE_STRUCT(xen_machphys_mfn_list);
-typedef struct xen_machphys_mfn_list xen_machphys_mfn_list_t;
-DEFINE_XEN_GUEST_HANDLE(xen_machphys_mfn_list_t);
-
-/*
- * Returns the location in virtual address space of the machine_to_phys
- * mapping table. Architectures which do not have a m2p table, or which do not
- * map it by default into guest address space, do not implement this command.
- * arg == addr of xen_machphys_mapping_t.
- */
-#define XENMEM_machphys_mapping     12
-struct xen_machphys_mapping {
-    xen_ulong_t v_start, v_end; /* Start and end virtual addresses.   */
-    xen_ulong_t max_mfn;        /* Maximum MFN that can be looked up. */
-};
-typedef struct xen_machphys_mapping xen_machphys_mapping_t;
-DEFINE_XEN_GUEST_HANDLE(xen_machphys_mapping_t);
+DEFINE_GUEST_HANDLE_STRUCT(xen_machphys_mfn_list);
 
 /*
  * Sets the GPFN at which a particular page appears in the specified guest's
@@ -195,14 +112,12 @@ struct xen_add_to_physmap {
     unsigned int space;
 
     /* Index into source mapping space. */
-    xen_ulong_t idx;
+    unsigned long idx;
 
     /* GPFN where the source mapping page should appear. */
-    xen_pfn_t     gpfn;
+    unsigned long gpfn;
 };
-DEFINE_XEN_GUEST_HANDLE_STRUCT(xen_add_to_physmap);
-typedef struct xen_add_to_physmap xen_add_to_physmap_t;
-DEFINE_XEN_GUEST_HANDLE(xen_add_to_physmap_t);
+DEFINE_GUEST_HANDLE_STRUCT(xen_add_to_physmap);
 
 /*
  * Translates a list of domain-specific GPFNs into MFNs. Returns a -ve error
@@ -214,72 +129,17 @@ struct xen_translate_gpfn_list {
     domid_t domid;
 
     /* Length of list. */
-    xen_ulong_t nr_gpfns;
+    unsigned long nr_gpfns;
 
     /* List of GPFNs to translate. */
-    XEN_GUEST_HANDLE(xen_pfn_t) gpfn_list;
+    GUEST_HANDLE(ulong) gpfn_list;
 
     /*
      * Output list to contain MFN translations. May be the same as the input
      * list (in which case each input GPFN is overwritten with the output MFN).
      */
-    XEN_GUEST_HANDLE(xen_pfn_t) mfn_list;
+    GUEST_HANDLE(ulong) mfn_list;
 };
-DEFINE_XEN_GUEST_HANDLE_STRUCT(xen_translate_gpfn_list);
-typedef struct xen_translate_gpfn_list xen_translate_gpfn_list_t;
-DEFINE_XEN_GUEST_HANDLE(xen_translate_gpfn_list_t);
-
-/*
- * Returns the pseudo-physical memory map as it was when the domain
- * was started (specified by XENMEM_set_memory_map).
- * arg == addr of xen_memory_map_t.
- */
-#define XENMEM_memory_map           9
-struct xen_memory_map {
-    /*
-     * On call the number of entries which can be stored in buffer. On
-     * return the number of entries which have been stored in
-     * buffer.
-     */
-    unsigned int nr_entries;
-
-    /*
-     * Entries in the buffer are in the same format as returned by the
-     * BIOS INT 0x15 EAX=0xE820 call.
-     */
-    XEN_GUEST_HANDLE(void) buffer;
-};
-typedef struct xen_memory_map xen_memory_map_t;
-DEFINE_XEN_GUEST_HANDLE(xen_memory_map_t);
-
-/*
- * Returns the real physical memory map. Passes the same structure as
- * XENMEM_memory_map.
- * arg == addr of xen_memory_map_t.
- */
-#define XENMEM_machine_memory_map   10
-
-/*
- * Set the pseudo-physical memory map of a domain, as returned by
- * XENMEM_memory_map.
- * arg == addr of xen_foreign_memory_map_t.
- */
-#define XENMEM_set_memory_map       13
-struct xen_foreign_memory_map {
-    domid_t domid;
-    struct xen_memory_map map;
-};
-typedef struct xen_foreign_memory_map xen_foreign_memory_map_t;
-DEFINE_XEN_GUEST_HANDLE(xen_foreign_memory_map_t);
+DEFINE_GUEST_HANDLE_STRUCT(xen_translate_gpfn_list);
 
 #endif /* __XEN_PUBLIC_MEMORY_H__ */
-
-/*
- * Local variables:
- * mode: C
- * c-set-style: "BSD"
- * c-basic-offset: 4
- * tab-width: 4
- * indent-tabs-mode: nil
- * End:
- */