direct-io.hg

annotate tools/libxc/xenctrl.h @ 9221:1439cfa5ee8c

The existing xc_domain_dumpcore is very specific to disk/file based
output. Refactor the code slightly to allow more user-specified
control. This is done by adding a parallel
xc_domain_dumpcore_via_callback, which allows the specification of a
callback routine and an opaque argument block. The existing dumpcore
routine is modified to use the callback for all write operations and
to turn the single seek into a small write (it's for page alignment).

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