Lines Matching refs:xch

33     struct xc_interface_core xch_buf = { 0 }, *xch = &xch_buf;  in xc_interface_open()  local
35 xch->flags = open_flags; in xc_interface_open()
36 xch->dombuild_logger_file = 0; in xc_interface_open()
37 xc_clear_last_error(xch); in xc_interface_open()
39 xch->error_handler = logger; xch->error_handler_tofree = 0; in xc_interface_open()
40 xch->dombuild_logger = dombuild_logger; xch->dombuild_logger_tofree = 0; in xc_interface_open()
42 if (!xch->error_handler) { in xc_interface_open()
43 xch->error_handler = xch->error_handler_tofree = in xc_interface_open()
46 if (!xch->error_handler) in xc_interface_open()
50 xch = malloc(sizeof(*xch)); in xc_interface_open()
51 if (!xch) { in xc_interface_open()
52 xch = &xch_buf; in xc_interface_open()
56 *xch = xch_buf; in xc_interface_open()
59 return xch; /* We are done */ in xc_interface_open()
61 xch->xcall = xencall_open(xch->error_handler, in xc_interface_open()
63 if ( xch->xcall == NULL ) in xc_interface_open()
66 xch->fmem = xenforeignmemory_open(xch->error_handler, 0); in xc_interface_open()
67 if ( xch->fmem == NULL ) in xc_interface_open()
70 xch->dmod = xendevicemodel_open(xch->error_handler, 0); in xc_interface_open()
71 if ( xch->dmod == NULL ) in xc_interface_open()
74 return xch; in xc_interface_open()
77 xenforeignmemory_close(xch->fmem); in xc_interface_open()
78 xencall_close(xch->xcall); in xc_interface_open()
79 xtl_logger_destroy(xch->error_handler_tofree); in xc_interface_open()
80 if (xch != &xch_buf) free(xch); in xc_interface_open()
84 int xc_interface_close(xc_interface *xch) in xc_interface_close() argument
88 if (!xch) in xc_interface_close()
91 rc = xencall_close(xch->xcall); in xc_interface_close()
94 rc = xenforeignmemory_close(xch->fmem); in xc_interface_close()
97 rc = xendevicemodel_close(xch->dmod); in xc_interface_close()
100 xtl_logger_destroy(xch->dombuild_logger_tofree); in xc_interface_close()
101 xtl_logger_destroy(xch->error_handler_tofree); in xc_interface_close()
103 free(xch); in xc_interface_close()
107 xencall_handle *xc_interface_xcall_handle(xc_interface *xch) in xc_interface_xcall_handle() argument
109 return xch->xcall; in xc_interface_xcall_handle()
112 struct xenforeignmemory_handle *xc_interface_fmem_handle(xc_interface *xch) in xc_interface_fmem_handle() argument
114 return xch->fmem; in xc_interface_fmem_handle()
117 struct xendevicemodel_handle *xc_interface_dmod_handle(xc_interface *xch) in xc_interface_dmod_handle() argument
119 return xch->dmod; in xc_interface_dmod_handle()
125 const xc_error *xc_get_last_error(xc_interface *xch) in xc_get_last_error() argument
127 return &xch->last_error; in xc_get_last_error()
130 void xc_clear_last_error(xc_interface *xch) in xc_clear_last_error() argument
132 xch->last_error.code = XC_ERROR_NONE; in xc_clear_last_error()
133 xch->last_error.message[0] = '\0'; in xc_clear_last_error()
156 void xc_reportv(xc_interface *xch, xentoollog_logger *lg, in xc_reportv() argument
177 msg = xch->last_error.message; in xc_reportv()
178 xch->last_error.code = code; in xc_reportv()
192 void xc_report(xc_interface *xch, xentoollog_logger *lg, in xc_report() argument
196 xc_reportv(xch,lg,level,code,fmt,args); in xc_report()
200 void xc_report_error(xc_interface *xch, int code, const char *fmt, ...) in xc_report_error() argument
204 xc_reportv(xch, xch->error_handler, XTL_ERROR, code, fmt, args); in xc_report_error()
208 const char *xc_set_progress_prefix(xc_interface *xch, const char *doing) in xc_set_progress_prefix() argument
210 const char *old = xch->currently_progress_reporting; in xc_set_progress_prefix()
212 xch->currently_progress_reporting = doing; in xc_set_progress_prefix()
216 void xc_report_progress_single(xc_interface *xch, const char *doing) in xc_report_progress_single() argument
219 xtl_progress(xch->error_handler, "xc", doing, 0, 0); in xc_report_progress_single()
222 void xc_report_progress_step(xc_interface *xch, in xc_report_progress_step() argument
225 assert(xch->currently_progress_reporting); in xc_report_progress_step()
226 xtl_progress(xch->error_handler, "xc", in xc_report_progress_step()
227 xch->currently_progress_reporting, done, total); in xc_report_progress_step()
230 int xc_get_pfn_type_batch(xc_interface *xch, uint32_t dom, in xc_get_pfn_type_batch() argument
236 if ( xc_hypercall_bounce_pre(xch, arr) ) in xc_get_pfn_type_batch()
242 rc = do_domctl_retry_efault(xch, &domctl); in xc_get_pfn_type_batch()
243 xc_hypercall_bounce_post(xch, arr); in xc_get_pfn_type_batch()
248 xc_interface *xch, in xc_mmuext_op() argument
256 if ( xc_hypercall_bounce_pre(xch, op) ) in xc_mmuext_op()
262 ret = xencall4(xch->xcall, __HYPERVISOR_mmuext_op, in xc_mmuext_op()
266 xc_hypercall_bounce_post(xch, op); in xc_mmuext_op()
272 static int flush_mmu_updates(xc_interface *xch, struct xc_mmu *mmu) in flush_mmu_updates() argument
280 if ( xc_hypercall_bounce_pre(xch, updates) ) in flush_mmu_updates()
287 rc = xencall4(xch->xcall, __HYPERVISOR_mmu_update, in flush_mmu_updates()
298 xc_hypercall_bounce_post(xch, updates); in flush_mmu_updates()
304 struct xc_mmu *xc_alloc_mmu_updates(xc_interface *xch, unsigned int subject) in xc_alloc_mmu_updates() argument
314 int xc_add_mmu_update(xc_interface *xch, struct xc_mmu *mmu, in xc_add_mmu_update() argument
321 return flush_mmu_updates(xch, mmu); in xc_add_mmu_update()
326 int xc_flush_mmu_updates(xc_interface *xch, struct xc_mmu *mmu) in xc_flush_mmu_updates() argument
328 return flush_mmu_updates(xch, mmu); in xc_flush_mmu_updates()
331 long do_memory_op(xc_interface *xch, int cmd, void *arg, size_t len) in do_memory_op() argument
336 if ( xc_hypercall_bounce_pre(xch, arg) ) in do_memory_op()
342 ret = xencall2(xch->xcall, __HYPERVISOR_memory_op, in do_memory_op()
345 xc_hypercall_bounce_post(xch, arg); in do_memory_op()
350 int xc_maximum_ram_page(xc_interface *xch, unsigned long *max_mfn) in xc_maximum_ram_page() argument
352 long rc = do_memory_op(xch, XENMEM_maximum_ram_page, NULL, 0); in xc_maximum_ram_page()
362 long long xc_domain_get_cpu_usage(xc_interface *xch, uint32_t domid, int vcpu) in xc_domain_get_cpu_usage() argument
369 if ( (do_domctl(xch, &domctl) < 0) ) in xc_domain_get_cpu_usage()
377 int xc_machphys_mfn_list(xc_interface *xch, in xc_machphys_mfn_list() argument
387 if ( xc_hypercall_bounce_pre(xch, extent_start) ) in xc_machphys_mfn_list()
394 rc = do_memory_op(xch, XENMEM_machphys_mfn_list, &xmml, sizeof(xmml)); in xc_machphys_mfn_list()
400 xc_hypercall_bounce_post(xch, extent_start); in xc_machphys_mfn_list()
405 long xc_get_tot_pages(xc_interface *xch, uint32_t domid) in xc_get_tot_pages() argument
408 if ( (xc_domain_getinfo(xch, domid, 1, &info) != 1) || in xc_get_tot_pages()
414 int xc_copy_to_domain_page(xc_interface *xch, in xc_copy_to_domain_page() argument
420 xch, domid, PAGE_SIZE, PROT_WRITE, dst_pfn); in xc_copy_to_domain_page()
425 xc_domain_cacheflush(xch, domid, dst_pfn, 1); in xc_copy_to_domain_page()
429 int xc_clear_domain_pages(xc_interface *xch, in xc_clear_domain_pages() argument
436 xch, domid, size, PROT_WRITE, dst_pfn); in xc_clear_domain_pages()
441 xc_domain_cacheflush(xch, domid, dst_pfn, num); in xc_clear_domain_pages()
445 int xc_domctl(xc_interface *xch, struct xen_domctl *domctl) in xc_domctl() argument
447 return do_domctl(xch, domctl); in xc_domctl()
450 int xc_sysctl(xc_interface *xch, struct xen_sysctl *sysctl) in xc_sysctl() argument
452 return do_sysctl(xch, sysctl); in xc_sysctl()
455 int xc_version(xc_interface *xch, int cmd, void *arg) in xc_version() argument
507 if ( (sz != 0) && xc_hypercall_bounce_pre(xch, arg) ) in xc_version()
513 rc = do_xen_version(xch, cmd, HYPERCALL_BUFFER(arg)); in xc_version()
516 xc_hypercall_bounce_post(xch, arg); in xc_version()
522 xc_interface *xch, uint32_t domid, unsigned long mfn) in xc_make_page_below_4G() argument
528 xch, domid, 1, 0, &old_mfn) != 0 ) in xc_make_page_below_4G()
535 xch, domid, 1, 0, XENMEMF_address_bits(32), &new_mfn) != 0 ) in xc_make_page_below_4G()
557 const char *xc_strerror(xc_interface *xch, int errcode) in xc_strerror() argument
559 if ( xch->flags & XC_OPENFLAG_NON_REENTRANT ) in xc_strerror()