LCOV - code coverage report
Current view: top level - zephyr/xen/public - memory.h Coverage Total Hit
Test: new.info Lines: 0.0 % 61 0
Test Date: 2025-10-20 12:20:01

            Line data    Source code
       1            0 : /* SPDX-License-Identifier: MIT */
       2              : 
       3              : /******************************************************************************
       4              :  * memory.h
       5              :  *
       6              :  * Memory reservation and information.
       7              :  *
       8              :  * Permission is hereby granted, free of charge, to any person obtaining a copy
       9              :  * of this software and associated documentation files (the "Software"), to
      10              :  * deal in the Software without restriction, including without limitation the
      11              :  * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
      12              :  * sell copies of the Software, and to permit persons to whom the Software is
      13              :  * furnished to do so, subject to the following conditions:
      14              :  *
      15              :  * The above copyright notice and this permission notice shall be included in
      16              :  * all copies or substantial portions of the Software.
      17              :  *
      18              :  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
      19              :  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
      20              :  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
      21              :  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
      22              :  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
      23              :  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
      24              :  * DEALINGS IN THE SOFTWARE.
      25              :  *
      26              :  * Copyright (c) 2005, Keir Fraser <keir@xensource.com>
      27              :  */
      28              : 
      29              : #ifndef __XEN_PUBLIC_MEMORY_H__
      30              : #define __XEN_PUBLIC_MEMORY_H__
      31              : 
      32              : #include "xen.h"
      33              : 
      34            0 : #define XENMEM_populate_physmap         6
      35              : 
      36            0 : struct xen_memory_reservation {
      37              : 
      38              :         /*
      39              :          * XENMEM_increase_reservation:
      40              :          *   OUT: MFN (*not* GMFN) bases of extents that were allocated
      41              :          * XENMEM_decrease_reservation:
      42              :          *   IN:  GMFN bases of extents to free
      43              :          * XENMEM_populate_physmap:
      44              :          *   IN:  GPFN bases of extents to populate with memory
      45              :          *   OUT: GMFN bases of extents that were allocated
      46              :          *   (NB. This command also updates the mach_to_phys translation table)
      47              :          * XENMEM_claim_pages:
      48              :          *   IN: must be zero
      49              :          */
      50            0 :         XEN_GUEST_HANDLE(xen_pfn_t) extent_start;
      51              : 
      52              :         /* Number of extents, and size/alignment of each (2^extent_order pages). */
      53            0 :         xen_ulong_t     nr_extents;
      54            0 :         unsigned int    extent_order;
      55              : 
      56              : #if CONFIG_XEN_INTERFACE_VERSION >= 0x00030209
      57              :         /* XENMEMF flags. */
      58              :         unsigned int    mem_flags;
      59              : #else
      60            0 :         unsigned int    address_bits;
      61              : #endif
      62              : 
      63              :         /*
      64              :          * Domain whose reservation is being changed.
      65              :          * Unprivileged domains can specify only DOMID_SELF.
      66              :          */
      67            0 :         domid_t         domid;
      68              : };
      69            0 : typedef struct xen_memory_reservation xen_memory_reservation_t;
      70            0 : DEFINE_XEN_GUEST_HANDLE(xen_memory_reservation_t);
      71              : 
      72              : /* A batched version of add_to_physmap. */
      73            0 : #define XENMEM_add_to_physmap_batch 23
      74            0 : struct xen_add_to_physmap_batch {
      75              :         /* IN */
      76              :         /* Which domain to change the mapping for. */
      77            0 :         domid_t domid;
      78            0 :         uint16_t space; /* => enum phys_map_space */
      79              : 
      80              :         /* Number of pages to go through */
      81            0 :         uint16_t size;
      82              : 
      83              : #if CONFIG_XEN_INTERFACE_VERSION < 0x00040700
      84            0 :         domid_t foreign_domid; /* IFF gmfn_foreign. Should be 0 for other spaces. */
      85              : #else
      86              :         union xen_add_to_physmap_batch_extra {
      87              :                 domid_t foreign_domid; /* gmfn_foreign */
      88              :                 uint16_t res0;  /* All the other spaces. Should be 0 */
      89              :         } u;
      90              : #endif
      91              : 
      92              :         /* Indexes into space being mapped. */
      93            0 :         XEN_GUEST_HANDLE(xen_ulong_t) idxs;
      94              : 
      95              :         /* GPFN in domid where the source mapping page should appear. */
      96            0 :         XEN_GUEST_HANDLE(xen_pfn_t) gpfns;
      97              : 
      98              :         /* OUT */
      99              :         /* Per index error code. */
     100            0 :         XEN_GUEST_HANDLE(int) errs;
     101              : };
     102            0 : typedef struct xen_add_to_physmap_batch xen_add_to_physmap_batch_t;
     103            0 : DEFINE_XEN_GUEST_HANDLE(xen_add_to_physmap_batch_t);
     104              : 
     105              : 
     106            0 : #define XENMAPSPACE_shared_info         0       /* shared info page */
     107            0 : #define XENMAPSPACE_grant_table         1       /* grant table page */
     108            0 : #define XENMAPSPACE_gmfn                2       /* GMFN */
     109              : 
     110              : /* GMFN range, XENMEM_add_to_physmap only.*/
     111            0 : #define XENMAPSPACE_gmfn_range          3
     112              : 
     113              : /* GMFN from another dom, XENMEM_add_to_physmap_batch only. */
     114            0 : #define XENMAPSPACE_gmfn_foreign        4
     115              : 
     116              : /*
     117              :  * Device mmio region ARM only; the region is mapped in Stage-2 using the
     118              :  * Normal Memory Inner/Outer Write-Back Cacheable memory attribute.
     119              :  */
     120            0 : #define XENMAPSPACE_dev_mmio            5
     121              : 
     122              : /*
     123              :  * Sets the GPFN at which a particular page appears in the specified guest's
     124              :  * physical address space (translated guests only).
     125              :  * arg == addr of xen_add_to_physmap_t.
     126              :  */
     127            0 : #define XENMEM_add_to_physmap           7
     128            0 : struct xen_add_to_physmap {
     129              :         /* Which domain to change the mapping for. */
     130            0 :         domid_t domid;
     131              : 
     132              :         /* Number of pages to go through for gmfn_range */
     133            0 :         uint16_t size;
     134              : 
     135            0 :         unsigned int space; /* => enum phys_map_space */
     136              : 
     137            0 : #define XENMAPIDX_grant_table_status 0x80000000
     138              : 
     139              :         /* Index into space being mapped. */
     140            0 :         xen_ulong_t idx;
     141              : 
     142              :         /* GPFN in domid where the source mapping page should appear. */
     143            0 :         xen_pfn_t gpfn;
     144              : };
     145            0 : typedef struct xen_add_to_physmap xen_add_to_physmap_t;
     146            0 : DEFINE_XEN_GUEST_HANDLE(xen_add_to_physmap_t);
     147              : 
     148              : /*
     149              :  * Unmaps the page appearing at a particular GPFN from the specified guest's
     150              :  * physical address space (translated guests only).
     151              :  * arg == addr of xen_remove_from_physmap_t.
     152              :  */
     153            0 : #define XENMEM_remove_from_physmap      15
     154            0 : struct xen_remove_from_physmap {
     155              :         /* Which domain to change the mapping for. */
     156            0 :         domid_t domid;
     157              : 
     158              :         /* GPFN of the current mapping of the page. */
     159            0 :         xen_pfn_t gpfn;
     160              : };
     161            0 : typedef struct xen_remove_from_physmap xen_remove_from_physmap_t;
     162            0 : DEFINE_XEN_GUEST_HANDLE(xen_remove_from_physmap_t);
     163              : 
     164              : /*
     165              :  * Get the pages for a particular guest resource, so that they can be
     166              :  * mapped directly by a tools domain.
     167              :  */
     168            0 : #define XENMEM_acquire_resource 28
     169            0 : struct xen_mem_acquire_resource {
     170              :         /* IN - The domain whose resource is to be mapped */
     171            0 :         domid_t domid;
     172              :         /* IN - the type of resource */
     173            0 :         uint16_t type;
     174              : 
     175            0 : #define XENMEM_resource_ioreq_server 0
     176            0 : #define XENMEM_resource_grant_table 1
     177            0 : #define XENMEM_resource_vmtrace_buf 2
     178              : 
     179              :         /*
     180              :          * IN - a type-specific resource identifier, which must be zero
     181              :          *      unless stated otherwise.
     182              :          *
     183              :          * type == XENMEM_resource_ioreq_server -> id == ioreq server id
     184              :          * type == XENMEM_resource_grant_table -> id defined below
     185              :          */
     186            0 :         uint32_t id;
     187              : 
     188            0 : #define XENMEM_resource_grant_table_id_shared 0
     189            0 : #define XENMEM_resource_grant_table_id_status 1
     190              : 
     191              :         /*
     192              :          * IN/OUT
     193              :          *
     194              :          * As an IN parameter number of frames of the resource to be mapped.
     195              :          * This value may be updated over the course of the operation.
     196              :          *
     197              :          * When frame_list is NULL and nr_frames is 0, this is interpreted as a
     198              :          * request for the size of the resource, which shall be returned in the
     199              :          * nr_frames field.
     200              :          *
     201              :          * The size of a resource will never be zero, but a nonzero result doesn't
     202              :          * guarantee that a subsequent mapping request will be successful.  There
     203              :          * are further type/id specific constraints which may change between the
     204              :          * two calls.
     205              :          */
     206            0 :         uint32_t nr_frames;
     207              :         /*
     208              :          * Padding field, must be zero on input.
     209              :          * In a previous version this was an output field with the lowest bit
     210              :          * named XENMEM_rsrc_acq_caller_owned. Future versions of this interface
     211              :          * will not reuse this bit as an output with the field being zero on
     212              :          * input.
     213              :          */
     214            0 :         uint32_t pad;
     215              :         /*
     216              :          * IN - the index of the initial frame to be mapped. This parameter
     217              :          *      is ignored if nr_frames is 0.  This value may be updated
     218              :          *      over the course of the operation.
     219              :          */
     220            0 :         uint64_t frame;
     221              : 
     222            0 : #define XENMEM_resource_ioreq_server_frame_bufioreq 0
     223            0 : #define XENMEM_resource_ioreq_server_frame_ioreq(n) (1 + (n))
     224              : 
     225              :         /*
     226              :          * IN/OUT - If the tools domain is PV then, upon return, frame_list
     227              :          *          will be populated with the MFNs of the resource.
     228              :          *          If the tools domain is HVM then it is expected that, on
     229              :          *          entry, frame_list will be populated with a list of GFNs
     230              :          *          that will be mapped to the MFNs of the resource.
     231              :          *          If -EIO is returned then the frame_list has only been
     232              :          *          partially mapped and it is up to the caller to unmap all
     233              :          *          the GFNs.
     234              :          *          This parameter may be NULL if nr_frames is 0.  This
     235              :          *          value may be updated over the course of the operation.
     236              :          */
     237            0 :         XEN_GUEST_HANDLE(xen_pfn_t) frame_list;
     238              : };
     239            0 : typedef struct xen_mem_acquire_resource xen_mem_acquire_resource_t;
     240            0 : DEFINE_XEN_GUEST_HANDLE(xen_mem_acquire_resource_t);
     241              : 
     242              : #endif /* __XEN_PUBLIC_MEMORY_H__ */
        

Generated by: LCOV version 2.0-1