[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] merge
# HG changeset patch # User vhanquez@xxxxxxxxxxxxxxxxxxxxxxx # Node ID 9fedfb8cb1b29d7a385c0b66a9077f4984950142 # Parent 2a873f8020ae8859a90c624dc78cbc6d9d3e9058 # Parent 5b30599761b3f0b85e6bb1768f0236294881e900 merge diff -r 2a873f8020ae -r 9fedfb8cb1b2 tools/examples/xmexample.vmx --- a/tools/examples/xmexample.vmx Tue Jan 3 13:03:35 2006 +++ b/tools/examples/xmexample.vmx Tue Jan 3 13:04:59 2006 @@ -29,6 +29,9 @@ #----------------------------------------------------------------------------- # the number of cpus guest platform has, default=1 vcpus=1 + +# enable/disalbe vmx guest ACPI, default=0 (disabled) +#acpi=0 # List of which CPUS this domain is allowed to use, default Xen picks #cpus = "" # leave to Xen to pick diff -r 2a873f8020ae -r 9fedfb8cb1b2 tools/firmware/vmxassist/Makefile --- a/tools/firmware/vmxassist/Makefile Tue Jan 3 13:03:35 2006 +++ b/tools/firmware/vmxassist/Makefile Tue Jan 3 13:04:59 2006 @@ -24,7 +24,7 @@ # The emulator code lives in ROM space TEXTADDR=0x000D0000 -DEFINES=-DDEBUG -D_ACPI_ -DTEXTADDR=$(TEXTADDR) +DEFINES=-DDEBUG -DTEXTADDR=$(TEXTADDR) XENINC=-I$(XEN_ROOT)/tools/libxc LD = ld diff -r 2a873f8020ae -r 9fedfb8cb1b2 tools/firmware/vmxassist/acpi_madt.c --- a/tools/firmware/vmxassist/acpi_madt.c Tue Jan 3 13:03:35 2006 +++ b/tools/firmware/vmxassist/acpi_madt.c Tue Jan 3 13:04:59 2006 @@ -24,23 +24,75 @@ extern int puts(const char *s); -#define VCPU_NR_PAGE 0x0009F000 -#define VCPU_NR_OFFSET 0x00000800 -#define VCPU_MAGIC 0x76637075 /* "vcpu" */ +#define HVM_INFO_PAGE 0x0009F000 +#define HVM_INFO_OFFSET 0x00000800 -/* xc_vmx_builder wrote vcpu block at 0x9F800. Return it. */ +struct hvm_info_table { + char signature[8]; /* "HVM INFO" */ + uint32_t length; + uint8_t checksum; + uint8_t acpi_enabled; + uint8_t pad[2]; + uint32_t nr_vcpus; +}; + +static struct hvm_info_table *table = NULL; + static int +checksum_valid(uint8_t *ptr, int len) +{ + uint8_t sum=0; + int i; + + for (i = 0; i < len; i++) + sum += ptr[i]; + + return (sum == 0); +} + +/* xc_vmx_builder wrote hvm info at 0x9F800. Return it. */ +static struct hvm_info_table * +get_hvm_info_table(void) +{ + struct hvm_info_table *t; + char signature[] = "HVM INFO"; + int i; + + if (table != NULL) + return table; + + t = (struct hvm_info_table *)(HVM_INFO_PAGE + HVM_INFO_OFFSET); + + /* strncmp(t->signature, "HVM INFO", 8) */ + for (i = 0; i < 8; i++) { + if (signature[i] != t->signature[i]) { + puts("Bad hvm info signature\n"); + return NULL; + } + } + + if (!checksum_valid((uint8_t *)t, t->length)) { + puts("Bad hvm info checksum\n"); + return NULL; + } + + table = t; + + return table; +} + +int get_vcpu_nr(void) { - unsigned int *vcpus; + struct hvm_info_table *t = get_hvm_info_table(); + return (t ? t->nr_vcpus : 1); /* default 1 vcpu */ +} - vcpus = (unsigned int *)(VCPU_NR_PAGE + VCPU_NR_OFFSET); - if (vcpus[0] != VCPU_MAGIC) { - puts("Bad vcpus magic, set vcpu number to 1 by default.\n"); - return 1; - } - - return vcpus[1]; +int +get_acpi_enabled(void) +{ + struct hvm_info_table *t = get_hvm_info_table(); + return (t ? t->acpi_enabled : 0); /* default no acpi */ } static void * diff -r 2a873f8020ae -r 9fedfb8cb1b2 tools/firmware/vmxassist/vmxloader.c --- a/tools/firmware/vmxassist/vmxloader.c Tue Jan 3 13:03:35 2006 +++ b/tools/firmware/vmxassist/vmxloader.c Tue Jan 3 13:04:59 2006 @@ -24,12 +24,10 @@ #include "machine.h" #include "roms.h" -#ifdef _ACPI_ #include "acpi.h" #include "../acpi/acpi2_0.h" // for ACPI_PHYSICAL_ADDRESS int acpi_madt_update(unsigned char* acpi_start); -#endif - +int get_acpi_enabled(void); /* * C runtime start off @@ -120,18 +118,17 @@ memcpy((void *)0xC0000, vgabios_stdvga, sizeof(vgabios_stdvga)); } -#ifdef _ACPI_ - puts("Loading ACPI ...\n"); - acpi_madt_update(acpi); - - if (ACPI_PHYSICAL_ADDRESS+sizeof(acpi) <= 0xF0000) { - /* make sure acpi table does not overlap rombios - * currently acpi less than 8K will be OK. - */ - memcpy((void *)ACPI_PHYSICAL_ADDRESS, acpi, sizeof(acpi)); + if (get_acpi_enabled() != 0) { + puts("Loading ACPI ...\n"); + acpi_madt_update((unsigned char*)acpi); + if (ACPI_PHYSICAL_ADDRESS+sizeof(acpi) <= 0xF0000) { + /* make sure acpi table does not overlap rombios + * currently acpi less than 8K will be OK. + */ + memcpy((void *)ACPI_PHYSICAL_ADDRESS, acpi, sizeof(acpi)); + } } -#endif puts("Loading VMXAssist ...\n"); memcpy((void *)TEXTADDR, vmxassist, sizeof(vmxassist)); diff -r 2a873f8020ae -r 9fedfb8cb1b2 tools/libxc/xc_vmx_build.c --- a/tools/libxc/xc_vmx_build.c Tue Jan 3 13:03:35 2006 +++ b/tools/libxc/xc_vmx_build.c Tue Jan 3 13:04:59 2006 @@ -33,8 +33,17 @@ #define E820_MAP_NR_OFFSET 0x000001E8 #define E820_MAP_OFFSET 0x000002D0 -#define VCPU_NR_PAGE 0x0009F000 -#define VCPU_NR_OFFSET 0x00000800 +#define HVM_INFO_PAGE 0x0009F000 +#define HVM_INFO_OFFSET 0x00000800 + +struct hvm_info_table { + char signature[8]; /* "HVM INFO" */ + uint32_t length; + uint8_t checksum; + uint8_t acpi_enabled; + uint8_t pad[2]; + uint32_t nr_vcpus; +}; struct e820entry { uint64_t addr; @@ -119,26 +128,45 @@ return (*(((unsigned char *)e820_page) + E820_MAP_NR_OFFSET) = nr_map); } +static void +set_hvm_info_checksum(struct hvm_info_table *t) +{ + uint8_t *ptr = (uint8_t *)t, sum = 0; + unsigned int i; + + t->checksum = 0; + + for (i = 0; i < t->length; i++) + sum += *ptr++; + + t->checksum = -sum; +} + /* - * Use E820 reserved memory 0x9F800 to pass number of vcpus to vmxloader - * vmxloader will use it to config ACPI MADT table + * Use E820 reserved memory 0x9F800 to pass HVM info to vmxloader + * vmxloader will use this info to set BIOS accordingly */ -#define VCPU_MAGIC 0x76637075 /* "vcpu" */ -static int set_vcpu_nr(int xc_handle, uint32_t dom, - unsigned long *pfn_list, unsigned int vcpus) -{ - char *va_map; - unsigned int *va_vcpus; +static int set_hvm_info(int xc_handle, uint32_t dom, + unsigned long *pfn_list, unsigned int vcpus, + unsigned int acpi) +{ + char *va_map; + struct hvm_info_table *va_hvm; va_map = xc_map_foreign_range(xc_handle, dom, PAGE_SIZE, PROT_READ|PROT_WRITE, - pfn_list[VCPU_NR_PAGE >> PAGE_SHIFT]); + pfn_list[HVM_INFO_PAGE >> PAGE_SHIFT]); if ( va_map == NULL ) return -1; - va_vcpus = (unsigned int *)(va_map + VCPU_NR_OFFSET); - va_vcpus[0] = VCPU_MAGIC; - va_vcpus[1] = vcpus; + 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->nr_vcpus = vcpus; + + set_hvm_info_checksum(va_hvm); munmap(va_map, PAGE_SIZE); @@ -281,6 +309,7 @@ unsigned int control_evtchn, unsigned int lapic, unsigned int vcpus, + unsigned int acpi, unsigned int store_evtchn, unsigned long *store_mfn) { @@ -490,8 +519,8 @@ goto error_out; } - if (set_vcpu_nr(xc_handle, dom, page_array, vcpus)) { - fprintf(stderr, "Couldn't set vcpu number for VMX guest.\n"); + if (set_hvm_info(xc_handle, dom, page_array, vcpus, acpi)) { + fprintf(stderr, "Couldn't set hvm info for VMX guest.\n"); goto error_out; } @@ -581,6 +610,7 @@ unsigned int control_evtchn, unsigned int lapic, unsigned int vcpus, + unsigned int acpi, unsigned int store_evtchn, unsigned long *store_mfn) { @@ -644,7 +674,7 @@ if ( setup_guest(xc_handle, domid, memsize, image, image_size, nr_pages, ctxt, op.u.getdomaininfo.shared_info_frame, control_evtchn, - lapic, vcpus, store_evtchn, store_mfn) < 0) + lapic, vcpus, acpi, store_evtchn, store_mfn) < 0) { ERROR("Error constructing guest OS"); goto error_out; diff -r 2a873f8020ae -r 9fedfb8cb1b2 tools/libxc/xenguest.h --- a/tools/libxc/xenguest.h Tue Jan 3 13:03:35 2006 +++ b/tools/libxc/xenguest.h Tue Jan 3 13:04:59 2006 @@ -58,6 +58,7 @@ unsigned int control_evtchn, unsigned int lapic, unsigned int vcpus, + unsigned int acpi, unsigned int store_evtchn, unsigned long *store_mfn); diff -r 2a873f8020ae -r 9fedfb8cb1b2 tools/python/xen/lowlevel/xc/xc.c --- a/tools/python/xen/lowlevel/xc/xc.c Tue Jan 3 13:03:35 2006 +++ b/tools/python/xen/lowlevel/xc/xc.c Tue Jan 3 13:04:59 2006 @@ -364,19 +364,20 @@ int control_evtchn, store_evtchn; int vcpus = 1; int lapic = 0; + int acpi = 0; int memsize; unsigned long store_mfn = 0; static char *kwd_list[] = { "dom", "control_evtchn", "store_evtchn", - "memsize", "image", "lapic", "vcpus", NULL }; - - if ( !PyArg_ParseTupleAndKeywords(args, kwds, "iiiisii", kwd_list, + "memsize", "image", "lapic", "vcpus", "acpi",NULL }; + + if ( !PyArg_ParseTupleAndKeywords(args, kwds, "iiiisiii", kwd_list, &dom, &control_evtchn, &store_evtchn, - &memsize, &image, &lapic, &vcpus) ) + &memsize, &image, &lapic, &vcpus,&acpi) ) return NULL; if ( xc_vmx_build(self->xc_handle, dom, memsize, image, control_evtchn, - lapic, vcpus, store_evtchn, &store_mfn) != 0 ) + lapic, vcpus, acpi, store_evtchn, &store_mfn) != 0 ) return PyErr_SetFromErrno(xc_error); return Py_BuildValue("{s:i}", "store_mfn", store_mfn); diff -r 2a873f8020ae -r 9fedfb8cb1b2 tools/python/xen/xend/image.py --- a/tools/python/xen/xend/image.py Tue Jan 3 13:03:35 2006 +++ b/tools/python/xen/xend/image.py Tue Jan 3 13:04:59 2006 @@ -214,6 +214,8 @@ if not lapic is None: self.lapic = int(lapic) + self.acpi = int(sxp.child_value(imageConfig, 'acpi', 0)) + def buildDomain(self): # Create an event channel self.device_channel = xc.evtchn_alloc_unbound(dom=self.vm.getDomid(), @@ -229,6 +231,7 @@ log.debug("memsize = %d", self.vm.getMemoryTarget() / 1024) log.debug("lapic = %d", self.lapic) log.debug("vcpus = %d", self.vm.getVCpuCount()) + log.debug("acpi = %d", self.acpi) return xc.vmx_build(dom = self.vm.getDomid(), image = self.kernel, @@ -236,8 +239,8 @@ store_evtchn = store_evtchn, memsize = self.vm.getMemoryTarget() / 1024, lapic = self.lapic, + acpi = self.acpi, vcpus = self.vm.getVCpuCount()) - # Return a list of cmd line args to the device models based on the # xm config file @@ -269,44 +272,44 @@ nics = 0 for (name, info) in deviceConfig: if name == 'vbd': - uname = sxp.child_value(info, 'uname') - typedev = sxp.child_value(info, 'dev') - (_, vbdparam) = string.split(uname, ':', 1) - if re.match('^ioemu:', typedev): - (emtype, vbddev) = string.split(typedev, ':', 1) - else: - emtype = 'vbd' - vbddev = typedev - if emtype != 'ioemu': - continue; - vbddev_list = ['hda', 'hdb', 'hdc', 'hdd'] - if vbddev not in vbddev_list: - raise VmError("vmx: for qemu vbd type=file&dev=hda~hdd") - ret.append("-%s" % vbddev) - ret.append("%s" % vbdparam) + uname = sxp.child_value(info, 'uname') + typedev = sxp.child_value(info, 'dev') + (_, vbdparam) = string.split(uname, ':', 1) + if 'ioemu:' in typedev: + (emtype, vbddev) = string.split(typedev, ':', 1) + else: + emtype = 'vbd' + vbddev = typedev + if emtype == 'vbd': + continue; + vbddev_list = ['hda', 'hdb', 'hdc', 'hdd'] + if vbddev not in vbddev_list: + raise VmError("vmx: for qemu vbd type=file&dev=hda~hdd") + ret.append("-%s" % vbddev) + ret.append("%s" % vbdparam) if name == 'vif': - type = sxp.child_value(info, 'type') - if type != 'ioemu': - continue - nics += 1 - if mac != None: - continue - mac = sxp.child_value(info, 'mac') - bridge = sxp.child_value(info, 'bridge') - if mac == None: - mac = randomMAC() - if bridge == None: - bridge = 'xenbr0' - ret.append("-macaddr") - ret.append("%s" % mac) - ret.append("-bridge") - ret.append("%s" % bridge) + type = sxp.child_value(info, 'type') + if type != 'ioemu': + continue + nics += 1 + if mac != None: + continue + mac = sxp.child_value(info, 'mac') + bridge = sxp.child_value(info, 'bridge') + if mac == None: + mac = randomMAC() + if bridge == None: + bridge = 'xenbr0' + ret.append("-macaddr") + ret.append("%s" % mac) + ret.append("-bridge") + ret.append("%s" % bridge) if name == 'vtpm': - instance = sxp.child_value(info, 'pref_instance') - ret.append("-instance") - ret.append("%s" % instance) + instance = sxp.child_value(info, 'pref_instance') + ret.append("-instance") + ret.append("%s" % instance) ret.append("-nics") - ret.append("%d" % nics) + ret.append("%d" % nics) return ret def configVNC(self, config): diff -r 2a873f8020ae -r 9fedfb8cb1b2 tools/python/xen/xend/server/blkif.py --- a/tools/python/xen/xend/server/blkif.py Tue Jan 3 13:03:35 2006 +++ b/tools/python/xen/xend/server/blkif.py Tue Jan 3 13:04:59 2006 @@ -31,7 +31,7 @@ """Block device interface controller. Handles all block devices for a domain. """ - + def __init__(self, vm): """Create a block device controller. """ @@ -40,9 +40,9 @@ def getDeviceDetails(self, config): """@see DevController.getDeviceDetails""" - + dev = sxp.child_value(config, 'dev') - if re.match('^ioemu:', dev): + if 'ioemu:' in dev: return (None,{},{}) devid = blkif.blkdev_name_to_number(dev) diff -r 2a873f8020ae -r 9fedfb8cb1b2 tools/python/xen/xm/create.py --- a/tools/python/xen/xm/create.py Tue Jan 3 13:03:35 2006 +++ b/tools/python/xen/xm/create.py Tue Jan 3 13:04:59 2006 @@ -163,6 +163,10 @@ gopts.var('lapic', val='LAPIC', fn=set_int, default=0, use="Disable or enable local APIC of VMX domain.") + +gopts.var('acpi', val='ACPI', + fn=set_int, default=0, + use="Disable or enable ACPI of VMX domain.") gopts.var('vcpus', val='VCPUS', fn=set_int, default=1, @@ -531,7 +535,7 @@ args = [ 'device_model', 'vcpus', 'cdrom', 'boot', 'fda', 'fdb', 'localtime', 'serial', 'stdvga', 'isa', 'nographic', 'audio', 'vnc', 'vncviewer', 'sdl', 'display', 'ne2000', 'lapic', - 'xauthority' ] + 'xauthority', 'acpi' ] for a in args: if (vals.__dict__[a]): config_image.append([a, vals.__dict__[a]]) _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |