diff -r d8c32fa3e3a9 buildconfigs/linux-defconfig_xen_ia64 --- a/buildconfigs/linux-defconfig_xen_ia64 Wed Nov 29 11:07:28 2006 -0700 +++ b/buildconfigs/linux-defconfig_xen_ia64 Wed Nov 29 15:23:42 2006 -0700 @@ -1450,7 +1450,8 @@ CONFIG_GENERIC_PENDING_IRQ=y # # Instrumentation Support # -# CONFIG_PROFILING is not set +CONFIG_PROFILING=y +CONFIG_OPROFILE=y # CONFIG_KPROBES is not set # diff -r d8c32fa3e3a9 linux-2.6-xen-sparse/arch/ia64/xen/xcom_privcmd.c --- a/linux-2.6-xen-sparse/arch/ia64/xen/xcom_privcmd.c Wed Nov 29 11:07:28 2006 -0700 +++ b/linux-2.6-xen-sparse/arch/ia64/xen/xcom_privcmd.c Wed Nov 29 15:23:42 2006 -0700 @@ -579,9 +579,11 @@ xencomm_privcmd_hvm_op(privcmd_hypercall case HVMOP_set_param: argsize = sizeof(xen_hvm_param_t); break; +#if 0 /* XXX safe to remove this permanently? */ case HVMOP_set_irq_level: argsize = sizeof(xen_hvm_set_irq_level_t); break; +#endif default: printk("%s: unknown HVMOP %d\n", __func__, cmd); return -EINVAL; diff -r d8c32fa3e3a9 tools/libxc/ia64/xc_ia64_hvm_build.c --- a/tools/libxc/ia64/xc_ia64_hvm_build.c Wed Nov 29 11:07:28 2006 -0700 +++ b/tools/libxc/ia64/xc_ia64_hvm_build.c Wed Nov 29 15:23:42 2006 -0700 @@ -41,7 +41,7 @@ error_out: return -1; } -static void +int xc_set_hvm_param(int handle, domid_t dom, int param, unsigned long value) { DECLARE_HYPERCALL; @@ -56,15 +56,37 @@ xc_set_hvm_param(int handle, domid_t dom arg.index = param; arg.value = value; - if (mlock(&arg, sizeof(arg)) != 0) { - PERROR("Could not lock memory for set parameter"); - return; - } + if (mlock(&arg, sizeof(arg)) != 0) + return -1; rc = do_xen_hypercall(handle, &hypercall); safe_munlock(&arg, sizeof(arg)); - if (rc < 0) - PERROR("set HVM parameter failed (%d)", rc); + + return rc; +} + +int +xc_get_hvm_param(int handle, domid_t dom, int param, unsigned long *value) +{ + DECLARE_HYPERCALL; + xen_hvm_param_t arg; + int rc; + + hypercall.op = __HYPERVISOR_hvm_op; + hypercall.arg[0] = HVMOP_get_param; + hypercall.arg[1] = (unsigned long)&arg; + + arg.domid = dom; + arg.index = param; + + if (mlock(&arg, sizeof(arg)) != 0) + return -1; + + rc = do_xen_hypercall(handle, &hypercall); + safe_munlock(&arg, sizeof(arg)); + + *value = arg.value; + return rc; } #define HOB_SIGNATURE 0x3436474953424f48 // "HOBSIG64" @@ -123,15 +145,13 @@ static int hob_init(void *buffer ,unsig static int hob_init(void *buffer ,unsigned long buf_size); static int add_pal_hob(void* hob_buf); static int add_mem_hob(void* hob_buf, unsigned long dom_mem_size); -static int add_vcpus_hob(void* hob_buf, unsigned long nr_vcpu); static int build_hob(void* hob_buf, unsigned long hob_buf_size, - unsigned long dom_mem_size, unsigned long vcpus); + unsigned long dom_mem_size); static int load_hob(int xc_handle,uint32_t dom, void *hob_buf, unsigned long dom_mem_size); static int -xc_ia64_build_hob(int xc_handle, uint32_t dom, - unsigned long memsize, unsigned long vcpus) +xc_ia64_build_hob(int xc_handle, uint32_t dom, unsigned long memsize) { char *hob_buf; @@ -141,7 +161,7 @@ xc_ia64_build_hob(int xc_handle, uint32_ return -1; } - if (build_hob(hob_buf, GFW_HOB_SIZE, memsize, vcpus) < 0) { + if (build_hob(hob_buf, GFW_HOB_SIZE, memsize) < 0) { free(hob_buf); PERROR("Could not build hob"); return -1; @@ -238,8 +258,7 @@ get_hob_size(void* hob_buf) } static int -build_hob(void* hob_buf, unsigned long hob_buf_size, - unsigned long dom_mem_size, unsigned long vcpus) +build_hob(void* hob_buf, unsigned long hob_buf_size, unsigned long dom_mem_size) { //Init HOB List if (hob_init(hob_buf, hob_buf_size) < 0) { @@ -252,10 +271,8 @@ build_hob(void* hob_buf, unsigned long h goto err_out; } - if (add_vcpus_hob(hob_buf, vcpus) < 0) { - PERROR("Add NR_VCPU hob failed, buffer too small"); - goto err_out; - } + // XXX Removed add_vcpus_hob() call since vcpus no longer available. + // May not work... if (add_pal_hob( hob_buf ) < 0) { PERROR("Add PAL hob failed, buffer too small"); @@ -314,12 +331,6 @@ add_mem_hob(void* hob_buf, unsigned long return -1; } return 0; -} - -static int -add_vcpus_hob(void* hob_buf, unsigned long vcpus) -{ - return hob_add(hob_buf, HOB_TYPE_NR_VCPU, &vcpus, sizeof(vcpus)); } static const unsigned char config_pal_bus_get_features_data[24] = { @@ -559,8 +570,8 @@ add_pal_hob(void* hob_buf) */ static int setup_guest(int xc_handle, uint32_t dom, unsigned long memsize, - char *image, unsigned long image_size, uint32_t vcpus, - unsigned int store_evtchn, unsigned long *store_mfn) + char *image, unsigned long image_size, + vcpu_guest_context_t *ctxt) { xen_pfn_t *pfn_list; shared_iopage_t *sp; @@ -647,11 +658,7 @@ setup_guest(int xc_handle, uint32_t dom, if (xc_domctl(xc_handle, &domctl)) goto error_out; - if (xc_domain_translate_gpfn_list(xc_handle, dom, nr_pages, - pfn_list, pfn_list)) { - PERROR("Could not translate addresses of HVM guest.\n"); - goto error_out; - } + // XXX FIXME: Used to call xc_domain_translate_gpfn_list() here. // Load guest firmware if (xc_ia64_copy_to_domain_pages(xc_handle, dom, image, @@ -662,18 +669,15 @@ setup_guest(int xc_handle, uint32_t dom, } // Hand-off state passed to guest firmware - if (xc_ia64_build_hob(xc_handle, dom, dom_memsize, - (unsigned long)vcpus) < 0) { + if (xc_ia64_build_hob(xc_handle, dom, dom_memsize) < 0) { PERROR("Could not build hob\n"); goto error_out; } xc_set_hvm_param(xc_handle, dom, HVM_PARAM_STORE_PFN, STORE_PAGE_START>>PAGE_SHIFT); - xc_set_hvm_param(xc_handle, dom, HVM_PARAM_STORE_EVTCHN, store_evtchn); // Retrieve special pages like io, xenstore, etc. - *store_mfn = pfn_list[nr_pages - 2]; sp = (shared_iopage_t *)xc_map_foreign_range(xc_handle, dom, PAGE_SIZE, PROT_READ | PROT_WRITE, pfn_list[nr_pages - 3]); @@ -695,12 +699,9 @@ error_out: } int -xc_hvm_build(int xc_handle, uint32_t domid, int memsize, - const char *image_name, unsigned int vcpus, unsigned int pae, - unsigned int acpi, unsigned int store_evtchn, - unsigned long *store_mfn) -{ - struct xen_domctl launch_domctl, domctl; +xc_hvm_build(int xc_handle, uint32_t domid, int memsize, const char *image_name) +{ + struct xen_domctl launch_domctl; int rc; vcpu_guest_context_t st_ctxt, *ctxt = &st_ctxt; char *image = NULL; @@ -726,18 +727,10 @@ xc_hvm_build(int xc_handle, uint32_t dom return 1; } - domctl.cmd = XEN_DOMCTL_getdomaininfo; - domctl.domain = (domid_t)domid; - if (do_domctl(xc_handle, &domctl) < 0 || - (uint16_t)domctl.domain != domid) { - PERROR("Could not get info on domain"); - goto error_out; - } - memset(ctxt, 0, sizeof(*ctxt)); if (setup_guest(xc_handle, domid, (unsigned long)memsize, image, - image_size, vcpus, store_evtchn, store_mfn) < 0) { + image_size, ctxt) < 0) { ERROR("Error constructing guest OS"); goto error_out; } diff -r d8c32fa3e3a9 tools/libxc/xc_linux_build.c --- a/tools/libxc/xc_linux_build.c Wed Nov 29 11:07:28 2006 -0700 +++ b/tools/libxc/xc_linux_build.c Wed Nov 29 15:23:42 2006 -0700 @@ -510,6 +510,12 @@ static int setup_guest(int xc_handle, goto error_out; } + /* XXX We used to call xc_domain_translate_gpfn_list() here, but + * that no longer exists. The xc_map_foreign_range() below fails + * (test added for NULL before the memset to avoid segfault), so + * we must need to do something. + */ + dsi.v_start = round_pgdown(dsi.v_start); vinitrd_start = round_pgup(dsi.v_end); start_info_mpa = (nr_pages - 3) << PAGE_SHIFT; @@ -565,6 +571,9 @@ static int setup_guest(int xc_handle, start_info = xc_map_foreign_range( xc_handle, dom, PAGE_SIZE, PROT_READ|PROT_WRITE, page_array[nr_pages - 3]); + if ( start_info == NULL ) + goto error_out; + memset(start_info, 0, sizeof(*start_info)); rc = xc_version(xc_handle, XENVER_version, NULL); sprintf(start_info->magic, "xen-%i.%i-ia64", rc >> 16, rc & (0xFFFF)); diff -r d8c32fa3e3a9 tools/python/xen/lowlevel/xc/xc.c --- a/tools/python/xen/lowlevel/xc/xc.c Wed Nov 29 11:07:28 2006 -0700 +++ b/tools/python/xen/lowlevel/xc/xc.c Wed Nov 29 15:23:42 2006 -0700 @@ -16,6 +16,7 @@ #include #include #include +#include #include "xenctrl.h" #include @@ -379,6 +380,7 @@ static PyObject *pyxc_hvm_build(XcObject char *image; int i, store_evtchn, memsize, vcpus = 1, pae = 0, acpi = 0, apic = 1; unsigned long store_mfn; + int page_size = getpagesize(); static char *kwd_list[] = { "domid", "store_evtchn", "memsize", "image", "vcpus", "pae", "acpi", @@ -392,7 +394,7 @@ static PyObject *pyxc_hvm_build(XcObject return PyErr_SetFromErrno(xc_error); /* Set up the HVM info table. */ - va_map = xc_map_foreign_range(self->xc_handle, dom, PAGE_SIZE, + va_map = xc_map_foreign_range(self->xc_handle, dom, page_size, PROT_READ | PROT_WRITE, HVM_INFO_PFN); if ( va_map == NULL ) @@ -407,7 +409,7 @@ static PyObject *pyxc_hvm_build(XcObject for ( i = 0, sum = 0; i < va_hvm->length; i++ ) sum += ((uint8_t *)va_hvm)[i]; va_hvm->checksum = -sum; - munmap(va_map, PAGE_SIZE); + munmap(va_map, page_size); xc_get_hvm_param(self->xc_handle, dom, HVM_PARAM_STORE_PFN, &store_mfn); xc_set_hvm_param(self->xc_handle, dom, HVM_PARAM_PAE_ENABLED, pae); diff -r d8c32fa3e3a9 xen/arch/ia64/vmx/vmx_hypercall.c --- a/xen/arch/ia64/vmx/vmx_hypercall.c Wed Nov 29 11:07:28 2006 -0700 +++ b/xen/arch/ia64/vmx/vmx_hypercall.c Wed Nov 29 15:23:42 2006 -0700 @@ -80,6 +80,7 @@ do_hvm_op(unsigned long op, XEN_GUEST_HA break; } +#if 0 /* XXX Can this be removed permanently? */ case HVMOP_set_irq_level: { struct xen_hvm_set_irq_level op; @@ -104,6 +105,7 @@ do_hvm_op(unsigned long op, XEN_GUEST_HA put_domain(d); break; } +#endif default: gdprintk(XENLOG_INFO, "Bad HVM op %ld.\n", op);