~ubuntu-branches/ubuntu/utopic/xen/utopic

« back to all changes in this revision

Viewing changes to tools/libxc/xenguest.h

  • Committer: Bazaar Package Importer
  • Author(s): Bastian Blank
  • Date: 2010-05-06 15:47:38 UTC
  • mto: (1.3.1) (15.1.1 sid) (4.1.1 experimental)
  • mto: This revision was merged to the branch mainline in revision 3.
  • Revision ID: james.westby@ubuntu.com-20100506154738-agoz0rlafrh1fnq7
Tags: upstream-4.0.0
ImportĀ upstreamĀ versionĀ 4.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/******************************************************************************
 
2
 * xenguest.h
 
3
 *
 
4
 * A library for guest domain management in Xen.
 
5
 *
 
6
 * Copyright (c) 2003-2004, K A Fraser.
 
7
 */
 
8
 
 
9
#ifndef XENGUEST_H
 
10
#define XENGUEST_H
 
11
 
 
12
#define XCFLAGS_LIVE      1
 
13
#define XCFLAGS_DEBUG     2
 
14
#define XCFLAGS_HVM       4
 
15
#define XCFLAGS_STDVGA    8
 
16
#define X86_64_B_SIZE   64 
 
17
#define X86_32_B_SIZE   32
 
18
 
 
19
/* callbacks provided by xc_domain_save */
 
20
struct save_callbacks {
 
21
    int (*suspend)(void* data);
 
22
    /* callback to rendezvous with external checkpoint functions */
 
23
    int (*postcopy)(void* data);
 
24
    /* returns:
 
25
     * 0: terminate checkpointing gracefully
 
26
     * 1: take another checkpoint */
 
27
    int (*checkpoint)(void* data);
 
28
 
 
29
    /* to be provided as the first argument to each callback function */
 
30
    void* data;
 
31
};
 
32
 
 
33
/**
 
34
 * This function will save a running domain.
 
35
 *
 
36
 * @parm xc_handle a handle to an open hypervisor interface
 
37
 * @parm fd the file descriptor to save a domain to
 
38
 * @parm dom the id of the domain
 
39
 * @return 0 on success, -1 on failure
 
40
 */
 
41
int xc_domain_save(int xc_handle, int io_fd, uint32_t dom, uint32_t max_iters,
 
42
                   uint32_t max_factor, uint32_t flags /* XCFLAGS_xxx */,
 
43
                   struct save_callbacks* callbacks,
 
44
                   int hvm, void (*switch_qemu_logdirty)(int, unsigned)); /* HVM only */
 
45
 
 
46
 
 
47
/**
 
48
 * This function will restore a saved domain.
 
49
 *
 
50
 * @parm xc_handle a handle to an open hypervisor interface
 
51
 * @parm fd the file descriptor to restore a domain from
 
52
 * @parm dom the id of the domain
 
53
 * @parm store_evtchn the store event channel for this domain to use
 
54
 * @parm store_mfn returned with the mfn of the store page
 
55
 * @parm hvm non-zero if this is a HVM restore
 
56
 * @parm pae non-zero if this HVM domain has PAE support enabled
 
57
 * @parm superpages non-zero to allocate guest memory with superpages
 
58
 * @return 0 on success, -1 on failure
 
59
 */
 
60
int xc_domain_restore(int xc_handle, int io_fd, uint32_t dom,
 
61
                      unsigned int store_evtchn, unsigned long *store_mfn,
 
62
                      unsigned int console_evtchn, unsigned long *console_mfn,
 
63
                      unsigned int hvm, unsigned int pae, int superpages);
 
64
 
 
65
/**
 
66
 * This function will create a domain for a paravirtualized Linux
 
67
 * using file names pointing to kernel and ramdisk
 
68
 *
 
69
 * @parm xc_handle a handle to an open hypervisor interface
 
70
 * @parm domid the id of the domain
 
71
 * @parm mem_mb memory size in megabytes
 
72
 * @parm image_name name of the kernel image file
 
73
 * @parm ramdisk_name name of the ramdisk image file
 
74
 * @parm cmdline command line string
 
75
 * @parm flags domain creation flags
 
76
 * @parm store_evtchn the store event channel for this domain to use
 
77
 * @parm store_mfn returned with the mfn of the store page
 
78
 * @parm console_evtchn the console event channel for this domain to use
 
79
 * @parm conole_mfn returned with the mfn of the console page
 
80
 * @return 0 on success, -1 on failure
 
81
 */
 
