direct-io.hg

annotate tools/libxc/xc.h @ 5699:eef23f57f20e

The attached patch adds a new dom0_op, DOM0_GETDOMAININFOLIST. This
operation allows retrieval of the domain info structures for all domains
in one hypercall.

Using a small test program, on a system with 97 domains with
non-contiguous domain IDs, I found that with this hypercall I could
retrieve the full array of info structures 12840 times per second, an
improvement from 2380 times per second with the DOM0_GETDOMAININFO op.

The patch also adds a libxc wrapper for this new hypercall.

Signed-off-by: Josh Triplett <josht@us.ibm.com>
author kaf24@firebug.cl.cam.ac.uk
date Fri Jul 08 09:06:04 2005 +0000 (2005-07-08)
parents b38b3893fa76
children 579d1e771025
rev   line source
mjw@1623 1 /******************************************************************************
mjw@1623 2 * xc.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
mjw@1623 9 #ifndef __XC_H__
mjw@1623 10 #define __XC_H__
mjw@1623 11
kaf24@3266 12 #include <stdint.h>
iap10@3390 13
kaf24@3266 14 typedef uint8_t u8;
kaf24@3266 15 typedef uint16_t u16;
kaf24@3266 16 typedef uint32_t u32;
kaf24@3266 17 typedef uint64_t u64;
kaf24@3266 18 typedef int8_t s8;
kaf24@3266 19 typedef int16_t s16;
kaf24@3266 20 typedef int32_t s32;
kaf24@3266 21 typedef int64_t s64;
mjw@1623 22
kaf24@4719 23 #include <sys/ptrace.h>
kaf24@2821 24 #include <xen/xen.h>
kaf24@2821 25 #include <xen/dom0_ops.h>
kaf24@2821 26 #include <xen/event_channel.h>
kaf24@2821 27 #include <xen/sched_ctl.h>
kaf24@5541 28 #include <xen/acm.h>
kaf24@2787 29
kaf24@3961 30 /*
kaf24@3961 31 * DEFINITIONS FOR CPU BARRIERS
kaf24@3961 32 */
kaf24@3961 33
kaf24@3961 34 #if defined(__i386__)
kaf24@3966 35 #define mb() __asm__ __volatile__ ( "lock; addl $0,0(%%esp)" : : : "memory" )
kaf24@3966 36 #define rmb() __asm__ __volatile__ ( "lock; addl $0,0(%%esp)" : : : "memory" )
kaf24@3966 37 #define wmb() __asm__ __volatile__ ( "" : : : "memory")
kaf24@3961 38 #elif defined(__x86_64__)
kaf24@3966 39 #define mb() __asm__ __volatile__ ( "mfence" : : : "memory")
kaf24@3966 40 #define rmb() __asm__ __volatile__ ( "lfence" : : : "memory")
kaf24@3966 41 #define wmb() __asm__ __volatile__ ( "" : : : "memory")
kaf24@3961 42 #else
kaf24@3961 43 #error "Define barriers"
kaf24@3961 44 #endif
kaf24@3961 45
kaf24@3961 46 /*
iap10@3443 47 * INITIALIZATION FUNCTIONS
kaf24@3961 48 */
iap10@3443 49
iap10@3443 50 /**
iap10@3443 51 * This function opens a handle to the hypervisor interface. This function can
iap10@3443 52 * be called multiple times within a single process. Multiple processes can
iap10@3443 53 * have an open hypervisor interface at the same time.
iap10@3443 54 *
iap10@3443 55 * Each call to this function should have a corresponding call to
iap10@3443 56 * xc_interface_close().
iap10@3443 57 *
iap10@3443 58 * This function can fail if the caller does not have superuser permission or
iap10@3443 59 * if a Xen-enabled kernel is not currently running.
iap10@3443 60 *
iap10@3443 61 * @return a handle to the hypervisor interface or -1 on failure
iap10@3443 62 */
mjw@1623 63 int xc_interface_open(void);
iap10@3443 64
iap10@3443 65 /**
iap10@3443 66 * This function closes an open hypervisor interface.
iap10@3443 67 *
iap10@3443 68 * This function can fail if the handle does not represent an open interface or
iap10@3443 69 * if there were problems closing the interface.
iap10@3443 70 *
iap10@3443 71 * @parm xc_handle a handle to an open hypervisor interface
iap10@3443 72 * @return 0 on success, -1 otherwise.
iap10@3443 73 */
mjw@1623 74 int xc_interface_close(int xc_handle);
mjw@1623 75
kaf24@3961 76 /*
kaf24@4719 77 * DOMAIN DEBUGGING FUNCTIONS
kaf24@4719 78 */
kaf24@4719 79
kaf24@4719 80 typedef struct xc_core_header {
kaf24@4719 81 unsigned int xch_magic;
kaf24@4719 82 unsigned int xch_nr_vcpus;
kaf24@4719 83 unsigned int xch_nr_pages;
kaf24@4719 84 unsigned int xch_ctxt_offset;
kaf24@4719 85 unsigned int xch_index_offset;
kaf24@4719 86 unsigned int xch_pages_offset;
kaf24@4719 87 } xc_core_header_t;
kaf24@4719 88
kaf24@4719 89
kaf24@4719 90 long xc_ptrace(enum __ptrace_request request,
cl349@4853 91 u32 domid,
cl349@4853 92 long addr,
cl349@4853 93 long data);
kaf24@4719 94
kaf24@4719 95 long xc_ptrace_core(enum __ptrace_request request,
cl349@4853 96 u32 domid,
cl349@4853 97 long addr,
cl349@4853 98 long data);
kaf24@4719 99
kaf24@4719 100 int xc_waitdomain(int domain,
cl349@4853 101 int *status,
cl349@4853 102 int options);
kaf24@4719 103
kaf24@4719 104 int xc_waitdomain_core(int domain,
cl349@4853 105 int *status,
cl349@4853 106 int options);
kaf24@4719 107
kaf24@4719 108 /*
iap10@3443 109 * DOMAIN MANAGEMENT FUNCTIONS
kaf24@3961 110 */
iap10@3443 111
mjw@1623 112 typedef struct {
mjw@1623 113 u32 domid;
smh22@5514 114 u32 ssidref;
mjw@1623 115 unsigned int dying:1, crashed:1, shutdown:1,
mjw@1623 116 paused:1, blocked:1, running:1;
mjw@1623 117 unsigned int shutdown_reason; /* only meaningful if shutdown==1 */
mjw@1623 118 unsigned long nr_pages;
mjw@1623 119 unsigned long shared_info_frame;
mjw@1623 120 u64 cpu_time;
mjw@1623 121 unsigned long max_memkb;
cl349@4853 122 unsigned int vcpus;
cl349@4847 123 s32 vcpu_to_cpu[MAX_VIRT_CPUS];
cl349@4845 124 cpumap_t cpumap[MAX_VIRT_CPUS];
mjw@1623 125 } xc_dominfo_t;
mjw@1623 126
kaf24@2787 127 typedef dom0_getdomaininfo_t xc_domaininfo_t;
mjw@1623 128 int xc_domain_create(int xc_handle,
smh22@5514 129 u32 ssidref,
mjw@1623 130 u32 *pdomid);
iap10@3443 131
kaf24@4719 132
kaf24@4719 133 int xc_domain_dumpcore(int xc_handle,
cl349@4853 134 u32 domid,
cl349@4853 135 const char *corename);
kaf24@4719 136
kaf24@4719 137
iap10@3443 138 /**
iap10@3443 139 * This function pauses a domain. A paused domain still exists in memory
iap10@3443 140 * however it does not receive any timeslices from the hypervisor.
iap10@3443 141 *
iap10@3443 142 * @parm xc_handle a handle to an open hypervisor interface
iap10@3443 143 * @parm domid the domain id to pause
iap10@3443 144 * @return 0 on success, -1 on failure.
iap10@3443 145 */
mjw@1623 146 int xc_domain_pause(int xc_handle,
mjw@1623 147 u32 domid);
iap10@3443 148 /**
iap10@3443 149 * This function unpauses a domain. The domain should have been previously
iap10@3443 150 * paused.
iap10@3443 151 *
iap10@3443 152 * @parm xc_handle a handle to an open hypervisor interface
iap10@3443 153 * @parm domid the domain id to unpause
iap10@3443 154 * return 0 on success, -1 on failure
iap10@3443 155 */
mjw@1623 156 int xc_domain_unpause(int xc_handle,
mjw@1623 157 u32 domid);
iap10@3443 158
iap10@3443 159 /**
iap10@3443 160 * This function will destroy a domain. Destroying a domain removes the domain
iap10@3443 161 * completely from memory. This function should be called after sending the
iap10@3443 162 * domain a SHUTDOWN control message to free up the domain resources.
iap10@3443 163 *
iap10@3443 164 * @parm xc_handle a handle to an open hypervisor interface
iap10@3443 165 * @parm domid the domain id to destroy
iap10@3443 166 * @return 0 on success, -1 on failure
iap10@3443 167 */
mjw@1623 168 int xc_domain_destroy(int xc_handle,
mjw@1623 169 u32 domid);
mjw@1623 170 int xc_domain_pincpu(int xc_handle,
mjw@1623 171 u32 domid,
cl349@4845 172 int vcpu,
cl349@4845 173 cpumap_t *cpumap);
iap10@3443 174 /**
dsteklof@5498 175 * This function will return information about one or more domains. It is
dsteklof@5498 176 * designed to iterate over the list of domains. If a single domain is
dsteklof@5498 177 * requested, this function will return the next domain in the list - if
dsteklof@5498 178 * one exists. It is, therefore, important in this case to make sure the
dsteklof@5498 179 * domain requested was the one returned.
iap10@3443 180 *
iap10@3443 181 * @parm xc_handle a handle to an open hypervisor interface
iap10@3443 182 * @parm first_domid the first domain to enumerate information from. Domains
iap10@3443 183 * are currently enumerate in order of creation.
iap10@3443 184 * @parm max_doms the number of elements in info
iap10@3443 185 * @parm info an array of max_doms size that will contain the information for
iap10@3443 186 * the enumerated domains.
iap10@3443 187 * @return the number of domains enumerated or -1 on error
iap10@3443 188 */
mjw@1623 189 int xc_domain_getinfo(int xc_handle,
mjw@1623 190 u32 first_domid,
mjw@1623 191 unsigned int max_doms,
mjw@1623 192 xc_dominfo_t *info);
iap10@3443 193
iap10@3443 194 /**
kaf24@5699 195 * This function will return information about one or more domains, using a
kaf24@5699 196 * single hypercall. The domain information will be stored into the supplied
kaf24@5699 197 * array of xc_domaininfo_t structures.
kaf24@5699 198 *
kaf24@5699 199 * @parm xc_handle a handle to an open hypervisor interface
kaf24@5699 200 * @parm first_domain the first domain to enumerate information from.
kaf24@5699 201 * Domains are currently enumerate in order of creation.
kaf24@5699 202 * @parm max_domains the number of elements in info
kaf24@5699 203 * @parm info an array of max_doms size that will contain the information for
kaf24@5699 204 * the enumerated domains.
kaf24@5699 205 * @return the number of domains enumerated or -1 on error
kaf24@5699 206 */
kaf24@5699 207 int xc_domain_getinfolist(int xc_handle,
kaf24@5699 208 u32 first_domain,
kaf24@5699 209 unsigned int max_domains,
kaf24@5699 210 xc_domaininfo_t *info);
kaf24@5699 211
kaf24@5699 212 /**
iap10@3443 213 * This function returns information about one domain. This information is
iap10@3443 214 * more detailed than the information from xc_domain_getinfo().
iap10@3443 215 *
iap10@3443 216 * @parm xc_handle a handle to an open hypervisor interface
iap10@3443 217 * @parm domid the domain to get information from
iap10@3443 218 * @parm info a pointer to an xc_domaininfo_t to store the domain information
iap10@3443 219 * @parm ctxt a pointer to a structure to store the execution context of the
iap10@3443 220 * domain
iap10@3443 221 * @return 0 on success, -1 on failure
iap10@3443 222 */
cl349@4849 223 int xc_domain_get_vcpu_context(int xc_handle,
cl349@4853 224 u32 domid,
cl349@4853 225 u32 vcpu,
cl349@4853 226 vcpu_guest_context_t *ctxt);
cl349@4849 227
gm281@2236 228 int xc_domain_setcpuweight(int xc_handle,
gm281@2236 229 u32 domid,
gm281@2236 230 float weight);
kaf24@2787 231 long long xc_domain_get_cpu_usage(int xc_handle,
mafetter@3435 232 domid_t domid,
mafetter@3435 233 int vcpu);
mjw@1623 234
kaf24@2787 235
kaf24@2787 236 typedef dom0_shadow_control_stats_t xc_shadow_control_stats_t;
mjw@1623 237 int xc_shadow_control(int xc_handle,
mjw@1623 238 u32 domid,
mjw@1623 239 unsigned int sop,
mjw@1623 240 unsigned long *dirty_bitmap,
mjw@1623 241 unsigned long pages,
mjw@1623 242 xc_shadow_control_stats_t *stats);
mjw@1623 243
mjw@1623 244
mjw@2574 245 #define XCFLAGS_VERBOSE 1
mjw@2574 246 #define XCFLAGS_LIVE 2
mjw@2574 247 #define XCFLAGS_DEBUG 4
mjw@2574 248 #define XCFLAGS_CONFIGURE 8
mjw@1623 249
mjw@1623 250 struct XcIOContext;
iap10@3443 251
iap10@3443 252 /**
cl349@5121 253 * This function will save a domain running Linux.
iap10@3443 254 *
iap10@3443 255 * @parm xc_handle a handle to an open hypervisor interface
cl349@5121 256 * @parm fd the file descriptor to save a domain to
cl349@5121 257 * @parm dom the id of the domain
iap10@3443 258 * @return 0 on success, -1 on failure
iap10@3443 259 */
cl349@5121 260 int xc_linux_save(int xc_handle, int fd, u32 dom);
iap10@3443 261
iap10@3443 262 /**
cl349@5121 263 * This function will restore a saved domain running Linux.
iap10@3443 264 *
iap10@3443 265 * @parm xc_handle a handle to an open hypervisor interface
cl349@5121 266 * @parm fd the file descriptor to restore a domain from
cl349@5121 267 * @parm dom the id of the domain
cl349@5121 268 * @parm nr_pfns the number of pages
iap10@3443 269 * @return 0 on success, -1 on failure
iap10@3443 270 */
cl349@5089 271 int xc_linux_restore(int xc_handle, int io_fd, u32 dom, unsigned long nr_pfns);
mjw@1623 272
mjw@1623 273 int xc_linux_build(int xc_handle,
mjw@1623 274 u32 domid,
mjw@1623 275 const char *image_name,
mjw@1623 276 const char *ramdisk_name,
mjw@1623 277 const char *cmdline,
mjw@1623 278 unsigned int control_evtchn,
cl349@3451 279 unsigned long flags,
cl349@5349 280 unsigned int vcpus,
cl349@5349 281 unsigned int store_evtchn,
cl349@5349 282 unsigned long *store_mfn);
mjw@1623 283
kaf24@3420 284 struct mem_map;
iap10@3390 285 int xc_vmx_build(int xc_handle,
iap10@3390 286 u32 domid,
iap10@3605 287 int memsize,
iap10@3390 288 const char *image_name,
iap10@3390 289 struct mem_map *memmap,
iap10@3390 290 const char *ramdisk_name,
iap10@3390 291 const char *cmdline,
iap10@3390 292 unsigned int control_evtchn,
iap10@3390 293 unsigned long flags);
iap10@3390 294
mjw@1623 295 int xc_bvtsched_global_set(int xc_handle,
mjw@1623 296 unsigned long ctx_allow);
mjw@1623 297
mjw@1623 298 int xc_bvtsched_domain_set(int xc_handle,
mjw@1623 299 u32 domid,
gm281@2058 300 u32 mcuadv,
gm281@2058 301 int warpback,
gm281@2058 302 s32 warpvalue,
gm281@2058 303 long long warpl,
gm281@2058 304 long long warpu);
mjw@1623 305
mjw@1623 306 int xc_bvtsched_global_get(int xc_handle,
mjw@1623 307 unsigned long *ctx_allow);
mjw@1623 308
mjw@1623 309 int xc_bvtsched_domain_get(int xc_handle,
mjw@1623 310 u32 domid,
gm281@2058 311 u32 *mcuadv,
gm281@2058 312 int *warpback,
gm281@2058 313 s32 *warpvalue,
gm281@2058 314 long long *warpl,
gm281@2058 315 long long *warpu);
mjw@1623 316
sd386@3449 317 int xc_sedf_domain_set(int xc_handle,
sd386@3449 318 u32 domid,
sd386@3573 319 u64 period, u64 slice, u64 latency, u16 extratime, u16 weight);
sd386@3449 320
sd386@3449 321 int xc_sedf_domain_get(int xc_handle,
sd386@3449 322 u32 domid,
sd386@3573 323 u64* period, u64 *slice, u64 *latency, u16 *extratime, u16* weight);
sd386@3449 324
kaf24@2787 325 typedef evtchn_status_t xc_evtchn_status_t;
iap10@3443 326
kaf24@3961 327 /*
iap10@3443 328 * EVENT CHANNEL FUNCTIONS
kaf24@3961 329 */
iap10@3443 330
iap10@3443 331 /**
iap10@3443 332 * This function allocates an unbound port. Ports are named endpoints used for
iap10@3443 333 * interdomain communication. This function is most useful in opening a
iap10@3443 334 * well-known port within a domain to receive events on.
iap10@3443 335 *
iap10@3443 336 * @parm xc_handle a handle to an open hypervisor interface
iap10@3443 337 * @parm dom the ID of the domain. This maybe DOMID_SELF
iap10@3443 338 * @parm port a pointer to a port. This is an in/out parameter. If *port is
iap10@3443 339 * 0, then a new port will be assigned, if port is > 0 then that
iap10@3443 340 * port is allocated if the port is unallocated.
iap10@3443 341 * @return 0 on success, -1 on failure
iap10@3443 342 */
kaf24@2713 343 int xc_evtchn_alloc_unbound(int xc_handle,
kaf24@2713 344 u32 dom,
kaf24@2713 345 int *port);
iap10@3443 346
iap10@3443 347 /**
iap10@3443 348 * This function creates a pair of ports between two domains. A port can only
iap10@3443 349 * be bound once within a domain.
iap10@3443 350 *
iap10@3443 351 * @parm xc_handle a handle to an open hypervisor interface
iap10@3443 352 * @parm dom1 one of the two domains to connect. Can be DOMID_SELF.
iap10@3443 353 * @parm dom2 the other domain to connect. Can be DOMID_SELF.
iap10@3443 354 * @parm port1 an in/out parameter. If > 0, then try to connect *port. If
iap10@3443 355 * 0, then allocate a new port and store the port in *port.
iap10@3443 356 * @parm port2 the port connected on port2. This parameter behaves the same
iap10@3443 357 * way as port1.
iap10@3443 358 * @return 0 on success, -1 on error.
iap10@3443 359 */
mjw@1623 360 int xc_evtchn_bind_interdomain(int xc_handle,
iap10@3443 361 u32 dom1,
iap10@3443 362 u32 dom2,
mjw@1623 363 int *port1,
mjw@1623 364 int *port2);
mjw@1623 365 int xc_evtchn_bind_virq(int xc_handle,
mjw@1623 366 int virq,
mjw@1623 367 int *port);
iap10@3443 368
iap10@3443 369 /**
iap10@3443 370 * This function will close a single port on an event channel.
iap10@3443 371 *
iap10@3443 372 * @parm xc_handle a handle to an open hypervisor interface
iap10@3443 373 * @parm dom the domain that the port exists on. May be DOMID_SELF.
iap10@3443 374 * @parm port the port to close
iap10@3443 375 * @return 0 on success, -1 on error
iap10@3443 376 */
mjw@1623 377 int xc_evtchn_close(int xc_handle,
mjw@1623 378 u32 dom, /* may be DOMID_SELF */
mjw@1623 379 int port);
iap10@3443 380
iap10@3443 381 /**
iap10@3443 382 * This function generates a notify event on a bound port.
iap10@3443 383 *
iap10@3443 384 * Notifies can be read within Linux by opening /dev/xen/evtchn and reading
iap10@3443 385 * a 16 bit value. The result will be the port the event occurred on. When
iap10@3443 386 * events occur, the port is masked until the 16 bit port value is written back
iap10@3443 387 * to the file. When /dev/xen/evtchn is opened, it has to be bound via an
iap10@3443 388 * ioctl to each port to listen on. The ioctl for binding is _IO('E', 2). The
iap10@3443 389 * parameter is the port to listen on.
iap10@3443 390 *
iap10@3443 391 * @parm xc_handle a handle to an open hypervisor interface
iap10@3443 392 * @parm local_port the port to generate the notify on
iap10@3443 393 * @return 0 on success, -1 on error
iap10@3443 394 */
mjw@1623 395 int xc_evtchn_send(int xc_handle,
mjw@1623 396 int local_port);
mjw@1623 397 int xc_evtchn_status(int xc_handle,
mjw@1623 398 u32 dom, /* may be DOMID_SELF */
mjw@1623 399 int port,
mjw@1623 400 xc_evtchn_status_t *status);
mjw@1623 401
mjw@1623 402 int xc_physdev_pci_access_modify(int xc_handle,
mjw@1623 403 u32 domid,
mjw@1623 404 int bus,
mjw@1623 405 int dev,
mjw@1623 406 int func,
mjw@1623 407 int enable);
mjw@1623 408
mjw@1623 409 int xc_readconsolering(int xc_handle,
kaf24@5327 410 char **pbuffer,
kaf24@5327 411 unsigned int *pnr_chars,
mjw@1623 412 int clear);
mjw@1623 413
kaf24@2787 414 typedef dom0_physinfo_t xc_physinfo_t;
mjw@1623 415 int xc_physinfo(int xc_handle,
mjw@1623 416 xc_physinfo_t *info);
mjw@1623 417
gm281@2236 418 int xc_sched_id(int xc_handle,
gm281@2236 419 int *sched_id);
gm281@2236 420
mjw@1623 421 int xc_domain_setmaxmem(int xc_handle,
kaf24@3231 422 u32 domid,
kaf24@3231 423 unsigned int max_memkb);
mjw@1623 424
cl349@5045 425 int xc_domain_memory_increase_reservation(int xc_handle,
cl349@5045 426 u32 domid,
cl349@5045 427 unsigned int mem_kb);
cl349@5045 428
kaf24@3231 429 typedef dom0_perfc_desc_t xc_perfc_desc_t;
kaf24@3231 430 /* IMPORTANT: The caller is responsible for mlock()'ing the @desc array. */
kaf24@3231 431 int xc_perfc_control(int xc_handle,
kaf24@3231 432 u32 op,
kaf24@3231 433 xc_perfc_desc_t *desc);
mjw@1623 434
rneugeba@3963 435 /* read/write msr */
rneugeba@3963 436 long long xc_msr_read(int xc_handle, int cpu_mask, int msr);
rneugeba@3963 437 int xc_msr_write(int xc_handle, int cpu_mask, int msr, unsigned int low,
rneugeba@3963 438 unsigned int high);
rneugeba@3963 439
iap10@3443 440 /**
iap10@3443 441 * Memory maps a range within one domain to a local address range. Mappings
iap10@3443 442 * should be unmapped with munmap and should follow the same rules as mmap
rusty@4866 443 * regarding page alignment. Returns NULL on failure.
iap10@3443 444 *
iap10@3443 445 * In Linux, the ring queue for the control channel is accessible by mapping
iap10@3443 446 * the shared_info_frame (from xc_domain_getinfo()) + 2048. The structure
iap10@3443 447 * stored there is of type control_if_t.
iap10@3443 448 *
iap10@3443 449 * @parm xc_handle a handle on an open hypervisor interface
iap10@3443 450 * @parm dom the domain to map memory from
iap10@3443 451 * @parm size the amount of memory to map (in multiples of page size)
iap10@3443 452 * @parm prot same flag as in mmap().
iap10@3443 453 * @parm mfn the frame address to map.
iap10@3443 454 */
iap10@2325 455 void *xc_map_foreign_range(int xc_handle, u32 dom,
iap10@2325 456 int size, int prot,
iap10@2325 457 unsigned long mfn );
iap10@2325 458
iap10@2325 459 void *xc_map_foreign_batch(int xc_handle, u32 dom, int prot,
iap10@2325 460 unsigned long *arr, int num );
iap10@2325 461
iap10@3390 462 int xc_get_pfn_list(int xc_handle, u32 domid, unsigned long *pfn_buf,
cl349@4853 463 unsigned long max_pfns);
iap10@3390 464
cwc22@3985 465 /*\
cwc22@3985 466 * GRANT TABLE FUNCTIONS
cwc22@3985 467 \*/
cwc22@3985 468
cwc22@3985 469 /**
cwc22@3985 470 * This function opens a handle to the more restricted grant table hypervisor
cwc22@3985 471 * interface. This may be used where the standard interface is not
cwc22@3985 472 * available because the domain is not privileged.
cwc22@3985 473 * This function can be called multiple times within a single process.
cwc22@3985 474 * Multiple processes can have an open hypervisor interface at the same time.
cwc22@3985 475 *
cwc22@3985 476 * Each call to this function should have a corresponding call to
cwc22@3985 477 * xc_grant_interface_close().
cwc22@3985 478 *
cwc22@3985 479 * This function can fail if a Xen-enabled kernel is not currently running.
cwc22@3985 480 *
cwc22@3985 481 * @return a handle to the hypervisor grant table interface or -1 on failure
cwc22@3985 482 */
cwc22@3985 483 int xc_grant_interface_open(void);
cwc22@3985 484
cwc22@3985 485 /**
cwc22@3985 486 * This function closes an open grant table hypervisor interface.
cwc22@3985 487 *
cwc22@3985 488 * This function can fail if the handle does not represent an open interface or
cwc22@3985 489 * if there were problems closing the interface.
cwc22@3985 490 *
cwc22@3985 491 * @parm xc_handle a handle to an open grant table hypervisor interface
cwc22@3985 492 * @return 0 on success, -1 otherwise.
cwc22@3985 493 */
cwc22@3985 494 int xc_grant_interface_close(int xc_handle);
cwc22@3985 495
cwc22@3985 496 int xc_gnttab_map_grant_ref(int xc_handle,
cwc22@3985 497 memory_t host_virt_addr,
cwc22@3985 498 u32 dom,
cwc22@3985 499 u16 ref,
cwc22@3985 500 u16 flags,
cwc22@3985 501 s16 *handle,
cwc22@3985 502 memory_t *dev_bus_addr);
cwc22@3985 503
cwc22@3985 504 int xc_gnttab_unmap_grant_ref(int xc_handle,
cwc22@3985 505 memory_t host_virt_addr,
cwc22@3985 506 memory_t dev_bus_addr,
cwc22@3985 507 u16 handle,
cwc22@3985 508 s16 *status);
cwc22@3985 509
cwc22@3985 510 int xc_gnttab_setup_table(int xc_handle,
cwc22@3985 511 u32 dom,
cwc22@3985 512 u16 nr_frames,
cwc22@3985 513 s16 *status,
cwc22@3985 514 memory_t **frame_list);
cwc22@3985 515
cwc22@3985 516 /* Grant debug builds only: */
cwc22@3985 517 int xc_gnttab_dump_table(int xc_handle,
cwc22@3985 518 u32 dom,
cwc22@3985 519 s16 *status);
cwc22@3985 520
kaf24@5318 521 /* Get current total pages allocated to a domain. */
kaf24@5318 522 long xc_get_tot_pages(int xc_handle, u32 domid);
kaf24@5318 523
kaf24@5318 524 /* Execute a privileged dom0 operation. */
kaf24@5318 525 int xc_dom0_op(int xc_handle, dom0_op_t *op);
cwc22@3985 526
mjw@1623 527 #endif /* __XC_H__ */