aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorIan Campbell <ian.campbell@citrix.com>2010-09-08 16:47:32 +0100
committerIan Campbell <ian.campbell@citrix.com>2010-09-08 16:47:32 +0100
commitc9e3dd5b2afb9d3ae984f3444e4cf21440215f3e (patch)
tree5ef633211a0776eab1b1830984633924f43372dd /tools
parentecdd0b855fe190005c36d2637003498477549899 (diff)
downloadxen-c9e3dd5b2afb9d3ae984f3444e4cf21440215f3e.tar.gz
xen-c9e3dd5b2afb9d3ae984f3444e4cf21440215f3e.tar.bz2
xen-c9e3dd5b2afb9d3ae984f3444e4cf21440215f3e.zip
libxl: move hvm_build_set_params to libxl_dom.c
It is an internal function with only one caller. Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/libxl/Makefile2
-rw-r--r--tools/libxl/libxl_dom.c42
-rw-r--r--tools/libxl/libxl_internal.h6
3 files changed, 43 insertions, 7 deletions
diff --git a/tools/libxl/Makefile b/tools/libxl/Makefile
index 7c3529b7d1..a14724d0cb 100644
--- a/tools/libxl/Makefile
+++ b/tools/libxl/Makefile
@@ -27,7 +27,7 @@ else
LIBXL_OBJS-y += libxl_noblktap2.o
endif
-LIBXL_OBJS = flexarray.o libxl.o libxl_pci.o libxl_dom.o libxl_exec.o libxl_xshelp.o libxl_device.o libxl_internal.o xenguest.o libxl_utils.o $(LIBXL_OBJS-y)
+LIBXL_OBJS = flexarray.o libxl.o libxl_pci.o libxl_dom.o libxl_exec.o libxl_xshelp.o libxl_device.o libxl_internal.o libxl_utils.o $(LIBXL_OBJS-y)
LIBXL_OBJS += _libxl_types.o
AUTOINCS= libxlu_cfg_y.h libxlu_cfg_l.h
diff --git a/tools/libxl/libxl_dom.c b/tools/libxl/libxl_dom.c
index a54d8e91a2..7b386f96cd 100644
--- a/tools/libxl/libxl_dom.c
+++ b/tools/libxl/libxl_dom.c
@@ -20,6 +20,7 @@
#include <glob.h>
#include <inttypes.h>
#include <string.h>
+#include <sys/mman.h>
#include <sys/time.h> /* for struct timeval */
#include <unistd.h> /* for sleep(2) */
@@ -28,6 +29,8 @@
#include <xenguest.h>
#include <fcntl.h>
+#include <xen/hvm/hvm_info_table.h>
+
#include "libxl.h"
#include "libxl_internal.h"
@@ -216,6 +219,45 @@ out:
return ret == 0 ? 0 : ERROR_FAIL;
}
+static int hvm_build_set_params(xc_interface *handle, uint32_t domid,
+ libxl_domain_build_info *info,
+ int store_evtchn, unsigned long *store_mfn,
+ int console_evtchn, unsigned long *console_mfn)
+{
+ struct hvm_info_table *va_hvm;
+ uint8_t *va_map, sum;
+ int i;
+
+ va_map = xc_map_foreign_range(handle, domid,
+ XC_PAGE_SIZE, PROT_READ | PROT_WRITE,
+ HVM_INFO_PFN);
+ if (va_map == NULL)
+ return -1;
+
+ va_hvm = (struct hvm_info_table *)(va_map + HVM_INFO_OFFSET);
+ va_hvm->acpi_enabled = info->u.hvm.acpi;
+ va_hvm->apic_mode = info->u.hvm.apic;
+ va_hvm->nr_vcpus = info->max_vcpus;
+ memcpy(va_hvm->vcpu_online, &info->cur_vcpus, sizeof(info->cur_vcpus));
+ for (i = 0, sum = 0; i < va_hvm->length; i++)
+ sum += ((uint8_t *) va_hvm)[i];
+ 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_PAE_ENABLED, info->u.hvm.pae);
+#if defined(__i386__) || defined(__x86_64__)
+ xc_set_hvm_param(handle, domid, HVM_PARAM_VIRIDIAN, info->u.hvm.viridian);
+ xc_set_hvm_param(handle, domid, HVM_PARAM_HPET_ENABLED, (unsigned long) info->u.hvm.hpet);
+#endif
+ xc_set_hvm_param(handle, domid, HVM_PARAM_TIMER_MODE, (unsigned long) info->u.hvm.timer_mode);
+ xc_set_hvm_param(handle, domid, HVM_PARAM_VPT_ALIGN, (unsigned long) info->u.hvm.vpt_align);
+ xc_set_hvm_param(handle, domid, HVM_PARAM_STORE_EVTCHN, store_evtchn);
+ xc_set_hvm_param(handle, domid, HVM_PARAM_CONSOLE_EVTCHN, console_evtchn);
+ return 0;
+}
+
int libxl__build_hvm(libxl_ctx *ctx, uint32_t domid,
libxl_domain_build_info *info, libxl_domain_build_state *state)
{
diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h
index 95b86e66c3..762b76a444 100644
--- a/tools/libxl/libxl_internal.h
+++ b/tools/libxl/libxl_internal.h
@@ -181,12 +181,6 @@ _hidden int libxl__wait_for_device_model(libxl_ctx *ctx,
void *check_callback_userdata);
_hidden int libxl__wait_for_backend(libxl_ctx *ctx, char *be_path, char *state);
-/* from xenguest (helper */
-_hidden int hvm_build_set_params(xc_interface *handle, uint32_t domid,
- libxl_domain_build_info *info,
- int store_evtchn, unsigned long *store_mfn,
- int console_evtchn, unsigned long *console_mfn);
-
/* xl_exec */
/* higher-level double-fork and separate detach eg as for device models */