--- xen-3.2-3.2.0.orig/docs/ChangeLog +++ xen-3.2-3.2.0/docs/ChangeLog @@ -0,0 +1,65 @@ +This file contains a list of changes and additions to the API/ABI that +might affect cross-OS compatibility or otherwise impact OS +implementations, in particular any changes to hypervisor interfaces and +the inter-domain protocols. When making such a change you are expected +to add it here (bonus points for a link to fuller documentation). New +entries should be part of the patch making the change (so the history of +this file will give the relevant changeset), added to the top of the +file, and in a format like: + +2008-01-08 Add ChangeLog file + +Add a ChangeLog file indicating changes to the API/ABI, as discussed +here: +http://lists.xensource.com/archives/html/xen-devel/2008-01/msg00010.html + +Xen 3.2 release +--------------- + +16592: XEN_DOMCTL_test_assign_device +http://xenbits.xensource.com/xen-unstable.hg?rev/ef83b50fc4a4 + +Test VT-d device assignability in xend. If VT-d is not enabled, or the +device is not exist, or the device has already been assigned to other +domain, it fails and quits the domain creation. + +16549: GNTST_address_too_big +http://xenbits.xensource.com/xen-unstable.hg?rev/baf90ee3c1da + +32-on-64 related additional error return. + +16512: XEN_DOMCTL_set_opt_feature +http://xenbits.xensource.com/xen-unstable.hg?rev/1de4e5056394 + +Allows the domain builder to set optimization features for a guest. This +is currently only used by the IA64 domain builder to identify identity +mapped regions based on the guest_os_type specified in the domain config +file. Other architectures may extend this domctl to enable features +specific to their architecture. + +16504: flush cache disk op +http://xenbits.xensource.com/xen-unstable.hg?rev/ebfb3b26010d + +Adds a BLKIF_OP_FLUSH_DISKCACHE request. The backend is expected to ask +underlying storage to flush its cache upon receiving this request. +Backend advertises availability via 'feature-flush-cache' xenstore node. +Needed for correct behaviour of disk-cache-aware filesystems such as +ZFS. + +16425: multicast notifications +http://xenbits.xensource.com/xen-unstable.hg?rev/d3041196ae69 + +Adds XEN_NETIF_EXTRA_TYPE_MCAST_ADD and XEN_NETIF_EXTRA_TYPE_MCAST_DEL +operations to the networking driver, which it uses to request multicast +addresses it's interested in. Available if the backend has +'feature-multicast-control', requested by the frontend with +'request-multicast-control'. Used by Solaris: this avoids having to +always put the backend's underlying networking device into promiscuous +mode. + +16402: gnttab page attributes +http://xenbits.xensource.com/xen-unstable.hg?rev/2e5d922b7ee3 + +Adds new grant tab flags for table entries. + +Older changes are not recorded further. --- xen-3.2-3.2.0.orig/.hgtags +++ xen-3.2-3.2.0/.hgtags @@ -23,3 +23,6 @@ 458dc123dd02d38aaa9acb513d6f237a1c6e967e 3.2.0-rc2 ed79613b48817d5e0d1f9b3cf104c0e4e8b0d8cf 3.2.0-rc3 c5deb251b9dcece9e466a48a66d3528ca1797db4 3.2.0-rc4 +36bb2ab4722733d919d32e4555eb46cc6a06cb8f 3.2.0-rc5 +9facc624a238f2b9437b07fa28ff65884aa867f2 3.2.0-rc6 +6d9c23207e5f4aeb38da92cc30b90f30660a6abb RELEASE-3.2.0 --- xen-3.2-3.2.0.orig/tools/libxc/xc_hvm_build.c +++ xen-3.2-3.2.0/tools/libxc/xc_hvm_build.c @@ -77,13 +77,19 @@ e820entry[nr_map].type = E820_RESERVED; nr_map++; - /* Low RAM goes here. Remove 3 pages for ioreq, bufioreq, and xenstore. */ + /* + * Low RAM goes here. Remove 4 pages for: ioreq, bufioreq, and xenstore. + * 1. Guard page. + * 2. Buffered ioreq. + * 3. Xenstore. + * 4. Normal ioreq. + */ e820entry[nr_map].addr = 0x100000; - e820entry[nr_map].size = mem_size - 0x100000 - PAGE_SIZE * 3; + e820entry[nr_map].size = mem_size - 0x100000 - PAGE_SIZE * 4; e820entry[nr_map].type = E820_RAM; nr_map++; - /* Explicitly reserve space for special pages (ioreq and xenstore). */ + /* Explicitly reserve space for special pages. */ e820entry[nr_map].addr = mem_size - PAGE_SIZE * 3; e820entry[nr_map].size = PAGE_SIZE * 3; e820entry[nr_map].type = E820_RESERVED; @@ -244,6 +250,15 @@ else shared_page_nr = (v_end >> PAGE_SHIFT) - 1; + /* Free the guard page that separates low RAM from special pages. */ + rc = xc_domain_memory_decrease_reservation( + xc_handle, dom, 1, 0, &page_array[shared_page_nr-3]); + if ( rc != 0 ) + { + PERROR("Could not deallocate guard page for HVM guest.\n"); + goto error_out; + } + /* Paranoia: clean pages. */ if ( xc_clear_domain_page(xc_handle, dom, shared_page_nr) || xc_clear_domain_page(xc_handle, dom, shared_page_nr-1) || --- xen-3.2-3.2.0.orig/tools/libxen/include/xen/api/xen_common.h +++ xen-3.2-3.2.0/tools/libxen/include/xen/api/xen_common.h @@ -107,7 +107,7 @@ * minor, and extraversion of the Xen release with which it was released, * plus the library's own version as the patch. */ -extern xen_version *xen_get_client_side_version(); +extern xen_version *xen_get_client_side_version(void); extern bool --- xen-3.2-3.2.0.orig/tools/console/daemon/io.c +++ xen-3.2-3.2.0/tools/console/daemon/io.c @@ -246,7 +246,6 @@ } #ifdef __sun__ -/* Once Solaris has openpty(), this is going to be removed. */ static int openpty(int *amaster, int *aslave, char *name, struct termios *termp, struct winsize *winp) { @@ -278,8 +277,10 @@ if (winp) ioctl(sfd, TIOCSWINSZ, winp); + if (termp) + tcsetattr(sfd, TCSAFLUSH, termp); + assert(name == NULL); - assert(termp == NULL); return 0; @@ -289,7 +290,20 @@ close(mfd); return -1; } -#endif + +void cfmakeraw(struct termios *termios_p) +{ + termios_p->c_iflag &= + ~(IGNBRK|BRKINT|PARMRK|ISTRIP|INLCR|IGNCR|ICRNL|IXON); + termios_p->c_oflag &= ~OPOST; + termios_p->c_lflag &= ~(ECHO|ECHONL|ICANON|ISIG|IEXTEN); + termios_p->c_cflag &= ~(CSIZE|PARENB); + termios_p->c_cflag |= CS8; + + termios_p->c_cc[VMIN] = 0; + termios_p->c_cc[VTIME] = 0; +} +#endif /* __sun__ */ static int domain_create_tty(struct domain *dom) { @@ -299,11 +313,14 @@ bool success; char *data; unsigned int len; + struct termios term; assert(dom->slave_fd == -1); assert(dom->master_fd == -1); - if (openpty(&dom->master_fd, &dom->slave_fd, NULL, NULL, NULL) < 0) { + cfmakeraw(&term); + + if (openpty(&dom->master_fd, &dom->slave_fd, NULL, &term, NULL) < 0) { err = errno; dolog(LOG_ERR, "Failed to create tty for domain-%d (errno = %i, %s)", dom->domid, err, strerror(err)); --- xen-3.2-3.2.0.orig/tools/firmware/vmxassist/vm86.c +++ xen-3.2-3.2.0/tools/firmware/vmxassist/vm86.c @@ -1593,6 +1593,9 @@ goto invalid; } break; + case 0x06: /* clts */ + oldctx.cr0 &= ~CR0_TS; + return OPC_EMULATED; case 0x09: /* wbinvd */ return OPC_EMULATED; case 0x20: /* mov Rd, Cd (1h) */ --- xen-3.2-3.2.0.orig/tools/python/xen/xend/XendDomainInfo.py +++ xen-3.2-3.2.0/tools/python/xen/xend/XendDomainInfo.py @@ -535,6 +535,11 @@ self._createDevice(dev_type, dev_config_dict) self._waitForDevice(dev_type, devid) except VmError, ex: + del self.info['devices'][dev_uuid] + if dev_type == 'tap': + self.info['vbd_refs'].remove(dev_uuid) + else: + self.info['%s_refs' % dev_type].remove(dev_uuid) raise ex else: devid = None @@ -1650,9 +1655,10 @@ self._recreateDom() # Set timer configration of domain - if hvm: + timer_mode = self.info["platform"].get("timer_mode") + if hvm and timer_mode is not None: xc.hvm_set_param(self.domid, HVM_PARAM_TIMER_MODE, - long(self.info["platform"].get("timer_mode"))) + long(timer_mode)) # Set maximum number of vcpus in domain xc.domain_max_vcpus(self.domid, int(self.info['VCPUs_max'])) --- xen-3.2-3.2.0.orig/tools/python/xen/xend/XendAPI.py +++ xen-3.2-3.2.0/tools/python/xen/xend/XendAPI.py @@ -2475,6 +2475,7 @@ # Xen API: Class SR # ---------------------------------------------------------------- SR_attr_ro = ['VDIs', + 'PBDs', 'virtual_allocation', 'physical_utilisation', 'physical_size', @@ -2524,6 +2525,9 @@ def SR_get_VDIs(self, _, ref): return self._get_SR_func(ref, 'list_images') + def SR_get_PBDs(self, _, ref): + return xen_api_success(XendPBD.get_by_SR(ref)) + def SR_get_virtual_allocation(self, _, ref): return self._get_SR_func(ref, 'virtual_allocation') @@ -2531,7 +2535,7 @@ return self._get_SR_func(ref, 'physical_utilisation') def SR_get_physical_size(self, _, ref): - return self._get_SR_func(ref, 'physical_size') + return self._get_SR_attr(ref, 'physical_size') def SR_get_type(self, _, ref): return self._get_SR_attr(ref, 'type') --- xen-3.2-3.2.0.orig/tools/ioemu/xenstore.c +++ xen-3.2-3.2.0/tools/ioemu/xenstore.c @@ -85,6 +85,7 @@ *dev = NULL, *params = NULL, *type = NULL, *drv = NULL; int i, is_scsi, is_hdN = 0; unsigned int len, num, hd_index; + BlockDriverState *bs; for(i = 0; i < MAX_DISKS + MAX_SCSI_DISKS; i++) media_filename[i] = NULL; @@ -209,17 +210,17 @@ } } - bs_table[hd_index + (is_scsi ? MAX_DISKS : 0)] = bdrv_new(dev); + bs = bs_table[hd_index + (is_scsi ? MAX_DISKS : 0)] = bdrv_new(dev); /* check if it is a cdrom */ if (type && !strcmp(type, "cdrom")) { - bdrv_set_type_hint(bs_table[hd_index], BDRV_TYPE_CDROM); + bdrv_set_type_hint(bs, BDRV_TYPE_CDROM); if (pasprintf(&buf, "%s/params", bpath) != -1) xs_watch(xsh, buf, dev); } + /* open device now if media present */ if (params[0]) { - if (bdrv_open(bs_table[hd_index + (is_scsi ? MAX_DISKS : 0)], - params, 0 /* snapshot */) < 0) + if (bdrv_open(bs, params, 0 /* snapshot */) < 0) fprintf(stderr, "qemu: could not open hard disk image '%s'\n", params); } --- xen-3.2-3.2.0.orig/tools/ioemu/target-i386-dm/helper2.c +++ xen-3.2-3.2.0/tools/ioemu/target-i386-dm/helper2.c @@ -72,7 +72,7 @@ int domid = -1; int vcpus = 1; -int xc_handle; +extern int xc_handle; long time_offset = 0; --- xen-3.2-3.2.0.orig/tools/ioemu/target-i386-dm/qemu-ifup +++ xen-3.2-3.2.0/tools/ioemu/target-i386-dm/qemu-ifup @@ -34,4 +34,4 @@ fi ifconfig $1 0.0.0.0 up -brctl addif $bridge $1 +brctl addif $bridge $1 || true --- xen-3.2-3.2.0.orig/tools/ioemu/target-i386-dm/exec-dm.c +++ xen-3.2-3.2.0/tools/ioemu/target-i386-dm/exec-dm.c @@ -414,7 +414,7 @@ #if defined(__i386__) || defined(__x86_64__) #define phys_ram_addr(x) (qemu_map_cache(x)) #elif defined(__ia64__) -#define phys_ram_addr(x) ((addr < ram_size) ? (phys_ram_base + (x)) : NULL) +#define phys_ram_addr(x) (((x) < ram_size) ? (phys_ram_base + (x)) : NULL) #endif extern unsigned long *logdirty_bitmap; --- xen-3.2-3.2.0.orig/tools/ioemu/hw/ide.c +++ xen-3.2-3.2.0/tools/ioemu/hw/ide.c @@ -756,7 +756,9 @@ s->end_transfer_func = end_transfer_func; s->data_ptr = buf; s->data_end = buf + size; - s->status |= DRQ_STAT; + /* don't violate the HSM */ + if (!(s->status & ERR_STAT)) + s->status |= DRQ_STAT; buffered_pio_reset(s); } @@ -2011,6 +2013,7 @@ /* overlapping commands not supported */ if (s->feature & 0x02) goto abort_cmd; + s->status = READY_STAT; s->atapi_dma = s->feature & 1; s->nsector = 1; ide_transfer_start(s, s->io_buffer, ATAPI_PACKET_SIZE, --- xen-3.2-3.2.0.orig/tools/examples/block +++ xen-3.2-3.2.0/tools/examples/block @@ -329,7 +329,7 @@ if LANG=C losetup -h 2>&1 | grep read-only >/dev/null then - roflag="-$mode"; roflag="${roflag#-w}" + roflag="-$mode"; roflag="${roflag#-w}"; roflag="${roflag#-!}" else roflag='' fi --- xen-3.2-3.2.0.orig/tools/examples/network-bridge +++ xen-3.2-3.2.0/tools/examples/network-bridge @@ -96,12 +96,12 @@ do_ifup() { if ! ifup $1 ; then - if [ ${addr_pfx} ] ; then + if [ -n "$addr_pfx" ] ; then # use the info from get_ip_info() ip addr flush $1 ip addr add ${addr_pfx} dev $1 ip link set dev $1 up - [ ${gateway} ] && ip route add default via ${gateway} + [ -n "$gateway" ] && ip route add default via ${gateway} fi fi } @@ -121,7 +121,8 @@ ip addr show dev ${src} | egrep '^ *inet ' | sed -e " s/inet/ip addr add/ s@\([0-9]\+\.[0-9]\+\.[0-9]\+\.[0-9]\+/[0-9]\+\)@\1@ -s/${src}/dev ${dst}/ +s/${src}/dev ${dst} label ${dst}/ +s/secondary// " | sh -e # Remove automatic routes on destination device ip route list | sed -ne " --- xen-3.2-3.2.0.orig/debian/xen-utils-3.2.NEWS +++ xen-3.2-3.2.0/debian/xen-utils-3.2.NEWS @@ -0,0 +1,25 @@ +xen-3.0 (3.0.1-1) unstable; urgency=low + + If you are upgrading from official xen 2.0.6 packages (or unofficial 2.0.7 + ones) be careful: manual intervention is needed before you can boot into your + new Xen 3.0 system. In particular you *must* upgrade both your Domain 0 + kernel and your unprivileged domains ones with a xen-flavored version of + Linux 2.6.12. Instructions for how to do so are provided in the + README.Debian file, as they are useful for new users of Xen too. + + Also please note that Xen 2.0.6 has a bug and before getting removed doesn't + shutdown your domains. This, together with the fact that xen-utils for Xen + 3.0 is incompatible with the 2.0 hypervisor means that you won't be able to + control your domains after upgrading, other than through the network. So + please shut them all down before upgrading to this packages. + + If you want to be really sure that nothing will go wrong please reboot into + a normal Linux system before upgrading, upgrade from there, build the new + kernels, and only then start your new Xen 3.0 system. + + On the good news side: Xen 3.0 is able to automatically baloon down your + Domain 0 to the value specified in /etc/xen/xend-config.sxp. For it to be + able to do so, just remove your "dom0_mem=" option from the xen kernel line in + your grub.conf, and also the "mem=" option from your linux module line. + + -- Guido Trotter Tue, 21 Feb 2006 09:07:26 +0100 --- xen-3.2-3.2.0.orig/debian/python-xen-3.2.install +++ xen-3.2-3.2.0/debian/python-xen-3.2.install @@ -0,0 +1 @@ +usr/lib/python* --- xen-3.2-3.2.0.orig/debian/xen-hypervisor-3.2.postrm +++ xen-3.2-3.2.0/debian/xen-hypervisor-3.2.postrm @@ -0,0 +1,23 @@ +#!/bin/bash + +set -e + +case "$1" in + remove) + if command -v update-grub > /dev/null && [ -d /boot/grub ]; then + update-grub || : + fi + ;; + + purge|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear) + ;; + + *) + echo "postrm called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +#DEBHELPER# + +exit 0 --- xen-3.2-3.2.0.orig/debian/scripts/network-dummy +++ xen-3.2-3.2.0/debian/scripts/network-dummy @@ -0,0 +1,3 @@ +#!/bin/sh + +exit 0 --- xen-3.2-3.2.0.orig/debian/pycompat +++ xen-3.2-3.2.0/debian/pycompat @@ -0,0 +1,2 @@ +2 + --- xen-3.2-3.2.0.orig/debian/docs +++ xen-3.2-3.2.0/debian/docs @@ -0,0 +1 @@ +README --- xen-3.2-3.2.0.orig/debian/xen-utils-3.2.install +++ xen-3.2-3.2.0/debian/xen-utils-3.2.install @@ -0,0 +1,12 @@ +usr/sbin/* +usr/bin/* +usr/share/xen/* +etc/udev/*.rules +etc/xen/auto +etc/xen/scripts +etc/xen/xend* +var/log/xen +usr/share/man/* +usr/lib/xen/* +usr/share/xen/qemu/* +etc/xen/qemu-ifup --- xen-3.2-3.2.0.orig/debian/xen-utils-3.2.xend.init +++ xen-3.2-3.2.0/debian/xen-utils-3.2.xend.init @@ -0,0 +1,56 @@ +#!/bin/bash +### BEGIN INIT INFO +# Provides: xend +# Required-Start: $local_fs +# Required-Stop: $local_fs +# Default-Start: 2 3 4 5 +# Default-Stop: S 0 1 6 +# Short-Description: XEN control daemon +# Description: XEN control daemon +### END INIT INFO + +if ! grep -q "control_d" /proc/xen/capabilities ; then + exit 0 +fi + +# Wait for Xend to be up +function await_daemons_up +{ + i=1 + rets=10 + xend status + while [ $? -ne 0 -a $i -lt $rets ]; do + sleep 1 + echo -n . + i=$(($i + 1)) + xend status + done +} + +case "$1" in + start) + xend start + await_daemons_up + ;; + stop) + xend stop + ;; + status) + xend status + ;; + reload) + xend reload + ;; + restart|force-reload) + xend restart + await_daemons_up + ;; + *) + # do not advertise unreasonable commands that there is no reason + # to use with this device + echo $"Usage: $0 {start|stop|status|restart|reload|force-reload}" + exit 1 +esac + +exit $? + --- xen-3.2-3.2.0.orig/debian/rules +++ xen-3.2-3.2.0/debian/rules @@ -0,0 +1,217 @@ +#!/usr/bin/make -f + +# Uncomment this to turn on verbose mode. +export DH_VERBOSE=1 + +DEB_HOST_ARCH := $(shell dpkg-architecture -qDEB_HOST_ARCH) +DEB_BUILD_ARCH := $(shell dpkg-architecture -qDEB_BUILD_ARCH) +srcver := $(shell dpkg-parsechangelog | awk '/^Version:/ {print $$2}') +VERSION := 3.2.0 +MAJOR := 3.2 +BUILD_DIR = debian/build +STAMPS_DIR = debian/stamps + +LDFLAGS := +export LDFLAGS + +export DH_OPTIONS + +ifneq (,$(filter $(DEB_HOST_ARCH), i386 lpia)) +ARCH := XEN_TARGET_ARCH=x86_32 pae=y +endif +ifneq (,$(amd64, $(DEB_HOST_ARCH))) +ARCH := XEN_TARGET_ARCH=x86_64 +endif + +setup: $(STAMPS_DIR)/setup +$(STAMPS_DIR)/setup: $(BUILD_DIR) $(STAMPS_DIR) setup-docs setup-hypervisor setup-tools setup-headers + dh_testdir + touch $@ + +srcfiles := $(filter-out debian, $(wildcard * .[^.]*)) +$(STAMPS_DIR)/setup-patch: + @rm -rf $(BUILD_DIR)/source + mkdir $(BUILD_DIR)/source + cp -a $(srcfiles) $(BUILD_DIR)/source + cd $(BUILD_DIR)/source/ ; QUILT_PATCHES=$(CURDIR)/debian/patches quilt --quiltrc /dev/null push -a || test $$? = 2 + touch $@ + +$(STAMPS_DIR)/setup-docs: $(STAMPS_DIR)/setup-patch + @rm -rf $(BUILD_DIR)/build-docs + cp -a $(BUILD_DIR)/source/ $(BUILD_DIR)/build-docs + touch $@ + +$(STAMPS_DIR)/setup-hypervisor: $(STAMPS_DIR)/setup-patch + @rm -rf $(BUILD_DIR)/build-hypervisor + cp -a $(BUILD_DIR)/source/ $(BUILD_DIR)/build-hypervisor + touch $@ + +$(STAMPS_DIR)/setup-headers: $(STAMPS_DIR)/setup-patch + @rm -rf $(BUILD_DIR)/build-headers + cp -a $(BUILD_DIR)/source/ $(BUILD_DIR)/build-headers + touch $@ + +$(STAMPS_DIR)/setup-libs: $(STAMPS_DIR)/setup-patch + @rm -rf $(BUILD_DIR)/build-libs + cp -a $(BUILD_DIR)/source/ $(BUILD_DIR)/build-libs + touch $@ + +$(STAMPS_DIR)/setup-tools: $(STAMPS_DIR)/setup-patch + @rm -rf $(BUILD_DIR)/build-tools + cp -a $(BUILD_DIR)/source/ $(BUILD_DIR)/build-tools + touch $@ + +build: $(STAMPS_DIR)/build +$(STAMPS_DIR)/build: $(BUILD_DIR) $(STAMPS_DIR) $(STAMPS_DIR)/setup build-docs build-hypervisor build-tools + dh_testdir + touch $@ + +build-indep: + +$(STAMPS_DIR)/build-%: DIR=$(BUILD_DIR)/$(@F) + +$(STAMPS_DIR)/build-docs: $(STAMPS_DIR)/setup-docs + $(MAKE) -C $(DIR)/docs + touch $@ + +$(STAMPS_DIR)/build-hypervisor: $(STAMPS_DIR)/setup-hypervisor + $(MAKE) -C $(DIR)/xen $(ARCH) + touch $@ + +$(STAMPS_DIR)/build-tools: $(STAMPS_DIR)/setup-tools + $(MAKE) -C $(DIR)/tools XENFB_TOOLS=y + touch $@ + +setup-docs:: $(STAMPS_DIR)/setup-docs +build-docs:: $(STAMPS_DIR)/build-docs +setup-headers:: $(STAMPS_DIR)/setup-headers +build-headers:: $(STAMPS_DIR)/build-headers +setup-libs:: $(STAMPS_DIR)/setup-libs +build-libs:: $(STAMPS_DIR)/build-libs +build-hypervisor:: $(STAMPS_DIR)/build-hypervisor +setup-hypervisor:: $(STAMPS_DIR)/setup-hypervisor +ifneq (,$(filter amd64 i386 ia64 lpia, $(DEB_HOST_ARCH))) +build-tools:: $(STAMPS_DIR)/build-tools +install-tools-check:: install-tools +setup-tools:: $(STAMPS_DIR)/setup-tools +endif + +$(BUILD_DIR) $(STAMPS_DIR): + @[ -d $@ ] || mkdir $@ + +# This is to make dpatch-edit-patch work +unpatch: clean + +clean: + dh_testdir + rm -rf $(BUILD_DIR) $(STAMPS_DIR) + dh_clean + +install-arch: install-hypervisor install-tools-check install-libs install-headers + +install-indep: install-docs + +install-docs: DH_OPTIONS = -pxen-docs-$(MAJOR) +install-docs: + dh_testdir + dh_testroot + dh_clean -k + + $(MAKE) -C $(BUILD_DIR)/build-docs/docs install DESTDIR=$(CURDIR)/debian/tmp + dh_install --sourcedir=debian/tmp + +install-hypervisor: + dh_testdir + dh_testroot + dh_clean -k -pxen-hypervisor-$(MAJOR) + + mkdir debian/xen-hypervisor-$(MAJOR)/boot -p + cp $(BUILD_DIR)/build-hypervisor/xen/xen.gz debian/xen-hypervisor-$(MAJOR)/boot/xen-$(MAJOR).gz + +install-tools: DH_OPTIONS = -pxen-utils-$(MAJOR) -ppython-xen-${MAJOR} +install-tools: + dh_testdir + dh_testroot + dh_clean -k + + $(MAKE) -C $(BUILD_DIR)/build-docs/docs install DESTDIR=$(CURDIR)/debian/tmp + $(MAKE) -C $(BUILD_DIR)/build-tools/tools install XEN_PYTHON_NATIVE_INSTALL=1 DESTDIR=$(CURDIR)/debian/tmp DISTDIR=$(CURDIR)/debian/tmp + if [ "$(DEB_HOST_ARCH)" = "amd64" ]; then \ + mv $(CURDIR)/debian/tmp/usr/lib64/* $(CURDIR)/debian/tmp/usr/lib; \ + rm -rf $(CURDIR)/debian/tmp/usr/lib64; \ + fi +# strip --remove-section=.comment --remove-section=.note \ +# --strip-unneeded $(CURDIR)/debian/tmp/usr/lib/xen-ioemu-3.1/boot/hvmloader + + dh_install --sourcedir=debian/tmp + +install-libs: DH_OPTIONS = -plibxen3 +install-libs: + dh_testdir + dh_testroot + dh_clean -k + + $(MAKE) -C $(BUILD_DIR)/build-docs/docs install DESTDIR=$(CURDIR)/debian/tmp + $(MAKE) -C $(BUILD_DIR)/build-tools/tools install XEN_PYTHON_NATIVE_INSTALL=1 DESTDIR=$(CURDIR)/debian/tmp DISTDIR=$(CURDIR)/debian/tmp + if [ "$(DEB_HOST_ARCH)" = "amd64" ]; then \ + mv $(CURDIR)/debian/tmp/usr/lib64/* $(CURDIR)/debian/tmp/usr/lib; \ + rm -rf $(CURDIR)/debian/tmp/usr/lib64; \ + fi + dh_install --sourcedir=debian/tmp + +install-headers: DH_OPTIONS = -plibxen3-dev +install-headers: + dh_testdir + dh_testroot + dh_clean -k + + $(MAKE) -C $(BUILD_DIR)/build-headers/xen install DESTDIR=$(CURDIR)/debian/tmp + $(MAKE) -C $(BUILD_DIR)/build-headers/tools install XEN_PYTHON_NATIVE_INSTALL=1 DESTDIR=$(CURDIR)/debian/tmp DISTDIR=$(CURDIR)/debian/tmp + + install $(BUILD_DIR)/build-headers/tools/xenstore/xs*.h $(CURDIR)/debian/tmp/usr/include + install -d $(CURDIR)/debian/tmp/usr/include/xen/linux + dh_install --sourcedir=debian/tmp + + +# Build architecture-independent files here. +binary-indep: install-indep + dh_testdir + dh_testroot + dh_installchangelogs -i + dh_installdocs -i + dh_installexamples -i + dh_link -i + dh_strip -i + dh_compress -i -X.pdf + dh_fixperms -i + dh_installdeb -i + dh_shlibdeps -i + dh_gencontrol -i + dh_md5sums -i + dh_builddeb -i + +# Build architecture-dependent files here. +binary-arch: install-arch + dh_testdir + dh_testroot + dh_installchangelogs -s + dh_installdocs -s + dh_installexamples -s + dh_installinit -p xen-utils-$(MAJOR) --name xend -- defaults 20 21 + dh_installinit -p xen-utils-$(MAJOR) --name xendomains --no-restart-on-upgrade -- defaults 21 20 + dh_installman -s + dh_link -s + dh_strip -s + dh_compress -s + dh_fixperms -s + #dh_pycentral -s + dh_python -s + dh_makeshlibs -s + dh_installdeb -s + dh_shlibdeps -s + dh_gencontrol -s + dh_md5sums -s + dh_builddeb -s + +binary: binary-indep binary-arch +.PHONY: build clean binary-indep binary-arch binary install --- xen-3.2-3.2.0.orig/debian/libxen3-dev.install +++ xen-3.2-3.2.0/debian/libxen3-dev.install @@ -0,0 +1,3 @@ +usr/include/xen/* +usr/include/* +usr/lib/lib*.so --- xen-3.2-3.2.0.orig/debian/xen-utils-3.2.postrm +++ xen-3.2-3.2.0/debian/xen-utils-3.2.postrm @@ -0,0 +1,26 @@ +#!/bin/sh + +set -e + +case "$1" in +purge) + # Remove udev rules symlink + L="/etc/udev/rules.d/z60_xen-backend.rules" + [ -L "$L" ] && rm "$L" + + XENSTORED_DIR="/var/lib/xenstored" + [ -d "${XENSTORED_DIR}" ] && rm -r "${XENSTORED_DIR}" + ;; + +remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear) + ;; + +*) + echo "postrm called with unknown argument \`$1'" >&2 + exit + ;; +esac + +#DEBHELPER# + +exit 0 --- xen-3.2-3.2.0.orig/debian/control +++ xen-3.2-3.2.0/debian/control @@ -0,0 +1,70 @@ +Source: xen-3.2 +Section: misc +Priority: extra +Maintainer: Chuck Short +Build-Depends: debhelper (>= 5.0.37.2), libcurl3-dev, python-central (>= 0.5), python-all-dev, transfig, libsdl1.2-dev, libvncserver-dev, libjpeg-dev, bzip2, bcc, quilt, lsb-release, libc6-dev-i386 [amd64], libncurses5-dev, pciutils-dev, libxml2-dev,graphviz, gs-common, texlive-fonts-recommended, texlive-latex-recommended +XS-Python-Version: all +Standards-Version: 3.7.3.0 + +Package: xen-hypervisor-3.2 +Architecture: i386 amd64 +Provides: xen-hypervisor, xen-hypervisor-i386, xen-hypervisor-amd64 +Description: The Xen Hypervisor for i386 and amd64. + The hypervisor is the "core" for XEN itself. It gets booted by the boot loader + and controls cpu and memory, sharing them between your administrative domain + (Domain 0) and the virtual guest systems. + . + In order to boot a XEN system along with this package you also need a kernel + specifically crafted to work as the Domain 0, mediating hardware access for + XEN itself. An example config file for this kernel and documentation on how + to build it can be found in the xen-docs package. + . + This version of the hypervisor is built with support for systems with up to + 4GB of memory. If you have more please install the -pae version instead. + +Package: xen-utils-3.2 +Architecture: i386 amd64 +Depends: ${shlibs:Depends}, python, python-xen-3.2, xen-hypervisor-3.2, iproute, udev (>> 0.060) +Recommends: bridge-utils, libc6-xen +Provides: xen-utils +Conflicts: xen-utils, xen, libxen-python, libxen2.0, libxen2.0-dev, xen-utils-3.0 +Replaces: xen-utils-3.0 +Description: XEN administrative tools + The userspace tools to manage a system virtualized through the XEN virtual + machine monitor. + +Package: xen-docs-3.2 +Architecture: amd64 i386 +Replaces: xen-docs-3.0 +Description: documentation for XEN, a Virtual Machine Monitor + This package contains all the large documentation files for XEN. This + includes a description interface(both the api, and a nice explanation of + how XEN works). It also contains the VBD and Xeno howtos. + +Package: libxen3-dev +Architecture: amd64 i386 +Replaces: xen-utils-3.0 (<= 3.0.2+hg111412-5), libxen3.1-dev, libxen3.2-dev ( << libxen3.2-3.2.0-0ubuntu3), libxen3.0 +Conflicts: libxen3.0-dev +Depends: libxen3 (= ${Source-Version}) +Description: headers for Xen, a Virtual Machine Monitor + This package provides headers for interfacing with the Xen hypervisor and + related libraries. + +Package: libxen3 +Architecture: amd64 i386 +Replaces: xen-utils-3.0 (<= 3.0.2+hg111412-5), libxen3.1, libxen3.2 ( << libxen3.2-3.2.0-0ubuntu3) +Conflicts: libxen3.2 +Depends: ${shlibs:Depends} +Description: library interface for Xen, a Virtual Machine Monitor + library interface for Xen, a Virtual Machine Monitor. This package + provides the libraries for interfacing with the Xen hypervisor. + +Package: python-xen-3.2 +Architecture: amd64 i386 +Depends: python, python-dev +Replaces: xen-utils-3.0 (<= 3.0.2+hg111412-5), python-xen3.0, python-xen3.2, python-xen-3.1 +Conflicts: python-xen3.0, python3.2 +XB-Python-Version: ${python:Versions} +Description: python bindings for Xen, a Virtual Machine Monitor + python bindings for Xen, a Virtual Machine Monitor. This package + provides the python bindings for xen, used for tools such as libvirt. --- xen-3.2-3.2.0.orig/debian/copyright +++ xen-3.2-3.2.0/debian/copyright @@ -0,0 +1,251 @@ +Xen was initially debianized by Adam Heath + +It was downloaded from http://www.cl.cam.ac.uk/netos/xen + +The project is partially hosted on sourceforge. It's homepage on sf redirects +to the above url. Part of the development is carried on at http://www.xensource.com + +Copyright: + + This package is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 dated June, 1991. + + This package is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this package; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +This is the header of Xen 3.0 upstream COPYING file which clarifies a bit how +the licence is meant to be applied. The file continues with the complete text +of the GNU General Public Licence version 2, which is not included here as it +can be found on Debian GNU/Linux systems in `/usr/share/common-licenses/GPL-2'. + + + XEN NOTICE + ========== + +This license does *not* cover guest operating systems that use +Xen services via normal hypercalls - this is merely considered normal +use of Xen, and does *not* fall under the heading of "derived work". +Also note that the GPL below is copyrighted by the Free Software +Foundation, but the instance of code that it refers to (the Xen +virtual machine monitor) is copyrighted by me and others who actually +wrote it. + +Further note that the guest-OS interfacing header files, which +includes all files within the subdirectory include/public, are +*not* covered by the GPL but by a much weaker license: + include/public/COPYING + +Also note that the only valid version of the GPL as far as Xen is +concerned is _this_ particular version of the license (i.e., *only* +v2, not v2.2 or v3.x or whatever), unless explicitly otherwise +stated. + + -- Keir Fraser (on behalf of the Xen team) + +===================================================================== + + +As an exception, for the convenience of users who want to port other operating +systems to Xen, some files are licensed under a BSD-style licence. This licence +applies to all the files under the xen/include/public directory inside the +upstream tarball. This is the content of the COPYING file in that directory: + + +XEN NOTICE +========== + +This copyright applies to all files within this subdirectory. All +other files in the Xen source distribution are covered by version 2 of +the GNU General Public License. + + -- Keir Fraser (on behalf of the Xen team) + +===================================================================== + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to +deal in the Software without restriction, including without limitation the +rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + + +And this, for reference, is the list of the files it applies to: + +xen/include/public/acm.h +xen/include/public/acm_ops.h +xen/include/public/arch-ia64.h +xen/include/public/arch-x86_32.h +xen/include/public/arch-x86_64.h +xen/include/public/dom0_ops.h +xen/include/public/event_channel.h +xen/include/public/grant_table.h +xen/include/public/hvm/hvm_info_table.h +xen/include/public/hvm/ioreq.h +xen/include/public/hvm/vmx_assist.h +xen/include/public/io/blkif.h +xen/include/public/io/console.h +xen/include/public/io/netif.h +xen/include/public/io/ring.h +xen/include/public/io/tpmif.h +xen/include/public/io/xenbus.h +xen/include/public/io/xs_wire.h +xen/include/public/memory.h +xen/include/public/nmi.h +xen/include/public/physdev.h +xen/include/public/sched.h +xen/include/public/sched_ctl.h +xen/include/public/trace.h +xen/include/public/vcpu.h +xen/include/public/version.h +xen/include/public/xen.h + +and all the files under tools/python/logging + +===================================================================== +There are other exceptions: +===================================================================== + +The files under extras/mini-os are under a BSD licence. + +The following files are under the LGPL licence version 2.1, which on a Debian +system resides in /usr/share/common-licenses/LGPL-2.1. Unless explicitely +specified only version 2.1 of the licence can be used. + +tools/examples/block-common.sh +tools/examples/locking.sh +tools/examples/logging.sh +tools/examples/vif-common.sh +tools/examples/vtpm-hotplug-common.sh +tools/examples/xen-hotplug-common.sh +tools/examples/xen-network-common.sh +tools/examples/xen-script-common.sh +tools/firmware/rombios/apmbios.S +tools/firmware/rombios/rombios.c +ioemu/COPYING.LIB +ioemu/cpu-all.h +ioemu/cpu-defs.h +ioemu/cpu.h +ioemu/exec-all.h +ioemu/exec.c +ioemu/hw/fmopl.c +ioemu/target-i386-dm/helper2.c +ioemu/thunk.c +ioemu/thunk.h + +all the files under tools/firmware/vgabios (licence v2.1 or above) +all the files under tools/python/xen +all the files under tools/xenstore +all the files under tools/vnet +all the files under tools/xenstat + +===================================================================== +tools/vtpm_manager license + +Copyright (c) 2005, Intel Corp. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + * Neither the name of Intel Corporation nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED +OF THE POSSIBILITY OF SUCH DAMAGE. + +===================================================================== +Files tools/python/ license + + This software is Copyright (c) Zope Corporation (tm) and + Contributors. All rights reserved. + +This license has been certified as open source. It has also +been designated as GPL compatible by the Free Software +Foundation (FSF). + +Redistribution and use in source and binary forms, with or +without modification, are permitted provided that the +following conditions are met: + +1. Redistributions in source code must retain the above + copyright notice, this list of conditions, and the following + disclaimer. + +2. Redistributions in binary form must reproduce the above + copyright notice, this list of conditions, and the following + disclaimer in the documentation and/or other materials + provided with the distribution. + +3. The name Zope Corporation (tm) must not be used to + endorse or promote products derived from this software + without prior written permission from Zope Corporation. + +4. The right to distribute this software or to use it for + any purpose does not give you the right to use Servicemarks + (sm) or Trademarks (tm) of Zope Corporation. Use of them is + covered in a separate agreement (see + http://www.zope.com/Marks). + +5. If any files are modified, you must cause the modified + files to carry prominent notices stating that you changed + the files and the date of any change. + +Disclaimer + + THIS SOFTWARE IS PROVIDED BY ZOPE CORPORATION ``AS IS'' + AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT + NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN + NO EVENT SHALL ZOPE CORPORATION OR ITS CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH + DAMAGE. + +This software consists of contributions made by Zope +Corporation and many individuals on behalf of Zope +Corporation. Specific attributions are listed in the +accompanying credits file. + --- xen-3.2-3.2.0.orig/debian/xen-utils-3.2.xendomains.init +++ xen-3.2-3.2.0/debian/xen-utils-3.2.xendomains.init @@ -0,0 +1,516 @@ +#!/bin/bash +# +# /etc/init.d/xendomains +# Start / stop domains automatically when domain 0 boots / shuts down. +# +# chkconfig: 345 99 00 +# description: Start / stop Xen domains. +# +# This script offers fairly basic functionality. It should work on Redhat +# but also on LSB-compliant SuSE releases and on Debian with the LSB package +# installed. (LSB is the Linux Standard Base) +# +# Based on the example in the "Designing High Quality Integrated Linux +# Applications HOWTO" by Avi Alkalay +# +# +### BEGIN INIT INFO +# Provides: xendomains +# Required-Start: $syslog $remote_fs xend +# Should-Start: +# Required-Stop: $syslog $remote_fs xend +# Should-Stop: +# Default-Start: 3 4 5 +# Default-Stop: 0 1 2 6 +# Short-Description: Start/stop secondary xen domains +# Description: Start / stop domains automatically when domain 0 +# boots / shuts down. +### END INIT INFO + +# Correct exit code would probably be 5, but it's enough +# if xend complains if we're not running as privileged domain +if ! [ -e /proc/xen/privcmd ]; then + exit 0 +fi + +LOCKFILE=/var/lock/xendomains +XENDOM_CONFIG=/etc/default/xendomains + +test -r $XENDOM_CONFIG || { echo "$XENDOM_CONFIG not existing"; + if [ "$1" = "stop" ]; then exit 0; + else exit 6; fi; } + +. $XENDOM_CONFIG + +# Use the SUSE rc_ init script functions; +# emulate them on LSB, RH and other systems +if test -e /etc/rc.status; then + # SUSE rc script library + . /etc/rc.status +else + _cmd=$1 + declare -a _SMSG + if test "${_cmd}" = "status"; then + _SMSG=(running dead dead unused unknown) + _RC_UNUSED=3 + else + _SMSG=(done failed failed missed failed skipped unused failed failed) + _RC_UNUSED=6 + fi + if test -e /etc/init.d/functions; then + # REDHAT + . /etc/init.d/functions + echo_rc() + { + #echo -n " [${_SMSG[${_RC_RV}]}] " + if test ${_RC_RV} = 0; then + success " [${_SMSG[${_RC_RV}]}] " + else + failure " [${_SMSG[${_RC_RV}]}] " + fi + } + elif test -e /lib/lsb/init-functions; then + # LSB + . /lib/lsb/init-functions + if alias log_success_msg >/dev/null 2>/dev/null; then + echo_rc() + { + echo " [${_SMSG[${_RC_RV}]}] " + } + else + echo_rc() + { + if test ${_RC_RV} = 0; then + log_success_msg " [${_SMSG[${_RC_RV}]}] " + else + log_failure_msg " [${_SMSG[${_RC_RV}]}] " + fi + } + fi + else + # emulate it + echo_rc() + { + echo " [${_SMSG[${_RC_RV}]}] " + } + fi + rc_reset() { _RC_RV=0; } + rc_failed() + { + if test -z "$1"; then + _RC_RV=1; + elif test "$1" != "0"; then + _RC_RV=$1; + fi + return ${_RC_RV} + } + rc_check() + { + return rc_failed $? + } + rc_status() + { + rc_failed $? + if test "$1" = "-r"; then _RC_RV=0; shift; fi + if test "$1" = "-s"; then rc_failed 5; echo_rc; rc_failed 3; shift; fi + if test "$1" = "-u"; then rc_failed ${_RC_UNUSED}; echo_rc; rc_failed 3; shift; fi + if test "$1" = "-v"; then echo_rc; shift; fi + if test "$1" = "-r"; then _RC_RV=0; shift; fi + return ${_RC_RV} + } + rc_exit() { exit ${_RC_RV}; } + rc_active() + { + if test -z "$RUNLEVEL"; then read RUNLEVEL REST < <(/sbin/runlevel); fi + if test -e /etc/init.d/S[0-9][0-9]${1}; then return 0; fi + return 1 + } +fi + +if ! which usleep >&/dev/null +then + usleep() + { + if [ -n "$1" ] + then + sleep $(( $1 / 1000000 )) + fi + } +fi + +# Reset status of this service +rc_reset + +## +# Returns 0 (success) if the given parameter names a directory, and that +# directory is not empty. +# +contains_something() +{ + if [ -d "$1" ] && [ `/bin/ls $1 | wc -l` -gt 0 ] + then + return 0 + else + return 1 + fi +} + +# read name from xen config file +rdname() +{ + NM=$(xm create --quiet --dryrun --defconfig "$1" | + sed -n 's/^.*(name \(.*\))$/\1/p') +} + +rdnames() +{ + NAMES= + if ! contains_something "$XENDOMAINS_AUTO" + then + return + fi + for dom in $XENDOMAINS_AUTO/*; do + rdname $dom + if test -z $NAMES; then + NAMES=$NM; + else + NAMES="$NAMES|$NM" + fi + done +} + +parseln() +{ + name=`echo "$1" | cut -d\ -f1` + name=${name%% *} + rest=`echo "$1" | cut cut -d\ -f2-` + read id mem cpu vcpu state tm < <(echo "$rest") +} + +is_running() +{ + rdname $1 + RC=1 + while read LN; do + parseln "$LN" + if test $id = 0; then continue; fi + case $name in + ($NM) + RC=0 + ;; + esac + done < <(xm list | grep -v '^Name') + return $RC +} + +start() +{ + if [ -f $LOCKFILE ]; then + echo -n "xendomains already running (lockfile exists)" + return; + fi + + saved_domains=" " + if [ "$XENDOMAINS_RESTORE" = "true" ] && + contains_something "$XENDOMAINS_SAVE" + then + mkdir -p $(dirname "$LOCKFILE") + touch $LOCKFILE + echo -n "Restoring Xen domains:" + saved_domains=`ls $XENDOMAINS_SAVE` + for dom in $XENDOMAINS_SAVE/*; do + echo -n " ${dom##*/}" + xm restore $dom + if [ $? -ne 0 ]; then + rc_failed $? + echo -n '!' + else + # mv $dom ${dom%/*}/.${dom##*/} + rm $dom + fi + done + echo . + fi + + if contains_something "$XENDOMAINS_AUTO" + then + touch $LOCKFILE + echo -n "Starting auto Xen domains:" + # We expect config scripts for auto starting domains to be in + # XENDOMAINS_AUTO - they could just be symlinks to files elsewhere + + # Create all domains with config files in XENDOMAINS_AUTO. + # TODO: We should record which domain name belongs + # so we have the option to selectively shut down / migrate later + # If a domain statefile from $XENDOMAINS_SAVE matches a domain name + # in $XENDOMAINS_AUTO, do not try to start that domain; if it didn't + # restore correctly it requires administrative attention. + for dom in $XENDOMAINS_AUTO/*; do + echo -n " ${dom##*/}" + shortdom=$(echo $dom | sed -n 's/^.*\/\(.*\)$/\1/p') + echo $saved_domains | grep -w $shortdom > /dev/null + if [ $? -eq 0 ] || is_running $dom; then + echo -n "(skip)" + else + xm create --quiet --defconfig $dom + if [ $? -ne 0 ]; then + rc_failed $? + echo -n '!' + else + usleep $XENDOMAINS_CREATE_USLEEP + fi + fi + done + fi +} + +all_zombies() +{ + while read LN; do + parseln "$LN" + if test $id = 0; then continue; fi + if test "$state" != "-b---d" -a "$state" != "-----d"; then + return 1; + fi + done < <(xm list | grep -v '^Name') + return 0 +} + +# Wait for max $XENDOMAINS_STOP_MAXWAIT for xm $1 to finish; +# if it has not exited by that time kill it, so the init script will +# succeed within a finite amount of time; if $2 is nonnull, it will +# kill the command as well as soon as no domain (except for zombies) +# are left (used for shutdown --all). +watchdog_xm() +{ + if test -z "$XENDOMAINS_STOP_MAXWAIT" -o "$XENDOMAINS_STOP_MAXWAIT" = "0"; then + exit + fi + usleep 20000 + for no in `seq 0 $XENDOMAINS_STOP_MAXWAIT`; do + # exit if xm save/migrate/shutdown is finished + PSAX=`ps axlw | grep "xm $1" | grep -v grep` + if test -z "$PSAX"; then exit; fi + echo -n "."; sleep 1 + # go to kill immediately if there's only zombies left + if all_zombies && test -n "$2"; then break; fi + done + sleep 1 + read PSF PSUID PSPID PSPPID < <(echo "$PSAX") + # kill xm $1 + kill $PSPID >/dev/null 2>&1 +} + +stop() +{ + # Collect list of domains to shut down + if test "$XENDOMAINS_AUTO_ONLY" = "true"; then + rdnames + fi + echo -n "Shutting down Xen domains:" + while read LN; do + parseln "$LN" + if test $id = 0; then continue; fi + echo -n " $name" + if test "$XENDOMAINS_AUTO_ONLY" = "true"; then + case $name in + ($NAMES) + # nothing + ;; + (*) + echo -n "(skip)" + continue + ;; + esac + fi + # XENDOMAINS_SYSRQ chould be something like just "s" + # or "s e i u" or even "s e s i u o" + # for the latter, you should set XENDOMAINS_USLEEP to 1200000 or so + if test -n "$XENDOMAINS_SYSRQ"; then + for sysrq in $XENDOMAINS_SYSRQ; do + echo -n "(SR-$sysrq)" + xm sysrq $id $sysrq + if test $? -ne 0; then + rc_failed $? + echo -n '!' + fi + # usleep just ignores empty arg + usleep $XENDOMAINS_USLEEP + done + fi + if test "$state" = "-b---d" -o "$state" = "-----d"; then + echo -n "(zomb)" + continue + fi + if test -n "$XENDOMAINS_MIGRATE"; then + echo -n "(migr)" + watchdog_xm migrate & + WDOG_PID=$! + xm migrate $id $XENDOMAINS_MIGRATE + if test $? -ne 0; then + rc_failed $? + echo -n '!' + kill $WDOG_PID >/dev/null 2>&1 + else + kill $WDOG_PID >/dev/null 2>&1 + continue + fi + fi + if test -n "$XENDOMAINS_SAVE"; then + echo -n "(save)" + watchdog_xm save & + WDOG_PID=$! + mkdir -p "$XENDOMAINS_SAVE" + xm save $id $XENDOMAINS_SAVE/$name + if test $? -ne 0; then + rc_failed $? + echo -n '!' + kill $WDOG_PID >/dev/null 2>&1 + else + kill $WDOG_PID >/dev/null 2>&1 + continue + fi + fi + if test -n "$XENDOMAINS_SHUTDOWN"; then + # XENDOMAINS_SHUTDOWN should be "--halt --wait" + echo -n "(shut)" + watchdog_xm shutdown & + WDOG_PID=$! + xm shutdown $id $XENDOMAINS_SHUTDOWN + if test $? -ne 0; then + rc_failed $? + echo -n '!' + fi + kill $WDOG_PID >/dev/null 2>&1 + fi + done < <(xm list | grep -v '^Name') + + # NB. this shuts down ALL Xen domains (politely), not just the ones in + # AUTODIR/* + # This is because it's easier to do ;-) but arguably if this script is run + # on system shutdown then it's also the right thing to do. + if ! all_zombies && test -n "$XENDOMAINS_SHUTDOWN_ALL"; then + # XENDOMAINS_SHUTDOWN_ALL should be "--all --halt --wait" + echo -n " SHUTDOWN_ALL " + watchdog_xm shutdown 1 & + WDOG_PID=$! + xm shutdown $XENDOMAINS_SHUTDOWN_ALL + if test $? -ne 0; then + rc_failed $? + echo -n '!' + fi + kill $WDOG_PID >/dev/null 2>&1 + fi + + # Unconditionally delete lock file + rm -f $LOCKFILE +} + +check_domain_up() +{ + while read LN; do + parseln "$LN" + if test $id = 0; then continue; fi + case $name in + ($1) + return 0 + ;; + esac + done < <(xm list | grep -v "^Name") + return 1 +} + +check_all_auto_domains_up() +{ + if ! contains_something "$XENDOMAINS_AUTO" + then + return 0 + fi + missing= + for nm in $XENDOMAINS_AUTO/*; do + rdname $nm + found=0 + if check_domain_up "$NM"; then + echo -n " $name" + else + missing="$missing $NM" + fi + done + if test -n "$missing"; then + echo -n " MISS AUTO:$missing" + return 1 + fi + return 0 +} + +check_all_saved_domains_up() +{ + if ! contains_something "$XENDOMAINS_SAVE" + then + return 0 + fi + missing=`/bin/ls $XENDOMAINS_SAVE` + echo -n " MISS SAVED: " $missing + return 1 +} + +# This does NOT necessarily restart all running domains: instead it +# stops all running domains and then boots all the domains specified in +# AUTODIR. If other domains have been started manually then they will +# not get restarted. +# Commented out to avoid confusion! + +restart() +{ + stop + start +} + +reload() +{ + restart +} + + +case "$1" in + start) + start + rc_status + if test -f $LOCKFILE; then rc_status -v; fi + ;; + + stop) + stop + rc_status -v + ;; + + restart) + restart + ;; + reload) + reload + ;; + force-reload) + reload + ;; + status) + echo -n "Checking for xendomains:" + if test ! -f $LOCKFILE; then + rc_failed 3 + else + check_all_auto_domains_up + rc_status + check_all_saved_domains_up + rc_status + fi + rc_status -v + ;; + + *) + echo "Usage: $0 {start|stop|restart|reload|status}" + rc_failed 3 + rc_status -v + ;; +esac + +rc_exit --- xen-3.2-3.2.0.orig/debian/xen-utils-3.2.postinst +++ xen-3.2-3.2.0/debian/xen-utils-3.2.postinst @@ -0,0 +1,28 @@ +#!/bin/sh + +set -e + +case "$1" in +configure) + # Set up udev rules symlink + L="/etc/udev/rules.d/z60_xen-backend.rules" + [ ! -z "$2" ] || [ -e "$L" ] || [ -L "$L" ] || ln -s ../xen-backend.rules "$L" + + XENSTORED_DIR="/var/lib/xenstored" + [ ! -d "${XENSTORED_DIR}" ] && install -d -m 0700 "${XENSTORED_DIR}" + install -d -m 2750 -g adm /var/log/xen + + ;; + +abort-upgrade|abort-remove|abort-deconfigure) + ;; + +*) + echo "postinst called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +#DEBHELPER# + +exit 0 --- xen-3.2-3.2.0.orig/debian/xen-utils-3.2.xendomains.default +++ xen-3.2-3.2.0/debian/xen-utils-3.2.xendomains.default @@ -0,0 +1,137 @@ +## Path: System/xen +## Description: xen domain start/stop on boot +## Type: string +## Default: +# +# The xendomains script can send SysRq requests to domains on shutdown. +# If you don't want to MIGRATE, SAVE, or SHUTDOWN, this may be a possibility +# to do a quick and dirty shutdown ("s e i u o") or at least sync the disks +# of the domains ("s"). +# +XENDOMAINS_SYSRQ="" + +## Type: integer +## Default: 100000 +# +# If XENDOMAINS_SYSRQ is set, this variable determines how long to wait +# (in microseconds) after each SysRq, so the domain has a chance to react. +# If you want to a quick'n'dirty shutdown via SysRq, you may want to set +# it to a relatively high value (1200000). +# +XENDOMAINS_USLEEP=100000 + +## Type: integer +## Default: 5000000 +# +# When creating a guest domain, it is sensible to allow a little time for it +# to get started before creating another domain or proceeding through the +# boot process. Without this, the booting guests will thrash the disk as they +# start up. This timeout (in microseconds) specifies the delay after guest +# domain creation. +# +XENDOMAINS_CREATE_USLEEP=5000000 + +## Type: string +## Default: "" +# +# Set this to a non-empty string if you want to migrate virtual machines +# on shutdown. The string will be passed to the xm migrate DOMID command +# as is: It should contain the target IP address of the physical machine +# to migrate to and optionally parameters like --live. Leave empty if +# you don't want to try virtual machine relocation on shutdown. +# If migration succeeds, neither SAVE nor SHUTDOWN will be executed for +# that domain. +# +XENDOMAINS_MIGRATE="" + +## Type: string +## Default: /var/lib/xen/save +# +# Directory to save running domains to when the system (dom0) is +# shut down. Will also be used to restore domains from if # XENDOMAINS_RESTORE +# is set (see below). Leave empty to disable domain saving on shutdown +# (e.g. because you rather shut domains down). +# If domain saving does succeed, SHUTDOWN will not be executed. +# +XENDOMAINS_SAVE=/var/lib/xen/save + +## Type: string +## Default: "--halt --wait" +# +# If neither MIGRATE nor SAVE were enabled or if they failed, you can +# try to shut down a domain by sending it a shutdown request. To do this, +# set this to "--halt --wait". Omit the "--wait" flag to avoid waiting +# for the domain to be really down. Leave empty to skip domain shutdown. +# +XENDOMAINS_SHUTDOWN="--halt --wait" + +## Type: string +## Default: "--all --halt --wait" +# +# After we have gone over all virtual machines (resp. all automatically +# started ones, see XENDOMAINS_AUTO_ONLY below) in a loop and sent SysRq, +# migrated, saved and/or shutdown according to the settings above, we +# might want to shutdown the virtual machines that are still running +# for some reason or another. To do this, set this variable to +# "--all --halt --wait", it will be passed to xm shutdown. +# Leave it empty not to do anything special here. +# (Note: This will hit all virtual machines, even if XENDOMAINS_AUTO_ONLY +# is set.) +# +XENDOMAINS_SHUTDOWN_ALL="--all --halt --wait" + +## Type: boolean +## Default: true +# +# This variable determines whether saved domains from XENDOMAINS_SAVE +# will be restored on system startup. +# +XENDOMAINS_RESTORE=true + +## Type: string +## Default: /etc/xen/auto +# +# This variable sets the directory where domains configurations +# are stored that should be started on system startup automatically. +# Leave empty if you don't want to start domains automatically +# (or just don't place any xen domain config files in that dir). +# Note that the script tries to be clever if both RESTORE and AUTO are +# set: It will first restore saved domains and then only start domains +# in AUTO which are not running yet. +# Note that the name matching is somewhat fuzzy. +# +XENDOMAINS_AUTO=/etc/xen/auto + +## Type: boolean +## Default: false +# +# If this variable is set to "true", only the domains started via config +# files in XENDOMAINS_AUTO will be treated according to XENDOMAINS_SYSRQ, +# XENDOMAINS_MIGRATE, XENDOMAINS_SAVE, XENDMAINS_SHUTDOWN; otherwise +# all running domains will be. +# Note that the name matching is somewhat fuzzy. +# +XENDOMAINS_AUTO_ONLY=false + +## Type: integer +## Default: 300 +# +# On xendomains stop, a number of xm commands (xm migrate, save, shutdown, +# shutdown --all) may be executed. In the worst case, these commands may +# stall forever, which will prevent a successful shutdown of the machine. +# If this variable is non-zero, the script will set up a watchdog timer +# for every of these xm commands and time it out after the number of seconds +# specified by this variable. +# Note that SHUTDOWN_ALL will not be called if no virtual machines or only +# zombies are still running, so you don't need to enable this timeout just +# for the zombie case. +# The setting should be large enough to make sure that migrate/save/shutdown +# can succeed. If you do live migrations, keep in mind that live migration +# of a 1GB machine over Gigabit ethernet may actually take something like +# 100s (assuming that live migration uses 10% of the network # bandwidth). +# Depending on the virtual machine, a shutdown may also require a significant +# amount of time. So better setup this variable to a huge number and hope the +# watchdog never fires. +# +XENDOMAINS_STOP_MAXWAIT=300 + --- xen-3.2-3.2.0.orig/debian/compat +++ xen-3.2-3.2.0/debian/compat @@ -0,0 +1 @@ +4 --- xen-3.2-3.2.0.orig/debian/libxen3.install +++ xen-3.2-3.2.0/debian/libxen3.install @@ -0,0 +1,2 @@ +usr/lib/lib*.so.* +usr/lib/fs/*/fsimage.so --- xen-3.2-3.2.0.orig/debian/changelog +++ xen-3.2-3.2.0/debian/changelog @@ -0,0 +1,689 @@ +xen-3.2 (3.2.0-0ubuntu10) hardy; urgency=low + + * debian/xen-utils-3.2.xendomains.init + - fix cut in the init script. (LP: #208300) + * debian/xen-utils-3.2.install (LP: #201765) + - fixed missing /etc/xen/qemu-ifup + * debian/patches/xen-ubuntu-fixes.diff + - Added fixes from xen-3.1 + * debian/xen-utils-3.2.xend.init + - Disable loading of modules since they are builtin into the kernel. + + -- Chuck Short Thu, 03 Apr 2008 15:28:08 -0400 + +xen-3.2 (3.2.0-0ubuntu9) hardy; urgency=low + + * Fixed typo in debian/rules. Init scripts are back. (LP: #191875) + * Disabled suse patches. (LP: #199533) + * Dont conflict with libxen3.0 (LP: #199467) + + -- Chuck Short Thu, 13 Mar 2008 07:24:42 -0400 + +xen-3.2 (3.2.0-0ubuntu8) hardy; urgency=low + + * Removed python-xml from depends. (LP: #199014) + * Conflict with python-xen-3.1. (LP: #196020) + + -- Chuck Short Thu, 06 Mar 2008 09:08:08 -0500 + +xen-3.2 (3.2.0-0ubuntu7) hardy; urgency=low + + * Really re-add the init script. + + -- Chuck Short Sun, 24 Feb 2008 08:52:21 -0500 + +xen-3.2 (3.2.0-0ubuntu6) hardy; urgency=low + + * Clear LDFLAGS values that might be set in the environment because + the Xen build uses them in a non-standard way. Thanks to Steve Langasek. + + -- Chuck Short Thu, 21 Feb 2008 07:07:18 -0500 + +xen-3.2 (3.2.0-0ubuntu5) hardy; urgency=low + + * Readded init script. (LP: #191875) + + -- Chuck Short Fri, 15 Feb 2008 19:58:12 -0500 + +xen-3.2 (3.2.0-0ubuntu4) hardy; urgency=low + + * Renamed libxen3.2 to libxen3. + + -- Chuck Short Wed, 06 Feb 2008 08:51:32 -0500 + +xen-3.2 (3.2.0-0ubuntu3) hardy; urgency=low + + * Fix FTBFS of xen-docs. + * Fix typo in python-xen-3.2.install. (LP: #187665) + + -- Chuck Short Thu, 31 Jan 2008 08:00:01 -0500 + +xen-3.2 (3.2.0-0ubuntu2) hardy; urgency=low + + * Updated to 3.2 final. + * Added build dependency on libxml2-dev. + + -- Chuck SHort Wed, 30 Jan 2008 12:22:26 -0500 + +xen-3.2 (3.2.0-0ubuntu1) hardy; urgency=low + + * Initial release based on 3.2.0 rc4. + * Updated build-depends. + * Added pciutils-dev to build-depends. + * Dropped xen-ioemu now in xen-utils. + * Dropped xen-docs. + * Dropped security fixes since it is now apart of upstream. + * Moved from dpatch in-favour of quilt. + + -- Chuck Short Fri, 11 Jan 2008 14:28:08 -0500 + +xen-3.1 (3.1.0-0ubuntu19) hardy; urgency=low + + * tools/examples/Makefile: call udevadm instead of udevinfo and thus + simply version comparisons + * tools/check/check_udev, install, install.sh: likewise + + -- Scott James Remnant Fri, 14 Dec 2007 16:50:48 +0000 + +xen-3.1 (3.1.0-0ubuntu18) gutsy; urgency=low + + * SECURITY UPDATE: Fix for ne200 in qemu + * Add xen-qemu-ne2000-CVE-2007-1321.dpatch: upstream fixes to fix qeumu ne2000 + * CVE-2007-1321 + + -- Chuck Short Wed, 10 Oct 2007 11:24:50 -0400 + +xen-3.1 (3.1.0-0ubuntu17) gutsy; urgency=low + + * Fix network bridge due to ifplugd changes (LP: #144711) + * Fix HVM so that mouse doesnt get stuck on the left side of the screen. + (LP: #140963) + + -- Chuck Short Sat, 06 Oct 2007 13:18:06 -0400 + +xen-3.1 (3.1.0-0ubuntu16) gutsy; urgency=low + + * SECURITY UPDATE: guest root can escape to host after reboot. + * Add pygrub-sanitize.dpatch: upstream fixes to protect pygrub + from possible malicious content in guest grub config file. + * References + CVE-2007-4993 + + -- Kees Cook Fri, 05 Oct 2007 10:10:53 -0700 + +xen-3.1 (3.1.0-0ubuntu15) gutsy; urgency=low + + * Build for lpia (still to do: add -mtune=i586). + * Avoid warning when built with gcc-4.2. + + -- Matthias Klose Thu, 23 Aug 2007 18:17:11 +0000 + +xen-3.1 (3.1.0-0ubuntu14) gutsy; urgency=low + + * Fix python libraries typo. + + -- Chuck Short Sun, 12 Aug 2007 06:41:28 -0400 + +xen-3.1 (3.1.0-0ubuntu13) gutsy; urgency=low + + * Fix xen-docs FTBFS. + + -- Chuck Short Mon, 06 Aug 2007 19:03:30 -0400 + +xen-3.1 (3.1.0-0ubuntu12) gutsy; urgency=low + + * lintian fixes. + * Various build fixes (Closes: #127405) + * Fix amd64 ftbfs (Closes: 128032) + * Fix python-xen-3.1 issue. (Closes: #128809) + * Fix missing xen-docs (Closes: #128881) + + -- Chuck Short Sun, 05 Aug 2007 21:18:09 -0400 + +xen-3.1 (3.1.0-0ubuntu11) gutsy; urgency=low + + * Bug fixes for (#127699) + + -- Chuck Short Mon, 23 Jul 2007 19:24:25 -0400 + +xen-3.1 (3.1.0-0ubuntu10) gutsy; urgency=low + + * Force rebuild for stupid typo again. + + -- Chuck Short Sun, 22 Jul 2007 07:02:38 -0400 + +xen-3.1 (3.1.0-0ubuntu9) gutsy; urgency=low + + * Fixes various typos found corrected by me. + + -- Chuck Short Sat, 21 Jul 2007 17:25:44 -0400 + +xen-3.1 (3.1.0-0ubuntu8) gutsy; urgency=low + + * Re-enabled amd64. + + -- Chuck Short Mon, 16 Jul 2007 23:02:42 +0000 + +xen-3.1 (3.1.0-0ubuntu7) gutsy; urgency=low + + * Temporarily disabled amd64 support. Since there is no kernel for it. + * Removed non-pae versions. + + -- Chuck Short Fri, 06 Jul 2007 10:16:26 -0400 + +xen-3.1 (3.1.0-0ubuntu6) gutsy; urgency=low + + * Fix various issues found by pitti. + * Updated debian/rules. + + -- Chuck Short Sun, 23 Jun 2007 08:52:15 -0400 + +xen-3.1 (3.1.0-0ubuntu5) gutsy; urgency=low + + * For real this time. + + -- Chuck Short Thu, 21 Jun 2007 21:33:32 -0400 + +xen-3.1 (3.1.0-0ubuntu4) gutsy; urgency=low + + * Fix FTBFS for AMD64. + + -- Chuck Short Thu, 21 Jun 2007 13:40:45 -0400 + +xen-3.1 (3.1.0-0ubuntu3) gutsy; urgency=low + + * Changes by Chuck Short: + * Re-enabled xen-docs. + * Added patch to disable pdf and ps docs since they were + not being built properly. + * Re-enabled non-pae xen hypervisor. + * Added patch to hardcode the configuration of XENFB. + * Updated debian/control. + + * Merged from xen-unstable.hg + * [DOCS] - fix docs when missing doxygen. + + -- Chuck Short Tue, 19 Jun 2007 20:37:17 -0400 + +xen-3.1 (3.1.0-0ubuntu2) gutsy; urgency=low + + * Fix FTBFS. + * Fixed typo in debian/control. + * Added build depends on texlive-latex-base + + * Merged from xen-unstable.hg + * [TOOLS] - Fix for waiting for devices to disconnect during the + end stage of migration. + * [XEND] - Tear down domain if device hotplug fails during startup. + * [VTPM] - Fix bug where enabling vtpm causes installation error. + * [XEND] - Give "xm start" a -c parameter for connecting to the + console. + * [XEND] - Fix checkname so that it detects duplicate domains. + * [HVM] - Prevent usb driver crashes in Windows. + * [XEND] - Fix duplicate random MAC generation. + * [LIBXC] - Fix fully-virtualized core dumps for 32-bit guests. + * [XENTOP] - Fix -b option (batch mode). + * [XENAPI] - Fix segfault in libxenapi. + * [HVM] - Fix for BSOD when "migrating" from Intel to AMD. + + -- Chuck Short Thu, 14 Jun 2007 20:00:43 -0400 + +xen-3.1 (3.1.0-0ubuntu1) gutsy; urgency=low + + * Resynchronized with debian: + * Dropped amd64-libdir-fixes. + * Dropped fedora-sync. + * Dropped noblktap. + * Dropped pygrub-fix-corruption. + * Dropped xen-console-select-vuln. + * Dropped xen-scripts. + * Added prefix-utils. + * Added prefix-ioemu. + * Updated debian/rules to make it more saner. + * Added XENFB tools support. + * Updated to xen-3.1 final. + + -- Chuck Short Wed, 2 May 2007 13:04:43 -0400 + +xen-3.0 (3.0.3-0ubuntu10) feisty; urgency=low + + * SECURITY UPDATE: local guest can read arbitrary files from host. + * debian/patches/xen-console-select-vuln.dpatch: remove console selection. + * References + http://bugzilla.redhat.com/bugzilla/attachment.cgi?id=149043 + CVE-2007-0998 + + -- Kees Cook Fri, 23 Mar 2007 10:21:46 -0700 + + +xen-3.0 (3.0.3-0ubuntu9) feisty; urgency=low + + * Remove depends on libreiserfs0.3-dev completely, disabling support, + but making this build. + + -- Tollef Fog Heen Wed, 14 Mar 2007 08:42:50 +0100 + +xen-3.0 (3.0.3-0ubuntu8) feisty; urgency=low + + * Build-depend on libreiserfs0.3-dev to fix FTBFS. + + -- Tollef Fog Heen Mon, 12 Mar 2007 16:16:27 +0100 + +xen-3.0 (3.0.3-0ubuntu7) feisty; urgency=low + + * Updated xend init script. (Closes #89133). + * Include pygrub (Closes: #85067). + * Resynchronize with redhat. + + -- Chuck Short Fri, 9 Mar 2007 19:07:12 -0500 + +xen-3.0 (3.0.3-0ubuntu6) feisty; urgency=low + + * Updated xen-utils. + * Set xen-docs to all architectures. + + -- Chuck Short Mon, 12 Feb 2007 12:58:03 -0500 + +xen-3.0 (3.0.3-0ubuntu5) feisty; urgency=low + + * Added dependency on libncurses5-devel. + * Readed blktap support. + + -- Chuck Short Mon, 29 Jan 2007 10:43:16 -0500 + +xen-3.0 (3.0.3-0ubuntu4) feisty; urgency=low + + * Added patches stolen from fedora. + * Dropped xen-vnc-password patch. + + -- Chuck Short Wed, 17 Jan 2007 13:08:21 -0500 + +xen-3.0 (3.0.3-0ubuntu3) feisty; urgency=low + + * Resynchronize with debian. + - Pathces: + - Dropped manpages, xen-ioemu-config, and amd64-fixes. + - Added prefix-ioemu, prefix-utils. + - Updated *.install to conside with the new patches that were added. + - Added xen-hypervisor*.install to configure grub when the hypervisor is + installed. + - Updated build-depends. + * Dropped xend-unix-socket.dpatch. Closes (#71789). + + + -- Chuck Short Mon, 8 Jan 2007 19:55:10 -0500 + +xen-3.0 (3.0.3-0ubuntu1) edgy; urgency=low + + * Update to Xen 3.0.3 final. + + -- Chuck Short Tue, 17 Oct 2006 20:17:59 -0400 + +xen-3.0 (3.0.3~rc5-0ubuntu1) edgy; urgency=low + + * Update to Xen 3.0.3 RC5. This should hopefully be the last release + candiate before 3.0.3 is released. + * Added patch from Andrew Mitchell to remove udev rules symlink. + + -- Chuck Short Sat, 14 Oct 2006 10:44:33 -0400 + +xen-3.0 (3.0.3~rc2-0ubuntu1) edgy; urgency=low + + * Update to Xen 3.0.3 RC2 + * Add python-xen3.0 dependency to xen-utils-3.0 (Malone: #63902 + + -- Andrew Mitchell Thu, 5 Oct 2006 16:42:00 +1300 + +xen-3.0 (3.0.3~rc1) edgy; urgency=low + + Changes by Chuck Short: + + * Updated to release candidate. + * Droped compiler_fixes patch no longer needed. + + Changes by Andrew Mitchell: + + * Add libxen3.0 & libxen3.0-dev packages. + * Enable xend-unix-server & xend-unix-path in default config. + + -- Chuck Short Sat, 30 Sep 2006 20:25:53 -0400 + +xen-3.0 (3.0.2+hg111412-5) edgy; urgency=low + + * Fix various issues that were hunted down by reading the forums. Please + open bugs in launchpad so that they can be tracked. + * Removed qemu-ifup from xen-utils. + + -- Chuck Short Tue, 19 Sep 2006 20:28:06 -0400 + +xen-3.0 (3.0.2+hg111412-4) edgy; urgency=low + + * Fix xen-ioemu. (Closes #61121) + * Added patchxen-ioemu-config.dpatch so that our ioemu is more closer to + debian. + + -- Chuck Short Mon, 18 Sep 2006 21:40:20 -0400 + +xen-3.0 (3.0.2+hg111412-3) edgy; urgency=low + + * Fix FTBFS. + + -- Chuck Short Mon, 11 Sep 2006 06:57:22 -0400 + +xen-3.0 (3.0.2+hg111412-2) edgy; urgency=low + + * Removed blktabctrl. + * Changed init script to load the necessary modules when Xen starts. + + -- Chuck Short Sun, 10 Sep 2006 17:49:39 -0400 + +xen-3.0 (3.0.2+hg111412-1) edgy; urgency=low + + * New version, based off of changeset 11412. + * Dropped libdir patch and compile_date patch. + * Refactored ubuntu-fixes. + + -- Chuck Short Sun, 3 Sep 2006 19:49:50 -0400 + +xen-3.0 (3.0.2+hg11127-9) edgy; urgency=low + + * Fix thinko. (Closes: #58076) + + -- Chuck Short Fri, 1 Sep 2006 08:35:30 -0400 + +xen-3.0 (3.0.2+hg11127-8) edgy; urgency=low + + * Added missing blktapctrl. [#57859] + + -- Chuck Short Sun, 27 Aug 2006 09:41:51 -0400 + +xen-3.0 (3.0.2+hg11127-7) edgy; urgency=low + + * Fix dependency problem on amd64 + + -- Chuck Short Sun, 13 Aug 2006 19:07:30 -0400 + +xen-3.0 (3.0.2+hg11127-6) edgy; urgency=low + + * Added amd64 support. + * Added suggestion for better error detection. (Closes: #55217). + * Added patch from Ian for better xen hotplug scripts performance + improvement. (Closes #55218). + * Added libc6-dev-amd64 as a build-depends for amd64. + + -- Chuck Short Mon, 7 Aug 2006 18:57:26 -0400 + +xen-3.0 (3.0.2+hg11127-5) edgy; urgency=low + + * Fixed overzealus removal of amd64. + + -- Chuck Short Wed, 2 Aug 2006 18:14:22 -0400 + +xen-3.0 (3.0.2+hg11127-4) edgy; urgency=low + + * Removed amd64 support for now since it is not building properly. + + -- Chuck Short Wed, 2 Aug 2006 10:43:13 -0400 + +xen-3.0 (3.0.2+hg11127-3) edgy; urgency=low + + * Changed /etc/xen/scripts to use bash. + * Create /var/run/xend and /var/run/xenstored when running the + xend init script. + + -- Chuck Short Tue, 1 Aug 2006 19:34:46 -0400 + +xen-3.0 (3.0.2+hg11127-2) edgy; urgency=low + + * Added missing shared object files. + + -- Chuck Short Sat, 29 Jul 2006 22:32:26 -0400 + +xen-3.0 (3.0.2+hg11127-1) edgy; urgency=low + + * Initial ubuntu release. + * Updated hg snapshot 1174. + * Added compilation fixes. + * Resynchronized debian's patches. + * Fixed preious FTBFS. + + -- Chuck Short Sat, 22 Jul 2006 18:09:07 +0000 + +xen-3.0 (3.0.2+hg9697-1) unstable; urgency=low + + [ Guido Trotter ] + * Update Standards Version + * Merge upstream fixes trunk (upstream 3.0.2-3 + a couple of fixes) + [ Bastian Blank ] + * Add xen-ioemu-3.0 package to support HVM guests (closes: #368496) + + -- Guido Trotter Wed, 31 May 2006 10:50:05 +0200 + +xen-3.0 (3.0.2+hg9681-1) unstable; urgency=low + + * Update xen-hypervisor-3.0-i386 and xen-hypervisor-3.0-i386-pae + descriptions, specifying what the difference between the two packages is + (closes: #366019) + * Merge upstream fixes trunk + + -- Guido Trotter Thu, 18 May 2006 15:25:02 +0200 + +xen-3.0 (3.0.2+hg9656-1) unstable; urgency=low + + * Merge upstream fixes trunk + - This includes a fix for CVE-2006-1056 + + -- Guido Trotter Thu, 27 Apr 2006 17:34:03 +0200 + +xen-3.0 (3.0.2+hg9651-1) unstable; urgency=low + + * Merge upstream fixes trunk + * Fix PAE disabled in pae build (Closes: #364875) + + -- Julien Danjou Wed, 26 Apr 2006 13:19:39 +0200 + +xen-3.0 (3.0.2+hg9646-1) unstable; urgency=low + + [ Guido Trotter ] + * Merge upstream fixes trunk + + [ Bastian Blank ] + * debian/patches/libdir.dpatch: Update to make xm save work + + -- Julien Danjou Mon, 24 Apr 2006 18:02:07 +0200 + +xen-3.0 (3.0.2+hg9611-1) unstable; urgency=low + + * Merge upstream bug fixes + * Fix bug with xend init.d script + + -- Julien Danjou Wed, 12 Apr 2006 17:35:35 +0200 + +xen-3.0 (3.0.2+hg9598-1) unstable; urgency=low + + * New upstream release + * Fix copyright file + + -- Julien Danjou Mon, 10 Apr 2006 17:02:55 +0200 + +xen-3.0 (3.0.1+hg8762-1) unstable; urgency=low + + * The "preserve our homes" release + * Now cooperatively maintained by the Debian Xen Team + * New upstream release (closes: #327493, #342249) + * Build depend on transfig (closes: #321157) + * Use gcc rather than gcc-3.4 to compile (closes: #323698) + * Split xen-hypervisor-3.0 and xen-utils-3.0 + * Build both normal and pae hypervisor packages + * Change maintainer and add uploaders field + * Add force-reload support for init script xendomains + * Remove dependency against bash + * Bump standards version to 3.6.2.2 + * xen-utils-3.0 conflicts and replaces xen + * Add dpatch structure to the package + * Remove build-dependency on gcc (it's build essential anyway) + * Make SrvServer.py not executable + * Create NEWS.Debian file with important upgrade notices + * Update copyright file + * Remove the linux-patch-xen package + * Removed useless build-dependencies: libncurses5-dev, wget + * Changed xendomains config path to /etc/default + * xen-utils-3.0 now provides xen-utils and xen-hypervisor-3.0-i386 & + xen-hypervisor-3.0-i386-pae & xen-hypervizor-amd64 now provide + xen-hypervisor + * Made xen-utils-3.0.postinst more fault-tolerant, so that upgrading + xen2 -> xen3 don't fail because of a running xen2 hypervisor + * Updated the "Replaces & Conflicts" + * Install only and correctly udev files + * Compile date is no more in current locale + * Add patch which add the debian version and maintainer in the version + string and removes the banner. + * Don't install unusable cruft in xen-utils + * Remove libxen packages (no stable API/ABI) + + -- Julien Danjou Wed, 5 Apr 2006 16:05:07 +0200 + +xen (2.0.6-1) unstable; urgency=low + + * Patches applied upstream: non-xen-init-exit.patch, add-build.patch, + python-install.patch, disable-html-docs.patch. + * New upstream released. Closes: #311336. + * Remove comparison to UML from xen short description. Closes: #317066. + * Make packages conflicts with 1.2 doc debs. Closes: #304285. + * Add iproute to xen depends, as it uses /bin/ip. Closes: #300488, + #317468. + + -- Adam Heath Wed, 06 Jul 2005 12:35:50 -0500 + +xen (2.0.5-3) experimental; urgency=low + + * Change priority/section to match the overrides file. + + -- Adam Heath Fri, 18 Mar 2005 12:43:50 -0600 + +xen (2.0.5-2) experimental; urgency=low + + * Mike McCallister , + Tommi Virtanen , Tom Hibbert : + Fix missing '.' in update-rc.d call in xen.postinst. Closes: #299384 + + -- Adam Heath Fri, 18 Mar 2005 11:39:56 -0600 + +xen (2.0.5-1) experimental; urgency=low + + * New upstream. + * Remove pic-lib.patch, tools-misc-TARGETS.patch, and clean-mttr.patch + as they have been applied upstream(in various forms). + * xend now starts at priority 20, stops at 21, while xendomains starts + at 21, and stops at 20. + + -- Adam Heath Fri, 11 Mar 2005 14:33:33 -0600 + +xen (2.0.4-4) experimental; urgency=low + + * Bah, major booboo. Add /boot to debian/xen.install, so xen.gz will + get shipped. Reported by Clint Adams . + + -- Adam Heath Tue, 15 Feb 2005 13:00:57 -0600 + +xen (2.0.4-3) experimental; urgency=low + + * Fix file overlap(/usr/share/doc/xen/examples/*) between xen and + xen-docs. Reported by Tupshin Harper . + + -- Adam Heath Sun, 06 Feb 2005 01:22:45 -0600 + +xen (2.0.4-2) experimental; urgency=low + + * Fix kernel patch generation. It was broken when I integrated with + debian's kernel source. I used a symlink, and diff doesn't follow + those. + + -- Adam Heath Sat, 05 Feb 2005 18:16:35 -0600 + +xen (2.0.4-1) experimental; urgency=low + + * New upstream. + * xen.deb can now install on a plain kernel; that is, the init scripts + exit successfully if /proc/xen/privcmd doesn't exist. This allows + for dual-boot setups. + * Manpages do not yet exist xend, xenperf, xensv, xfrd, nor xm. xend + xfrd are daemons, and take little if any options. I've not had a need + to use xenperf nor xensv yet. xm has nice built in help(xm help). + * Upstream now requires either linux 2.4.29, or 2.6.10. Since 2.4.29 is + not yet in debian, disable the 2.4 patch generation. Closes: #271245. + * Not certain how the kernel-patch-xen was empty. It's not now, with + the repackaging. Closes: #272299. + * Xen no longer produces kernel images, so problems about missing features + are no longer valid. Closes: #253924. + * Acknowledge nmu bugs: + * No longer build-depend on gcc 3.3, as the default gcc works. Closes: + #243048. + + -- Adam Heath Sat, 05 Feb 2005 18:04:27 -0600 + +xen (2.0.3-0.1) unstable; urgency=low + + * Changes from Tommi Virtanen: + * Added dh-kpatches and libcurl3-dev to Build-Depends. + * Add /etc/xen/sv/params.py and /etc/xen/xend/params.py. + * Add xmexample1 and xmexample2 to xen/doc/examples. + + -- Adam Heath Wed, 26 Jan 2005 10:55:07 -0600 + +xen (2.0.3-0) unstable; urgency=low + + * New upstream. Closes: #280733. + * Repackaged from scratch. + * Using unreleased patch management system. See debian/README.build. + * After extracting the .dsc, there are no special steps needed + * Those wanting to change the source, use the normal procedures for + any package, including using interdiff(or other tool) to send a + patch to me or the bts. + * No longer try to do anything fancy with regard to the layout of the + built kernels. Now, only patches are distributed. Please make use of + the xen support in kernel-package. + * Early preview release to #debian-devel. + + -- Adam Heath Tue, 25 Jan 2005 13:24:54 -0600 + +xen (1.2-4.1) unstable; urgency=high + + * NMU + * Remove gcc-3.2 from Build-Depends as isn't used during build + (Closes: #243048) + + -- Frank Lichtenheld Sat, 21 Aug 2004 17:42:28 +0200 + +xen (1.2-4) unstable; urgency=low + + * Added xen-docs.README.Debian, which explains the kernel image layout, + and contains references on the locations differ from what is mentioned + by the upstream documentation. Closes: #230345. + + -- Adam Heath Fri, 26 Mar 2004 17:36:41 -0600 + +xen (1.2-3) unstable; urgency=low + + * Add kernel-source-2.4.25 and kernel-patch-debian-2.4.25 to + Build-Depends-Indep. + + -- Adam Heath Tue, 23 Mar 2004 20:14:39 -0600 + +xen (1.2-2) unstable; urgency=low + + * xen: moved /boot/xen.gz to /usr/lib/kernels/xen-i386/images/vmlinuz + * kernel-image, kernel-modules: swapped i386/xeno to xeno/i386 in + /usr/lib/kernels. + * Add kernel-patch-nfs-swap deb. + * Apply additional patches to kernel-image-xen: + * nfs-group + * nfs-swap + + -- Adam Heath Thu, 04 Mar 2004 12:47:47 -0600 + +xen (1.2-1) unstable; urgency=low + + * Initial version. + + -- Adam Heath Tue, 02 Mar 2004 13:21:52 -0600 --- xen-3.2-3.2.0.orig/debian/xen-hypervisor-3.2.postinst +++ xen-3.2-3.2.0/debian/xen-hypervisor-3.2.postinst @@ -0,0 +1,23 @@ +#!/bin/bash + +set -e + +case "$1" in + configure) + if command -v update-grub > /dev/null && [ -d /boot/grub ]; then + update-grub || : + fi + ;; + + abort-upgrade|abort-remove|abort-deconfigure) + ;; + + *) + echo "postinst called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +#DEBHELPER# + +exit 0 --- xen-3.2-3.2.0.orig/debian/xen-utils-3.2.README.Debian +++ xen-3.2-3.2.0/debian/xen-utils-3.2.README.Debian @@ -0,0 +1,95 @@ +Xen for Debian +-------------- + +* About /lib/tls: + + Since Xen guest machines have to work in non-contiguous areas of memory, + they cannot support a segmented glibc efficiently. If your glibc is + segmented Xen will have to emulate the support, with a high performance + penalty. To solve this problem you just have to execute this command: + + mv /lib/tls /lib/tls.disabled + + Unfortunately we cannot do this ourselves when you install Xen or at any + other time, without breaking the Debian Policy and thus provoke the Wrath of + the Gods. We know that this solution is not optimal, especially because + every time you upgrade the glibc package /lib/tls will be restored, and + you'll have to + + rm -rf /lib/tls.disabled + mv /lib/tls /lib/tls.disabled + + again. We'll be working towards a better solution, but for now this is it. + Please remember to always keep your system tls disabled. + + +* About the kernel: + + Unfortunately for now we cannot provide precompiled Linux Kernels with the + xen patch applied and configured to work in a Domain 0 or in an unprivileged + domain. The only thing we can give you is the patch, which is included in + the linux-patch-xen package. You are expected to install this package, + download a 2.6.12 kernel from kernel.org (this is the version supported by + xen right now. The patch will make it a 2.6.12.6+xen kernel) and roll your + own kernel. + + After you've done so you can add a section similar to this one to your + /boot/grub/menu.lst file in order to boot your xen system. (Only grub is + supported on Xen systems, if you're a LILO fan we're sorry, there's no way + you can use Xen without switching, and probably there will never be) + + title Debian Xen+GNU/Linux + root (hd0,0) + kernel /boot/xen.gz + module /boot/xen-linux-2.6.12.6xeno003 root=/dev/sda1 ro console=tty0 + boot + + Of course you have this example supplying your own kernel path and root + device in the module line in order to have a working Xen system after a + reboot. + + We will provide a "roll your own xen kernel" manual and example config files + later on. We also hope to be able to provide complete Xen kernels, sooner or + later, so don't despair! (Well, do, since in the meantime you have to do it + yourself anyway, if you want to try Xen... But don't give up now, compiling + a kernel is not hard, and trying Xen is worth learning how to do it!) + +* About networking: + + By default Xen modifies your networking configuration, creating a bridge. + To avoid breaking a machine's connection to the network the debian package + doesn't touch the network configuration unless requested. On the other hand + xen needs to connect the guest domains somewhere, in order for them to have + networking, and expects that the xen bridge exists. You should hand-tune + your networking configuration by editing /etc/xen/xend-config.sxp and + possibly /etc/network/interfaces to decide how to connect your domains to + the network. + +* About loop devices: + + If you plan hosting virtual domains with file backed block devices (ie. the + ones xen-tools creates by default) be careful about two issues: + + 1. Maximum number of loop devices + By default the loop driver supports a maximum of 8 loop devices. Of + course since every xen domain uses at least two (one for the data and one + for the swap) this number is absolutely insufficient. You should increase + it by adding a file named local-loop in /etc/modprobe.d containing the + string "options loop max_loop=128", if the loop driver is compiled as a + module, or by appending the string max_loop=128 to your kernel parameters + if the driver is in-kernel. Of course you can increase or decrease the + number 128 as you see fit. + + 2. Driver loading (only if loop is compiled as a module) + Normally the loop driver gets loaded when the first loop device is + accessed. When using udev, though, the loop devices get created only + after the driver gets loaded. This means that xen will fail if the loop + driver is not already loaded when it tries to start a file-backed virtual + domain. To fix this just add "loop" in your /etc/modules file, thus + forcing it to be loaded at boot time. + + +Kindly yours, + +Guido Trotter, for the Debian Xen Team. +(with a litte help from Ralph Passgang) --- xen-3.2-3.2.0.orig/debian/patches/series +++ xen-3.2-3.2.0/debian/patches/series @@ -0,0 +1,5 @@ +suse-addons.diff +tools-misc-xend-race.diff +doc-remove-unused.diff +fix-amd64-libdir.diff +xen-ubuntu-fixes.diff --- xen-3.2-3.2.0.orig/debian/patches/suse-addons.diff +++ xen-3.2-3.2.0/debian/patches/suse-addons.diff @@ -0,0 +1,935 @@ +diff -Naur xen-3.2-3.2.0.orig/Config.mk xen-3.2-3.2.0/Config.mk +--- xen-3.2-3.2.0.orig/Config.mk 2007-12-29 12:57:47.000000000 -0500 ++++ xen-3.2-3.2.0/Config.mk 2008-01-30 07:32:07.000000000 -0500 +@@ -88,7 +88,7 @@ + # Optional components + XENSTAT_XENTOP ?= y + VTPM_TOOLS ?= n +-LIBXENAPI_BINDINGS ?= n ++LIBXENAPI_BINDINGS ?= y + PYTHON_TOOLS ?= y + + -include $(XEN_ROOT)/.config +diff -Naur xen-3.2-3.2.0.orig/tools/examples/block xen-3.2-3.2.0/tools/examples/block +--- xen-3.2-3.2.0.orig/tools/examples/block 2008-01-30 07:29:50.000000000 -0500 ++++ xen-3.2-3.2.0/tools/examples/block 2008-01-30 07:52:59.000000000 -0500 +@@ -233,6 +233,9 @@ + mount it read-write in a guest domain." + fi + ++ losetup_failure=1 ++ for do_losetup in 1 2 3 ++ do + loopdev='' + for dev in /dev/loop* + do +@@ -327,6 +330,9 @@ + fatal 'Failed to find an unused loop device' + fi + ++ losetup "$loopdev" "$file" && losetup_failure="" && break ++ done ++ + if LANG=C losetup -h 2>&1 | grep read-only >/dev/null + then + roflag="-$mode"; roflag="${roflag#-w}"; roflag="${roflag#-!}" +@@ -356,8 +362,18 @@ + + file) + node=$(xenstore_read "$XENBUS_PATH/node") +- losetup -d "$node" +- exit 0 ++ ++ #In case the loopback is temporarily blocked, retry the losetup -d. ++ for i in 1 2 3 4 5 ++ do ++ if losetup -d "$node" ++ then ++ exit 0 ++ fi ++ sleep 1 ++ done ++ log err "losetup -d $node failed." ++ exit 1 + ;; + + "") +diff -Naur xen-3.2-3.2.0.orig/tools/examples/xend-config.sxp xen-3.2-3.2.0/tools/examples/xend-config.sxp +--- xen-3.2-3.2.0.orig/tools/examples/xend-config.sxp 2007-12-29 12:57:47.000000000 -0500 ++++ xen-3.2-3.2.0/tools/examples/xend-config.sxp 2008-01-30 07:32:07.000000000 -0500 +@@ -129,7 +129,8 @@ + # + # (network-script 'network-bridge netdev=eth1') + # +-# The bridge is named xenbr0, by default. To rename the bridge, use ++# The bridge is named to match the outgoing interface, by default. For example, ++# eth1 is on xenbr1. To rename the bridge, use + # + # (network-script 'network-bridge bridge=') + # +diff -Naur xen-3.2-3.2.0.orig/tools/ioemu/block.c xen-3.2-3.2.0/tools/ioemu/block.c +--- xen-3.2-3.2.0.orig/tools/ioemu/block.c 2007-12-29 12:57:47.000000000 -0500 ++++ xen-3.2-3.2.0/tools/ioemu/block.c 2008-01-30 07:32:07.000000000 -0500 +@@ -558,6 +558,9 @@ + else + return 0; + } else { ++ unsigned int ns = sector_num * 512; ++ if (ns < 0) ++ return -1; + return drv->bdrv_write(bs, sector_num, buf, nb_sectors); + } + } +diff -Naur xen-3.2-3.2.0.orig/tools/ioemu/hw/cirrus_vga.c xen-3.2-3.2.0/tools/ioemu/hw/cirrus_vga.c +--- xen-3.2-3.2.0.orig/tools/ioemu/hw/cirrus_vga.c 2007-12-29 12:57:47.000000000 -0500 ++++ xen-3.2-3.2.0/tools/ioemu/hw/cirrus_vga.c 2008-01-30 07:32:07.000000000 -0500 +@@ -220,6 +220,20 @@ + #define CIRRUS_HOOK_NOT_HANDLED 0 + #define CIRRUS_HOOK_HANDLED 1 + ++#define BLTUNSAFE(s) \ ++ ( \ ++ ( /* check dst is within bounds */ \ ++ (s)->cirrus_blt_height * (s)->cirrus_blt_dstpitch \ ++ + ((s)->cirrus_blt_dstaddr & (s)->cirrus_addr_mask) > \ ++ (s)->vram_size \ ++ ) || \ ++ ( /* check src is within bounds */ \ ++ (s)->cirrus_blt_height * (s)->cirrus_blt_srcpitch \ ++ + ((s)->cirrus_blt_srcaddr & (s)->cirrus_addr_mask) > \ ++ (s)->vram_size \ ++ ) \ ++ ) ++ + struct CirrusVGAState; + typedef void (*cirrus_bitblt_rop_t) (struct CirrusVGAState *s, + uint8_t * dst, const uint8_t * src, +@@ -599,7 +613,7 @@ + + for (y = 0; y < lines; y++) { + off_cur = off_begin; +- off_cur_end = off_cur + bytesperline; ++ off_cur_end = (off_cur + bytesperline) & s->cirrus_addr_mask; + off_cur &= TARGET_PAGE_MASK; + while (off_cur < off_cur_end) { + cpu_physical_memory_set_dirty(s->vram_offset + +@@ -615,7 +629,11 @@ + { + uint8_t *dst; + +- dst = s->vram_ptr + s->cirrus_blt_dstaddr; ++ dst = s->vram_ptr + (s->cirrus_blt_dstaddr & s->cirrus_addr_mask); ++ ++ if (BLTUNSAFE(s)) ++ return 0; ++ + (*s->cirrus_rop) (s, dst, src, + s->cirrus_blt_dstpitch, 0, + s->cirrus_blt_width, s->cirrus_blt_height); +@@ -631,8 +649,11 @@ + { + cirrus_fill_t rop_func; + ++ if (BLTUNSAFE(s)) ++ return 0; ++ + rop_func = cirrus_fill[rop_to_index[blt_rop]][s->cirrus_blt_pixelwidth - 1]; +- rop_func(s, s->vram_ptr + s->cirrus_blt_dstaddr, ++ rop_func(s, s->vram_ptr + (s->cirrus_blt_dstaddr & s->cirrus_addr_mask), + s->cirrus_blt_dstpitch, + s->cirrus_blt_width, s->cirrus_blt_height); + cirrus_invalidate_region(s, s->cirrus_blt_dstaddr, +@@ -651,8 +672,8 @@ + static int cirrus_bitblt_videotovideo_patterncopy(CirrusVGAState * s) + { + return cirrus_bitblt_common_patterncopy(s, +- s->vram_ptr + +- (s->cirrus_blt_srcaddr & ~7)); ++ s->vram_ptr + ((s->cirrus_blt_srcaddr & ~7) & ++ s->cirrus_addr_mask)); + } + + static void cirrus_do_copy(CirrusVGAState *s, int dst, int src, int w, int h) +@@ -702,8 +723,10 @@ + if (notify) + vga_hw_update(); + +- (*s->cirrus_rop) (s, s->vram_ptr + s->cirrus_blt_dstaddr, +- s->vram_ptr + s->cirrus_blt_srcaddr, ++ (*s->cirrus_rop) (s, s->vram_ptr + ++ (s->cirrus_blt_dstaddr & s->cirrus_addr_mask), ++ s->vram_ptr + ++ (s->cirrus_blt_srcaddr & s->cirrus_addr_mask), + s->cirrus_blt_dstpitch, s->cirrus_blt_srcpitch, + s->cirrus_blt_width, s->cirrus_blt_height); + +@@ -729,8 +752,14 @@ + s->cirrus_blt_srcaddr - s->start_addr, + s->cirrus_blt_width, s->cirrus_blt_height); + } else { +- (*s->cirrus_rop) (s, s->vram_ptr + s->cirrus_blt_dstaddr, +- s->vram_ptr + s->cirrus_blt_srcaddr, ++ ++ if (BLTUNSAFE(s)) ++ return 0; ++ ++ (*s->cirrus_rop) (s, s->vram_ptr + ++ (s->cirrus_blt_dstaddr & s->cirrus_addr_mask), ++ s->vram_ptr + ++ (s->cirrus_blt_srcaddr & s->cirrus_addr_mask), + s->cirrus_blt_dstpitch, s->cirrus_blt_srcpitch, + s->cirrus_blt_width, s->cirrus_blt_height); + +@@ -762,8 +791,9 @@ + } else { + /* at least one scan line */ + do { +- (*s->cirrus_rop)(s, s->vram_ptr + s->cirrus_blt_dstaddr, +- s->cirrus_bltbuf, 0, 0, s->cirrus_blt_width, 1); ++ (*s->cirrus_rop)(s, s->vram_ptr + ++ (s->cirrus_blt_dstaddr & s->cirrus_addr_mask), ++ s->cirrus_bltbuf, 0, 0, s->cirrus_blt_width, 1); + cirrus_invalidate_region(s, s->cirrus_blt_dstaddr, 0, + s->cirrus_blt_width, 1); + s->cirrus_blt_dstaddr += s->cirrus_blt_dstpitch; +@@ -1879,7 +1909,7 @@ + unsigned val = mem_value; + uint8_t *dst; + +- dst = s->vram_ptr + offset; ++ dst = s->vram_ptr + (offset &= s->cirrus_addr_mask); + for (x = 0; x < 8; x++) { + if (val & 0x80) { + *dst = s->cirrus_shadow_gr1; +@@ -1902,7 +1932,7 @@ + unsigned val = mem_value; + uint8_t *dst; + +- dst = s->vram_ptr + offset; ++ dst = s->vram_ptr + (offset &= s->cirrus_addr_mask); + for (x = 0; x < 8; x++) { + if (val & 0x80) { + *dst = s->cirrus_shadow_gr1; +diff -Naur xen-3.2-3.2.0.orig/tools/ioemu/hw/cirrus_vga_rop.h xen-3.2-3.2.0/tools/ioemu/hw/cirrus_vga_rop.h +--- xen-3.2-3.2.0.orig/tools/ioemu/hw/cirrus_vga_rop.h 2007-12-29 12:57:47.000000000 -0500 ++++ xen-3.2-3.2.0/tools/ioemu/hw/cirrus_vga_rop.h 2008-01-30 07:32:07.000000000 -0500 +@@ -49,6 +49,12 @@ + src = src_ - src_base; + dstpitch -= bltwidth; + srcpitch -= bltwidth; ++ ++ if (dstpitch < 0 || srcpitch < 0) { ++ /* is 0 valid? srcpitch == 0 could be useful */ ++ return; ++ } ++ + for (y = 0; y < bltheight; y++) { + for (x = 0; x < bltwidth; x++) { + ROP_OP(*(dst_base + m(dst)), *(src_base + m(src))); +diff -Naur xen-3.2-3.2.0.orig/tools/ioemu/hw/i8259.c xen-3.2-3.2.0/tools/ioemu/hw/i8259.c +--- xen-3.2-3.2.0.orig/tools/ioemu/hw/i8259.c 2007-12-29 12:57:47.000000000 -0500 ++++ xen-3.2-3.2.0/tools/ioemu/hw/i8259.c 2008-01-30 07:32:07.000000000 -0500 +@@ -299,9 +299,11 @@ + s->init_state = 1; + s->init4 = val & 1; + if (val & 0x02) +- hw_error("single mode not supported"); ++ /* hw_error("single mode not supported"); */ ++ return; + if (val & 0x08) +- hw_error("level sensitive irq not supported"); ++ /* hw_error("level sensitive irq not supported"); */ ++ return; + } else if (val & 0x08) { + if (val & 0x04) + s->poll = 1; +diff -Naur xen-3.2-3.2.0.orig/tools/ioemu/hw/ne2000.c xen-3.2-3.2.0/tools/ioemu/hw/ne2000.c +--- xen-3.2-3.2.0.orig/tools/ioemu/hw/ne2000.c 2007-12-29 12:57:47.000000000 -0500 ++++ xen-3.2-3.2.0/tools/ioemu/hw/ne2000.c 2008-01-30 07:32:07.000000000 -0500 +@@ -221,7 +221,7 @@ + NE2000State *s = opaque; + + if (s->cmd & E8390_STOP) +- return 1; ++ return 0; + return !ne2000_buffer_full(s); + } + +diff -Naur xen-3.2-3.2.0.orig/tools/ioemu/hw/pc.c xen-3.2-3.2.0/tools/ioemu/hw/pc.c +--- xen-3.2-3.2.0.orig/tools/ioemu/hw/pc.c 2007-12-29 12:57:47.000000000 -0500 ++++ xen-3.2-3.2.0/tools/ioemu/hw/pc.c 2008-01-30 07:32:07.000000000 -0500 +@@ -315,7 +315,8 @@ + case 0x400: + case 0x401: + fprintf(stderr, "BIOS panic at rombios.c, line %d\n", val); +- exit(1); ++ /* according to documentation, these can be safely ignored */ ++ break; + case 0x402: + case 0x403: + #ifdef DEBUG_BIOS +@@ -338,8 +339,9 @@ + /* LGPL'ed VGA BIOS messages */ + case 0x501: + case 0x502: ++ /* according to documentation, these can be safely ignored */ + fprintf(stderr, "VGA BIOS panic, line %d\n", val); +- exit(1); ++ break; + case 0x500: + case 0x503: + #ifdef DEBUG_BIOS +diff -Naur xen-3.2-3.2.0.orig/tools/ioemu/keymaps/nl-be xen-3.2-3.2.0/tools/ioemu/keymaps/nl-be +--- xen-3.2-3.2.0.orig/tools/ioemu/keymaps/nl-be 2007-12-29 12:57:47.000000000 -0500 ++++ xen-3.2-3.2.0/tools/ioemu/keymaps/nl-be 2008-01-30 07:32:07.000000000 -0500 +@@ -1,6 +1,72 @@ + # Dutch (Belgium) +-map 0x813 + include common ++map 0x813 ++ampersand 0x02 ++1 0x02 shift ++bar 0x02 altgr ++eacute 0x03 ++2 0x03 shift ++at 0x03 altgr ++quotedbl 0x04 ++3 0x04 shift ++numbersign 0x04 altgr ++apostrophe 0x05 ++4 0x05 shift ++parenleft 0x06 ++5 0x06 shift ++section 0x07 ++6 0x07 shift ++circumflex 0x07 altgr ++egrave 0x08 ++7 0x08 shift ++exclam 0x09 ++8 0x09 shift ++bracketleft 0x09 altgr ++ccedilla 0x0a ++9 0x0a shift ++braceleft 0x0a altgr ++agrave 0x0b ++0 0x0b shift ++braceright 0x0b altgr ++parenright 0x0c ++degree 0x0c shift ++minus 0x0d ++underscore 0x0d shift ++a 0x10 addupper ++z 0x11 addupper ++EuroSign 0x12 altgr ++dead_circumflex 0x1a ++dead_diaeresis 0x1a shift ++bracketleft 0x1a altgr ++dollar 0x1b ++asterisk 0x1b shift ++bracketright 0x1b altgr ++q 0x1e addupper ++m 0x27 addupper ++ugrave 0x28 ++percent 0x28 shift ++dead_acute 0x28 altgr ++twosuperior 0x29 ++threesuperior 0x29 shift ++mu 0x2b ++sterling 0x2b shift ++dead_grave 0x2b altgr ++w 0x2c addupper ++comma 0x32 ++question 0x32 shift ++semicolon 0x33 ++period 0x33 shift ++colon 0x34 ++slash 0x34 shift ++periodcentered 0x34 altgr ++equal 0x35 ++plus 0x35 shift ++tilde 0x35 altgr ++dead_tilde 0x35 shift altgr ++less 0x56 ++greater 0x56 shift ++backslash 0x56 altgr ++ + ampersand 0x02 + 1 0x02 shift + bar 0x02 altgr +diff -Naur xen-3.2-3.2.0.orig/tools/ioemu/sdl_keysym.h xen-3.2-3.2.0/tools/ioemu/sdl_keysym.h +--- xen-3.2-3.2.0.orig/tools/ioemu/sdl_keysym.h 2007-12-29 12:57:47.000000000 -0500 ++++ xen-3.2-3.2.0/tools/ioemu/sdl_keysym.h 2008-01-30 07:32:07.000000000 -0500 +@@ -274,5 +274,27 @@ + {"Pause", SDLK_PAUSE}, + {"Escape", SDLK_ESCAPE}, + ++ /* dead keys */ ++{"dead_grave", 0xfe50}, ++{"dead_acute", 0xfe51}, ++{"dead_circumflex", 0xfe52}, ++{"dead_tilde", 0xfe53}, ++{"dead_macron", 0xfe54}, ++{"dead_brev", 0xfe55}, ++{"dead_abovedot", 0xfe56}, ++{"dead_diaeresis", 0xfe57}, ++{"dead_abovering", 0xfe58}, ++{"dead_doubleacute", 0xfe59}, ++{"dead_caron", 0xfe5a}, ++{"dead_cedilla", 0xfe5b}, ++{"dead_ogonek", 0xfe5c}, ++{"dead_iota", 0xfe5d}, ++{"dead_voiced_sound", 0xfe5e}, ++{"dead_semivoiced_sound", 0xfe5f}, ++{"dead_belowdot", 0xfe60}, ++{"dead_hook", 0xfe61}, ++{"dead_horn", 0xfe62}, ++ + {0,0}, + }; ++ +diff -Naur xen-3.2-3.2.0.orig/tools/ioemu/target-i386/translate.c xen-3.2-3.2.0/tools/ioemu/target-i386/translate.c +--- xen-3.2-3.2.0.orig/tools/ioemu/target-i386/translate.c 2007-12-29 12:57:47.000000000 -0500 ++++ xen-3.2-3.2.0/tools/ioemu/target-i386/translate.c 2008-01-30 07:32:07.000000000 -0500 +@@ -5326,7 +5326,12 @@ + if (CODE64(s)) + goto illegal_op; + val = ldub_code(s->pc++); +- gen_op_aam(val); ++ /* taviso: operand can be zero */ ++ if (val) { ++ gen_op_aam(val); ++ } else { ++ gen_exception(s, EXCP00_DIVZ, s->pc - s->cs_base); ++ } + s->cc_op = CC_OP_LOGICB; + break; + case 0xd5: /* aad */ +@@ -5374,6 +5379,7 @@ + gen_jmp_im(pc_start - s->cs_base); + gen_op_into(s->pc - pc_start); + break; ++#ifdef WANT_ICEBP + case 0xf1: /* icebp (undocumented, exits to external debugger) */ + #if 1 + gen_debug(s, pc_start - s->cs_base); +@@ -5383,6 +5389,7 @@ + cpu_set_log(CPU_LOG_INT | CPU_LOG_TB_IN_ASM); + #endif + break; ++#endif /* icebp */ + case 0xfa: /* cli */ + if (!s->vm86) { + if (s->cpl <= s->iopl) { +diff -Naur xen-3.2-3.2.0.orig/tools/ioemu/target-i386-dm/qemu-ifup xen-3.2-3.2.0/tools/ioemu/target-i386-dm/qemu-ifup +--- xen-3.2-3.2.0.orig/tools/ioemu/target-i386-dm/qemu-ifup 2008-01-30 07:29:50.000000000 -0500 ++++ xen-3.2-3.2.0/tools/ioemu/target-i386-dm/qemu-ifup 2008-01-30 07:32:07.000000000 -0500 +@@ -1,11 +1,11 @@ + #!/bin/sh + +-#. /etc/rc.d/init.d/functions +-#ulimit -c unlimited +- +-echo 'config qemu network with xen bridge for ' $* +- + bridge=$2 ++if [ -z "$bridge" ]; then ++ brnum=$(ip route list | awk '/^default / { print $NF }' | sed 's/^[^0-9]*//') ++ brnum=${brnum:-0} ++ bridge=xenbr${brnum} ++fi + + # + # Old style bridge setup with netloop, used to have a bridge name +diff -Naur xen-3.2-3.2.0.orig/tools/ioemu/vl.c xen-3.2-3.2.0/tools/ioemu/vl.c +--- xen-3.2-3.2.0.orig/tools/ioemu/vl.c 2007-12-29 12:57:47.000000000 -0500 ++++ xen-3.2-3.2.0/tools/ioemu/vl.c 2008-01-30 07:32:07.000000000 -0500 +@@ -102,8 +102,6 @@ + #define DEFAULT_NETWORK_SCRIPT "/etc/xen/qemu-ifup" + #ifdef _BSD + #define DEFAULT_BRIDGE "bridge0" +-#else +-#define DEFAULT_BRIDGE "xenbr0" + #endif + #ifdef __sun__ + #define SMBD_COMMAND "/usr/sfw/sbin/smbd" +@@ -3584,8 +3582,8 @@ + VLANClientState *vc; + int fd; + int state; /* 0 = getting length, 1 = getting data */ +- int index; +- int packet_len; ++ unsigned int index; ++ unsigned int packet_len; + uint8_t buf[4096]; + struct sockaddr_in dgram_dst; /* contains inet host and port destination iff connectionless (SOCK_DGRAM) */ + } NetSocketState; +@@ -3616,7 +3614,8 @@ + static void net_socket_send(void *opaque) + { + NetSocketState *s = opaque; +- int l, size, err; ++ int size, err; ++ unsigned l; + uint8_t buf1[4096]; + const uint8_t *buf; + +@@ -3655,7 +3654,15 @@ + l = s->packet_len - s->index; + if (l > size) + l = size; +- memcpy(s->buf + s->index, buf, l); ++ if (s->index + l <= sizeof(s->buf)) { ++ memcpy(s->buf + s->index, buf, l); ++ } else { ++ fprintf(stderr, "serious error: oversized packet received," ++ "connection terminated.\n"); ++ s->state = 0; ++ goto eoc; ++ } ++ + s->index += l; + buf += l; + size -= l; +@@ -4129,10 +4136,10 @@ + if (get_param_value(setup_script, sizeof(setup_script), "script", p) == 0) { + pstrcpy(setup_script, sizeof(setup_script), DEFAULT_NETWORK_SCRIPT); + } +- if (get_param_value(bridge, sizeof(bridge), "bridge", p) == 0) { +- pstrcpy(bridge, sizeof(bridge), DEFAULT_BRIDGE); +- } +- ret = net_tap_init(vlan, ifname, setup_script, bridge); ++ if (get_param_value(bridge, sizeof(bridge), "bridge", p) == 0) ++ ret = net_tap_init(vlan, ifname, setup_script, NULL); ++ else ++ ret = net_tap_init(vlan, ifname, setup_script, bridge); + } + } else + #endif +diff -Naur xen-3.2-3.2.0.orig/tools/ioemu/xenstore.c xen-3.2-3.2.0/tools/ioemu/xenstore.c +--- xen-3.2-3.2.0.orig/tools/ioemu/xenstore.c 2008-01-30 07:29:50.000000000 -0500 ++++ xen-3.2-3.2.0/tools/ioemu/xenstore.c 2008-01-30 07:32:07.000000000 -0500 +@@ -81,9 +81,9 @@ + { + char **e = NULL; + char *buf = NULL, *path; +- char *fpath = NULL, *bpath = NULL, ++ char *fpath = NULL, *bpath = NULL, *btype = NULL, + *dev = NULL, *params = NULL, *type = NULL, *drv = NULL; +- int i, is_scsi, is_hdN = 0; ++ int i, is_scsi, is_tap, is_hdN = 0; + unsigned int len, num, hd_index; + BlockDriverState *bs; + +@@ -117,6 +117,14 @@ + bpath = xs_read(xsh, XBT_NULL, buf, &len); + if (bpath == NULL) + continue; ++ /* check to see if type is tap or not */ ++ if (pasprintf(&buf, "%s/type", bpath) == -1) ++ continue; ++ free(btype); ++ btype = xs_read(xsh, XBT_NULL, buf, &len); ++ if (btype == NULL) ++ continue; ++ is_tap = !strncmp(btype, "tap", 3); + /* read the name of the device */ + if (pasprintf(&buf, "%s/dev", bpath) == -1) + continue; +@@ -244,6 +252,7 @@ + free(type); + free(params); + free(dev); ++ free(btype); + free(bpath); + free(buf); + free(path); +diff -Naur xen-3.2-3.2.0.orig/tools/Makefile xen-3.2-3.2.0/tools/Makefile +--- xen-3.2-3.2.0.orig/tools/Makefile 2007-12-29 12:57:47.000000000 -0500 ++++ xen-3.2-3.2.0/tools/Makefile 2008-01-30 07:32:07.000000000 -0500 +@@ -64,7 +64,7 @@ + $(MAKE) -C check clean + + .PHONY: ioemu ioemuinstall ioemuclean +-ifeq ($(CONFIG_IOEMU),y) ++ifeq ($(XEN_COMPILE_ARCH)$(CONFIG_IOEMU),$(XEN_TARGET_ARCH)y) + export IOEMU_DIR ?= ioemu + ioemu ioemuinstall: + [ -f $(IOEMU_DIR)/config-host.mak ] || \ +diff -Naur xen-3.2-3.2.0.orig/tools/python/xen/xend/balloon.py xen-3.2-3.2.0/tools/python/xen/xend/balloon.py +--- xen-3.2-3.2.0.orig/tools/python/xen/xend/balloon.py 2007-12-29 12:57:47.000000000 -0500 ++++ xen-3.2-3.2.0/tools/python/xen/xend/balloon.py 2008-01-30 07:32:07.000000000 -0500 +@@ -41,6 +41,8 @@ + # label actually shown in the PROC_XEN_BALLOON file. + labels = { 'current' : 'Current allocation', + 'target' : 'Requested target', ++ 'min-target' : 'Minimum target', ++ 'max-target' : 'Maximum target', + 'low-balloon' : 'Low-mem balloon', + 'high-balloon' : 'High-mem balloon', + 'limit' : 'Xen hard limit' } +@@ -67,6 +69,23 @@ + raise VmError('Failed to query target memory allocation of dom0.') + return kb + ++def get_dom0_min_target(): ++ """Returns the minimum amount of memory (in KiB) that dom0 will accept.""" ++ ++ kb = _get_proc_balloon(labels['min-target']) ++ if kb == None: ++ raise VmError('Failed to query minimum target memory allocation of dom0.') ++ return kb ++ ++def get_dom0_max_target(): ++ """Returns the maximum amount of memory (in KiB) that is potentially ++ visible to dom0.""" ++ ++ kb = _get_proc_balloon(labels['max-target']) ++ if kb == None: ++ raise VmError('Failed to query maximum target memory allocation of dom0.') ++ return kb ++ + def free(need_mem): + """Balloon out memory from the privileged domain so that there is the + specified required amount (in KiB) free. +diff -Naur xen-3.2-3.2.0.orig/tools/python/xen/xend/image.py xen-3.2-3.2.0/tools/python/xen/xend/image.py +--- xen-3.2-3.2.0.orig/tools/python/xen/xend/image.py 2007-12-29 12:57:47.000000000 -0500 ++++ xen-3.2-3.2.0/tools/python/xen/xend/image.py 2008-01-30 07:32:07.000000000 -0500 +@@ -485,13 +485,16 @@ + mac = devinfo.get('mac') + if mac is None: + raise VmError("MAC address not specified or generated.") +- bridge = devinfo.get('bridge', 'xenbr0') ++ bridge = devinfo.get('bridge', None) + model = devinfo.get('model', 'rtl8139') + ret.append("-net") + ret.append("nic,vlan=%d,macaddr=%s,model=%s" % + (nics, mac, model)) + ret.append("-net") +- ret.append("tap,vlan=%d,bridge=%s" % (nics, bridge)) ++ net = "tap,vlan=%d" % (nics,) ++ if bridge: ++ net += ",bridge=%s" % (bridge,) ++ ret.append(net) + + return ret + +@@ -577,7 +580,7 @@ + + def configure(self, vmConfig): + HVMImageHandler.configure(self, vmConfig) +- self.pae = int(vmConfig['platform'].get('pae', 0)) ++ self.pae = int(vmConfig['platform'].get('pae', 1)) + + def buildDomain(self): + xc.hvm_set_param(self.vm.getDomid(), HVM_PARAM_PAE_ENABLED, self.pae) +diff -Naur xen-3.2-3.2.0.orig/tools/python/xen/xend/server/SrvDomain.py xen-3.2-3.2.0/tools/python/xen/xend/server/SrvDomain.py +--- xen-3.2-3.2.0.orig/tools/python/xen/xend/server/SrvDomain.py 2007-12-29 12:57:47.000000000 -0500 ++++ xen-3.2-3.2.0/tools/python/xen/xend/server/SrvDomain.py 2008-01-30 07:32:07.000000000 -0500 +@@ -170,7 +170,7 @@ + + + def op_mem_target_set(self, _, req): +- return self.call(self.dom.setMemoryTarget, ++ return self.call(self.dom.capAndSetMemoryTarget, + [['target', 'int']], + req) + +diff -Naur xen-3.2-3.2.0.orig/tools/python/xen/xend/XendDomainInfo.py xen-3.2-3.2.0/tools/python/xen/xend/XendDomainInfo.py +--- xen-3.2-3.2.0.orig/tools/python/xen/xend/XendDomainInfo.py 2008-01-30 07:29:50.000000000 -0500 ++++ xen-3.2-3.2.0/tools/python/xen/xend/XendDomainInfo.py 2008-01-30 07:32:07.000000000 -0500 +@@ -685,6 +685,27 @@ + return dev_info + + ++ def capAndSetMemoryTarget(self, target): ++ """Potentially lowers the requested target to the largest possible ++ value (i.e., caps it), and then sets the memory target of this domain ++ to that value. ++ @param target in MiB. ++ """ ++ max_target = 0 ++ if self.domid == 0: ++ try: ++ from balloon import get_dom0_max_target ++ max_target = get_dom0_max_target() / 1024 ++ except: ++ # It's nice to cap the max at sane values, but harmless to set ++ # them high. Carry on. ++ pass ++ if max_target and target > max_target: ++ log.debug("Requested memory target %d MiB; maximum reasonable is %d MiB.", ++ target, max_target) ++ target = max_target ++ self.setMemoryTarget(target) ++ + def setMemoryTarget(self, target): + """Set the memory target of this domain. + @param target: In MiB. +@@ -1508,6 +1529,9 @@ + if devclass in XendDevices.valid_devices(): + log.info("createDevice: %s : %s" % (devclass, scrub_password(config))) + dev_uuid = config.get('uuid') ++ if 'keymap' not in config: ++ if 'keymap' in self.info['platform']: ++ config['keymap'] = self.info['platform']['keymap'] + devid = self._createDevice(devclass, config) + + # store devid in XendConfig for caching reasons +@@ -1736,7 +1760,7 @@ + xc.domain_setmaxmem(self.domid, maxmem) + + # Make sure there's enough RAM available for the domain +- balloon.free(memory + shadow) ++ balloon.free(memory + shadow + 512) + + # Set up the shadow memory + shadow_cur = xc.shadow_mem_control(self.domid, shadow / 1024) +@@ -2042,7 +2066,7 @@ + (fn, BOOTLOADER_LOOPBACK_DEVICE)) + + vbd = { +- 'mode': 'RO', ++ 'mode': 'RW', + 'device': BOOTLOADER_LOOPBACK_DEVICE, + } + +diff -Naur xen-3.2-3.2.0.orig/tools/python/xen/xend/XendNode.py xen-3.2-3.2.0/tools/python/xen/xend/XendNode.py +--- xen-3.2-3.2.0.orig/tools/python/xen/xend/XendNode.py 2007-12-29 12:57:47.000000000 -0500 ++++ xen-3.2-3.2.0/tools/python/xen/xend/XendNode.py 2008-01-30 07:32:07.000000000 -0500 +@@ -585,10 +585,34 @@ + + info['cpu_mhz'] = info['cpu_khz'] / 1000 + +- # physinfo is in KiB, need it in MiB +- info['total_memory'] = info['total_memory'] / 1024 +- info['free_memory'] = info['free_memory'] / 1024 +- info['node_to_cpu'] = self.format_node_to_cpu(info) ++ configured_floor = xendoptions().get_dom0_min_mem() * 1024 ++ from xen.xend import balloon ++ try: ++ kernel_floor = balloon.get_dom0_min_target() ++ except: ++ kernel_floor = 0 ++ dom0_min_mem = max(configured_floor, kernel_floor) ++ dom0_mem = balloon.get_dom0_current_alloc() ++ extra_mem = 0 ++ if dom0_min_mem > 0 and dom0_mem > dom0_min_mem: ++ extra_mem = dom0_mem - dom0_min_mem ++ info['free_memory'] = info['free_memory'] + info['scrub_memory'] ++ info['max_free_memory'] = info['free_memory'] + extra_mem ++ ++ # Convert KiB to MiB, rounding down to be conservative ++ info['total_memory'] = info['total_memory'] / 1024 ++ info['free_memory'] = info['free_memory'] / 1024 ++ info['max_free_memory'] = info['max_free_memory'] / 1024 ++ info['node_to_cpu'] = self.format_node_to_cpu(info) ++ ++ # FIXME: These are hard-coded to be the inverse of the getXenMemory ++ # functions in image.py. Find a cleaner way. ++ info['max_para_memory'] = info['max_free_memory'] - 4 ++ if info['max_para_memory'] < 0: ++ info['max_para_memory'] = 0 ++ info['max_hvm_memory'] = int((info['max_free_memory']-12) * (1-2.4/1024)) ++ if info['max_hvm_memory'] < 0: ++ info['max_hvm_memory'] = 0 + + ITEM_ORDER = ['nr_cpus', + 'nr_nodes', +@@ -598,6 +622,9 @@ + 'hw_caps', + 'total_memory', + 'free_memory', ++ 'max_free_memory', ++ 'max_para_memory', ++ 'max_hvm_memory', + 'node_to_cpu' + ] + +diff -Naur xen-3.2-3.2.0.orig/tools/python/xen/xend/XendOptions.py xen-3.2-3.2.0/tools/python/xen/xend/XendOptions.py +--- xen-3.2-3.2.0.orig/tools/python/xen/xend/XendOptions.py 2007-12-29 12:57:47.000000000 -0500 ++++ xen-3.2-3.2.0/tools/python/xen/xend/XendOptions.py 2008-01-30 07:32:07.000000000 -0500 +@@ -315,6 +315,9 @@ + return self.get_config_string('vnc-x509-verify', self.xend_vnc_x509_verify) + + ++ def get_keymap(self): ++ return self.get_config_value('keymap', None) ++ + class XendOptionsFile(XendOptions): + + """Default path to the config file.""" +diff -Naur xen-3.2-3.2.0.orig/tools/python/xen/xm/main.py xen-3.2-3.2.0/tools/python/xen/xm/main.py +--- xen-3.2-3.2.0.orig/tools/python/xen/xm/main.py 2007-12-29 12:57:47.000000000 -0500 ++++ xen-3.2-3.2.0/tools/python/xen/xm/main.py 2008-01-30 07:32:07.000000000 -0500 +@@ -1833,6 +1833,10 @@ + def xm_top(args): + arg_check(args, "top", 0) + ++ # A hack to get a clear error message if ran as non-root ++ if os.geteuid() != 0: ++ raise IOError() ++ + os.system('xentop') + + def xm_dmesg(args): +diff -Naur xen-3.2-3.2.0.orig/tools/xm-test/tests/save/01_save_basic_pos.py xen-3.2-3.2.0/tools/xm-test/tests/save/01_save_basic_pos.py +--- xen-3.2-3.2.0.orig/tools/xm-test/tests/save/01_save_basic_pos.py 2007-12-29 12:57:47.000000000 -0500 ++++ xen-3.2-3.2.0/tools/xm-test/tests/save/01_save_basic_pos.py 2008-01-30 07:32:07.000000000 -0500 +@@ -35,3 +35,9 @@ + # Make sure it's gone + if isDomainRunning(domain.getName()): + FAIL("Domain still running after save!") ++ ++# Clean up ++try: ++ s, o = traceCommand("xm delete %s" % domain.getName(), timeout=30) ++except: ++ pass +diff -Naur xen-3.2-3.2.0.orig/xen/arch/x86/hvm/hvm.c xen-3.2-3.2.0/xen/arch/x86/hvm/hvm.c +--- xen-3.2-3.2.0.orig/xen/arch/x86/hvm/hvm.c 2007-12-29 12:57:47.000000000 -0500 ++++ xen-3.2-3.2.0/xen/arch/x86/hvm/hvm.c 2008-01-30 07:32:07.000000000 -0500 +@@ -606,10 +606,11 @@ + + value &= ~EFER_LMA; + +- if ( (value & ~(EFER_FFXSE | EFER_LME | EFER_NX | EFER_SCE)) || ++ if ( (value & ~(EFER_FFXSE | EFER_LMSLE | EFER_LME | EFER_NX | EFER_SCE)) || + ((sizeof(long) != 8) && (value & EFER_LME)) || + (!cpu_has_nx && (value & EFER_NX)) || + (!cpu_has_syscall && (value & EFER_SCE)) || ++ (!cpu_has_lmsl && (value & EFER_LMSLE)) || + (!cpu_has_ffxsr && (value & EFER_FFXSE)) ) + { + gdprintk(XENLOG_WARNING, "Trying to set reserved bit in " +diff -Naur xen-3.2-3.2.0.orig/xen/arch/x86/hvm/svm/svm.c xen-3.2-3.2.0/xen/arch/x86/hvm/svm/svm.c +--- xen-3.2-3.2.0.orig/xen/arch/x86/hvm/svm/svm.c 2008-01-30 07:29:50.000000000 -0500 ++++ xen-3.2-3.2.0/xen/arch/x86/hvm/svm/svm.c 2008-01-30 07:32:07.000000000 -0500 +@@ -53,6 +53,11 @@ + + u32 svm_feature_flags; + ++#ifdef __x86_64__ ++/* indicate whether guest may use EFER.LMSLE */ ++unsigned char cpu_has_lmsl = 0; ++#endif ++ + #define set_segment_register(name, value) \ + asm volatile ( "movw %%ax ,%%" STR(name) "" : : "a" (value) ) + +@@ -922,6 +927,22 @@ + /* Initialize core's ASID handling. */ + svm_asid_init(c); + ++#ifdef __x86_64__ ++ /* ++ * Check whether EFER.LMSLE can be written. ++ * Unfortunately there's no feature bit defined for this. ++ */ ++ eax = read_efer(); ++ edx = read_efer() >> 32; ++ if ( wrmsr_safe(MSR_EFER, eax | EFER_LMSLE, edx) == 0 ) ++ rdmsr(MSR_EFER, eax, edx); ++ if ( eax & EFER_LMSLE ) ++ { ++ cpu_has_lmsl = 1; ++ wrmsr(MSR_EFER, eax ^ EFER_LMSLE, edx); ++ } ++#endif ++ + if ( cpu != 0 ) + return 1; + +diff -Naur xen-3.2-3.2.0.orig/xen/arch/x86/io_apic.c xen-3.2-3.2.0/xen/arch/x86/io_apic.c +--- xen-3.2-3.2.0.orig/xen/arch/x86/io_apic.c 2007-12-29 12:57:47.000000000 -0500 ++++ xen-3.2-3.2.0/xen/arch/x86/io_apic.c 2008-01-30 07:32:07.000000000 -0500 +@@ -1336,7 +1336,7 @@ + return 0; /* don't check for pending */ + } + +-int ioapic_ack_new = 1; ++int ioapic_ack_new = -1; + static void setup_ioapic_ack(char *s) + { + if ( !strcmp(s, "old") ) +@@ -1774,6 +1774,8 @@ + else + io_apic_irqs = ~PIC_IRQS; + ++ if (ioapic_ack_new < 0) ++ ioapic_ack_new = (nr_ioapics > 1); + printk("ENABLING IO-APIC IRQs\n"); + printk(" -> Using %s ACK method\n", ioapic_ack_new ? "new" : "old"); + +diff -Naur xen-3.2-3.2.0.orig/xen/arch/x86/x86_32/mm.c xen-3.2-3.2.0/xen/arch/x86/x86_32/mm.c +--- xen-3.2-3.2.0.orig/xen/arch/x86/x86_32/mm.c 2007-12-29 12:57:47.000000000 -0500 ++++ xen-3.2-3.2.0/xen/arch/x86/x86_32/mm.c 2008-01-30 07:32:07.000000000 -0500 +@@ -66,6 +66,8 @@ + return &idle_pg_table_l2[l2_linear_offset(v)]; + } + ++extern unsigned long lowmem_emergency_pool_pages; ++ + void __init paging_init(void) + { + unsigned long v; +@@ -137,6 +139,20 @@ + l2e_from_page(virt_to_page(idle_vcpu[0]->domain-> + arch.mm_perdomain_pt) + i, + __PAGE_HYPERVISOR)); ++ ++ /* ++ * Size the lowmem_emergency_pool based on the total memory on the box ++ * This pool is needed only on 32 bit PAE configurations (4g to 16g). ++ */ ++ if (lowmem_emergency_pool_pages) ++ return; ++ ++ if (total_pages > (4 * 1024 * 1024)) ++ lowmem_emergency_pool_pages = 12000; ++ else if (total_pages > (2 * 1024 * 1024)) ++ lowmem_emergency_pool_pages = 8000; ++ else if (total_pages > (1 * 1024 * 1024) || max_page >= (1 * 1024 * 1024)) ++ lowmem_emergency_pool_pages = 4000; + } + + void __init zap_low_mappings(l2_pgentry_t *dom0_l2) +diff -Naur xen-3.2-3.2.0.orig/xen/common/page_alloc.c xen-3.2-3.2.0/xen/common/page_alloc.c +--- xen-3.2-3.2.0.orig/xen/common/page_alloc.c 2007-12-29 12:57:47.000000000 -0500 ++++ xen-3.2-3.2.0/xen/common/page_alloc.c 2008-01-30 07:32:07.000000000 -0500 +@@ -52,6 +52,20 @@ + boolean_param("bootscrub", opt_bootscrub); + + /* ++ * Amount of memory to reserve in a low-memory (<4GB) pool for specific ++ * allocation requests. Ordinary requests will not fall back to the ++ * lowmem emergency pool. ++ */ ++unsigned long lowmem_emergency_pool_pages; ++static void parse_lowmem_emergency_pool(char *s) ++{ ++ unsigned long long bytes; ++ bytes = parse_size_and_unit(s, NULL); ++ lowmem_emergency_pool_pages = bytes >> PAGE_SHIFT; ++} ++custom_param("lowmem_emergency_pool", parse_lowmem_emergency_pool); ++ ++/* + * Bit width of the DMA heap. + */ + static unsigned int dma_bitsize = CONFIG_DMA_BITSIZE; +diff -Naur xen-3.2-3.2.0.orig/xen/include/asm-x86/hvm/hvm.h xen-3.2-3.2.0/xen/include/asm-x86/hvm/hvm.h +--- xen-3.2-3.2.0.orig/xen/include/asm-x86/hvm/hvm.h 2007-12-29 12:57:47.000000000 -0500 ++++ xen-3.2-3.2.0/xen/include/asm-x86/hvm/hvm.h 2008-01-30 07:32:07.000000000 -0500 +@@ -127,6 +127,12 @@ + extern struct hvm_function_table hvm_funcs; + extern int hvm_enabled; + ++#ifdef __i386__ ++# define cpu_has_lmsl 0 ++#else ++extern unsigned char cpu_has_lmsl; ++#endif ++ + int hvm_domain_initialise(struct domain *d); + void hvm_domain_relinquish_resources(struct domain *d); + void hvm_domain_destroy(struct domain *d); --- xen-3.2-3.2.0.orig/debian/patches/fix-amd64-libdir.diff +++ xen-3.2-3.2.0/debian/patches/fix-amd64-libdir.diff @@ -0,0 +1,36 @@ +diff -Naur xen-3.2-3.2.0.orig/config/x86_64.mk xen-3.2-3.2.0/config/x86_64.mk +--- xen-3.2-3.2.0.orig/config/x86_64.mk 2007-12-29 12:57:47.000000000 -0500 ++++ xen-3.2-3.2.0/config/x86_64.mk 2008-01-15 10:42:16.000000000 -0500 +@@ -9,7 +9,7 @@ + CONFIG_IOEMU := y + + CFLAGS += -m64 +-LIBDIR = $(LIB64DIR) ++LIBDIR = lib + + # Use only if calling $(LD) directly. + ifeq ($(XEN_OS),OpenBSD) +diff -Naur xen-3.2-3.2.0.orig/tools/ioemu/configure xen-3.2-3.2.0/tools/ioemu/configure +--- xen-3.2-3.2.0.orig/tools/ioemu/configure 2007-12-29 12:57:47.000000000 -0500 ++++ xen-3.2-3.2.0/tools/ioemu/configure 2008-01-15 10:42:56.000000000 -0500 +@@ -67,7 +67,7 @@ + ;; + x86_64|amd64) + cpu="x86_64" +- libdir="lib64" ++ libdir="lib" + ;; + *) + cpu="unknown" +diff -Naur xen-3.2-3.2.0.orig/tools/ioemu/x86_64.ld xen-3.2-3.2.0/tools/ioemu/x86_64.ld +--- xen-3.2-3.2.0.orig/tools/ioemu/x86_64.ld 2007-12-29 12:57:47.000000000 -0500 ++++ xen-3.2-3.2.0/tools/ioemu/x86_64.ld 2008-01-15 10:46:12.000000000 -0500 +@@ -2,7 +2,7 @@ + OUTPUT_FORMAT("elf64-x86-64", "elf64-x86-64", "elf64-x86-64") + OUTPUT_ARCH(i386:x86-64) + ENTRY(_start) +-SEARCH_DIR("/lib64"); SEARCH_DIR("/usr/lib64"); SEARCH_DIR("/usr/local/lib64"); ++SEARCH_DIR("/lib64"); SEARCH_DIR("/usr/lib"); SEARCH_DIR("/usr/local/lib64"); + SECTIONS + { + /* Read-only sections, merged into text segment: */ --- xen-3.2-3.2.0.orig/debian/patches/xen-ubuntu-fixes.diff +++ xen-3.2-3.2.0/debian/patches/xen-ubuntu-fixes.diff @@ -0,0 +1,37 @@ +diff -Naur xen-3.2-3.2.0.orig/tools/check/check_udev xen-3.2-3.2.0/tools/check/check_udev +--- xen-3.2-3.2.0.orig/tools/check/check_udev 2007-12-29 12:57:47.000000000 -0500 ++++ xen-3.2-3.2.0/tools/check/check_udev 2008-04-10 20:34:15.000000000 -0400 +@@ -9,10 +9,10 @@ + which ${TOOL} 1>/dev/null 2>&1 || RC=1 + ;; + Linux) +- TOOL="udevinfo" ++ TOOL="udevadm" + UDEV_VERSION="0" + test -x "$(which ${TOOL} 2>/dev/null)" && \ +- UDEV_VERSION=$(${TOOL} -V | sed -e 's/^[^0-9]* \([0-9]\{1,\}\)[^0-9]\{0,\}/\1/') ++ UDEV_VERSION=$(${TOOL} version') + if test "${UDEV_VERSION}" -ge 059; then + RC=0 + else +diff -Naur xen-3.2-3.2.0.orig/tools/examples/Makefile xen-3.2-3.2.0/tools/examples/Makefile +--- xen-3.2-3.2.0.orig/tools/examples/Makefile 2007-12-29 12:57:47.000000000 -0500 ++++ xen-3.2-3.2.0/tools/examples/Makefile 2008-04-10 20:34:15.000000000 -0400 +@@ -46,7 +46,7 @@ + ifeq ($(findstring $(DI),$(DE)),$(DI)) + HOTPLUGS=install-hotplug install-udev + else +-ifeq ($(shell [ -x /usr/bin/udevinfo ] && [ `/usr/bin/udevinfo -V | sed -e 's/^[^0-9]* \([0-9]\{1,\}\)[^0-9]\{0,\}/\1/'` -ge 059 ] && echo 1),1) ++ifeq ($(shell [ -x /usr/bin/udevinfo ] && [ `/usr/bin/udevadm version` -ge 059 ] && echo 1),1) + HOTPLUGS=install-udev + else + HOTPLUGS=install-hotplug +diff -Naur xen-3.2-3.2.0.orig/tools/ioemu/target-i386-dm/qemu-ifup xen-3.2-3.2.0/tools/ioemu/target-i386-dm/qemu-ifup +--- xen-3.2-3.2.0.orig/tools/ioemu/target-i386-dm/qemu-ifup 2007-12-29 12:57:47.000000000 -0500 ++++ xen-3.2-3.2.0/tools/ioemu/target-i386-dm/qemu-ifup 2008-04-10 20:36:20.000000000 -0400 +@@ -1,4 +1,4 @@ +-#!/bin/sh ++#!/bin/bash + + #. /etc/rc.d/init.d/functions + #ulimit -c unlimited --- xen-3.2-3.2.0.orig/debian/patches/doc-remove-unused.diff +++ xen-3.2-3.2.0/debian/patches/doc-remove-unused.diff @@ -0,0 +1,12 @@ +--- xen-3.orig/docs/src/interface.tex ++++ xen-3/docs/src/interface.tex +@@ -1,6 +1,6 @@ +-\documentclass[11pt,twoside,final,openright]{report} +-\usepackage{a4,graphicx,html,setspace,times} +-\usepackage{comment,parskip} ++\documentclass[11pt,twoside,final,openright,a4paper]{report} ++\usepackage{graphicx,html,setspace,times} ++\usepackage{parskip} + \setstretch{1.15} + + % LIBRARY FUNCTIONS --- xen-3.2-3.2.0.orig/debian/patches/tools-misc-xend-race.diff +++ xen-3.2-3.2.0/debian/patches/tools-misc-xend-race.diff @@ -0,0 +1,13 @@ +# Wait a little bit before starting xenconsoled. + +--- xen-3.orig/tools/misc/xend ++++ xen-3/tools/misc/xend +@@ -78,6 +78,8 @@ + execute('xenstored', args) + + def start_consoled(): ++ import time ++ time.sleep(2) + if os.fork() == 0: + execute('xenconsoled') + --- xen-3.2-3.2.0.orig/.hg_archival.txt +++ xen-3.2-3.2.0/.hg_archival.txt @@ -1,2 +1,2 @@ repo: ab039beb22dc9d53f224a5ef2ef88d534b561898 -node: 2491691e3e69b38ef8e1f21aa535922b9ffaac28 +node: 1b013d10c6d1e635de4fa5a499df2e0aff0dfd2d --- xen-3.2-3.2.0.orig/xen/arch/x86/x86_emulate.c +++ xen-3.2-3.2.0/xen/arch/x86/x86_emulate.c @@ -103,8 +103,8 @@ ImplicitOps, ImplicitOps, DstReg|SrcMem|ModRM, DstReg|SrcMem16|ModRM|Mov, 0, 0, 0, 0, /* 0x68 - 0x6F */ - ImplicitOps|Mov, DstMem|SrcImm|ModRM|Mov, - ImplicitOps|Mov, DstMem|SrcImmByte|ModRM|Mov, + ImplicitOps|Mov, DstReg|SrcImm|ModRM|Mov, + ImplicitOps|Mov, DstReg|SrcImmByte|ModRM|Mov, ImplicitOps, ImplicitOps, ImplicitOps, ImplicitOps, /* 0x70 - 0x77 */ ImplicitOps, ImplicitOps, ImplicitOps, ImplicitOps, @@ -177,7 +177,7 @@ static uint8_t twobyte_table[256] = { /* 0x00 - 0x07 */ - 0, ImplicitOps|ModRM, 0, 0, 0, ImplicitOps, 0, 0, + 0, ImplicitOps|ModRM, 0, 0, 0, 0, ImplicitOps, 0, /* 0x08 - 0x0F */ ImplicitOps, ImplicitOps, 0, 0, 0, ImplicitOps|ModRM, 0, 0, /* 0x10 - 0x17 */ @@ -1059,11 +1059,14 @@ ((op_bytes == 8) ? 4 : op_bytes); else if ( (d & SrcMask) == SrcImmByte ) ea.mem.off += 1; - else if ( ((b == 0xf6) || (b == 0xf7)) && + else if ( !twobyte && ((b & 0xfe) == 0xf6) && ((modrm_reg & 7) <= 1) ) /* Special case in Grp3: test has immediate operand. */ ea.mem.off += (d & ByteOp) ? 1 : ((op_bytes == 8) ? 4 : op_bytes); + else if ( twobyte && ((b & 0xf7) == 0xa4) ) + /* SHLD/SHRD with immediate byte third operand. */ + ea.mem.off++; break; case 1: ea.mem.off += insn_fetch_type(int8_t); @@ -1331,34 +1334,37 @@ case 0x69: /* imul imm16/32 */ case 0x6b: /* imul imm8 */ { - unsigned long reg = *(long *)decode_register(modrm_reg, &_regs, 0); + unsigned long src1; /* ModR/M source operand */ + if ( ea.type == OP_REG ) + src1 = *ea.reg; + else if ( (rc = ops->read(ea.mem.seg, ea.mem.off, + &src1, op_bytes, ctxt)) ) + goto done; _regs.eflags &= ~(EFLG_OF|EFLG_CF); switch ( dst.bytes ) { case 2: dst.val = ((uint32_t)(int16_t)src.val * - (uint32_t)(int16_t)reg); + (uint32_t)(int16_t)src1); if ( (int16_t)dst.val != (uint32_t)dst.val ) _regs.eflags |= EFLG_OF|EFLG_CF; break; #ifdef __x86_64__ case 4: dst.val = ((uint64_t)(int32_t)src.val * - (uint64_t)(int32_t)reg); + (uint64_t)(int32_t)src1); if ( (int32_t)dst.val != dst.val ) _regs.eflags |= EFLG_OF|EFLG_CF; break; #endif default: { - unsigned long m[2] = { src.val, reg }; + unsigned long m[2] = { src.val, src1 }; if ( imul_dbl(m) ) _regs.eflags |= EFLG_OF|EFLG_CF; dst.val = m[0]; break; } } - dst.type = OP_REG; - dst.reg = decode_register(modrm_reg, &_regs, 0); break; } @@ -1726,7 +1732,6 @@ break; case 2: /* call (near) */ case 4: /* jmp (near) */ - dst.type = OP_NONE; if ( (dst.bytes != 8) && mode_64bit() ) { dst.bytes = op_bytes = 8; @@ -1740,11 +1745,14 @@ _regs.eip = dst.val; if ( (modrm_reg & 7) == 2 ) goto push; /* call */ + dst.type = OP_NONE; break; case 3: /* call (far, absolute indirect) */ case 5: /* jmp (far, absolute indirect) */ { unsigned long sel; + generate_exception_if(dst.type != OP_MEM, EXC_UD); + if ( (rc = ops->read(dst.mem.seg, dst.mem.off+dst.bytes, &sel, 2, ctxt)) ) goto done; @@ -2975,6 +2983,7 @@ { unsigned long old_lo, old_hi; generate_exception_if((modrm_reg & 7) != 1, EXC_UD); + generate_exception_if(ea.type != OP_MEM, EXC_UD); if ( (rc = ops->read(ea.mem.seg, ea.mem.off+0, &old_lo, 4, ctxt)) || (rc = ops->read(ea.mem.seg, ea.mem.off+4, &old_hi, 4, ctxt)) ) goto done; @@ -3002,6 +3011,7 @@ { unsigned long old, new; generate_exception_if((modrm_reg & 7) != 1, EXC_UD); + generate_exception_if(ea.type != OP_MEM, EXC_UD); if ( (rc = ops->read(ea.mem.seg, ea.mem.off, &old, 8, ctxt)) != 0 ) goto done; if ( ((uint32_t)(old>>0) != (uint32_t)_regs.eax) || --- xen-3.2-3.2.0.orig/xen/arch/x86/mm.c +++ xen-3.2-3.2.0/xen/arch/x86/mm.c @@ -1851,7 +1851,7 @@ flush_tlb_mask(mask); } - /* We lose existing type, back pointer, and validity. */ + /* We lose existing type and validity. */ nx &= ~(PGT_type_mask | PGT_validated); nx |= type; --- xen-3.2-3.2.0.orig/xen/arch/x86/traps.c +++ xen-3.2-3.2.0/xen/arch/x86/traps.c @@ -1116,12 +1116,11 @@ } /* - * Early handler to deal with spurious page faults. For example, consider a - * routine that uses a mapping immediately after installing it (making it - * present). The CPU may speculatively execute the memory access before - * executing the PTE write. The instruction will then be marked to cause a - * page fault when it is retired, despite the fact that the PTE is present and - * correct at that point in time. + * Early #PF handler to print CR2, error code, and stack. + * + * We also deal with spurious faults here, even though they should never happen + * during early boot (an issue was seen once, but was most likely a hardware + * problem). */ asmlinkage void do_early_page_fault(struct cpu_user_regs *regs) { @@ -1140,8 +1139,15 @@ } if ( stuck++ == 1000 ) - panic("Early fatal page fault at %04x:%p (cr2=%p, ec=%04x)\n", - regs->cs, _p(regs->eip), _p(cr2), regs->error_code); + { + unsigned long *stk = (unsigned long *)regs; + printk("Early fatal page fault at %04x:%p (cr2=%p, ec=%04x)\n", + regs->cs, _p(regs->eip), _p(cr2), regs->error_code); + printk("Stack dump: "); + while ( ((long)stk & ((PAGE_SIZE - 1) & ~(BYTES_PER_LONG - 1))) != 0 ) + printk("%p ", _p(*stk++)); + for ( ; ; ) ; + } } long do_fpu_taskswitch(int set) @@ -2679,14 +2685,24 @@ { } -void set_intr_gate(unsigned int n, void *addr) +static void __set_intr_gate(unsigned int n, uint32_t dpl, void *addr) { int i; /* Keep secondary tables in sync with IRQ updates. */ for ( i = 1; i < NR_CPUS; i++ ) if ( idt_tables[i] != NULL ) - _set_gate(&idt_tables[i][n], 14, 0, addr); - _set_gate(&idt_table[n], 14, 0, addr); + _set_gate(&idt_tables[i][n], 14, dpl, addr); + _set_gate(&idt_table[n], 14, dpl, addr); +} + +static void set_swint_gate(unsigned int n, void *addr) +{ + __set_intr_gate(n, 3, addr); +} + +void set_intr_gate(unsigned int n, void *addr) +{ + __set_intr_gate(n, 0, addr); } void set_tss_desc(unsigned int n, void *addr) @@ -2753,8 +2769,8 @@ set_intr_gate(TRAP_divide_error,÷_error); set_intr_gate(TRAP_debug,&debug); set_intr_gate(TRAP_nmi,&nmi); - set_intr_gate(TRAP_int3,&int3); /* usable from all privileges */ - set_intr_gate(TRAP_overflow,&overflow); /* usable from all privileges */ + set_swint_gate(TRAP_int3,&int3); /* usable from all privileges */ + set_swint_gate(TRAP_overflow,&overflow); /* usable from all privileges */ set_intr_gate(TRAP_bounds,&bounds); set_intr_gate(TRAP_invalid_op,&invalid_op); set_intr_gate(TRAP_no_device,&device_not_available); --- xen-3.2-3.2.0.orig/xen/arch/x86/mm/shadow/multi.c +++ xen-3.2-3.2.0/xen/arch/x86/mm/shadow/multi.c @@ -2899,7 +2899,10 @@ if ( is_hvm_domain(d) && unlikely(!hvm_wp_enabled(v)) && regs->error_code == (PFEC_write_access|PFEC_page_present) ) + { + perfc_incr(shadow_fault_emulate_wp); goto emulate; + } perfc_incr(shadow_fault_fixed); d->arch.paging.log_dirty.fault_count++; --- xen-3.2-3.2.0.orig/xen/arch/x86/hvm/intercept.c +++ xen-3.2-3.2.0/xen/arch/x86/hvm/intercept.c @@ -247,6 +247,50 @@ return 0; } +static int process_portio_intercept(portio_action_t action, ioreq_t *p) +{ + int rc = 1, i, sign = p->df ? -1 : 1; + uint32_t data; + + if ( p->dir == IOREQ_READ ) + { + if ( !p->data_is_ptr ) + { + rc = action(IOREQ_READ, p->addr, p->size, &data); + p->data = data; + } + else + { + for ( i = 0; i < p->count; i++ ) + { + rc = action(IOREQ_READ, p->addr, p->size, &data); + (void)hvm_copy_to_guest_phys(p->data + sign*i*p->size, + &data, p->size); + } + } + } + else /* p->dir == IOREQ_WRITE */ + { + if ( !p->data_is_ptr ) + { + data = p->data; + rc = action(IOREQ_WRITE, p->addr, p->size, &data); + } + else + { + for ( i = 0; i < p->count; i++ ) + { + data = 0; + (void)hvm_copy_from_guest_phys(&data, p->data + sign*i*p->size, + p->size); + rc = action(IOREQ_WRITE, p->addr, p->size, &data); + } + } + } + + return rc; +} + /* * Check if the request is handled inside xen * return value: 0 --not handled; 1 --handled @@ -255,28 +299,35 @@ { struct vcpu *v = current; struct hvm_io_handler *handler = - &(v->domain->arch.hvm_domain.io_handler); + &v->domain->arch.hvm_domain.io_handler; int i; unsigned long addr, size; if ( (type == HVM_PORTIO) && (dpci_ioport_intercept(p)) ) return 1; - for (i = 0; i < handler->num_slot; i++) { - if( type != handler->hdl_list[i].type) + for ( i = 0; i < handler->num_slot; i++ ) + { + if ( type != handler->hdl_list[i].type ) continue; addr = handler->hdl_list[i].addr; size = handler->hdl_list[i].size; - if (p->addr >= addr && - p->addr + p->size <= addr + size) - return handler->hdl_list[i].action(p); + if ( (p->addr >= addr) && + ((p->addr + p->size) <= (addr + size)) ) + { + if ( type == HVM_PORTIO ) + return process_portio_intercept( + handler->hdl_list[i].action.portio, p); + return handler->hdl_list[i].action.mmio(p); + } } + return 0; } int register_io_handler( struct domain *d, unsigned long addr, unsigned long size, - intercept_action_t action, int type) + void *action, int type) { struct hvm_io_handler *handler = &d->arch.hvm_domain.io_handler; int num = handler->num_slot; @@ -285,8 +336,10 @@ handler->hdl_list[num].addr = addr; handler->hdl_list[num].size = size; - handler->hdl_list[num].action = action; - handler->hdl_list[num].type = type; + if ( (handler->hdl_list[num].type = type) == HVM_PORTIO ) + handler->hdl_list[num].action.portio = action; + else + handler->hdl_list[num].action.mmio = action; handler->num_slot++; return 1; --- xen-3.2-3.2.0.orig/xen/arch/x86/hvm/svm/intr.c +++ xen-3.2-3.2.0/xen/arch/x86/hvm/svm/intr.c @@ -102,7 +102,6 @@ /* Crank the handle on interrupt state. */ pt_update_irq(v); - hvm_set_callback_irq_level(); do { intack = hvm_vcpu_has_pending_irq(v); --- xen-3.2-3.2.0.orig/xen/arch/x86/hvm/svm/svm.c +++ xen-3.2-3.2.0/xen/arch/x86/hvm/svm/svm.c @@ -1009,6 +1009,12 @@ __clear_bit(X86_FEATURE_PSE36 & 31, &edx); /* Filter all other features according to a whitelist. */ + ecx &= (bitmaskof(X86_FEATURE_LAHF_LM) | + bitmaskof(X86_FEATURE_ALTMOVCR) | + bitmaskof(X86_FEATURE_ABM) | + bitmaskof(X86_FEATURE_SSE4A) | + bitmaskof(X86_FEATURE_MISALIGNSSE) | + bitmaskof(X86_FEATURE_3DNOWPF)); edx &= (0x0183f3ff | /* features shared with 0x00000001:EDX */ bitmaskof(X86_FEATURE_NX) | bitmaskof(X86_FEATURE_LM) | @@ -2023,6 +2029,8 @@ perfc_incra(svmexits, exit_reason); + hvm_maybe_deassert_evtchn_irq(); + /* Event delivery caused this intercept? Queue for redelivery. */ eventinj = vmcb->exitintinfo; if ( unlikely(eventinj.fields.v) && --- xen-3.2-3.2.0.orig/xen/arch/x86/hvm/vpt.c +++ xen-3.2-3.2.0/xen/arch/x86/hvm/vpt.c @@ -167,6 +167,7 @@ pt_lock(pt); pt->pending_intr_nr++; + pt->do_not_freeze = 0; if ( !pt->one_shot ) { @@ -253,7 +254,6 @@ return; } - pt->do_not_freeze = 0; pt->irq_issued = 0; if ( pt->one_shot ) @@ -264,7 +264,8 @@ } else { - if ( mode_is(v->domain, one_missed_tick_pending) ) + if ( mode_is(v->domain, one_missed_tick_pending) || + mode_is(v->domain, no_missed_ticks_pending) ) { pt->last_plt_gtime = hvm_get_guest_time(v); pt->pending_intr_nr = 0; /* 'collapse' all missed ticks */ --- xen-3.2-3.2.0.orig/xen/arch/x86/hvm/i8254.c +++ xen-3.2-3.2.0/xen/arch/x86/hvm/i8254.c @@ -48,8 +48,10 @@ #define RW_STATE_WORD0 3 #define RW_STATE_WORD1 4 -static int handle_pit_io(ioreq_t *p); -static int handle_speaker_io(ioreq_t *p); +static int handle_pit_io( + int dir, uint32_t port, uint32_t bytes, uint32_t *val); +static int handle_speaker_io( + int dir, uint32_t port, uint32_t bytes, uint32_t *val); /* Compute with 96 bit intermediate result: (a*b)/c */ static uint64_t muldiv64(uint64_t a, uint32_t b, uint32_t c) @@ -525,24 +527,25 @@ } /* the intercept action for PIT DM retval:0--not handled; 1--handled */ -static int handle_pit_io(ioreq_t *p) +static int handle_pit_io( + int dir, uint32_t port, uint32_t bytes, uint32_t *val) { struct PITState *vpit = vcpu_vpit(current); - if ( (p->size != 1) || p->data_is_ptr || (p->type != IOREQ_TYPE_PIO) ) + if ( bytes != 1 ) { gdprintk(XENLOG_WARNING, "PIT bad access\n"); return 1; } - if ( p->dir == IOREQ_WRITE ) + if ( dir == IOREQ_WRITE ) { - pit_ioport_write(vpit, p->addr, p->data); + pit_ioport_write(vpit, port, *val); } else { - if ( (p->addr & 3) != 3 ) - p->data = pit_ioport_read(vpit, p->addr); + if ( (port & 3) != 3 ) + *val = pit_ioport_read(vpit, port); else gdprintk(XENLOG_WARNING, "PIT: read A1:A0=3!\n"); } @@ -566,11 +569,12 @@ (pit_get_out(pit, 2) << 5) | (refresh_clock << 4)); } -static int handle_speaker_io(ioreq_t *p) +static int handle_speaker_io( + int dir, uint32_t port, uint32_t bytes, uint32_t *val) { struct PITState *vpit = vcpu_vpit(current); - if ( (p->size != 1) || p->data_is_ptr || (p->type != IOREQ_TYPE_PIO) ) + if ( bytes != 1 ) { gdprintk(XENLOG_WARNING, "PIT_SPEAKER bad access\n"); return 1; @@ -578,10 +582,10 @@ spin_lock(&vpit->lock); - if ( p->dir == IOREQ_WRITE ) - speaker_ioport_write(vpit, p->addr, p->data); + if ( dir == IOREQ_WRITE ) + speaker_ioport_write(vpit, port, *val); else - p->data = speaker_ioport_read(vpit, p->addr); + *val = speaker_ioport_read(vpit, port); spin_unlock(&vpit->lock); @@ -599,11 +603,18 @@ }; if ( (current->domain->domain_id == 0) && dom0_pit_access(&ioreq) ) + { /* nothing to do */; - else if ( port == 0x61 ) - handle_speaker_io(&ioreq); + } else - handle_pit_io(&ioreq); + { + uint32_t val = data; + if ( port == 0x61 ) + handle_speaker_io(ioreq.dir, port, 1, &val); + else + handle_pit_io(ioreq.dir, port, 1, &val); + ioreq.data = val; + } return !write ? ioreq.data : 0; } --- xen-3.2-3.2.0.orig/xen/arch/x86/hvm/mtrr.c +++ xen-3.2-3.2.0/xen/arch/x86/hvm/mtrr.c @@ -186,7 +186,14 @@ uint8_t type) { if ( !range_sizek || (reg >= ((m->mtrr_cap & 0xff) - RESERVED_MTRR)) ) + { + gdprintk(XENLOG_WARNING, + "Failed to init var mtrr msr[%d]" + "range_size:%x, total available MSR:%d\n", + reg, range_sizek, + (uint32_t)((m->mtrr_cap & 0xff) - RESERVED_MTRR)); return reg; + } while ( range_sizek ) { @@ -202,7 +209,13 @@ range_sizek -= sizek; if ( reg >= ((m->mtrr_cap & 0xff) - RESERVED_MTRR) ) + { + gdprintk(XENLOG_WARNING, + "Failed to init var mtrr msr[%d]," + "total available MSR:%d\n", + reg, (uint32_t)((m->mtrr_cap & 0xff) - RESERVED_MTRR)); break; + } } return reg; @@ -253,7 +266,7 @@ { if ( e820_table[i].addr == 0x100000 ) { - size = e820_table[i].size + 0x100000 + PAGE_SIZE * 3; + size = e820_table[i].size + 0x100000 + PAGE_SIZE * 4; addr = 0; } else --- xen-3.2-3.2.0.orig/xen/arch/x86/hvm/vmx/intr.c +++ xen-3.2-3.2.0/xen/arch/x86/hvm/vmx/intr.c @@ -156,10 +156,7 @@ /* Crank the handle on interrupt state. */ pt_update_irq(v); - vmx_dirq_assist(v); - - hvm_set_callback_irq_level(); do { intack = hvm_vcpu_has_pending_irq(v); --- xen-3.2-3.2.0.orig/xen/arch/x86/hvm/vmx/vmx.c +++ xen-3.2-3.2.0/xen/arch/x86/hvm/vmx/vmx.c @@ -2741,6 +2741,8 @@ if ( unlikely(exit_reason & VMX_EXIT_REASONS_FAILED_VMENTRY) ) return vmx_failed_vmentry(exit_reason, regs); + hvm_maybe_deassert_evtchn_irq(); + /* Event delivery caused this intercept? Queue for redelivery. */ idtv_info = __vmread(IDT_VECTORING_INFO); if ( unlikely(idtv_info & INTR_INFO_VALID_MASK) && --- xen-3.2-3.2.0.orig/xen/arch/x86/hvm/vmx/vtd/intel-iommu.c +++ xen-3.2-3.2.0/xen/arch/x86/hvm/vmx/vtd/intel-iommu.c @@ -528,7 +528,6 @@ { struct acpi_drhd_unit *drhd; struct iommu *iommu; - int i = 0; wbinvd(); for_each_drhd_unit ( drhd ) @@ -536,7 +535,6 @@ iommu = drhd->iommu; iommu_flush_context_global(iommu, 0); iommu_flush_iotlb_global(iommu, 0); - i++; } } --- xen-3.2-3.2.0.orig/xen/arch/x86/hvm/vmx/vtd/dmar.c +++ xen-3.2-3.2.0/xen/arch/x86/hvm/vmx/vtd/dmar.c @@ -103,7 +103,11 @@ list_for_each_entry ( drhd, &acpi_drhd_units, list ) { if ( drhd->include_all ) + { include_all_drhd = drhd; + continue; + } + if ( acpi_pci_device_match(drhd->devices, drhd->devices_cnt, dev) ) { @@ -119,7 +123,7 @@ gdprintk(XENLOG_INFO VTDPREFIX, "acpi_find_matched_drhd_unit:include_all_drhd->addr = %lx\n", include_all_drhd->address); - return include_all_drhd;; + return include_all_drhd; } return NULL; @@ -513,7 +517,7 @@ ret = acpi_parse_one_rmrr(entry_header); break; case ACPI_DMAR_ATSR: - printk(KERN_INFO PREFIX "found ACPI_DMAR_RMRR\n"); + printk(KERN_INFO PREFIX "found ACPI_DMAR_ATSR\n"); ret = acpi_parse_one_atsr(entry_header); break; default: --- xen-3.2-3.2.0.orig/xen/arch/x86/hvm/vmx/vtd/utils.c +++ xen-3.2-3.2.0/xen/arch/x86/hvm/vmx/vtd/utils.c @@ -154,8 +154,9 @@ struct iommu *iommu; struct context_entry *ctxt_entry; struct root_entry *root_entry; - u64 *l4 = NULL, *l3, *l2, *l1; - u32 l4_index = 0, l3_index, l2_index, l1_index; + struct dma_pte pte; + u64 *l; + u32 l_index; u32 i = 0; int level = agaw_to_level(hd->agaw); @@ -176,20 +177,17 @@ iommu = drhd->iommu; root_entry = iommu->root_entry; - printk(" root_entry = %p\n", root_entry); if ( root_entry == NULL ) { printk(" root_entry == NULL\n"); continue; } + printk(" root_entry = %p\n", root_entry); printk(" root_entry[%x] = %"PRIx64"\n", bus, root_entry[bus].val); - printk(" maddr_to_virt(root_entry[%x]) = %p\n", - bus, maddr_to_virt(root_entry[bus].val)); - - if ( root_entry[bus].val == 0 ) + if ( !root_present(root_entry[bus]) ) { - printk(" root_entry[%x].lo == 0\n", bus); + printk(" root_entry[%x] not present\n", bus); continue; } @@ -201,73 +199,44 @@ continue; } - if ( ctxt_entry[devfn].lo == 0 ) - { - printk(" ctxt_entry[%x].lo == 0\n", devfn); - continue; - } - printk(" context = %p\n", ctxt_entry); printk(" context[%x] = %"PRIx64" %"PRIx64"\n", devfn, ctxt_entry[devfn].hi, ctxt_entry[devfn].lo); - printk(" maddr_to_virt(context[%x].lo) = %p\n", - devfn, maddr_to_virt(ctxt_entry[devfn].lo)); - printk(" context[%x] = %"PRIx64"\n", devfn, ctxt_entry[devfn].lo); - - switch ( level ) - { - case VTD_PAGE_TABLE_LEVEL_3: - l3 = maddr_to_virt(ctxt_entry[devfn].lo); - l3 = (u64*)(((unsigned long)l3 >> PAGE_SHIFT_4K) << PAGE_SHIFT_4K); - printk(" l3 = %p\n", l3); - if ( l3 == NULL ) - continue; - l3_index = get_level_index(gmfn, 3); - printk(" l3_index = %x\n", l3_index); - printk(" l3[%x] = %"PRIx64"\n", l3_index, l3[l3_index]); - - break; - case VTD_PAGE_TABLE_LEVEL_4: - l4 = maddr_to_virt(ctxt_entry[devfn].lo); - l4 = (u64*)(((unsigned long)l4 >> PAGE_SHIFT_4K) << PAGE_SHIFT_4K); - printk(" l4 = %p\n", l4); - if ( l4 == NULL ) - continue; - l4_index = get_level_index(gmfn, 4); - printk(" l4_index = %x\n", l4_index); - printk(" l4[%x] = %"PRIx64"\n", l4_index, l4[l4_index]); - - l3 = maddr_to_virt(l4[l4_index]); - l3 = (u64*)(((unsigned long)l3 >> PAGE_SHIFT_4K) << PAGE_SHIFT_4K); - printk(" l3 = %p\n", l3); - if ( l3 == NULL ) - continue; - l3_index = get_level_index(gmfn, 3); - printk(" l3_index = %x\n", l3_index); - printk(" l3[%x] = %"PRIx64"\n", l3_index, l3[l3_index]); + if ( !context_present(ctxt_entry[devfn]) ) + { + printk(" ctxt_entry[%x] not present\n", devfn); + continue; + } - break; - default: + if ( level != VTD_PAGE_TABLE_LEVEL_3 && + level != VTD_PAGE_TABLE_LEVEL_4) + { printk("Unsupported VTD page table level (%d)!\n", level); continue; } - l2 = maddr_to_virt(l3[l3_index]); - l2 = (u64*)(((unsigned long)l2 >> PAGE_SHIFT_4K) << PAGE_SHIFT_4K); - printk(" l2 = %p\n", l2); - if ( l2 == NULL ) - continue; - l2_index = get_level_index(gmfn, 2); - printk(" l2_index = %x\n", l2_index); - printk(" l2[%x] = %"PRIx64"\n", l2_index, l2[l2_index]); - - l1 = maddr_to_virt(l2[l2_index]); - l1 = (u64*)(((unsigned long)l1 >> PAGE_SHIFT_4K) << PAGE_SHIFT_4K); - printk(" l1 = %p\n", l1); - if ( l1 == NULL ) - continue; - l1_index = get_level_index(gmfn, 1); - printk(" l1_index = %x\n", l1_index); - printk(" l1[%x] = %"PRIx64"\n", l1_index, l1[l1_index]); - } + l = maddr_to_virt(ctxt_entry[devfn].lo); + do + { + l = (u64*)(((unsigned long)l >> PAGE_SHIFT_4K) << PAGE_SHIFT_4K); + printk(" l%d = %p\n", level, l); + if ( l == NULL ) + { + printk(" l%d == NULL\n", level); + break; + } + l_index = get_level_index(gmfn, level); + printk(" l%d_index = %x\n", level, l_index); + printk(" l%d[%x] = %"PRIx64"\n", level, l_index, l[l_index]); + + pte.val = l[l_index]; + if ( !dma_pte_present(pte) ) + { + printk(" l%d[%x] not present\n", level, l_index); + break; + } + + l = maddr_to_virt(l[l_index]); + } while ( --level ); + } } --- xen-3.2-3.2.0.orig/xen/arch/x86/hvm/hpet.c +++ xen-3.2-3.2.0/xen/arch/x86/hvm/hpet.c @@ -71,11 +71,11 @@ #define HPET_TN_INT_ROUTE_CAP_MASK (0xffffffffULL \ << HPET_TN_INT_ROUTE_CAP_SHIFT) -#define hpet_tick_to_ns(h, tick) ((s_time_t)(tick)* \ - (S_TO_NS*TSC_PER_HPET_TICK)/h->tsc_freq) +#define hpet_tick_to_ns(h, tick) \ + ((s_time_t)((((tick) > (h)->hpet_to_ns_limit) ? \ + ~0ULL : (tick) * (h)->hpet_to_ns_scale) >> 10)) #define timer_config(h, n) (h->hpet.timers[n].config) -#define timer_enabled(h, n) (timer_config(h, n) & HPET_TN_ENABLE) #define timer_is_periodic(h, n) (timer_config(h, n) & HPET_TN_PERIODIC) #define timer_is_32bit(h, n) (timer_config(h, n) & HPET_TN_32BIT) #define hpet_enabled(h) (h->hpet.config & HPET_CFG_ENABLE) @@ -195,9 +195,6 @@ ASSERT(tn < HPET_TIMER_NUM); ASSERT(spin_is_locked(&h->lock)); - if ( !hpet_enabled(h) || !timer_enabled(h, tn) ) - return; - if ( (tn == 0) && (h->hpet.config & HPET_CFG_LEGACY) ) { /* HPET specification requires PIT shouldn't generate @@ -306,12 +303,11 @@ } if ( new_val & HPET_TN_32BIT ) + { h->hpet.timers[tn].cmp = (uint32_t)h->hpet.timers[tn].cmp; + h->hpet.period[tn] = (uint32_t)h->hpet.period[tn]; + } - if ( !(old_val & HPET_TN_ENABLE) && (new_val & HPET_TN_ENABLE) ) - hpet_set_timer(h, tn); - else if ( (old_val & HPET_TN_ENABLE) && !(new_val & HPET_TN_ENABLE) ) - hpet_stop_timer(h, tn); break; case HPET_T0_CMP: @@ -324,9 +320,19 @@ (h->hpet.timers[tn].config & HPET_TN_SETVAL) ) h->hpet.timers[tn].cmp = new_val; else + { + /* + * Clamp period to reasonable min/max values: + * - minimum is 900us, same as timers controlled by vpt.c + * - maximum is to prevent overflow in time_after() calculations + */ + if ( hpet_tick_to_ns(h, new_val) < MICROSECS(900) ) + new_val = (MICROSECS(900) << 10) / h->hpet_to_ns_scale; + new_val &= (timer_is_32bit(h, tn) ? ~0u : ~0ull) >> 1; h->hpet.period[tn] = new_val; + } h->hpet.timers[tn].config &= ~HPET_TN_SETVAL; - if ( hpet_enabled(h) && timer_enabled(h, tn) ) + if ( hpet_enabled(h) ) hpet_set_timer(h, tn); break; @@ -383,7 +389,7 @@ return; } - /* We only support edge-triggered interrupt now */ + /* We support only edge-triggered interrupt. */ spin_lock(&d->arch.hvm_domain.irq_lock); vioapic_irq_positive_edge(d, tn_int_route); spin_unlock(&d->arch.hvm_domain.irq_lock); @@ -397,30 +403,30 @@ spin_lock(&h->lock); - if ( !hpet_enabled(h) || !timer_enabled(h, tn) ) + if ( !hpet_enabled(h) ) { spin_unlock(&h->lock); return; } - hpet_route_interrupt(h, tn); + if ( timer_config(h, tn) & HPET_TN_ENABLE ) + hpet_route_interrupt(h, tn); if ( timer_is_periodic(h, tn) && (h->hpet.period[tn] != 0) ) { - uint64_t mc = hpet_read_maincounter(h); + uint64_t mc = hpet_read_maincounter(h), period = h->hpet.period[tn]; if ( timer_is_32bit(h, tn) ) { while ( hpet_time_after(mc, h->hpet.timers[tn].cmp) ) h->hpet.timers[tn].cmp = (uint32_t)( - h->hpet.timers[tn].cmp + h->hpet.period[tn]); + h->hpet.timers[tn].cmp + period); } else { while ( hpet_time_after64(mc, h->hpet.timers[tn].cmp) ) - h->hpet.timers[tn].cmp += h->hpet.period[tn]; + h->hpet.timers[tn].cmp += period; } - set_timer(&h->timers[tn], - NOW() + hpet_tick_to_ns(h, h->hpet.period[tn])); + set_timer(&h->timers[tn], NOW() + hpet_tick_to_ns(h, period)); } spin_unlock(&h->lock); @@ -522,7 +528,8 @@ /* Restart the timers */ for ( i = 0; i < HPET_TIMER_NUM; i++ ) - hpet_set_timer(hp, i); + if ( hpet_enabled(hp) ) + hpet_set_timer(hp, i); spin_unlock(&hp->lock); @@ -543,6 +550,9 @@ h->vcpu = v; h->tsc_freq = ticks_per_sec(v); + h->hpet_to_ns_scale = ((S_TO_NS * TSC_PER_HPET_TICK) << 10) / h->tsc_freq; + h->hpet_to_ns_limit = ~0ULL / h->hpet_to_ns_scale; + /* 64-bit main counter; 3 timers supported; LegacyReplacementRoute. */ h->hpet.capability = 0x8086A201ULL; --- xen-3.2-3.2.0.orig/xen/arch/x86/hvm/irq.c +++ xen-3.2-3.2.0/xen/arch/x86/hvm/irq.c @@ -125,17 +125,13 @@ spin_unlock(&d->arch.hvm_domain.irq_lock); } -void hvm_set_callback_irq_level(void) +static void hvm_set_callback_irq_level(struct vcpu *v) { - struct vcpu *v = current; struct domain *d = v->domain; struct hvm_irq *hvm_irq = &d->arch.hvm_domain.irq; unsigned int gsi, pdev, pintx, asserted; - /* Fast lock-free tests. */ - if ( (v->vcpu_id != 0) || - (hvm_irq->callback_via_type == HVMIRQ_callback_none) ) - return; + ASSERT(v->vcpu_id == 0); spin_lock(&d->arch.hvm_domain.irq_lock); @@ -177,6 +173,22 @@ spin_unlock(&d->arch.hvm_domain.irq_lock); } +void hvm_maybe_deassert_evtchn_irq(void) +{ + struct domain *d = current->domain; + struct hvm_irq *hvm_irq = &d->arch.hvm_domain.irq; + + if ( hvm_irq->callback_via_asserted && + !vcpu_info(d->vcpu[0], evtchn_upcall_pending) ) + hvm_set_callback_irq_level(d->vcpu[0]); +} + +void hvm_assert_evtchn_irq(struct vcpu *v) +{ + if ( v->vcpu_id == 0 ) + hvm_set_callback_irq_level(v); +} + void hvm_set_pci_link_route(struct domain *d, u8 link, u8 isa_irq) { struct hvm_irq *hvm_irq = &d->arch.hvm_domain.irq; @@ -349,13 +361,7 @@ int hvm_local_events_need_delivery(struct vcpu *v) { - struct hvm_intack intack; - - /* TODO: Get rid of event-channel special case. */ - if ( vcpu_info(v, evtchn_upcall_pending) ) - intack = hvm_intack_pic(0); - else - intack = hvm_vcpu_has_pending_irq(v); + struct hvm_intack intack = hvm_vcpu_has_pending_irq(v); if ( likely(intack.source == hvm_intsrc_none) ) return 0; --- xen-3.2-3.2.0.orig/xen/arch/x86/hvm/stdvga.c +++ xen-3.2-3.2.0/xen/arch/x86/hvm/stdvga.c @@ -148,42 +148,37 @@ return rc; } -static int stdvga_out(ioreq_t *p) +static void stdvga_out(uint32_t port, uint32_t bytes, uint32_t val) { - int rc = 1; - - switch ( p->size ) + switch ( bytes ) { case 1: - rc &= stdvga_outb(p->addr, p->data); + stdvga_outb(port, val); break; case 2: - rc &= stdvga_outb(p->addr + 0, p->data >> 0); - rc &= stdvga_outb(p->addr + 1, p->data >> 8); + stdvga_outb(port + 0, val >> 0); + stdvga_outb(port + 1, val >> 8); break; default: - rc = 0; break; } - - return rc; } -int stdvga_intercept_pio(ioreq_t *p) +int stdvga_intercept_pio( + int dir, uint32_t port, uint32_t bytes, uint32_t *val) { struct hvm_hw_stdvga *s = ¤t->domain->arch.hvm_domain.stdvga; - int rc; - if ( p->data_is_ptr || (p->dir == IOREQ_READ) ) + if ( dir == IOREQ_READ ) return 0; spin_lock(&s->lock); - rc = (stdvga_out(p) && hvm_buffered_io_send(p)); + stdvga_out(port, bytes, *val); spin_unlock(&s->lock); - return rc; + return 0; /* propagate to external ioemu */ } #define GET_PLANE(data, p) (((data) >> ((p) * 8)) & 0xff) --- xen-3.2-3.2.0.orig/xen/arch/x86/hvm/pmtimer.c +++ xen-3.2-3.2.0/xen/arch/x86/hvm/pmtimer.c @@ -114,7 +114,8 @@ } /* Handle port I/O to the PM1a_STS and PM1a_EN registers */ -static int handle_evt_io(ioreq_t *p) +static int handle_evt_io( + int dir, uint32_t port, uint32_t bytes, uint32_t *val) { struct vcpu *v = current; PMTState *s = &v->domain->arch.hvm_domain.pl_time.vpmt; @@ -123,10 +124,10 @@ spin_lock(&s->lock); - if ( p->dir == IOREQ_WRITE ) + if ( dir == IOREQ_WRITE ) { /* Handle this I/O one byte at a time */ - for ( i = p->size, addr = p->addr, data = p->data; + for ( i = bytes, addr = port, data = *val; i > 0; i--, addr++, data >>= 8 ) { @@ -150,9 +151,8 @@ default: gdprintk(XENLOG_WARNING, - "Bad ACPI PM register write: %"PRIu64 - " bytes (%#"PRIx64") at %"PRIx64"\n", - p->size, p->data, p->addr); + "Bad ACPI PM register write: %x bytes (%x) at %x\n", + bytes, *val, port); } } /* Fix up the SCI state to match the new register state */ @@ -161,10 +161,10 @@ else /* p->dir == IOREQ_READ */ { data = s->pm.pm1a_sts | (((uint32_t) s->pm.pm1a_en) << 16); - data >>= 8 * (p->addr - PM1a_STS_ADDR); - if ( p->size == 1 ) data &= 0xff; - else if ( p->size == 2 ) data &= 0xffff; - p->data = data; + data >>= 8 * (port - PM1a_STS_ADDR); + if ( bytes == 1 ) data &= 0xff; + else if ( bytes == 2 ) data &= 0xffff; + *val = data; } spin_unlock(&s->lock); @@ -174,22 +174,23 @@ /* Handle port I/O to the TMR_VAL register */ -static int handle_pmt_io(ioreq_t *p) +static int handle_pmt_io( + int dir, uint32_t port, uint32_t bytes, uint32_t *val) { struct vcpu *v = current; PMTState *s = &v->domain->arch.hvm_domain.pl_time.vpmt; - if ( (p->size != 4) || p->data_is_ptr || (p->type != IOREQ_TYPE_PIO) ) + if ( bytes != 4 ) { gdprintk(XENLOG_WARNING, "HVM_PMT bad access\n"); return 1; } - if ( p->dir == IOREQ_READ ) + if ( dir == IOREQ_READ ) { spin_lock(&s->lock); pmt_update_time(s); - p->data = s->pm.tmr_val; + *val = s->pm.tmr_val; spin_unlock(&s->lock); return 1; } --- xen-3.2-3.2.0.orig/xen/arch/x86/hvm/vpic.c +++ xen-3.2-3.2.0/xen/arch/x86/hvm/vpic.c @@ -316,61 +316,45 @@ return vpic->imr; } -static int vpic_intercept_pic_io(ioreq_t *p) +static int vpic_intercept_pic_io( + int dir, uint32_t port, uint32_t bytes, uint32_t *val) { struct hvm_hw_vpic *vpic; - uint32_t data; - if ( (p->size != 1) || (p->count != 1) ) + if ( bytes != 1 ) { - gdprintk(XENLOG_WARNING, "PIC_IO bad access size %d\n", (int)p->size); + gdprintk(XENLOG_WARNING, "PIC_IO bad access size %d\n", bytes); return 1; } - vpic = ¤t->domain->arch.hvm_domain.vpic[p->addr >> 7]; + vpic = ¤t->domain->arch.hvm_domain.vpic[port >> 7]; - if ( p->dir == IOREQ_WRITE ) - { - if ( p->data_is_ptr ) - (void)hvm_copy_from_guest_phys(&data, p->data, p->size); - else - data = p->data; - vpic_ioport_write(vpic, (uint32_t)p->addr, (uint8_t)data); - } + if ( dir == IOREQ_WRITE ) + vpic_ioport_write(vpic, port, (uint8_t)*val); else - { - data = vpic_ioport_read(vpic, (uint32_t)p->addr); - if ( p->data_is_ptr ) - (void)hvm_copy_to_guest_phys(p->data, &data, p->size); - else - p->data = (u64)data; - } + *val = (uint8_t)vpic_ioport_read(vpic, port); return 1; } -static int vpic_intercept_elcr_io(ioreq_t *p) +static int vpic_intercept_elcr_io( + int dir, uint32_t port, uint32_t bytes, uint32_t *val) { struct hvm_hw_vpic *vpic; uint32_t data; - if ( (p->size != 1) || (p->count != 1) ) + if ( bytes != 1 ) { - gdprintk(XENLOG_WARNING, "PIC_IO bad access size %d\n", (int)p->size); + gdprintk(XENLOG_WARNING, "PIC_IO bad access size %d\n", bytes); return 1; } - vpic = ¤t->domain->arch.hvm_domain.vpic[p->addr & 1]; + vpic = ¤t->domain->arch.hvm_domain.vpic[port & 1]; - if ( p->dir == IOREQ_WRITE ) + if ( dir == IOREQ_WRITE ) { - if ( p->data_is_ptr ) - (void)hvm_copy_from_guest_phys(&data, p->data, p->size); - else - data = p->data; - /* Some IRs are always edge trig. Slave IR is always level trig. */ - data &= vpic_elcr_mask(vpic); + data = *val & vpic_elcr_mask(vpic); if ( vpic->is_master ) data |= 1 << 2; vpic->elcr = data; @@ -378,12 +362,7 @@ else { /* Reader should not see hardcoded level-triggered slave IR. */ - data = vpic->elcr & vpic_elcr_mask(vpic); - - if ( p->data_is_ptr ) - (void)hvm_copy_to_guest_phys(p->data, &data, p->size); - else - p->data = data; + *val = vpic->elcr & vpic_elcr_mask(vpic); } return 1; --- xen-3.2-3.2.0.orig/xen/arch/x86/hvm/rtc.c +++ xen-3.2-3.2.0/xen/arch/x86/hvm/rtc.c @@ -395,24 +395,25 @@ return ret; } -static int handle_rtc_io(ioreq_t *p) +static int handle_rtc_io( + int dir, uint32_t port, uint32_t bytes, uint32_t *val) { struct RTCState *vrtc = vcpu_vrtc(current); - if ( (p->size != 1) || p->data_is_ptr || (p->type != IOREQ_TYPE_PIO) ) + if ( bytes != 1 ) { gdprintk(XENLOG_WARNING, "HVM_RTC bas access\n"); return 1; } - if ( p->dir == IOREQ_WRITE ) + if ( dir == IOREQ_WRITE ) { - if ( rtc_ioport_write(vrtc, p->addr, p->data & 0xFF) ) + if ( rtc_ioport_write(vrtc, port, (uint8_t)*val) ) return 1; } else if ( vrtc->hw.cmos_index < RTC_CMOS_SIZE ) { - p->data = rtc_ioport_read(vrtc, p->addr); + *val = rtc_ioport_read(vrtc, port); return 1; } --- xen-3.2-3.2.0.orig/xen/arch/x86/domain.c +++ xen-3.2-3.2.0/xen/arch/x86/domain.c @@ -1416,6 +1416,7 @@ { struct cpu_user_regs *regs = guest_cpu_user_regs(); struct migrate_info *info = v->arch.continue_info; + cpumask_t mask = info->saved_affinity; regs->eax = info->func(info->data); @@ -1424,7 +1425,7 @@ xfree(info); - vcpu_set_affinity(v, &v->cpu_affinity); + vcpu_unlock_affinity(v, &mask); schedule_tail(v); } @@ -1432,7 +1433,6 @@ { struct vcpu *v = current; struct migrate_info *info; - cpumask_t mask = cpumask_of_cpu(cpu); int rc; if ( cpu == smp_processor_id() ) @@ -1445,12 +1445,12 @@ info->func = func; info->data = data; info->saved_schedule_tail = v->arch.schedule_tail; - info->saved_affinity = v->cpu_affinity; + info->saved_affinity = cpumask_of_cpu(cpu); v->arch.schedule_tail = continue_hypercall_on_cpu_helper; v->arch.continue_info = info; - rc = vcpu_set_affinity(v, &mask); + rc = vcpu_lock_affinity(v, &info->saved_affinity); if ( rc ) { v->arch.schedule_tail = info->saved_schedule_tail; --- xen-3.2-3.2.0.orig/xen/arch/x86/time.c +++ xen-3.2-3.2.0/xen/arch/x86/time.c @@ -732,8 +732,10 @@ local_irq_disable(); rdtscll(curr_tsc); t->local_tsc_stamp = curr_tsc; - t->stime_local_stamp = get_s_time(); t->stime_master_stamp = read_platform_stime(); + /* TSC-extrapolated time may be bogus after frequency change. */ + /*t->stime_local_stamp = get_s_time();*/ + t->stime_local_stamp = t->stime_master_stamp; set_time_scale(&t->tsc_scale, freq); local_irq_enable(); @@ -971,8 +973,17 @@ + d->time_offset_seconds; } +/* "cmos_utc_offset" is the difference between UTC time and CMOS time. */ +static long cmos_utc_offset; /* in seconds */ + int time_suspend(void) { + if ( smp_processor_id() == 0 ) + { + cmos_utc_offset = -get_cmos_time(); + cmos_utc_offset += (wc_sec + (wc_nsec + NOW()) / 1000000000ULL); + } + /* Better to cancel calibration timer for accuracy. */ kill_timer(&this_cpu(cpu_time).calibration_timer); @@ -986,7 +997,8 @@ set_time_scale(&this_cpu(cpu_time).tsc_scale, tmp); resume_platform_timer(); - do_settime(get_cmos_time(), 0, read_platform_stime()); + + do_settime(get_cmos_time() + cmos_utc_offset, 0, read_platform_stime()); init_percpu_time(); --- xen-3.2-3.2.0.orig/xen/arch/ia64/vmx/vmx_entry.S +++ xen-3.2-3.2.0/xen/arch/ia64/vmx/vmx_entry.S @@ -635,7 +635,7 @@ movl loc2=PERCPU_ADDR ;; tpa loc2 = loc2 // get physical address of per cpu date - ;; + tpa r3 = r8 // get physical address of ip dep loc5 = 0,in1,60,4 // get physical address of guest_vhpt dep loc6 = 0,in2,60,4 // get physical address of pal code ;; @@ -672,9 +672,7 @@ mov cr.itir=r18 mov cr.ifa=r17 mov r16=IA64_TR_KERNEL - //mov r3=ip movl r25 = PAGE_KERNEL - ;; dep r2=0,r3,0,KERNEL_TR_PAGE_SHIFT ;; or r24=r2,r25 --- xen-3.2-3.2.0.orig/xen/arch/ia64/vmx/vmx_fault.c +++ xen-3.2-3.2.0/xen/arch/ia64/vmx/vmx_fault.c @@ -392,7 +392,7 @@ if (!vhpt_enabled(v, vadr, misr.rs ? RSE_REF : DATA_REF)) { /* windows use region 4 and 5 for identity mapping */ - if ((optf->mask & XEN_IA64_OPTF_IDENT_MAP_REG4) && + if ((optf->mask & XEN_IA64_OPTF_IDENT_MAP_REG4_FLG) && REGION_NUMBER(vadr) == 4 && !(regs->cr_ipsr & IA64_PSR_CPL) && REGION_OFFSET(vadr) <= _PAGE_PPN_MASK) { @@ -402,7 +402,7 @@ goto try_again; return IA64_NO_FAULT; } - if ((optf->mask & XEN_IA64_OPTF_IDENT_MAP_REG5) && + if ((optf->mask & XEN_IA64_OPTF_IDENT_MAP_REG5_FLG) && REGION_NUMBER(vadr) == 5 && !(regs->cr_ipsr & IA64_PSR_CPL) && REGION_OFFSET(vadr) <= _PAGE_PPN_MASK) { @@ -428,8 +428,8 @@ } /* avoid recursively walking (short format) VHPT */ - if (!(optf->mask & XEN_IA64_OPTF_IDENT_MAP_REG4) && - !(optf->mask & XEN_IA64_OPTF_IDENT_MAP_REG5) && + if (!(optf->mask & XEN_IA64_OPTF_IDENT_MAP_REG4_FLG) && + !(optf->mask & XEN_IA64_OPTF_IDENT_MAP_REG5_FLG) && (((vadr ^ vpta.val) << 3) >> (vpta.size + 3)) == 0) { goto inject_dtlb_fault; } --- xen-3.2-3.2.0.orig/xen/arch/ia64/vmx/mmio.c +++ xen-3.2-3.2.0/xen/arch/ia64/vmx/mmio.c @@ -253,11 +253,11 @@ const struct opt_feature *optf = &d->arch.opt_feature; struct hvm_hw_ia64_identity_mappings im_save; - __vmx_identity_mapping_save(optf->mask & XEN_IA64_OPTF_IDENT_MAP_REG4, + __vmx_identity_mapping_save(optf->mask & XEN_IA64_OPTF_IDENT_MAP_REG4_FLG, &optf->im_reg4, &im_save.im_reg4); - __vmx_identity_mapping_save(optf->mask & XEN_IA64_OPTF_IDENT_MAP_REG5, + __vmx_identity_mapping_save(optf->mask & XEN_IA64_OPTF_IDENT_MAP_REG5_FLG, &optf->im_reg5, &im_save.im_reg5); - __vmx_identity_mapping_save(optf->mask & XEN_IA64_OPTF_IDENT_MAP_REG7, + __vmx_identity_mapping_save(optf->mask & XEN_IA64_OPTF_IDENT_MAP_REG7_FLG, &optf->im_reg7, &im_save.im_reg7); return hvm_save_entry(OPT_FEATURE_IDENTITY_MAPPINGS, 0, h, &im_save); --- xen-3.2-3.2.0.orig/xen/arch/ia64/xen/dom0_ops.c +++ xen-3.2-3.2.0/xen/arch/ia64/xen/dom0_ops.c @@ -168,7 +168,8 @@ { ret = shadow_mode_control(d, &op->u.shadow_op); put_domain(d); - copy_to_guest(u_domctl, op, 1); + if (copy_to_guest(u_domctl, op, 1)) + ret = -EFAULT; } } break; @@ -521,10 +522,14 @@ ret = dom0vp_zap_physmap(d, arg0, (unsigned int)arg1); break; case IA64_DOM0VP_add_physmap: + if (!IS_PRIV(d)) + return -EPERM; ret = dom0vp_add_physmap(d, arg0, arg1, (unsigned int)arg2, (domid_t)arg3); break; case IA64_DOM0VP_add_physmap_with_gmfn: + if (!IS_PRIV(d)) + return -EPERM; ret = dom0vp_add_physmap_with_gmfn(d, arg0, arg1, (unsigned int)arg2, (domid_t)arg3); break; --- xen-3.2-3.2.0.orig/xen/arch/ia64/xen/ivt.S +++ xen-3.2-3.2.0/xen/arch/ia64/xen/ivt.S @@ -714,15 +714,20 @@ adds r2=PT(CR_IFS)+16,r12 ;; st8 [r2]=r20 - ;; + ssm psr.ic | PSR_DEFAULT_BITS + ;; + srlz.i + ;; br.call.sptk.many b0=reflect_event ;; + rsm psr.i|psr.ic adds r2=PT(R14)+16,r12 adds r3=PT(R8)+16,r12 ;; //r16 contains ar.bsp before cover ld8 r16=[r2] ld8 r8=[r3] + srlz.i ;; br.sptk.many ia64_ret_from_syscall ;; --- xen-3.2-3.2.0.orig/xen/arch/ia64/xen/domain.c +++ xen-3.2-3.2.0/xen/arch/ia64/xen/domain.c @@ -2277,16 +2277,36 @@ * Helper function for the optimization stuff handling the identity mapping * feature. */ +static inline unsigned long +optf_identity_mapping_cmd_to_flg(unsigned long cmd) +{ + switch(cmd) { + case XEN_IA64_OPTF_IDENT_MAP_REG7: + return XEN_IA64_OPTF_IDENT_MAP_REG7_FLG; + case XEN_IA64_OPTF_IDENT_MAP_REG4: + return XEN_IA64_OPTF_IDENT_MAP_REG4_FLG; + case XEN_IA64_OPTF_IDENT_MAP_REG5: + return XEN_IA64_OPTF_IDENT_MAP_REG5_FLG; + default: + BUG(); + return 0; + } + + /* NOTREACHED */ +} + static inline void optf_set_identity_mapping(unsigned long* mask, struct identity_mapping* im, struct xen_ia64_opt_feature* f) { + unsigned long flag = optf_identity_mapping_cmd_to_flg(f->cmd); + if (f->on) { - *mask |= f->cmd; + *mask |= flag; im->pgprot = f->pgprot; im->key = f->key; } else { - *mask &= ~(f->cmd); + *mask &= ~flag; im->pgprot = 0; im->key = 0; } --- xen-3.2-3.2.0.orig/xen/arch/ia64/xen/vcpu.c +++ xen-3.2-3.2.0/xen/arch/ia64/xen/vcpu.c @@ -1779,7 +1779,7 @@ struct opt_feature* optf = &(vcpu->domain->arch.opt_feature); /* Optimization for identity mapped region 7 OS (linux) */ - if (optf->mask & XEN_IA64_OPTF_IDENT_MAP_REG7 && + if (optf->mask & XEN_IA64_OPTF_IDENT_MAP_REG7_FLG && region == 7 && ia64_psr(regs)->cpl == CONFIG_CPL0_EMUL) { pte.val = address & _PAGE_PPN_MASK; pte.val = pte.val | optf->im_reg7.pgprot; --- xen-3.2-3.2.0.orig/xen/common/schedule.c +++ xen-3.2-3.2.0/xen/common/schedule.c @@ -262,12 +262,11 @@ } } -int vcpu_set_affinity(struct vcpu *v, cpumask_t *affinity) +static int __vcpu_set_affinity( + struct vcpu *v, cpumask_t *affinity, + bool_t old_lock_status, bool_t new_lock_status) { - cpumask_t online_affinity; - - if ( (v->domain->domain_id == 0) && opt_dom0_vcpus_pin ) - return -EINVAL; + cpumask_t online_affinity, old_affinity; cpus_and(online_affinity, *affinity, cpu_online_map); if ( cpus_empty(online_affinity) ) @@ -275,7 +274,18 @@ vcpu_schedule_lock_irq(v); + if ( v->affinity_locked != old_lock_status ) + { + BUG_ON(!v->affinity_locked); + vcpu_schedule_unlock_irq(v); + return -EBUSY; + } + + v->affinity_locked = new_lock_status; + + old_affinity = v->cpu_affinity; v->cpu_affinity = *affinity; + *affinity = old_affinity; if ( !cpu_isset(v->processor, v->cpu_affinity) ) set_bit(_VPF_migrating, &v->pause_flags); @@ -290,6 +300,31 @@ return 0; } +int vcpu_set_affinity(struct vcpu *v, cpumask_t *affinity) +{ + if ( (v->domain->domain_id == 0) && opt_dom0_vcpus_pin ) + return -EINVAL; + return __vcpu_set_affinity(v, affinity, 0, 0); +} + +int vcpu_lock_affinity(struct vcpu *v, cpumask_t *affinity) +{ + return __vcpu_set_affinity(v, affinity, 0, 1); +} + +void vcpu_unlock_affinity(struct vcpu *v, cpumask_t *affinity) +{ + cpumask_t online_affinity; + + /* Do not fail if no CPU in old affinity mask is online. */ + cpus_and(online_affinity, *affinity, cpu_online_map); + if ( cpus_empty(online_affinity) ) + *affinity = cpu_online_map; + + if ( __vcpu_set_affinity(v, affinity, 1, 0) != 0 ) + BUG(); +} + /* Block the currently-executing domain until a pertinent event occurs. */ static long do_block(void) { --- xen-3.2-3.2.0.orig/xen/include/asm-ia64/domain.h +++ xen-3.2-3.2.0/xen/include/asm-ia64/domain.h @@ -93,6 +93,29 @@ unsigned long key; /* A protection key. */ }; +/* opt_feature mask */ +/* + * If this feature is switched on, the hypervisor inserts the + * tlb entries without calling the guests traphandler. + * This is useful in guests using region 7 for identity mapping + * like the linux kernel does. + */ +#define XEN_IA64_OPTF_IDENT_MAP_REG7_FLG_BIT 0 +#define XEN_IA64_OPTF_IDENT_MAP_REG7_FLG \ + (1UL << XEN_IA64_OPTF_IDENT_MAP_REG7_FLG_BIT) + +/* Identity mapping of region 4 addresses in HVM. */ +#define XEN_IA64_OPTF_IDENT_MAP_REG4_FLG_BIT \ + (XEN_IA64_OPTF_IDENT_MAP_REG7_FLG_BIT + 1) +#define XEN_IA64_OPTF_IDENT_MAP_REG4_FLG \ + (1UL << XEN_IA64_OPTF_IDENT_MAP_REG4_FLG_BIT) + +/* Identity mapping of region 5 addresses in HVM. */ +#define XEN_IA64_OPTF_IDENT_MAP_REG5_FLG_BIT \ + (XEN_IA64_OPTF_IDENT_MAP_REG7_FLG_BIT + 2) +#define XEN_IA64_OPTF_IDENT_MAP_REG5_FLG \ + (1UL << XEN_IA64_OPTF_IDENT_MAP_REG5_FLG_BIT) + /* Central structure for optimzation features used by the hypervisor. */ struct opt_feature { unsigned long mask; /* For every feature one bit. */ --- xen-3.2-3.2.0.orig/xen/include/public/arch-ia64.h +++ xen-3.2-3.2.0/xen/include/public/arch-ia64.h @@ -604,21 +604,13 @@ * This is useful in guests using region 7 for identity mapping * like the linux kernel does. */ -#define XEN_IA64_OPTF_IDENT_MAP_REG7_BIT 0 -#define XEN_IA64_OPTF_IDENT_MAP_REG7 \ - (1UL << XEN_IA64_OPTF_IDENT_MAP_REG7_BIT) +#define XEN_IA64_OPTF_IDENT_MAP_REG7 1 /* Identity mapping of region 4 addresses in HVM. */ -#define XEN_IA64_OPTF_IDENT_MAP_REG4_BIT \ - (XEN_IA64_OPTF_IDENT_MAP_REG7_BIT + 1) -#define XEN_IA64_OPTF_IDENT_MAP_REG4 \ - (1UL << XEN_IA64_OPTF_IDENT_MAP_REG4_BIT) +#define XEN_IA64_OPTF_IDENT_MAP_REG4 2 /* Identity mapping of region 5 addresses in HVM. */ -#define XEN_IA64_OPTF_IDENT_MAP_REG5_BIT \ - (XEN_IA64_OPTF_IDENT_MAP_REG7_BIT + 2) -#define XEN_IA64_OPTF_IDENT_MAP_REG5 \ - (1UL << XEN_IA64_OPTF_IDENT_MAP_REG5_BIT) +#define XEN_IA64_OPTF_IDENT_MAP_REG5 3 #define XEN_IA64_OPTF_IDENT_MAP_NOT_SET (0) --- xen-3.2-3.2.0.orig/xen/include/xen/sched.h +++ xen-3.2-3.2.0/xen/include/xen/sched.h @@ -122,6 +122,8 @@ bool_t defer_shutdown; /* VCPU is paused following shutdown request (d->is_shutting_down)? */ bool_t paused_for_shutdown; + /* VCPU affinity is temporarily locked from controller changes? */ + bool_t affinity_locked; unsigned long pause_flags; atomic_t pause_count; @@ -483,6 +485,8 @@ void vcpu_force_reschedule(struct vcpu *v); int vcpu_set_affinity(struct vcpu *v, cpumask_t *affinity); +int vcpu_lock_affinity(struct vcpu *v, cpumask_t *affinity); +void vcpu_unlock_affinity(struct vcpu *v, cpumask_t *affinity); void vcpu_runstate_get(struct vcpu *v, struct vcpu_runstate_info *runstate); --- xen-3.2-3.2.0.orig/xen/include/asm-x86/event.h +++ xen-3.2-3.2.0/xen/include/asm-x86/event.h @@ -30,7 +30,12 @@ static inline void vcpu_mark_events_pending(struct vcpu *v) { - if ( !test_and_set_bit(0, &vcpu_info(v, evtchn_upcall_pending)) ) + if ( test_and_set_bit(0, &vcpu_info(v, evtchn_upcall_pending)) ) + return; + + if ( is_hvm_vcpu(v) ) + hvm_assert_evtchn_irq(v); + else vcpu_kick(v); } --- xen-3.2-3.2.0.orig/xen/include/asm-x86/hvm/vpt.h +++ xen-3.2-3.2.0/xen/include/asm-x86/hvm/vpt.h @@ -58,6 +58,8 @@ struct hpet_registers hpet; struct vcpu *vcpu; uint64_t tsc_freq; + uint64_t hpet_to_ns_scale; /* hpet ticks to ns (multiplied by 2^10) */ + uint64_t hpet_to_ns_limit; /* max hpet ticks convertable to ns */ uint64_t mc_offset; struct timer timers[HPET_TIMER_NUM]; struct HPET_timer_fn_info timer_fn_info[HPET_TIMER_NUM]; --- xen-3.2-3.2.0.orig/xen/include/asm-x86/hvm/irq.h +++ xen-3.2-3.2.0/xen/include/asm-x86/hvm/irq.h @@ -152,7 +152,8 @@ void hvm_set_pci_link_route(struct domain *d, u8 link, u8 isa_irq); -void hvm_set_callback_irq_level(void); +void hvm_maybe_deassert_evtchn_irq(void); +void hvm_assert_evtchn_irq(struct vcpu *v); void hvm_set_callback_via(struct domain *d, uint64_t via); /* Check/Acknowledge next pending interrupt. */ --- xen-3.2-3.2.0.orig/xen/include/asm-x86/hvm/io.h +++ xen-3.2-3.2.0/xen/include/asm-x86/hvm/io.h @@ -86,23 +86,26 @@ #define HVM_MMIO 1 #define HVM_BUFFERED_IO 2 -typedef int (*intercept_action_t)(ioreq_t *); typedef unsigned long (*hvm_mmio_read_t)(struct vcpu *v, unsigned long addr, unsigned long length); - typedef void (*hvm_mmio_write_t)(struct vcpu *v, unsigned long addr, unsigned long length, unsigned long val); - typedef int (*hvm_mmio_check_t)(struct vcpu *v, unsigned long addr); +typedef int (*portio_action_t)( + int dir, uint32_t port, uint32_t bytes, uint32_t *val); +typedef int (*mmio_action_t)(ioreq_t *); struct io_handler { int type; unsigned long addr; unsigned long size; - intercept_action_t action; + union { + portio_action_t portio; + mmio_action_t mmio; + } action; }; struct hvm_io_handler { @@ -120,7 +123,7 @@ extern int hvm_io_intercept(ioreq_t *p, int type); extern int register_io_handler( struct domain *d, unsigned long addr, unsigned long size, - intercept_action_t action, int type); + void *action, int type); static inline int hvm_portio_intercept(ioreq_t *p) { @@ -137,14 +140,14 @@ static inline int register_portio_handler( struct domain *d, unsigned long addr, - unsigned long size, intercept_action_t action) + unsigned long size, portio_action_t action) { return register_io_handler(d, addr, size, action, HVM_PORTIO); } static inline int register_buffered_io_handler( struct domain *d, unsigned long addr, - unsigned long size, intercept_action_t action) + unsigned long size, mmio_action_t action) { return register_io_handler(d, addr, size, action, HVM_BUFFERED_IO); } --- xen-3.2-3.2.0.orig/xen/include/asm-x86/perfc_defn.h +++ xen-3.2-3.2.0/xen/include/asm-x86/perfc_defn.h @@ -56,6 +56,7 @@ PERFCOUNTER(shadow_fault_emulate_write, "shadow_fault emulates a write") PERFCOUNTER(shadow_fault_emulate_failed, "shadow_fault emulator fails") PERFCOUNTER(shadow_fault_emulate_stack, "shadow_fault emulate stack write") +PERFCOUNTER(shadow_fault_emulate_wp, "shadow_fault emulate for CR0.WP=0") PERFCOUNTER(shadow_fault_mmio, "shadow_fault handled as mmio") PERFCOUNTER(shadow_fault_fixed, "shadow_fault fixed fault") PERFCOUNTER(shadow_ptwr_emulate, "shadow causes ptwr to emulate") --- xen-3.2-3.2.0.orig/xen/Makefile +++ xen-3.2-3.2.0/xen/Makefile @@ -2,7 +2,7 @@ # All other places this is stored (eg. compile.h) should be autogenerated. export XEN_VERSION = 3 export XEN_SUBVERSION = 2 -export XEN_EXTRAVERSION ?= .0-rc4$(XEN_VENDORVERSION) +export XEN_EXTRAVERSION ?= .1-rc1-pre$(XEN_VENDORVERSION) export XEN_FULLVERSION = $(XEN_VERSION).$(XEN_SUBVERSION)$(XEN_EXTRAVERSION) -include xen-version