[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH 1/8] libxc: add xc_hvm_param_get/set() to get/set 64-bit values
HVMOP_get_param and HVMOP_set_param take a uint32_t for the parameter index and a uint64_t for the value. So add xc_hvm_param_get() and xc_hvm_param_set() that take the same types. The existing xc_get_hvm_param() and xc_set_hvm_param() are retained for compatibility but are deprecated. Signed-off-by: David Vrabel <david.vrabel@xxxxxxxxxx> --- tools/libxc/xc_cpuid_x86.c | 11 +++++----- tools/libxc/xc_dom_arm.c | 8 +++---- tools/libxc/xc_domain.c | 21 +++++++++++++++++-- tools/libxc/xc_domain_restore.c | 30 +++++++++++++-------------- tools/libxc/xc_domain_save.c | 39 ++++++++++++----------------------- tools/libxc/xc_hvm_build_x86.c | 20 +++++++++--------- tools/libxc/xc_resume.c | 4 ++-- tools/libxc/xenctrl.h | 3 +++ tools/libxl/libxl.c | 6 +++--- tools/libxl/libxl_dom.c | 30 +++++++++++++++------------ tools/python/xen/lowlevel/xc/xc.c | 16 +++++++------- tools/tests/xen-access/xen-access.c | 13 ++++++------ tools/xenpaging/xenpaging.c | 2 +- 13 files changed, 107 insertions(+), 96 deletions(-) diff --git a/tools/libxc/xc_cpuid_x86.c b/tools/libxc/xc_cpuid_x86.c index 4772ca7..8acb9fb 100644 --- a/tools/libxc/xc_cpuid_x86.c +++ b/tools/libxc/xc_cpuid_x86.c @@ -276,13 +276,12 @@ static void xc_cpuid_hvm_policy( { DECLARE_DOMCTL; char brand[13]; - unsigned long nestedhvm; - unsigned long pae; + uint64_t val; int is_pae, is_nestedhvm; uint64_t xfeature_mask; - xc_get_hvm_param(xch, domid, HVM_PARAM_PAE_ENABLED, &pae); - is_pae = !!pae; + xc_hvm_param_get(xch, domid, HVM_PARAM_PAE_ENABLED, &val); + is_pae = !!val; /* Detecting Xen's atitude towards XSAVE */ memset(&domctl, 0, sizeof(domctl)); @@ -291,8 +290,8 @@ static void xc_cpuid_hvm_policy( do_domctl(xch, &domctl); xfeature_mask = domctl.u.vcpuextstate.xfeature_mask; - xc_get_hvm_param(xch, domid, HVM_PARAM_NESTEDHVM, &nestedhvm); - is_nestedhvm = !!nestedhvm; + xc_hvm_param_get(xch, domid, HVM_PARAM_NESTEDHVM, &val); + is_nestedhvm = !!val; switch ( input[0] ) { diff --git a/tools/libxc/xc_dom_arm.c b/tools/libxc/xc_dom_arm.c index cc64363..10f6bcb 100644 --- a/tools/libxc/xc_dom_arm.c +++ b/tools/libxc/xc_dom_arm.c @@ -80,14 +80,14 @@ static int alloc_magic_pages(struct xc_dom_image *dom) xc_clear_domain_page(dom->xch, dom->guest_domid, dom->console_pfn); xc_clear_domain_page(dom->xch, dom->guest_domid, dom->xenstore_pfn); - xc_set_hvm_param(dom->xch, dom->guest_domid, HVM_PARAM_CONSOLE_PFN, + xc_hvm_param_set(dom->xch, dom->guest_domid, HVM_PARAM_CONSOLE_PFN, dom->console_pfn); - xc_set_hvm_param(dom->xch, dom->guest_domid, HVM_PARAM_STORE_PFN, + xc_hvm_param_set(dom->xch, dom->guest_domid, HVM_PARAM_STORE_PFN, dom->xenstore_pfn); /* allocated by toolstack */ - xc_set_hvm_param(dom->xch, dom->guest_domid, HVM_PARAM_CONSOLE_EVTCHN, + xc_hvm_param_set(dom->xch, dom->guest_domid, HVM_PARAM_CONSOLE_EVTCHN, dom->console_evtchn); - xc_set_hvm_param(dom->xch, dom->guest_domid, HVM_PARAM_STORE_EVTCHN, + xc_hvm_param_set(dom->xch, dom->guest_domid, HVM_PARAM_STORE_EVTCHN, dom->xenstore_evtchn); return 0; diff --git a/tools/libxc/xc_domain.c b/tools/libxc/xc_domain.c index 26edbaf..09d4a83 100644 --- a/tools/libxc/xc_domain.c +++ b/tools/libxc/xc_domain.c @@ -1244,7 +1244,7 @@ int xc_domain_send_trigger(xc_interface *xch, return do_domctl(xch, &domctl); } -int xc_set_hvm_param(xc_interface *handle, domid_t dom, int param, unsigned long value) +int xc_hvm_param_set(xc_interface *handle, domid_t dom, uint32_t param, uint64_t value) { DECLARE_HYPERCALL; DECLARE_HYPERCALL_BUFFER(xen_hvm_param_t, arg); @@ -1265,7 +1265,7 @@ int xc_set_hvm_param(xc_interface *handle, domid_t dom, int param, unsigned long return rc; } -int xc_get_hvm_param(xc_interface *handle, domid_t dom, int param, unsigned long *value) +int xc_hvm_param_get(xc_interface *handle, domid_t dom, uint32_t param, uint64_t *value) { DECLARE_HYPERCALL; DECLARE_HYPERCALL_BUFFER(xen_hvm_param_t, arg); @@ -1286,6 +1286,23 @@ int xc_get_hvm_param(xc_interface *handle, domid_t dom, int param, unsigned long return rc; } +int xc_set_hvm_param(xc_interface *handle, domid_t dom, int param, unsigned long value) +{ + return xc_hvm_param_set(handle, dom, param, value); +} + +int xc_get_hvm_param(xc_interface *handle, domid_t dom, int param, unsigned long *value) +{ + uint64_t v; + int ret; + + ret = xc_hvm_param_get(handle, dom, param, &v); + if (ret < 0) + return ret; + *value = v; + return 0; +} + int xc_hvm_create_ioreq_server(xc_interface *xch, domid_t domid, int handle_bufioreq, diff --git a/tools/libxc/xc_domain_restore.c b/tools/libxc/xc_domain_restore.c index b80f867..6849712 100644 --- a/tools/libxc/xc_domain_restore.c +++ b/tools/libxc/xc_domain_restore.c @@ -1646,15 +1646,15 @@ int xc_domain_restore(xc_interface *xch, int io_fd, uint32_t dom, } /* should this be deferred? does it change? */ if ( pagebuf.identpt ) - xc_set_hvm_param(xch, dom, HVM_PARAM_IDENT_PT, pagebuf.identpt); + xc_hvm_param_set(xch, dom, HVM_PARAM_IDENT_PT, pagebuf.identpt); if ( pagebuf.paging_ring_pfn ) - xc_set_hvm_param(xch, dom, HVM_PARAM_PAGING_RING_PFN, pagebuf.paging_ring_pfn); + xc_hvm_param_set(xch, dom, HVM_PARAM_PAGING_RING_PFN, pagebuf.paging_ring_pfn); if ( pagebuf.access_ring_pfn ) - xc_set_hvm_param(xch, dom, HVM_PARAM_ACCESS_RING_PFN, pagebuf.access_ring_pfn); + xc_hvm_param_set(xch, dom, HVM_PARAM_ACCESS_RING_PFN, pagebuf.access_ring_pfn); if ( pagebuf.sharing_ring_pfn ) - xc_set_hvm_param(xch, dom, HVM_PARAM_SHARING_RING_PFN, pagebuf.sharing_ring_pfn); + xc_hvm_param_set(xch, dom, HVM_PARAM_SHARING_RING_PFN, pagebuf.sharing_ring_pfn); if ( pagebuf.vm86_tss ) - xc_set_hvm_param(xch, dom, HVM_PARAM_VM86_TSS, pagebuf.vm86_tss); + xc_hvm_param_set(xch, dom, HVM_PARAM_VM86_TSS, pagebuf.vm86_tss); if ( pagebuf.console_pfn ) console_pfn = pagebuf.console_pfn; if ( pagebuf.vm_generationid_addr ) { @@ -1769,7 +1769,7 @@ int xc_domain_restore(xc_interface *xch, int io_fd, uint32_t dom, } if (pagebuf.viridian != 0) - xc_set_hvm_param(xch, dom, HVM_PARAM_VIRIDIAN, 1); + xc_hvm_param_set(xch, dom, HVM_PARAM_VIRIDIAN, 1); /* * If we are migrating in from a host that does not support @@ -1789,16 +1789,16 @@ int xc_domain_restore(xc_interface *xch, int io_fd, uint32_t dom, } else { if (pagebuf.nr_ioreq_server_pages != 0 && pagebuf.ioreq_server_pfn != 0) { - xc_set_hvm_param(xch, dom, HVM_PARAM_NR_IOREQ_SERVER_PAGES, + xc_hvm_param_set(xch, dom, HVM_PARAM_NR_IOREQ_SERVER_PAGES, pagebuf.nr_ioreq_server_pages); - xc_set_hvm_param(xch, dom, HVM_PARAM_IOREQ_SERVER_PFN, + xc_hvm_param_set(xch, dom, HVM_PARAM_IOREQ_SERVER_PFN, pagebuf.ioreq_server_pfn); } } if (pagebuf.acpi_ioport_location == 1) { DBGPRINTF("Use new firmware ioport from the checkpoint\n"); - xc_set_hvm_param(xch, dom, HVM_PARAM_ACPI_IOPORTS_LOCATION, 1); + xc_hvm_param_set(xch, dom, HVM_PARAM_ACPI_IOPORTS_LOCATION, 1); } else if (pagebuf.acpi_ioport_location == 0) { DBGPRINTF("Use old firmware ioport from the checkpoint\n"); } else { @@ -2329,15 +2329,15 @@ int xc_domain_restore(xc_interface *xch, int io_fd, uint32_t dom, goto out; } - if ( (frc = xc_set_hvm_param(xch, dom, + if ( (frc = xc_hvm_param_set(xch, dom, HVM_PARAM_IOREQ_PFN, tailbuf.u.hvm.magicpfns[0])) - || (frc = xc_set_hvm_param(xch, dom, + || (frc = xc_hvm_param_set(xch, dom, HVM_PARAM_BUFIOREQ_PFN, tailbuf.u.hvm.magicpfns[1])) - || (frc = xc_set_hvm_param(xch, dom, + || (frc = xc_hvm_param_set(xch, dom, HVM_PARAM_STORE_PFN, tailbuf.u.hvm.magicpfns[2])) - || (frc = xc_set_hvm_param(xch, dom, + || (frc = xc_hvm_param_set(xch, dom, HVM_PARAM_PAE_ENABLED, pae)) - || (frc = xc_set_hvm_param(xch, dom, + || (frc = xc_hvm_param_set(xch, dom, HVM_PARAM_STORE_EVTCHN, store_evtchn)) ) { @@ -2351,7 +2351,7 @@ int xc_domain_restore(xc_interface *xch, int io_fd, uint32_t dom, PERROR("error zeroing console page"); goto out; } - if ( (frc = xc_set_hvm_param(xch, dom, + if ( (frc = xc_hvm_param_set(xch, dom, HVM_PARAM_CONSOLE_PFN, console_pfn)) ) { PERROR("error setting HVM param: %i", frc); goto out; diff --git a/tools/libxc/xc_domain_save.c b/tools/libxc/xc_domain_save.c index 778cbde..14502c1 100644 --- a/tools/libxc/xc_domain_save.c +++ b/tools/libxc/xc_domain_save.c @@ -1645,8 +1645,7 @@ int xc_domain_save(xc_interface *xch, int io_fd, uint32_t dom, uint32_t max_iter chunk.id = XC_SAVE_ID_HVM_IDENT_PT; chunk.data = 0; - xc_get_hvm_param(xch, dom, HVM_PARAM_IDENT_PT, - (unsigned long *)&chunk.data); + xc_hvm_param_get(xch, dom, HVM_PARAM_IDENT_PT, &chunk.data); if ( (chunk.data != 0) && wrexact(io_fd, &chunk, sizeof(chunk)) ) @@ -1657,8 +1656,7 @@ int xc_domain_save(xc_interface *xch, int io_fd, uint32_t dom, uint32_t max_iter chunk.id = XC_SAVE_ID_HVM_PAGING_RING_PFN; chunk.data = 0; - xc_get_hvm_param(xch, dom, HVM_PARAM_PAGING_RING_PFN, - (unsigned long *)&chunk.data); + xc_hvm_param_get(xch, dom, HVM_PARAM_PAGING_RING_PFN, &chunk.data); if ( (chunk.data != 0) && wrexact(io_fd, &chunk, sizeof(chunk)) ) @@ -1669,8 +1667,7 @@ int xc_domain_save(xc_interface *xch, int io_fd, uint32_t dom, uint32_t max_iter chunk.id = XC_SAVE_ID_HVM_ACCESS_RING_PFN; chunk.data = 0; - xc_get_hvm_param(xch, dom, HVM_PARAM_ACCESS_RING_PFN, - (unsigned long *)&chunk.data); + xc_hvm_param_get(xch, dom, HVM_PARAM_ACCESS_RING_PFN, &chunk.data); if ( (chunk.data != 0) && wrexact(io_fd, &chunk, sizeof(chunk)) ) @@ -1681,8 +1678,7 @@ int xc_domain_save(xc_interface *xch, int io_fd, uint32_t dom, uint32_t max_iter chunk.id = XC_SAVE_ID_HVM_SHARING_RING_PFN; chunk.data = 0; - xc_get_hvm_param(xch, dom, HVM_PARAM_SHARING_RING_PFN, - (unsigned long *)&chunk.data); + xc_hvm_param_get(xch, dom, HVM_PARAM_SHARING_RING_PFN, &chunk.data); if ( (chunk.data != 0) && wrexact(io_fd, &chunk, sizeof(chunk)) ) @@ -1693,8 +1689,7 @@ int xc_domain_save(xc_interface *xch, int io_fd, uint32_t dom, uint32_t max_iter chunk.id = XC_SAVE_ID_HVM_VM86_TSS; chunk.data = 0; - xc_get_hvm_param(xch, dom, HVM_PARAM_VM86_TSS, - (unsigned long *)&chunk.data); + xc_hvm_param_get(xch, dom, HVM_PARAM_VM86_TSS, &chunk.data); if ( (chunk.data != 0) && wrexact(io_fd, &chunk, sizeof(chunk)) ) @@ -1705,8 +1700,7 @@ int xc_domain_save(xc_interface *xch, int io_fd, uint32_t dom, uint32_t max_iter chunk.id = XC_SAVE_ID_HVM_CONSOLE_PFN; chunk.data = 0; - xc_get_hvm_param(xch, dom, HVM_PARAM_CONSOLE_PFN, - (unsigned long *)&chunk.data); + xc_hvm_param_get(xch, dom, HVM_PARAM_CONSOLE_PFN, &chunk.data); if ( (chunk.data != 0) && wrexact(io_fd, &chunk, sizeof(chunk)) ) @@ -1717,8 +1711,7 @@ int xc_domain_save(xc_interface *xch, int io_fd, uint32_t dom, uint32_t max_iter chunk.id = XC_SAVE_ID_HVM_ACPI_IOPORTS_LOCATION; chunk.data = 0; - xc_get_hvm_param(xch, dom, HVM_PARAM_ACPI_IOPORTS_LOCATION, - (unsigned long *)&chunk.data); + xc_hvm_param_get(xch, dom, HVM_PARAM_ACPI_IOPORTS_LOCATION, &chunk.data); if ((chunk.data != 0) && wrexact(io_fd, &chunk, sizeof(chunk))) { @@ -1728,8 +1721,7 @@ int xc_domain_save(xc_interface *xch, int io_fd, uint32_t dom, uint32_t max_iter chunk.id = XC_SAVE_ID_HVM_VIRIDIAN; chunk.data = 0; - xc_get_hvm_param(xch, dom, HVM_PARAM_VIRIDIAN, - (unsigned long *)&chunk.data); + xc_hvm_param_get(xch, dom, HVM_PARAM_VIRIDIAN, &chunk.data); if ( (chunk.data != 0) && wrexact(io_fd, &chunk, sizeof(chunk)) ) @@ -1740,8 +1732,7 @@ int xc_domain_save(xc_interface *xch, int io_fd, uint32_t dom, uint32_t max_iter chunk.id = XC_SAVE_ID_HVM_IOREQ_SERVER_PFN; chunk.data = 0; - xc_get_hvm_param(xch, dom, HVM_PARAM_IOREQ_SERVER_PFN, - (unsigned long *)&chunk.data); + xc_hvm_param_get(xch, dom, HVM_PARAM_IOREQ_SERVER_PFN, &chunk.data); if ( (chunk.data != 0) && wrexact(io_fd, &chunk, sizeof(chunk)) ) @@ -1752,8 +1743,7 @@ int xc_domain_save(xc_interface *xch, int io_fd, uint32_t dom, uint32_t max_iter chunk.id = XC_SAVE_ID_HVM_NR_IOREQ_SERVER_PAGES; chunk.data = 0; - xc_get_hvm_param(xch, dom, HVM_PARAM_NR_IOREQ_SERVER_PAGES, - (unsigned long *)&chunk.data); + xc_hvm_param_get(xch, dom, HVM_PARAM_NR_IOREQ_SERVER_PAGES, &chunk.data); if ( (chunk.data != 0) && wrexact(io_fd, &chunk, sizeof(chunk)) ) @@ -1827,12 +1817,9 @@ int xc_domain_save(xc_interface *xch, int io_fd, uint32_t dom, uint32_t max_iter /* Save magic-page locations. */ memset(magic_pfns, 0, sizeof(magic_pfns)); - xc_get_hvm_param(xch, dom, HVM_PARAM_IOREQ_PFN, - (unsigned long *)&magic_pfns[0]); - xc_get_hvm_param(xch, dom, HVM_PARAM_BUFIOREQ_PFN, - (unsigned long *)&magic_pfns[1]); - xc_get_hvm_param(xch, dom, HVM_PARAM_STORE_PFN, - (unsigned long *)&magic_pfns[2]); + xc_hvm_param_get(xch, dom, HVM_PARAM_IOREQ_PFN, &magic_pfns[0]); + xc_hvm_param_get(xch, dom, HVM_PARAM_BUFIOREQ_PFN, &magic_pfns[1]); + xc_hvm_param_get(xch, dom, HVM_PARAM_STORE_PFN, &magic_pfns[2]); if ( wrexact(io_fd, magic_pfns, sizeof(magic_pfns)) ) { PERROR("Error when writing to state file (7)"); diff --git a/tools/libxc/xc_hvm_build_x86.c b/tools/libxc/xc_hvm_build_x86.c index ed1069b..c81a25b 100644 --- a/tools/libxc/xc_hvm_build_x86.c +++ b/tools/libxc/xc_hvm_build_x86.c @@ -487,19 +487,19 @@ static int setup_guest(xc_interface *xch, if ( xc_clear_domain_pages(xch, dom, special_pfn(0), NR_SPECIAL_PAGES) ) goto error_out; - xc_set_hvm_param(xch, dom, HVM_PARAM_STORE_PFN, + xc_hvm_param_set(xch, dom, HVM_PARAM_STORE_PFN, special_pfn(SPECIALPAGE_XENSTORE)); - xc_set_hvm_param(xch, dom, HVM_PARAM_BUFIOREQ_PFN, + xc_hvm_param_set(xch, dom, HVM_PARAM_BUFIOREQ_PFN, special_pfn(SPECIALPAGE_BUFIOREQ)); - xc_set_hvm_param(xch, dom, HVM_PARAM_IOREQ_PFN, + xc_hvm_param_set(xch, dom, HVM_PARAM_IOREQ_PFN, special_pfn(SPECIALPAGE_IOREQ)); - xc_set_hvm_param(xch, dom, HVM_PARAM_CONSOLE_PFN, + xc_hvm_param_set(xch, dom, HVM_PARAM_CONSOLE_PFN, special_pfn(SPECIALPAGE_CONSOLE)); - xc_set_hvm_param(xch, dom, HVM_PARAM_PAGING_RING_PFN, + xc_hvm_param_set(xch, dom, HVM_PARAM_PAGING_RING_PFN, special_pfn(SPECIALPAGE_PAGING)); - xc_set_hvm_param(xch, dom, HVM_PARAM_ACCESS_RING_PFN, + xc_hvm_param_set(xch, dom, HVM_PARAM_ACCESS_RING_PFN, special_pfn(SPECIALPAGE_ACCESS)); - xc_set_hvm_param(xch, dom, HVM_PARAM_SHARING_RING_PFN, + xc_hvm_param_set(xch, dom, HVM_PARAM_SHARING_RING_PFN, special_pfn(SPECIALPAGE_SHARING)); /* @@ -521,9 +521,9 @@ static int setup_guest(xc_interface *xch, goto error_out; /* Tell the domain where the pages are and how many there are */ - xc_set_hvm_param(xch, dom, HVM_PARAM_IOREQ_SERVER_PFN, + xc_hvm_param_set(xch, dom, HVM_PARAM_IOREQ_SERVER_PFN, ioreq_server_pfn(0)); - xc_set_hvm_param(xch, dom, HVM_PARAM_NR_IOREQ_SERVER_PAGES, + xc_hvm_param_set(xch, dom, HVM_PARAM_NR_IOREQ_SERVER_PAGES, NR_IOREQ_SERVER_PAGES); /* @@ -538,7 +538,7 @@ static int setup_guest(xc_interface *xch, ident_pt[i] = ((i << 22) | _PAGE_PRESENT | _PAGE_RW | _PAGE_USER | _PAGE_ACCESSED | _PAGE_DIRTY | _PAGE_PSE); munmap(ident_pt, PAGE_SIZE); - xc_set_hvm_param(xch, dom, HVM_PARAM_IDENT_PT, + xc_hvm_param_set(xch, dom, HVM_PARAM_IDENT_PT, special_pfn(SPECIALPAGE_IDENT_PT) << PAGE_SHIFT); /* Insert JMP <rel32> instruction at address 0x0 to reach entry point. */ diff --git a/tools/libxc/xc_resume.c b/tools/libxc/xc_resume.c index e423814..f48515a 100644 --- a/tools/libxc/xc_resume.c +++ b/tools/libxc/xc_resume.c @@ -51,8 +51,8 @@ static int modify_returncode(xc_interface *xch, uint32_t domid) if ( info.hvm ) { /* HVM guests without PV drivers have no return code to modify. */ - unsigned long irq = 0; - xc_get_hvm_param(xch, domid, HVM_PARAM_CALLBACK_IRQ, &irq); + uint64_t irq = 0; + xc_hvm_param_get(xch, domid, HVM_PARAM_CALLBACK_IRQ, &irq); if ( !irq ) return 0; diff --git a/tools/libxc/xenctrl.h b/tools/libxc/xenctrl.h index b55d857..b8fbfbe 100644 --- a/tools/libxc/xenctrl.h +++ b/tools/libxc/xenctrl.h @@ -1807,7 +1807,10 @@ const xc_error *xc_get_last_error(xc_interface *handle); */ void xc_clear_last_error(xc_interface *xch); +int xc_hvm_param_set(xc_interface *handle, domid_t dom, uint32_t param, uint64_t value); +int xc_hvm_param_get(xc_interface *handle, domid_t dom, uint32_t param, uint64_t *value); +/* Deprecated: use xc_hvm_param_set/get() instead. */ int xc_set_hvm_param(xc_interface *handle, domid_t dom, int param, unsigned long value); int xc_get_hvm_param(xc_interface *handle, domid_t dom, int param, unsigned long *value); diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c index 9054c3b..be59f99 100644 --- a/tools/libxl/libxl.c +++ b/tools/libxl/libxl.c @@ -885,7 +885,7 @@ int libxl__domain_pvcontrol_available(libxl__gc *gc, uint32_t domid) { libxl_ctx *ctx = libxl__gc_owner(gc); - unsigned long pvdriver = 0; + uint64_t pvdriver = 0; int ret; libxl_domain_type domtype = libxl__domain_type(gc, domid); @@ -895,7 +895,7 @@ int libxl__domain_pvcontrol_available(libxl__gc *gc, uint32_t domid) if (domtype == LIBXL_DOMAIN_TYPE_PV) return 1; - ret = xc_get_hvm_param(ctx->xch, domid, HVM_PARAM_CALLBACK_IRQ, &pvdriver); + ret = xc_hvm_param_get(ctx->xch, domid, HVM_PARAM_CALLBACK_IRQ, &pvdriver); if (ret<0) { LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "getting HVM callback IRQ"); return ERROR_FAIL; @@ -5080,7 +5080,7 @@ static int libxl__domain_s3_resume(libxl__gc *gc, int domid) case LIBXL_DOMAIN_TYPE_HVM: switch (libxl__device_model_version_running(gc, domid)) { case LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN_TRADITIONAL: - rc = xc_set_hvm_param(CTX->xch, domid, HVM_PARAM_ACPI_S_STATE, 0); + rc = xc_hvm_param_set(CTX->xch, domid, HVM_PARAM_ACPI_S_STATE, 0); break; case LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN: rc = libxl__qmp_system_wakeup(gc, domid); diff --git a/tools/libxl/libxl_dom.c b/tools/libxl/libxl_dom.c index 661999c..8096d66 100644 --- a/tools/libxl/libxl_dom.c +++ b/tools/libxl/libxl_dom.c @@ -212,18 +212,18 @@ static unsigned long timer_mode(const libxl_domain_build_info *info) static void hvm_set_conf_params(xc_interface *handle, uint32_t domid, libxl_domain_build_info *const info) { - xc_set_hvm_param(handle, domid, HVM_PARAM_PAE_ENABLED, + xc_hvm_param_set(handle, domid, HVM_PARAM_PAE_ENABLED, libxl_defbool_val(info->u.hvm.pae)); #if defined(__i386__) || defined(__x86_64__) - xc_set_hvm_param(handle, domid, HVM_PARAM_VIRIDIAN, + xc_hvm_param_set(handle, domid, HVM_PARAM_VIRIDIAN, libxl_defbool_val(info->u.hvm.viridian)); - xc_set_hvm_param(handle, domid, HVM_PARAM_HPET_ENABLED, + xc_hvm_param_set(handle, domid, HVM_PARAM_HPET_ENABLED, libxl_defbool_val(info->u.hvm.hpet)); #endif - xc_set_hvm_param(handle, domid, HVM_PARAM_TIMER_MODE, timer_mode(info)); - xc_set_hvm_param(handle, domid, HVM_PARAM_VPT_ALIGN, + xc_hvm_param_set(handle, domid, HVM_PARAM_TIMER_MODE, timer_mode(info)); + xc_hvm_param_set(handle, domid, HVM_PARAM_VPT_ALIGN, libxl_defbool_val(info->u.hvm.vpt_align)); - xc_set_hvm_param(handle, domid, HVM_PARAM_NESTEDHVM, + xc_hvm_param_set(handle, domid, HVM_PARAM_NESTEDHVM, libxl_defbool_val(info->u.hvm.nested_hvm)); } @@ -490,6 +490,7 @@ static int hvm_build_set_params(xc_interface *handle, uint32_t domid, { struct hvm_info_table *va_hvm; uint8_t *va_map, sum; + uint64_t str_mfn, cons_mfn; int i; va_map = xc_map_foreign_range(handle, domid, @@ -508,10 +509,13 @@ static int hvm_build_set_params(xc_interface *handle, uint32_t domid, va_hvm->checksum -= sum; munmap(va_map, XC_PAGE_SIZE); - xc_get_hvm_param(handle, domid, HVM_PARAM_STORE_PFN, store_mfn); - xc_get_hvm_param(handle, domid, HVM_PARAM_CONSOLE_PFN, console_mfn); - xc_set_hvm_param(handle, domid, HVM_PARAM_STORE_EVTCHN, store_evtchn); - xc_set_hvm_param(handle, domid, HVM_PARAM_CONSOLE_EVTCHN, console_evtchn); + xc_hvm_param_get(handle, domid, HVM_PARAM_STORE_PFN, &str_mfn); + xc_hvm_param_get(handle, domid, HVM_PARAM_CONSOLE_PFN, &cons_mfn); + xc_hvm_param_set(handle, domid, HVM_PARAM_STORE_EVTCHN, store_evtchn); + xc_hvm_param_set(handle, domid, HVM_PARAM_CONSOLE_EVTCHN, console_evtchn); + + *store_mfn = str_mfn; + *console_mfn = cons_mfn; xc_dom_gnttab_hvm_seed(handle, domid, *console_mfn, *store_mfn, console_domid, store_domid); return 0; @@ -1070,15 +1074,15 @@ static void domain_suspend_callback_common(libxl__egc *egc, libxl__domain_suspend_state *dss) { STATE_AO_GC(dss->ao); - unsigned long hvm_s_state = 0, hvm_pvdrv = 0; + uint64_t hvm_s_state = 0, hvm_pvdrv = 0; int ret, rc; /* Convenience aliases */ const uint32_t domid = dss->domid; if (dss->hvm) { - xc_get_hvm_param(CTX->xch, domid, HVM_PARAM_CALLBACK_IRQ, &hvm_pvdrv); - xc_get_hvm_param(CTX->xch, domid, HVM_PARAM_ACPI_S_STATE, &hvm_s_state); + xc_hvm_param_get(CTX->xch, domid, HVM_PARAM_CALLBACK_IRQ, &hvm_pvdrv); + xc_hvm_param_get(CTX->xch, domid, HVM_PARAM_ACPI_S_STATE, &hvm_s_state); } if ((hvm_s_state == 0) && (dss->guest_evtchn.port >= 0)) { diff --git a/tools/python/xen/lowlevel/xc/xc.c b/tools/python/xen/lowlevel/xc/xc.c index cb34446..314bb45 100644 --- a/tools/python/xen/lowlevel/xc/xc.c +++ b/tools/python/xen/lowlevel/xc/xc.c @@ -544,27 +544,27 @@ static PyObject *pyxc_linux_build(XcObject *self, return pyxc_error_to_exception(self->xc_handle); } -static PyObject *pyxc_get_hvm_param(XcObject *self, +static PyObject *pyxc_hvm_param_get(XcObject *self, PyObject *args, PyObject *kwds) { uint32_t dom; int param; - unsigned long value; + uint64_t value; static char *kwd_list[] = { "domid", "param", NULL }; if ( !PyArg_ParseTupleAndKeywords(args, kwds, "ii", kwd_list, &dom, ¶m) ) return NULL; - if ( xc_get_hvm_param(self->xc_handle, dom, param, &value) != 0 ) + if ( xc_hvm_param_get(self->xc_handle, dom, param, &value) != 0 ) return pyxc_error_to_exception(self->xc_handle); - return PyLong_FromUnsignedLong(value); + return PyLong_FromUnsignedLongLong(value); } -static PyObject *pyxc_set_hvm_param(XcObject *self, +static PyObject *pyxc_hvm_param_set(XcObject *self, PyObject *args, PyObject *kwds) { @@ -577,7 +577,7 @@ static PyObject *pyxc_set_hvm_param(XcObject *self, &dom, ¶m, &value) ) return NULL; - if ( xc_set_hvm_param(self->xc_handle, dom, param, value) != 0 ) + if ( xc_hvm_param_set(self->xc_handle, dom, param, value) != 0 ) return pyxc_error_to_exception(self->xc_handle); Py_INCREF(zero); @@ -2480,7 +2480,7 @@ static PyMethodDef pyxc_methods[] = { "Returns: None on sucess. Raises exception on error.\n" }, { "hvm_get_param", - (PyCFunction)pyxc_get_hvm_param, + (PyCFunction)pyxc_hvm_param_get, METH_VARARGS | METH_KEYWORDS, "\n" "get a parameter of HVM guest OS.\n" " dom [int]: Identifier of domain to build into.\n" @@ -2488,7 +2488,7 @@ static PyMethodDef pyxc_methods[] = { "Returns: [long] value of the param.\n" }, { "hvm_set_param", - (PyCFunction)pyxc_set_hvm_param, + (PyCFunction)pyxc_hvm_param_set, METH_VARARGS | METH_KEYWORDS, "\n" "set a parameter of HVM guest OS.\n" " dom [int]: Identifier of domain to build into.\n" diff --git a/tools/tests/xen-access/xen-access.c b/tools/tests/xen-access/xen-access.c index 0a84bd5..be4d100 100644 --- a/tools/tests/xen-access/xen-access.c +++ b/tools/tests/xen-access/xen-access.c @@ -223,6 +223,7 @@ xenaccess_t *xenaccess_init(xc_interface **xch_r, domid_t domain_id) xenaccess_t *xenaccess = 0; xc_interface *xch; int rc; + uint64_t val; unsigned long ring_pfn, mmap_pfn; xch = xc_interface_open(NULL, NULL, 0); @@ -246,9 +247,9 @@ xenaccess_t *xenaccess_init(xc_interface **xch_r, domid_t domain_id) mem_event_ring_lock_init(&xenaccess->mem_event); /* Map the ring page */ - xc_get_hvm_param(xch, xenaccess->mem_event.domain_id, - HVM_PARAM_ACCESS_RING_PFN, &ring_pfn); - mmap_pfn = ring_pfn; + xc_hvm_param_get(xch, xenaccess->mem_event.domain_id, + HVM_PARAM_ACCESS_RING_PFN, &val); + mmap_pfn = ring_pfn = val; xenaccess->mem_event.ring_page = xc_map_foreign_batch(xch, xenaccess->mem_event.domain_id, PROT_READ | PROT_WRITE, &mmap_pfn, 1); @@ -536,9 +537,9 @@ int main(int argc, char *argv[]) } if ( int3 ) - rc = xc_set_hvm_param(xch, domain_id, HVM_PARAM_MEMORY_EVENT_INT3, HVMPME_mode_sync); + rc = xc_hvm_param_set(xch, domain_id, HVM_PARAM_MEMORY_EVENT_INT3, HVMPME_mode_sync); else - rc = xc_set_hvm_param(xch, domain_id, HVM_PARAM_MEMORY_EVENT_INT3, HVMPME_mode_disabled); + rc = xc_hvm_param_set(xch, domain_id, HVM_PARAM_MEMORY_EVENT_INT3, HVMPME_mode_disabled); if ( rc < 0 ) { ERROR("Error %d setting int3 mem_event\n", rc); @@ -556,7 +557,7 @@ int main(int argc, char *argv[]) rc = xc_set_mem_access(xch, domain_id, XENMEM_access_rwx, ~0ull, 0); rc = xc_set_mem_access(xch, domain_id, XENMEM_access_rwx, 0, xenaccess->domain_info->max_pages); - rc = xc_set_hvm_param(xch, domain_id, HVM_PARAM_MEMORY_EVENT_INT3, HVMPME_mode_disabled); + rc = xc_hvm_param_set(xch, domain_id, HVM_PARAM_MEMORY_EVENT_INT3, HVMPME_mode_disabled); shutting_down = 1; } diff --git a/tools/xenpaging/xenpaging.c b/tools/xenpaging/xenpaging.c index 82c1ee4..442eed0 100644 --- a/tools/xenpaging/xenpaging.c +++ b/tools/xenpaging/xenpaging.c @@ -339,7 +339,7 @@ static struct xenpaging *xenpaging_init(int argc, char *argv[]) } /* Map the ring page */ - xc_get_hvm_param(xch, paging->mem_event.domain_id, + xc_hvm_param_get(xch, paging->mem_event.domain_id, HVM_PARAM_PAGING_RING_PFN, &ring_pfn); mmap_pfn = ring_pfn; paging->mem_event.ring_page = -- 1.7.10.4 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |