diff options
author | kfraser@localhost.localdomain <kfraser@localhost.localdomain> | 2006-11-27 17:49:41 +0000 |
---|---|---|
committer | kfraser@localhost.localdomain <kfraser@localhost.localdomain> | 2006-11-27 17:49:41 +0000 |
commit | da38d1f64bf737f7a89e32d032dd3459342aba5a (patch) | |
tree | 10336d2b9bf7628fdade1f5ac0059b3a18a9a9ba /tools/python | |
parent | 63e2f0bd68a7b2be82551c8640dde5f516b4dbb8 (diff) | |
download | xen-da38d1f64bf737f7a89e32d032dd3459342aba5a.tar.gz xen-da38d1f64bf737f7a89e32d032dd3459342aba5a.tar.bz2 xen-da38d1f64bf737f7a89e32d032dd3459342aba5a.zip |
[HVM] Re-introduce the 'apic' configuration option, default to 1.
Also simplify the HVM builder interface by doing more work in
the python wrapper, and fix mapping of shared_info page after the
change to map foreign pages by GMFN rather than MFN.
Signed-off-by: Keir Fraser <keir@xensource.com>
Diffstat (limited to 'tools/python')
-rw-r--r-- | tools/python/README.XendConfig | 1 | ||||
-rw-r--r-- | tools/python/README.sxpcfg | 1 | ||||
-rw-r--r-- | tools/python/xen/lowlevel/xc/xc.c | 45 | ||||
-rw-r--r-- | tools/python/xen/xend/image.py | 11 | ||||
-rw-r--r-- | tools/python/xen/xm/create.py | 12 |
5 files changed, 50 insertions, 20 deletions
diff --git a/tools/python/README.XendConfig b/tools/python/README.XendConfig index d860aac9c7..2e677f887a 100644 --- a/tools/python/README.XendConfig +++ b/tools/python/README.XendConfig @@ -123,6 +123,7 @@ otherConfig image.hvm.vncconsole image.hvm.pae image.hvm.acpi (also in image.devices) + image.hvm.apic image.hvm.devices.boot image.hvm.devices.fda image.hvm.devices.fdb diff --git a/tools/python/README.sxpcfg b/tools/python/README.sxpcfg index 9f7b787789..9beffd6ba0 100644 --- a/tools/python/README.sxpcfg +++ b/tools/python/README.sxpcfg @@ -56,6 +56,7 @@ image - vncconsole - pae - acpi + - apic (parseDeviceModel) - boot - fda diff --git a/tools/python/xen/lowlevel/xc/xc.c b/tools/python/xen/lowlevel/xc/xc.c index 51831838f7..2df6beaa54 100644 --- a/tools/python/xen/lowlevel/xc/xc.c +++ b/tools/python/xen/lowlevel/xc/xc.c @@ -13,10 +13,13 @@ #include <netinet/tcp.h> #include <sys/types.h> #include <sys/socket.h> +#include <sys/mman.h> #include <netdb.h> #include <arpa/inet.h> #include "xenctrl.h" +#include <xen/hvm/hvm_info_table.h> +#include <xen/hvm/params.h> /* Needed for Python versions earlier than 2.3. */ #ifndef PyMODINIT_FUNC @@ -371,25 +374,45 @@ static PyObject *pyxc_hvm_build(XcObject *self, PyObject *kwds) { uint32_t dom; + struct hvm_info_table *va_hvm; + uint8_t *va_map, sum; char *image; - int store_evtchn; - int memsize; - int vcpus = 1; - int pae = 0; - int acpi = 0; - unsigned long store_mfn = 0; + int i, store_evtchn, memsize, vcpus = 1, pae = 0, acpi = 0, apic = 1; + unsigned long store_mfn; static char *kwd_list[] = { "domid", "store_evtchn", "memsize", "image", "vcpus", "pae", "acpi", - NULL }; - if ( !PyArg_ParseTupleAndKeywords(args, kwds, "iiisiii", kwd_list, + "apic", NULL }; + if ( !PyArg_ParseTupleAndKeywords(args, kwds, "iiis|iiii", kwd_list, &dom, &store_evtchn, &memsize, - &image, &vcpus, &pae, &acpi) ) + &image, &vcpus, &pae, &acpi, &apic) ) return NULL; - if ( xc_hvm_build(self->xc_handle, dom, memsize, image, - vcpus, pae, acpi, store_evtchn, &store_mfn) != 0 ) + if ( xc_hvm_build(self->xc_handle, dom, memsize, image) != 0 ) + return PyErr_SetFromErrno(xc_error); + + /* Set up the HVM info table. */ + va_map = xc_map_foreign_range(self->xc_handle, dom, PAGE_SIZE, + PROT_READ | PROT_WRITE, + HVM_INFO_PFN); + if ( va_map == NULL ) return PyErr_SetFromErrno(xc_error); + va_hvm = (struct hvm_info_table *)(va_map + HVM_INFO_OFFSET); + memset(va_hvm, 0, sizeof(*va_hvm)); + strncpy(va_hvm->signature, "HVM INFO", 8); + va_hvm->length = sizeof(struct hvm_info_table); + va_hvm->acpi_enabled = acpi; + va_hvm->apic_mode = apic; + va_hvm->nr_vcpus = vcpus; + 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); + + 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); + xc_set_hvm_param(self->xc_handle, dom, HVM_PARAM_STORE_EVTCHN, + store_evtchn); return Py_BuildValue("{s:i}", "store_mfn", store_mfn); } diff --git a/tools/python/xen/xend/image.py b/tools/python/xen/xend/image.py index ab80f3e742..546e6eca38 100644 --- a/tools/python/xen/xend/image.py +++ b/tools/python/xen/xend/image.py @@ -252,7 +252,6 @@ class HVMImageHandler(ImageHandler): ImageHandler.__init__(self, vm, imageConfig, deviceConfig) self.shutdownWatch = None - def configure(self, imageConfig, deviceConfig): ImageHandler.configure(self, imageConfig, deviceConfig) @@ -277,9 +276,9 @@ class HVMImageHandler(ImageHandler): self.dmargs += self.configVNC(imageConfig) - self.pae = int(sxp.child_value(imageConfig, 'pae', 0)) - - self.acpi = int(sxp.child_value(imageConfig, 'acpi', 0)) + self.pae = int(sxp.child_value(imageConfig, 'pae', 1)) + self.acpi = int(sxp.child_value(imageConfig, 'acpi', 1)) + self.apic = int(sxp.child_value(imageConfig, 'apic', 1)) def buildDomain(self): store_evtchn = self.vm.getStorePort() @@ -293,6 +292,7 @@ class HVMImageHandler(ImageHandler): log.debug("vcpus = %d", self.vm.getVCpuCount()) log.debug("pae = %d", self.pae) log.debug("acpi = %d", self.acpi) + log.debug("apic = %d", self.apic) self.register_shutdown_watch() @@ -302,7 +302,8 @@ class HVMImageHandler(ImageHandler): memsize = mem_mb, vcpus = self.vm.getVCpuCount(), pae = self.pae, - acpi = self.acpi) + acpi = self.acpi, + apic = self.apic) # Return a list of cmd line args to the device models based on the # xm config file diff --git a/tools/python/xen/xm/create.py b/tools/python/xen/xm/create.py index 408c06b51d..e1df262c8f 100644 --- a/tools/python/xen/xm/create.py +++ b/tools/python/xen/xm/create.py @@ -174,13 +174,17 @@ gopts.var('cpus', val='CPUS', use="CPUS to run the domain on.") gopts.var('pae', val='PAE', - fn=set_int, default=0, + fn=set_int, default=1, use="Disable or enable PAE of HVM domain.") gopts.var('acpi', val='ACPI', - fn=set_int, default=0, + fn=set_int, default=1, use="Disable or enable ACPI of HVM domain.") +gopts.var('apic', val='APIC', + fn=set_int, default=1, + use="Disable or enable APIC mode.") + gopts.var('vcpus', val='VCPUS', fn=set_int, default=1, use="# of Virtual CPUS in domain.") @@ -664,9 +668,9 @@ def configure_hvm(config_image, vals): 'localtime', 'serial', 'stdvga', 'isa', 'nographic', 'soundhw', 'vnc', 'vncdisplay', 'vncunused', 'vncconsole', 'vnclisten', 'sdl', 'display', 'xauthority', - 'acpi', 'usb', 'usbdevice', 'keymap' ] + 'acpi', 'apic', 'usb', 'usbdevice', 'keymap' ] for a in args: - if (vals.__dict__[a]): + if a in vals.__dict__ and vals.__dict__[a] is not None: config_image.append([a, vals.__dict__[a]]) config_image.append(['vncpasswd', vals.vncpasswd]) |