1*3a9fd824SRoger Pau Monné /****************************************************************************** 2*3a9fd824SRoger Pau Monné * tmem.h 3*3a9fd824SRoger Pau Monné * 4*3a9fd824SRoger Pau Monné * Guest OS interface to Xen Transcendent Memory. 5*3a9fd824SRoger Pau Monné * 6*3a9fd824SRoger Pau Monné * Permission is hereby granted, free of charge, to any person obtaining a copy 7*3a9fd824SRoger Pau Monné * of this software and associated documentation files (the "Software"), to 8*3a9fd824SRoger Pau Monné * deal in the Software without restriction, including without limitation the 9*3a9fd824SRoger Pau Monné * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 10*3a9fd824SRoger Pau Monné * sell copies of the Software, and to permit persons to whom the Software is 11*3a9fd824SRoger Pau Monné * furnished to do so, subject to the following conditions: 12*3a9fd824SRoger Pau Monné * 13*3a9fd824SRoger Pau Monné * The above copyright notice and this permission notice shall be included in 14*3a9fd824SRoger Pau Monné * all copies or substantial portions of the Software. 15*3a9fd824SRoger Pau Monné * 16*3a9fd824SRoger Pau Monné * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17*3a9fd824SRoger Pau Monné * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18*3a9fd824SRoger Pau Monné * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19*3a9fd824SRoger Pau Monné * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20*3a9fd824SRoger Pau Monné * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 21*3a9fd824SRoger Pau Monné * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 22*3a9fd824SRoger Pau Monné * DEALINGS IN THE SOFTWARE. 23*3a9fd824SRoger Pau Monné * 24*3a9fd824SRoger Pau Monné * Copyright (c) 2004, K A Fraser 25*3a9fd824SRoger Pau Monné */ 26*3a9fd824SRoger Pau Monné 27*3a9fd824SRoger Pau Monné #ifndef __XEN_PUBLIC_TMEM_H__ 28*3a9fd824SRoger Pau Monné #define __XEN_PUBLIC_TMEM_H__ 29*3a9fd824SRoger Pau Monné 30*3a9fd824SRoger Pau Monné #include "xen.h" 31*3a9fd824SRoger Pau Monné 32*3a9fd824SRoger Pau Monné #if __XEN_INTERFACE_VERSION__ < 0x00041300 33*3a9fd824SRoger Pau Monné 34*3a9fd824SRoger Pau Monné /* version of ABI */ 35*3a9fd824SRoger Pau Monné #define TMEM_SPEC_VERSION 1 36*3a9fd824SRoger Pau Monné 37*3a9fd824SRoger Pau Monné #define TMEM_NEW_POOL 1 38*3a9fd824SRoger Pau Monné #define TMEM_DESTROY_POOL 2 39*3a9fd824SRoger Pau Monné #define TMEM_PUT_PAGE 4 40*3a9fd824SRoger Pau Monné #define TMEM_GET_PAGE 5 41*3a9fd824SRoger Pau Monné #define TMEM_FLUSH_PAGE 6 42*3a9fd824SRoger Pau Monné #define TMEM_FLUSH_OBJECT 7 43*3a9fd824SRoger Pau Monné #if __XEN_INTERFACE_VERSION__ < 0x00040400 44*3a9fd824SRoger Pau Monné #define TMEM_NEW_PAGE 3 45*3a9fd824SRoger Pau Monné #define TMEM_READ 8 46*3a9fd824SRoger Pau Monné #define TMEM_WRITE 9 47*3a9fd824SRoger Pau Monné #define TMEM_XCHG 10 48*3a9fd824SRoger Pau Monné #endif 49*3a9fd824SRoger Pau Monné 50*3a9fd824SRoger Pau Monné /* Privileged commands now called via XEN_SYSCTL_tmem_op. */ 51*3a9fd824SRoger Pau Monné #define TMEM_AUTH 101 /* as XEN_SYSCTL_TMEM_OP_SET_AUTH. */ 52*3a9fd824SRoger Pau Monné #define TMEM_RESTORE_NEW 102 /* as XEN_SYSCTL_TMEM_OP_SET_POOL. */ 53*3a9fd824SRoger Pau Monné 54*3a9fd824SRoger Pau Monné /* Bits for HYPERVISOR_tmem_op(TMEM_NEW_POOL) */ 55*3a9fd824SRoger Pau Monné #define TMEM_POOL_PERSIST 1 56*3a9fd824SRoger Pau Monné #define TMEM_POOL_SHARED 2 57*3a9fd824SRoger Pau Monné #define TMEM_POOL_PRECOMPRESSED 4 58*3a9fd824SRoger Pau Monné #define TMEM_POOL_PAGESIZE_SHIFT 4 59*3a9fd824SRoger Pau Monné #define TMEM_POOL_PAGESIZE_MASK 0xf 60*3a9fd824SRoger Pau Monné #define TMEM_POOL_VERSION_SHIFT 24 61*3a9fd824SRoger Pau Monné #define TMEM_POOL_VERSION_MASK 0xff 62*3a9fd824SRoger Pau Monné #define TMEM_POOL_RESERVED_BITS 0x00ffff00 63*3a9fd824SRoger Pau Monné 64*3a9fd824SRoger Pau Monné /* Bits for client flags (save/restore) */ 65*3a9fd824SRoger Pau Monné #define TMEM_CLIENT_COMPRESS 1 66*3a9fd824SRoger Pau Monné #define TMEM_CLIENT_FROZEN 2 67*3a9fd824SRoger Pau Monné 68*3a9fd824SRoger Pau Monné /* Special errno values */ 69*3a9fd824SRoger Pau Monné #define EFROZEN 1000 70*3a9fd824SRoger Pau Monné #define EEMPTY 1001 71*3a9fd824SRoger Pau Monné 72*3a9fd824SRoger Pau Monné struct xen_tmem_oid { 73*3a9fd824SRoger Pau Monné uint64_t oid[3]; 74*3a9fd824SRoger Pau Monné }; 75*3a9fd824SRoger Pau Monné typedef struct xen_tmem_oid xen_tmem_oid_t; 76*3a9fd824SRoger Pau Monné DEFINE_XEN_GUEST_HANDLE(xen_tmem_oid_t); 77*3a9fd824SRoger Pau Monné 78*3a9fd824SRoger Pau Monné #ifndef __ASSEMBLY__ 79*3a9fd824SRoger Pau Monné #if __XEN_INTERFACE_VERSION__ < 0x00040400 80*3a9fd824SRoger Pau Monné typedef xen_pfn_t tmem_cli_mfn_t; 81*3a9fd824SRoger Pau Monné #endif 82*3a9fd824SRoger Pau Monné typedef XEN_GUEST_HANDLE(char) tmem_cli_va_t; 83*3a9fd824SRoger Pau Monné struct tmem_op { 84*3a9fd824SRoger Pau Monné uint32_t cmd; 85*3a9fd824SRoger Pau Monné int32_t pool_id; 86*3a9fd824SRoger Pau Monné union { 87*3a9fd824SRoger Pau Monné struct { 88*3a9fd824SRoger Pau Monné uint64_t uuid[2]; 89*3a9fd824SRoger Pau Monné uint32_t flags; 90*3a9fd824SRoger Pau Monné uint32_t arg1; 91*3a9fd824SRoger Pau Monné } creat; /* for cmd == TMEM_NEW_POOL. */ 92*3a9fd824SRoger Pau Monné struct { 93*3a9fd824SRoger Pau Monné #if __XEN_INTERFACE_VERSION__ < 0x00040600 94*3a9fd824SRoger Pau Monné uint64_t oid[3]; 95*3a9fd824SRoger Pau Monné #else 96*3a9fd824SRoger Pau Monné xen_tmem_oid_t oid; 97*3a9fd824SRoger Pau Monné #endif 98*3a9fd824SRoger Pau Monné uint32_t index; 99*3a9fd824SRoger Pau Monné uint32_t tmem_offset; 100*3a9fd824SRoger Pau Monné uint32_t pfn_offset; 101*3a9fd824SRoger Pau Monné uint32_t len; 102*3a9fd824SRoger Pau Monné xen_pfn_t cmfn; /* client machine page frame */ 103*3a9fd824SRoger Pau Monné } gen; /* for all other cmd ("generic") */ 104*3a9fd824SRoger Pau Monné } u; 105*3a9fd824SRoger Pau Monné }; 106*3a9fd824SRoger Pau Monné typedef struct tmem_op tmem_op_t; 107*3a9fd824SRoger Pau Monné DEFINE_XEN_GUEST_HANDLE(tmem_op_t); 108*3a9fd824SRoger Pau Monné #endif 109*3a9fd824SRoger Pau Monné 110*3a9fd824SRoger Pau Monné #endif /* __XEN_INTERFACE_VERSION__ < 0x00041300 */ 111*3a9fd824SRoger Pau Monné 112*3a9fd824SRoger Pau Monné #endif /* __XEN_PUBLIC_TMEM_H__ */ 113*3a9fd824SRoger Pau Monné 114*3a9fd824SRoger Pau Monné /* 115*3a9fd824SRoger Pau Monné * Local variables: 116*3a9fd824SRoger Pau Monné * mode: C 117*3a9fd824SRoger Pau Monné * c-file-style: "BSD" 118*3a9fd824SRoger Pau Monné * c-basic-offset: 4 119*3a9fd824SRoger Pau Monné * tab-width: 4 120*3a9fd824SRoger Pau Monné * indent-tabs-mode: nil 121*3a9fd824SRoger Pau Monné * End: 122*3a9fd824SRoger Pau Monné */ 123