direct-io.hg

annotate tools/libxc/xenctrl.h @ 12224:cfb1136ee8f7

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