direct-io.hg

annotate tools/libxc/xenctrl.h @ 8686:c0a0f4db5ab1

Create a block of reserved PFNs in shadow translate mode guests, and
move the shared info and grant table pfns into that block. This
allows us to remove the get_gnttablist dom0 op, and simplifies the
domain creation code slightly. Having the reserved block managed by
Xen may also make it slightly easier to handle the case where the
grant table needs to be extended at run time.

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