mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 10:11:27 +01:00
[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>
This commit is contained in:
1 parent
63e2f0bd68
commit
da38d1f64b
14 files changed
+135
-170
No files matched your search
@@ -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
|
||||
|
||||
@@ -56,6 +56,7 @@ image
|
||||
- vncconsole
|
||||
- pae
|
||||
- acpi
|
||||
- apic
|
||||
(parseDeviceModel)
|
||||
- boot
|
||||
- fda
|
||||
|
||||
@@ -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,26 +374,46 @@ 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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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])
|
||||
|
||||
|
||||