direct-io.hg

annotate tools/libxc/xenctrl.h @ 11774:5d2ce349f9f4

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