ia64/xen-unstable

view tools/libxc/xenguest.h @ 13896:d39e8c44da34

[HVM] Save/restore: disentangle max_pfn from nr_pages.
These have been used interchangeably, which is OK for PV domains but
not for HVM. This fixes an over-allocation by 256MB when restoring
HVM guests that have more than 4GB of RAM.
Signed-off-by: Tim Deegan <Tim.Deegan@xensource.com>
author Tim Deegan <Tim.Deegan@xensource.com>
date Fri Feb 09 10:48:41 2007 +0000 (2007-02-09)
parents 16ba1d434f89
children 9af0c7e4ff51
line source
1 /******************************************************************************
2 * xenguest.h
3 *
4 * A library for guest domain management in Xen.
5 *
6 * Copyright (c) 2003-2004, K A Fraser.
7 */
9 #ifndef XENGUEST_H
10 #define XENGUEST_H
12 #define XCFLAGS_LIVE 1
13 #define XCFLAGS_DEBUG 2
14 #define XCFLAGS_HVM 4
17 /**
18 * This function will save a domain running Linux.
19 *
20 * @parm xc_handle a handle to an open hypervisor interface
21 * @parm fd the file descriptor to save a domain to
22 * @parm dom the id of the domain
23 * @return 0 on success, -1 on failure
24 */
25 int xc_linux_save(int xc_handle, int io_fd, uint32_t dom, uint32_t max_iters,
26 uint32_t max_factor, uint32_t flags /* XCFLAGS_xxx */,
27 int (*suspend)(int domid));
29 /**
30 * This function will save a hvm domain running unmodified guest.
31 * @return 0 on success, -1 on failure
32 */
33 int xc_hvm_save(int xc_handle, int io_fd, uint32_t dom, uint32_t max_iters,
34 uint32_t max_factor, uint32_t flags /* XCFLAGS_xxx */,
35 int (*suspend)(int domid));
37 /**
38 * This function will restore a saved domain running Linux.
39 *
40 * @parm xc_handle a handle to an open hypervisor interface
41 * @parm fd the file descriptor to restore a domain from
42 * @parm dom the id of the domain
43 * @parm nr_pfns the number of pages
44 * @parm store_evtchn the store event channel for this domain to use
45 * @parm store_mfn returned with the mfn of the store page
46 * @return 0 on success, -1 on failure
47 */
48 int xc_linux_restore(int xc_handle, int io_fd, uint32_t dom,
49 unsigned long nr_pfns, unsigned int store_evtchn,
50 unsigned long *store_mfn, unsigned int console_evtchn,
51 unsigned long *console_mfn);
53 /**
54 * This function will restore a saved hvm domain running unmodified guest.
55 *
56 * @parm store_mfn pass mem size & returned with the mfn of the store page
57 * @return 0 on success, -1 on failure
58 */
59 int xc_hvm_restore(int xc_handle, int io_fd, uint32_t dom,
60 unsigned long max_pfn, unsigned int store_evtchn,
61 unsigned long *store_mfn,
62 unsigned int pae, unsigned int apic);
64 /**
65 * This function will create a domain for a paravirtualized Linux
66 * using file names pointing to kernel and ramdisk
67 *
68 * @parm xc_handle a handle to an open hypervisor interface
69 * @parm domid the id of the domain
70 * @parm mem_mb memory size in megabytes
71 * @parm image_name name of the kernel image file
72 * @parm ramdisk_name name of the ramdisk image file
73 * @parm cmdline command line string
74 * @parm flags domain creation flags
75 * @parm store_evtchn the store event channel for this domain to use
76 * @parm store_mfn returned with the mfn of the store page
77 * @parm console_evtchn the console event channel for this domain to use
78 * @parm conole_mfn returned with the mfn of the console page
79 * @return 0 on success, -1 on failure
80 */
81 int xc_linux_build(int xc_handle,
82 uint32_t domid,
83 unsigned int mem_mb,
84 const char *image_name,
85 const char *ramdisk_name,
86 const char *cmdline,
87 const char *features,
88 unsigned long flags,
89 unsigned int store_evtchn,
90 unsigned long *store_mfn,
91 unsigned int console_evtchn,
92 unsigned long *console_mfn);
94 /**
95 * This function will create a domain for a paravirtualized Linux
96 * using buffers for kernel and initrd
97 *
98 * @parm xc_handle a handle to an open hypervisor interface
99 * @parm domid the id of the domain
100 * @parm mem_mb memory size in megabytes
101 * @parm image_buffer buffer containing kernel image
102 * @parm image_size size of the kernel image buffer
103 * @parm initrd_buffer name of the ramdisk image file
104 * @parm initrd_size size of the ramdisk buffer
105 * @parm cmdline command line string
106 * @parm flags domain creation flags
107 * @parm store_evtchn the store event channel for this domain to use
108 * @parm store_mfn returned with the mfn of the store page
109 * @parm console_evtchn the console event channel for this domain to use
110 * @parm conole_mfn returned with the mfn of the console page
111 * @return 0 on success, -1 on failure
112 */
113 int xc_linux_build_mem(int xc_handle,
114 uint32_t domid,
115 unsigned int mem_mb,
116 const char *image_buffer,
117 unsigned long image_size,
118 const char *initrd_buffer,
119 unsigned long initrd_size,
120 const char *cmdline,
121 const char *features,
122 unsigned long flags,
123 unsigned int store_evtchn,
124 unsigned long *store_mfn,
125 unsigned int console_evtchn,
126 unsigned long *console_mfn);
128 int xc_hvm_build(int xc_handle,
129 uint32_t domid,
130 int memsize,
131 const char *image_name);
133 int xc_hvm_build_mem(int xc_handle,
134 uint32_t domid,
135 int memsize,
136 const char *image_buffer,
137 unsigned long image_size);
139 int xc_set_hvm_param(
140 int handle, domid_t dom, int param, unsigned long value);
141 int xc_get_hvm_param(
142 int handle, domid_t dom, int param, unsigned long *value);
144 /* PowerPC specific. */
145 int xc_prose_build(int xc_handle,
146 uint32_t domid,
147 unsigned int mem_mb,
148 const char *image_name,
149 const char *ramdisk_name,
150 const char *cmdline,
151 const char *features,
152 unsigned long flags,
153 unsigned int store_evtchn,
154 unsigned long *store_mfn,
155 unsigned int console_evtchn,
156 unsigned long *console_mfn,
157 void *arch_args);
159 #endif /* XENGUEST_H */