diff -Naur linux-2.6.28/arch/x86/include/asm/xen/hypercall.h linux-2.6.28-tmem/arch/x86/include/asm/xen/hypercall.h --- linux-2.6.28/arch/x86/include/asm/xen/hypercall.h 2008-12-24 16:26:37.000000000 -0700 +++ linux-2.6.28-tmem/arch/x86/include/asm/xen/hypercall.h 2009-01-05 17:16:53.000000000 -0700 @@ -524,4 +524,11 @@ mcl->args[1] = esp; } +static inline int +HYPERVISOR_tmem_op( + struct tmem_op *op) +{ + return _hypercall1(int, tmem_op, op); +} + #endif /* _ASM_X86_XEN_HYPERCALL_H */ diff -Naur linux-2.6.28/arch/x86/xen/enlighten.c linux-2.6.28-tmem/arch/x86/xen/enlighten.c --- linux-2.6.28/arch/x86/xen/enlighten.c 2008-12-24 16:26:37.000000000 -0700 +++ linux-2.6.28-tmem/arch/x86/xen/enlighten.c 2009-01-05 16:56:34.000000000 -0700 @@ -1712,3 +1712,34 @@ x86_64_start_reservations((char *)__pa_symbol(&boot_params)); #endif } + +int xen_tmem_op(uint32_t tmem_cmd, uint32_t tmem_pool, uint64_t object, + uint32_t index, unsigned long gmfn, uint32_t offset, uint32_t len ) +{ + struct tmem_op op; + int rc = 0; + + op.cmd = tmem_cmd; + op.pool_id = tmem_pool; + op.object = object; + op.index = index; + op.offset = offset; + op.len = len; + set_xen_guest_handle(op.gmfn, (void *)gmfn); + rc = HYPERVISOR_tmem_op(&op); + return rc; +} + +int xen_tmem_new_pool(uint32_t tmem_cmd, uint64_t uuid_lo, + uint64_t uuid_hi, uint32_t flags) +{ + struct tmem_op op; + int rc = 0; + + op.cmd = tmem_cmd; + op.uuid[0] = uuid_lo; + op.uuid[1] = uuid_hi; + op.flags = flags; + rc = HYPERVISOR_tmem_op(&op); + return rc; +} diff -Naur linux-2.6.28/include/xen/interface/xen.h linux-2.6.28-tmem/include/xen/interface/xen.h --- linux-2.6.28/include/xen/interface/xen.h 2008-12-24 16:26:37.000000000 -0700 +++ linux-2.6.28-tmem/include/xen/interface/xen.h 2009-01-05 17:39:11.000000000 -0700 @@ -58,6 +58,7 @@ #define __HYPERVISOR_event_channel_op 32 #define __HYPERVISOR_physdev_op 33 #define __HYPERVISOR_hvm_op 34 +#define __HYPERVISOR_tmem_op 38 /* Architecture-specific hypercall definitions. */ #define __HYPERVISOR_arch_0 48 @@ -231,6 +232,29 @@ #define MAX_VMASST_TYPE 3 #ifndef __ASSEMBLY__ +struct tmem_op { + uint32_t cmd; + int32_t pool_id; /* private > 0; shared < 0; 0 is invalid */ + union { + struct { /* for cmd == TMEM_NEW_POOL */ + uint64_t uuid[2]; + uint32_t flags; + }; + struct { + uint64_t object; + uint32_t index; + uint32_t offset; + uint32_t len; + uint32_t padding; + GUEST_HANDLE(void) gmfn; /* guest machine page frame */ + }; + }; +}; +typedef struct tmem_op tmem_op_t; +DEFINE_GUEST_HANDLE_STRUCT(tmem_op_t); +#endif + +#ifndef __ASSEMBLY__ typedef uint16_t domid_t;