2 * Xen implementation for transcendent memory (tmem)
4 * Dan Magenheimer <dan.magenheimer@oracle.com> 2009
7 #include <linux/types.h>
8 #include <xen/interface/xen.h>
9 #include <asm/hypervisor.h>
12 int xen_tmem_op(u32 tmem_cmd, u32 tmem_pool, struct tmem_oid oid, u32 index,
13 unsigned long gmfn, u32 tmem_offset, u32 pfn_offset, u32 len)
19 op.pool_id = tmem_pool;
20 BUILD_BUG_ON(sizeof(op.u.gen.oid) != sizeof(oid.oid));
21 memcpy(op.u.gen.oid, oid.oid, sizeof(op.u.gen.oid));
22 op.u.gen.index = index;
23 op.u.gen.tmem_offset = tmem_offset;
24 op.u.gen.pfn_offset = pfn_offset;
27 rc = HYPERVISOR_tmem_op(&op);
31 int xen_tmem_new_pool(uint32_t tmem_cmd, struct tmem_pool_uuid uuid,
38 op.u.creat.uuid[0] = uuid.lo;
39 op.u.creat.uuid[1] = uuid.hi;
40 #ifdef TMEM_SPEC_VERSION
41 switch (flags >> TMEM_POOL_VERSION_SHIFT) {
43 flags |= TMEM_SPEC_VERSION << TMEM_POOL_VERSION_SHIFT;
45 case TMEM_SPEC_VERSION:
48 WARN(1, "TMEM: Bogus version %u, expecting %u\n",
49 flags >> TMEM_POOL_VERSION_SHIFT, TMEM_SPEC_VERSION);
53 op.u.creat.flags = flags;
54 rc = HYPERVISOR_tmem_op(&op);