Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   1) /* SPDX-License-Identifier: GPL-2.0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2) /******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3)  * memory.h
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5)  * Memory reservation and information.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7)  * Copyright (c) 2005, Keir Fraser <keir@xensource.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10) #ifndef __XEN_PUBLIC_MEMORY_H__
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11) #define __XEN_PUBLIC_MEMORY_H__
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13) #include <linux/spinlock.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16)  * Increase or decrease the specified domain's memory reservation. Returns a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17)  * -ve errcode on failure, or the # extents successfully allocated or freed.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18)  * arg == addr of struct xen_memory_reservation.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20) #define XENMEM_increase_reservation 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21) #define XENMEM_decrease_reservation 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22) #define XENMEM_populate_physmap     6
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23) struct xen_memory_reservation {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25)     /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26)      * XENMEM_increase_reservation:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27)      *   OUT: MFN (*not* GMFN) bases of extents that were allocated
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28)      * XENMEM_decrease_reservation:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29)      *   IN:  GMFN bases of extents to free
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30)      * XENMEM_populate_physmap:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31)      *   IN:  GPFN bases of extents to populate with memory
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32)      *   OUT: GMFN bases of extents that were allocated
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33)      *   (NB. This command also updates the mach_to_phys translation table)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34)      */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35)     GUEST_HANDLE(xen_pfn_t) extent_start;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37)     /* Number of extents, and size/alignment of each (2^extent_order pages). */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38)     xen_ulong_t  nr_extents;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39)     unsigned int   extent_order;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41)     /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42)      * Maximum # bits addressable by the user of the allocated region (e.g.,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43)      * I/O devices often have a 32-bit limitation even in 64-bit systems). If
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44)      * zero then the user has no addressing restriction.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45)      * This field is not used by XENMEM_decrease_reservation.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46)      */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47)     unsigned int   address_bits;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49)     /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50)      * Domain whose reservation is being changed.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51)      * Unprivileged domains can specify only DOMID_SELF.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52)      */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53)     domid_t        domid;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) DEFINE_GUEST_HANDLE_STRUCT(xen_memory_reservation);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59)  * An atomic exchange of memory pages. If return code is zero then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60)  * @out.extent_list provides GMFNs of the newly-allocated memory.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61)  * Returns zero on complete success, otherwise a negative error code.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62)  * On complete success then always @nr_exchanged == @in.nr_extents.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63)  * On partial success @nr_exchanged indicates how much work was done.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) #define XENMEM_exchange             11
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) struct xen_memory_exchange {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67)     /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68)      * [IN] Details of memory extents to be exchanged (GMFN bases).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69)      * Note that @in.address_bits is ignored and unused.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70)      */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71)     struct xen_memory_reservation in;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73)     /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74)      * [IN/OUT] Details of new memory extents.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75)      * We require that:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76)      *  1. @in.domid == @out.domid
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77)      *  2. @in.nr_extents  << @in.extent_order ==
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78)      *     @out.nr_extents << @out.extent_order
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79)      *  3. @in.extent_start and @out.extent_start lists must not overlap
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80)      *  4. @out.extent_start lists GPFN bases to be populated
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81)      *  5. @out.extent_start is overwritten with allocated GMFN bases
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82)      */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83)     struct xen_memory_reservation out;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85)     /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86)      * [OUT] Number of input extents that were successfully exchanged:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87)      *  1. The first @nr_exchanged input extents were successfully
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88)      *     deallocated.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89)      *  2. The corresponding first entries in the output extent list correctly
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90)      *     indicate the GMFNs that were successfully exchanged.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91)      *  3. All other input and output extents are untouched.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92)      *  4. If not all input exents are exchanged then the return code of this
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93)      *     command will be non-zero.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94)      *  5. THIS FIELD MUST BE INITIALISED TO ZERO BY THE CALLER!
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95)      */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96)     xen_ulong_t nr_exchanged;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) DEFINE_GUEST_HANDLE_STRUCT(xen_memory_exchange);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101)  * Returns the maximum machine frame number of mapped RAM in this system.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102)  * This command always succeeds (it never returns an error code).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103)  * arg == NULL.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) #define XENMEM_maximum_ram_page     2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108)  * Returns the current or maximum memory reservation, in pages, of the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109)  * specified domain (may be DOMID_SELF). Returns -ve errcode on failure.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110)  * arg == addr of domid_t.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) #define XENMEM_current_reservation  3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) #define XENMEM_maximum_reservation  4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116)  * Returns a list of MFN bases of 2MB extents comprising the machine_to_phys
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117)  * mapping table. Architectures which do not have a m2p table do not implement
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118)  * this command.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119)  * arg == addr of xen_machphys_mfn_list_t.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) #define XENMEM_machphys_mfn_list    5
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) struct xen_machphys_mfn_list {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123)     /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124)      * Size of the 'extent_start' array. Fewer entries will be filled if the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125)      * machphys table is smaller than max_extents * 2MB.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126)      */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127)     unsigned int max_extents;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129)     /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130)      * Pointer to buffer to fill with list of extent starts. If there are
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131)      * any large discontiguities in the machine address space, 2MB gaps in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132)      * the machphys table will be represented by an MFN base of zero.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133)      */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134)     GUEST_HANDLE(xen_pfn_t) extent_start;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136)     /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137)      * Number of extents written to the above array. This will be smaller
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138)      * than 'max_extents' if the machphys table is smaller than max_e * 2MB.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139)      */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140)     unsigned int nr_extents;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) DEFINE_GUEST_HANDLE_STRUCT(xen_machphys_mfn_list);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145)  * Returns the location in virtual address space of the machine_to_phys
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146)  * mapping table. Architectures which do not have a m2p table, or which do not
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147)  * map it by default into guest address space, do not implement this command.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148)  * arg == addr of xen_machphys_mapping_t.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) #define XENMEM_machphys_mapping     12
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) struct xen_machphys_mapping {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152)     xen_ulong_t v_start, v_end; /* Start and end virtual addresses.   */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153)     xen_ulong_t max_mfn;        /* Maximum MFN that can be looked up. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) DEFINE_GUEST_HANDLE_STRUCT(xen_machphys_mapping_t);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) #define XENMAPSPACE_shared_info  0 /* shared info page */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) #define XENMAPSPACE_grant_table  1 /* grant table page */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) #define XENMAPSPACE_gmfn         2 /* GMFN */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) #define XENMAPSPACE_gmfn_range   3 /* GMFN range, XENMEM_add_to_physmap only. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) #define XENMAPSPACE_gmfn_foreign 4 /* GMFN from another dom,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) 				    * XENMEM_add_to_physmap_range only.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) 				    */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) #define XENMAPSPACE_dev_mmio     5 /* device mmio region */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167)  * Sets the GPFN at which a particular page appears in the specified guest's
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168)  * pseudophysical address space.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169)  * arg == addr of xen_add_to_physmap_t.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) #define XENMEM_add_to_physmap      7
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) struct xen_add_to_physmap {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173)     /* Which domain to change the mapping for. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174)     domid_t domid;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176)     /* Number of pages to go through for gmfn_range */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177)     uint16_t    size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179)     /* Source mapping space. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180)     unsigned int space;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182)     /* Index into source mapping space. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183)     xen_ulong_t idx;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185)     /* GPFN where the source mapping page should appear. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186)     xen_pfn_t gpfn;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) DEFINE_GUEST_HANDLE_STRUCT(xen_add_to_physmap);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) /*** REMOVED ***/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) /*#define XENMEM_translate_gpfn_list  8*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) #define XENMEM_add_to_physmap_range 23
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) struct xen_add_to_physmap_range {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195)     /* IN */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196)     /* Which domain to change the mapping for. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197)     domid_t domid;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198)     uint16_t space; /* => enum phys_map_space */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200)     /* Number of pages to go through */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201)     uint16_t size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202)     domid_t foreign_domid; /* IFF gmfn_foreign */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204)     /* Indexes into space being mapped. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205)     GUEST_HANDLE(xen_ulong_t) idxs;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207)     /* GPFN in domid where the source mapping page should appear. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208)     GUEST_HANDLE(xen_pfn_t) gpfns;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210)     /* OUT */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212)     /* Per index error code. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213)     GUEST_HANDLE(int) errs;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) DEFINE_GUEST_HANDLE_STRUCT(xen_add_to_physmap_range);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218)  * Returns the pseudo-physical memory map as it was when the domain
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219)  * was started (specified by XENMEM_set_memory_map).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220)  * arg == addr of struct xen_memory_map.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) #define XENMEM_memory_map           9
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) struct xen_memory_map {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224)     /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225)      * On call the number of entries which can be stored in buffer. On
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226)      * return the number of entries which have been stored in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227)      * buffer.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228)      */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229)     unsigned int nr_entries;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231)     /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232)      * Entries in the buffer are in the same format as returned by the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233)      * BIOS INT 0x15 EAX=0xE820 call.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234)      */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235)     GUEST_HANDLE(void) buffer;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) DEFINE_GUEST_HANDLE_STRUCT(xen_memory_map);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240)  * Returns the real physical memory map. Passes the same structure as
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241)  * XENMEM_memory_map.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242)  * arg == addr of struct xen_memory_map.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) #define XENMEM_machine_memory_map   10
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248)  * Unmaps the page appearing at a particular GPFN from the specified guest's
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249)  * pseudophysical address space.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250)  * arg == addr of xen_remove_from_physmap_t.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) #define XENMEM_remove_from_physmap      15
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) struct xen_remove_from_physmap {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254)     /* Which domain to change the mapping for. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255)     domid_t domid;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257)     /* GPFN of the current mapping of the page. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258)     xen_pfn_t gpfn;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260) DEFINE_GUEST_HANDLE_STRUCT(xen_remove_from_physmap);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263)  * Get the pages for a particular guest resource, so that they can be
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264)  * mapped directly by a tools domain.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266) #define XENMEM_acquire_resource 28
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267) struct xen_mem_acquire_resource {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268)     /* IN - The domain whose resource is to be mapped */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269)     domid_t domid;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270)     /* IN - the type of resource */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271)     uint16_t type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273) #define XENMEM_resource_ioreq_server 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274) #define XENMEM_resource_grant_table 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 276)     /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 277)      * IN - a type-specific resource identifier, which must be zero
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 278)      *      unless stated otherwise.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 279)      *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 280)      * type == XENMEM_resource_ioreq_server -> id == ioreq server id
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 281)      * type == XENMEM_resource_grant_table -> id defined below
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 282)      */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 283)     uint32_t id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 284) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 285) #define XENMEM_resource_grant_table_id_shared 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 286) #define XENMEM_resource_grant_table_id_status 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 287) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 288)     /* IN/OUT - As an IN parameter number of frames of the resource
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 289)      *          to be mapped. However, if the specified value is 0 and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 290)      *          frame_list is NULL then this field will be set to the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 291)      *          maximum value supported by the implementation on return.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 292)      */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 293)     uint32_t nr_frames;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 294)     /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 295)      * OUT - Must be zero on entry. On return this may contain a bitwise
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 296)      *       OR of the following values.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 297)      */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 298)     uint32_t flags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 299) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 300)     /* The resource pages have been assigned to the calling domain */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 301) #define _XENMEM_rsrc_acq_caller_owned 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 302) #define XENMEM_rsrc_acq_caller_owned (1u << _XENMEM_rsrc_acq_caller_owned)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 303) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 304)     /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 305)      * IN - the index of the initial frame to be mapped. This parameter
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 306)      *      is ignored if nr_frames is 0.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 307)      */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 308)     uint64_t frame;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 309) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 310) #define XENMEM_resource_ioreq_server_frame_bufioreq 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 311) #define XENMEM_resource_ioreq_server_frame_ioreq(n) (1 + (n))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 312) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 313)     /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 314)      * IN/OUT - If the tools domain is PV then, upon return, frame_list
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 315)      *          will be populated with the MFNs of the resource.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 316)      *          If the tools domain is HVM then it is expected that, on
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 317)      *          entry, frame_list will be populated with a list of GFNs
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 318)      *          that will be mapped to the MFNs of the resource.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 319)      *          If -EIO is returned then the frame_list has only been
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 320)      *          partially mapped and it is up to the caller to unmap all
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 321)      *          the GFNs.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 322)      *          This parameter may be NULL if nr_frames is 0.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 323)      */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 324)     GUEST_HANDLE(xen_pfn_t) frame_list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 325) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 326) DEFINE_GUEST_HANDLE_STRUCT(xen_mem_acquire_resource);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 327) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 328) #endif /* __XEN_PUBLIC_MEMORY_H__ */