direct-io.hg

annotate tools/libxc/xc.h @ 6281:0608852073c8

Get rid of memory_t. Almost all uses should be unsigned long.
The few uses for a physical/machine address have been mostly
changed to u64.

Grant table code probably needs auditing for PAE correctness,
but at least the interface is now sound.

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