direct-io.hg

view tools/libxc/xenctrl.h @ 14296:f40b13ed0e05

Fix duplicate consts around xc_error declarations.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
author Ewan Mellor <ewan@xensource.com>
date Thu Mar 08 22:33:47 2007 +0000 (2007-03-08)
parents 270a5e2ead43
children 7ab04fa25d52
line source
1 /******************************************************************************
2 * xenctrl.h
3 *
4 * A library for low-level access to the Xen control interfaces.
5 *
6 * Copyright (c) 2003-2004, K A Fraser.
7 */
9 #ifndef XENCTRL_H
10 #define XENCTRL_H
12 /* Tell the Xen public headers we are a user-space tools build. */
13 #ifndef __XEN_TOOLS__
14 #define __XEN_TOOLS__ 1
15 #endif
17 #include <stddef.h>
18 #include <stdint.h>
19 #include <xen/xen.h>
20 #include <xen/domctl.h>
21 #include <xen/sysctl.h>
22 #include <xen/version.h>
23 #include <xen/event_channel.h>
24 #include <xen/sched.h>
25 #include <xen/memory.h>
26 #include <xen/acm.h>
27 #include <xen/acm_ops.h>
29 #ifdef __ia64__
30 #define XC_PAGE_SHIFT 14
31 #else
32 #define XC_PAGE_SHIFT 12
33 #endif
34 #define XC_PAGE_SIZE (1UL << XC_PAGE_SHIFT)
35 #define XC_PAGE_MASK (~(XC_PAGE_SIZE-1))
37 /*
38 * DEFINITIONS FOR CPU BARRIERS
39 */
41 #if defined(__i386__)
42 #define mb() __asm__ __volatile__ ( "lock; addl $0,0(%%esp)" : : : "memory" )
43 #define rmb() __asm__ __volatile__ ( "lock; addl $0,0(%%esp)" : : : "memory" )
44 #define wmb() __asm__ __volatile__ ( "" : : : "memory")
45 #elif defined(__x86_64__)
46 #define mb() __asm__ __volatile__ ( "mfence" : : : "memory")
47 #define rmb() __asm__ __volatile__ ( "lfence" : : : "memory")
48 #define wmb() __asm__ __volatile__ ( "" : : : "memory")
49 #elif defined(__ia64__)
50 #define mb() __asm__ __volatile__ ("mf" ::: "memory")
51 #define rmb() __asm__ __volatile__ ("mf" ::: "memory")
52 #define wmb() __asm__ __volatile__ ("mf" ::: "memory")
53 #elif defined(__powerpc__)
54 /* XXX loosen these up later */
55 #define mb() __asm__ __volatile__ ("sync" : : : "memory")
56 #define rmb() __asm__ __volatile__ ("sync" : : : "memory") /* lwsync? */
57 #define wmb() __asm__ __volatile__ ("sync" : : : "memory") /* eieio? */
58 #else
59 #error "Define barriers"
60 #endif
62 /*
63 * INITIALIZATION FUNCTIONS
64 */
66 /**
67 * This function opens a handle to the hypervisor interface. This function can
68 * be called multiple times within a single process. Multiple processes can
69 * have an open hypervisor interface at the same time.
70 *
71 * Each call to this function should have a corresponding call to
72 * xc_interface_close().
73 *
74 * This function can fail if the caller does not have superuser permission or
75 * if a Xen-enabled kernel is not currently running.
76 *
77 * @return a handle to the hypervisor interface or -1 on failure
78 */
79 int xc_interface_open(void);
81 /**
82 * This function closes an open hypervisor interface.
83 *
84 * This function can fail if the handle does not represent an open interface or
85 * if there were problems closing the interface.
86 *
87 * @parm xc_handle a handle to an open hypervisor interface
88 * @return 0 on success, -1 otherwise.
89 */
90 int xc_interface_close(int xc_handle);
92 /*
93 * KERNEL INTERFACES
94 */
96 /*
97 * Resolve a kernel device name (e.g., "evtchn", "blktap0") into a kernel
98 * device number. Returns -1 on error (and sets errno).
99 */
100 int xc_find_device_number(const char *name);
102 /*
103 * DOMAIN DEBUGGING FUNCTIONS
104 */
106 typedef struct xc_core_header {
107 unsigned int xch_magic;
108 unsigned int xch_nr_vcpus;
109 unsigned int xch_nr_pages;
110 unsigned int xch_ctxt_offset;
111 unsigned int xch_index_offset;
112 unsigned int xch_pages_offset;
113 } xc_core_header_t;
115 #define XC_CORE_MAGIC 0xF00FEBED
116 #define XC_CORE_MAGIC_HVM 0xF00FEBEE
118 #ifdef __linux__
120 #include <sys/ptrace.h>
121 #include <thread_db.h>
123 typedef void (*thr_ev_handler_t)(long);
125 void xc_register_event_handler(
126 thr_ev_handler_t h,
127 td_event_e e);
129 long xc_ptrace(
130 int xc_handle,
131 enum __ptrace_request request,
132 uint32_t domid,
133 long addr,
134 long data);
136 int xc_waitdomain(
137 int xc_handle,
138 int domain,
139 int *status,
140 int options);
142 #endif /* __linux__ */
144 /*
145 * DOMAIN MANAGEMENT FUNCTIONS
146 */
148 typedef struct xc_dominfo {
149 uint32_t domid;
150 uint32_t ssidref;
151 unsigned int dying:1, crashed:1, shutdown:1,
152 paused:1, blocked:1, running:1,
153 hvm:1;
154 unsigned int shutdown_reason; /* only meaningful if shutdown==1 */
155 unsigned long nr_pages;
156 unsigned long shared_info_frame;
157 uint64_t cpu_time;
158 unsigned long max_memkb;
159 unsigned int nr_online_vcpus;
160 unsigned int max_vcpu_id;
161 xen_domain_handle_t handle;
162 } xc_dominfo_t;
164 typedef xen_domctl_getdomaininfo_t xc_domaininfo_t;
165 int xc_domain_create(int xc_handle,
166 uint32_t ssidref,
167 xen_domain_handle_t handle,
168 uint32_t flags,
169 uint32_t *pdomid);
172 /* Functions to produce a dump of a given domain
173 * xc_domain_dumpcore - produces a dump to a specified file
174 * xc_domain_dumpcore_via_callback - produces a dump, using a specified
175 * callback function
176 */
177 int xc_domain_dumpcore(int xc_handle,
178 uint32_t domid,
179 const char *corename);
181 /* Define the callback function type for xc_domain_dumpcore_via_callback.
182 *
183 * This function is called by the coredump code for every "write",
184 * and passes an opaque object for the use of the function and
185 * created by the caller of xc_domain_dumpcore_via_callback.
186 */
187 typedef int (dumpcore_rtn_t)(void *arg, char *buffer, unsigned int length);
189 int xc_domain_dumpcore_via_callback(int xc_handle,
190 uint32_t domid,
191 void *arg,
192 dumpcore_rtn_t dump_rtn);
194 /*
195 * This function sets the maximum number of vcpus that a domain may create.
196 *
197 * @parm xc_handle a handle to an open hypervisor interface.
198 * @parm domid the domain id in which vcpus are to be created.
199 * @parm max the maximum number of vcpus that the domain may create.
200 * @return 0 on success, -1 on failure.
201 */
202 int xc_domain_max_vcpus(int xc_handle,
203 uint32_t domid,
204 unsigned int max);
206 /**
207 * This function pauses a domain. A paused domain still exists in memory
208 * however it does not receive any timeslices from the hypervisor.
209 *
210 * @parm xc_handle a handle to an open hypervisor interface
211 * @parm domid the domain id to pause
212 * @return 0 on success, -1 on failure.
213 */
214 int xc_domain_pause(int xc_handle,
215 uint32_t domid);
216 /**
217 * This function unpauses a domain. The domain should have been previously
218 * paused.
219 *
220 * @parm xc_handle a handle to an open hypervisor interface
221 * @parm domid the domain id to unpause
222 * return 0 on success, -1 on failure
223 */
224 int xc_domain_unpause(int xc_handle,
225 uint32_t domid);
227 /**
228 * This function will destroy a domain. Destroying a domain removes the domain
229 * completely from memory. This function should be called after sending the
230 * domain a SHUTDOWN control message to free up the domain resources.
231 *
232 * @parm xc_handle a handle to an open hypervisor interface
233 * @parm domid the domain id to destroy
234 * @return 0 on success, -1 on failure
235 */
236 int xc_domain_destroy(int xc_handle,
237 uint32_t domid);
240 /**
241 * This function resumes a suspended domain. The domain should have
242 * been previously suspended.
243 *
244 * @parm xc_handle a handle to an open hypervisor interface
245 * @parm domid the domain id to resume
246 * @parm fast use cooperative resume (guest must support this)
247 * return 0 on success, -1 on failure
248 */
249 int xc_domain_resume(int xc_handle,
250 uint32_t domid,
251 int fast);
253 /**
254 * This function will shutdown a domain. This is intended for use in
255 * fully-virtualized domains where this operation is analogous to the
256 * sched_op operations in a paravirtualized domain. The caller is
257 * expected to give the reason for the shutdown.
258 *
259 * @parm xc_handle a handle to an open hypervisor interface
260 * @parm domid the domain id to destroy
261 * @parm reason is the reason (SHUTDOWN_xxx) for the shutdown
262 * @return 0 on success, -1 on failure
263 */
264 int xc_domain_shutdown(int xc_handle,
265 uint32_t domid,
266 int reason);
268 int xc_vcpu_setaffinity(int xc_handle,
269 uint32_t domid,
270 int vcpu,
271 uint64_t cpumap);
272 int xc_vcpu_getaffinity(int xc_handle,
273 uint32_t domid,
274 int vcpu,
275 uint64_t *cpumap);
277 /**
278 * This function will return information about one or more domains. It is
279 * designed to iterate over the list of domains. If a single domain is
280 * requested, this function will return the next domain in the list - if
281 * one exists. It is, therefore, important in this case to make sure the
282 * domain requested was the one returned.
283 *
284 * @parm xc_handle a handle to an open hypervisor interface
285 * @parm first_domid the first domain to enumerate information from. Domains
286 * are currently enumerate in order of creation.
287 * @parm max_doms the number of elements in info
288 * @parm info an array of max_doms size that will contain the information for
289 * the enumerated domains.
290 * @return the number of domains enumerated or -1 on error
291 */
292 int xc_domain_getinfo(int xc_handle,
293 uint32_t first_domid,
294 unsigned int max_doms,
295 xc_dominfo_t *info);
298 /**
299 * This function will set the execution context for the specified vcpu.
300 *
301 * @parm xc_handle a handle to an open hypervisor interface
302 * @parm domid the domain to set the vcpu context for
303 * @parm vcpu the vcpu number for the context
304 * @parm ctxt pointer to the the cpu context with the values to set
305 * @return the number of domains enumerated or -1 on error
306 */
307 int xc_vcpu_setcontext(int xc_handle,
308 uint32_t domid,
309 uint32_t vcpu,
310 vcpu_guest_context_t *ctxt);
311 /**
312 * This function will return information about one or more domains, using a
313 * single hypercall. The domain information will be stored into the supplied
314 * array of xc_domaininfo_t structures.
315 *
316 * @parm xc_handle a handle to an open hypervisor interface
317 * @parm first_domain the first domain to enumerate information from.
318 * Domains are currently enumerate in order of creation.
319 * @parm max_domains the number of elements in info
320 * @parm info an array of max_doms size that will contain the information for
321 * the enumerated domains.
322 * @return the number of domains enumerated or -1 on error
323 */
324 int xc_domain_getinfolist(int xc_handle,
325 uint32_t first_domain,
326 unsigned int max_domains,
327 xc_domaininfo_t *info);
329 /**
330 * This function returns information about the context of a hvm domain
331 * @parm xc_handle a handle to an open hypervisor interface
332 * @parm domid the domain to get information from
333 * @parm ctxt_buf a pointer to a structure to store the execution context of
334 * the hvm domain
335 * @parm size the size of ctxt_buf in bytes
336 * @return 0 on success, -1 on failure
337 */
338 int xc_domain_hvm_getcontext(int xc_handle,
339 uint32_t domid,
340 uint8_t *ctxt_buf,
341 uint32_t size);
343 /**
344 * This function will set the context for hvm domain
345 *
346 * @parm xc_handle a handle to an open hypervisor interface
347 * @parm domid the domain to set the hvm domain context for
348 * @parm hvm_ctxt pointer to the the hvm context with the values to set
349 * @parm size the size of hvm_ctxt in bytes
350 * @return 0 on success, -1 on failure
351 */
352 int xc_domain_hvm_setcontext(int xc_handle,
353 uint32_t domid,
354 uint8_t *hvm_ctxt,
355 uint32_t size);
357 /**
358 * This function returns information about the execution context of a
359 * particular vcpu of a domain.
360 *
361 * @parm xc_handle a handle to an open hypervisor interface
362 * @parm domid the domain to get information from
363 * @parm vcpu the vcpu number
364 * @parm ctxt a pointer to a structure to store the execution context of the
365 * domain
366 * @return 0 on success, -1 on failure
367 */
368 int xc_vcpu_getcontext(int xc_handle,
369 uint32_t domid,
370 uint32_t vcpu,
371 vcpu_guest_context_t *ctxt);
373 typedef xen_domctl_getvcpuinfo_t xc_vcpuinfo_t;
374 int xc_vcpu_getinfo(int xc_handle,
375 uint32_t domid,
376 uint32_t vcpu,
377 xc_vcpuinfo_t *info);
379 int xc_domain_setcpuweight(int xc_handle,
380 uint32_t domid,
381 float weight);
382 long long xc_domain_get_cpu_usage(int xc_handle,
383 domid_t domid,
384 int vcpu);
386 int xc_domain_sethandle(int xc_handle, uint32_t domid,
387 xen_domain_handle_t handle);
389 typedef xen_domctl_shadow_op_stats_t xc_shadow_op_stats_t;
390 int xc_shadow_control(int xc_handle,
391 uint32_t domid,
392 unsigned int sop,
393 unsigned long *dirty_bitmap,
394 unsigned long pages,
395 unsigned long *mb,
396 uint32_t mode,
397 xc_shadow_op_stats_t *stats);
399 int xc_sedf_domain_set(int xc_handle,
400 uint32_t domid,
401 uint64_t period, uint64_t slice,
402 uint64_t latency, uint16_t extratime,
403 uint16_t weight);
405 int xc_sedf_domain_get(int xc_handle,
406 uint32_t domid,
407 uint64_t* period, uint64_t *slice,
408 uint64_t *latency, uint16_t *extratime,
409 uint16_t *weight);
411 int xc_sched_credit_domain_set(int xc_handle,
412 uint32_t domid,
413 struct xen_domctl_sched_credit *sdom);
415 int xc_sched_credit_domain_get(int xc_handle,
416 uint32_t domid,
417 struct xen_domctl_sched_credit *sdom);
419 /**
420 * This function sends a trigger to a domain.
421 *
422 * @parm xc_handle a handle to an open hypervisor interface
423 * @parm domid the domain id to send trigger
424 * @parm trigger the trigger type
425 * @parm vcpu the vcpu number to send trigger
426 * return 0 on success, -1 on failure
427 */
428 int xc_domain_send_trigger(int xc_handle,
429 uint32_t domid,
430 uint32_t trigger,
431 uint32_t vcpu);
433 /*
434 * EVENT CHANNEL FUNCTIONS
435 */
437 /**
438 * This function allocates an unbound port. Ports are named endpoints used for
439 * interdomain communication. This function is most useful in opening a
440 * well-known port within a domain to receive events on.
441 *
442 * NOTE: If you are allocating a *local* unbound port, you probably want to
443 * use xc_evtchn_bind_unbound_port(). This function is intended for allocating
444 * ports *only* during domain creation.
445 *
446 * @parm xc_handle a handle to an open hypervisor interface
447 * @parm dom the ID of the local domain (the 'allocatee')
448 * @parm remote_dom the ID of the domain who will later bind
449 * @return allocated port (in @dom) on success, -1 on failure
450 */
451 int xc_evtchn_alloc_unbound(int xc_handle,
452 uint32_t dom,
453 uint32_t remote_dom);
455 int xc_evtchn_reset(int xc_handle,
456 uint32_t dom);
458 int xc_physdev_pci_access_modify(int xc_handle,
459 uint32_t domid,
460 int bus,
461 int dev,
462 int func,
463 int enable);
465 int xc_readconsolering(int xc_handle,
466 char **pbuffer,
467 unsigned int *pnr_chars,
468 int clear);
470 typedef xen_sysctl_physinfo_t xc_physinfo_t;
471 int xc_physinfo(int xc_handle,
472 xc_physinfo_t *info);
474 int xc_sched_id(int xc_handle,
475 int *sched_id);
477 int xc_domain_setmaxmem(int xc_handle,
478 uint32_t domid,
479 unsigned int max_memkb);
481 int xc_domain_set_memmap_limit(int xc_handle,
482 uint32_t domid,
483 unsigned long map_limitkb);
485 int xc_domain_set_time_offset(int xc_handle,
486 uint32_t domid,
487 int32_t time_offset_seconds);
489 int xc_domain_memory_increase_reservation(int xc_handle,
490 uint32_t domid,
491 unsigned long nr_extents,
492 unsigned int extent_order,
493 unsigned int address_bits,
494 xen_pfn_t *extent_start);
496 int xc_domain_memory_decrease_reservation(int xc_handle,
497 uint32_t domid,
498 unsigned long nr_extents,
499 unsigned int extent_order,
500 xen_pfn_t *extent_start);
502 int xc_domain_memory_populate_physmap(int xc_handle,
503 uint32_t domid,
504 unsigned long nr_extents,
505 unsigned int extent_order,
506 unsigned int address_bits,
507 xen_pfn_t *extent_start);
509 int xc_domain_ioport_permission(int xc_handle,
510 uint32_t domid,
511 uint32_t first_port,
512 uint32_t nr_ports,
513 uint32_t allow_access);
515 int xc_domain_irq_permission(int xc_handle,
516 uint32_t domid,
517 uint8_t pirq,
518 uint8_t allow_access);
520 int xc_domain_iomem_permission(int xc_handle,
521 uint32_t domid,
522 unsigned long first_mfn,
523 unsigned long nr_mfns,
524 uint8_t allow_access);
526 unsigned long xc_make_page_below_4G(int xc_handle, uint32_t domid,
527 unsigned long mfn);
529 typedef xen_sysctl_perfc_desc_t xc_perfc_desc_t;
530 typedef xen_sysctl_perfc_val_t xc_perfc_val_t;
531 /* IMPORTANT: The caller is responsible for mlock()'ing the @desc and @val
532 arrays. */
533 int xc_perfc_control(int xc_handle,
534 uint32_t op,
535 xc_perfc_desc_t *desc,
536 xc_perfc_val_t *val,
537 int *nbr_desc,
538 int *nbr_val);
540 /**
541 * Memory maps a range within one domain to a local address range. Mappings
542 * should be unmapped with munmap and should follow the same rules as mmap
543 * regarding page alignment. Returns NULL on failure.
544 *
545 * In Linux, the ring queue for the control channel is accessible by mapping
546 * the shared_info_frame (from xc_domain_getinfo()) + 2048. The structure
547 * stored there is of type control_if_t.
548 *
549 * @parm xc_handle a handle on an open hypervisor interface
550 * @parm dom the domain to map memory from
551 * @parm size the amount of memory to map (in multiples of page size)
552 * @parm prot same flag as in mmap().
553 * @parm mfn the frame address to map.
554 */
555 void *xc_map_foreign_range(int xc_handle, uint32_t dom,
556 int size, int prot,
557 unsigned long mfn );
559 void *xc_map_foreign_batch(int xc_handle, uint32_t dom, int prot,
560 xen_pfn_t *arr, int num );
562 /**
563 * Translates a virtual address in the context of a given domain and
564 * vcpu returning the machine page frame number of the associated
565 * page.
566 *
567 * @parm xc_handle a handle on an open hypervisor interface
568 * @parm dom the domain to perform the translation in
569 * @parm vcpu the vcpu to perform the translation on
570 * @parm virt the virtual address to translate
571 */
572 unsigned long xc_translate_foreign_address(int xc_handle, uint32_t dom,
573 int vcpu, unsigned long long virt);
576 /**
577 * DEPRECATED. Avoid using this, as it does not correctly account for PFNs
578 * without a backing MFN.
579 */
580 int xc_get_pfn_list(int xc_handle, uint32_t domid, uint64_t *pfn_buf,
581 unsigned long max_pfns);
583 unsigned long xc_ia64_fpsr_default(void);
585 int xc_ia64_get_pfn_list(int xc_handle, uint32_t domid,
586 xen_pfn_t *pfn_buf,
587 unsigned int start_page, unsigned int nr_pages);
589 int xc_copy_to_domain_page(int xc_handle, uint32_t domid,
590 unsigned long dst_pfn, const char *src_page);
592 int xc_clear_domain_page(int xc_handle, uint32_t domid,
593 unsigned long dst_pfn);
595 long xc_get_max_pages(int xc_handle, uint32_t domid);
597 int xc_mmuext_op(int xc_handle, struct mmuext_op *op, unsigned int nr_ops,
598 domid_t dom);
600 int xc_memory_op(int xc_handle, int cmd, void *arg);
602 int xc_get_pfn_type_batch(int xc_handle, uint32_t dom,
603 int num, uint32_t *arr);
606 /* Get current total pages allocated to a domain. */
607 long xc_get_tot_pages(int xc_handle, uint32_t domid);
610 /*
611 * Trace Buffer Operations
612 */
614 /**
615 * xc_tbuf_enable - enable tracing buffers
616 *
617 * @parm xc_handle a handle to an open hypervisor interface
618 * @parm cnt size of tracing buffers to create (in pages)
619 * @parm mfn location to store mfn of the trace buffers to
620 * @parm size location to store the size (in bytes) of a trace buffer to
621 *
622 * Gets the machine address of the trace pointer area and the size of the
623 * per CPU buffers.
624 */
625 int xc_tbuf_enable(int xc_handle, unsigned long pages,
626 unsigned long *mfn, unsigned long *size);
628 /*
629 * Disable tracing buffers.
630 */
631 int xc_tbuf_disable(int xc_handle);
633 /**
634 * This function sets the size of the trace buffers. Setting the size
635 * is currently a one-shot operation that may be performed either at boot
636 * time or via this interface, not both. The buffer size must be set before
637 * enabling tracing.
638 *
639 * @parm xc_handle a handle to an open hypervisor interface
640 * @parm size the size in pages per cpu for the trace buffers
641 * @return 0 on success, -1 on failure.
642 */
643 int xc_tbuf_set_size(int xc_handle, unsigned long size);
645 /**
646 * This function retrieves the current size of the trace buffers.
647 * Note that the size returned is in terms of bytes, not pages.
649 * @parm xc_handle a handle to an open hypervisor interface
650 * @parm size will contain the size in bytes for the trace buffers
651 * @return 0 on success, -1 on failure.
652 */
653 int xc_tbuf_get_size(int xc_handle, unsigned long *size);
655 int xc_tbuf_set_cpu_mask(int xc_handle, uint32_t mask);
657 int xc_tbuf_set_evt_mask(int xc_handle, uint32_t mask);
659 int xc_domctl(int xc_handle, struct xen_domctl *domctl);
660 int xc_sysctl(int xc_handle, struct xen_sysctl *sysctl);
662 int xc_version(int xc_handle, int cmd, void *arg);
664 /*
665 * MMU updates.
666 */
667 #define MAX_MMU_UPDATES 1024
668 struct xc_mmu {
669 mmu_update_t updates[MAX_MMU_UPDATES];
670 int idx;
671 domid_t subject;
672 };
673 typedef struct xc_mmu xc_mmu_t;
674 xc_mmu_t *xc_init_mmu_updates(int xc_handle, domid_t dom);
675 int xc_add_mmu_update(int xc_handle, xc_mmu_t *mmu,
676 unsigned long long ptr, unsigned long long val);
677 int xc_finish_mmu_updates(int xc_handle, xc_mmu_t *mmu);
679 int xc_acm_op(int xc_handle, int cmd, void *arg, unsigned long arg_size);
681 /*
682 * Return a handle to the event channel driver, or -1 on failure, in which case
683 * errno will be set appropriately.
684 */
685 int xc_evtchn_open(void);
687 /*
688 * Close a handle previously allocated with xc_evtchn_open().
689 */
690 int xc_evtchn_close(int xce_handle);
692 /*
693 * Return an fd that can be select()ed on for further calls to
694 * xc_evtchn_pending().
695 */
696 int xc_evtchn_fd(int xce_handle);
698 /*
699 * Notify the given event channel. Returns -1 on failure, in which case
700 * errno will be set appropriately.
701 */
702 int xc_evtchn_notify(int xce_handle, evtchn_port_t port);
704 /*
705 * Returns a new event port awaiting interdomain connection from the given
706 * domain ID, or -1 on failure, in which case errno will be set appropriately.
707 */
708 evtchn_port_t xc_evtchn_bind_unbound_port(int xce_handle, int domid);
710 /*
711 * Returns a new event port bound to the remote port for the given domain ID,
712 * or -1 on failure, in which case errno will be set appropriately.
713 */
714 evtchn_port_t xc_evtchn_bind_interdomain(int xce_handle, int domid,
715 evtchn_port_t remote_port);
717 /*
718 * Unbind the given event channel. Returns -1 on failure, in which case errno
719 * will be set appropriately.
720 */
721 int xc_evtchn_unbind(int xce_handle, evtchn_port_t port);
723 /*
724 * Bind an event channel to the given VIRQ. Returns the event channel bound to
725 * the VIRQ, or -1 on failure, in which case errno will be set appropriately.
726 */
727 evtchn_port_t xc_evtchn_bind_virq(int xce_handle, unsigned int virq);
729 /*
730 * Return the next event channel to become pending, or -1 on failure, in which
731 * case errno will be set appropriately.
732 */
733 evtchn_port_t xc_evtchn_pending(int xce_handle);
735 /*
736 * Unmask the given event channel. Returns -1 on failure, in which case errno
737 * will be set appropriately.
738 */
739 int xc_evtchn_unmask(int xce_handle, evtchn_port_t port);
741 int xc_hvm_set_pci_intx_level(
742 int xc_handle, domid_t dom,
743 uint8_t domain, uint8_t bus, uint8_t device, uint8_t intx,
744 unsigned int level);
745 int xc_hvm_set_isa_irq_level(
746 int xc_handle, domid_t dom,
747 uint8_t isa_irq,
748 unsigned int level);
750 int xc_hvm_set_pci_link_route(
751 int xc_handle, domid_t dom, uint8_t link, uint8_t isa_irq);
754 typedef enum {
755 XC_ERROR_NONE = 0,
756 XC_INTERNAL_ERROR = 1,
757 XC_INVALID_KERNEL = 2,
758 XC_INVALID_PARAM = 3,
759 XC_OUT_OF_MEMORY = 4,
760 } xc_error_code;
762 #define XC_MAX_ERROR_MSG_LEN 1024
763 typedef struct {
764 int code;
765 char message[XC_MAX_ERROR_MSG_LEN];
766 } xc_error;
768 /*
769 * Return a pointer to the last error. This pointer and the
770 * data pointed to are only valid until the next call to
771 * libxc.
772 */
773 const xc_error *xc_get_last_error(void);
775 /*
776 * Clear the last error
777 */
778 void xc_clear_last_error(void);
780 typedef void (*xc_error_handler)(const xc_error * const err);
782 /*
783 * The default error handler which prints to stderr
784 */
785 void xc_default_error_handler(const xc_error * const err);
787 /*
788 * Convert an error code into a text description
789 */
790 const char *xc_error_code_to_desc(int code);
792 /*
793 * Registers a callback to handle errors
794 */
795 xc_error_handler xc_set_error_handler(xc_error_handler handler);
797 /* PowerPC specific. */
798 int xc_alloc_real_mode_area(int xc_handle,
799 uint32_t domid,
800 unsigned int log);
801 #endif