direct-io.hg

annotate tools/libxc/xenctrl.h @ 6941:ec01850d0ee9

Fix xc_ptrace (live debug, not coredump debug) for 32-bit pae.
Clean up interfaces and add simple documentation for using
the domU debug interfaces.

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