direct-io.hg

annotate tools/libxc/xenctrl.h @ 7702:b3c2bc39d815

Enable save/restore for PAE domains.

This includes quite a few cleanups / refactoring of the old code, some
of which is intended to prepare for 64-bit save/restore.

Signed-off-by: Steven Hand <steven@xensource.com>
author smh22@firebug.cl.cam.ac.uk
date Tue Nov 08 18:42:07 2005 +0100 (2005-11-08)
parents 15dc55145e55
children 5aad7e145e50
rev   line source
mjw@1623 1 /******************************************************************************
cl349@6388 2 * xenctrl.h
mjw@1623 3 *
mjw@1623 4 * A library for low-level access to the Xen control interfaces.
mjw@1623 5 *
kaf24@2787 6 * Copyright (c) 2003-2004, K A Fraser.
mjw@1623 7 */
mjw@1623 8
cl349@6389 9 #ifndef XENCTRL_H
cl349@6389 10 #define XENCTRL_H
mjw@1623 11
kaf24@3266 12 #include <stdint.h>
kaf24@4719 13 #include <sys/ptrace.h>
kaf24@2821 14 #include <xen/xen.h>
kaf24@2821 15 #include <xen/dom0_ops.h>
vh249@6549 16 #include <xen/version.h>
kaf24@2821 17 #include <xen/event_channel.h>
kaf24@7196 18 #include <xen/sched.h>
kaf24@2821 19 #include <xen/sched_ctl.h>
smh22@7702 20 #include <xen/memory.h>
kaf24@5541 21 #include <xen/acm.h>
kaf24@2787 22
kaf24@5914 23 #ifdef __ia64__
kaf24@5914 24 #define XC_PAGE_SHIFT 14
kaf24@5914 25 #else
kaf24@5914 26 #define XC_PAGE_SHIFT 12
kaf24@5914 27 #endif
kaf24@5914 28 #define XC_PAGE_SIZE (1UL << XC_PAGE_SHIFT)
kaf24@5914 29 #define XC_PAGE_MASK (~(XC_PAGE_SIZE-1))
kaf24@5914 30
kaf24@3961 31 /*
kaf24@3961 32 * DEFINITIONS FOR CPU BARRIERS
kaf24@3961 33 */
kaf24@3961 34
kaf24@3961 35 #if defined(__i386__)
kaf24@3966 36 #define mb() __asm__ __volatile__ ( "lock; addl $0,0(%%esp)" : : : "memory" )
kaf24@3966 37 #define rmb() __asm__ __volatile__ ( "lock; addl $0,0(%%esp)" : : : "memory" )
kaf24@3966 38 #define wmb() __asm__ __volatile__ ( "" : : : "memory")
kaf24@3961 39 #elif defined(__x86_64__)
kaf24@3966 40 #define mb() __asm__ __volatile__ ( "mfence" : : : "memory")
kaf24@3966 41 #define rmb() __asm__ __volatile__ ( "lfence" : : : "memory")
kaf24@3966 42 #define wmb() __asm__ __volatile__ ( "" : : : "memory")
kaf24@5914 43 #elif defined(__ia64__)
kaf24@5914 44 /* FIXME */
kaf24@5914 45 #define mb()
kaf24@5914 46 #define rmb()
kaf24@5914 47 #define wmb()
kaf24@3961 48 #else
kaf24@3961 49 #error "Define barriers"
kaf24@3961 50 #endif
kaf24@3961 51
kaf24@3961 52 /*
iap10@3443 53 * INITIALIZATION FUNCTIONS
kaf24@3961 54 */
iap10@3443 55
iap10@3443 56 /**
iap10@3443 57 * This function opens a handle to the hypervisor interface. This function can
iap10@3443 58 * be called multiple times within a single process. Multiple processes can
iap10@3443 59 * have an open hypervisor interface at the same time.
iap10@3443 60 *
iap10@3443 61 * Each call to this function should have a corresponding call to
iap10@3443 62 * xc_interface_close().
iap10@3443 63 *
iap10@3443 64 * This function can fail if the caller does not have superuser permission or
iap10@3443 65 * if a Xen-enabled kernel is not currently running.
iap10@3443 66 *
iap10@3443 67 * @return a handle to the hypervisor interface or -1 on failure
iap10@3443 68 */
mjw@1623 69 int xc_interface_open(void);
iap10@3443 70
iap10@3443 71 /**
iap10@3443 72 * This function closes an open hypervisor interface.
iap10@3443 73 *
iap10@3443 74 * This function can fail if the handle does not represent an open interface or
iap10@3443 75 * if there were problems closing the interface.
iap10@3443 76 *
iap10@3443 77 * @parm xc_handle a handle to an open hypervisor interface
iap10@3443 78 * @return 0 on success, -1 otherwise.
iap10@3443 79 */
mjw@1623 80 int xc_interface_close(int xc_handle);
mjw@1623 81
kaf24@3961 82 /*
kaf24@4719 83 * DOMAIN DEBUGGING FUNCTIONS
kaf24@4719 84 */
kaf24@4719 85
kaf24@4719 86 typedef struct xc_core_header {
kaf24@4719 87 unsigned int xch_magic;
kaf24@4719 88 unsigned int xch_nr_vcpus;
kaf24@4719 89 unsigned int xch_nr_pages;
kaf24@4719 90 unsigned int xch_ctxt_offset;
kaf24@4719 91 unsigned int xch_index_offset;
kaf24@4719 92 unsigned int xch_pages_offset;
kaf24@4719 93 } xc_core_header_t;
kaf24@4719 94
kaf24@4719 95
kaf24@6941 96 long xc_ptrace(
kaf24@6941 97 int xc_handle,
kaf24@6941 98 enum __ptrace_request request,
kaf24@7339 99 uint32_t domid,
kaf24@6941 100 long addr,
kaf24@6941 101 long data);
kaf24@4719 102
kaf24@6941 103 long xc_ptrace_core(
kaf24@6941 104 int xc_handle,
kaf24@6941 105 enum __ptrace_request request,
kaf24@7339 106 uint32_t domid,
kaf24@6941 107 long addr,
kaf24@6941 108 long data);
kaf24@4719 109
kaf24@6941 110 int xc_waitdomain(
kaf24@6941 111 int xc_handle,
kaf24@6941 112 int domain,
kaf24@6941 113 int *status,
kaf24@6941 114 int options);
kaf24@4719 115
kaf24@6941 116 int xc_waitdomain_core(
kaf24@6941 117 int xc_handle,
kaf24@6941 118 int domain,
kaf24@6941 119 int *status,
kaf24@6941 120 int options);
kaf24@4719 121
kaf24@4719 122 /*
iap10@3443 123 * DOMAIN MANAGEMENT FUNCTIONS
kaf24@3961 124 */
iap10@3443 125
mjw@1623 126 typedef struct {
kaf24@7378 127 uint32_t domid;
kaf24@7378 128 uint32_t ssidref;
mjw@1623 129 unsigned int dying:1, crashed:1, shutdown:1,
mjw@1623 130 paused:1, blocked:1, running:1;
mjw@1623 131 unsigned int shutdown_reason; /* only meaningful if shutdown==1 */
mjw@1623 132 unsigned long nr_pages;
mjw@1623 133 unsigned long shared_info_frame;
kaf24@7378 134 uint64_t cpu_time;
mjw@1623 135 unsigned long max_memkb;
kaf24@7397 136 unsigned int nr_online_vcpus;
kaf24@7397 137 unsigned int max_vcpu_id;
kaf24@7378 138 xen_domain_handle_t handle;
mjw@1623 139 } xc_dominfo_t;
mjw@1623 140
kaf24@2787 141 typedef dom0_getdomaininfo_t xc_domaininfo_t;
mjw@1623 142 int xc_domain_create(int xc_handle,
kaf24@7339 143 uint32_t ssidref,
kaf24@7378 144 xen_domain_handle_t handle,
kaf24@7339 145 uint32_t *pdomid);
iap10@3443 146
kaf24@4719 147
kaf24@4719 148 int xc_domain_dumpcore(int xc_handle,
kaf24@7339 149 uint32_t domid,
cl349@4853 150 const char *corename);
kaf24@4719 151
kaf24@7354 152 /*
kaf24@7566 153 * This function sets the maximum number of vcpus that a domain may create.
kaf24@7354 154 *
kaf24@7354 155 * @parm xc_handle a handle to an open hypervisor interface.
kaf24@7354 156 * @parm domid the domain id in which vcpus are to be created.
kaf24@7354 157 * @parm max the maximum number of vcpus that the domain may create.
kaf24@7354 158 * @return 0 on success, -1 on failure.
kaf24@7354 159 */
kaf24@7354 160 int xc_domain_max_vcpus(int xc_handle,
kaf24@7354 161 uint32_t domid,
kaf24@7354 162 unsigned int max);
kaf24@4719 163
iap10@3443 164 /**
iap10@3443 165 * This function pauses a domain. A paused domain still exists in memory
iap10@3443 166 * however it does not receive any timeslices from the hypervisor.
iap10@3443 167 *
iap10@3443 168 * @parm xc_handle a handle to an open hypervisor interface
iap10@3443 169 * @parm domid the domain id to pause
iap10@3443 170 * @return 0 on success, -1 on failure.
iap10@3443 171 */
mjw@1623 172 int xc_domain_pause(int xc_handle,
kaf24@7339 173 uint32_t domid);
iap10@3443 174 /**
iap10@3443 175 * This function unpauses a domain. The domain should have been previously
iap10@3443 176 * paused.
iap10@3443 177 *
iap10@3443 178 * @parm xc_handle a handle to an open hypervisor interface
iap10@3443 179 * @parm domid the domain id to unpause
iap10@3443 180 * return 0 on success, -1 on failure
iap10@3443 181 */
mjw@1623 182 int xc_domain_unpause(int xc_handle,
kaf24@7339 183 uint32_t domid);
iap10@3443 184
iap10@3443 185 /**
iap10@3443 186 * This function will destroy a domain. Destroying a domain removes the domain
iap10@3443 187 * completely from memory. This function should be called after sending the
iap10@3443 188 * domain a SHUTDOWN control message to free up the domain resources.
iap10@3443 189 *
iap10@3443 190 * @parm xc_handle a handle to an open hypervisor interface
iap10@3443 191 * @parm domid the domain id to destroy
iap10@3443 192 * @return 0 on success, -1 on failure
iap10@3443 193 */
mjw@1623 194 int xc_domain_destroy(int xc_handle,
kaf24@7339 195 uint32_t domid);
mjw@1623 196 int xc_domain_pincpu(int xc_handle,
kaf24@7339 197 uint32_t domid,
cl349@4845 198 int vcpu,
kaf24@7378 199 cpumap_t cpumap);
kaf24@7378 200
iap10@3443 201 /**
dsteklof@5498 202 * This function will return information about one or more domains. It is
dsteklof@5498 203 * designed to iterate over the list of domains. If a single domain is
dsteklof@5498 204 * requested, this function will return the next domain in the list - if
dsteklof@5498 205 * one exists. It is, therefore, important in this case to make sure the
dsteklof@5498 206 * domain requested was the one returned.
iap10@3443 207 *
iap10@3443 208 * @parm xc_handle a handle to an open hypervisor interface
iap10@3443 209 * @parm first_domid the first domain to enumerate information from. Domains
iap10@3443 210 * are currently enumerate in order of creation.
iap10@3443 211 * @parm max_doms the number of elements in info
iap10@3443 212 * @parm info an array of max_doms size that will contain the information for
iap10@3443 213 * the enumerated domains.
iap10@3443 214 * @return the number of domains enumerated or -1 on error
iap10@3443 215 */
mjw@1623 216 int xc_domain_getinfo(int xc_handle,
kaf24@7339 217 uint32_t first_domid,
mjw@1623 218 unsigned int max_doms,
mjw@1623 219 xc_dominfo_t *info);
iap10@3443 220
iap10@3443 221 /**
kaf24@5699 222 * This function will return information about one or more domains, using a
kaf24@5699 223 * single hypercall. The domain information will be stored into the supplied
kaf24@5699 224 * array of xc_domaininfo_t structures.
kaf24@5699 225 *
kaf24@5699 226 * @parm xc_handle a handle to an open hypervisor interface
kaf24@5699 227 * @parm first_domain the first domain to enumerate information from.
kaf24@5699 228 * Domains are currently enumerate in order of creation.
kaf24@5699 229 * @parm max_domains the number of elements in info
kaf24@5699 230 * @parm info an array of max_doms size that will contain the information for
kaf24@5699 231 * the enumerated domains.
kaf24@5699 232 * @return the number of domains enumerated or -1 on error
kaf24@5699 233 */
kaf24@5699 234 int xc_domain_getinfolist(int xc_handle,
kaf24@7339 235 uint32_t first_domain,
kaf24@5699 236 unsigned int max_domains,
kaf24@5699 237 xc_domaininfo_t *info);
kaf24@5699 238
kaf24@5699 239 /**
emellor@7404 240 * This function returns information about the execution context of a
emellor@7404 241 * particular vcpu of a domain.
iap10@3443 242 *
iap10@3443 243 * @parm xc_handle a handle to an open hypervisor interface
iap10@3443 244 * @parm domid the domain to get information from
emellor@7404 245 * @parm vcpu the vcpu number
iap10@3443 246 * @parm ctxt a pointer to a structure to store the execution context of the
iap10@3443 247 * domain
iap10@3443 248 * @return 0 on success, -1 on failure
iap10@3443 249 */
cl349@4849 250 int xc_domain_get_vcpu_context(int xc_handle,
kaf24@7339 251 uint32_t domid,
kaf24@7339 252 uint32_t vcpu,
cl349@4853 253 vcpu_guest_context_t *ctxt);
cl349@4849 254
kaf24@7397 255 typedef dom0_getvcpuinfo_t xc_vcpuinfo_t;
kaf24@7397 256 int xc_domain_get_vcpu_info(int xc_handle,
kaf24@7397 257 uint32_t domid,
kaf24@7397 258 uint32_t vcpu,
kaf24@7397 259 xc_vcpuinfo_t *info);
kaf24@7397 260
kaf24@7397 261
gm281@2236 262 int xc_domain_setcpuweight(int xc_handle,
kaf24@7339 263 uint32_t domid,
gm281@2236 264 float weight);
kaf24@2787 265 long long xc_domain_get_cpu_usage(int xc_handle,
mafetter@3435 266 domid_t domid,
mafetter@3435 267 int vcpu);
mjw@1623 268
kaf24@7379 269 int xc_domain_sethandle(int xc_handle, uint32_t domid,
kaf24@7379 270 xen_domain_handle_t handle);
kaf24@2787 271
kaf24@2787 272 typedef dom0_shadow_control_stats_t xc_shadow_control_stats_t;
mjw@1623 273 int xc_shadow_control(int xc_handle,
kaf24@7339 274 uint32_t domid,
mjw@1623 275 unsigned int sop,
mjw@1623 276 unsigned long *dirty_bitmap,
mjw@1623 277 unsigned long pages,
mjw@1623 278 xc_shadow_control_stats_t *stats);
mjw@1623 279
mjw@1623 280 int xc_bvtsched_global_set(int xc_handle,
mjw@1623 281 unsigned long ctx_allow);
mjw@1623 282
mjw@1623 283 int xc_bvtsched_domain_set(int xc_handle,
kaf24@7339 284 uint32_t domid,
kaf24@7339 285 uint32_t mcuadv,
gm281@2058 286 int warpback,
kaf24@7339 287 int32_t warpvalue,
gm281@2058 288 long long warpl,
gm281@2058 289 long long warpu);
mjw@1623 290
mjw@1623 291 int xc_bvtsched_global_get(int xc_handle,
mjw@1623 292 unsigned long *ctx_allow);
mjw@1623 293
mjw@1623 294 int xc_bvtsched_domain_get(int xc_handle,
kaf24@7339 295 uint32_t domid,
kaf24@7339 296 uint32_t *mcuadv,
gm281@2058 297 int *warpback,
kaf24@7339 298 int32_t *warpvalue,
gm281@2058 299 long long *warpl,
gm281@2058 300 long long *warpu);
mjw@1623 301
sd386@3449 302 int xc_sedf_domain_set(int xc_handle,
kaf24@7339 303 uint32_t domid,
kaf24@7339 304 uint64_t period, uint64_t slice,
kaf24@7339 305 uint64_t latency, uint16_t extratime,
kaf24@7339 306 uint16_t weight);
sd386@3449 307
sd386@3449 308 int xc_sedf_domain_get(int xc_handle,
kaf24@7339 309 uint32_t domid,
kaf24@7339 310 uint64_t* period, uint64_t *slice,
kaf24@7339 311 uint64_t *latency, uint16_t *extratime,
kaf24@7339 312 uint16_t *weight);
sd386@3449 313
kaf24@2787 314 typedef evtchn_status_t xc_evtchn_status_t;
iap10@3443 315
kaf24@3961 316 /*
iap10@3443 317 * EVENT CHANNEL FUNCTIONS
kaf24@3961 318 */
iap10@3443 319
iap10@3443 320 /**
iap10@3443 321 * This function allocates an unbound port. Ports are named endpoints used for
iap10@3443 322 * interdomain communication. This function is most useful in opening a
iap10@3443 323 * well-known port within a domain to receive events on.
iap10@3443 324 *
iap10@3443 325 * @parm xc_handle a handle to an open hypervisor interface
kaf24@7223 326 * @parm dom the ID of the local domain (the 'allocatee')
kaf24@7237 327 * @parm remote_dom the ID of the domain who will later bind
kaf24@7237 328 * @return allocated port (in @dom) on success, -1 on failure
iap10@3443 329 */
kaf24@2713 330 int xc_evtchn_alloc_unbound(int xc_handle,
kaf24@7339 331 uint32_t dom,
kaf24@7339 332 uint32_t remote_dom);
iap10@3443 333
mjw@1623 334 int xc_evtchn_status(int xc_handle,
kaf24@7339 335 uint32_t dom, /* may be DOMID_SELF */
mjw@1623 336 int port,
mjw@1623 337 xc_evtchn_status_t *status);
mjw@1623 338
mjw@1623 339 int xc_physdev_pci_access_modify(int xc_handle,
kaf24@7339 340 uint32_t domid,
mjw@1623 341 int bus,
mjw@1623 342 int dev,
mjw@1623 343 int func,
mjw@1623 344 int enable);
mjw@1623 345
mjw@1623 346 int xc_readconsolering(int xc_handle,
kaf24@5327 347 char **pbuffer,
kaf24@5327 348 unsigned int *pnr_chars,
mjw@1623 349 int clear);
mjw@1623 350
kaf24@2787 351 typedef dom0_physinfo_t xc_physinfo_t;
mjw@1623 352 int xc_physinfo(int xc_handle,
mjw@1623 353 xc_physinfo_t *info);
mjw@1623 354
gm281@2236 355 int xc_sched_id(int xc_handle,
gm281@2236 356 int *sched_id);
gm281@2236 357
mjw@1623 358 int xc_domain_setmaxmem(int xc_handle,
kaf24@7339 359 uint32_t domid,
kaf24@3231 360 unsigned int max_memkb);
mjw@1623 361
cl349@5045 362 int xc_domain_memory_increase_reservation(int xc_handle,
kaf24@7339 363 uint32_t domid,
iap10@6688 364 unsigned long nr_extents,
iap10@6682 365 unsigned int extent_order,
iap10@6688 366 unsigned int address_bits,
iap10@6688 367 unsigned long *extent_start);
iap10@6688 368
iap10@6688 369 int xc_domain_memory_decrease_reservation(int xc_handle,
kaf24@7339 370 uint32_t domid,
iap10@6688 371 unsigned long nr_extents,
iap10@6688 372 unsigned int extent_order,
iap10@6688 373 unsigned long *extent_start);
iap10@6688 374
kaf24@7624 375 int xc_domain_ioport_permission(int xc_handle,
kaf24@7624 376 uint32_t domid,
kaf24@7624 377 uint16_t first_port,
kaf24@7624 378 uint16_t nr_ports,
kaf24@7624 379 uint16_t allow_access);
kaf24@7624 380
kaf24@7339 381 unsigned long xc_make_page_below_4G(int xc_handle, uint32_t domid,
iap10@6688 382 unsigned long mfn);
cl349@5045 383
kaf24@3231 384 typedef dom0_perfc_desc_t xc_perfc_desc_t;
kaf24@3231 385 /* IMPORTANT: The caller is responsible for mlock()'ing the @desc array. */
kaf24@3231 386 int xc_perfc_control(int xc_handle,
kaf24@7339 387 uint32_t op,
kaf24@3231 388 xc_perfc_desc_t *desc);
mjw@1623 389
rneugeba@3963 390 /* read/write msr */
rneugeba@3963 391 long long xc_msr_read(int xc_handle, int cpu_mask, int msr);
rneugeba@3963 392 int xc_msr_write(int xc_handle, int cpu_mask, int msr, unsigned int low,
rneugeba@3963 393 unsigned int high);
rneugeba@3963 394
iap10@3443 395 /**
iap10@3443 396 * Memory maps a range within one domain to a local address range. Mappings
iap10@3443 397 * should be unmapped with munmap and should follow the same rules as mmap
rusty@4866 398 * regarding page alignment. Returns NULL on failure.
iap10@3443 399 *
iap10@3443 400 * In Linux, the ring queue for the control channel is accessible by mapping
iap10@3443 401 * the shared_info_frame (from xc_domain_getinfo()) + 2048. The structure
iap10@3443 402 * stored there is of type control_if_t.
iap10@3443 403 *
iap10@3443 404 * @parm xc_handle a handle on an open hypervisor interface
iap10@3443 405 * @parm dom the domain to map memory from
iap10@3443 406 * @parm size the amount of memory to map (in multiples of page size)
iap10@3443 407 * @parm prot same flag as in mmap().
iap10@3443 408 * @parm mfn the frame address to map.
iap10@3443 409 */
kaf24@7339 410 void *xc_map_foreign_range(int xc_handle, uint32_t dom,
iap10@2325 411 int size, int prot,
iap10@2325 412 unsigned long mfn );
iap10@2325 413
kaf24@7339 414 void *xc_map_foreign_batch(int xc_handle, uint32_t dom, int prot,
iap10@2325 415 unsigned long *arr, int num );
iap10@2325 416
kaf24@7339 417 int xc_get_pfn_list(int xc_handle, uint32_t domid, unsigned long *pfn_buf,
cl349@4853 418 unsigned long max_pfns);
iap10@3390 419
kaf24@7339 420 int xc_ia64_get_pfn_list(int xc_handle, uint32_t domid,
kaf24@7339 421 unsigned long *pfn_buf,
kaf24@7339 422 unsigned int start_page, unsigned int nr_pages);
kaf24@5914 423
djm@7536 424 int xc_copy_to_domain_page(int xc_handle, uint32_t domid,
djm@7536 425 unsigned long dst_pfn, void *src_page);
djm@7536 426
djm@7536 427 int xc_ia64_copy_to_domain_pages(int xc_handle, uint32_t domid,
djm@7536 428 void* src_page, unsigned long dst_pfn, int nr_pages);
djm@7536 429
kaf24@7339 430 long xc_get_max_pages(int xc_handle, uint32_t domid);
djm@6856 431
cl349@6389 432 int xc_mmuext_op(int xc_handle, struct mmuext_op *op, unsigned int nr_ops,
cl349@6389 433 domid_t dom);
cl349@6389 434
kaf24@6468 435 int xc_memory_op(int xc_handle, int cmd, void *arg);
cl349@6389 436
kaf24@7339 437 int xc_get_pfn_type_batch(int xc_handle, uint32_t dom,
kaf24@7339 438 int num, unsigned long *arr);
cl349@6389 439
cl349@6389 440
cwc22@3985 441 /*\
cwc22@3985 442 * GRANT TABLE FUNCTIONS
cwc22@3985 443 \*/
cwc22@3985 444
cwc22@3985 445 /**
cwc22@3985 446 * This function opens a handle to the more restricted grant table hypervisor
cwc22@3985 447 * interface. This may be used where the standard interface is not
cwc22@3985 448 * available because the domain is not privileged.
cwc22@3985 449 * This function can be called multiple times within a single process.
cwc22@3985 450 * Multiple processes can have an open hypervisor interface at the same time.
cwc22@3985 451 *
cwc22@3985 452 * Each call to this function should have a corresponding call to
cwc22@3985 453 * xc_grant_interface_close().
cwc22@3985 454 *
cwc22@3985 455 * This function can fail if a Xen-enabled kernel is not currently running.
cwc22@3985 456 *
cwc22@3985 457 * @return a handle to the hypervisor grant table interface or -1 on failure
cwc22@3985 458 */
cwc22@3985 459 int xc_grant_interface_open(void);
cwc22@3985 460
cwc22@3985 461 /**
cwc22@3985 462 * This function closes an open grant table hypervisor interface.
cwc22@3985 463 *
cwc22@3985 464 * This function can fail if the handle does not represent an open interface or
cwc22@3985 465 * if there were problems closing the interface.
cwc22@3985 466 *
cwc22@3985 467 * @parm xc_handle a handle to an open grant table hypervisor interface
cwc22@3985 468 * @return 0 on success, -1 otherwise.
cwc22@3985 469 */
cwc22@3985 470 int xc_grant_interface_close(int xc_handle);
cwc22@3985 471
kaf24@7339 472 int xc_gnttab_map_grant_ref(int xc_handle,
kaf24@7339 473 uint64_t host_virt_addr,
kaf24@7339 474 uint32_t dom,
kaf24@7339 475 uint16_t ref,
kaf24@7339 476 uint16_t flags,
kaf24@7339 477 int16_t *handle,
kaf24@7339 478 uint64_t *dev_bus_addr);
cwc22@3985 479
kaf24@6281 480 int xc_gnttab_unmap_grant_ref(int xc_handle,
kaf24@7339 481 uint64_t host_virt_addr,
kaf24@7339 482 uint64_t dev_bus_addr,
kaf24@7339 483 uint16_t handle,
kaf24@7339 484 int16_t *status);
cwc22@3985 485
cwc22@3985 486 int xc_gnttab_setup_table(int xc_handle,
kaf24@7339 487 uint32_t dom,
kaf24@7339 488 uint16_t nr_frames,
kaf24@7339 489 int16_t *status,
kaf24@6281 490 unsigned long **frame_list);
cwc22@3985 491
cwc22@3985 492 /* Grant debug builds only: */
cwc22@3985 493 int xc_gnttab_dump_table(int xc_handle,
kaf24@7339 494 uint32_t dom,
kaf24@7339 495 int16_t *status);
cwc22@3985 496
kaf24@5318 497 /* Get current total pages allocated to a domain. */
kaf24@7339 498 long xc_get_tot_pages(int xc_handle, uint32_t domid);
kaf24@5318 499
kaf24@7566 500
kaf24@7566 501 /*
kaf24@7566 502 * Trace Buffer Operations
kaf24@7566 503 */
kaf24@7566 504
kaf24@7566 505 /**
kaf24@7566 506 * This function enables or disables tracing. Trace buffer memory must
kaf24@7566 507 * be already allocated by setting the size to a non-zero value, otherwise
kaf24@7566 508 * tracing cannot be enabled.
kaf24@7566 509 *
kaf24@7566 510 * @parm xc_handle a handle to an open hypervisor interface
kaf24@7566 511 * @parm enable the desired action, 1 for enable, 0 for disable
kaf24@7566 512 * @return 0 on success, -1 on failure.
kaf24@7566 513 */
kaf24@7566 514 int xc_tbuf_enable(int xc_handle, int enable);
kaf24@7566 515
kaf24@7566 516 /**
kaf24@7571 517 * This function sets the size of the trace buffers. Setting the size
kaf24@7571 518 * is currently a one-shot operation that may be performed either at boot
kaf24@7571 519 * time or via this interface, not both. The buffer size must be set before
kaf24@7571 520 * enabling tracing.
kaf24@7566 521 *
kaf24@7566 522 * @parm xc_handle a handle to an open hypervisor interface
kaf24@7566 523 * @parm size the size in pages per cpu for the trace buffers
kaf24@7566 524 * @return 0 on success, -1 on failure.
kaf24@7566 525 */
kaf24@7566 526 int xc_tbuf_set_size(int xc_handle, uint32_t size);
kaf24@7566 527
kaf24@7566 528 /**
kaf24@7566 529 * This function retrieves the current size of the trace buffers.
kaf24@7566 530 * Note that the size returned is in terms of bytes, not pages.
kaf24@7566 531
kaf24@7566 532 * @parm xc_handle a handle to an open hypervisor interface
kaf24@7566 533 * @parm size will contain the size in bytes for the trace buffers
kaf24@7566 534 * @return 0 on success, -1 on failure.
kaf24@7566 535 */
kaf24@7566 536 int xc_tbuf_get_size(int xc_handle, uint32_t *size);
kaf24@7566 537
kaf24@7566 538
kaf24@5318 539 /* Execute a privileged dom0 operation. */
kaf24@5318 540 int xc_dom0_op(int xc_handle, dom0_op_t *op);
cwc22@3985 541
vh249@6549 542 int xc_version(int xc_handle, int cmd, void *arg);
vh249@6549 543
cl349@6389 544 /*
cl349@6389 545 * MMU updates.
cl349@6389 546 */
cl349@6389 547 #define MAX_MMU_UPDATES 1024
cl349@6389 548 struct xc_mmu {
cl349@6389 549 mmu_update_t updates[MAX_MMU_UPDATES];
cl349@6389 550 int idx;
cl349@6389 551 domid_t subject;
cl349@6389 552 };
cl349@6389 553 typedef struct xc_mmu xc_mmu_t;
cl349@6389 554 xc_mmu_t *xc_init_mmu_updates(int xc_handle, domid_t dom);
cl349@6389 555 int xc_add_mmu_update(int xc_handle, xc_mmu_t *mmu,
iap10@6680 556 unsigned long long ptr, unsigned long long val);
cl349@6389 557 int xc_finish_mmu_updates(int xc_handle, xc_mmu_t *mmu);
cl349@6389 558
cl349@6389 559 #endif