tmem: Public interface for tmem
PATCH 1/9 tmem: Public interface for tmem
[1] Public interface for tmem
xen/include/public/xen.h +68 -0
@@ -91,6 +91,7 @@ DEFINE_XEN_GUEST_HANDLE(xen_pfn_t);#define __HYPERVISOR_sysctl 35#define __HYPERVISOR_domctl 36#define __HYPERVISOR_kexec_op 37 +#define __HYPERVISOR_tmem_op 38/* Architecture-specific hypercall definitions. */ #define __HYPERVISOR_arch_0 48
@@ -324,6 +325,73 @@ DEFINE_XEN_GUEST_HANDLE(mmuext_op_t);#define VMASST_TYPE_pae_extended_cr3 3#define MAX_VMASST_TYPE 3 + +/* +* Commands to HYPERVISOR_tmem_op(). +*/ +#define TMEM_CONTROL 0 +#define TMEM_NEW_POOL 1 +#define TMEM_DESTROY_POOL 2 +#define TMEM_NEW_PAGE 3 +#define TMEM_PUT_PAGE 4 +#define TMEM_GET_PAGE 5 +#define TMEM_FLUSH_PAGE 6 +#define TMEM_FLUSH_OBJECT 7 +#define TMEM_READ 8 +#define TMEM_WRITE 9 +#define TMEM_XCHG 10 + +#define TMEMC_THAW 0 +#define TMEMC_FREEZE 1 +#define TMEMC_DESTROY 2 +#define TMEMC_LIST 3 +#define TMEMC_SET_WEIGHT 4 +#define TMEMC_SET_CAP 5 +#define TMEMC_SET_COMPRESS 6 + +#define TMEM_POOL_PERSIST 1 +#define TMEM_POOL_SHARED 2 + +#define EFROZEN 1000 + +#define TMEM_POOL_PAGESIZE_SHIFT 4 +#define TMEM_POOL_PAGESIZE_MASK 0xf +#define TMEM_POOL_VERSION_SHIFT 24 +#define TMEM_POOL_VERSION_MASK 0xff + +#ifndef __ASSEMBLY__ +typedef XEN_GUEST_HANDLE (void )tmem_cli_mfn_t ; +typedef XEN_GUEST_HANDLE (char )tmem_cli_va_t ; +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 {/* for cmd == TMEM_CONTROL */ +uint32_t subop; +uint32_t cli_id; +uint32_t arg1; +uint32_t arg2; +tmem_cli_va_t buf; + }; +struct { +uint64_t object; +uint32_t index; +uint32_t tmem_offset; +uint32_t pfn_offset; +uint32_t len; +tmem_cli_mfn_t cmfn;/* client machine page frame */ + }; + }; +}; +typedef struct tmem_op tmem_op_t ; +DEFINE_XEN_GUEST_HANDLE (tmem_op_t); +typedef XEN_GUEST_HANDLE (tmem_op_t)tmem_cli_op_t ; + +#endif #ifndef __ASSEMBLY__
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
Quoted 2 lines
Quoted 1 line
Quoted 1 line
Dan Magenheimer <[email protected]> 06.02.09 01:40 >>>
[1] Public interface for tmem
Couldn't the whole second hunk rather go in a separate header?
Jan
Thanks for the feedback!
Quoted 1 line
Couldn't the whole second hunk rather go in a separate header?
Are you referring to the constants and the data structure? All of these are used by both xen and a guest and must be identical, thus the placement in public/xen.h. Are there other header files which are guaranteed to be shared between xen and a (linux) guest?
Thanks,
Dan
Quoted 16 lines
-----Original Message-----
From: Jan Beulich [mailto:[email protected]]
Sent: Friday, February 06, 2009 1:47 AM
To: Dan Magenheimer
Cc: [email protected]
Subject: Re: [Xen-devel] [PATCH 1/9] tmem: Public interface for tmemQuoted 2 lines
Quoted 1 line
Quoted 1 line
Dan Magenheimer <[email protected]> 06.02.09 01:40 >>>
[1] Public interface for tmem
Couldn't the whole second hunk rather go in a separate header?
Jan
Quoted 8 lines
Quoted 2 lines
Quoted 1 line
Dan Magenheimer <[email protected]> 06.02.09 15:08 >>>
Couldn't the whole second hunk rather go in a separate header?
Are you referring to the constants and the data structure? All of these are used by both xen and a guest and must be identical, thus the placement in
public/xen.h. Are there other header files which are guaranteed to be shared between xen and a (linux) guest?
All headers in xen/include/public/. You could create a new one, or (less ideal) put it in xen/include/public/memory.h.
Jan