direct-io.hg

annotate tools/libxc/xenctrl.h @ 8500:dd5649730b32

Fix a couple of bogus dom0_op names:
setdomaininfo -> setvcpucontext
pincpudomain -> setvcpuaffinity

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