82
int xc_linux_build(int xc_handle,
 
83
                   uint32_t domid,
 
84
                   unsigned int mem_mb,
 
85
                   const char *image_name,
 
86
                   const char *ramdisk_name,
 
87
                   const char *cmdline,
 
88
                   const char *features,
 
89
                   unsigned long flags,
 
90
                   unsigned int store_evtchn,
 
91
                   unsigned long *store_mfn,
 
92
                   unsigned int console_evtchn,
 
93
                   unsigned long *console_mfn);
 
94
 
 
95
/** The same interface, but the dom structure is managed by the caller */
 
96
struct xc_dom_image;
 
97
int xc_dom_linux_build(int xc_handle,
 
98
                       struct xc_dom_image *dom,
 
99
                       uint32_t domid,
 
100
                       unsigned int mem_mb,
 
101
                       const char *image_name,
 
102
                       const char *ramdisk_name,
 
103
                       unsigned long flags,
 
104
                       unsigned int store_evtchn,
 
105
                       unsigned long *store_mfn,
 
106
                       unsigned int console_evtchn,
 
107
                       unsigned long *console_mfn);
 
108
 
 
109
/**
 
110
 * This function will create a domain for a paravirtualized Linux
 
111
 * using buffers for kernel and initrd
 
112
 *
 
113
 * @parm xc_handle a handle to an open hypervisor interface
 
114
 * @parm domid the id of the domain
 
115
 * @parm mem_mb memory size in megabytes
 
116
 * @parm image_buffer buffer containing kernel image
 
117
 * @parm image_size size of the kernel image buffer
 
118
 * @parm initrd_buffer name of the ramdisk image file
 
119
 * @parm initrd_size size of the ramdisk buffer
 
120
 * @parm cmdline command line string
 
121
 * @parm flags domain creation flags
 
122
 * @parm store_evtchn the store event channel for this domain to use
 
123
 * @parm store_mfn returned with the mfn of the store page
 
124
 * @parm console_evtchn the console event channel for this domain to use
 
125
 * @parm conole_mfn returned with the mfn of the console page
 
126
 * @return 0 on success, -1 on failure
 
127
 */
 
128
int xc_linux_build_mem(int xc_handle,
 
129
                       uint32_t domid,
 
130
                       unsigned int mem_mb,
 
131
                       const char *image_buffer,
 
132
                       unsigned long image_size,
 
133
                       const char *initrd_buffer,
 
134
                       unsigned long initrd_size,
 
135
                       const char *cmdline,
 
136
                       const char *features,
 
137
                       unsigned long flags,
 
138
                       unsigned int store_evtchn,
 
139
                       unsigned long *store_mfn,
 
140
                       unsigned int console_evtchn,
 
141
                       unsigned long *console_mfn);
 
142
 
 
143
int xc_hvm_build(int xc_handle,
 
144
                 uint32_t domid,
 
145
                 int memsize,
 
146
                 const char *image_name);
 
147
 
 
148
int xc_hvm_build_target_mem(int xc_handle,
 
149
                            uint32_t domid,
 
150
                            int memsize,
 
151
                            int target,
 
152
                            const char *image_name);
 
153
 
 
154
int xc_hvm_build_mem(int xc_handle,
 
155
                     uint32_t domid,
 
156
                     int memsize,
 
157
                     const char *image_buffer,
 
158
                     unsigned long image_size);
 
159
 
 
160
int xc_suspend_evtchn_release(int xce, int suspend_evtchn);
 
161
 
 
162
int xc_suspend_evtchn_init(int xc, int xce, int domid, int port);
 
163
 
 
164
int xc_await_suspend(int xce, int suspend_evtchn);
 
165
 
 
166
int xc_get_bit_size(const char *image_name, const char *cmdline,
 
167
                      const char *features, int *type);
 
168
 
 
169
int xc_mark_page_online(int xc, unsigned long start,
 
170
                        unsigned long end, uint32_t *status);
 
171
 
 
172
int xc_mark_page_offline(int xc, unsigned long start,
 
173
                          unsigned long end, uint32_t *status);
 
174
 
 
175
int xc_query_page_offline_status(int xc, unsigned long start,
 
176
                                 unsigned long end, uint32_t *status);
 
177
 
 
178
int xc_exchange_page(int xc_handle, int domid, xen_pfn_t mfn);
 
179
 
 
180
 
 
181
/**
 
182
 * This function map m2p table
 
183
 * @parm xc_handle a handle to an open hypervisor interface
 
184
 * @parm max_mfn the max pfn
 
185
 * @parm prot the flags to map, such as read/write etc
 
186
 * @parm mfn0 return the first mfn, can be NULL
 
187
 * @return mapped m2p table on success, NULL on failure
 
188
 */
 
189
xen_pfn_t *xc_map_m2p(int xc_handle,
 
190
                      unsigned long max_mfn,
 
191
                      int prot,
 
192
                      unsigned long *mfn0);
 
193
#endif /* XENGUEST_H */