direct-io.hg

annotate tools/libxc/xenctrl.h @ 11393:fd6c2b5e041f

[TOOLS] xenctrl.h defines __XEN_TOOLS__ if it's not already.
Signed-off-by: Keir Fraser <keir@xensource.com>
author kaf24@firebug.cl.cam.ac.uk
date Thu Aug 31 18:54:50 2006 +0100 (2006-08-31)
parents 86d26e6ec89b
children 11645dda144c 7e79259c2c17
rev   line source
mjw@1623 1 /******************************************************************************
cl349@6388 2 * xenctrl.h
kaf24@9660 3 *
mjw@1623 4 * A library for low-level access to the Xen control interfaces.
kaf24@9660 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@11393 12 /* Tell the Xen public headers we are a user-space tools build. */
kaf24@11393 13 #ifndef __XEN_TOOLS__
kaf24@11393 14 #define __XEN_TOOLS__ 1
kaf24@11393 15 #endif
kaf24@11393 16
kaf24@9999 17 #include <stddef.h>
kaf24@3266 18 #include <stdint.h>
kaf24@4719 19 #include <sys/ptrace.h>
kaf24@2821 20 #include <xen/xen.h>
kfraser@11257 21 #include <xen/domctl.h>
kfraser@11257 22 #include <xen/sysctl.h>
vh249@6549 23 #include <xen/version.h>
kaf24@2821 24 #include <xen/event_channel.h>
kaf24@7196 25 #include <xen/sched.h>
smh22@7702 26 #include <xen/memory.h>
kaf24@5541 27 #include <xen/acm.h>
kaf24@9907 28 #include <xen/acm_ops.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@9660 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@10687 55 #elif defined(__powerpc__)
kaf24@10687 56 /* XXX loosen these up later */
kaf24@10687 57 #define mb() __asm__ __volatile__ ("sync" : : : "memory")
kaf24@10687 58 #define rmb() __asm__ __volatile__ ("sync" : : : "memory") /* lwsync? */
kaf24@10687 59 #define wmb() __asm__ __volatile__ ("sync" : : : "memory") /* eieio? */
kaf24@3961 60 #else
kaf24@3961 61 #error "Define barriers"
kaf24@3961 62 #endif
kaf24@3961 63
kaf24@3961 64 /*
iap10@3443 65 * INITIALIZATION FUNCTIONS
kaf24@9660 66 */
iap10@3443 67
iap10@3443 68 /**
iap10@3443 69 * This function opens a handle to the hypervisor interface. This function can
iap10@3443 70 * be called multiple times within a single process. Multiple processes can
iap10@3443 71 * have an open hypervisor interface at the same time.
iap10@3443 72 *
iap10@3443 73 * Each call to this function should have a corresponding call to
iap10@3443 74 * xc_interface_close().
iap10@3443 75 *
iap10@3443 76 * This function can fail if the caller does not have superuser permission or
iap10@3443 77 * if a Xen-enabled kernel is not currently running.
iap10@3443 78 *
iap10@3443 79 * @return a handle to the hypervisor interface or -1 on failure
iap10@3443 80 */
mjw@1623 81 int xc_interface_open(void);
iap10@3443 82
iap10@3443 83 /**
iap10@3443 84 * This function closes an open hypervisor interface.
iap10@3443 85 *
iap10@3443 86 * This function can fail if the handle does not represent an open interface or
iap10@3443 87 * if there were problems closing the interface.
iap10@3443 88 *
iap10@3443 89 * @parm xc_handle a handle to an open hypervisor interface
iap10@3443 90 * @return 0 on success, -1 otherwise.
iap10@3443 91 */
mjw@1623 92 int xc_interface_close(int xc_handle);
mjw@1623 93
kaf24@3961 94 /*
kaf24@4719 95 * DOMAIN DEBUGGING FUNCTIONS
kaf24@4719 96 */
kaf24@4719 97
kaf24@4719 98 typedef struct xc_core_header {
kaf24@4719 99 unsigned int xch_magic;
kaf24@4719 100 unsigned int xch_nr_vcpus;
kaf24@4719 101 unsigned int xch_nr_pages;
kaf24@4719 102 unsigned int xch_ctxt_offset;
kaf24@4719 103 unsigned int xch_index_offset;
kaf24@4719 104 unsigned int xch_pages_offset;
kaf24@4719 105 } xc_core_header_t;
kaf24@4719 106
kaf24@9145 107 #define XC_CORE_MAGIC 0xF00FEBED
kaf24@4719 108
kaf24@6941 109 long xc_ptrace_core(
kaf24@6941 110 int xc_handle,
kaf24@9660 111 enum __ptrace_request request,
kaf24@9660 112 uint32_t domid,
kaf24@9660 113 long addr,
kaf24@9143 114 long data,
kaf24@9143 115 vcpu_guest_context_t *ctxt);
kaf24@9143 116 void * map_domain_va_core(
kaf24@9660 117 unsigned long domfd,
kaf24@9660 118 int cpu,
kaf24@9143 119 void *guest_va,
kaf24@9143 120 vcpu_guest_context_t *ctxt);
kaf24@6941 121 int xc_waitdomain_core(
kaf24@6941 122 int xc_handle,
kaf24@9660 123 int domain,
kaf24@9660 124 int *status,
kaf24@9143 125 int options,
kaf24@9143 126 vcpu_guest_context_t *ctxt);
kaf24@4719 127
kaf24@4719 128 /*
iap10@3443 129 * DOMAIN MANAGEMENT FUNCTIONS
kaf24@3961 130 */
iap10@3443 131
mjw@1623 132 typedef struct {
kaf24@7378 133 uint32_t domid;
kaf24@7378 134 uint32_t ssidref;
kaf24@9660 135 unsigned int dying:1, crashed:1, shutdown:1,
mjw@1623 136 paused:1, blocked:1, running:1;
mjw@1623 137 unsigned int shutdown_reason; /* only meaningful if shutdown==1 */
mjw@1623 138 unsigned long nr_pages;
mjw@1623 139 unsigned long shared_info_frame;
kaf24@7378 140 uint64_t cpu_time;
mjw@1623 141 unsigned long max_memkb;
kaf24@7397 142 unsigned int nr_online_vcpus;
kaf24@7397 143 unsigned int max_vcpu_id;
kaf24@7378 144 xen_domain_handle_t handle;
mjw@1623 145 } xc_dominfo_t;
mjw@1623 146
kfraser@11257 147 typedef xen_domctl_getdomaininfo_t xc_domaininfo_t;
kaf24@9660 148 int xc_domain_create(int xc_handle,
kaf24@7339 149 uint32_t ssidref,
kaf24@7378 150 xen_domain_handle_t handle,
kaf24@7339 151 uint32_t *pdomid);
iap10@3443 152
kaf24@4719 153
kaf24@9221 154 /* Functions to produce a dump of a given domain
kaf24@9221 155 * xc_domain_dumpcore - produces a dump to a specified file
kaf24@9221 156 * xc_domain_dumpcore_via_callback - produces a dump, using a specified
kaf24@9221 157 * callback function
kaf24@9221 158 */
kaf24@9660 159 int xc_domain_dumpcore(int xc_handle,
kaf24@7339 160 uint32_t domid,
cl349@4853 161 const char *corename);
kaf24@4719 162
kaf24@9221 163 /* Define the callback function type for xc_domain_dumpcore_via_callback.
kaf24@9221 164 *
kaf24@9221 165 * This function is called by the coredump code for every "write",
kaf24@9221 166 * and passes an opaque object for the use of the function and
kaf24@9221 167 * created by the caller of xc_domain_dumpcore_via_callback.
kaf24@9221 168 */
kaf24@9221 169 typedef int (dumpcore_rtn_t)(void *arg, char *buffer, unsigned int length);
kaf24@9221 170
kaf24@9660 171 int xc_domain_dumpcore_via_callback(int xc_handle,
kaf24@9221 172 uint32_t domid,
kaf24@9221 173 void *arg,
kaf24@9221 174 dumpcore_rtn_t dump_rtn);
kaf24@9221 175
kaf24@7354 176 /*
kaf24@7566 177 * This function sets the maximum number of vcpus that a domain may create.
kaf24@7354 178 *
kaf24@7354 179 * @parm xc_handle a handle to an open hypervisor interface.
kaf24@7354 180 * @parm domid the domain id in which vcpus are to be created.
kaf24@7354 181 * @parm max the maximum number of vcpus that the domain may create.
kaf24@7354 182 * @return 0 on success, -1 on failure.
kaf24@7354 183 */
kaf24@7354 184 int xc_domain_max_vcpus(int xc_handle,
kaf24@9660 185 uint32_t domid,
kaf24@7354 186 unsigned int max);
kaf24@4719 187
iap10@3443 188 /**
iap10@3443 189 * This function pauses a domain. A paused domain still exists in memory
iap10@3443 190 * however it does not receive any timeslices from the hypervisor.
iap10@3443 191 *
iap10@3443 192 * @parm xc_handle a handle to an open hypervisor interface
iap10@3443 193 * @parm domid the domain id to pause
iap10@3443 194 * @return 0 on success, -1 on failure.
iap10@3443 195 */
kaf24@9660 196 int xc_domain_pause(int xc_handle,
kaf24@7339 197 uint32_t domid);
iap10@3443 198 /**
iap10@3443 199 * This function unpauses a domain. The domain should have been previously
iap10@3443 200 * paused.
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 unpause
iap10@3443 204 * return 0 on success, -1 on failure
iap10@3443 205 */
kaf24@9660 206 int xc_domain_unpause(int xc_handle,
kaf24@7339 207 uint32_t domid);
iap10@3443 208
iap10@3443 209 /**
iap10@3443 210 * This function will destroy a domain. Destroying a domain removes the domain
iap10@3443 211 * completely from memory. This function should be called after sending the
iap10@3443 212 * domain a SHUTDOWN control message to free up the domain resources.
iap10@3443 213 *
iap10@3443 214 * @parm xc_handle a handle to an open hypervisor interface
iap10@3443 215 * @parm domid the domain id to destroy
iap10@3443 216 * @return 0 on success, -1 on failure
iap10@3443 217 */
kaf24@9660 218 int xc_domain_destroy(int xc_handle,
kaf24@7339 219 uint32_t domid);
kaf24@8500 220
kaf24@9560 221 /**
kaf24@9560 222 * This function will shutdown a domain. This is intended for use in
kaf24@9560 223 * fully-virtualized domains where this operation is analogous to the
kaf24@9560 224 * sched_op operations in a paravirtualized domain. The caller is
kaf24@9560 225 * expected to give the reason for the shutdown.
kaf24@9560 226 *
kaf24@9560 227 * @parm xc_handle a handle to an open hypervisor interface
kaf24@9560 228 * @parm domid the domain id to destroy
kaf24@9560 229 * @parm reason is the reason (SHUTDOWN_xxx) for the shutdown
kaf24@9560 230 * @return 0 on success, -1 on failure
kaf24@9560 231 */
kaf24@9660 232 int xc_domain_shutdown(int xc_handle,
kaf24@9560 233 uint32_t domid,
kaf24@9560 234 int reason);
kaf24@9560 235
kaf24@8500 236 int xc_vcpu_setaffinity(int xc_handle,
kaf24@8500 237 uint32_t domid,
kaf24@8500 238 int vcpu,
kfraser@11257 239 uint64_t cpumap);
kfraser@11257 240 int xc_vcpu_getaffinity(int xc_handle,
kfraser@11257 241 uint32_t domid,
kfraser@11257 242 int vcpu,
kfraser@11257 243 uint64_t *cpumap);
kaf24@7378 244
iap10@3443 245 /**
dsteklof@5498 246 * This function will return information about one or more domains. It is
dsteklof@5498 247 * designed to iterate over the list of domains. If a single domain is
dsteklof@5498 248 * requested, this function will return the next domain in the list - if
dsteklof@5498 249 * one exists. It is, therefore, important in this case to make sure the
dsteklof@5498 250 * domain requested was the one returned.
iap10@3443 251 *
iap10@3443 252 * @parm xc_handle a handle to an open hypervisor interface
iap10@3443 253 * @parm first_domid the first domain to enumerate information from. Domains
iap10@3443 254 * are currently enumerate in order of creation.
iap10@3443 255 * @parm max_doms the number of elements in info
iap10@3443 256 * @parm info an array of max_doms size that will contain the information for
iap10@3443 257 * the enumerated domains.
iap10@3443 258 * @return the number of domains enumerated or -1 on error
iap10@3443 259 */
mjw@1623 260 int xc_domain_getinfo(int xc_handle,
kaf24@9660 261 uint32_t first_domid,
mjw@1623 262 unsigned int max_doms,
mjw@1623 263 xc_dominfo_t *info);
iap10@3443 264
kaf24@8381 265
kaf24@8381 266 /**
kaf24@8500 267 * This function will set the execution context for the specified vcpu.
kaf24@8381 268 *
kaf24@8381 269 * @parm xc_handle a handle to an open hypervisor interface
kaf24@8381 270 * @parm domid the domain to set the vcpu context for
kaf24@8381 271 * @parm vcpu the vcpu number for the context
kaf24@8381 272 * @parm ctxt pointer to the the cpu context with the values to set
kaf24@8381 273 * @return the number of domains enumerated or -1 on error
kaf24@8381 274 */
kaf24@8500 275 int xc_vcpu_setcontext(int xc_handle,
kaf24@8500 276 uint32_t domid,
kaf24@8500 277 uint32_t vcpu,
kaf24@8500 278 vcpu_guest_context_t *ctxt);
iap10@3443 279 /**
kaf24@5699 280 * This function will return information about one or more domains, using a
kaf24@5699 281 * single hypercall. The domain information will be stored into the supplied
kaf24@5699 282 * array of xc_domaininfo_t structures.
kaf24@5699 283 *
kaf24@5699 284 * @parm xc_handle a handle to an open hypervisor interface
kaf24@5699 285 * @parm first_domain the first domain to enumerate information from.
kaf24@5699 286 * Domains are currently enumerate in order of creation.
kaf24@5699 287 * @parm max_domains the number of elements in info
kaf24@5699 288 * @parm info an array of max_doms size that will contain the information for
kaf24@5699 289 * the enumerated domains.
kaf24@5699 290 * @return the number of domains enumerated or -1 on error
kaf24@5699 291 */
kaf24@5699 292 int xc_domain_getinfolist(int xc_handle,
kaf24@7339 293 uint32_t first_domain,
kaf24@5699 294 unsigned int max_domains,
kaf24@5699 295 xc_domaininfo_t *info);
kaf24@5699 296
kaf24@5699 297 /**
emellor@7404 298 * This function returns information about the execution context of a
emellor@7404 299 * particular vcpu of a domain.
iap10@3443 300 *
iap10@3443 301 * @parm xc_handle a handle to an open hypervisor interface
iap10@3443 302 * @parm domid the domain to get information from
emellor@7404 303 * @parm vcpu the vcpu number
iap10@3443 304 * @parm ctxt a pointer to a structure to store the execution context of the
iap10@3443 305 * domain
iap10@3443 306 * @return 0 on success, -1 on failure
iap10@3443 307 */
kaf24@8500 308 int xc_vcpu_getcontext(int xc_handle,
kaf24@7339 309 uint32_t domid,
kaf24@7339 310 uint32_t vcpu,
cl349@4853 311 vcpu_guest_context_t *ctxt);
cl349@4849 312
kfraser@11257 313 typedef xen_domctl_getvcpuinfo_t xc_vcpuinfo_t;
kaf24@8500 314 int xc_vcpu_getinfo(int xc_handle,
kaf24@8500 315 uint32_t domid,
kaf24@8500 316 uint32_t vcpu,
kaf24@8500 317 xc_vcpuinfo_t *info);
kaf24@7397 318
gm281@2236 319 int xc_domain_setcpuweight(int xc_handle,
kaf24@7339 320 uint32_t domid,
gm281@2236 321 float weight);
kaf24@2787 322 long long xc_domain_get_cpu_usage(int xc_handle,
mafetter@3435 323 domid_t domid,
mafetter@3435 324 int vcpu);
mjw@1623 325
kaf24@9660 326 int xc_domain_sethandle(int xc_handle, uint32_t domid,
kaf24@7379 327 xen_domain_handle_t handle);
kaf24@2787 328
kfraser@11257 329 typedef xen_domctl_shadow_op_stats_t xc_shadow_op_stats_t;
mjw@1623 330 int xc_shadow_control(int xc_handle,
kaf24@9660 331 uint32_t domid,
mjw@1623 332 unsigned int sop,
mjw@1623 333 unsigned long *dirty_bitmap,
mjw@1623 334 unsigned long pages,
tdeegan@11151 335 unsigned long *mb,
tdeegan@11151 336 uint32_t mode,
kfraser@11257 337 xc_shadow_op_stats_t *stats);
mjw@1623 338
sd386@3449 339 int xc_sedf_domain_set(int xc_handle,
kaf24@7339 340 uint32_t domid,
kaf24@7339 341 uint64_t period, uint64_t slice,
kaf24@7339 342 uint64_t latency, uint16_t extratime,
kaf24@7339 343 uint16_t weight);
sd386@3449 344
sd386@3449 345 int xc_sedf_domain_get(int xc_handle,
kaf24@7339 346 uint32_t domid,
kaf24@7339 347 uint64_t* period, uint64_t *slice,
kaf24@7339 348 uint64_t *latency, uint16_t *extratime,
kaf24@7339 349 uint16_t *weight);
sd386@3449 350
kaf24@10174 351 int xc_sched_credit_domain_set(int xc_handle,
kaf24@10174 352 uint32_t domid,
kfraser@11257 353 struct xen_domctl_sched_credit *sdom);
ack@10168 354
kaf24@10174 355 int xc_sched_credit_domain_get(int xc_handle,
kaf24@10174 356 uint32_t domid,
kfraser@11257 357 struct xen_domctl_sched_credit *sdom);
ack@10168 358
kaf24@3961 359 /*
iap10@3443 360 * EVENT CHANNEL FUNCTIONS
kaf24@3961 361 */
iap10@3443 362
iap10@3443 363 /**
iap10@3443 364 * This function allocates an unbound port. Ports are named endpoints used for
iap10@3443 365 * interdomain communication. This function is most useful in opening a
iap10@3443 366 * well-known port within a domain to receive events on.
iap10@3443 367 *
iap10@3443 368 * @parm xc_handle a handle to an open hypervisor interface
kaf24@7223 369 * @parm dom the ID of the local domain (the 'allocatee')
kaf24@7237 370 * @parm remote_dom the ID of the domain who will later bind
kaf24@7237 371 * @return allocated port (in @dom) on success, -1 on failure
iap10@3443 372 */
kaf24@2713 373 int xc_evtchn_alloc_unbound(int xc_handle,
kaf24@7339 374 uint32_t dom,
kaf24@7339 375 uint32_t remote_dom);
iap10@3443 376
mjw@1623 377 int xc_physdev_pci_access_modify(int xc_handle,
kaf24@7339 378 uint32_t domid,
mjw@1623 379 int bus,
mjw@1623 380 int dev,
mjw@1623 381 int func,
mjw@1623 382 int enable);
mjw@1623 383
mjw@1623 384 int xc_readconsolering(int xc_handle,
kaf24@5327 385 char **pbuffer,
kaf24@9660 386 unsigned int *pnr_chars,
mjw@1623 387 int clear);
mjw@1623 388
kfraser@11257 389 typedef xen_sysctl_physinfo_t xc_physinfo_t;
mjw@1623 390 int xc_physinfo(int xc_handle,
mjw@1623 391 xc_physinfo_t *info);
mjw@1623 392
gm281@2236 393 int xc_sched_id(int xc_handle,
gm281@2236 394 int *sched_id);
gm281@2236 395
mjw@1623 396 int xc_domain_setmaxmem(int xc_handle,
kaf24@9660 397 uint32_t domid,
kaf24@3231 398 unsigned int max_memkb);
mjw@1623 399
kaf24@10474 400 int xc_domain_set_time_offset(int xc_handle,
kaf24@10474 401 uint32_t domid,
kaf24@10474 402 int32_t time_offset_seconds);
kaf24@10474 403
cl349@5045 404 int xc_domain_memory_increase_reservation(int xc_handle,
kaf24@9660 405 uint32_t domid,
iap10@6688 406 unsigned long nr_extents,
iap10@6682 407 unsigned int extent_order,
iap10@6688 408 unsigned int address_bits,
kaf24@10276 409 xen_pfn_t *extent_start);
iap10@6688 410
iap10@6688 411 int xc_domain_memory_decrease_reservation(int xc_handle,
kaf24@9660 412 uint32_t domid,
iap10@6688 413 unsigned long nr_extents,
iap10@6688 414 unsigned int extent_order,
kaf24@10276 415 xen_pfn_t *extent_start);
iap10@6688 416
kaf24@8856 417 int xc_domain_memory_populate_physmap(int xc_handle,
kaf24@8856 418 uint32_t domid,
kaf24@8856 419 unsigned long nr_extents,
kaf24@8856 420 unsigned int extent_order,
kaf24@8856 421 unsigned int address_bits,
kaf24@10276 422 xen_pfn_t *extent_start);
kaf24@8856 423
kaf24@8856 424 int xc_domain_translate_gpfn_list(int xc_handle,
kaf24@8856 425 uint32_t domid,
kaf24@8856 426 unsigned long nr_gpfns,
kaf24@10276 427 xen_pfn_t *gpfn_list,
kaf24@10276 428 xen_pfn_t *mfn_list);
kaf24@8856 429
kaf24@7624 430 int xc_domain_ioport_permission(int xc_handle,
kaf24@7624 431 uint32_t domid,
kaf24@8121 432 uint32_t first_port,
kaf24@8121 433 uint32_t nr_ports,
kaf24@8121 434 uint32_t allow_access);
kaf24@7624 435
kaf24@8460 436 int xc_domain_irq_permission(int xc_handle,
kaf24@8460 437 uint32_t domid,
kaf24@8460 438 uint8_t pirq,
kaf24@8460 439 uint8_t allow_access);
kaf24@8460 440
kaf24@8460 441 int xc_domain_iomem_permission(int xc_handle,
kaf24@8460 442 uint32_t domid,
kaf24@8736 443 unsigned long first_mfn,
kaf24@8736 444 unsigned long nr_mfns,
kaf24@8460 445 uint8_t allow_access);
kaf24@8460 446
kaf24@10266 447 unsigned long xc_make_page_below_4G(int xc_handle, uint32_t domid,
kaf24@10266 448 unsigned long mfn);
kaf24@10266 449
kfraser@11257 450 typedef xen_sysctl_perfc_desc_t xc_perfc_desc_t;
kfraser@11257 451 typedef xen_sysctl_perfc_val_t xc_perfc_val_t;
kaf24@10953 452 /* IMPORTANT: The caller is responsible for mlock()'ing the @desc and @val
kaf24@10953 453 arrays. */
kaf24@3231 454 int xc_perfc_control(int xc_handle,
kaf24@7339 455 uint32_t op,
kaf24@10953 456 xc_perfc_desc_t *desc,
kaf24@10953 457 xc_perfc_val_t *val,
kaf24@10953 458 int *nbr_desc,
kaf24@10953 459 int *nbr_val);
mjw@1623 460
iap10@3443 461 /**
iap10@3443 462 * Memory maps a range within one domain to a local address range. Mappings
iap10@3443 463 * should be unmapped with munmap and should follow the same rules as mmap
rusty@4866 464 * regarding page alignment. Returns NULL on failure.
iap10@3443 465 *
iap10@3443 466 * In Linux, the ring queue for the control channel is accessible by mapping
iap10@3443 467 * the shared_info_frame (from xc_domain_getinfo()) + 2048. The structure
iap10@3443 468 * stored there is of type control_if_t.
iap10@3443 469 *
iap10@3443 470 * @parm xc_handle a handle on an open hypervisor interface
iap10@3443 471 * @parm dom the domain to map memory from
iap10@3443 472 * @parm size the amount of memory to map (in multiples of page size)
iap10@3443 473 * @parm prot same flag as in mmap().
iap10@3443 474 * @parm mfn the frame address to map.
iap10@3443 475 */
kaf24@7339 476 void *xc_map_foreign_range(int xc_handle, uint32_t dom,
iap10@2325 477 int size, int prot,
iap10@2325 478 unsigned long mfn );
iap10@2325 479
kaf24@7339 480 void *xc_map_foreign_batch(int xc_handle, uint32_t dom, int prot,
kaf24@10276 481 xen_pfn_t *arr, int num );
iap10@2325 482
Ian@8435 483 /**
Ian@8435 484 * Translates a virtual address in the context of a given domain and
Ian@8435 485 * vcpu returning the machine page frame number of the associated
Ian@8435 486 * page.
Ian@8435 487 *
Ian@8435 488 * @parm xc_handle a handle on an open hypervisor interface
Ian@8435 489 * @parm dom the domain to perform the translation in
Ian@8435 490 * @parm vcpu the vcpu to perform the translation on
Ian@8435 491 * @parm virt the virtual address to translate
Ian@8435 492 */
Ian@8435 493 unsigned long xc_translate_foreign_address(int xc_handle, uint32_t dom,
kaf24@9221 494 int vcpu, unsigned long long virt);
Ian@8435 495
kaf24@10276 496 int xc_get_pfn_list(int xc_handle, uint32_t domid, xen_pfn_t *pfn_buf,
cl349@4853 497 unsigned long max_pfns);
iap10@3390 498
kaf24@7339 499 int xc_ia64_get_pfn_list(int xc_handle, uint32_t domid,
kaf24@10276 500 xen_pfn_t *pfn_buf,
kaf24@7339 501 unsigned int start_page, unsigned int nr_pages);
kaf24@5914 502
djm@7536 503 int xc_copy_to_domain_page(int xc_handle, uint32_t domid,
kaf24@9221 504 unsigned long dst_pfn, const char *src_page);
djm@7536 505
kaf24@7786 506 int xc_clear_domain_page(int xc_handle, uint32_t domid,
kaf24@7786 507 unsigned long dst_pfn);
kaf24@7786 508
kaf24@7339 509 long xc_get_max_pages(int xc_handle, uint32_t domid);
djm@6856 510
cl349@6389 511 int xc_mmuext_op(int xc_handle, struct mmuext_op *op, unsigned int nr_ops,
kaf24@9221 512 domid_t dom);
cl349@6389 513
kaf24@6468 514 int xc_memory_op(int xc_handle, int cmd, void *arg);
cl349@6389 515
kaf24@7339 516 int xc_get_pfn_type_batch(int xc_handle, uint32_t dom,
kaf24@7339 517 int num, unsigned long *arr);
cl349@6389 518
cl349@6389 519
kaf24@5318 520 /* Get current total pages allocated to a domain. */
kaf24@7339 521 long xc_get_tot_pages(int xc_handle, uint32_t domid);
kaf24@5318 522
kaf24@7566 523
kaf24@7566 524 /*
kaf24@7566 525 * Trace Buffer Operations
kaf24@7566 526 */
kaf24@7566 527
kaf24@7566 528 /**
kaf24@9996 529 * xc_tbuf_enable - enable tracing buffers
kaf24@7566 530 *
kaf24@7566 531 * @parm xc_handle a handle to an open hypervisor interface
kaf24@9996 532 * @parm cnt size of tracing buffers to create (in pages)
kaf24@9996 533 * @parm mfn location to store mfn of the trace buffers to
kaf24@9996 534 * @parm size location to store the size (in bytes) of a trace buffer to
kaf24@9996 535 *
kaf24@9996 536 * Gets the machine address of the trace pointer area and the size of the
kaf24@9996 537 * per CPU buffers.
kaf24@7566 538 */
kaf24@9996 539 int xc_tbuf_enable(int xc_handle, size_t cnt, unsigned long *mfn,
kaf24@9996 540 unsigned long *size);
kaf24@9996 541
kaf24@9996 542 /*
kaf24@9996 543 * Disable tracing buffers.
kaf24@9996 544 */
kaf24@9996 545 int xc_tbuf_disable(int xc_handle);
kaf24@7566 546
kaf24@7566 547 /**
kaf24@7571 548 * This function sets the size of the trace buffers. Setting the size
kaf24@7571 549 * is currently a one-shot operation that may be performed either at boot
kaf24@7571 550 * time or via this interface, not both. The buffer size must be set before
kaf24@7571 551 * enabling tracing.
kaf24@7566 552 *
kaf24@7566 553 * @parm xc_handle a handle to an open hypervisor interface
kaf24@7566 554 * @parm size the size in pages per cpu for the trace buffers
kaf24@7566 555 * @return 0 on success, -1 on failure.
kaf24@7566 556 */
kaf24@9996 557 int xc_tbuf_set_size(int xc_handle, unsigned long size);
kaf24@7566 558
kaf24@7566 559 /**
kaf24@9660 560 * This function retrieves the current size of the trace buffers.
kaf24@7566 561 * Note that the size returned is in terms of bytes, not pages.
kaf24@7566 562
kaf24@7566 563 * @parm xc_handle a handle to an open hypervisor interface
kaf24@7566 564 * @parm size will contain the size in bytes for the trace buffers
kaf24@7566 565 * @return 0 on success, -1 on failure.
kaf24@7566 566 */
kaf24@9996 567 int xc_tbuf_get_size(int xc_handle, unsigned long *size);
kaf24@9907 568
kaf24@9907 569 int xc_tbuf_set_cpu_mask(int xc_handle, uint32_t mask);
kaf24@9907 570
kaf24@9907 571 int xc_tbuf_set_evt_mask(int xc_handle, uint32_t mask);
kaf24@7566 572
kfraser@11257 573 int xc_domctl(int xc_handle, struct xen_domctl *domctl);
kfraser@11257 574 int xc_sysctl(int xc_handle, struct xen_sysctl *sysctl);
cwc22@3985 575
vh249@6549 576 int xc_version(int xc_handle, int cmd, void *arg);
vh249@6549 577
cl349@6389 578 /*
cl349@6389 579 * MMU updates.
cl349@6389 580 */
cl349@6389 581 #define MAX_MMU_UPDATES 1024
cl349@6389 582 struct xc_mmu {
cl349@6389 583 mmu_update_t updates[MAX_MMU_UPDATES];
cl349@6389 584 int idx;
cl349@6389 585 domid_t subject;
cl349@6389 586 };
cl349@6389 587 typedef struct xc_mmu xc_mmu_t;
cl349@6389 588 xc_mmu_t *xc_init_mmu_updates(int xc_handle, domid_t dom);
kaf24@9660 589 int xc_add_mmu_update(int xc_handle, xc_mmu_t *mmu,
iap10@6680 590 unsigned long long ptr, unsigned long long val);
cl349@6389 591 int xc_finish_mmu_updates(int xc_handle, xc_mmu_t *mmu);
cl349@6389 592
kaf24@10057 593 int xc_acm_op(int xc_handle, int cmd, void *arg, size_t arg_size);
kaf24@9907 594
kaf24@10355 595 /*
kaf24@10355 596 * Return a handle to the event channel driver, or -1 on failure, in which case
kaf24@10355 597 * errno will be set appropriately.
kaf24@10355 598 */
kaf24@10355 599 int xc_evtchn_open(void);
kaf24@10355 600
kaf24@10355 601 /*
kaf24@10355 602 * Close a handle previously allocated with xc_evtchn_open().
kaf24@10355 603 */
kaf24@10355 604 int xc_evtchn_close(int xce_handle);
kaf24@10355 605
kaf24@10355 606 /*
kaf24@10355 607 * Return an fd that can be select()ed on for further calls to
kaf24@10355 608 * xc_evtchn_pending().
kaf24@10355 609 */
kaf24@10355 610 int xc_evtchn_fd(int xce_handle);
kaf24@10355 611
kaf24@10355 612 /*
kaf24@10355 613 * Notify the given event channel. Returns -1 on failure, in which case
kaf24@10355 614 * errno will be set appropriately.
kaf24@10355 615 */
kaf24@10355 616 int xc_evtchn_notify(int xce_handle, evtchn_port_t port);
kaf24@10355 617
kaf24@10355 618 /*
kaf24@10355 619 * Returns a new event port bound to the remote port for the given domain ID,
kaf24@10355 620 * or -1 on failure, in which case errno will be set appropriately.
kaf24@10355 621 */
kaf24@10355 622 evtchn_port_t xc_evtchn_bind_interdomain(int xce_handle, int domid,
kaf24@10355 623 evtchn_port_t remote_port);
kaf24@10355 624
kaf24@10355 625 /*
kaf24@10355 626 * Unbind the given event channel. Returns -1 on failure, in which case errno
kaf24@10355 627 * will be set appropriately.
kaf24@10355 628 */
kaf24@10355 629 int xc_evtchn_unbind(int xce_handle, evtchn_port_t port);
kaf24@10355 630
kaf24@10355 631 /*
kaf24@10355 632 * Bind an event channel to the given VIRQ. Returns the event channel bound to
kaf24@10355 633 * the VIRQ, or -1 on failure, in which case errno will be set appropriately.
kaf24@10355 634 */
kaf24@10355 635 evtchn_port_t xc_evtchn_bind_virq(int xce_handle, unsigned int virq);
kaf24@10355 636
kaf24@10355 637 /*
kaf24@10355 638 * Return the next event channel to become pending, or -1 on failure, in which
kaf24@10355 639 * case errno will be set appropriately.
kaf24@10355 640 */
kaf24@10355 641 evtchn_port_t xc_evtchn_pending(int xce_handle);
kaf24@10355 642
kaf24@10355 643 /*
kaf24@10355 644 * Unmask the given event channel. Returns -1 on failure, in which case errno
kaf24@10355 645 * will be set appropriately.
kaf24@10355 646 */
kaf24@10355 647 int xc_evtchn_unmask(int xce_handle, evtchn_port_t port);
kaf24@10355 648
cl349@6389 649 #endif