direct-io.hg

annotate tools/libxc/xenctrl.h @ 9996:18fceb2f6b2d

Use common code for enabling tracing via xenmon and xentrace, also fixing
the last two remaining xc_private.h users outside of libxc.

Signed-off-by: John Levon <john.levon@sun.com>
author kaf24@firebug.cl.cam.ac.uk
date Tue May 16 09:18:25 2006 +0100 (2006-05-16)
parents 24dbb153ab39
children bc7d49df1651
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@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@9907 22 #include <xen/acm_ops.h>
kaf24@2787 23
kaf24@5914 24 #ifdef __ia64__
kaf24@5914 25 #define XC_PAGE_SHIFT 14
kaf24@5914 26 #else
kaf24@5914 27 #define XC_PAGE_SHIFT 12
kaf24@5914 28 #endif
kaf24@5914 29 #define XC_PAGE_SIZE (1UL << XC_PAGE_SHIFT)
kaf24@5914 30 #define XC_PAGE_MASK (~(XC_PAGE_SIZE-1))
kaf24@5914 31
kaf24@3961 32 /*
kaf24@3961 33 * DEFINITIONS FOR CPU BARRIERS
kaf24@9660 34 */
kaf24@3961 35
kaf24@3961 36 #if defined(__i386__)
kaf24@3966 37 #define mb() __asm__ __volatile__ ( "lock; addl $0,0(%%esp)" : : : "memory" )
kaf24@3966 38 #define rmb() __asm__ __volatile__ ( "lock; addl $0,0(%%esp)" : : : "memory" )
kaf24@3966 39 #define wmb() __asm__ __volatile__ ( "" : : : "memory")
kaf24@3961 40 #elif defined(__x86_64__)
kaf24@3966 41 #define mb() __asm__ __volatile__ ( "mfence" : : : "memory")
kaf24@3966 42 #define rmb() __asm__ __volatile__ ( "lfence" : : : "memory")
kaf24@3966 43 #define wmb() __asm__ __volatile__ ( "" : : : "memory")
kaf24@5914 44 #elif defined(__ia64__)
kaf24@5914 45 /* FIXME */
kaf24@5914 46 #define mb()
kaf24@5914 47 #define rmb()
kaf24@5914 48 #define wmb()
kaf24@3961 49 #else
kaf24@3961 50 #error "Define barriers"
kaf24@3961 51 #endif
kaf24@3961 52
kaf24@3961 53 /*
iap10@3443 54 * INITIALIZATION FUNCTIONS
kaf24@9660 55 */
iap10@3443 56
iap10@3443 57 /**
iap10@3443 58 * This function opens a handle to the hypervisor interface. This function can
iap10@3443 59 * be called multiple times within a single process. Multiple processes can
iap10@3443 60 * have an open hypervisor interface at the same time.
iap10@3443 61 *
iap10@3443 62 * Each call to this function should have a corresponding call to
iap10@3443 63 * xc_interface_close().
iap10@3443 64 *
iap10@3443 65 * This function can fail if the caller does not have superuser permission or
iap10@3443 66 * if a Xen-enabled kernel is not currently running.
iap10@3443 67 *
iap10@3443 68 * @return a handle to the hypervisor interface or -1 on failure
iap10@3443 69 */
mjw@1623 70 int xc_interface_open(void);
iap10@3443 71
iap10@3443 72 /**
iap10@3443 73 * This function closes an open hypervisor interface.
iap10@3443 74 *
iap10@3443 75 * This function can fail if the handle does not represent an open interface or
iap10@3443 76 * if there were problems closing the interface.
iap10@3443 77 *
iap10@3443 78 * @parm xc_handle a handle to an open hypervisor interface
iap10@3443 79 * @return 0 on success, -1 otherwise.
iap10@3443 80 */
mjw@1623 81 int xc_interface_close(int xc_handle);
mjw@1623 82
kaf24@3961 83 /*
kaf24@4719 84 * DOMAIN DEBUGGING FUNCTIONS
kaf24@4719 85 */
kaf24@4719 86
kaf24@4719 87 typedef struct xc_core_header {
kaf24@4719 88 unsigned int xch_magic;
kaf24@4719 89 unsigned int xch_nr_vcpus;
kaf24@4719 90 unsigned int xch_nr_pages;
kaf24@4719 91 unsigned int xch_ctxt_offset;
kaf24@4719 92 unsigned int xch_index_offset;
kaf24@4719 93 unsigned int xch_pages_offset;
kaf24@4719 94 } xc_core_header_t;
kaf24@4719 95
kaf24@9145 96 #define XC_CORE_MAGIC 0xF00FEBED
kaf24@4719 97
kaf24@6941 98 long xc_ptrace_core(
kaf24@6941 99 int xc_handle,
kaf24@9660 100 enum __ptrace_request request,
kaf24@9660 101 uint32_t domid,
kaf24@9660 102 long addr,
kaf24@9143 103 long data,
kaf24@9143 104 vcpu_guest_context_t *ctxt);
kaf24@9143 105 void * map_domain_va_core(
kaf24@9660 106 unsigned long domfd,
kaf24@9660 107 int cpu,
kaf24@9143 108 void *guest_va,
kaf24@9143 109 vcpu_guest_context_t *ctxt);
kaf24@6941 110 int xc_waitdomain_core(
kaf24@6941 111 int xc_handle,
kaf24@9660 112 int domain,
kaf24@9660 113 int *status,
kaf24@9143 114 int options,
kaf24@9143 115 vcpu_guest_context_t *ctxt);
kaf24@4719 116
kaf24@4719 117 /*
iap10@3443 118 * DOMAIN MANAGEMENT FUNCTIONS
kaf24@3961 119 */
iap10@3443 120
mjw@1623 121 typedef struct {
kaf24@7378 122 uint32_t domid;
kaf24@7378 123 uint32_t ssidref;
kaf24@9660 124 unsigned int dying:1, crashed:1, shutdown:1,
mjw@1623 125 paused:1, blocked:1, running:1;
mjw@1623 126 unsigned int shutdown_reason; /* only meaningful if shutdown==1 */
mjw@1623 127 unsigned long nr_pages;
mjw@1623 128 unsigned long shared_info_frame;
kaf24@7378 129 uint64_t cpu_time;
mjw@1623 130 unsigned long max_memkb;
kaf24@7397 131 unsigned int nr_online_vcpus;
kaf24@7397 132 unsigned int max_vcpu_id;
kaf24@7378 133 xen_domain_handle_t handle;
mjw@1623 134 } xc_dominfo_t;
mjw@1623 135
kaf24@2787 136 typedef dom0_getdomaininfo_t xc_domaininfo_t;
kaf24@9660 137 int xc_domain_create(int xc_handle,
kaf24@7339 138 uint32_t ssidref,
kaf24@7378 139 xen_domain_handle_t handle,
kaf24@7339 140 uint32_t *pdomid);
iap10@3443 141
kaf24@4719 142
kaf24@9221 143 /* Functions to produce a dump of a given domain
kaf24@9221 144 * xc_domain_dumpcore - produces a dump to a specified file
kaf24@9221 145 * xc_domain_dumpcore_via_callback - produces a dump, using a specified
kaf24@9221 146 * callback function
kaf24@9221 147 */
kaf24@9660 148 int xc_domain_dumpcore(int xc_handle,
kaf24@7339 149 uint32_t domid,
cl349@4853 150 const char *corename);
kaf24@4719 151
kaf24@9221 152 /* Define the callback function type for xc_domain_dumpcore_via_callback.
kaf24@9221 153 *
kaf24@9221 154 * This function is called by the coredump code for every "write",
kaf24@9221 155 * and passes an opaque object for the use of the function and
kaf24@9221 156 * created by the caller of xc_domain_dumpcore_via_callback.
kaf24@9221 157 */
kaf24@9221 158 typedef int (dumpcore_rtn_t)(void *arg, char *buffer, unsigned int length);
kaf24@9221 159
kaf24@9660 160 int xc_domain_dumpcore_via_callback(int xc_handle,
kaf24@9221 161 uint32_t domid,
kaf24@9221 162 void *arg,
kaf24@9221 163 dumpcore_rtn_t dump_rtn);
kaf24@9221 164
kaf24@7354 165 /*
kaf24@7566 166 * This function sets the maximum number of vcpus that a domain may create.
kaf24@7354 167 *
kaf24@7354 168 * @parm xc_handle a handle to an open hypervisor interface.
kaf24@7354 169 * @parm domid the domain id in which vcpus are to be created.
kaf24@7354 170 * @parm max the maximum number of vcpus that the domain may create.
kaf24@7354 171 * @return 0 on success, -1 on failure.
kaf24@7354 172 */
kaf24@7354 173 int xc_domain_max_vcpus(int xc_handle,
kaf24@9660 174 uint32_t domid,
kaf24@7354 175 unsigned int max);
kaf24@4719 176
iap10@3443 177 /**
iap10@3443 178 * This function pauses a domain. A paused domain still exists in memory
iap10@3443 179 * however it does not receive any timeslices from the hypervisor.
iap10@3443 180 *
iap10@3443 181 * @parm xc_handle a handle to an open hypervisor interface
iap10@3443 182 * @parm domid the domain id to pause
iap10@3443 183 * @return 0 on success, -1 on failure.
iap10@3443 184 */
kaf24@9660 185 int xc_domain_pause(int xc_handle,
kaf24@7339 186 uint32_t domid);
iap10@3443 187 /**
iap10@3443 188 * This function unpauses a domain. The domain should have been previously
iap10@3443 189 * paused.
iap10@3443 190 *
iap10@3443 191 * @parm xc_handle a handle to an open hypervisor interface
iap10@3443 192 * @parm domid the domain id to unpause
iap10@3443 193 * return 0 on success, -1 on failure
iap10@3443 194 */
kaf24@9660 195 int xc_domain_unpause(int xc_handle,
kaf24@7339 196 uint32_t domid);
iap10@3443 197
iap10@3443 198 /**
iap10@3443 199 * This function will destroy a domain. Destroying a domain removes the domain
iap10@3443 200 * completely from memory. This function should be called after sending the
iap10@3443 201 * domain a SHUTDOWN control message to free up the domain resources.
iap10@3443 202 *
iap10@3443 203 * @parm xc_handle a handle to an open hypervisor interface
iap10@3443 204 * @parm domid the domain id to destroy
iap10@3443 205 * @return 0 on success, -1 on failure
iap10@3443 206 */
kaf24@9660 207 int xc_domain_destroy(int xc_handle,
kaf24@7339 208 uint32_t domid);
kaf24@8500 209
kaf24@9560 210 /**
kaf24@9560 211 * This function will shutdown a domain. This is intended for use in
kaf24@9560 212 * fully-virtualized domains where this operation is analogous to the
kaf24@9560 213 * sched_op operations in a paravirtualized domain. The caller is
kaf24@9560 214 * expected to give the reason for the shutdown.
kaf24@9560 215 *
kaf24@9560 216 * @parm xc_handle a handle to an open hypervisor interface
kaf24@9560 217 * @parm domid the domain id to destroy
kaf24@9560 218 * @parm reason is the reason (SHUTDOWN_xxx) for the shutdown
kaf24@9560 219 * @return 0 on success, -1 on failure
kaf24@9560 220 */
kaf24@9660 221 int xc_domain_shutdown(int xc_handle,
kaf24@9560 222 uint32_t domid,
kaf24@9560 223 int reason);
kaf24@9560 224
kaf24@8500 225 int xc_vcpu_setaffinity(int xc_handle,
kaf24@8500 226 uint32_t domid,
kaf24@8500 227 int vcpu,
kaf24@8500 228 cpumap_t cpumap);
kaf24@7378 229
iap10@3443 230 /**
dsteklof@5498 231 * This function will return information about one or more domains. It is
dsteklof@5498 232 * designed to iterate over the list of domains. If a single domain is
dsteklof@5498 233 * requested, this function will return the next domain in the list - if
dsteklof@5498 234 * one exists. It is, therefore, important in this case to make sure the
dsteklof@5498 235 * domain requested was the one returned.
iap10@3443 236 *
iap10@3443 237 * @parm xc_handle a handle to an open hypervisor interface
iap10@3443 238 * @parm first_domid the first domain to enumerate information from. Domains
iap10@3443 239 * are currently enumerate in order of creation.
iap10@3443 240 * @parm max_doms the number of elements in info
iap10@3443 241 * @parm info an array of max_doms size that will contain the information for
iap10@3443 242 * the enumerated domains.
iap10@3443 243 * @return the number of domains enumerated or -1 on error
iap10@3443 244 */
mjw@1623 245 int xc_domain_getinfo(int xc_handle,
kaf24@9660 246 uint32_t first_domid,
mjw@1623 247 unsigned int max_doms,
mjw@1623 248 xc_dominfo_t *info);
iap10@3443 249
kaf24@8381 250
kaf24@8381 251 /**
kaf24@8500 252 * This function will set the execution context for the specified vcpu.
kaf24@8381 253 *
kaf24@8381 254 * @parm xc_handle a handle to an open hypervisor interface
kaf24@8381 255 * @parm domid the domain to set the vcpu context for
kaf24@8381 256 * @parm vcpu the vcpu number for the context
kaf24@8381 257 * @parm ctxt pointer to the the cpu context with the values to set
kaf24@8381 258 * @return the number of domains enumerated or -1 on error
kaf24@8381 259 */
kaf24@8500 260 int xc_vcpu_setcontext(int xc_handle,
kaf24@8500 261 uint32_t domid,
kaf24@8500 262 uint32_t vcpu,
kaf24@8500 263 vcpu_guest_context_t *ctxt);
iap10@3443 264 /**
kaf24@5699 265 * This function will return information about one or more domains, using a
kaf24@5699 266 * single hypercall. The domain information will be stored into the supplied
kaf24@5699 267 * array of xc_domaininfo_t structures.
kaf24@5699 268 *
kaf24@5699 269 * @parm xc_handle a handle to an open hypervisor interface
kaf24@5699 270 * @parm first_domain the first domain to enumerate information from.
kaf24@5699 271 * Domains are currently enumerate in order of creation.
kaf24@5699 272 * @parm max_domains the number of elements in info
kaf24@5699 273 * @parm info an array of max_doms size that will contain the information for
kaf24@5699 274 * the enumerated domains.
kaf24@5699 275 * @return the number of domains enumerated or -1 on error
kaf24@5699 276 */
kaf24@5699 277 int xc_domain_getinfolist(int xc_handle,
kaf24@7339 278 uint32_t first_domain,
kaf24@5699 279 unsigned int max_domains,
kaf24@5699 280 xc_domaininfo_t *info);
kaf24@5699 281
kaf24@5699 282 /**
emellor@7404 283 * This function returns information about the execution context of a
emellor@7404 284 * particular vcpu of a domain.
iap10@3443 285 *
iap10@3443 286 * @parm xc_handle a handle to an open hypervisor interface
iap10@3443 287 * @parm domid the domain to get information from
emellor@7404 288 * @parm vcpu the vcpu number
iap10@3443 289 * @parm ctxt a pointer to a structure to store the execution context of the
iap10@3443 290 * domain
iap10@3443 291 * @return 0 on success, -1 on failure
iap10@3443 292 */
kaf24@8500 293 int xc_vcpu_getcontext(int xc_handle,
kaf24@7339 294 uint32_t domid,
kaf24@7339 295 uint32_t vcpu,
cl349@4853 296 vcpu_guest_context_t *ctxt);
cl349@4849 297
kaf24@7397 298 typedef dom0_getvcpuinfo_t xc_vcpuinfo_t;
kaf24@8500 299 int xc_vcpu_getinfo(int xc_handle,
kaf24@8500 300 uint32_t domid,
kaf24@8500 301 uint32_t vcpu,
kaf24@8500 302 xc_vcpuinfo_t *info);
kaf24@7397 303
gm281@2236 304 int xc_domain_setcpuweight(int xc_handle,
kaf24@7339 305 uint32_t domid,
gm281@2236 306 float weight);
kaf24@2787 307 long long xc_domain_get_cpu_usage(int xc_handle,
mafetter@3435 308 domid_t domid,
mafetter@3435 309 int vcpu);
mjw@1623 310
kaf24@9660 311 int xc_domain_sethandle(int xc_handle, uint32_t domid,
kaf24@7379 312 xen_domain_handle_t handle);
kaf24@2787 313
kaf24@2787 314 typedef dom0_shadow_control_stats_t xc_shadow_control_stats_t;
mjw@1623 315 int xc_shadow_control(int xc_handle,
kaf24@9660 316 uint32_t domid,
mjw@1623 317 unsigned int sop,
mjw@1623 318 unsigned long *dirty_bitmap,
mjw@1623 319 unsigned long pages,
mjw@1623 320 xc_shadow_control_stats_t *stats);
mjw@1623 321
mjw@1623 322 int xc_bvtsched_global_set(int xc_handle,
mjw@1623 323 unsigned long ctx_allow);
mjw@1623 324
mjw@1623 325 int xc_bvtsched_domain_set(int xc_handle,
kaf24@7339 326 uint32_t domid,
kaf24@7339 327 uint32_t mcuadv,
gm281@2058 328 int warpback,
kaf24@7339 329 int32_t warpvalue,
gm281@2058 330 long long warpl,
gm281@2058 331 long long warpu);
mjw@1623 332
mjw@1623 333 int xc_bvtsched_global_get(int xc_handle,
mjw@1623 334 unsigned long *ctx_allow);
mjw@1623 335
mjw@1623 336 int xc_bvtsched_domain_get(int xc_handle,
kaf24@7339 337 uint32_t domid,
kaf24@7339 338 uint32_t *mcuadv,
gm281@2058 339 int *warpback,
kaf24@7339 340 int32_t *warpvalue,
gm281@2058 341 long long *warpl,
gm281@2058 342 long long *warpu);
mjw@1623 343
sd386@3449 344 int xc_sedf_domain_set(int xc_handle,
kaf24@7339 345 uint32_t domid,
kaf24@7339 346 uint64_t period, uint64_t slice,
kaf24@7339 347 uint64_t latency, uint16_t extratime,
kaf24@7339 348 uint16_t weight);
sd386@3449 349
sd386@3449 350 int xc_sedf_domain_get(int xc_handle,
kaf24@7339 351 uint32_t domid,
kaf24@7339 352 uint64_t* period, uint64_t *slice,
kaf24@7339 353 uint64_t *latency, uint16_t *extratime,
kaf24@7339 354 uint16_t *weight);
sd386@3449 355
kaf24@2787 356 typedef evtchn_status_t xc_evtchn_status_t;
iap10@3443 357
kaf24@3961 358 /*
iap10@3443 359 * EVENT CHANNEL FUNCTIONS
kaf24@3961 360 */
iap10@3443 361
iap10@3443 362 /**
iap10@3443 363 * This function allocates an unbound port. Ports are named endpoints used for
iap10@3443 364 * interdomain communication. This function is most useful in opening a
iap10@3443 365 * well-known port within a domain to receive events on.
iap10@3443 366 *
iap10@3443 367 * @parm xc_handle a handle to an open hypervisor interface
kaf24@7223 368 * @parm dom the ID of the local domain (the 'allocatee')
kaf24@7237 369 * @parm remote_dom the ID of the domain who will later bind
kaf24@7237 370 * @return allocated port (in @dom) on success, -1 on failure
iap10@3443 371 */
kaf24@2713 372 int xc_evtchn_alloc_unbound(int xc_handle,
kaf24@7339 373 uint32_t dom,
kaf24@7339 374 uint32_t remote_dom);
iap10@3443 375
mjw@1623 376 int xc_evtchn_status(int xc_handle,
kaf24@7339 377 uint32_t dom, /* may be DOMID_SELF */
kaf24@8151 378 evtchn_port_t port,
mjw@1623 379 xc_evtchn_status_t *status);
mjw@1623 380
mjw@1623 381 int xc_physdev_pci_access_modify(int xc_handle,
kaf24@7339 382 uint32_t domid,
mjw@1623 383 int bus,
mjw@1623 384 int dev,
mjw@1623 385 int func,
mjw@1623 386 int enable);
mjw@1623 387
mjw@1623 388 int xc_readconsolering(int xc_handle,
kaf24@5327 389 char **pbuffer,
kaf24@9660 390 unsigned int *pnr_chars,
mjw@1623 391 int clear);
mjw@1623 392
kaf24@2787 393 typedef dom0_physinfo_t xc_physinfo_t;
mjw@1623 394 int xc_physinfo(int xc_handle,
mjw@1623 395 xc_physinfo_t *info);
mjw@1623 396
gm281@2236 397 int xc_sched_id(int xc_handle,
gm281@2236 398 int *sched_id);
gm281@2236 399
mjw@1623 400 int xc_domain_setmaxmem(int xc_handle,
kaf24@9660 401 uint32_t domid,
kaf24@3231 402 unsigned int max_memkb);
mjw@1623 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@9221 409 unsigned long *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@9221 415 unsigned long *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@8856 422 unsigned long *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@8856 427 unsigned long *gpfn_list,
kaf24@8856 428 unsigned long *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@9660 447 unsigned long xc_make_page_below_4G(int xc_handle, uint32_t domid,
kaf24@9221 448 unsigned long mfn);
cl349@5045 449
kaf24@3231 450 typedef dom0_perfc_desc_t xc_perfc_desc_t;
kaf24@3231 451 /* IMPORTANT: The caller is responsible for mlock()'ing the @desc array. */
kaf24@3231 452 int xc_perfc_control(int xc_handle,
kaf24@7339 453 uint32_t op,
kaf24@3231 454 xc_perfc_desc_t *desc);
mjw@1623 455
rneugeba@3963 456 /* read/write msr */
rneugeba@3963 457 long long xc_msr_read(int xc_handle, int cpu_mask, int msr);
rneugeba@3963 458 int xc_msr_write(int xc_handle, int cpu_mask, int msr, unsigned int low,
rneugeba@3963 459 unsigned int high);
rneugeba@3963 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,
iap10@2325 481 unsigned long *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@9660 496 int xc_get_pfn_list(int xc_handle, uint32_t domid, unsigned long *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@9660 500 unsigned long *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
djm@7536 509 int xc_ia64_copy_to_domain_pages(int xc_handle, uint32_t domid,
djm@7536 510 void* src_page, unsigned long dst_pfn, int nr_pages);
djm@7536 511
kaf24@7339 512 long xc_get_max_pages(int xc_handle, uint32_t domid);
djm@6856 513
cl349@6389 514 int xc_mmuext_op(int xc_handle, struct mmuext_op *op, unsigned int nr_ops,
kaf24@9221 515 domid_t dom);
cl349@6389 516
kaf24@6468 517 int xc_memory_op(int xc_handle, int cmd, void *arg);
cl349@6389 518
kaf24@7339 519 int xc_get_pfn_type_batch(int xc_handle, uint32_t dom,
kaf24@7339 520 int num, unsigned long *arr);
cl349@6389 521
cl349@6389 522
kaf24@5318 523 /* Get current total pages allocated to a domain. */
kaf24@7339 524 long xc_get_tot_pages(int xc_handle, uint32_t domid);
kaf24@5318 525
kaf24@7566 526
kaf24@7566 527 /*
kaf24@7566 528 * Trace Buffer Operations
kaf24@7566 529 */
kaf24@7566 530
kaf24@7566 531 /**
kaf24@9996 532 * xc_tbuf_enable - enable tracing buffers
kaf24@7566 533 *
kaf24@7566 534 * @parm xc_handle a handle to an open hypervisor interface
kaf24@9996 535 * @parm cnt size of tracing buffers to create (in pages)
kaf24@9996 536 * @parm mfn location to store mfn of the trace buffers to
kaf24@9996 537 * @parm size location to store the size (in bytes) of a trace buffer to
kaf24@9996 538 *
kaf24@9996 539 * Gets the machine address of the trace pointer area and the size of the
kaf24@9996 540 * per CPU buffers.
kaf24@7566 541 */
kaf24@9996 542 int xc_tbuf_enable(int xc_handle, size_t cnt, unsigned long *mfn,
kaf24@9996 543 unsigned long *size);
kaf24@9996 544
kaf24@9996 545 /*
kaf24@9996 546 * Disable tracing buffers.
kaf24@9996 547 */
kaf24@9996 548 int xc_tbuf_disable(int xc_handle);
kaf24@7566 549
kaf24@7566 550 /**
kaf24@7571 551 * This function sets the size of the trace buffers. Setting the size
kaf24@7571 552 * is currently a one-shot operation that may be performed either at boot
kaf24@7571 553 * time or via this interface, not both. The buffer size must be set before
kaf24@7571 554 * enabling tracing.
kaf24@7566 555 *
kaf24@7566 556 * @parm xc_handle a handle to an open hypervisor interface
kaf24@7566 557 * @parm size the size in pages per cpu for the trace buffers
kaf24@7566 558 * @return 0 on success, -1 on failure.
kaf24@7566 559 */
kaf24@9996 560 int xc_tbuf_set_size(int xc_handle, unsigned long size);
kaf24@7566 561
kaf24@7566 562 /**
kaf24@9660 563 * This function retrieves the current size of the trace buffers.
kaf24@7566 564 * Note that the size returned is in terms of bytes, not pages.
kaf24@7566 565
kaf24@7566 566 * @parm xc_handle a handle to an open hypervisor interface
kaf24@7566 567 * @parm size will contain the size in bytes for the trace buffers
kaf24@7566 568 * @return 0 on success, -1 on failure.
kaf24@7566 569 */
kaf24@9996 570 int xc_tbuf_get_size(int xc_handle, unsigned long *size);
kaf24@9907 571
kaf24@9907 572 int xc_tbuf_set_cpu_mask(int xc_handle, uint32_t mask);
kaf24@9907 573
kaf24@9907 574 int xc_tbuf_set_evt_mask(int xc_handle, uint32_t mask);
kaf24@7566 575
kaf24@5318 576 /* Execute a privileged dom0 operation. */
kaf24@5318 577 int xc_dom0_op(int xc_handle, dom0_op_t *op);
cwc22@3985 578
vh249@6549 579 int xc_version(int xc_handle, int cmd, void *arg);
vh249@6549 580
cl349@6389 581 /*
cl349@6389 582 * MMU updates.
cl349@6389 583 */
cl349@6389 584 #define MAX_MMU_UPDATES 1024
cl349@6389 585 struct xc_mmu {
cl349@6389 586 mmu_update_t updates[MAX_MMU_UPDATES];
cl349@6389 587 int idx;
cl349@6389 588 domid_t subject;
cl349@6389 589 };
cl349@6389 590 typedef struct xc_mmu xc_mmu_t;
cl349@6389 591 xc_mmu_t *xc_init_mmu_updates(int xc_handle, domid_t dom);
kaf24@9660 592 int xc_add_mmu_update(int xc_handle, xc_mmu_t *mmu,
iap10@6680 593 unsigned long long ptr, unsigned long long val);
cl349@6389 594 int xc_finish_mmu_updates(int xc_handle, xc_mmu_t *mmu);
cl349@6389 595
kaf24@9907 596 int xc_acm_op(int xc_handle, struct acm_op *op);
kaf24@9907 597
cl349@6389 598 #endif