From 8e64a8e0af9530f804e2867693ffdc2d6b256376940f57191a419651a4140827 Mon Sep 17 00:00:00 2001 From: OBS User buildservice-autocommit Date: Fri, 25 Feb 2011 08:44:52 +0000 Subject: [PATCH 1/5] Updating link to change in openSUSE:Factory/xen revision 122.0 OBS-URL: https://build.opensuse.org/package/show/Virtualization/xen?expand=0&rev=142bb91297675e2be37f8d3c151000a4 --- xen.spec | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/xen.spec b/xen.spec index 109974e..77c2e95 100644 --- a/xen.spec +++ b/xen.spec @@ -54,8 +54,8 @@ BuildRequires: acpica BuildRequires: texlive BuildRequires: texlive-latex %else -BuildRequires: te_ams -BuildRequires: te_latex +BuildRequires: te_ams +BuildRequires: te_latex BuildRequires: tetex %endif %ifarch x86_64 @@ -73,7 +73,7 @@ BuildRequires: glibc-devel BuildRequires: kernel-source kernel-syms module-init-tools xorg-x11 %endif Version: 4.0.2_02 -Release: 1 +Release: 6 License: GPLv2+ Group: System/Kernel AutoReqProv: on From 213dc42b7cfdc4937d60a6b5e62846e0096e0d9d7454d7e165e364c9bb67bf20 Mon Sep 17 00:00:00 2001 From: Charles Arnold Date: Mon, 21 Mar 2011 16:38:44 +0000 Subject: [PATCH 2/5] - Fix xen-utils to cope with xen-unstable c/s 21483 - xz-devel is available since 11.2, make it optional for SLES11SP1 - bnc#665610 - xm console > 1 to same VM messes up both consoles Upstream rejected due to portability concern, see http://lists.xensource.com/archives/html/xen-devel/2011-02/msg00942.html xenconsole-no-multiple-connections.patch - Enable support for kernel decompression for gzip, bzip2, and LZMA so that kernels compressed with any of these methods can be launched. - Update to Xen 4.1.0 c/s 22861 OBS-URL: https://build.opensuse.org/package/show/Virtualization/xen?expand=0&rev=101 --- xen-4.1.0-testing-src.tar.bz2 | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 xen-4.1.0-testing-src.tar.bz2 diff --git a/xen-4.1.0-testing-src.tar.bz2 b/xen-4.1.0-testing-src.tar.bz2 new file mode 100644 index 0000000..d98e365 --- /dev/null +++ b/xen-4.1.0-testing-src.tar.bz2 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6bcc8046d5760c203a44f0358eb063c5cf35c5f5b68fc477268a646e529a2d57 +size 10781365 From 05bedd548839bdee6eec022fd31c30e14255af8a6b549f9840f4ec89f8023b85 Mon Sep 17 00:00:00 2001 From: Charles Arnold Date: Mon, 21 Mar 2011 16:47:37 +0000 Subject: [PATCH 3/5] - bnc#681302 - xm create -x returns "ImportError: No module named ext" xm-create-xflag.patch - Fix xen-utils to cope with xen-unstable c/s 21483 - xz-devel is available since 11.2, make it optional for SLES11SP1 - bnc#665610 - xm console > 1 to same VM messes up both consoles Upstream rejected due to portability concern, see http://lists.xensource.com/archives/html/xen-devel/2011-02/msg00942.html xenconsole-no-multiple-connections.patch - Enable support for kernel decompression for gzip, bzip2, and LZMA so that kernels compressed with any of these methods can be launched. - Update to Xen 4.1.0 c/s 22861 OBS-URL: https://build.opensuse.org/package/show/Virtualization/xen?expand=0&rev=102 --- 20158-revert.patch | 55 - 21089-x86-startup-irq-from-setup-gsi.patch | 110 - 21235-crashkernel-advanced.patch | 181 - 21271-x86-cache-flush-global.patch | 69 - 21301-svm-lmsl.patch | 100 - 21304-keyhandler-alternative.patch | 99 - 21406-x86-microcode-quiet.patch | 27 - 21421-vtd-ats-enabling.patch | 144 - 21526-x86-nehalem-cpuid-mask.patch | 230 - 21542-amd-erratum-411.patch | 51 - 21615-dont-save-xen-heap-pages.patch | 163 - 21627-cpuidle-wrap.patch | 25 - 21653-xend-mac-addr.patch | 46 - 21678-xend-mac-fix.patch | 39 - 21683-vtd-kill-timer-conditional.patch | 49 - 21723-get-domu-state.patch | 188 - 21810-x2apic-acpi.patch | 483 -- 21847-pscsi.patch | 130 - 21866-xenapi.patch | 90 - 21894-intel-unmask-cpuid.patch | 52 - 22019-x86-cpuidle-online-check.patch | 32 - 22214-x86-msr-misc-enable.patch | 87 - 22231-x86-pv-ucode-msr-intel.patch | 70 - 22235-lxml-validator.patch | 186 - 22326-cpu-pools-numa-placement.patch | 43 - 22332-vtd-workarounds.patch | 750 -- 22369-xend-pci-passthru-fix.patch | 64 - 22388-x2apic-panic.patch | 50 - 22408-vpmu-nehalem.patch | 21 - 22431-p2m-remove-bug-check.patch | 25 - 22475-x2apic-cleanup.patch | 496 -- 22484-vlapic-tmcct-periodic.patch | 36 - 22504-iommu-dom0-holes.patch | 102 - 22533-x86-32bit-apicid.patch | 177 - 22534-x86-max-local-apic.patch | 165 - 22535-x2apic-preenabled.patch | 88 - 22645-amd-flush-filter.patch | 60 - 22693-fam10-mmio-conf-base-protect.patch | 77 - 22694-x86_64-no-weak.patch | 46 - 22707-x2apic-preenabled-check.patch | 109 - 22708-xenctx-misc.patch | 114 - 22744-ept-pod-locking.patch | 47 - 22749-vtd-workarounds.patch | 264 - 22777-vtd-ats-fixes.patch | 110 - 22781-pod-hap-logdirty.patch | 64 - 22789-i386-no-x2apic.patch | 82 - 22790-svm-resume-migrate-pirqs.patch | 24 - 32on64-extra-mem.patch | 8 +- 7410-qemu-alt-gr.patch | 118 - 7426-xenfb-depth.patch | 50 - 7433-qemu-altgr.patch | 106 - 7434-qemu-rlimit-as.patch | 36 - altgr_2.patch | 6 +- bdrv_default_rwflag.patch | 14 +- bdrv_open2_fix_flags.patch | 18 +- bdrv_open2_flags_2.patch | 20 +- blktap-pv-cdrom.patch | 72 +- blktap.patch | 20 +- blktap2.patch | 26 - blktapctrl-default-to-ioemu.patch | 6 +- bridge-bonding.diff | 12 +- bridge-opensuse.patch | 8 +- bridge-record-creation.patch | 10 +- bridge-vlan.diff | 14 +- build-tapdisk-ioemu.patch | 24 +- capslock_enable.patch | 6 +- cdrom-removable.patch | 32 +- change_home_server.patch | 8 +- check_device_status.patch | 13 +- checkpoint-rename.patch | 8 +- cpu-pools-docs.patch | 1484 ---- cpu-pools-libxc.patch | 307 - cpu-pools-libxen.patch | 2180 ------ cpu-pools-python.patch | 2531 ------- cpu-pools-xmtest.patch | 838 --- cpupools-core-fixup.patch | 144 - cpupools-core.patch | 3230 --------- del_usb_xend_entry.patch | 8 +- disable_emulated_device.diff | 6 +- dom-print.patch | 8 +- domu-usb-controller.patch | 8 +- dump-exec-state.patch | 220 - enable_more_nic_pxe.patch | 6165 ----------------- hibernate.patch | 16 +- hotplug-block-losetup-a.patch | 34 - hv_extid_compatibility.patch | 22 +- ...7615-qcow2-fix-alloc_cluster_link_l2.patch | 6 +- ioemu-bdrv-open-CACHE_WB.patch | 6 +- ioemu-blktap-barriers.patch | 6 +- ioemu-blktap-fv-init.patch | 10 +- ioemu-blktap-image-format.patch | 12 +- ioemu-blktap-zero-size.patch | 12 +- ioemu-debuginfo.patch | 14 +- ioemu-disable-emulated-ide-if-pv.patch | 43 +- ioemu-disable-scsi.patch | 22 +- ioemu-vnc-resize.patch | 6 +- libxen_permissive.patch | 6 +- magic_ioport_compat.patch | 6 +- minios-fixups.patch | 36 +- multi-xvdp.patch | 26 +- network-nat-open-SuSEfirewall2-FORWARD.patch | 6 +- network-nat.patch | 6 +- network-route.patch | 13 - popen2-argument-fix.patch | 13 - pv-driver-build.patch | 24 +- pvdrv-import-shared-info.patch | 18 +- pvdrv_emulation_control.patch | 6 +- qemu-dm-segfault.patch | 6 +- qemu-security-etch1.diff | 16 +- serial-split.patch | 8 +- snapshot-ioemu-delete.patch | 22 +- snapshot-ioemu-restore.patch | 10 +- snapshot-ioemu-save.patch | 42 +- snapshot-without-pv-fix.patch | 36 +- snapshot-xend.patch | 82 +- stdvga-cache.patch | 6 +- supported_module.diff | 4 +- tapdisk-ioemu-logfile.patch | 6 +- tapdisk-ioemu-shutdown-fix.patch | 12 +- tmp_build.patch | 10 +- tools-kboot.diff | 36 +- tools-xc_kexec.diff | 80 +- udev-rules.patch | 22 +- usb-list.patch | 8 +- vif-bridge-no-iptables.patch | 20 +- vif-bridge.mtu.patch | 18 +- vif-route-ifup.patch | 22 +- x86-cpufreq-report.patch | 26 +- x86-extra-trap-info.patch | 117 +- x86-ioapic-ack-default.patch | 10 +- x86-show-page-walk-early.patch | 60 +- xen-4.0.2-testing-src.tar.bz2 | 3 - xen-api-auth.patch | 6 +- xen-changeset.diff | 6 +- xen-config.diff | 95 +- xen-destdir.diff | 90 +- xen-disable-qemu-monitor.diff | 6 +- xen-domUloader.diff | 100 +- xen-extra-fixes.patch | 14 - xen-fixme-doc.diff | 26 +- xen-hvm-default-bridge.diff | 26 +- xen-hvm-default-pae.diff | 6 +- xen-ioemu-hvm-pv-support.diff | 6 +- xen-max-free-mem.diff | 53 +- xen-minimum-restart-time.patch | 6 +- xen-no-dummy-nfs-ip.diff | 8 +- xen-paths.diff | 22 +- xen-qemu-iscsi-fix.patch | 14 +- xen-rpmoptflags.diff | 12 +- xen-utils-0.1.tar.bz2 | 4 +- xen-warnings.diff | 76 +- xen-xm-top-needs-root.diff | 8 +- xen-xmexample-vti.diff | 8 +- xen-xmexample.diff | 38 +- xen.changes | 36 +- xen.spec | 362 +- xenapi-console-protocol.patch | 8 +- xenconsole-no-multiple-connections.patch | 25 + xend-config.diff | 26 +- xend-core-dump-loc.diff | 8 +- xend-devid-or-name.patch | 8 +- xend-domain-lock.patch | 149 +- xend-sysconfig.patch | 18 +- xenpaging.autostart_delay.patch | 85 + xentrace.dynamic_sized_tbuf.patch | 59 +- xm-create-xflag.patch | 24 +- xm-save-check-file.patch | 36 +- xm-test-cleanup.diff | 6 +- 168 files changed, 1330 insertions(+), 24685 deletions(-) delete mode 100644 20158-revert.patch delete mode 100644 21089-x86-startup-irq-from-setup-gsi.patch delete mode 100644 21235-crashkernel-advanced.patch delete mode 100644 21271-x86-cache-flush-global.patch delete mode 100644 21301-svm-lmsl.patch delete mode 100644 21304-keyhandler-alternative.patch delete mode 100644 21406-x86-microcode-quiet.patch delete mode 100644 21421-vtd-ats-enabling.patch delete mode 100644 21526-x86-nehalem-cpuid-mask.patch delete mode 100644 21542-amd-erratum-411.patch delete mode 100644 21615-dont-save-xen-heap-pages.patch delete mode 100644 21627-cpuidle-wrap.patch delete mode 100644 21653-xend-mac-addr.patch delete mode 100644 21678-xend-mac-fix.patch delete mode 100644 21683-vtd-kill-timer-conditional.patch delete mode 100644 21723-get-domu-state.patch delete mode 100644 21810-x2apic-acpi.patch delete mode 100644 21847-pscsi.patch delete mode 100644 21866-xenapi.patch delete mode 100644 21894-intel-unmask-cpuid.patch delete mode 100644 22019-x86-cpuidle-online-check.patch delete mode 100644 22214-x86-msr-misc-enable.patch delete mode 100644 22231-x86-pv-ucode-msr-intel.patch delete mode 100644 22235-lxml-validator.patch delete mode 100644 22326-cpu-pools-numa-placement.patch delete mode 100644 22332-vtd-workarounds.patch delete mode 100644 22369-xend-pci-passthru-fix.patch delete mode 100644 22388-x2apic-panic.patch delete mode 100644 22408-vpmu-nehalem.patch delete mode 100644 22431-p2m-remove-bug-check.patch delete mode 100644 22475-x2apic-cleanup.patch delete mode 100644 22484-vlapic-tmcct-periodic.patch delete mode 100644 22504-iommu-dom0-holes.patch delete mode 100644 22533-x86-32bit-apicid.patch delete mode 100644 22534-x86-max-local-apic.patch delete mode 100644 22535-x2apic-preenabled.patch delete mode 100644 22645-amd-flush-filter.patch delete mode 100644 22693-fam10-mmio-conf-base-protect.patch delete mode 100644 22694-x86_64-no-weak.patch delete mode 100644 22707-x2apic-preenabled-check.patch delete mode 100644 22708-xenctx-misc.patch delete mode 100644 22744-ept-pod-locking.patch delete mode 100644 22749-vtd-workarounds.patch delete mode 100644 22777-vtd-ats-fixes.patch delete mode 100644 22781-pod-hap-logdirty.patch delete mode 100644 22789-i386-no-x2apic.patch delete mode 100644 22790-svm-resume-migrate-pirqs.patch delete mode 100644 7410-qemu-alt-gr.patch delete mode 100644 7426-xenfb-depth.patch delete mode 100644 7433-qemu-altgr.patch delete mode 100644 7434-qemu-rlimit-as.patch delete mode 100644 blktap2.patch delete mode 100644 cpu-pools-docs.patch delete mode 100644 cpu-pools-libxc.patch delete mode 100644 cpu-pools-libxen.patch delete mode 100644 cpu-pools-python.patch delete mode 100644 cpu-pools-xmtest.patch delete mode 100644 cpupools-core-fixup.patch delete mode 100644 cpupools-core.patch delete mode 100644 dump-exec-state.patch delete mode 100644 enable_more_nic_pxe.patch delete mode 100644 hotplug-block-losetup-a.patch delete mode 100644 network-route.patch delete mode 100644 popen2-argument-fix.patch delete mode 100644 xen-4.0.2-testing-src.tar.bz2 delete mode 100644 xen-extra-fixes.patch create mode 100644 xenconsole-no-multiple-connections.patch create mode 100644 xenpaging.autostart_delay.patch diff --git a/20158-revert.patch b/20158-revert.patch deleted file mode 100644 index a57c2b1..0000000 --- a/20158-revert.patch +++ /dev/null @@ -1,55 +0,0 @@ -# HG changeset patch -# User jfehlig@localhost -# Date 1293498049 25200 -# Node ID 7584dc7bc3de64340f193a0cab188e85bd50d594 -# Parent f9ce5858f7eae84bec34aa10d3585c7e6f6ca6c9 -Revert 20158:f9ce5858f7ea xend: Support "bootloader" mode for "drbd:" devices - -block-drbd (provided by drbd project) handles all the details that -c/s 20158 introduces within xend. Subtleties of configuring storage -subsystems should not be handled by xend, but instead delegated to the block -script mechansim provided by the xen toool stack. - -Note: Patch submitted upstream but not (yet) accepted since xend is on - the way out. - -http://lists.xensource.com/archives/html/xen-devel/2010-12/msg01160.html - -Index: xen-4.0.2-testing/tools/python/xen/util/blkif.py -=================================================================== ---- xen-4.0.2-testing.orig/tools/python/xen/util/blkif.py -+++ xen-4.0.2-testing/tools/python/xen/util/blkif.py -@@ -79,13 +79,6 @@ def parse_uname(uname): - if typ == "phy" and not fn.startswith("/"): - fn = "/dev/%s" %(fn,) - -- if typ == "drbd": -- if not fn.startswith("drbd"): -- (drbdadmstdin, drbdadmstdout) = os.popen2("/sbin/drbdadm "+"sh-dev "+fn) -- fn = drbdadmstdout.readline().strip() -- else: -- fn = "/dev/%s" %(fn,) -- - if typ in ("tap", "tap2"): - (taptype, fn) = fn.split(":", 1) - if taptype in ("tapdisk", "ioemu"): -Index: xen-4.0.2-testing/tools/python/xen/xend/XendDomainInfo.py -=================================================================== ---- xen-4.0.2-testing.orig/tools/python/xen/xend/XendDomainInfo.py -+++ xen-4.0.2-testing/tools/python/xen/xend/XendDomainInfo.py -@@ -3283,15 +3283,6 @@ class XendDomainInfo: - - (fn, types) = parse_uname(disk) - -- # If this is a drbd volume, check if we need to activate it -- if disk.find(":") != -1: -- (disktype, diskname) = disk.split(':', 1) -- if disktype == 'drbd': -- (drbdadmstdin, drbdadmstdout) = os.popen2(["/sbin/drbdadm", "state", diskname]) -- (state, junk) = drbdadmstdout.readline().split('/', 1) -- if state == 'Secondary': -- os.system('/sbin/drbdadm primary ' + diskname) -- - mounted_vbd_uuid = 0 - def _shouldMount(types): - if types[0] in ('file', 'phy'): diff --git a/21089-x86-startup-irq-from-setup-gsi.patch b/21089-x86-startup-irq-from-setup-gsi.patch deleted file mode 100644 index a932993..0000000 --- a/21089-x86-startup-irq-from-setup-gsi.patch +++ /dev/null @@ -1,110 +0,0 @@ -# HG changeset patch -# User Keir Fraser -# Date 1270026749 -3600 -# Node ID 4f796e29987c0db1579787fe0b7d3d5af00963ea -# Parent 589d075ba2953123c1b39ecdbc190689ac6f443c -x86: start PCI IRQs Xen uses from Dom0-invoked io_apic_set_pci_routing() - -When using a serial port from an add-in PCI card, and that IRQ is (as -usual) outside of the legacy range (0...15), Xen would never really -enable the IRQ, as at the time setup_irq() runs the handler for the -IRQ still is &no_irq_type. Consequently, once the trigger mode and -polarity of the interrupt become known to Xen, it should start such -IRQ(s) it uses for itself. - -The question is whether the same should also be done in -ioapic_guest_write(): Legacy kernels don't use PHYSDEVOP_setup_gsi -(and hence don't trigger the code path modified). - -Note however that even when a kernel is using PHYSDEVOP_setup_gsi in -the way the pv-ops kernel currently does, there's still no guarantee -that the call would ever be issued for IRQs Xen may be using, since -this happens only when devices get enabled. For Xen's purposes, this -function should be called for *all* device IRQs, regardless of -whether those would actually be (attempted to be) used by the kernel, -i.e. in a subsys_initcall() from drivers/acpi/pci_irq.c iterating -over all PCI devices and doing mostly what acpi_pci_irq_enable() does -except for calling this function in place of acpi_register_gsi(). The -downside of this approach is that without extra filtering in Xen -(based on a hint from Dom0), vectors will then get up even for IRQs -that are unused by both hypervisor and kernel. - -Signed-off-by: Jan Beulich - -# HG changeset patch -# User Keir Fraser -# Date 1271090214 -3600 -# Node ID 7eeb131880b20a33e7675cc1726ae312a489be2d -# Parent b65a41dc6c6a2e2341ae778d8386a08d502bbfa4 -Fix bug in 21089:4f796e29987c - -Signed-off-by: Jan Beulich - -# HG changeset patch -# User Keir Fraser -# Date 1271169507 -3600 -# Node ID 0bebb5fa4f051df9b4fed4d11a723fae91bc7523 -# Parent 859a372efa66e6bcba8e1fd968e521cb16da12ea -Make c/s 21089 work again with c/s 21092 - -Unfortunately the latter c/s' change to mpparse.c yielded the former -patch non-functional - Xen's serial port IRQ is not in IQR_DISABLED -state, yet must be allowed to get its trigger mode and polarity set -up in order for it to be usable. - -Signed-off-by: Jan Beulich - -Index: xen-4.0.2-testing/xen/arch/x86/io_apic.c -=================================================================== ---- xen-4.0.2-testing.orig/xen/arch/x86/io_apic.c -+++ xen-4.0.2-testing/xen/arch/x86/io_apic.c -@@ -2232,6 +2232,7 @@ int __init io_apic_get_redir_entries (in - - int io_apic_set_pci_routing (int ioapic, int pin, int irq, int edge_level, int active_high_low) - { -+ struct irq_desc *desc = irq_to_desc(irq); - struct IO_APIC_route_entry entry; - unsigned long flags; - int vector; -@@ -2283,7 +2284,12 @@ int io_apic_set_pci_routing (int ioapic, - io_apic_write(ioapic, 0x11+2*pin, *(((int *)&entry)+1)); - io_apic_write(ioapic, 0x10+2*pin, *(((int *)&entry)+0)); - set_native_irq_info(irq, TARGET_CPUS); -- spin_unlock_irqrestore(&ioapic_lock, flags); -+ spin_unlock(&ioapic_lock); -+ -+ spin_lock(&desc->lock); -+ if (!(desc->status & (IRQ_DISABLED | IRQ_GUEST))) -+ desc->handler->startup(irq); -+ spin_unlock_irqrestore(&desc->lock, flags); - - return 0; - } -Index: xen-4.0.2-testing/xen/arch/x86/mpparse.c -=================================================================== ---- xen-4.0.2-testing.orig/xen/arch/x86/mpparse.c -+++ xen-4.0.2-testing/xen/arch/x86/mpparse.c -@@ -1102,6 +1102,8 @@ int mp_register_gsi (u32 gsi, int trigge - int ioapic = -1; - int ioapic_pin = 0; - int idx, bit = 0; -+ struct irq_desc * desc; -+ unsigned long flags; - - /* - * Mapping between Global System Interrups, which -@@ -1123,8 +1125,13 @@ int mp_register_gsi (u32 gsi, int trigge - - ioapic_pin = gsi - mp_ioapic_routing[ioapic].gsi_base; - -- if (!(irq_to_desc(gsi)->status & IRQ_DISABLED)) -+ desc = irq_to_desc(gsi); -+ spin_lock_irqsave(&desc->lock, flags); -+ if (!(desc->status & IRQ_DISABLED) && desc->handler != &no_irq_type) { -+ spin_unlock_irqrestore(&desc->lock, flags); - return -EEXIST; -+ } -+ spin_unlock_irqrestore(&desc->lock, flags); - - /* - * Avoid pin reprogramming. PRTs typically include entries diff --git a/21235-crashkernel-advanced.patch b/21235-crashkernel-advanced.patch deleted file mode 100644 index d2be9ad..0000000 --- a/21235-crashkernel-advanced.patch +++ /dev/null @@ -1,181 +0,0 @@ -References: bnc#585371 - -# HG changeset patch -# User Keir Fraser -# Date 1272280332 -3600 -# Node ID 3ce824963dc41827bdf1617b37a40e5e5e9dce29 -# Parent d01ea51fc929c57c7d5f427e1aafa0de7a436473 -Support Linux's advanced crashkernel= syntax - -Quoting the original Linux patch's description: - -"This patch adds a extended crashkernel syntax that makes the value of - reserved system RAM dependent on the system RAM itself: - - crashkernel=:[,:,...][@offset] - range=start-[end] - - For example: - - crashkernel=512M-2G:64M,2G-:128M - - The motivation comes from distributors that configure their - crashkernel command line automatically with some configuration tool - (YaST, you know ;)). Of course that tool knows the value of System - RAM, but if the user removes RAM, then the system becomes unbootable - or at least unusable and error handling is very difficult." - -For x86, other than Linux we pass the actual amount of RAM rather than -the highest page's address (to cope with sparse physical address -maps). - -This still needs to be hooked up for ia64. - -Signed-off-by: Jan Beulich - -Index: xen-4.0.2-testing/xen/arch/x86/setup.c -=================================================================== ---- xen-4.0.2-testing.orig/xen/arch/x86/setup.c -+++ xen-4.0.2-testing/xen/arch/x86/setup.c -@@ -664,6 +664,11 @@ void __init __start_xen(unsigned long mb - memcpy(&boot_e820, &e820, sizeof(e820)); - - /* Early kexec reservation (explicit static start address). */ -+ nr_pages = 0; -+ for ( i = 0; i < e820.nr_map; i++ ) -+ if ( e820.map[i].type == E820_RAM ) -+ nr_pages += e820.map[i].size >> PAGE_SHIFT; -+ set_kexec_crash_area_size((u64)nr_pages << PAGE_SHIFT); - kexec_reserve_area(&boot_e820); - - /* -Index: xen-4.0.2-testing/xen/common/kexec.c -=================================================================== ---- xen-4.0.2-testing.orig/xen/common/kexec.c -+++ xen-4.0.2-testing/xen/common/kexec.c -@@ -49,15 +49,109 @@ static unsigned char vmcoreinfo_data[VMC - static size_t vmcoreinfo_size = 0; - - xen_kexec_reserve_t kexec_crash_area; -+static struct { -+ u64 start, end; -+ unsigned long size; -+} ranges[16] __initdata; - -+/* -+ * Parse command lines in the format -+ * -+ * crashkernel=:[,...][@] -+ * -+ * with being of form -+ * -+ * -[] -+ * -+ * as well as the legacy ones in the format -+ * -+ * crashkernel=[@] -+ */ - static void __init parse_crashkernel(const char *str) - { -- kexec_crash_area.size = parse_size_and_unit(str, &str); -- if ( *str == '@' ) -- kexec_crash_area.start = parse_size_and_unit(str+1, NULL); -+ const char *cur; -+ -+ if ( strchr(str, ':' ) ) -+ { -+ unsigned int idx = 0; -+ -+ do { -+ if ( idx >= ARRAY_SIZE(ranges) ) -+ { -+ printk(XENLOG_WARNING "crashkernel: too many ranges\n"); -+ cur = NULL; -+ str = strchr(str, '@'); -+ break; -+ } -+ -+ ranges[idx].start = parse_size_and_unit(cur = str + !!idx, &str); -+ if ( cur == str ) -+ break; -+ -+ if ( *str != '-' ) -+ { -+ printk(XENLOG_WARNING "crashkernel: '-' expected\n"); -+ break; -+ } -+ -+ if ( *++str != ':' ) -+ { -+ ranges[idx].end = parse_size_and_unit(cur = str, &str); -+ if ( cur == str ) -+ break; -+ if ( ranges[idx].end <= ranges[idx].start ) -+ { -+ printk(XENLOG_WARNING "crashkernel: end <= start\n"); -+ break; -+ } -+ } -+ else -+ ranges[idx].end = -1; -+ -+ if ( *str != ':' ) -+ { -+ printk(XENLOG_WARNING "crashkernel: ':' expected\n"); -+ break; -+ } -+ -+ ranges[idx].size = parse_size_and_unit(cur = str + 1, &str); -+ if ( cur == str ) -+ break; -+ -+ ++idx; -+ } while ( *str == ',' ); -+ if ( idx < ARRAY_SIZE(ranges) ) -+ ranges[idx].size = 0; -+ } -+ else -+ kexec_crash_area.size = parse_size_and_unit(cur = str, &str); -+ if ( cur != str && *str == '@' ) -+ kexec_crash_area.start = parse_size_and_unit(cur = str + 1, &str); -+ if ( cur == str ) -+ printk(XENLOG_WARNING "crashkernel: memory value expected\n"); - } - custom_param("crashkernel", parse_crashkernel); - -+void __init set_kexec_crash_area_size(u64 system_ram) -+{ -+ unsigned int idx; -+ -+ for ( idx = 0; idx < ARRAY_SIZE(ranges) && !kexec_crash_area.size; ++idx ) -+ { -+ if ( !ranges[idx].size ) -+ break; -+ -+ if ( ranges[idx].size >= system_ram ) -+ { -+ printk(XENLOG_WARNING "crashkernel: invalid size\n"); -+ continue; -+ } -+ -+ if ( ranges[idx].start <= system_ram && ranges[idx].end > system_ram ) -+ kexec_crash_area.size = ranges[idx].size; -+ } -+} -+ - static void one_cpu_only(void) - { - /* Only allow the first cpu to continue - force other cpus to spin */ -Index: xen-4.0.2-testing/xen/include/xen/kexec.h -=================================================================== ---- xen-4.0.2-testing.orig/xen/include/xen/kexec.h -+++ xen-4.0.2-testing/xen/include/xen/kexec.h -@@ -12,6 +12,8 @@ typedef struct xen_kexec_reserve { - - extern xen_kexec_reserve_t kexec_crash_area; - -+void set_kexec_crash_area_size(u64 system_ram); -+ - /* We have space for 4 images to support atomic update - * of images. This is important for CRASH images since - * a panic can happen at any time... diff --git a/21271-x86-cache-flush-global.patch b/21271-x86-cache-flush-global.patch deleted file mode 100644 index 5ca8447..0000000 --- a/21271-x86-cache-flush-global.patch +++ /dev/null @@ -1,69 +0,0 @@ -# HG changeset patch -# User Keir Fraser -# Date 1272973271 -3600 -# Node ID 6c7b905b03ff1cf171187bafe7129e3e213e5787 -# Parent bd52f2e040e5a5ca58e956b3d0780a86934a429e -x86: add support for domain-initiated global cache flush - -Newer Linux' AGP code wants to flush caches on all CPUs under certain -circumstances. Since doing this on all vCPU-s of the domain in -question doesn't yield the intended effect, this needs to be done in -the hypervisor. Add a new MMUEXT operation for this. - -Signed-off-by: Jan Beulich - -Index: xen-4.0.2-testing/xen/arch/x86/mm.c -=================================================================== ---- xen-4.0.2-testing.orig/xen/arch/x86/mm.c -+++ xen-4.0.2-testing/xen/arch/x86/mm.c -@@ -2889,6 +2889,27 @@ int do_mmuext_op( - } - break; - -+ case MMUEXT_FLUSH_CACHE_GLOBAL: -+ if ( unlikely(foreigndom != DOMID_SELF) ) -+ okay = 0; -+ else if ( likely(cache_flush_permitted(d)) ) -+ { -+ unsigned int cpu; -+ cpumask_t mask = CPU_MASK_NONE; -+ -+ for_each_online_cpu(cpu) -+ if ( !cpus_intersects(mask, -+ per_cpu(cpu_sibling_map, cpu)) ) -+ cpu_set(cpu, mask); -+ flush_mask(&mask, FLUSH_CACHE); -+ } -+ else -+ { -+ MEM_LOG("Non-physdev domain tried to FLUSH_CACHE_GLOBAL"); -+ okay = 0; -+ } -+ break; -+ - case MMUEXT_SET_LDT: - { - unsigned long ptr = op.arg1.linear_addr; -Index: xen-4.0.2-testing/xen/include/public/xen.h -=================================================================== ---- xen-4.0.2-testing.orig/xen/include/public/xen.h -+++ xen-4.0.2-testing/xen/include/public/xen.h -@@ -239,6 +239,10 @@ DEFINE_XEN_GUEST_HANDLE(xen_pfn_t); - * - * cmd: MMUEXT_FLUSH_CACHE - * No additional arguments. Writes back and flushes cache contents. -+ * -+ * cmd: MMUEXT_FLUSH_CACHE_GLOBAL -+ * No additional arguments. Writes back and flushes cache contents -+ * on all CPUs in the system. - * - * cmd: MMUEXT_SET_LDT - * linear_addr: Linear address of LDT base (NB. must be page-aligned). -@@ -268,6 +272,7 @@ DEFINE_XEN_GUEST_HANDLE(xen_pfn_t); - #define MMUEXT_NEW_USER_BASEPTR 15 - #define MMUEXT_CLEAR_PAGE 16 - #define MMUEXT_COPY_PAGE 17 -+#define MMUEXT_FLUSH_CACHE_GLOBAL 18 - - #ifndef __ASSEMBLY__ - struct mmuext_op { diff --git a/21301-svm-lmsl.patch b/21301-svm-lmsl.patch deleted file mode 100644 index 2fb8966..0000000 --- a/21301-svm-lmsl.patch +++ /dev/null @@ -1,100 +0,0 @@ -# HG changeset patch -# User Keir Fraser -# Date 1273142634 -3600 -# Node ID 69c85f5b0a07e7a95945d117ea478a80d21c6b9e -# Parent 26da9bb87405c64c02def8d5f11c66f15847bd02 -svm: support EFER.LMSLE for guests - -Now that the feature is officially documented (see -http://support.amd.com/us/Processor_TechDocs/24593.pdf), I think it -makes sense to also allow HVM guests to make use of it. - -Signed-off-by: Jan Beulich - -Index: xen-4.0.2-testing/xen/arch/x86/hvm/hvm.c -=================================================================== ---- xen-4.0.2-testing.orig/xen/arch/x86/hvm/hvm.c -+++ xen-4.0.2-testing/xen/arch/x86/hvm/hvm.c -@@ -603,11 +603,12 @@ static int hvm_load_cpu_ctxt(struct doma - return -EINVAL; - } - -- if ( (ctxt.msr_efer & ~(EFER_FFXSE | EFER_LME | EFER_LMA | -+ if ( (ctxt.msr_efer & ~(EFER_FFXSE | EFER_LMSLE | EFER_LME | EFER_LMA | - EFER_NX | EFER_SCE)) || - ((sizeof(long) != 8) && (ctxt.msr_efer & EFER_LME)) || - (!cpu_has_nx && (ctxt.msr_efer & EFER_NX)) || - (!cpu_has_syscall && (ctxt.msr_efer & EFER_SCE)) || -+ (!cpu_has_lmsl && (ctxt.msr_efer & EFER_LMSLE)) || - (!cpu_has_ffxsr && (ctxt.msr_efer & EFER_FFXSE)) || - ((ctxt.msr_efer & (EFER_LME|EFER_LMA)) == EFER_LMA) ) - { -@@ -960,10 +961,11 @@ int hvm_set_efer(uint64_t value) - - 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 " -Index: xen-4.0.2-testing/xen/arch/x86/hvm/svm/svm.c -=================================================================== ---- xen-4.0.2-testing.orig/xen/arch/x86/hvm/svm/svm.c -+++ xen-4.0.2-testing/xen/arch/x86/hvm/svm/svm.c -@@ -57,6 +57,9 @@ - - u32 svm_feature_flags; - -+/* Indicates whether guests may use EFER.LMSLE. */ -+bool_t cpu_has_lmsl; -+ - #define set_segment_register(name, value) \ - asm volatile ( "movw %%ax ,%%" STR(name) "" : : "a" (value) ) - -@@ -864,6 +867,29 @@ static int svm_cpu_up(struct cpuinfo_x86 - /* 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 ) -+ { -+ if ( c == &boot_cpu_data ) -+ cpu_has_lmsl = 1; -+ wrmsr(MSR_EFER, eax ^ EFER_LMSLE, edx); -+ } -+ else -+ { -+ if ( cpu_has_lmsl ) -+ printk(XENLOG_WARNING "Inconsistent LMLSE support across CPUs!\n"); -+ cpu_has_lmsl = 0; -+ } -+#endif -+ - return 1; - } - -Index: xen-4.0.2-testing/xen/include/asm-x86/hvm/hvm.h -=================================================================== ---- xen-4.0.2-testing.orig/xen/include/asm-x86/hvm/hvm.h -+++ xen-4.0.2-testing/xen/include/asm-x86/hvm/hvm.h -@@ -143,6 +143,7 @@ struct hvm_function_table { - - extern struct hvm_function_table hvm_funcs; - extern int hvm_enabled; -+extern bool_t cpu_has_lmsl; - - int hvm_domain_initialise(struct domain *d); - void hvm_domain_relinquish_resources(struct domain *d); diff --git a/21304-keyhandler-alternative.patch b/21304-keyhandler-alternative.patch deleted file mode 100644 index 79131bb..0000000 --- a/21304-keyhandler-alternative.patch +++ /dev/null @@ -1,99 +0,0 @@ -# HG changeset patch -# User Keir Fraser -# Date 1273143595 -3600 -# Node ID ccae861f52f7f25aa2ab404a6110831402845dac -# Parent 924f54145fda26df64bf6f57010793893b29866f -Reduce '0' debug key's global impact - -On large systems, dumping state may cause time management to get -stalled for so long a period that it wouldn't recover. Therefore add -a tasklet-based alternative mechanism to handle Dom0 state dumps. - -Signed-off-by: Jan Beulich - -Index: xen-4.0.2-testing/xen/common/keyhandler.c -=================================================================== ---- xen-4.0.2-testing.orig/xen/common/keyhandler.c -+++ xen-4.0.2-testing/xen/common/keyhandler.c -@@ -19,6 +19,7 @@ - - static struct keyhandler *key_table[256]; - static unsigned char keypress_key; -+static bool_t alt_key_handling; - - char keyhandler_scratch[1024]; - -@@ -115,6 +116,26 @@ static struct keyhandler dump_registers_ - .desc = "dump registers" - }; - -+static DECLARE_TASKLET(dump_dom0_tasklet, NULL, 0); -+ -+static void dump_dom0_action(unsigned long arg) -+{ -+ struct vcpu *v = (void *)arg; -+ -+ for ( ; ; ) -+ { -+ vcpu_show_execution_state(v); -+ if ( (v = v->next_in_list) == NULL ) -+ break; -+ if ( softirq_pending(smp_processor_id()) ) -+ { -+ dump_dom0_tasklet.data = (unsigned long)v; -+ tasklet_schedule_on_cpu(&dump_dom0_tasklet, v->processor); -+ break; -+ } -+ } -+} -+ - static void dump_dom0_registers(unsigned char key) - { - struct vcpu *v; -@@ -125,7 +146,17 @@ static void dump_dom0_registers(unsigned - printk("'%c' pressed -> dumping Dom0's registers\n", key); - - for_each_vcpu ( dom0, v ) -+ { -+ if ( alt_key_handling && softirq_pending(smp_processor_id()) ) -+ { -+ tasklet_kill(&dump_dom0_tasklet); -+ tasklet_init(&dump_dom0_tasklet, dump_dom0_action, -+ (unsigned long)v); -+ tasklet_schedule_on_cpu(&dump_dom0_tasklet, v->processor); -+ return; -+ } - vcpu_show_execution_state(v); -+ } - } - - static struct keyhandler dump_dom0_registers_keyhandler = { -@@ -439,8 +470,28 @@ static struct keyhandler do_debug_key_ke - .desc = "trap to xendbg" - }; - -+static void do_toggle_alt_key(unsigned char key, struct cpu_user_regs *regs) -+{ -+ alt_key_handling = !alt_key_handling; -+ printk("'%c' pressed -> using %s key handling\n", key, -+ alt_key_handling ? "alternative" : "normal"); -+} -+ -+static struct keyhandler toggle_alt_keyhandler = { -+ .irq_callback = 1, -+ .u.irq_fn = do_toggle_alt_key, -+ .desc = "toggle alternative key handling" -+}; -+ - void __init initialize_keytable(void) - { -+ if ( num_present_cpus() > 16 ) -+ { -+ alt_key_handling = 1; -+ printk(XENLOG_INFO "Defaulting to alternative key handling; " -+ "send 'A' to switch to normal mode.\n"); -+ } -+ register_keyhandler('A', &toggle_alt_keyhandler); - register_keyhandler('d', &dump_registers_keyhandler); - register_keyhandler('h', &show_handlers_keyhandler); - register_keyhandler('q', &dump_domains_keyhandler); diff --git a/21406-x86-microcode-quiet.patch b/21406-x86-microcode-quiet.patch deleted file mode 100644 index 8032015..0000000 --- a/21406-x86-microcode-quiet.patch +++ /dev/null @@ -1,27 +0,0 @@ -# HG changeset patch -# User Keir Fraser -# Date 1274118689 -3600 -# Node ID 2a16128f17d884b87124eb159d4c4a0c34339d4e -# Parent 89a2f9ad02f23c24a06274a1217991181f19930b -x86: Quieten microcode.c during CPU hotplug - -Signed-off-by: Keir Fraser - -Index: xen-4.0.2-testing/xen/arch/x86/microcode.c -=================================================================== ---- xen-4.0.2-testing.orig/xen/arch/x86/microcode.c -+++ xen-4.0.2-testing/xen/arch/x86/microcode.c -@@ -66,12 +66,10 @@ static void microcode_fini_cpu(int cpu) - - int microcode_resume_cpu(int cpu) - { -- int err = 0; -+ int err; - struct ucode_cpu_info *uci = &per_cpu(ucode_cpu_info, cpu); - struct cpu_signature nsig; - -- gdprintk(XENLOG_INFO, "microcode: CPU%d resumed\n", cpu); -- - if ( !uci->mc.mc_valid ) - return -EIO; - diff --git a/21421-vtd-ats-enabling.patch b/21421-vtd-ats-enabling.patch deleted file mode 100644 index 08deb16..0000000 --- a/21421-vtd-ats-enabling.patch +++ /dev/null @@ -1,144 +0,0 @@ -References: bnc#573413 - -# HG changeset patch -# User Keir Fraser -# Date 1274253726 -3600 -# Node ID f67ae6f9d4107f091d062fc1501a96f873671d10 -# Parent eb4ecc037b7a53647f0ac89c7067d11ea622ab00 -VT-d: Fix ATS enabling for device assignment - -Currently, Xen only enables ATS in Xen booting. When an ATS capable -device is assigned to guest, ATS is actually not enabled because FLR -before assignment causes it to be disabled. Thus ATS cannot be used in -guest. This patch enables ATS in domain_context_mapping. This ensures -ATS is enabled in assignment because FLR is earlier than -domain_context_mapping call. Therefore ATS can be used in guest. This -patch also implements disable_ats_device to disable ATS when the -device is deassigned from a domain. - -Signed-off-by: Weidong Han - -Index: xen-4.0.2-testing/xen/drivers/passthrough/vtd/ia64/ats.c -=================================================================== ---- xen-4.0.2-testing.orig/xen/drivers/passthrough/vtd/ia64/ats.c -+++ xen-4.0.2-testing/xen/drivers/passthrough/vtd/ia64/ats.c -@@ -47,6 +47,11 @@ int enable_ats_device(int seg, int bus, - return 0; - } - -+int disable_ats_device(int seg, int bus, int devfn) -+{ -+ return 0; -+} -+ - int dev_invalidate_iotlb(struct iommu *iommu, u16 did, - u64 addr, unsigned int size_order, u64 type) - { -Index: xen-4.0.2-testing/xen/drivers/passthrough/vtd/iommu.c -=================================================================== ---- xen-4.0.2-testing.orig/xen/drivers/passthrough/vtd/iommu.c -+++ xen-4.0.2-testing/xen/drivers/passthrough/vtd/iommu.c -@@ -1354,6 +1354,9 @@ static int domain_context_mapping(struct - dprintk(VTDPREFIX, "d%d:PCIe: map bdf = %x:%x.%x\n", - domain->domain_id, bus, PCI_SLOT(devfn), PCI_FUNC(devfn)); - ret = domain_context_mapping_one(domain, drhd->iommu, bus, devfn); -+ if ( !ret && ats_device(0, bus, devfn) ) -+ enable_ats_device(0, bus, devfn); -+ - break; - - case DEV_TYPE_PCI: -@@ -1476,6 +1479,9 @@ static int domain_context_unmap(struct d - dprintk(VTDPREFIX, "d%d:PCIe: unmap bdf = %x:%x.%x\n", - domain->domain_id, bus, PCI_SLOT(devfn), PCI_FUNC(devfn)); - ret = domain_context_unmap_one(domain, iommu, bus, devfn); -+ if ( !ret && ats_device(0, bus, devfn) ) -+ disable_ats_device(0, bus, devfn); -+ - break; - - case DEV_TYPE_PCI: -@@ -1805,8 +1811,6 @@ static void setup_dom0_devices(struct do - list_add(&pdev->domain_list, &d->arch.pdev_list); - domain_context_mapping(d, pdev->bus, pdev->devfn); - pci_enable_acs(pdev); -- if ( ats_device(0, pdev->bus, pdev->devfn) ) -- enable_ats_device(0, pdev->bus, pdev->devfn); - } - } - spin_unlock(&pcidevs_lock); -Index: xen-4.0.2-testing/xen/drivers/passthrough/vtd/x86/ats.c -=================================================================== ---- xen-4.0.2-testing.orig/xen/drivers/passthrough/vtd/x86/ats.c -+++ xen-4.0.2-testing/xen/drivers/passthrough/vtd/x86/ats.c -@@ -92,6 +92,9 @@ int ats_device(int seg, int bus, int dev - - pdev = pci_get_pdev(bus, devfn); - drhd = acpi_find_matched_drhd_unit(pdev); -+ if ( !drhd ) -+ return 0; -+ - if ( !ecap_queued_inval(drhd->iommu->ecap) || - !ecap_dev_iotlb(drhd->iommu->ecap) ) - return 0; -@@ -144,6 +147,9 @@ int enable_ats_device(int seg, int bus, - - value = pci_conf_read16(bus, PCI_SLOT(devfn), - PCI_FUNC(devfn), pos + ATS_REG_CTL); -+ if ( value & ATS_ENABLE ) -+ return 0; -+ - value |= ATS_ENABLE; - pci_conf_write16(bus, PCI_SLOT(devfn), PCI_FUNC(devfn), - pos + ATS_REG_CTL, value); -@@ -153,10 +159,50 @@ int enable_ats_device(int seg, int bus, - pdev->devfn = devfn; - pdev->ats_queue_depth = queue_depth; - list_add(&(pdev->list), &ats_devices); -+ if ( iommu_verbose ) -+ dprintk(XENLOG_INFO VTDPREFIX, "%x:%x.%x: ATS is enabled\n", -+ bus, PCI_SLOT(devfn), PCI_FUNC(devfn)); - - return pos; - } - -+int disable_ats_device(int seg, int bus, int devfn) -+{ -+ struct list_head *pdev_list, *tmp; -+ struct pci_ats_dev *pdev; -+ u32 value; -+ int pos; -+ -+ pos = pci_find_ext_capability(seg, bus, devfn, PCI_EXT_CAP_ID_ATS); -+ if ( !pos ) -+ return 0; -+ -+ /* BUGBUG: add back seg when multi-seg platform support is enabled */ -+ value = pci_conf_read16(bus, PCI_SLOT(devfn), -+ PCI_FUNC(devfn), pos + ATS_REG_CTL); -+ value &= ~ATS_ENABLE; -+ pci_conf_write16(bus, PCI_SLOT(devfn), PCI_FUNC(devfn), -+ pos + ATS_REG_CTL, value); -+ -+ list_for_each_safe( pdev_list, tmp, &ats_devices ) -+ { -+ pdev = list_entry(pdev_list, struct pci_ats_dev, list); -+ if ( pdev->bus == bus && pdev->devfn == devfn ) -+ { -+ list_del(&pdev->list); -+ xfree(pdev); -+ break; -+ } -+ } -+ -+ if ( iommu_verbose ) -+ dprintk(XENLOG_INFO VTDPREFIX, "%x:%x.%x: ATS is disabled\n", -+ bus, PCI_SLOT(devfn), PCI_FUNC(devfn)); -+ -+ return 0; -+} -+ -+ - static int device_in_domain(struct iommu *iommu, struct pci_ats_dev *pdev, u16 did) - { - struct root_entry *root_entry = NULL; diff --git a/21526-x86-nehalem-cpuid-mask.patch b/21526-x86-nehalem-cpuid-mask.patch deleted file mode 100644 index bcc6eee..0000000 --- a/21526-x86-nehalem-cpuid-mask.patch +++ /dev/null @@ -1,230 +0,0 @@ -# HG changeset patch -# User Keir Fraser -# Date 1275643111 -3600 -# Node ID 48e2b07cf01c044bf483bd7fa5408a6f9801416b -# Parent f2b1924f20281bc42fa3532c7d82b3ee0700aff4 -Intel: Add CPUID feature mask support for NHM processors. - -Signed-off-by: Jun Nakajima -Signed-off-by: Liping Ke - -# HG changeset patch -# User Keir Fraser -# Date 1276604335 -3600 -# Node ID 2501732e291b001711a0dc1c474bb89ce77f3110 -# Parent a2cc1db1af9c8f9b148c80f8b2c3f64bde7542f9 -x86: fix pv cpuid masking - -Invert initial values of the variables parsed into from the command -line, so that completely clearing out one or more of the four bit -fields is possible. - -Further, consolidate the command line parameter specifications into -a single place. - -Finally, as per "Intel Virtualization Technology FlexMigration -Application Note" (http://www.intel.com/Assets/PDF/manual/323850.pdf), -also handle family 6 model 0x1f. - -What remains open is the question whether pv_cpuid() shouldn't also -consume these masks. - -Signed-off-by: Jan Beulich - -Index: xen-4.0.2-testing/xen/arch/x86/cpu/amd.c -=================================================================== ---- xen-4.0.2-testing.orig/xen/arch/x86/cpu/amd.c -+++ xen-4.0.2-testing/xen/arch/x86/cpu/amd.c -@@ -33,14 +33,6 @@ void start_svm(struct cpuinfo_x86 *c); - static char opt_famrev[14]; - string_param("cpuid_mask_cpu", opt_famrev); - --/* Finer-grained CPUID feature control. */ --static unsigned int opt_cpuid_mask_ecx, opt_cpuid_mask_edx; --integer_param("cpuid_mask_ecx", opt_cpuid_mask_ecx); --integer_param("cpuid_mask_edx", opt_cpuid_mask_edx); --static unsigned int opt_cpuid_mask_ext_ecx, opt_cpuid_mask_ext_edx; --integer_param("cpuid_mask_ext_ecx", opt_cpuid_mask_ext_ecx); --integer_param("cpuid_mask_ext_edx", opt_cpuid_mask_ext_edx); -- - static inline void wrmsr_amd(unsigned int index, unsigned int lo, - unsigned int hi) - { -@@ -102,7 +94,7 @@ static inline int wrmsr_amd_safe(unsigne - * - * The processor revision string parameter has precedene. - */ --static void __devinit set_cpuidmask(struct cpuinfo_x86 *c) -+static void __devinit set_cpuidmask(const struct cpuinfo_x86 *c) - { - static unsigned int feat_ecx, feat_edx; - static unsigned int extfeat_ecx, extfeat_edx; -@@ -117,12 +109,12 @@ static void __devinit set_cpuidmask(stru - ASSERT((status == not_parsed) && (smp_processor_id() == 0)); - status = no_mask; - -- if (opt_cpuid_mask_ecx | opt_cpuid_mask_edx | -- opt_cpuid_mask_ext_ecx | opt_cpuid_mask_ext_edx) { -- feat_ecx = opt_cpuid_mask_ecx ? : ~0U; -- feat_edx = opt_cpuid_mask_edx ? : ~0U; -- extfeat_ecx = opt_cpuid_mask_ext_ecx ? : ~0U; -- extfeat_edx = opt_cpuid_mask_ext_edx ? : ~0U; -+ if (~(opt_cpuid_mask_ecx & opt_cpuid_mask_edx & -+ opt_cpuid_mask_ext_ecx & opt_cpuid_mask_ext_edx)) { -+ feat_ecx = opt_cpuid_mask_ecx; -+ feat_edx = opt_cpuid_mask_edx; -+ extfeat_ecx = opt_cpuid_mask_ext_ecx; -+ extfeat_edx = opt_cpuid_mask_ext_edx; - } else if (*opt_famrev == '\0') { - return; - } else if (!strcmp(opt_famrev, "fam_0f_rev_c")) { -Index: xen-4.0.2-testing/xen/arch/x86/cpu/common.c -=================================================================== ---- xen-4.0.2-testing.orig/xen/arch/x86/cpu/common.c -+++ xen-4.0.2-testing/xen/arch/x86/cpu/common.c -@@ -22,6 +22,15 @@ static int cachesize_override __cpuinitd - static int disable_x86_fxsr __cpuinitdata; - static int disable_x86_serial_nr __cpuinitdata; - -+unsigned int __devinitdata opt_cpuid_mask_ecx = ~0u; -+integer_param("cpuid_mask_ecx", opt_cpuid_mask_ecx); -+unsigned int __devinitdata opt_cpuid_mask_edx = ~0u; -+integer_param("cpuid_mask_edx", opt_cpuid_mask_edx); -+unsigned int __devinitdata opt_cpuid_mask_ext_ecx = ~0u; -+integer_param("cpuid_mask_ext_ecx", opt_cpuid_mask_ext_ecx); -+unsigned int __devinitdata opt_cpuid_mask_ext_edx = ~0u; -+integer_param("cpuid_mask_ext_edx", opt_cpuid_mask_ext_edx); -+ - struct cpu_dev * cpu_devs[X86_VENDOR_NUM] = {}; - - /* -Index: xen-4.0.2-testing/xen/arch/x86/cpu/cpu.h -=================================================================== ---- xen-4.0.2-testing.orig/xen/arch/x86/cpu/cpu.h -+++ xen-4.0.2-testing/xen/arch/x86/cpu/cpu.h -@@ -21,6 +21,9 @@ struct cpu_dev { - - extern struct cpu_dev * cpu_devs [X86_VENDOR_NUM]; - -+extern unsigned int opt_cpuid_mask_ecx, opt_cpuid_mask_edx; -+extern unsigned int opt_cpuid_mask_ext_ecx, opt_cpuid_mask_ext_edx; -+ - extern int get_model_name(struct cpuinfo_x86 *c); - extern void display_cacheinfo(struct cpuinfo_x86 *c); - -Index: xen-4.0.2-testing/xen/arch/x86/cpu/intel.c -=================================================================== ---- xen-4.0.2-testing.orig/xen/arch/x86/cpu/intel.c -+++ xen-4.0.2-testing/xen/arch/x86/cpu/intel.c -@@ -20,16 +20,6 @@ - - extern int trap_init_f00f_bug(void); - --/* -- * opt_cpuid_mask_ecx/edx: cpuid.1[ecx, edx] feature mask. -- * For example, E8400[Intel Core 2 Duo Processor series] ecx = 0x0008E3FD, -- * edx = 0xBFEBFBFF when executing CPUID.EAX = 1 normally. If you want to -- * 'rev down' to E8400, you can set these values in these Xen boot parameters. -- */ --static unsigned int opt_cpuid_mask_ecx, opt_cpuid_mask_edx; --integer_param("cpuid_mask_ecx", opt_cpuid_mask_ecx); --integer_param("cpuid_mask_edx", opt_cpuid_mask_edx); -- - static int use_xsave; - boolean_param("xsave", use_xsave); - -@@ -40,24 +30,57 @@ boolean_param("xsave", use_xsave); - struct movsl_mask movsl_mask __read_mostly; - #endif - --static void __devinit set_cpuidmask(void) -+/* -+ * opt_cpuid_mask_ecx/edx: cpuid.1[ecx, edx] feature mask. -+ * For example, E8400[Intel Core 2 Duo Processor series] ecx = 0x0008E3FD, -+ * edx = 0xBFEBFBFF when executing CPUID.EAX = 1 normally. If you want to -+ * 'rev down' to E8400, you can set these values in these Xen boot parameters. -+ */ -+static void __devinit set_cpuidmask(const struct cpuinfo_x86 *c) - { -- unsigned int eax, ebx, ecx, edx, model; -+ const char *extra = ""; - -- if (!(opt_cpuid_mask_ecx | opt_cpuid_mask_edx)) -+ if (!~(opt_cpuid_mask_ecx & opt_cpuid_mask_edx & -+ opt_cpuid_mask_ext_ecx & opt_cpuid_mask_ext_edx)) - return; - -- cpuid(0x00000001, &eax, &ebx, &ecx, &edx); -- model = ((eax & 0xf0000) >> 12) | ((eax & 0xf0) >> 4); -- if (!((model == 0x1d) || ((model == 0x17) && ((eax & 0xf) >= 4)))) { -- printk(XENLOG_ERR "Cannot set CPU feature mask on CPU#%d\n", -- smp_processor_id()); -+ /* Only family 6 supports this feature */ -+ switch ((c->x86 == 6) * c->x86_model) { -+ case 0x17: -+ if ((c->x86_mask & 0x0f) < 4) -+ break; -+ /* fall through */ -+ case 0x1d: -+ wrmsr(MSR_INTEL_CPUID_FEATURE_MASK, -+ opt_cpuid_mask_ecx, -+ opt_cpuid_mask_edx); -+ if (!~(opt_cpuid_mask_ext_ecx & opt_cpuid_mask_ext_edx)) -+ return; -+ extra = "extended "; -+ break; -+/* -+ * CPU supports this feature if the processor signature meets the following: -+ * (CPUID.(EAX=01h):EAX) > 000106A2h, or -+ * (CPUID.(EAX=01h):EAX) == 000106Exh, 0002065xh, 000206Cxh, 000206Exh, or 000206Fxh -+ * -+ */ -+ case 0x1a: -+ if ((c->x86_mask & 0x0f) <= 2) -+ break; -+ /* fall through */ -+ case 0x1e: case 0x1f: -+ case 0x25: case 0x2c: case 0x2e: case 0x2f: -+ wrmsr(MSR_INTEL_CPUID1_FEATURE_MASK, -+ opt_cpuid_mask_ecx, -+ opt_cpuid_mask_edx); -+ wrmsr(MSR_INTEL_CPUID80000001_FEATURE_MASK, -+ opt_cpuid_mask_ext_ecx, -+ opt_cpuid_mask_ext_edx); - return; - } - -- wrmsr(MSR_IA32_CPUID_FEATURE_MASK1, -- opt_cpuid_mask_ecx ? : ~0u, -- opt_cpuid_mask_edx ? : ~0u); -+ printk(XENLOG_ERR "Cannot set CPU feature mask on CPU#%d\n", -+ smp_processor_id()); - } - - void __devinit early_intel_workaround(struct cpuinfo_x86 *c) -@@ -179,7 +202,7 @@ static void __devinit init_intel(struct - - detect_ht(c); - -- set_cpuidmask(); -+ set_cpuidmask(c); - - /* Work around errata */ - Intel_errata_workarounds(c); -Index: xen-4.0.2-testing/xen/include/asm-x86/msr-index.h -=================================================================== ---- xen-4.0.2-testing.orig/xen/include/asm-x86/msr-index.h -+++ xen-4.0.2-testing/xen/include/asm-x86/msr-index.h -@@ -156,8 +156,10 @@ - #define MSR_P6_EVNTSEL0 0x00000186 - #define MSR_P6_EVNTSEL1 0x00000187 - --/* MSR for cpuid feature mask */ --#define MSR_IA32_CPUID_FEATURE_MASK1 0x00000478 -+/* MSRs for Intel cpuid feature mask */ -+#define MSR_INTEL_CPUID_FEATURE_MASK 0x00000478 -+#define MSR_INTEL_CPUID1_FEATURE_MASK 0x00000130 -+#define MSR_INTEL_CPUID80000001_FEATURE_MASK 0x00000131 - - /* MSRs & bits used for VMX enabling */ - #define MSR_IA32_VMX_BASIC 0x480 diff --git a/21542-amd-erratum-411.patch b/21542-amd-erratum-411.patch deleted file mode 100644 index bce9608..0000000 --- a/21542-amd-erratum-411.patch +++ /dev/null @@ -1,51 +0,0 @@ -# HG changeset patch -# User Keir Fraser -# Date 1275892689 -3600 -# Node ID 0251bbc0a9a879126bce65e47e4410575cfa73de -# Parent 7ff0e885b5c30cc8573b52144b274509e04759fd -AMD: Workaround for erratum 411 - -Clear APIC TMICT when we mask APIC LVTT. - -Signed-off-by: Wei Wang - -Index: xen-4.0.2-testing/xen/arch/x86/apic.c -=================================================================== ---- xen-4.0.2-testing.orig/xen/arch/x86/apic.c -+++ xen-4.0.2-testing/xen/arch/x86/apic.c -@@ -198,6 +198,9 @@ void clear_local_APIC(void) - - maxlvt = get_maxlvt(); - -+ /* Work around AMD Erratum 411. This is a nice thing to do anyway. */ -+ apic_write_around(APIC_TMICT, 0); -+ - /* - * Masking an LVT entry on a P6 can trigger a local APIC error - * if the vector is zero. Mask LVTERR first to prevent this. -@@ -1327,7 +1330,10 @@ void disable_APIC_timer(void) - { - if (using_apic_timer) { - unsigned long v; -- -+ -+ /* Work around AMD Erratum 411. This is a nice thing to do anyway. */ -+ apic_write_around(APIC_TMICT, 0); -+ - v = apic_read(APIC_LVTT); - apic_write_around(APIC_LVTT, v | APIC_LVT_MASKED); - } -Index: xen-4.0.2-testing/xen/arch/x86/hpet.c -=================================================================== ---- xen-4.0.2-testing.orig/xen/arch/x86/hpet.c -+++ xen-4.0.2-testing/xen/arch/x86/hpet.c -@@ -659,8 +659,7 @@ void hpet_broadcast_enter(void) - if ( hpet_attach_channel ) - hpet_attach_channel(cpu, ch); - -- /* Cancel any outstanding LAPIC timer event and disable interrupts. */ -- reprogram_timer(0); -+ /* Disable LAPIC timer interrupts. */ - disable_APIC_timer(); - - cpu_set(cpu, ch->cpumask); diff --git a/21615-dont-save-xen-heap-pages.patch b/21615-dont-save-xen-heap-pages.patch deleted file mode 100644 index c1160af..0000000 --- a/21615-dont-save-xen-heap-pages.patch +++ /dev/null @@ -1,163 +0,0 @@ -# HG changeset patch -# User Keir Fraser -# Date 1276604289 -3600 -# Node ID a2cc1db1af9c8f9b148c80f8b2c3f64bde7542f9 -# Parent 094b826a2b8e2c17fe7004923352d459e0c23f13 -Don't save Xen heap pages during domain save -References: bnc#609153 - -As discussed in the thread starting at -http://lists.xensource.com/archives/html/xen-devel/2010-05/msg01383.html, -don't save Xen heap pages in order to avoid overallocation when the -domain gets restored, as those pages would get (temporarily) backed -with normal RAM pages by the restore code. - -This requires making DOMCTL_getpageframeinfo{2,3} usable for HVM -guests, meaning that the input to these must be treated as GMFNs. - -Signed-off-by: Jan Beulich - -Index: xen-4.0.2-testing/tools/libxc/xc_domain_save.c -=================================================================== ---- xen-4.0.2-testing.orig/tools/libxc/xc_domain_save.c -+++ xen-4.0.2-testing/tools/libxc/xc_domain_save.c -@@ -1282,58 +1282,64 @@ int xc_domain_save(int xc_handle, int io - goto out; - } - -- if ( hvm ) -+ /* Get page types */ -+ if ( xc_get_pfn_type_batch(xc_handle, dom, batch, pfn_type) ) - { -- /* Look for and skip completely empty batches. */ -- for ( j = 0; j < batch; j++ ) -- { -- if ( !pfn_err[j] ) -- break; -- pfn_type[j] |= XEN_DOMCTL_PFINFO_XTAB; -- } -- if ( j == batch ) -- { -- munmap(region_base, batch*PAGE_SIZE); -- continue; /* bail on this batch: no valid pages */ -- } -- for ( ; j < batch; j++ ) -- if ( pfn_err[j] ) -- pfn_type[j] |= XEN_DOMCTL_PFINFO_XTAB; -+ ERROR("get_pfn_type_batch failed"); -+ goto out; - } -- else -+ -+ for ( run = j = 0; j < batch; j++ ) - { -- /* Get page types */ -- if ( xc_get_pfn_type_batch(xc_handle, dom, batch, pfn_type) ) -- { -- ERROR("get_pfn_type_batch failed"); -- goto out; -- } -+ unsigned long gmfn = pfn_batch[j]; -+ -+ if ( !hvm ) -+ gmfn = pfn_to_mfn(gmfn); - -- for ( j = 0; j < batch; j++ ) -+ if ( pfn_err[j] ) - { -- unsigned long mfn = pfn_to_mfn(pfn_batch[j]); -- - if ( pfn_type[j] == XEN_DOMCTL_PFINFO_XTAB ) -- { -- DPRINTF("type fail: page %i mfn %08lx\n", -- j, mfn); - continue; -- } -- -- if ( debug ) -+ DPRINTF("map fail: page %i mfn %08lx err %d\n", -+ j, gmfn, pfn_err[j]); -+ pfn_type[j] = XEN_DOMCTL_PFINFO_XTAB; -+ continue; -+ } -+ -+ if ( pfn_type[j] == XEN_DOMCTL_PFINFO_XTAB ) -+ { -+ DPRINTF("type fail: page %i mfn %08lx\n", j, gmfn); -+ continue; -+ } -+ -+ /* canonicalise mfn->pfn */ -+ pfn_type[j] |= pfn_batch[j]; -+ ++run; -+ -+ if ( debug ) -+ { -+ if ( hvm ) -+ DPRINTF("%d pfn=%08lx sum=%08lx\n", -+ iter, -+ pfn_type[j], -+ csum_page(region_base + (PAGE_SIZE*j))); -+ else - DPRINTF("%d pfn= %08lx mfn= %08lx [mfn]= %08lx" - " sum= %08lx\n", - iter, -- pfn_type[j] | pfn_batch[j], -- mfn, -- mfn_to_pfn(mfn), -+ pfn_type[j], -+ gmfn, -+ mfn_to_pfn(gmfn), - csum_page(region_base + (PAGE_SIZE*j))); -- -- /* canonicalise mfn->pfn */ -- pfn_type[j] |= pfn_batch[j]; - } - } - -+ if ( !run ) -+ { -+ munmap(region_base, batch*PAGE_SIZE); -+ continue; /* bail on this batch: no valid pages */ -+ } -+ - if ( write_exact(io_fd, &batch, sizeof(unsigned int)) ) - { - PERROR("Error when writing to state file (2)"); -Index: xen-4.0.2-testing/xen/arch/x86/domctl.c -=================================================================== ---- xen-4.0.2-testing.orig/xen/arch/x86/domctl.c -+++ xen-4.0.2-testing/xen/arch/x86/domctl.c -@@ -206,11 +206,12 @@ long arch_do_domctl( - - for ( j = 0; j < k; j++ ) - { -- unsigned long type = 0, mfn = arr[j]; -+ unsigned long type = 0, mfn = gmfn_to_mfn(d, arr[j]); - - page = mfn_to_page(mfn); - -- if ( unlikely(!mfn_valid(mfn)) ) -+ if ( unlikely(!mfn_valid(mfn)) || -+ unlikely(is_xen_heap_mfn(mfn)) ) - type = XEN_DOMCTL_PFINFO_XTAB; - else if ( xsm_getpageframeinfo(page) != 0 ) - ; -@@ -305,14 +306,15 @@ long arch_do_domctl( - for ( j = 0; j < k; j++ ) - { - struct page_info *page; -- unsigned long mfn = arr32[j]; -+ unsigned long mfn = gmfn_to_mfn(d, arr32[j]); - - page = mfn_to_page(mfn); - - if ( domctl->cmd == XEN_DOMCTL_getpageframeinfo3) - arr32[j] = 0; - -- if ( unlikely(!mfn_valid(mfn)) ) -+ if ( unlikely(!mfn_valid(mfn)) || -+ unlikely(is_xen_heap_mfn(mfn)) ) - arr32[j] |= XEN_DOMCTL_PFINFO_XTAB; - else if ( xsm_getpageframeinfo(page) != 0 ) - continue; diff --git a/21627-cpuidle-wrap.patch b/21627-cpuidle-wrap.patch deleted file mode 100644 index 1c97112..0000000 --- a/21627-cpuidle-wrap.patch +++ /dev/null @@ -1,25 +0,0 @@ -# HG changeset patch -# User Keir Fraser -# Date 1276761018 -3600 -# Node ID 7a00c0bd4fc131fb4de5df9f3fdc4e48a29dd5f9 -# Parent dab8676e97ce7a95c0777e58eee4b1b03bfc5322 -cpuidle: fix wrapped ticks calculation for pm timer. - -Signed-off-by: Wei Gang - -Index: xen-4.0.2-testing/xen/arch/x86/acpi/cpu_idle.c -=================================================================== ---- xen-4.0.2-testing.orig/xen/arch/x86/acpi/cpu_idle.c -+++ xen-4.0.2-testing/xen/arch/x86/acpi/cpu_idle.c -@@ -127,9 +127,9 @@ static inline u32 ticks_elapsed(u32 t1, - if ( t2 >= t1 ) - return (t2 - t1); - else if ( !(acpi_gbl_FADT.flags & ACPI_FADT_32BIT_TIMER) ) -- return (((0x00FFFFFF - t1) + t2) & 0x00FFFFFF); -+ return (((0x00FFFFFF - t1) + t2 + 1) & 0x00FFFFFF); - else -- return ((0xFFFFFFFF - t1) + t2); -+ return ((0xFFFFFFFF - t1) + t2 +1); - } - - static void acpi_safe_halt(void) diff --git a/21653-xend-mac-addr.patch b/21653-xend-mac-addr.patch deleted file mode 100644 index d70f1a8..0000000 --- a/21653-xend-mac-addr.patch +++ /dev/null @@ -1,46 +0,0 @@ -# HG changeset patch -# User Ian Jackson -# Date 1277219220 -3600 -# Node ID 9da3abe88c90bd8ec48963a9ec537a8871e266db -# Parent 2ad890d46cb8a11fc6ea329126d398021307e627 -Check "mac" address sooner in device_create function, before doing device_add. - -In XendDomainInfo.py device_create function, when device type is -"vif", it has a paragraph to check the validity of "mac" -address. Before checking validity, device_add has been done. But after -checking validity, if the mac address is invlid, it raises VmError and -exits directly without doing clean work like removing the device item -from config info. This will cause that the incorrect mac address is -saved into VM Config file and VM fails to restart. If check "mac" -validity before doing device_add, there will be no problem. - -Signed-off-by Chunyan Liu - -Index: xen-4.0.2-testing/tools/python/xen/xend/XendDomainInfo.py -=================================================================== ---- xen-4.0.2-testing.orig/tools/python/xen/xend/XendDomainInfo.py -+++ xen-4.0.2-testing/tools/python/xen/xend/XendDomainInfo.py -@@ -847,11 +847,6 @@ class XendDomainInfo: - @type dev_config: SXP object (parsed config) - """ - log.debug("XendDomainInfo.device_create: %s" % scrub_password(dev_config)) -- dev_type = sxp.name(dev_config) -- dev_uuid = self.info.device_add(dev_type, cfg_sxp = dev_config) -- dev_config_dict = self.info['devices'][dev_uuid][1] -- log.debug("XendDomainInfo.device_create: %s" % scrub_password(dev_config_dict)) -- - if dev_type == 'vif': - for x in dev_config: - if x != 'vif' and x[0] == 'mac': -@@ -859,6 +854,11 @@ class XendDomainInfo: - log.error("Virtual network interface creation error - invalid MAC Address entered: %s", x[1]) - raise VmError("Cannot create a new virtual network interface - MAC address is not valid!"); - -+ dev_type = sxp.name(dev_config) -+ dev_uuid = self.info.device_add(dev_type, cfg_sxp = dev_config) -+ dev_config_dict = self.info['devices'][dev_uuid][1] -+ log.debug("XendDomainInfo.device_create: %s" % scrub_password(dev_config_dict)) -+ - if self.domid is not None: - try: - dev_config_dict['devid'] = devid = \ diff --git a/21678-xend-mac-fix.patch b/21678-xend-mac-fix.patch deleted file mode 100644 index b4ed513..0000000 --- a/21678-xend-mac-fix.patch +++ /dev/null @@ -1,39 +0,0 @@ -# HG changeset patch -# User Ian Jackson -# Date 1277475191 -3600 -# Node ID e307aa11ed27ea91cf175461b3a715fe3f7253bc -# Parent e7b55cc5533aed48a47cf70e20aa9fb991bf2de4 -xend: Fix up check "mac" address sooner change - -In changeset 21653, - dev_type = sxp.name(dev_config) -should not have been moved, otherwise, the checking "mac" -paragraph is of no use. - -(The original patch as submitted was correct but I had to make the -change manually as it had been mangled.) - -Signed-off-by: Ian Jackson -Signed-off-by Chunyan Liu - -Index: xen-4.0.2-testing/tools/python/xen/xend/XendDomainInfo.py -=================================================================== ---- xen-4.0.2-testing.orig/tools/python/xen/xend/XendDomainInfo.py -+++ xen-4.0.2-testing/tools/python/xen/xend/XendDomainInfo.py -@@ -847,6 +847,8 @@ class XendDomainInfo: - @type dev_config: SXP object (parsed config) - """ - log.debug("XendDomainInfo.device_create: %s" % scrub_password(dev_config)) -+ dev_type = sxp.name(dev_config) -+ - if dev_type == 'vif': - for x in dev_config: - if x != 'vif' and x[0] == 'mac': -@@ -854,7 +856,6 @@ class XendDomainInfo: - log.error("Virtual network interface creation error - invalid MAC Address entered: %s", x[1]) - raise VmError("Cannot create a new virtual network interface - MAC address is not valid!"); - -- dev_type = sxp.name(dev_config) - dev_uuid = self.info.device_add(dev_type, cfg_sxp = dev_config) - dev_config_dict = self.info['devices'][dev_uuid][1] - log.debug("XendDomainInfo.device_create: %s" % scrub_password(dev_config_dict)) diff --git a/21683-vtd-kill-timer-conditional.patch b/21683-vtd-kill-timer-conditional.patch deleted file mode 100644 index e1ef004..0000000 --- a/21683-vtd-kill-timer-conditional.patch +++ /dev/null @@ -1,49 +0,0 @@ -# HG changeset patch -# User Keir Fraser -# Date 1277739919 -3600 -# Node ID 059a12afce52a213db56bd8e9442d9eeadfdd34c -# Parent 7e46fdbe8a1187cee2ab609256300d7967f37f06 -vtd: Only kill_timer() an init_timer()'ed timer. - -Signed-off-by: Keir Fraser - -Index: xen-4.0.2-testing/xen/drivers/passthrough/io.c -=================================================================== ---- xen-4.0.2-testing.orig/xen/drivers/passthrough/io.c -+++ xen-4.0.2-testing/xen/drivers/passthrough/io.c -@@ -27,7 +27,7 @@ - - static void hvm_dirq_assist(unsigned long _d); - --static int pt_irq_need_timer(uint32_t flags) -+bool_t pt_irq_need_timer(uint32_t flags) - { - return !(flags & (HVM_IRQ_DPCI_GUEST_MSI | HVM_IRQ_DPCI_TRANSLATE)); - } -Index: xen-4.0.2-testing/xen/drivers/passthrough/pci.c -=================================================================== ---- xen-4.0.2-testing.orig/xen/drivers/passthrough/pci.c -+++ xen-4.0.2-testing/xen/drivers/passthrough/pci.c -@@ -257,7 +257,9 @@ static void pci_clean_dpci_irqs(struct d - i = find_next_bit(hvm_irq_dpci->mapping, d->nr_pirqs, i + 1) ) - { - pirq_guest_unbind(d, i); -- kill_timer(&hvm_irq_dpci->hvm_timer[domain_pirq_to_irq(d, i)]); -+ -+ if ( pt_irq_need_timer(hvm_irq_dpci->mirq[i].flags) ) -+ kill_timer(&hvm_irq_dpci->hvm_timer[domain_pirq_to_irq(d, i)]); - - list_for_each_safe ( digl_list, tmp, - &hvm_irq_dpci->mirq[i].digl_list ) -Index: xen-4.0.2-testing/xen/include/xen/iommu.h -=================================================================== ---- xen-4.0.2-testing.orig/xen/include/xen/iommu.h -+++ xen-4.0.2-testing/xen/include/xen/iommu.h -@@ -106,6 +106,7 @@ void hvm_dpci_isairq_eoi(struct domain * - struct hvm_irq_dpci *domain_get_irq_dpci(struct domain *domain); - int domain_set_irq_dpci(struct domain *domain, struct hvm_irq_dpci *dpci); - void free_hvm_irq_dpci(struct hvm_irq_dpci *dpci); -+bool_t pt_irq_need_timer(uint32_t flags); - - #define PT_IRQ_TIME_OUT MILLISECS(8) - #define VTDPREFIX "[VT-D]" diff --git a/21723-get-domu-state.patch b/21723-get-domu-state.patch deleted file mode 100644 index 3bdd4d1..0000000 --- a/21723-get-domu-state.patch +++ /dev/null @@ -1,188 +0,0 @@ -# HG changeset patch -# User Ian Jackson -# Date 1277819571 -3600 -# Node ID a60c604b5829db6285ff89d8163478330ac12ee2 -# Parent 7b00193bd0334606b6f6779c3f14a1667a952fe4 -tools/xend, xm: add a command to get the state of VMs - -add a command "domstate" to get the state of Vms, which may have one state of -{'shutoff', 'idle','shutdown','running','crashed','paused' or 'paused by -admin"}. - -For case of pause, I distinguish it into two conditions. One is "paused" the -other is "paused by admin". -"pasued by admin" means that users pause a domain voluntary by "xm paused -VM" or " API" - -Signed-off-by James (Song Wei) - -Index: xen-4.0.2-testing/tools/python/xen/xend/XendDomain.py -=================================================================== ---- xen-4.0.2-testing.orig/tools/python/xen/xend/XendDomain.py -+++ xen-4.0.2-testing/tools/python/xen/xend/XendDomain.py -@@ -250,6 +250,18 @@ class XendDomain: - @return: path to config file. - """ - return os.path.join(self._managed_path(domuuid), CACHED_CONFIG_FILE) -+ def domain_setpauseflag(self, dom, flag=False): -+ try: -+ dominfo = self.domain_lookup_nr(dom) -+ dominfo.paused_by_admin = flag -+ except Exception, err: -+ log.debug("error in in setpauseflag") -+ def domain_getpauseflag(self, dom): -+ try: -+ dominfo = self.domain_lookup_nr(dom) -+ return dominfo.paused_by_admin -+ except Exception, err: -+ log.debug("error in in getpauseflag") - - def _managed_check_point_path(self, domuuid): - """Returns absolute path to check point file for managed domain. -Index: xen-4.0.2-testing/tools/python/xen/xend/XendDomainInfo.py -=================================================================== ---- xen-4.0.2-testing.orig/tools/python/xen/xend/XendDomainInfo.py -+++ xen-4.0.2-testing/tools/python/xen/xend/XendDomainInfo.py -@@ -327,6 +327,8 @@ class XendDomainInfo: - @type info: dictionary - @ivar domid: Domain ID (if VM has started) - @type domid: int or None -+ @ivar paused_by_admin: Is this Domain paused by command or API -+ @type paused_by_admin: bool - @ivar guest_bitsize: the bitsize of guest - @type guest_bitsize: int or None - @ivar alloc_mem: the memory domain allocated when booting -@@ -390,6 +392,7 @@ class XendDomainInfo: - self.domid = domid - self.guest_bitsize = None - self.alloc_mem = None -+ self.paused_by_admin = False - - maxmem = self.info.get('memory_static_max', 0) - memory = self.info.get('memory_dynamic_max', 0) -Index: xen-4.0.2-testing/tools/python/xen/xend/server/SrvDomain.py -=================================================================== ---- xen-4.0.2-testing.orig/tools/python/xen/xend/server/SrvDomain.py -+++ xen-4.0.2-testing/tools/python/xen/xend/server/SrvDomain.py -@@ -225,6 +225,20 @@ class SrvDomain(SrvDir): - self.acceptCommand(req) - return self.xd.domain_reset(self.dom.getName()) - -+ def op_do_get_pauseflag(self, op, req): -+ self.acceptCommand(req) -+ return req.threadRequest(self.do_get_pauseflag, op, req) -+ -+ def do_get_pauseflag(self, _, req): -+ return self.xd.domain_getpauseflag(self.dom.getName(), req) -+ -+ def op_do_set_pauseflag(self, op, req): -+ self.acceptCommand(req) -+ return req.threadRequest(self.do_set_pauseflag, op, req) -+ -+ def do_set_pauseflag(self, _, req): -+ return self.xd.domain_setpauseflag(self.dom.getName(), req) -+ - def op_usb_add(self, op, req): - self.acceptCommand(req) - return req.threadRequest(self.do_usb_add, op, req) -Index: xen-4.0.2-testing/tools/python/xen/xm/main.py -=================================================================== ---- xen-4.0.2-testing.orig/tools/python/xen/xm/main.py -+++ xen-4.0.2-testing/tools/python/xen/xm/main.py -@@ -165,6 +165,8 @@ SUBCOMMAND_HELP = { - #usb - 'usb-add' : (' <[host:bus.addr] [host:vendor_id:product_id]>','Add the usb device to FV VM.'), - 'usb-del' : (' <[host:bus.addr] [host:vendor_id:product_id]>','Delete the usb device to FV VM.'), -+ #domstate -+ 'domstate' : (' ', 'get the state of a domain'), - - # device commands - -@@ -370,6 +372,7 @@ common_commands = [ - "uptime", - "usb-add", - "usb-del", -+ "domstate", - "vcpu-set", - ] - -@@ -404,6 +407,7 @@ domain_commands = [ - "uptime", - "usb-add", - "usb-del", -+ "domstate", - "vcpu-list", - "vcpu-pin", - "vcpu-set", -@@ -901,7 +905,6 @@ def getDomains(domain_names, state, full - return "-" - state_str = "".join([state_on_off(state) - for state in states]) -- - dom_rec.update({'name': dom_rec['name_label'], - 'memory_actual': int(dom_metrics_rec['memory_actual'])/1024, - 'vcpus': dom_metrics_rec['VCPUs_number'], -@@ -1395,8 +1398,10 @@ def xm_pause(args): - - if serverType == SERVER_XEN_API: - server.xenapi.VM.pause(get_single_vm(dom)) -+ server.xenapi.VM.set_pauseflag(get_single_vm(dom), True) - else: - server.xend.domain.pause(dom) -+ server.xend.domain.setpauseflag(dom, True) - - def xm_unpause(args): - arg_check(args, "unpause", 1) -@@ -1404,8 +1409,10 @@ def xm_unpause(args): - - if serverType == SERVER_XEN_API: - server.xenapi.VM.unpause(get_single_vm(dom)) -+ server.xenapi.VM.set_pauseflag(get_single_vm(dom), False) - else: - server.xend.domain.unpause(dom) -+ server.xend.domain.setpauseflag(dom, False) - - def xm_dump_core(args): - live = False -@@ -1517,6 +1524,32 @@ def xm_usb_add(args): - arg_check(args, "usb-add", 2) - server.xend.domain.usb_add(args[0],args[1]) - -+def xm_domstate(args): -+ arg_check(args, "domstate", 1) -+ (opitons, params) = getopt.gnu_getopt(args, 's', ['domname=']) -+ doms = getDomains(params, 'all') -+ d = parse_doms_info(doms[0]) -+ state = d['state'] -+ if state: -+ if state.find('s') > 0: -+ print 'shutoff' -+ elif state.find('b') > 0: -+ print 'idle' -+ elif state.find('d') > 0: -+ print 'shutdown' -+ elif state.find('r') > 0: -+ print 'running' -+ elif state.find('c') > 0: -+ print 'crashed' -+ elif state.find('p') > 0: -+ if server.xend.domain.getpauseflag(args[0]): -+ print 'paused by admin' -+ else: -+ print 'paused' -+ else: -+ print 'shutoff' -+ return -+ - def xm_usb_del(args): - arg_check(args, "usb-del", 2) - server.xend.domain.usb_del(args[0],args[1]) -@@ -3542,6 +3575,8 @@ commands = { - #usb - "usb-add": xm_usb_add, - "usb-del": xm_usb_del, -+ #domstate -+ "domstate": xm_domstate, - } - - ## The commands supported by a separate argument parser in xend.xm. diff --git a/21810-x2apic-acpi.patch b/21810-x2apic-acpi.patch deleted file mode 100644 index 9d79d35..0000000 --- a/21810-x2apic-acpi.patch +++ /dev/null @@ -1,483 +0,0 @@ -# HG changeset patch -# User Keir Fraser -# Date 1279284738 -3600 -# Node ID fedab6367c9a0141d49853c77a23d6642ba70ff6 -# Parent 1f7c2418e58c7d1d5650ea211016b30114de48f2 -ACPI: add support for x2APIC ACPI extensions -References: bnc#656369, bnc#658704 - -All logical processors with APIC ID values of 255 and greater will -have their APIC reported through Processor X2APIC structure (type-9 -entry type) and all logical processors with APIC ID less than 255 will -have their APIC reported through legacy Processor Local APIC (type-0 -entry type) only. This is the same case even for NMI structure -reporting. - -The Processor X2APIC Affinity structure provides the association -between the X2APIC ID of a logical processor and the proximity domain -to which the logical processor belongs. - -This patch adds 2 new subtables to MADT and one new subtable to SRAT. - -This patch also changes x86_acpiid_to_apicid from u8 to u32 for x2APIC -ID, and changes mp_register_lapic to accept 32-bit id. But there are -still some 8-bit apic id hardcode and assumptions in Xen code, it -needs to be fixed in future. - -Signed-off-by: Weidong Han - -Index: xen-4.0.2-testing/xen/arch/x86/acpi/boot.c -=================================================================== ---- xen-4.0.2-testing.orig/xen/arch/x86/acpi/boot.c -+++ xen-4.0.2-testing/xen/arch/x86/acpi/boot.c -@@ -81,7 +81,7 @@ u8 acpi_enable_value, acpi_disable_value - #warning ACPI uses CMPXCHG, i486 and later hardware - #endif - --u8 x86_acpiid_to_apicid[MAX_MADT_ENTRIES] = -+u32 x86_acpiid_to_apicid[MAX_MADT_ENTRIES] = - {[0 ... MAX_MADT_ENTRIES - 1] = 0xff }; - EXPORT_SYMBOL(x86_acpiid_to_apicid); - -@@ -156,6 +156,35 @@ static int __init acpi_parse_madt(struct - } - - static int __init -+acpi_parse_x2apic(struct acpi_subtable_header *header, const unsigned long end) -+{ -+ struct acpi_table_x2apic *processor = NULL; -+ -+ processor = (struct acpi_table_x2apic *)header; -+ -+ if (BAD_MADT_ENTRY(processor, end)) -+ return -EINVAL; -+ -+ acpi_table_print_madt_entry(header); -+ -+ /* Record local apic id only when enabled */ -+ if (processor->flags.enabled) -+ x86_acpiid_to_apicid[processor->acpi_uid] = processor->id; -+ -+ /* -+ * We need to register disabled CPU as well to permit -+ * counting disabled CPUs. This allows us to size -+ * cpus_possible_map more accurately, to permit -+ * to not preallocating memory for all NR_CPUS -+ * when we use CPU hotplug. -+ */ -+ mp_register_lapic(processor->id, /* X2APIC ID */ -+ processor->flags.enabled); /* Enabled? */ -+ -+ return 0; -+} -+ -+static int __init - acpi_parse_lapic(struct acpi_subtable_header * header, const unsigned long end) - { - struct acpi_table_lapic *processor = NULL; -@@ -201,6 +230,25 @@ acpi_parse_lapic_addr_ovr(struct acpi_su - } - - static int __init -+acpi_parse_x2apic_nmi(struct acpi_subtable_header *header, -+ const unsigned long end) -+{ -+ struct acpi_table_x2apic_nmi *x2apic_nmi = NULL; -+ -+ x2apic_nmi = (struct acpi_table_x2apic_nmi *)header; -+ -+ if (BAD_MADT_ENTRY(x2apic_nmi, end)) -+ return -EINVAL; -+ -+ acpi_table_print_madt_entry(header); -+ -+ if (x2apic_nmi->lint != 1) -+ printk(KERN_WARNING PREFIX "NMI not connected to LINT 1!\n"); -+ -+ return 0; -+} -+ -+static int __init - acpi_parse_lapic_nmi(struct acpi_subtable_header * header, const unsigned long end) - { - struct acpi_table_lapic_nmi *lapic_nmi = NULL; -@@ -465,7 +513,7 @@ static int __init acpi_parse_fadt(struct - */ - static int __init acpi_parse_madt_lapic_entries(void) - { -- int count; -+ int count, x2count; - - if (!cpu_has_apic) - return -ENODEV; -@@ -488,11 +536,13 @@ static int __init acpi_parse_madt_lapic_ - - count = acpi_table_parse_madt(ACPI_MADT_LAPIC, acpi_parse_lapic, - MAX_APICS); -- if (!count) { -+ x2count = acpi_table_parse_madt(ACPI_MADT_X2APIC, acpi_parse_x2apic, -+ MAX_APICS); -+ if (!count && !x2count) { - printk(KERN_ERR PREFIX "No LAPIC entries present\n"); - /* TBD: Cleanup to allow fallback to MPS */ - return -ENODEV; -- } else if (count < 0) { -+ } else if (count < 0 || x2count < 0) { - printk(KERN_ERR PREFIX "Error parsing LAPIC entry\n"); - /* TBD: Cleanup to allow fallback to MPS */ - return count; -@@ -500,7 +550,10 @@ static int __init acpi_parse_madt_lapic_ - - count = - acpi_table_parse_madt(ACPI_MADT_LAPIC_NMI, acpi_parse_lapic_nmi, 0); -- if (count < 0) { -+ x2count = -+ acpi_table_parse_madt(ACPI_MADT_X2APIC_NMI, -+ acpi_parse_x2apic_nmi, 0); -+ if (count < 0 || x2count < 0) { - printk(KERN_ERR PREFIX "Error parsing LAPIC NMI entry\n"); - /* TBD: Cleanup to allow fallback to MPS */ - return count; -Index: xen-4.0.2-testing/xen/arch/x86/mpparse.c -=================================================================== ---- xen-4.0.2-testing.orig/xen/arch/x86/mpparse.c -+++ xen-4.0.2-testing/xen/arch/x86/mpparse.c -@@ -838,7 +838,7 @@ void __init mp_register_lapic_address ( - - - int __devinit mp_register_lapic ( -- u8 id, -+ u32 id, - u8 enabled) - { - struct mpc_config_processor processor; -Index: xen-4.0.2-testing/xen/arch/x86/srat.c -=================================================================== ---- xen-4.0.2-testing.orig/xen/arch/x86/srat.c -+++ xen-4.0.2-testing/xen/arch/x86/srat.c -@@ -164,6 +164,36 @@ void __init acpi_numa_slit_init(struct a - } - #endif - -+/* Callback for Proximity Domain -> x2APIC mapping */ -+void __init -+acpi_numa_x2apic_affinity_init(struct acpi_srat_x2apic_cpu_affinity *pa) -+{ -+ int pxm, node; -+ int apic_id; -+ -+ if (srat_disabled()) -+ return; -+ if (pa->header.length < sizeof(struct acpi_srat_x2apic_cpu_affinity)) { -+ bad_srat(); -+ return; -+ } -+ if ((pa->flags & ACPI_SRAT_CPU_ENABLED) == 0) -+ return; -+ pxm = pa->proximity_domain; -+ node = setup_node(pxm); -+ if (node < 0) { -+ printk(KERN_ERR "SRAT: Too many proximity domains %x\n", pxm); -+ bad_srat(); -+ return; -+ } -+ -+ apic_id = pa->apic_id; -+ apicid_to_node[apic_id] = node; -+ acpi_numa = 1; -+ printk(KERN_INFO "SRAT: PXM %u -> APIC %u -> Node %u\n", -+ pxm, apic_id, node); -+} -+ - /* Callback for Proximity Domain -> LAPIC mapping */ - void __init - acpi_numa_processor_affinity_init(struct acpi_srat_cpu_affinity *pa) -Index: xen-4.0.2-testing/xen/drivers/acpi/numa.c -=================================================================== ---- xen-4.0.2-testing.orig/xen/drivers/acpi/numa.c -+++ xen-4.0.2-testing/xen/drivers/acpi/numa.c -@@ -90,6 +90,21 @@ void __init acpi_table_print_srat_entry( - #endif /* ACPI_DEBUG_OUTPUT */ - break; - -+ case ACPI_SRAT_TYPE_X2APIC_CPU_AFFINITY: -+#ifdef ACPI_DEBUG_OUTPUT -+ { -+ struct acpi_srat_x2apic_cpu_affinity *p = -+ (struct acpi_srat_x2apic_cpu_affinity *)header; -+ ACPI_DEBUG_PRINT((ACPI_DB_INFO, -+ "SRAT Processor (x2apicid[0x%08x]) in" -+ " proximity domain %d %s\n", -+ p->apic_id, -+ p->proximity_domain, -+ (p->flags & ACPI_SRAT_CPU_ENABLED) ? -+ "enabled" : "disabled")); -+ } -+#endif /* ACPI_DEBUG_OUTPUT */ -+ break; - default: - printk(KERN_WARNING PREFIX - "Found unsupported SRAT entry (type = 0x%x)\n", -@@ -105,6 +120,33 @@ static int __init acpi_parse_slit(struct - return 0; - } - -+void __init __attribute__ ((weak)) -+acpi_numa_x2apic_affinity_init(struct acpi_srat_x2apic_cpu_affinity *pa) -+{ -+ printk(KERN_WARNING PREFIX -+ "Found unsupported x2apic [0x%08x] SRAT entry\n", pa->apic_id); -+ return; -+} -+ -+ -+static int __init -+acpi_parse_x2apic_affinity(struct acpi_subtable_header *header, -+ const unsigned long end) -+{ -+ struct acpi_srat_x2apic_cpu_affinity *processor_affinity; -+ -+ processor_affinity = (struct acpi_srat_x2apic_cpu_affinity *)header; -+ if (!processor_affinity) -+ return -EINVAL; -+ -+ acpi_table_print_srat_entry(header); -+ -+ /* let architecture-dependent part to do it */ -+ acpi_numa_x2apic_affinity_init(processor_affinity); -+ -+ return 0; -+} -+ - static int __init - acpi_parse_processor_affinity(struct acpi_subtable_header * header, - const unsigned long end) -@@ -164,6 +206,8 @@ int __init acpi_numa_init(void) - { - /* SRAT: Static Resource Affinity Table */ - if (!acpi_table_parse(ACPI_SIG_SRAT, acpi_parse_srat)) { -+ acpi_table_parse_srat(ACPI_SRAT_TYPE_X2APIC_CPU_AFFINITY, -+ acpi_parse_x2apic_affinity, NR_CPUS); - acpi_table_parse_srat(ACPI_SRAT_PROCESSOR_AFFINITY, - acpi_parse_processor_affinity, - NR_CPUS); -Index: xen-4.0.2-testing/xen/drivers/acpi/tables.c -=================================================================== ---- xen-4.0.2-testing.orig/xen/drivers/acpi/tables.c -+++ xen-4.0.2-testing/xen/drivers/acpi/tables.c -@@ -63,6 +63,18 @@ void __init acpi_table_print_madt_entry( - } - break; - -+ case ACPI_MADT_TYPE_LOCAL_X2APIC: -+ { -+ struct acpi_madt_local_x2apic *p = -+ (struct acpi_madt_local_x2apic *)header; -+ printk(KERN_INFO PREFIX -+ "X2APIC (apic_id[0x%02x] uid[0x%02x] %s)\n", -+ p->local_apic_id, p->uid, -+ (p->lapic_flags & ACPI_MADT_ENABLED) ? -+ "enabled" : "disabled"); -+ } -+ break; -+ - case ACPI_MADT_TYPE_IO_APIC: - { - struct acpi_madt_io_apic *p = -@@ -116,6 +128,24 @@ void __init acpi_table_print_madt_entry( - p->lint); - } - break; -+ -+ case ACPI_MADT_TYPE_LOCAL_X2APIC_NMI: -+ { -+ u16 polarity, trigger; -+ struct acpi_madt_local_x2apic_nmi *p = -+ (struct acpi_madt_local_x2apic_nmi *)header; -+ -+ polarity = p->inti_flags & ACPI_MADT_POLARITY_MASK; -+ trigger = (p->inti_flags & ACPI_MADT_TRIGGER_MASK) >> 2; -+ -+ printk(KERN_INFO PREFIX -+ "X2APIC_NMI (uid[0x%02x] %s %s lint[0x%x])\n", -+ p->uid, -+ mps_inti_flags_polarity[polarity], -+ mps_inti_flags_trigger[trigger], -+ p->lint); -+ } -+ break; - - case ACPI_MADT_TYPE_LOCAL_APIC_OVERRIDE: - { -Index: xen-4.0.2-testing/xen/include/acpi/actbl1.h -=================================================================== ---- xen-4.0.2-testing.orig/xen/include/acpi/actbl1.h -+++ xen-4.0.2-testing/xen/include/acpi/actbl1.h -@@ -404,7 +404,9 @@ enum acpi_madt_type { - ACPI_MADT_TYPE_IO_SAPIC = 6, - ACPI_MADT_TYPE_LOCAL_SAPIC = 7, - ACPI_MADT_TYPE_INTERRUPT_SOURCE = 8, -- ACPI_MADT_TYPE_RESERVED = 9 /* 9 and greater are reserved */ -+ ACPI_MADT_TYPE_LOCAL_X2APIC = 9, -+ ACPI_MADT_TYPE_LOCAL_X2APIC_NMI = 10, -+ ACPI_MADT_TYPE_RESERVED = 11 /* 11 and greater are reserved */ - }; - - /* -@@ -505,6 +507,26 @@ struct acpi_madt_interrupt_source { - - #define ACPI_MADT_CPEI_OVERRIDE (1) - -+/* 9: Processor Local X2APIC (ACPI 4.0) */ -+ -+struct acpi_madt_local_x2apic { -+ struct acpi_subtable_header header; -+ u16 reserved; /* Reserved - must be zero */ -+ u32 local_apic_id; /* Processor X2_APIC ID */ -+ u32 lapic_flags; -+ u32 uid; /* Extended X2_APIC processor ID */ -+}; -+ -+/* 10: Local X2APIC NMI (ACPI 4.0) */ -+ -+struct acpi_madt_local_x2apic_nmi { -+ struct acpi_subtable_header header; -+ u16 inti_flags; -+ u32 uid; /* Processor X2_APIC ID */ -+ u8 lint; /* LINTn to which NMI is connected */ -+ u8 reserved[3]; -+}; -+ - /* - * Common flags fields for MADT subtables - */ -@@ -646,11 +668,14 @@ struct acpi_table_srat { - enum acpi_srat_type { - ACPI_SRAT_TYPE_CPU_AFFINITY = 0, - ACPI_SRAT_TYPE_MEMORY_AFFINITY = 1, -- ACPI_SRAT_TYPE_RESERVED = 2 -+ ACPI_SRAT_TYPE_X2APIC_CPU_AFFINITY = 2, -+ ACPI_SRAT_TYPE_RESERVED = 3 /* 3 and greater are reserved */ - }; - - /* SRAT sub-tables */ - -+/* 0: Processor Local APIC/SAPIC Affinity */ -+ - struct acpi_srat_cpu_affinity { - struct acpi_subtable_header header; - u8 proximity_domain_lo; -@@ -661,9 +686,7 @@ struct acpi_srat_cpu_affinity { - u32 reserved; /* Reserved, must be zero */ - }; - --/* Flags */ -- --#define ACPI_SRAT_CPU_ENABLED (1) /* 00: Use affinity structure */ -+/* 1: Memory Affinity */ - - struct acpi_srat_mem_affinity { - struct acpi_subtable_header header; -@@ -682,6 +705,22 @@ struct acpi_srat_mem_affinity { - #define ACPI_SRAT_MEM_HOT_PLUGGABLE (1<<1) /* 01: Memory region is hot pluggable */ - #define ACPI_SRAT_MEM_NON_VOLATILE (1<<2) /* 02: Memory region is non-volatile */ - -+/* 2: Processor Local X2_APIC Affinity (ACPI 4.0) */ -+ -+struct acpi_srat_x2apic_cpu_affinity { -+ struct acpi_subtable_header header; -+ u16 reserved; /* Reserved, must be zero */ -+ u32 proximity_domain; -+ u32 apic_id; -+ u32 flags; -+ u32 clock_domain; -+ u32 reserved2; -+}; -+ -+/* Flags for struct acpi_srat_cpu_affinity and struct acpi_srat_x2apic_cpu_affinity */ -+ -+#define ACPI_SRAT_CPU_ENABLED (1) /* 00: Use affinity structure */ -+ - /******************************************************************************* - * - * TCPA - Trusted Computing Platform Alliance table -Index: xen-4.0.2-testing/xen/include/asm-x86/acpi.h -=================================================================== ---- xen-4.0.2-testing.orig/xen/include/asm-x86/acpi.h -+++ xen-4.0.2-testing/xen/include/asm-x86/acpi.h -@@ -151,7 +151,7 @@ struct acpi_sleep_info { - #endif /* CONFIG_ACPI_SLEEP */ - - #define MAX_MADT_ENTRIES 256 --extern u8 x86_acpiid_to_apicid[]; -+extern u32 x86_acpiid_to_apicid[]; - #define MAX_LOCAL_APIC 256 - - extern u32 pmtmr_ioport; -Index: xen-4.0.2-testing/xen/include/asm-x86/mpspec.h -=================================================================== ---- xen-4.0.2-testing.orig/xen/include/asm-x86/mpspec.h -+++ xen-4.0.2-testing/xen/include/asm-x86/mpspec.h -@@ -24,7 +24,7 @@ extern int pic_mode; - extern int using_apic_timer; - - #ifdef CONFIG_ACPI --extern int mp_register_lapic (u8 id, u8 enabled); -+extern int mp_register_lapic (u32 id, u8 enabled); - extern void mp_unregister_lapic(uint32_t apic_id, uint32_t cpu); - extern void mp_register_lapic_address (u64 address); - extern void mp_register_ioapic (u8 id, u32 address, u32 gsi_base); -Index: xen-4.0.2-testing/xen/include/xen/acpi.h -=================================================================== ---- xen-4.0.2-testing.orig/xen/include/xen/acpi.h -+++ xen-4.0.2-testing/xen/include/xen/acpi.h -@@ -57,6 +57,8 @@ enum acpi_madt_entry_id { - ACPI_MADT_IOSAPIC, - ACPI_MADT_LSAPIC, - ACPI_MADT_PLAT_INT_SRC, -+ ACPI_MADT_X2APIC, -+ ACPI_MADT_X2APIC_NMI, - ACPI_MADT_ENTRY_COUNT - }; - -@@ -76,6 +78,17 @@ struct acpi_table_lapic { - } flags; - } __attribute__ ((packed)); - -+struct acpi_table_x2apic { -+ struct acpi_subtable_header header; -+ u16 reserved; -+ u32 id; -+ struct { -+ u32 enabled:1; -+ u32 reserved:31; -+ } flags; -+ u32 acpi_uid; -+} __attribute__ ((packed)); -+ - struct acpi_table_ioapic { - struct acpi_subtable_header header; - u8 id; -@@ -105,6 +118,14 @@ struct acpi_table_lapic_nmi { - u8 lint; - } __attribute__ ((packed)); - -+struct acpi_table_x2apic_nmi { -+ struct acpi_subtable_header header; -+ acpi_interrupt_flags flags; -+ u32 acpi_uid; -+ u8 lint; -+ u8 reserved[3]; -+} __attribute__ ((packed)); -+ - struct acpi_table_lapic_addr_ovr { - struct acpi_subtable_header header; - u8 reserved[2]; -@@ -280,6 +301,7 @@ void acpi_table_print_srat_entry (struct - /* the following four functions are architecture-dependent */ - void acpi_numa_slit_init (struct acpi_table_slit *slit); - void acpi_numa_processor_affinity_init (struct acpi_srat_cpu_affinity *pa); -+void acpi_numa_x2apic_affinity_init(struct acpi_srat_x2apic_cpu_affinity *pa); - void acpi_numa_memory_affinity_init (struct acpi_srat_mem_affinity *ma); - void acpi_numa_arch_fixup(void); - diff --git a/21847-pscsi.patch b/21847-pscsi.patch deleted file mode 100644 index f4f9989..0000000 --- a/21847-pscsi.patch +++ /dev/null @@ -1,130 +0,0 @@ -# HG changeset patch -# User "Dube, Lutz" -# Date 1279902875 -3600 -# Node ID 4814e16ea4105502332407e3379c49da92018899 -# Parent e23302fcb83c72f93ec01285bd7f4f1641eb67e4 -tools/xend: Fix performance of xend with more than 10000 FC device paths - -On server startup xend start or a later xend restart needs approx. 30 min to -start/restart. Without attached FC devices xend start/restart needs only some -seconds. - -server type: Fujitsu Primergy RX600-S5 - -The time gets lost in xen/xend/XendNode.py line 329 while calling -vscsi_util.get_all_scsi_device(). - -329 for pscsi_record in vscsi_util.get_all_scsi_devices(): -330 scsi_id = pscsi_record['scsi_id'] -331 if scsi_id: -332 saved_HBA_uuid = None - -I think, in most cases we don't need all the PSCSI devices registered in -xend, but only a few of it. -So a good solution for this perforamce issue is to scan only the SCSI device -paths we need, controlled by a new option in xend-config.sxp. - -I have made a patch to allow specification of scsi devices we need in xend -in the config file xend-config.sxp. -The new options pscsi-device-mask expects a list of device ids oder partial -device ids like the option of lsscsi, e.g. -(pscsi-device-mask (': "Well done" -Committed-by: Ian Jackson - -Index: xen-4.0.2-testing/tools/examples/xend-config.sxp -=================================================================== ---- xen-4.0.2-testing.orig/tools/examples/xend-config.sxp -+++ xen-4.0.2-testing/tools/examples/xend-config.sxp -@@ -277,3 +277,11 @@ - # we have to realize this may incur security issue and we can't make sure the - # device assignment could really work properly even after we do this. - #(pci-passthrough-strict-check yes) -+ -+# If we have a very big scsi device configuration, start of xend is slow, -+# because xend scans all the device paths to build its internal PSCSI device -+# list. If we need only a few devices for assigning to a guest, we can reduce -+# the scan to this device. Set list list of device paths in same syntax like in -+# command lsscsi, e.g. ('16:0:0:0' '15:0') -+# (pscsi-device-mask ('*')) -+ -Index: xen-4.0.2-testing/tools/python/xen/util/vscsi_util.py -=================================================================== ---- xen-4.0.2-testing.orig/tools/python/xen/util/vscsi_util.py -+++ xen-4.0.2-testing/tools/python/xen/util/vscsi_util.py -@@ -148,11 +148,12 @@ def _vscsi_get_scsidevices_by_sysfs(): - return devices - - --def vscsi_get_scsidevices(): -+def vscsi_get_scsidevices(mask=""): - """ get all scsi devices information """ - -- devices = _vscsi_get_scsidevices_by_lsscsi("") -- if devices: -+ devices = _vscsi_get_scsidevices_by_lsscsi("[%s]" % mask) -+ if devices or (len(mask) and mask[0] != "*"): -+ # devices found or partial device scan - return devices - return _vscsi_get_scsidevices_by_sysfs() - -@@ -274,9 +275,9 @@ def get_scsi_device(pHCTL): - return _make_scsi_record(scsi_info) - return None - --def get_all_scsi_devices(): -+def get_all_scsi_devices(mask=""): - scsi_records = [] -- for scsi_info in vscsi_get_scsidevices(): -+ for scsi_info in vscsi_get_scsidevices(mask): - scsi_record = _make_scsi_record(scsi_info) - scsi_records.append(scsi_record) - return scsi_records -Index: xen-4.0.2-testing/tools/python/xen/xend/XendNode.py -=================================================================== ---- xen-4.0.2-testing.orig/tools/python/xen/xend/XendNode.py -+++ xen-4.0.2-testing/tools/python/xen/xend/XendNode.py -@@ -323,7 +323,12 @@ class XendNode: - pscsi_table = {} - pscsi_HBA_table = {} - -- for pscsi_record in vscsi_util.get_all_scsi_devices(): -+ pscsi_records = [] -+ for pscsi_mask in xendoptions().get_pscsi_device_mask(): -+ pscsi_records += vscsi_util.get_all_scsi_devices(pscsi_mask) -+ log.debug("pscsi record count: %s" % len(pscsi_records)) -+ -+ for pscsi_record in pscsi_records: - scsi_id = pscsi_record['scsi_id'] - if scsi_id: - saved_HBA_uuid = None -Index: xen-4.0.2-testing/tools/python/xen/xend/XendOptions.py -=================================================================== ---- xen-4.0.2-testing.orig/tools/python/xen/xend/XendOptions.py -+++ xen-4.0.2-testing/tools/python/xen/xend/XendOptions.py -@@ -164,6 +164,9 @@ class XendOptions: - """ - print >>sys.stderr, "xend [ERROR]", fmt % args - -+ """Default mask for pscsi device scan.""" -+ xend_pscsi_device_mask = ['*'] -+ - - def configure(self): - self.set_config() -@@ -430,6 +433,10 @@ class XendOptions: - return self.get_config_bool("pci-passthrough-strict-check", - self.pci_dev_assign_strict_check_default) - -+ def get_pscsi_device_mask(self): -+ return self.get_config_value("pscsi-device-mask", -+ self.xend_pscsi_device_mask) -+ - class XendOptionsFile(XendOptions): - - """Default path to the config file.""" diff --git a/21866-xenapi.patch b/21866-xenapi.patch deleted file mode 100644 index c1fa627..0000000 --- a/21866-xenapi.patch +++ /dev/null @@ -1,90 +0,0 @@ -# HG changeset patch -# User Lutz Dube -# Date 1280245980 -3600 -# Node ID e017930af272c888f2a562f842af4e142a973d5f -# Parent 5078f2c1e3d6a3a06ecf352a068eb496f09a2a98 -xend (XenAPI): Error in Xend-API method VM_set_actions_after_crash - -Xend-API defines the method VM_set_actions_after_crash with valid -action names coredump_and_destroy, coredump_and_restart,... . These -values have to be converted into internal representation -"coredump-destroy", "coredump-restart", ... otherwise start of the -domain is rejected. Same error occurs, if I try to create a VM using -the Xend-API with actions_after_crash set to coredump_and_destroy. - -Could you please apply my patch to xen-4-0-testing, too. - -Signed-off-by: Lutz Dube Lutz.Dube@ts.fujitsu.com -Acked-by: Jim Fehlig -Committed-by: Ian Jackson - -Index: xen-4.0.2-testing/tools/python/xen/xend/XendAPI.py -=================================================================== ---- xen-4.0.2-testing.orig/tools/python/xen/xend/XendAPI.py -+++ xen-4.0.2-testing/tools/python/xen/xend/XendAPI.py -@@ -1667,7 +1667,8 @@ class XendAPI(object): - def VM_set_actions_after_crash(self, session, vm_ref, action): - if action not in XEN_API_ON_CRASH_BEHAVIOUR: - return xen_api_error(['VM_ON_CRASH_BEHAVIOUR_INVALID', vm_ref]) -- return self.VM_set('actions_after_crash', session, vm_ref, action) -+ return self.VM_set('actions_after_crash', session, vm_ref, -+ XEN_API_ON_CRASH_BEHAVIOUR_LEGACY[action]) - - def VM_set_HVM_boot_policy(self, session, vm_ref, value): - if value != "" and value != "BIOS order": -Index: xen-4.0.2-testing/tools/python/xen/xend/XendAPIConstants.py -=================================================================== ---- xen-4.0.2-testing.orig/tools/python/xen/xend/XendAPIConstants.py -+++ xen-4.0.2-testing/tools/python/xen/xend/XendAPIConstants.py -@@ -63,6 +63,18 @@ XEN_API_ON_CRASH_BEHAVIOUR_FILTER = { - 'rename_restart' : 'rename_restart', - } - -+XEN_API_ON_CRASH_BEHAVIOUR_LEGACY = { -+ 'destroy' : 'destroy', -+ 'coredump-destroy' : 'coredump-destroy', -+ 'coredump_and_destroy' : 'coredump-destroy', -+ 'restart' : 'restart', -+ 'coredump-restart' : 'coredump-restart', -+ 'coredump_and_restart' : 'coredump-restart', -+ 'preserve' : 'preserve', -+ 'rename-restart' : 'rename-restart', -+ 'rename_restart' : 'rename-restart', -+} -+ - XEN_API_VBD_MODE = ['RO', 'RW'] - XEN_API_VDI_TYPE = ['system', 'user', 'ephemeral'] - XEN_API_VBD_TYPE = ['CD', 'Disk'] -Index: xen-4.0.2-testing/tools/python/xen/xend/XendConfig.py -=================================================================== ---- xen-4.0.2-testing.orig/tools/python/xen/xend/XendConfig.py -+++ xen-4.0.2-testing/tools/python/xen/xend/XendConfig.py -@@ -41,6 +41,7 @@ from xen.util.pci import pci_opts_list_f - from xen.xend.XendSXPDev import dev_dict_to_sxp - from xen.util import xsconstants - from xen.util import auxbin -+from xen.xend.XendAPIConstants import * - import xen.util.fileuri - - log = logging.getLogger("xend.XendConfig") -@@ -62,6 +63,11 @@ def reverse_dict(adict): - def bool0(v): - return v != '0' and v != 'False' and bool(v) - -+def convert_on_crash(v): -+ v = str(v) -+ return XEN_API_ON_CRASH_BEHAVIOUR_LEGACY[v] \ -+ if v in XEN_API_ON_CRASH_BEHAVIOUR else v -+ - # Recursively copy a data struct, scrubbing out VNC passwords. - # Will scrub any dict entry with a key of 'vncpasswd' or any - # 2-element list whose first member is 'vncpasswd'. It will -@@ -211,7 +217,7 @@ XENAPI_CFG_TYPES = { - 'VCPUs_live': int, - 'actions_after_shutdown': str, - 'actions_after_reboot': str, -- 'actions_after_crash': str, -+ 'actions_after_crash': convert_on_crash, - 'PV_bootloader': str, - 'PV_kernel': str, - 'PV_ramdisk': str, diff --git a/21894-intel-unmask-cpuid.patch b/21894-intel-unmask-cpuid.patch deleted file mode 100644 index 4d5a34d..0000000 --- a/21894-intel-unmask-cpuid.patch +++ /dev/null @@ -1,52 +0,0 @@ -# HG changeset patch -# User Keir Fraser -# Date 1280486194 -3600 -# Node ID c9e7850ec9a18d7085c7468407e175bb64513846 -# Parent 754877be695ba3050f140002dbd185a27a437fcc -x86: unmask CPUID levels on Intel CPUs -References: bnc#640773 - -If the CPUID limit bit in MSR_IA32_MISC_ENABLE is set, clear it to -make all CPUID information available. This is required for some -features to work, such as MWAIT in cpuidle, get cpu topology, XSAVE, -etc. - -Signed-off-by: Wei Gang - -Index: xen-4.0.2-testing/xen/arch/x86/cpu/intel.c -=================================================================== ---- xen-4.0.2-testing.orig/xen/arch/x86/cpu/intel.c -+++ xen-4.0.2-testing/xen/arch/x86/cpu/intel.c -@@ -90,6 +90,20 @@ void __devinit early_intel_workaround(st - /* Netburst reports 64 bytes clflush size, but does IO in 128 bytes */ - if (c->x86 == 15 && c->x86_cache_alignment == 64) - c->x86_cache_alignment = 128; -+ -+ /* Unmask CPUID levels if masked: */ -+ if (c->x86 > 6 || (c->x86 == 6 && c->x86_model >= 0xd)) { -+ u64 misc_enable; -+ -+ rdmsrl(MSR_IA32_MISC_ENABLE, misc_enable); -+ -+ if (misc_enable & MSR_IA32_MISC_ENABLE_LIMIT_CPUID) { -+ misc_enable &= ~MSR_IA32_MISC_ENABLE_LIMIT_CPUID; -+ wrmsrl(MSR_IA32_MISC_ENABLE, misc_enable); -+ c->cpuid_level = cpuid_eax(0); -+ printk("revised cpuid_level = %d\n", c->cpuid_level); -+ } -+ } - } - - /* -Index: xen-4.0.2-testing/xen/include/asm-x86/msr-index.h -=================================================================== ---- xen-4.0.2-testing.orig/xen/include/asm-x86/msr-index.h -+++ xen-4.0.2-testing/xen/include/asm-x86/msr-index.h -@@ -324,6 +324,7 @@ - #define MSR_IA32_MISC_ENABLE_BTS_UNAVAIL (1<<11) - #define MSR_IA32_MISC_ENABLE_PEBS_UNAVAIL (1<<12) - #define MSR_IA32_MISC_ENABLE_MONITOR_ENABLE (1<<18) -+#define MSR_IA32_MISC_ENABLE_LIMIT_CPUID (1<<22) - #define MSR_IA32_MISC_ENABLE_XTPR_DISABLE (1<<23) - - /* Intel Model 6 */ diff --git a/22019-x86-cpuidle-online-check.patch b/22019-x86-cpuidle-online-check.patch deleted file mode 100644 index 7e95d1e..0000000 --- a/22019-x86-cpuidle-online-check.patch +++ /dev/null @@ -1,32 +0,0 @@ -# HG changeset patch -# User Keir Fraser -# Date 1282069957 -3600 -# Node ID 5218db847b58a151d8f320b7141efc984f759b35 -# Parent 542e8cd16a6cf036e89b597ba6343245fcaafa25 -x86 cpuidle: check whether cpu is online in cpu idle control - -We observed a 2.6.18.8 dom0 kernel crash when Xen has maxcpus < num -of physical cores (maxcpus=3D4 for a 12-core system). It appeared that -hypervisor doesn't check whether CPU is online or not. This small -patch fixed the issue. - -Signed-off-by: Uwe Dannowski -Acked-by: Wei Huang - -Index: xen-4.0.2-testing/xen/arch/x86/acpi/cpuidle_menu.c -=================================================================== ---- xen-4.0.2-testing.orig/xen/arch/x86/acpi/cpuidle_menu.c -+++ xen-4.0.2-testing/xen/arch/x86/acpi/cpuidle_menu.c -@@ -270,9 +270,10 @@ static void menu_reflect(struct acpi_pro - - static int menu_enable_device(struct acpi_processor_power *power) - { -- struct menu_device *data = &per_cpu(menu_devices, power->cpu); -+ if (!cpu_online(power->cpu)) -+ return -1; - -- memset(data, 0, sizeof(struct menu_device)); -+ memset(&per_cpu(menu_devices, power->cpu), 0, sizeof(struct menu_device)); - - return 0; - } diff --git a/22214-x86-msr-misc-enable.patch b/22214-x86-msr-misc-enable.patch deleted file mode 100644 index b24cfdf..0000000 --- a/22214-x86-msr-misc-enable.patch +++ /dev/null @@ -1,87 +0,0 @@ -# HG changeset patch -# User Keir Fraser -# Date 1285340079 -3600 -# Node ID 71f836615ea211ac4e6f3b9793f58c6f6934c030 -# Parent eb247ea9db8c8b541a7f8c9cdc51c064c4c9e41c -x86: adjust MSR_IA32_MISC_ENABLE handling - -In the warning message issued on writes, the Xen-modified value should -be printed (and used to determine whether anything needs to be printed -at all), as the guest kernel will usually do a read-modify-write -cycle. - -A question is whether Dom0 shouldn't be allowed control over some -bits, or whether some bits shouldn't be fully virtualized. I'm -particularly thinking of MSR_IA32_MISC_ENABLE_FAST_STRING, which -recent Linux kernels want to disable for CONFIG_KMEMCHECK. - -While putting this together I also noticed that rdmsr_safe() failed to -initialize its output registers in the failure path, thus leading to -printing of uninitialized data in the guest WRMSR warning message. - -Further, the default case value-changed check can be simplified. - -Signed-off-by: Jan Beulich - -Index: xen-4.0.2-testing/xen/arch/x86/traps.c -=================================================================== ---- xen-4.0.2-testing.orig/xen/arch/x86/traps.c -+++ xen-4.0.2-testing/xen/arch/x86/traps.c -@@ -1679,6 +1679,16 @@ unsigned long guest_to_host_gpr_switch(u - - void (*pv_post_outb_hook)(unsigned int port, u8 value); - -+static inline uint32_t guest_misc_enable(uint32_t eax) -+{ -+ eax &= ~(MSR_IA32_MISC_ENABLE_PERF_AVAIL | -+ MSR_IA32_MISC_ENABLE_MONITOR_ENABLE); -+ eax |= MSR_IA32_MISC_ENABLE_BTS_UNAVAIL | -+ MSR_IA32_MISC_ENABLE_PEBS_UNAVAIL | -+ MSR_IA32_MISC_ENABLE_XTPR_DISABLE; -+ return eax; -+} -+ - /* Instruction fetch with error handling. */ - #define insn_fetch(type, base, eip, limit) \ - ({ unsigned long _rc, _ptr = (base) + (eip); \ -@@ -2276,6 +2286,13 @@ static int emulate_privileged_op(struct - if ( wrmsr_safe(MSR_FAM10H_MMIO_CONF_BASE, eax, edx) != 0 ) - goto fail; - break; -+ case MSR_IA32_MISC_ENABLE: -+ if ( rdmsr_safe(regs->ecx, l, h) ) -+ goto invalid; -+ l = guest_misc_enable(l); -+ if ( eax != l || edx != h ) -+ goto invalid; -+ break; - case MSR_IA32_MPERF: - case MSR_IA32_APERF: - if (( boot_cpu_data.x86_vendor != X86_VENDOR_INTEL ) && -@@ -2382,11 +2399,7 @@ static int emulate_privileged_op(struct - case MSR_IA32_MISC_ENABLE: - if ( rdmsr_safe(regs->ecx, regs->eax, regs->edx) ) - goto fail; -- regs->eax &= ~(MSR_IA32_MISC_ENABLE_PERF_AVAIL | -- MSR_IA32_MISC_ENABLE_MONITOR_ENABLE); -- regs->eax |= MSR_IA32_MISC_ENABLE_BTS_UNAVAIL | -- MSR_IA32_MISC_ENABLE_PEBS_UNAVAIL | -- MSR_IA32_MISC_ENABLE_XTPR_DISABLE; -+ regs->eax = guest_misc_enable(regs->eax); - break; - case MSR_EFER: - case MSR_AMD_PATCHLEVEL: -Index: xen-4.0.2-testing/xen/include/asm-x86/msr.h -=================================================================== ---- xen-4.0.2-testing.orig/xen/include/asm-x86/msr.h -+++ xen-4.0.2-testing/xen/include/asm-x86/msr.h -@@ -39,7 +39,8 @@ static inline void wrmsrl(unsigned int m - __asm__ __volatile__( \ - "1: rdmsr\n2:\n" \ - ".section .fixup,\"ax\"\n" \ -- "3: movl %5,%2\n; jmp 2b\n" \ -+ "3: xor %0,%0\n; xor %1,%1\n" \ -+ " movl %5,%2\n; jmp 2b\n" \ - ".previous\n" \ - ".section __ex_table,\"a\"\n" \ - " "__FIXUP_ALIGN"\n" \ diff --git a/22231-x86-pv-ucode-msr-intel.patch b/22231-x86-pv-ucode-msr-intel.patch deleted file mode 100644 index 8edce4f..0000000 --- a/22231-x86-pv-ucode-msr-intel.patch +++ /dev/null @@ -1,70 +0,0 @@ -# HG changeset patch -# User Keir Fraser -# Date 1286784105 -3600 -# Node ID a1405385db77c7c81aac27bd88d6c4b2d90b1389 -# Parent a33886146b45da46a5161a7ebed4d2f607642aee -x86: emulate MSR_IA32_UCODE_REV Intel access protocol - -Intel requires a write of zeros (hence such writes now get silently -ignored) followed by a cpuid(1) followed by the actual read. - -Includes some code redundancy elimination possible after the actual -change. - -Signed-off-by: Jan Beulich - -Index: xen-4.0.2-testing/xen/arch/x86/traps.c -=================================================================== ---- xen-4.0.2-testing.orig/xen/arch/x86/traps.c -+++ xen-4.0.2-testing/xen/arch/x86/traps.c -@@ -2286,6 +2286,14 @@ static int emulate_privileged_op(struct - if ( wrmsr_safe(MSR_FAM10H_MMIO_CONF_BASE, eax, edx) != 0 ) - goto fail; - break; -+ case MSR_IA32_UCODE_REV: -+ if ( boot_cpu_data.x86_vendor != X86_VENDOR_INTEL ) -+ goto fail; -+ if ( rdmsr_safe(regs->ecx, l, h) ) -+ goto fail; -+ if ( l | h ) -+ goto invalid; -+ break; - case MSR_IA32_MISC_ENABLE: - if ( rdmsr_safe(regs->ecx, l, h) ) - goto invalid; -@@ -2393,16 +2401,21 @@ static int emulate_privileged_op(struct - regs->eax = regs->edx = 0; - break; - } -- if ( rdmsr_safe(regs->ecx, regs->eax, regs->edx) != 0 ) -- goto fail; -- break; -+ goto rdmsr_normal; -+ case MSR_IA32_UCODE_REV: -+ BUILD_BUG_ON(MSR_IA32_UCODE_REV != MSR_AMD_PATCHLEVEL); -+ if ( boot_cpu_data.x86_vendor == X86_VENDOR_INTEL ) -+ { -+ if ( wrmsr_safe(MSR_IA32_UCODE_REV, 0, 0) ) -+ goto fail; -+ sync_core(); -+ } -+ goto rdmsr_normal; - case MSR_IA32_MISC_ENABLE: - if ( rdmsr_safe(regs->ecx, regs->eax, regs->edx) ) - goto fail; - regs->eax = guest_misc_enable(regs->eax); - break; -- case MSR_EFER: -- case MSR_AMD_PATCHLEVEL: - default: - if ( rdmsr_hypervisor_regs(regs->ecx, &val) ) - { -@@ -2418,6 +2431,8 @@ static int emulate_privileged_op(struct - if ( rc ) - goto rdmsr_writeback; - -+ case MSR_EFER: -+ rdmsr_normal: - /* Everyone can read the MSR space. */ - /* gdprintk(XENLOG_WARNING,"Domain attempted RDMSR %p.\n", - _p(regs->ecx));*/ diff --git a/22235-lxml-validator.patch b/22235-lxml-validator.patch deleted file mode 100644 index b141d1e..0000000 --- a/22235-lxml-validator.patch +++ /dev/null @@ -1,186 +0,0 @@ -# HG changeset patch -# User Stephan Peijnik -# Date 1286816093 -3600 -# Node ID b8cc53d22545706b28c7a26dffd24f192a76541a -# Parent fbce8e403470db8c9e580a5efd9d717cd2260c1f -Replace pyxml/xmlproc-based XML validator with lxml based one - -Pyxml/xmlproc is being used in tools/xen/xm/xenapi_create.py but is -unmaintained for several years now. xmlproc is used only for validating -XML documents against a DTD file. - -This patch replaces the pyxml/xmlproc based XML validation with code -based on lxml, which is actively maintained. - -Signed-off-by: Stephan Peijnik -Signed-off-by: Stefano Stabellini -committer: Stefano Stabellini - -Index: xen-4.0.2-testing/README -=================================================================== ---- xen-4.0.2-testing.orig/README -+++ xen-4.0.2-testing/README -@@ -137,12 +137,15 @@ Python Runtime Libraries - Xend (the Xen daemon) has the following runtime dependencies: - - * Python 2.3 or later. -- In many distros, the XML-aspects to the standard library -+ In some distros, the XML-aspects to the standard library - (xml.dom.minidom etc) are broken out into a separate python-xml package. - This is also required. -+ In more recent versions of Debian and Ubuntu the XML-aspects are included -+ in the base python package however (python-xml has been removed -+ from Debian in squeeze and from Ubuntu in intrepid). - - URL: http://www.python.org/ -- Debian: python, python-xml -+ Debian: python - - * For optional SSL support, pyOpenSSL: - URL: http://pyopenssl.sourceforge.net/ -@@ -153,8 +156,9 @@ Xend (the Xen daemon) has the following - Debian: python-pam - - * For optional XenAPI support in XM, PyXML: -- URL: http://pyxml.sourceforge.net -- YUM: PyXML -+ URL: http://codespeak.net/lxml/ -+ Debian: python-lxml -+ YUM: python-lxml - - - Intel(R) Trusted Execution Technology Support -Index: xen-4.0.2-testing/tools/python/xen/xm/xenapi_create.py -=================================================================== ---- xen-4.0.2-testing.orig/tools/python/xen/xm/xenapi_create.py -+++ xen-4.0.2-testing/tools/python/xen/xm/xenapi_create.py -@@ -14,13 +14,15 @@ - # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - #============================================================================ - # Copyright (C) 2007 Tom Wilkie -+# Copyright (C) 2010 ANEXIA Internetdienstleistungs GmbH -+# Author: Stephan Peijnik - #============================================================================ - """Domain creation using new XenAPI - """ - - from xen.xm.main import server, get_default_SR - from xml.dom.minidom import parse, getDOMImplementation --from xml.parsers.xmlproc import xmlproc, xmlval, xmldtd -+from lxml import etree - from xen.xend import sxp - from xen.xend.XendAPIConstants import XEN_API_ON_NORMAL_EXIT, \ - XEN_API_ON_CRASH_BEHAVIOUR -@@ -35,6 +37,7 @@ import os - from os.path import join - import traceback - import re -+import warnings # Used by lxml-based validator - - def log(_, msg): - #print "> " + msg -@@ -118,12 +121,21 @@ class xenapi_create: - Use this if possible as it gives nice - error messages - """ -- dtd = xmldtd.load_dtd(self.dtd) -- parser = xmlproc.XMLProcessor() -- parser.set_application(xmlval.ValidatingApp(dtd, parser)) -- parser.dtd = dtd -- parser.ent = dtd -- parser.parse_resource(file) -+ try: -+ dtd = etree.DTD(open(self.dtd, 'r')) -+ except IOError: -+ # The old code did neither raise an exception here, nor -+ # did it report an error. For now we issue a warning. -+ # TODO: How to handle a missing dtd file? -+ # --sp -+ warnings.warn('DTD file %s not found.' % (self.dtd), -+ UserWarning) -+ return -+ -+ tree = etree.parse(file) -+ root = tree.getroot() -+ if not dtd.validate(root): -+ self.handle_dtd_errors(dtd) - - def check_dom_against_dtd(self, dom): - """ -@@ -131,49 +143,36 @@ class xenapi_create: - Doesn't give as nice error messages. - (no location info) - """ -- dtd = xmldtd.load_dtd(self.dtd) -- app = xmlval.ValidatingApp(dtd, self) -- app.set_locator(self) -- self.dom2sax(dom, app) -- -- # Get errors back from ValidatingApp -- def report_error(self, number, args=None): -- self.errors = xmlproc.errors.english - try: -- msg = self.errors[number] -- if args != None: -- msg = msg % args -- except KeyError: -- msg = self.errors[4002] % number # Unknown err msg :-) -- print msg -+ dtd = etree.DTD(open(self.dtd, 'r')) -+ except IOError: -+ # The old code did neither raise an exception here, nor -+ # did it report an error. For now we issue a warning. -+ # TODO: How to handle a missing dtd file? -+ # --sp -+ warnings.warn('DTD file %s not found.' % (self.dtd), -+ UserWarning) -+ return -+ -+ # XXX: This may be a bit slow. Maybe we should use another way -+ # of getting an etree root element from the minidom DOM tree... -+ # -- sp -+ root = etree.XML(dom.toxml()) -+ if not dtd.validate(root): -+ self.handle_dtd_errors(dtd) -+ -+ # Do the same that was done in report_error before. This is directly -+ # called by check_dtd and check_dom_against_dtd. -+ # We are using sys.stderr instead of print though (python3k clean). -+ def handle_dtd_errors(self, dtd): -+ # XXX: Do we really want to bail out here? -+ # -- sp -+ for err in dtd.error_log: -+ err_str = 'ERROR: %s\n' % (str(err),) -+ sys.stderr.write(err_str) -+ sys.stderr.flush() - sys.exit(-1) - -- # Here for compatibility with ValidatingApp -- def get_line(self): -- return -1 -- -- def get_column(self): -- return -1 -- -- def dom2sax(self, dom, app): -- """ -- Take a dom tree and tarverse it, -- issuing SAX calls to app. -- """ -- for child in dom.childNodes: -- if child.nodeType == child.TEXT_NODE: -- data = child.nodeValue -- app.handle_data(data, 0, len(data)) -- else: -- app.handle_start_tag( -- child.nodeName, -- self.attrs_to_dict(child.attributes)) -- self.dom2sax(child, app) -- app.handle_end_tag(child.nodeName) -- -- def attrs_to_dict(self, attrs): -- return dict(attrs.items()) -- - # - # Checks which cannot be done with dtd - # diff --git a/22326-cpu-pools-numa-placement.patch b/22326-cpu-pools-numa-placement.patch deleted file mode 100644 index 613f716..0000000 --- a/22326-cpu-pools-numa-placement.patch +++ /dev/null @@ -1,43 +0,0 @@ -# HG changeset patch -# User Juergen Gross -# Date 1288264929 -3600 -# Node ID dc66c13a29f9af67e0258f688bcd6330cf515383 -# Parent 4ac03710fc320e8f76014ca27849da03b85dff9d -avoid numa placement of cpus with active cpupools - -When using cpupools don't pin vcpus to numa nodes as this might -conflict with the cpupool definition. -numa placement should be handled by cpupool configuration instead. - -Signed-off-by: Juergen Gross -Signed-off-by: Ian Jackson - -Index: xen-4.0.2-testing/tools/python/xen/xend/XendCPUPool.py -=================================================================== ---- xen-4.0.2-testing.orig/tools/python/xen/xend/XendCPUPool.py -+++ xen-4.0.2-testing/tools/python/xen/xend/XendCPUPool.py -@@ -881,6 +881,11 @@ class XendCPUPool(XendBase): - lookup_pool = classmethod(lookup_pool) - - -+ def number_of_pools(cls): -+ return len(xc.cpupool_getinfo()) -+ -+ number_of_pools = classmethod(number_of_pools) -+ - def _cpu_number_to_ref(cls, number): - node = XendNode.instance() - for cpu_ref in node.get_host_cpu_refs(): -Index: xen-4.0.2-testing/tools/python/xen/xend/XendDomainInfo.py -=================================================================== ---- xen-4.0.2-testing.orig/tools/python/xen/xend/XendDomainInfo.py -+++ xen-4.0.2-testing/tools/python/xen/xend/XendDomainInfo.py -@@ -2790,7 +2790,7 @@ class XendDomainInfo: - return map(lambda x: x[0], sorted(enumerate(nodeload), key=lambda x:x[1])) - - info = xc.physinfo() -- if info['nr_nodes'] > 1: -+ if info['nr_nodes'] > 1 and XendCPUPool.number_of_pools() < 2: - node_memory_list = info['node_to_memory'] - needmem = self.image.getRequiredAvailableMemory(self.info['memory_dynamic_max']) / 1024 - candidate_node_list = [] diff --git a/22332-vtd-workarounds.patch b/22332-vtd-workarounds.patch deleted file mode 100644 index 323590c..0000000 --- a/22332-vtd-workarounds.patch +++ /dev/null @@ -1,750 +0,0 @@ -# HG changeset patch -# User Keir Fraser -# Date 1288344554 -3600 -# Node ID b48d8f27fca251c2df0222d195ffcb772d6a1128 -# Parent 2d5e8f4ac43a120bbb5d4c52d08f6980848f0166 -vtd: consolidate VT-d quirks into a single file quirks.c - -Consolidate VT-d quirks into a single file - quirks.c. This includes -quirks to workaround OEM BIOS issue with VT-d enabling in IGD, Cantiga -VT-d buffer flush issue, Cantiga IGD Vt-d low power related errata, -and a quirk to workaround issues related to wifi direct assignment. - -Signed-off-by: Allen Kay -Reviewed-by: Jan Beulich - -# HG changeset patch -# User Keir Fraser -# Date 1288888517 0 -# Node ID fedcd4cbcc1eb3e210628bdf95766ca0c400fc18 -# Parent d508b18a68447f91cd879b79a498f06536d89f8e -[VTD] fix a typo and some minor cleanup of quirks.c - -Fixed a typo for IGD_DEV define and some minor cleanup to ease future -enhancement. - -Signed-off-by: Allen Kay - -# HG changeset patch -# User Keir Fraser -# Date 1294221021 0 -# Node ID e635e6641c07ee2da66b16f46f45442c9a46821d -# Parent 76d897a06b316bf2278220b006d578faf31ce3fb -[VTD] added WLAN device ID on Fujitsu's platform in quirks.c - -Added WLAN device ID 0x422C that was found on Fujitsu's Calpella -system to WLAN quirk. - -Signed-off-by: Allen Kay - ---- a/xen/drivers/passthrough/vtd/Makefile -+++ b/xen/drivers/passthrough/vtd/Makefile -@@ -6,3 +6,4 @@ obj-y += dmar.o - obj-y += utils.o - obj-y += qinval.o - obj-y += intremap.o -+obj-y += quirks.o ---- a/xen/drivers/passthrough/vtd/dmar.c -+++ b/xen/drivers/passthrough/vtd/dmar.c -@@ -242,7 +242,7 @@ struct acpi_rhsa_unit * drhd_to_rhsa(str - - int is_igd_drhd(struct acpi_drhd_unit *drhd) - { -- return ( drhd->address == igd_drhd_address ? 1 : 0); -+ return drhd && (drhd->address == igd_drhd_address); - } - - /* -@@ -278,8 +278,7 @@ static int scope_device_count(void *star - - - static int __init acpi_parse_dev_scope(void *start, void *end, -- void *acpi_entry, int type, -- int *igd) -+ void *acpi_entry, int type) - { - struct dmar_scope *scope = acpi_entry; - struct acpi_ioapic_unit *acpi_ioapic_unit; -@@ -340,8 +339,15 @@ static int __init acpi_parse_dev_scope(v - if ( iommu_verbose ) - dprintk(VTDPREFIX, " endpoint: %x:%x.%x\n", - bus, path->dev, path->fn); -- if ( (bus == 0) && (path->dev == 2) && (path->fn == 0) ) -- *igd = 1; -+ -+ if ( type == DMAR_TYPE ) -+ { -+ struct acpi_drhd_unit *drhd = acpi_entry; -+ -+ if ( (bus == 0) && (path->dev == 2) && (path->fn == 0) ) -+ igd_drhd_address = drhd->address; -+ } -+ - break; - - case ACPI_DEV_IOAPIC: -@@ -388,7 +394,7 @@ acpi_parse_one_drhd(struct acpi_dmar_ent - struct acpi_table_drhd * drhd = (struct acpi_table_drhd *)header; - void *dev_scope_start, *dev_scope_end; - struct acpi_drhd_unit *dmaru; -- int ret, igd = 0; -+ int ret; - static int include_all = 0; - - if ( (ret = acpi_dmar_check_length(header, sizeof(*drhd))) != 0 ) -@@ -413,10 +419,7 @@ acpi_parse_one_drhd(struct acpi_dmar_ent - dev_scope_start = (void *)(drhd + 1); - dev_scope_end = ((void *)drhd) + header->length; - ret = acpi_parse_dev_scope(dev_scope_start, dev_scope_end, -- dmaru, DMAR_TYPE, &igd); -- -- if ( igd ) -- igd_drhd_address = dmaru->address; -+ dmaru, DMAR_TYPE); - - if ( dmaru->include_all ) - { -@@ -504,7 +507,7 @@ acpi_parse_one_rmrr(struct acpi_dmar_ent - struct acpi_rmrr_unit *rmrru; - void *dev_scope_start, *dev_scope_end; - u64 base_addr = rmrr->base_address, end_addr = rmrr->end_address; -- int ret, igd = 0; -+ int ret; - - if ( (ret = acpi_dmar_check_length(header, sizeof(*rmrr))) != 0 ) - return ret; -@@ -536,7 +539,7 @@ acpi_parse_one_rmrr(struct acpi_dmar_ent - dev_scope_start = (void *)(rmrr + 1); - dev_scope_end = ((void *)rmrr) + header->length; - ret = acpi_parse_dev_scope(dev_scope_start, dev_scope_end, -- rmrru, RMRR_TYPE, &igd); -+ rmrru, RMRR_TYPE); - - if ( ret || (rmrru->scope.devices_cnt == 0) ) - xfree(rmrru); -@@ -601,7 +604,7 @@ acpi_parse_one_atsr(struct acpi_dmar_ent - { - struct acpi_table_atsr *atsr = (struct acpi_table_atsr *)header; - struct acpi_atsr_unit *atsru; -- int ret, igd = 0; -+ int ret; - static int all_ports; - void *dev_scope_start, *dev_scope_end; - -@@ -622,7 +625,7 @@ acpi_parse_one_atsr(struct acpi_dmar_ent - dev_scope_start = (void *)(atsr + 1); - dev_scope_end = ((void *)atsr) + header->length; - ret = acpi_parse_dev_scope(dev_scope_start, dev_scope_end, -- atsru, ATSR_TYPE, &igd); -+ atsru, ATSR_TYPE); - } - else - { ---- a/xen/drivers/passthrough/vtd/extern.h -+++ b/xen/drivers/passthrough/vtd/extern.h -@@ -26,6 +26,7 @@ - - extern int qinval_enabled; - extern int ats_enabled; -+extern bool_t rwbf_quirk; - - void print_iommu_regs(struct acpi_drhd_unit *drhd); - void print_vtd_entries(struct iommu *iommu, int bus, int devfn, u64 gmfn); -@@ -35,6 +36,12 @@ int enable_qinval(struct iommu *iommu); - void disable_qinval(struct iommu *iommu); - int enable_intremap(struct iommu *iommu, int eim); - void disable_intremap(struct iommu *iommu); -+ -+void iommu_flush_cache_entry(void *addr, unsigned int size); -+void iommu_flush_cache_page(void *addr, unsigned long npages); -+int iommu_alloc(struct acpi_drhd_unit *drhd); -+void iommu_free(struct acpi_drhd_unit *drhd); -+ - int queue_invalidate_context(struct iommu *iommu, - u16 did, u16 source_id, u8 function_mask, u8 granu); - int queue_invalidate_iotlb(struct iommu *iommu, -@@ -44,19 +51,41 @@ int queue_invalidate_iec(struct iommu *i - int invalidate_sync(struct iommu *iommu); - int iommu_flush_iec_global(struct iommu *iommu); - int iommu_flush_iec_index(struct iommu *iommu, u8 im, u16 iidx); -+void clear_fault_bits(struct iommu *iommu); -+ - struct iommu * ioapic_to_iommu(unsigned int apic_id); - struct acpi_drhd_unit * ioapic_to_drhd(unsigned int apic_id); - struct acpi_drhd_unit * iommu_to_drhd(struct iommu *iommu); - struct acpi_rhsa_unit * drhd_to_rhsa(struct acpi_drhd_unit *drhd); --void clear_fault_bits(struct iommu *iommu); -+struct acpi_drhd_unit * find_ats_dev_drhd(struct iommu *iommu); -+ - int ats_device(int seg, int bus, int devfn); - int enable_ats_device(int seg, int bus, int devfn); - int disable_ats_device(int seg, int bus, int devfn); - int invalidate_ats_tcs(struct iommu *iommu); -+ - int qinval_device_iotlb(struct iommu *iommu, - u32 max_invs_pend, u16 sid, u16 size, u64 addr); - int dev_invalidate_iotlb(struct iommu *iommu, u16 did, - u64 addr, unsigned int size_order, u64 type); --struct acpi_drhd_unit * find_ats_dev_drhd(struct iommu *iommu); -+ -+unsigned int get_cache_line_size(void); -+void cacheline_flush(char *); -+void flush_all_cache(void); -+ -+u64 alloc_pgtable_maddr(struct acpi_drhd_unit *drhd, unsigned long npages); -+void free_pgtable_maddr(u64 maddr); -+void *map_vtd_domain_page(u64 maddr); -+void unmap_vtd_domain_page(void *va); -+int domain_context_mapping_one(struct domain *domain, struct iommu *iommu, -+ u8 bus, u8 devfn); -+int domain_context_unmap_one(struct domain *domain, struct iommu *iommu, -+ u8 bus, u8 devfn); -+ -+int is_igd_vt_enabled_quirk(void); -+void __init platform_quirks_init(void); -+void vtd_ops_preamble_quirk(struct iommu* iommu); -+void vtd_ops_postamble_quirk(struct iommu* iommu); -+void me_wifi_quirk(struct domain *domain, u8 bus, u8 devfn, int map); - - #endif // _VTD_EXTERN_H_ ---- a/xen/drivers/passthrough/vtd/iommu.c -+++ b/xen/drivers/passthrough/vtd/iommu.c -@@ -43,7 +43,6 @@ - #endif - - int nr_iommus; --static bool_t rwbf_quirk; - - static void setup_dom0_devices(struct domain *d); - static void setup_dom0_rmrr(struct domain *d); -@@ -481,16 +480,36 @@ static int inline iommu_flush_iotlb_glob - int flush_non_present_entry, int flush_dev_iotlb) - { - struct iommu_flush *flush = iommu_get_flush(iommu); -- return flush->iotlb(iommu, 0, 0, 0, DMA_TLB_GLOBAL_FLUSH, -+ int status; -+ -+ /* apply platform specific errata workarounds */ -+ vtd_ops_preamble_quirk(iommu); -+ -+ status = flush->iotlb(iommu, 0, 0, 0, DMA_TLB_GLOBAL_FLUSH, - flush_non_present_entry, flush_dev_iotlb); -+ -+ /* undo platform specific errata workarounds */ -+ vtd_ops_postamble_quirk(iommu); -+ -+ return status; - } - - static int inline iommu_flush_iotlb_dsi(struct iommu *iommu, u16 did, - int flush_non_present_entry, int flush_dev_iotlb) - { - struct iommu_flush *flush = iommu_get_flush(iommu); -- return flush->iotlb(iommu, did, 0, 0, DMA_TLB_DSI_FLUSH, -+ int status; -+ -+ /* apply platform specific errata workarounds */ -+ vtd_ops_preamble_quirk(iommu); -+ -+ status = flush->iotlb(iommu, did, 0, 0, DMA_TLB_DSI_FLUSH, - flush_non_present_entry, flush_dev_iotlb); -+ -+ /* undo platform specific errata workarounds */ -+ vtd_ops_postamble_quirk(iommu); -+ -+ return status; - } - - static int inline get_alignment(u64 base, unsigned int size) -@@ -514,6 +533,7 @@ static int inline iommu_flush_iotlb_psi( - { - unsigned int align; - struct iommu_flush *flush = iommu_get_flush(iommu); -+ int status; - - ASSERT(!(addr & (~PAGE_MASK_4K))); - ASSERT(pages > 0); -@@ -534,8 +554,16 @@ static int inline iommu_flush_iotlb_psi( - addr >>= PAGE_SHIFT_4K + align; - addr <<= PAGE_SHIFT_4K + align; - -- return flush->iotlb(iommu, did, addr, align, DMA_TLB_PSI_FLUSH, -+ /* apply platform specific errata workarounds */ -+ vtd_ops_preamble_quirk(iommu); -+ -+ status = flush->iotlb(iommu, did, addr, align, DMA_TLB_PSI_FLUSH, - flush_non_present_entry, flush_dev_iotlb); -+ -+ /* undo platform specific errata workarounds */ -+ vtd_ops_postamble_quirk(iommu); -+ -+ return status; - } - - static void iommu_flush_all(void) -@@ -688,24 +716,13 @@ static int iommu_set_root_entry(struct i - return 0; - } - --#define GGC 0x52 --#define GGC_MEMORY_VT_ENABLED (0x8 << 8) --static int is_igd_vt_enabled(void) --{ -- unsigned short ggc; -- -- /* integrated graphics on Intel platforms is located at 0:2.0 */ -- ggc = pci_conf_read16(0, 2, 0, GGC); -- return ( ggc & GGC_MEMORY_VT_ENABLED ? 1 : 0 ); --} -- - static void iommu_enable_translation(struct acpi_drhd_unit *drhd) - { - u32 sts; - unsigned long flags; - struct iommu *iommu = drhd->iommu; - -- if ( !is_igd_vt_enabled() && is_igd_drhd(drhd) ) -+ if ( is_igd_drhd(drhd) && !is_igd_vt_enabled_quirk() ) - { - if ( force_iommu ) - panic("BIOS did not enable IGD for VT properly, crash Xen for security purpose!\n"); -@@ -717,6 +734,9 @@ static void iommu_enable_translation(str - } - } - -+ /* apply platform specific errata workarounds */ -+ vtd_ops_preamble_quirk(iommu); -+ - if ( iommu_verbose ) - dprintk(VTDPREFIX, - "iommu_enable_translation: iommu->reg = %p\n", iommu->reg); -@@ -729,6 +749,9 @@ static void iommu_enable_translation(str - (sts & DMA_GSTS_TES), sts); - spin_unlock_irqrestore(&iommu->register_lock, flags); - -+ /* undo platform specific errata workarounds */ -+ vtd_ops_postamble_quirk(iommu); -+ - /* Disable PMRs when VT-d engine takes effect per spec definition */ - disable_pmr(iommu); - } -@@ -738,6 +761,9 @@ static void iommu_disable_translation(st - u32 sts; - unsigned long flags; - -+ /* apply platform specific errata workarounds */ -+ vtd_ops_preamble_quirk(iommu); -+ - spin_lock_irqsave(&iommu->register_lock, flags); - sts = dmar_readl(iommu->reg, DMAR_GSTS_REG); - dmar_writel(iommu->reg, DMAR_GCMD_REG, sts & (~DMA_GCMD_TE)); -@@ -746,6 +772,9 @@ static void iommu_disable_translation(st - IOMMU_WAIT_OP(iommu, DMAR_GSTS_REG, dmar_readl, - !(sts & DMA_GSTS_TES), sts); - spin_unlock_irqrestore(&iommu->register_lock, flags); -+ -+ /* undo platform specific errata workarounds */ -+ vtd_ops_postamble_quirk(iommu); - } - - enum faulttype { -@@ -1089,6 +1118,7 @@ int __init iommu_alloc(struct acpi_drhd_ - xfree(iommu); - return -ENOMEM; - } -+ iommu->intel->drhd = drhd; - - iommu->reg = map_to_nocache_virt(nr_iommus, drhd->address); - iommu->index = nr_iommus++; -@@ -1221,7 +1251,7 @@ static void intel_iommu_dom0_init(struct - } - } - --static int domain_context_mapping_one( -+int domain_context_mapping_one( - struct domain *domain, - struct iommu *iommu, - u8 bus, u8 devfn) -@@ -1324,6 +1354,8 @@ static int domain_context_mapping_one( - - unmap_vtd_domain_page(context_entries); - -+ me_wifi_quirk(domain, bus, devfn, MAP_ME_PHANTOM_FUNC); -+ - return 0; - } - -@@ -1398,7 +1430,7 @@ static int domain_context_mapping(struct - return ret; - } - --static int domain_context_unmap_one( -+int domain_context_unmap_one( - struct domain *domain, - struct iommu *iommu, - u8 bus, u8 devfn) -@@ -1446,6 +1478,8 @@ static int domain_context_unmap_one( - spin_unlock(&iommu->lock); - unmap_vtd_domain_page(context_entries); - -+ me_wifi_quirk(domain, bus, devfn, UNMAP_ME_PHANTOM_FUNC); -+ - return 0; - } - -@@ -1945,19 +1979,6 @@ static void setup_dom0_rmrr(struct domai - spin_unlock(&pcidevs_lock); - } - --static void platform_quirks(void) --{ -- u32 id; -- -- /* Mobile 4 Series Chipset neglects to set RWBF capability. */ -- id = pci_conf_read32(0, 0, 0, 0); -- if ( id == 0x2a408086 ) -- { -- dprintk(XENLOG_INFO VTDPREFIX, "DMAR: Forcing write-buffer flush\n"); -- rwbf_quirk = 1; -- } --} -- - int intel_vtd_setup(void) - { - struct acpi_drhd_unit *drhd; -@@ -1966,7 +1987,7 @@ int intel_vtd_setup(void) - if ( list_empty(&acpi_drhd_units) ) - return -ENODEV; - -- platform_quirks(); -+ platform_quirks_init(); - - irq_to_iommu = xmalloc_array(struct iommu*, nr_irqs); - BUG_ON(!irq_to_iommu); ---- a/xen/drivers/passthrough/vtd/iommu.h -+++ b/xen/drivers/passthrough/vtd/iommu.h -@@ -501,6 +501,7 @@ struct intel_iommu { - struct qi_ctrl qi_ctrl; - struct ir_ctrl ir_ctrl; - struct iommu_flush flush; -+ struct acpi_drhd_unit *drhd; - }; - - #endif ---- /dev/null -+++ b/xen/drivers/passthrough/vtd/quirks.c -@@ -0,0 +1,263 @@ -+/* -+ * Copyright (c) 2010, Intel Corporation. -+ * -+ * This program is free software; you can redistribute it and/or modify it -+ * under the terms and conditions of the GNU General Public License, -+ * version 2, as published by the Free Software Foundation. -+ * -+ * This program is distributed in the hope 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 program; if not, write to the Free Software Foundation, Inc., 59 Temple -+ * Place - Suite 330, Boston, MA 02111-1307 USA. -+ * -+ * Author: Allen Kay -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include "iommu.h" -+#include "dmar.h" -+#include "extern.h" -+#include "vtd.h" -+ -+#define IOH_DEV 0 -+#define IGD_DEV 2 -+ -+#define IGD_BAR_MASK 0xFFFFFFFFFFFF0000 -+#define GGC 0x52 -+#define GGC_MEMORY_VT_ENABLED (0x8 << 8) -+ -+#define IS_CTG(id) (id == 0x2a408086) -+#define IS_ILK(id) (id == 0x00408086 || id == 0x00448086 || id== 0x00628086 || id == 0x006A8086) -+#define IS_CPT(id) (id == 0x01008086 || id == 0x01048086) -+ -+u32 ioh_id; -+u32 igd_id; -+bool_t rwbf_quirk; -+static int is_cantiga_b3; -+static u8 *igd_reg_va; -+ -+/* -+ * QUIRK to workaround Xen boot issue on Calpella/Ironlake OEM BIOS -+ * not enabling VT-d properly in IGD. The workaround is to not enabling -+ * IGD VT-d translation if VT is not enabled in IGD. -+ */ -+int is_igd_vt_enabled_quirk(void) -+{ -+ u16 ggc; -+ -+ if ( !IS_ILK(ioh_id) ) -+ return 1; -+ -+ /* integrated graphics on Intel platforms is located at 0:2.0 */ -+ ggc = pci_conf_read16(0, IGD_DEV, 0, GGC); -+ return ( ggc & GGC_MEMORY_VT_ENABLED ? 1 : 0 ); -+} -+ -+/* -+ * QUIRK to workaround cantiga VT-d buffer flush issue. -+ * The workaround is to force write buffer flush even if -+ * VT-d capability indicates it is not required. -+ */ -+static void cantiga_b3_errata_init(void) -+{ -+ u16 vid; -+ u8 did_hi, rid; -+ -+ vid = pci_conf_read16(0, IGD_DEV, 0, 0); -+ if ( vid != 0x8086 ) -+ return; -+ -+ did_hi = pci_conf_read8(0, IGD_DEV, 0, 3); -+ rid = pci_conf_read8(0, IGD_DEV, 0, 8); -+ -+ if ( (did_hi == 0x2A) && (rid == 0x7) ) -+ is_cantiga_b3 = 1; -+} -+ -+/* -+ * QUIRK to workaround Cantiga IGD VT-d low power errata. -+ * This errata impacts IGD assignment on Cantiga systems -+ * and can potentially cause VT-d operations to hang. -+ * The workaround is to access an IGD PCI config register -+ * to get IGD out of low power state before VT-d translation -+ * enable/disable and IOTLB flushes. -+ */ -+ -+/* -+ * map IGD MMIO+0x2000 page to allow Xen access to IGD 3D register. -+ */ -+static void map_igd_reg(void) -+{ -+ u64 igd_mmio, igd_reg; -+ -+ if ( !is_cantiga_b3 || igd_reg_va != NULL ) -+ return; -+ -+ /* get IGD mmio address in PCI BAR */ -+ igd_mmio = ((u64)pci_conf_read32(0, IGD_DEV, 0, 0x14) << 32) + -+ pci_conf_read32(0, IGD_DEV, 0, 0x10); -+ -+ /* offset of IGD regster we want to access is in 0x2000 range */ -+ igd_reg = (igd_mmio & IGD_BAR_MASK) + 0x2000; -+ -+ /* ioremap this physical page */ -+ set_fixmap_nocache(FIX_IGD_MMIO, igd_reg); -+ igd_reg_va = (u8 *)fix_to_virt(FIX_IGD_MMIO); -+} -+ -+/* -+ * force IGD to exit low power mode by accessing a IGD 3D regsiter. -+ */ -+static int cantiga_vtd_ops_preamble(struct iommu* iommu) -+{ -+ struct intel_iommu *intel = iommu->intel; -+ struct acpi_drhd_unit *drhd = intel ? intel->drhd : NULL; -+ -+ if ( !is_igd_drhd(drhd) || !is_cantiga_b3 ) -+ return 0; -+ -+ /* -+ * read IGD register at IGD MMIO + 0x20A4 to force IGD -+ * to exit low power state. Since map_igd_reg() -+ * already mapped page starting 0x2000, we just need to -+ * add page offset 0x0A4 to virtual address base. -+ */ -+ return ( *((volatile int *)(igd_reg_va + 0x0A4)) ); -+} -+ -+/* -+ * call before VT-d translation enable and IOTLB flush operations. -+ */ -+void vtd_ops_preamble_quirk(struct iommu* iommu) -+{ -+ cantiga_vtd_ops_preamble(iommu); -+} -+ -+/* -+ * call after VT-d translation enable and IOTLB flush operations. -+ */ -+void vtd_ops_postamble_quirk(struct iommu* iommu) -+{ -+ return; -+} -+ -+/* initialize platform identification flags */ -+void __init platform_quirks_init(void) -+{ -+ ioh_id = pci_conf_read32(0, IOH_DEV, 0, 0); -+ igd_id = pci_conf_read32(0, IGD_DEV, 0, 0); -+ -+ /* Mobile 4 Series Chipset neglects to set RWBF capability. */ -+ if ( ioh_id == 0x2a408086 ) -+ { -+ dprintk(XENLOG_INFO VTDPREFIX, "DMAR: Forcing write-buffer flush\n"); -+ rwbf_quirk = 1; -+ } -+ -+ /* initialize cantiga B3 identification */ -+ cantiga_b3_errata_init(); -+ -+ /* ioremap IGD MMIO+0x2000 page */ -+ map_igd_reg(); -+} -+ -+/* -+ * QUIRK to workaround wifi direct assignment issue. This issue -+ * impacts only cases where Intel integrated wifi device is directly -+ * is directly assigned to a guest. -+ * -+ * The workaround is to map ME phantom device 0:3.7 or 0:22.7 -+ * to the ME vt-d engine if detect the user is trying to directly -+ * assigning Intel integrated wifi device to a guest. -+ */ -+ -+static void map_me_phantom_function(struct domain *domain, u32 dev, int map) -+{ -+ struct acpi_drhd_unit *drhd; -+ struct pci_dev *pdev; -+ -+ /* find ME VT-d engine base on a real ME device */ -+ pdev = pci_get_pdev(0, PCI_DEVFN(dev, 0)); -+ drhd = acpi_find_matched_drhd_unit(pdev); -+ -+ /* map or unmap ME phantom function */ -+ if ( map ) -+ domain_context_mapping_one(domain, drhd->iommu, 0, -+ PCI_DEVFN(dev, 7)); -+ else -+ domain_context_unmap_one(domain, drhd->iommu, 0, -+ PCI_DEVFN(dev, 7)); -+} -+ -+void me_wifi_quirk(struct domain *domain, u8 bus, u8 devfn, int map) -+{ -+ u32 id; -+ -+ id = pci_conf_read32(0, 0, 0, 0); -+ if ( IS_CTG(id) ) -+ { -+ /* quit if ME does not exist */ -+ if ( pci_conf_read32(0, 3, 0, 0) == 0xffffffff ) -+ return; -+ -+ /* if device is WLAN device, map ME phantom device 0:3.7 */ -+ id = pci_conf_read32(bus, PCI_SLOT(devfn), PCI_FUNC(devfn), 0); -+ switch (id) -+ { -+ case 0x42328086: -+ case 0x42358086: -+ case 0x42368086: -+ case 0x42378086: -+ case 0x423a8086: -+ case 0x423b8086: -+ case 0x423c8086: -+ case 0x423d8086: -+ map_me_phantom_function(domain, 3, map); -+ break; -+ default: -+ break; -+ } -+ } -+ else if ( IS_ILK(id) || IS_CPT(id) ) -+ { -+ /* quit if ME does not exist */ -+ if ( pci_conf_read32(0, 22, 0, 0) == 0xffffffff ) -+ return; -+ -+ /* if device is WLAN device, map ME phantom device 0:22.7 */ -+ id = pci_conf_read32(bus, PCI_SLOT(devfn), PCI_FUNC(devfn), 0); -+ switch (id) -+ { -+ case 0x00878086: -+ case 0x00898086: -+ case 0x00828086: -+ case 0x00858086: -+ case 0x42388086: -+ case 0x422b8086: -+ case 0x422c8086: -+ map_me_phantom_function(domain, 22, map); -+ break; -+ default: -+ break; -+ } -+ -+ } -+} ---- a/xen/drivers/passthrough/vtd/vtd.h -+++ b/xen/drivers/passthrough/vtd/vtd.h -@@ -23,6 +23,9 @@ - - #include - -+#define MAP_ME_PHANTOM_FUNC 1 -+#define UNMAP_ME_PHANTOM_FUNC 0 -+ - /* Accomodate both IOAPIC and IOSAPIC. */ - struct IO_xAPIC_route_entry { - __u32 vector : 8, -@@ -97,18 +100,4 @@ struct msi_msg_remap_entry { - u32 data; /* msi message data */ - }; - --unsigned int get_cache_line_size(void); --void cacheline_flush(char *); --void flush_all_cache(void); --u64 alloc_pgtable_maddr(struct acpi_drhd_unit *drhd, unsigned long npages); --void free_pgtable_maddr(u64 maddr); --void *map_vtd_domain_page(u64 maddr); --void unmap_vtd_domain_page(void *va); -- --void iommu_flush_cache_entry(void *addr, unsigned int size); --void iommu_flush_cache_page(void *addr, unsigned long npages); -- --int iommu_alloc(struct acpi_drhd_unit *drhd); --void iommu_free(struct acpi_drhd_unit *drhd); -- - #endif // _VTD_H_ ---- a/xen/drivers/passthrough/vtd/x86/vtd.c -+++ b/xen/drivers/passthrough/vtd/x86/vtd.c -@@ -27,6 +27,7 @@ - #include "../iommu.h" - #include "../dmar.h" - #include "../vtd.h" -+#include "../extern.h" - - /* - * iommu_inclusive_mapping: when set, all memory below 4GB is included in dom0 ---- a/xen/include/asm-x86/fixmap.h -+++ b/xen/include/asm-x86/fixmap.h -@@ -52,6 +52,7 @@ enum fixed_addresses { - FIX_MSIX_IO_RESERV_BASE, - FIX_MSIX_IO_RESERV_END = FIX_MSIX_IO_RESERV_BASE + FIX_MSIX_MAX_PAGES -1, - FIX_TBOOT_MAP_ADDRESS, -+ FIX_IGD_MMIO, - __end_of_fixed_addresses - }; - diff --git a/22369-xend-pci-passthru-fix.patch b/22369-xend-pci-passthru-fix.patch deleted file mode 100644 index 40be35c..0000000 --- a/22369-xend-pci-passthru-fix.patch +++ /dev/null @@ -1,64 +0,0 @@ -# HG changeset patch -# User Jim Fehlig -# Date 1288301229 21600 -# Branch xend-pci -# Node ID 461b9d3a643a2c67c961d9fc468a804891f3770d -# Parent 28a16074681582f1209c9077f870ccf44927133e -Fix pci passthru in xend interface used by libvirt - -Attempting to define or create a domain whose XML config contains a -passthru PCI device fails with libvirt - -xen84: # cat win2k8r2.xml -... - - -
- - -... - -xen84: # virsh create ./win2k8r2.xml -error: Failed to create domain from ./win2k8r2.xml -error: POST operation failed: xend_post: error from xen daemon: - (xend.err "Error creating domain: 'key'") - -The PCI device config maintained by xend includes a 'key' field, which is -initialized by xm client when using that tool and traditional xen config -file. libvirt, which uses xend's sexpr-over-http interface (is that the -proper name for that interface??), does not initialize this field - and -shouldn't be expected to do so IMO. Clients should not be bothered with -xend's internal representation of a PCI device. - -This patch populates the 'key' field within xend if it is uninitialized, -similar to current initialization of 'uuid' field. The 'vdevfn' field -suffers a similar problem if not (optionally) specified by user. -AFAICT, the xm client initializes 'vdevfn' to 0x100 if not specified so -I've done the same here. - - Signed-off-by: Jim Fehlig - -Index: xen-4.0.2-testing/tools/python/xen/util/pci.py -=================================================================== ---- xen-4.0.2-testing.orig/tools/python/xen/util/pci.py -+++ xen-4.0.2-testing/tools/python/xen/util/pci.py -@@ -240,10 +240,16 @@ def pci_convert_sxp_to_dict(dev_sxp): - pci_dev_info = dict(pci_dev[1:]) - if 'opts' in pci_dev_info: - pci_dev_info['opts'] = pci_opts_list_from_sxp(pci_dev) -- # append uuid to each pci device that does't already have one. -+ # If necessary, initialize uuid, key, and vdevfn for each pci device - if not pci_dev_info.has_key('uuid'): -- dpci_uuid = pci_dev_info.get('uuid', uuid.createString()) -- pci_dev_info['uuid'] = dpci_uuid -+ pci_dev_info['uuid'] = uuid.createString() -+ if not pci_dev_info.has_key('key'): -+ pci_dev_info['key'] = "%02x:%02x.%x" % \ -+ (int(pci_dev_info['bus'], 16), -+ int(pci_dev_info['slot'], 16), -+ int(pci_dev_info['func'], 16)) -+ if not pci_dev_info.has_key('vdevfn'): -+ pci_dev_info['vdevfn'] = "0x%02x" % AUTO_PHP_SLOT - pci_devs.append(pci_dev_info) - dev_config['devs'] = pci_devs - diff --git a/22388-x2apic-panic.patch b/22388-x2apic-panic.patch deleted file mode 100644 index ab58647..0000000 --- a/22388-x2apic-panic.patch +++ /dev/null @@ -1,50 +0,0 @@ -# HG changeset patch -# User Keir Fraser -# Date 1289813498 0 -# Node ID 87f248de52304bc96a80dc093250fed0197f37e0 -# Parent 8af10bd7f2d0e9300f1bc68f7e2fb137fa839365 -x2apic: Remove a panic condition in enabling x2APIC - -Currently Xen triggers a panic if user disables VT-d by command line -while not disable x2APIC. This requires users to specify both -"iommu=0" and "x2apic=0" to disable VT-d if the platform supports -x2APIC. It's not user friendly. This patch removes the panic -condition. That's to say, don't require user to specify "x2apic=0" -when specify "iommu=0". As long as VT-d is not enabled (disabled in -BIOS or in command line), x2APIC won't be enabled naturally (x2APIC -depends on VT-d Interrupt remapping). - -Signed-off-by: Weidong Han - -Index: xen-4.0.2-testing/xen/arch/x86/apic.c -=================================================================== ---- xen-4.0.2-testing.orig/xen/arch/x86/apic.c -+++ xen-4.0.2-testing/xen/arch/x86/apic.c -@@ -1001,22 +1001,11 @@ static void enable_bsp_x2apic(void) - } - else - { -- if ( !iommu_enabled || !iommu_intremap || !iommu_qinval ) -- panic("Cannot enable x2APIC due to iommu or interrupt " -- "remapping or queued invalidation is disabled " -- "by command line!\n"); -- else -- { -- if ( x2apic_preenabled ) -- panic("x2APIC: already enabled by BIOS, but " -- "iommu_supports_eim fails\n"); -- else -- { -- printk("Not enable x2APIC due to " -- "iommu_supports_eim fails!\n"); -- return; -- } -- } -+ if ( x2apic_preenabled ) -+ panic("x2APIC: already enabled by BIOS, but " -+ "iommu_supports_eim failed!\n"); -+ printk("Not enabling x2APIC: depends oniommu_supports_eim\n"); -+ return; - } - } - diff --git a/22408-vpmu-nehalem.patch b/22408-vpmu-nehalem.patch deleted file mode 100644 index 5de623d..0000000 --- a/22408-vpmu-nehalem.patch +++ /dev/null @@ -1,21 +0,0 @@ -References: bnc#655438 - -# HG changeset patch -# User Keir Fraser -# Date 1290173202 0 -# Node ID b7ed352fa6100104374000cdbd845bbfc6478f08 -# Parent 437576a0f2026ded6dcc4b11558714dad1d1d042 -VPMU: Add the Intel CPU X7542 to the list of supported prcocessors - -Signed-off-by: Dietmar Hahn - ---- a/xen/arch/x86/hvm/vmx/vpmu.c -+++ b/xen/arch/x86/hvm/vmx/vpmu.c -@@ -96,6 +96,7 @@ void vpmu_initialise(struct vcpu *v) - case 23: - case 26: - case 29: -+ case 46: - vpmu->arch_vpmu_ops = &core2_vpmu_ops; - break; - } diff --git a/22431-p2m-remove-bug-check.patch b/22431-p2m-remove-bug-check.patch deleted file mode 100644 index 1797e2e..0000000 --- a/22431-p2m-remove-bug-check.patch +++ /dev/null @@ -1,25 +0,0 @@ -# HG changeset patch -# User Tim Deegan -# Date 1290594003 0 -# Node ID 79b71c77907b80772ee8cba0c5bbf8e444e61226 -# Parent e5c4e925e1bd15baeadc0817dcceb5fff54b8a74 -x86/mm: remove incorrect BUG_ON. -This BUG_ON tests a property of an effectively random PFN in the guest, -and is explicitly _not_ seeing the MFN that's known to be owned. - -Signed-off-by: Tim Deegan - -Index: xen-4.0.2-testing/xen/arch/x86/mm/p2m.c -=================================================================== ---- xen-4.0.2-testing.orig/xen/arch/x86/mm/p2m.c -+++ xen-4.0.2-testing/xen/arch/x86/mm/p2m.c -@@ -2186,9 +2186,6 @@ guest_physmap_add_entry(struct domain *d - P2M_DEBUG("aliased! mfn=%#lx, old gfn=%#lx, new gfn=%#lx\n", - mfn + i, ogfn, gfn + i); - omfn = gfn_to_mfn_query(d, ogfn, &ot); -- /* If we get here, we know the local domain owns the page, -- so it can't have been grant mapped in. */ -- BUG_ON( p2m_is_grant(ot) ); - if ( p2m_is_ram(ot) ) - { - ASSERT(mfn_valid(omfn)); diff --git a/22475-x2apic-cleanup.patch b/22475-x2apic-cleanup.patch deleted file mode 100644 index 46588d0..0000000 --- a/22475-x2apic-cleanup.patch +++ /dev/null @@ -1,496 +0,0 @@ -# HG changeset patch -# User Keir Fraser -# Date 1291922374 0 -# Node ID d9fc83a64a82624e24876250dd88b2cd9528d266 -# Parent 49d2aa5cee4ecc2411d8d638e4ee32c10e9b2761 -x86: x2apic: Large cleanup -References: bnc#656369, bnc#658704 - -Signed-off-by: Keir Fraser - -Index: xen-4.0.2-testing/xen/arch/x86/apic.c -=================================================================== ---- xen-4.0.2-testing.orig/xen/arch/x86/apic.c -+++ xen-4.0.2-testing/xen/arch/x86/apic.c -@@ -67,12 +67,12 @@ static int enable_local_apic __initdata - */ - int apic_verbosity; - -+static int opt_x2apic = 1; -+boolean_param("x2apic", opt_x2apic); -+ - int x2apic_enabled __read_mostly = 0; - int directed_eoi_enabled __read_mostly = 0; - --/* x2APIC is enabled in BIOS */ --static int x2apic_preenabled; -- - /* - * The following vectors are part of the Linux architecture, there - * is no hardware IRQ pin equivalent for them, they are triggered -@@ -945,30 +945,24 @@ no_apic: - return -1; - } - --void check_x2apic_preenabled(void) -+void x2apic_setup(void) - { -+ struct IO_APIC_route_entry **ioapic_entries = NULL; - u32 lo, hi; - -- if ( !x2apic_is_available() ) -- return; -- -- rdmsr(MSR_IA32_APICBASE, lo, hi); -- if ( lo & MSR_IA32_APICBASE_EXTD ) -+ if ( smp_processor_id() != 0 ) - { -- printk("x2APIC mode is already enabled by BIOS.\n"); -- x2apic_preenabled = 1; -- x2apic_enabled = 1; -+ if ( x2apic_enabled ) -+ __enable_x2apic(); -+ return; - } --} - --static void enable_bsp_x2apic(void) --{ -- struct IO_APIC_route_entry **ioapic_entries = NULL; -- const struct genapic *x2apic_genapic = NULL; -- -- ASSERT(smp_processor_id() == 0); -+ if ( !cpu_has_x2apic ) -+ return; - -- if ( x2apic_preenabled ) -+ /* Check whether x2apic mode was already enabled by the BIOS. */ -+ rdmsr(MSR_IA32_APICBASE, lo, hi); -+ if ( lo & MSR_IA32_APICBASE_EXTD ) - { - /* - * Interrupt remapping should be also enabled by BIOS when -@@ -978,39 +972,33 @@ static void enable_bsp_x2apic(void) - if ( !intremap_enabled() ) - panic("Interrupt remapping is not enabled by BIOS while " - "x2APIC is already enabled by BIOS!\n"); -+ -+ printk("x2APIC mode is already enabled by BIOS.\n"); -+ x2apic_enabled = 1; - } - -- x2apic_genapic = apic_x2apic_probe(); -- if ( x2apic_genapic ) -- genapic = x2apic_genapic; -- else -+ if ( !opt_x2apic ) - { -- if ( x2apic_cmdline_disable() ) -+ if ( !x2apic_enabled ) - { -- if ( x2apic_preenabled ) -- { -- /* Ignore x2apic=0, and set default x2apic mode */ -- genapic = &apic_x2apic_cluster; -- printk("x2APIC: already enabled by BIOS, ignore x2apic=0.\n"); -- } -- else -- { -- printk("Not enable x2APIC due to x2apic=0 is set.\n"); -- return; -- } -+ printk("Not enabling x2APIC: disabled by cmdline.\n"); -+ return; - } -- else -+ printk("x2APIC: Already enabled by BIOS: Ignoring cmdline disable.\n"); -+ } -+ -+ if ( !iommu_supports_eim() ) -+ { -+ if ( !x2apic_enabled ) - { -- if ( x2apic_preenabled ) -- panic("x2APIC: already enabled by BIOS, but " -- "iommu_supports_eim failed!\n"); -- printk("Not enabling x2APIC: depends oniommu_supports_eim\n"); -+ printk("Not enabling x2APIC: depends on iommu_supports_eim.\n"); - return; - } -+ panic("x2APIC: already enabled by BIOS, but " -+ "iommu_supports_eim failed!\n"); - } - -- ioapic_entries = alloc_ioapic_entries(); -- if ( !ioapic_entries ) -+ if ( (ioapic_entries = alloc_ioapic_entries()) == NULL ) - { - printk("Allocate ioapic_entries failed\n"); - goto out; -@@ -1032,13 +1020,13 @@ static void enable_bsp_x2apic(void) - goto restore_out; - } - -- x2apic_enabled = 1; -+ genapic = apic_x2apic_probe(); - printk("Switched to APIC driver %s.\n", genapic->name); - -- if ( !x2apic_preenabled ) -+ if ( !x2apic_enabled ) - { -+ x2apic_enabled = 1; - __enable_x2apic(); -- printk("x2APIC mode enabled.\n"); - } - - restore_out: -@@ -1050,24 +1038,6 @@ out: - free_ioapic_entries(ioapic_entries); - } - --static void enable_ap_x2apic(void) --{ -- ASSERT(smp_processor_id() != 0); -- -- /* APs only enable x2apic when BSP did so. */ -- BUG_ON(!x2apic_enabled); -- -- __enable_x2apic(); --} -- --void enable_x2apic(void) --{ -- if ( smp_processor_id() == 0 ) -- enable_bsp_x2apic(); -- else -- enable_ap_x2apic(); --} -- - void __init init_apic_mappings(void) - { - unsigned long apic_phys; -Index: xen-4.0.2-testing/xen/arch/x86/cpu/common.c -=================================================================== ---- xen-4.0.2-testing.orig/xen/arch/x86/cpu/common.c -+++ xen-4.0.2-testing/xen/arch/x86/cpu/common.c -@@ -250,8 +250,8 @@ static void __init early_cpu_detect(void - - c->x86 = 4; - if (c->cpuid_level >= 0x00000001) { -- u32 junk, tfms, cap0, misc; -- cpuid(0x00000001, &tfms, &misc, &junk, &cap0); -+ u32 cap4, tfms, cap0, misc; -+ cpuid(0x00000001, &tfms, &misc, &cap4, &cap0); - c->x86 = (tfms >> 8) & 15; - c->x86_model = (tfms >> 4) & 15; - if (c->x86 == 0xf) -@@ -260,9 +260,12 @@ static void __init early_cpu_detect(void - c->x86_model += ((tfms >> 16) & 0xF) << 4; - c->x86_mask = tfms & 15; - cap0 &= ~cleared_caps[0]; -+ cap4 &= ~cleared_caps[4]; - if (cap0 & (1<<19)) - c->x86_cache_alignment = ((misc >> 8) & 0xff) * 8; -- c->x86_capability[0] = cap0; /* Added for Xen bootstrap */ -+ /* Leaf 0x1 capabilities filled in early for Xen. */ -+ c->x86_capability[0] = cap0; -+ c->x86_capability[4] = cap4; - } - } - -Index: xen-4.0.2-testing/xen/arch/x86/genapic/x2apic.c -=================================================================== ---- xen-4.0.2-testing.orig/xen/arch/x86/genapic/x2apic.c -+++ xen-4.0.2-testing/xen/arch/x86/genapic/x2apic.c -@@ -23,89 +23,44 @@ - #include - #include - --static int x2apic = 1; --boolean_param("x2apic", x2apic); -- --static int x2apic_phys; /* By default we use logical cluster mode. */ -+static int x2apic_phys; /* By default we use logical cluster mode. */ - boolean_param("x2apic_phys", x2apic_phys); - --int x2apic_cmdline_disable(void) --{ -- return (x2apic == 0); --} -- --static int probe_x2apic_phys(void) -+static void init_apic_ldr_x2apic_phys(void) - { -- return x2apic && x2apic_phys && x2apic_is_available() && -- iommu_supports_eim(); - } - --static int probe_x2apic_cluster(void) --{ -- return x2apic && !x2apic_phys && x2apic_is_available() && -- iommu_supports_eim(); --} -- --const struct genapic apic_x2apic_phys = { -- APIC_INIT("x2apic_phys", probe_x2apic_phys), -- GENAPIC_X2APIC_PHYS --}; -- --const struct genapic apic_x2apic_cluster = { -- APIC_INIT("x2apic_cluster", probe_x2apic_cluster), -- GENAPIC_X2APIC_CLUSTER --}; -- --const struct genapic *apic_x2apic_probe(void) --{ -- if ( !x2apic || !x2apic_is_available() ) -- return NULL; -- -- if ( !iommu_supports_eim() ) -- return NULL; -- -- if ( x2apic_phys ) -- return &apic_x2apic_phys; -- else -- return &apic_x2apic_cluster; --} -- --void init_apic_ldr_x2apic_phys(void) --{ -- return; --} -- --void init_apic_ldr_x2apic_cluster(void) -+static void init_apic_ldr_x2apic_cluster(void) - { - int cpu = smp_processor_id(); - cpu_2_logical_apicid[cpu] = apic_read(APIC_LDR); - } --void clustered_apic_check_x2apic(void) -+ -+static void clustered_apic_check_x2apic(void) - { -- return; - } - --cpumask_t target_cpus_x2apic(void) -+static cpumask_t target_cpus_x2apic(void) - { - return cpu_online_map; - } - --cpumask_t vector_allocation_domain_x2apic(int cpu) -+static cpumask_t vector_allocation_domain_x2apic(int cpu) - { - return cpumask_of_cpu(cpu); - } - --unsigned int cpu_mask_to_apicid_x2apic_phys(cpumask_t cpumask) -+static unsigned int cpu_mask_to_apicid_x2apic_phys(cpumask_t cpumask) - { - return cpu_physical_id(first_cpu(cpumask)); - } - --unsigned int cpu_mask_to_apicid_x2apic_cluster(cpumask_t cpumask) -+static unsigned int cpu_mask_to_apicid_x2apic_cluster(cpumask_t cpumask) - { - return cpu_2_logical_apicid[first_cpu(cpumask)]; - } - --void send_IPI_mask_x2apic_phys(const cpumask_t *cpumask, int vector) -+static void send_IPI_mask_x2apic_phys(const cpumask_t *cpumask, int vector) - { - unsigned int cpu, cfg; - unsigned long flags; -@@ -132,7 +87,7 @@ void send_IPI_mask_x2apic_phys(const cpu - local_irq_restore(flags); - } - --void send_IPI_mask_x2apic_cluster(const cpumask_t *cpumask, int vector) -+static void send_IPI_mask_x2apic_cluster(const cpumask_t *cpumask, int vector) - { - unsigned int cpu, cfg; - unsigned long flags; -@@ -148,3 +103,34 @@ void send_IPI_mask_x2apic_cluster(const - - local_irq_restore(flags); - } -+ -+static const struct genapic apic_x2apic_phys = { -+ APIC_INIT("x2apic_phys", NULL), -+ .int_delivery_mode = dest_Fixed, -+ .int_dest_mode = 0 /* physical delivery */, -+ .init_apic_ldr = init_apic_ldr_x2apic_phys, -+ .clustered_apic_check = clustered_apic_check_x2apic, -+ .target_cpus = target_cpus_x2apic, -+ .vector_allocation_domain = vector_allocation_domain_x2apic, -+ .cpu_mask_to_apicid = cpu_mask_to_apicid_x2apic_phys, -+ .send_IPI_mask = send_IPI_mask_x2apic_phys, -+ .send_IPI_self = send_IPI_self_x2apic -+}; -+ -+static const struct genapic apic_x2apic_cluster = { -+ APIC_INIT("x2apic_cluster", NULL), -+ .int_delivery_mode = dest_LowestPrio, -+ .int_dest_mode = 1 /* logical delivery */, -+ .init_apic_ldr = init_apic_ldr_x2apic_cluster, -+ .clustered_apic_check = clustered_apic_check_x2apic, -+ .target_cpus = target_cpus_x2apic, -+ .vector_allocation_domain = vector_allocation_domain_x2apic, -+ .cpu_mask_to_apicid = cpu_mask_to_apicid_x2apic_cluster, -+ .send_IPI_mask = send_IPI_mask_x2apic_cluster, -+ .send_IPI_self = send_IPI_self_x2apic -+}; -+ -+const struct genapic *apic_x2apic_probe(void) -+{ -+ return x2apic_phys ? &apic_x2apic_phys : &apic_x2apic_cluster; -+} -Index: xen-4.0.2-testing/xen/arch/x86/setup.c -=================================================================== ---- xen-4.0.2-testing.orig/xen/arch/x86/setup.c -+++ xen-4.0.2-testing/xen/arch/x86/setup.c -@@ -1006,9 +1006,6 @@ void __init __start_xen(unsigned long mb - - tboot_probe(); - -- /* Check if x2APIC is already enabled in BIOS */ -- check_x2apic_preenabled(); -- - /* Unmap the first page of CPU0's stack. */ - memguard_guard_stack(cpu0_stack); - -@@ -1039,8 +1036,7 @@ void __init __start_xen(unsigned long mb - - init_apic_mappings(); - -- if ( x2apic_is_available() ) -- enable_x2apic(); -+ x2apic_setup(); - - percpu_free_unused_areas(); - -Index: xen-4.0.2-testing/xen/arch/x86/smpboot.c -=================================================================== ---- xen-4.0.2-testing.orig/xen/arch/x86/smpboot.c -+++ xen-4.0.2-testing/xen/arch/x86/smpboot.c -@@ -325,8 +325,7 @@ void __devinit smp_callin(void) - */ - wait_for_init_deassert(&init_deasserted); - -- if ( x2apic_enabled ) -- enable_x2apic(); -+ x2apic_setup(); - - /* - * (This works even if the APIC is not enabled.) -Index: xen-4.0.2-testing/xen/drivers/passthrough/vtd/intremap.c -=================================================================== ---- xen-4.0.2-testing.orig/xen/drivers/passthrough/vtd/intremap.c -+++ xen-4.0.2-testing/xen/drivers/passthrough/vtd/intremap.c -@@ -129,15 +129,10 @@ int iommu_supports_eim(void) - struct acpi_drhd_unit *drhd; - int apic; - -- if ( !iommu_enabled || !iommu_qinval || !iommu_intremap ) -+ if ( !iommu_enabled || !iommu_qinval || !iommu_intremap || -+ list_empty(&acpi_drhd_units) ) - return 0; - -- if ( list_empty(&acpi_drhd_units) ) -- { -- dprintk(XENLOG_WARNING VTDPREFIX, "VT-d is not supported\n"); -- return 0; -- } -- - /* We MUST have a DRHD unit for each IOAPIC. */ - for ( apic = 0; apic < nr_ioapics; apic++ ) - if ( !ioapic_to_drhd(IO_APIC_ID(apic)) ) -Index: xen-4.0.2-testing/xen/include/asm-x86/apic.h -=================================================================== ---- xen-4.0.2-testing.orig/xen/include/asm-x86/apic.h -+++ xen-4.0.2-testing/xen/include/asm-x86/apic.h -@@ -25,21 +25,8 @@ extern int apic_verbosity; - extern int x2apic_enabled; - extern int directed_eoi_enabled; - --extern void check_x2apic_preenabled(void); --extern int x2apic_cmdline_disable(void); --extern void enable_x2apic(void); -- --static __inline int x2apic_is_available(void) --{ -- unsigned int op = 1, eax, ecx; -- -- asm ( "cpuid" -- : "=a" (eax), "=c" (ecx) -- : "0" (op) -- : "bx", "dx" ); -- -- return (ecx & (1U << 21)); --} -+void x2apic_setup(void); -+const struct genapic *apic_x2apic_probe(void); - - /* - * Define the default level of output to be very little -Index: xen-4.0.2-testing/xen/include/asm-x86/genapic.h -=================================================================== ---- xen-4.0.2-testing.orig/xen/include/asm-x86/genapic.h -+++ xen-4.0.2-testing/xen/include/asm-x86/genapic.h -@@ -49,8 +49,6 @@ struct genapic { - APICFUNC(acpi_madt_oem_check) - - extern const struct genapic *genapic; --extern const struct genapic apic_x2apic_phys; --extern const struct genapic apic_x2apic_cluster; - - void init_apic_ldr_flat(void); - void clustered_apic_check_flat(void); -@@ -70,39 +68,6 @@ cpumask_t vector_allocation_domain_flat( - .send_IPI_mask = send_IPI_mask_flat, \ - .send_IPI_self = send_IPI_self_flat - --const struct genapic *apic_x2apic_probe(void); --void init_apic_ldr_x2apic_phys(void); --void init_apic_ldr_x2apic_cluster(void); --void clustered_apic_check_x2apic(void); --cpumask_t target_cpus_x2apic(void); --unsigned int cpu_mask_to_apicid_x2apic_phys(cpumask_t cpumask); --unsigned int cpu_mask_to_apicid_x2apic_cluster(cpumask_t cpumask); --void send_IPI_mask_x2apic_phys(const cpumask_t *mask, int vector); --void send_IPI_mask_x2apic_cluster(const cpumask_t *mask, int vector); --void send_IPI_self_x2apic(int vector); --cpumask_t vector_allocation_domain_x2apic(int cpu); --#define GENAPIC_X2APIC_PHYS \ -- .int_delivery_mode = dest_Fixed, \ -- .int_dest_mode = 0 /* physical delivery */, \ -- .init_apic_ldr = init_apic_ldr_x2apic_phys, \ -- .clustered_apic_check = clustered_apic_check_x2apic, \ -- .target_cpus = target_cpus_x2apic, \ -- .vector_allocation_domain = vector_allocation_domain_x2apic, \ -- .cpu_mask_to_apicid = cpu_mask_to_apicid_x2apic_phys, \ -- .send_IPI_mask = send_IPI_mask_x2apic_phys, \ -- .send_IPI_self = send_IPI_self_x2apic -- --#define GENAPIC_X2APIC_CLUSTER \ -- .int_delivery_mode = dest_LowestPrio, \ -- .int_dest_mode = 1 /* logical delivery */, \ -- .init_apic_ldr = init_apic_ldr_x2apic_cluster, \ -- .clustered_apic_check = clustered_apic_check_x2apic, \ -- .target_cpus = target_cpus_x2apic, \ -- .vector_allocation_domain = vector_allocation_domain_x2apic, \ -- .cpu_mask_to_apicid = cpu_mask_to_apicid_x2apic_cluster, \ -- .send_IPI_mask = send_IPI_mask_x2apic_cluster, \ -- .send_IPI_self = send_IPI_self_x2apic -- - void init_apic_ldr_phys(void); - void clustered_apic_check_phys(void); - cpumask_t target_cpus_phys(void); -@@ -121,4 +86,6 @@ cpumask_t vector_allocation_domain_phys( - .send_IPI_mask = send_IPI_mask_phys, \ - .send_IPI_self = send_IPI_self_phys - -+void send_IPI_self_x2apic(int vector); -+ - #endif diff --git a/22484-vlapic-tmcct-periodic.patch b/22484-vlapic-tmcct-periodic.patch deleted file mode 100644 index bff15e5..0000000 --- a/22484-vlapic-tmcct-periodic.patch +++ /dev/null @@ -1,36 +0,0 @@ -# HG changeset patch -# User Keir Fraser -# Date 1291999745 0 -# Node ID 3b3fce9050b9b14f3a11123f6943998413ea7e7e -# Parent 901c118b363e978566775f9d118b4f2f15598212 -hvm vlapic: Fix tmcct read logic when in periodic mode. - -Signed-off-by: Keir Fraser - -Index: xen-4.0.2-testing/xen/arch/x86/hvm/vlapic.c -=================================================================== ---- xen-4.0.2-testing.orig/xen/arch/x86/hvm/vlapic.c -+++ xen-4.0.2-testing/xen/arch/x86/hvm/vlapic.c -@@ -428,12 +428,19 @@ int vlapic_ipi( - static uint32_t vlapic_get_tmcct(struct vlapic *vlapic) - { - struct vcpu *v = current; -- uint32_t tmcct, tmict = vlapic_get_reg(vlapic, APIC_TMICT); -+ uint32_t tmcct = 0, tmict = vlapic_get_reg(vlapic, APIC_TMICT); - uint64_t counter_passed; - - counter_passed = ((hvm_get_guest_time(v) - vlapic->timer_last_update) -- / APIC_BUS_CYCLE_NS / vlapic->hw.timer_divisor); -- tmcct = tmict - counter_passed; -+ / (APIC_BUS_CYCLE_NS * vlapic->hw.timer_divisor)); -+ -+ if ( tmict != 0 ) -+ { -+ if ( vlapic_lvtt_period(vlapic) ) -+ counter_passed %= tmict; -+ if ( counter_passed < tmict ) -+ tmcct = tmict - counter_passed; -+ } - - HVM_DBG_LOG(DBG_LEVEL_VLAPIC_TIMER, - "timer initial count %d, timer current count %d, " diff --git a/22504-iommu-dom0-holes.patch b/22504-iommu-dom0-holes.patch deleted file mode 100644 index 1889b6a..0000000 --- a/22504-iommu-dom0-holes.patch +++ /dev/null @@ -1,102 +0,0 @@ -# HG changeset patch -# User Keir Fraser -# Date 1292320377 0 -# Node ID fd4cbfbbd83e6091a343844eae1da1468f54b72b -# Parent ab785e37499c8cdadd1fd5e4ab1bfbbacebf358b -x86/iommu: don't map RAM holes above 4G -References: bnc#658163 - -Matching the comment in iommu_set_dom0_mapping(), map only actual RAM -from the address range starting at 4G. It's not clear though whether -that comment is actually correct (which is why I'm sending this as -RFC), but it is certain that on systems with sparse physical memory -map we're currently wasting a potentially significant amount of memory -for setting up IOMMU page tables that will never be used. - -The main question is what happens for MMIO ranges living above 4G. Of -course, the same issue would currently exist for any such ranges -sitting beyond the end of RAM. - -Signed-off-by: Jan Beulich - ---- a/xen/arch/x86/domain_build.c -+++ b/xen/arch/x86/domain_build.c -@@ -194,7 +194,7 @@ static unsigned long __init compute_dom0 - unsigned int s; - - for ( s = 9; s < BITS_PER_LONG; s += 9 ) -- avail -= max_page >> s; -+ avail -= max_pdx >> s; - } - - /* ---- a/xen/drivers/passthrough/amd/pci_amd_iommu.c -+++ b/xen/drivers/passthrough/amd/pci_amd_iommu.c -@@ -239,8 +239,16 @@ static void amd_iommu_dom0_init(struct d - if ( !iommu_passthrough && !need_iommu(d) ) - { - /* Set up 1:1 page table for dom0 */ -- for ( i = 0; i < max_page; i++ ) -- amd_iommu_map_page(d, i, i, IOMMUF_readable|IOMMUF_writable); -+ for ( i = 0; i < max_pdx; i++ ) -+ { -+ unsigned long pfn = pdx_to_pfn(i); -+ -+ /* -+ * XXX Should we really map all non-RAM (above 4G)? Minimally -+ * a pfn_valid() check would seem desirable here. -+ */ -+ amd_iommu_map_page(d, pfn, pfn, IOMMUF_readable|IOMMUF_writable); -+ } - } - - amd_iommu_setup_dom0_devices(d); ---- a/xen/drivers/passthrough/vtd/x86/vtd.c -+++ b/xen/drivers/passthrough/vtd/x86/vtd.c -@@ -128,14 +128,14 @@ void hvm_dpci_isairq_eoi(struct domain * - - void iommu_set_dom0_mapping(struct domain *d) - { -- u64 i, j, tmp, max_pfn; -+ unsigned long i, j, tmp, top; - extern int xen_in_range(unsigned long mfn); - - BUG_ON(d->domain_id != 0); - -- max_pfn = max_t(u64, max_page, 0x100000000ull >> PAGE_SHIFT); -+ top = max(max_pdx, pfn_to_pdx(0xffffffffUL >> PAGE_SHIFT) + 1); - -- for ( i = 0; i < max_pfn; i++ ) -+ for ( i = 0; i < top; i++ ) - { - /* - * Set up 1:1 mapping for dom0. Default to use only conventional RAM -@@ -143,18 +143,23 @@ void iommu_set_dom0_mapping(struct domai - * inclusive mapping maps in everything below 4GB except unusable - * ranges. - */ -- if ( !page_is_ram_type(i, RAM_TYPE_CONVENTIONAL) && -- (!iommu_inclusive_mapping || -- page_is_ram_type(i, RAM_TYPE_UNUSABLE)) ) -+ unsigned long pfn = pdx_to_pfn(i); -+ -+ if ( pfn > (0xffffffffUL >> PAGE_SHIFT) ? -+ (!mfn_valid(pfn) || -+ !page_is_ram_type(pfn, RAM_TYPE_CONVENTIONAL)) : -+ iommu_inclusive_mapping ? -+ page_is_ram_type(pfn, RAM_TYPE_UNUSABLE) : -+ !page_is_ram_type(pfn, RAM_TYPE_CONVENTIONAL) ) - continue; - - /* Exclude Xen bits */ -- if ( xen_in_range(i) ) -+ if ( xen_in_range(pfn) ) - continue; - - tmp = 1 << (PAGE_SHIFT - PAGE_SHIFT_4K); - for ( j = 0; j < tmp; j++ ) -- iommu_map_page(d, (i*tmp+j), (i*tmp+j), -+ iommu_map_page(d, pfn * tmp + j, pfn * tmp + j, - IOMMUF_readable|IOMMUF_writable); - - if (!(i & (0xfffff >> (PAGE_SHIFT - PAGE_SHIFT_4K)))) diff --git a/22533-x86-32bit-apicid.patch b/22533-x86-32bit-apicid.patch deleted file mode 100644 index 2acca77..0000000 --- a/22533-x86-32bit-apicid.patch +++ /dev/null @@ -1,177 +0,0 @@ -# HG changeset patch -# User Keir Fraser -# Date 1292413934 0 -# Node ID 548c808be2a6f166657ce7cfb86df7a296a9526a -# Parent c0662cb08260d831ae8d211ba16fc7038cb889b6 -x86: mpparse and cstate need to use 32bit apic id -References: bnc#656369, bnc#658704 - -Instead of going with mpc_config_processor struct. -that field ony have 8 bits. - -We should not change that struct, because it is shared with mptable. - -Also need to increase MAX_APICS. - -Signed-off-by: Yinghai Lu - -Rather than using a fixed value of 512, make this scale with NR_CPUS -(which obviously still doesn't cover all theoretically possible -systems, but at least allows some build time control). - -Signed-off-by: Jan Beulich - -Index: xen-4.0.2-testing/xen/arch/x86/acpi/cpu_idle.c -=================================================================== ---- xen-4.0.2-testing.orig/xen/arch/x86/acpi/cpu_idle.c -+++ xen-4.0.2-testing/xen/arch/x86/acpi/cpu_idle.c -@@ -742,7 +742,7 @@ static void set_cx( - int get_cpu_id(u8 acpi_id) - { - int i; -- u8 apic_id; -+ u32 apic_id; - - apic_id = x86_acpiid_to_apicid[acpi_id]; - if ( apic_id == 0xff ) -Index: xen-4.0.2-testing/xen/arch/x86/mpparse.c -=================================================================== ---- xen-4.0.2-testing.orig/xen/arch/x86/mpparse.c -+++ xen-4.0.2-testing/xen/arch/x86/mpparse.c -@@ -99,7 +99,8 @@ static int mpc_record; - static struct mpc_config_translation *translation_table[MAX_MPC_ENTRY] __initdata; - - /* Return xen's logical cpu_id of the new added cpu or <0 if error */ --static int __devinit MP_processor_info (struct mpc_config_processor *m) -+static int __devinit MP_processor_info_x(struct mpc_config_processor *m, -+ u32 apicidx) - { - int ver, apicid, cpu = 0; - physid_mask_t phys_cpu; -@@ -107,7 +108,7 @@ static int __devinit MP_processor_info ( - if (!(m->mpc_cpuflag & CPU_ENABLED)) - return -EINVAL; - -- apicid = mpc_apic_id(m, translation_table[mpc_record]); -+ apicid = mpc_apic_id(m, apicidx, translation_table[mpc_record]); - - if (m->mpc_featureflag&(1<<0)) - Dprintk(" Floating point unit present.\n"); -@@ -159,7 +160,7 @@ static int __devinit MP_processor_info ( - - if (m->mpc_cpuflag & CPU_BOOTPROCESSOR) { - Dprintk(" Bootup CPU\n"); -- boot_cpu_physical_apicid = m->mpc_apicid; -+ boot_cpu_physical_apicid = apicid; - } - - ver = m->mpc_apicver; -@@ -170,10 +171,10 @@ static int __devinit MP_processor_info ( - if (ver == 0x0) { - printk(KERN_WARNING "BIOS bug, APIC version is 0 for CPU#%d! " - "fixing up to 0x10. (tell your hw vendor)\n", -- m->mpc_apicid); -+ apicid); - ver = 0x10; - } -- apic_version[m->mpc_apicid] = ver; -+ apic_version[apicid] = ver; - - phys_cpu = apicid_to_cpu_present(apicid); - physids_or(phys_cpu_present_map, phys_cpu_present_map, phys_cpu); -@@ -216,6 +217,11 @@ static int __devinit MP_processor_info ( - return cpu; - } - -+static int __devinit MP_processor_info(struct mpc_config_processor *m) -+{ -+ return MP_processor_info_x(m, m->mpc_apicid); -+} -+ - static void __init MP_bus_info (struct mpc_config_bus *m) - { - char str[7]; -@@ -844,7 +850,7 @@ int __devinit mp_register_lapic ( - struct mpc_config_processor processor; - int boot_cpu = 0; - -- if (MAX_APICS - id <= 0) { -+ if (MAX_APICS <= id) { - printk(KERN_WARNING "Processor #%d invalid (max %d)\n", - id, MAX_APICS); - return -EINVAL; -@@ -864,7 +870,7 @@ int __devinit mp_register_lapic ( - processor.mpc_reserved[0] = 0; - processor.mpc_reserved[1] = 0; - -- return MP_processor_info(&processor); -+ return MP_processor_info_x(&processor, id); - } - - void mp_unregister_lapic(uint32_t apic_id, uint32_t cpu) -Index: xen-4.0.2-testing/xen/common/sched_sedf.c -=================================================================== ---- xen-4.0.2-testing.orig/xen/common/sched_sedf.c -+++ xen-4.0.2-testing/xen/common/sched_sedf.c -@@ -124,7 +124,6 @@ struct sedf_cpu_info { - - #define PERIOD_BEGIN(inf) ((inf)->deadl_abs - (inf)->period) - --#define MIN(x,y) (((x)<(y))?(x):(y)) - #define DIV_UP(x,y) (((x) + (y) - 1) / y) - - #define extra_runs(inf) ((inf->status) & 6) -Index: xen-4.0.2-testing/xen/include/asm-x86/mach-generic/mach_apic.h -=================================================================== ---- xen-4.0.2-testing.orig/xen/include/asm-x86/mach-generic/mach_apic.h -+++ xen-4.0.2-testing/xen/include/asm-x86/mach-generic/mach_apic.h -@@ -26,15 +26,15 @@ static inline void enable_apic_mode(void - - extern u32 bios_cpu_apicid[]; - --static inline int mpc_apic_id(struct mpc_config_processor *m, -+static inline int mpc_apic_id(struct mpc_config_processor *m, u32 apicid, - struct mpc_config_translation *translation_record) - { - printk("Processor #%d %d:%d APIC version %d\n", -- m->mpc_apicid, -+ apicid, - (m->mpc_cpufeature & CPU_FAMILY_MASK) >> 8, - (m->mpc_cpufeature & CPU_MODEL_MASK) >> 4, - m->mpc_apicver); -- return (m->mpc_apicid); -+ return apicid; - } - - static inline void setup_portio_remap(void) -Index: xen-4.0.2-testing/xen/include/asm-x86/mpspec_def.h -=================================================================== ---- xen-4.0.2-testing.orig/xen/include/asm-x86/mpspec_def.h -+++ xen-4.0.2-testing/xen/include/asm-x86/mpspec_def.h -@@ -14,7 +14,7 @@ - #define SMP_MAGIC_IDENT (('_'<<24)|('P'<<16)|('M'<<8)|'_') - - #define MAX_MPC_ENTRY 1024 --#define MAX_APICS 256 -+#define MAX_APICS MAX(256, 4 * NR_CPUS) - - struct intel_mp_floating - { -Index: xen-4.0.2-testing/xen/include/xen/kernel.h -=================================================================== ---- xen-4.0.2-testing.orig/xen/include/xen/kernel.h -+++ xen-4.0.2-testing/xen/include/xen/kernel.h -@@ -33,6 +33,13 @@ - #define max_t(type,x,y) \ - ({ type __x = (x); type __y = (y); __x > __y ? __x: __y; }) - -+/* -+ * pre-processor, array size, and bit field width suitable variants; -+ * please don't use in "normal" expressions. -+ */ -+#define MIN(x,y) ((x) < (y) ? (x) : (y)) -+#define MAX(x,y) ((x) > (y) ? (x) : (y)) -+ - /** - * container_of - cast a member of a structure out to the containing structure - * diff --git a/22534-x86-max-local-apic.patch b/22534-x86-max-local-apic.patch deleted file mode 100644 index bb0e432..0000000 --- a/22534-x86-max-local-apic.patch +++ /dev/null @@ -1,165 +0,0 @@ -# HG changeset patch -# User Keir Fraser -# Date 1292414148 0 -# Node ID d4b373ec948bed71b8683e09e41c6afc99f1edb6 -# Parent 548c808be2a6f166657ce7cfb86df7a296a9526a -x86: increase MAX_LOCAL_APIC -References: bnc#656369, bnc#658704 - -otherwise apicid_to_node[MAX_LOCAL_APIC] will be overrun if apicid > -255. After patch, the mapping get right. - -Signed-off-by: Yinghai Lu - -Make this and also MAX_MADT_ENTRIES loosely depend on NR_CPUS. Tie -MAX_APICS to MAX_LOCAL_APIC. Fix initializer of x86_acpiid_to_apicid[] -to match the array member type of u32, as well as all checks in -readers of this array and x86_cpu_to_apicid[]. - -While the adjustment to xen_vcpu_physid_to_x86_{acpi,apic}id() is not -backward compatible, I think it should still be done this way as the -former reserving of values beyond 0xff should never have been part of -the interface. If considered impossible, a second best solution would -appear to be to make the macros depend on __XEN_INTERFACE_VERSION__. - -Signed-off-by: Jan Beulich - -Index: xen-4.0.2-testing/xen/arch/x86/acpi/boot.c -=================================================================== ---- xen-4.0.2-testing.orig/xen/arch/x86/acpi/boot.c -+++ xen-4.0.2-testing/xen/arch/x86/acpi/boot.c -@@ -82,7 +82,7 @@ u8 acpi_enable_value, acpi_disable_value - #endif - - u32 x86_acpiid_to_apicid[MAX_MADT_ENTRIES] = -- {[0 ... MAX_MADT_ENTRIES - 1] = 0xff }; -+ {[0 ... MAX_MADT_ENTRIES - 1] = BAD_APICID }; - EXPORT_SYMBOL(x86_acpiid_to_apicid); - - /* -------------------------------------------------------------------------- -@@ -534,6 +534,7 @@ static int __init acpi_parse_madt_lapic_ - - mp_register_lapic_address(acpi_lapic_addr); - -+ BUILD_BUG_ON(MAX_APICS != MAX_LOCAL_APIC); - count = acpi_table_parse_madt(ACPI_MADT_LAPIC, acpi_parse_lapic, - MAX_APICS); - x2count = acpi_table_parse_madt(ACPI_MADT_X2APIC, acpi_parse_x2apic, -@@ -998,12 +999,12 @@ unsigned int acpi_get_processor_id(unsig - { - unsigned int acpiid, apicid; - -- if ((apicid = x86_cpu_to_apicid[cpu]) == 0xff) -- return 0xff; -+ if ((apicid = x86_cpu_to_apicid[cpu]) == BAD_APICID) -+ return INVALID_ACPIID; - - for (acpiid = 0; acpiid < ARRAY_SIZE(x86_acpiid_to_apicid); acpiid++) - if (x86_acpiid_to_apicid[acpiid] == apicid) - return acpiid; - -- return 0xff; -+ return INVALID_ACPIID; - } -Index: xen-4.0.2-testing/xen/arch/x86/acpi/cpu_idle.c -=================================================================== ---- xen-4.0.2-testing.orig/xen/arch/x86/acpi/cpu_idle.c -+++ xen-4.0.2-testing/xen/arch/x86/acpi/cpu_idle.c -@@ -745,7 +745,7 @@ int get_cpu_id(u8 acpi_id) - u32 apic_id; - - apic_id = x86_acpiid_to_apicid[acpi_id]; -- if ( apic_id == 0xff ) -+ if ( apic_id == BAD_APICID ) - return -1; - - for ( i = 0; i < NR_CPUS; i++ ) -Index: xen-4.0.2-testing/xen/arch/x86/smpboot.c -=================================================================== ---- xen-4.0.2-testing.orig/xen/arch/x86/smpboot.c -+++ xen-4.0.2-testing/xen/arch/x86/smpboot.c -@@ -96,7 +96,7 @@ struct cpuinfo_x86 cpu_data[NR_CPUS]; - EXPORT_SYMBOL(cpu_data); - - u32 x86_cpu_to_apicid[NR_CPUS] __read_mostly = -- { [0 ... NR_CPUS-1] = -1U }; -+ { [0 ... NR_CPUS-1] = BAD_APICID }; - EXPORT_SYMBOL(x86_cpu_to_apicid); - - static void map_cpu_to_logical_apicid(void); -@@ -1479,7 +1479,7 @@ int cpu_add(uint32_t apic_id, uint32_t a - return -EINVAL; - - /* Detect if the cpu has been added before */ -- if ( x86_acpiid_to_apicid[acpi_id] != 0xff) -+ if ( x86_acpiid_to_apicid[acpi_id] != BAD_APICID ) - { - if (x86_acpiid_to_apicid[acpi_id] != apic_id) - return -EINVAL; -@@ -1513,7 +1513,7 @@ int cpu_add(uint32_t apic_id, uint32_t a - { - dprintk(XENLOG_WARNING, - "Setup node failed for pxm %x\n", pxm); -- x86_acpiid_to_apicid[acpi_id] = 0xff; -+ x86_acpiid_to_apicid[acpi_id] = BAD_APICID; - mp_unregister_lapic(apic_id, cpu); - spin_unlock(&cpu_add_remove_lock); - return node; -Index: xen-4.0.2-testing/xen/include/asm-x86/acpi.h -=================================================================== ---- xen-4.0.2-testing.orig/xen/include/asm-x86/acpi.h -+++ xen-4.0.2-testing/xen/include/asm-x86/acpi.h -@@ -150,9 +150,11 @@ struct acpi_sleep_info { - - #endif /* CONFIG_ACPI_SLEEP */ - --#define MAX_MADT_ENTRIES 256 -+#define MAX_MADT_ENTRIES MAX(256, 2 * NR_CPUS) - extern u32 x86_acpiid_to_apicid[]; --#define MAX_LOCAL_APIC 256 -+#define MAX_LOCAL_APIC MAX(256, 4 * NR_CPUS) -+ -+#define INVALID_ACPIID (-1U) - - extern u32 pmtmr_ioport; - -Index: xen-4.0.2-testing/xen/include/asm-x86/numa.h -=================================================================== ---- xen-4.0.2-testing.orig/xen/include/asm-x86/numa.h -+++ xen-4.0.2-testing/xen/include/asm-x86/numa.h -@@ -39,7 +39,7 @@ extern int setup_node(int pxm); - extern void srat_detect_node(int cpu); - - extern void setup_node_bootmem(int nodeid, u64 start, u64 end); --extern unsigned char apicid_to_node[256]; -+extern unsigned char apicid_to_node[]; - #ifdef CONFIG_NUMA - extern void __init init_cpu_to_node(void); - -Index: xen-4.0.2-testing/xen/include/public/vcpu.h -=================================================================== ---- xen-4.0.2-testing.orig/xen/include/public/vcpu.h -+++ xen-4.0.2-testing/xen/include/public/vcpu.h -@@ -187,8 +187,7 @@ DEFINE_XEN_GUEST_HANDLE(vcpu_register_vc - /* - * Get the physical ID information for a pinned vcpu's underlying physical - * processor. The physical ID informmation is architecture-specific. -- * On x86: id[31:0]=apic_id, id[63:32]=acpi_id, and all values 0xff and -- * greater are reserved. -+ * On x86: id[31:0]=apic_id, id[63:32]=acpi_id. - * This command returns -EINVAL if it is not a valid operation for this VCPU. - */ - #define VCPUOP_get_physid 12 /* arg == vcpu_get_physid_t */ -@@ -197,10 +196,8 @@ struct vcpu_get_physid { - }; - typedef struct vcpu_get_physid vcpu_get_physid_t; - DEFINE_XEN_GUEST_HANDLE(vcpu_get_physid_t); --#define xen_vcpu_physid_to_x86_apicid(physid) \ -- ((((uint32_t)(physid)) >= 0xff) ? 0xff : ((uint8_t)(physid))) --#define xen_vcpu_physid_to_x86_acpiid(physid) \ -- ((((uint32_t)((physid)>>32)) >= 0xff) ? 0xff : ((uint8_t)((physid)>>32))) -+#define xen_vcpu_physid_to_x86_apicid(physid) ((uint32_t)(physid)) -+#define xen_vcpu_physid_to_x86_acpiid(physid) ((uint32_t)((physid) >> 32)) - - /* - * Register a memory location to get a secondary copy of the vcpu time diff --git a/22535-x2apic-preenabled.patch b/22535-x2apic-preenabled.patch deleted file mode 100644 index 67a9b0a..0000000 --- a/22535-x2apic-preenabled.patch +++ /dev/null @@ -1,88 +0,0 @@ -# HG changeset patch -# User Keir Fraser -# Date 1292414185 0 -# Node ID fcc91cb3efcb83823b7e9c74ee3c97c4a9c0b7d5 -# Parent d4b373ec948bed71b8683e09e41c6afc99f1edb6 -x86: x2apic pre-enabled but intr-remapping is not enabled -References: bnc#656369, bnc#658704 - -Make it aligned with Linux kernel. - -Signed-off-by: Yinghai Lu - -Removed unnecessary bits from the original patch, and removed -intremap_enabled() with its only caller gone. - -Signed-off-by: Jan Beulich - -Index: xen-4.0.2-testing/xen/arch/x86/apic.c -=================================================================== ---- xen-4.0.2-testing.orig/xen/arch/x86/apic.c -+++ xen-4.0.2-testing/xen/arch/x86/apic.c -@@ -964,15 +964,6 @@ void x2apic_setup(void) - rdmsr(MSR_IA32_APICBASE, lo, hi); - if ( lo & MSR_IA32_APICBASE_EXTD ) - { -- /* -- * Interrupt remapping should be also enabled by BIOS when -- * x2APIC is already enabled by BIOS, otherwise it's a BIOS -- * bug -- */ -- if ( !intremap_enabled() ) -- panic("Interrupt remapping is not enabled by BIOS while " -- "x2APIC is already enabled by BIOS!\n"); -- - printk("x2APIC mode is already enabled by BIOS.\n"); - x2apic_enabled = 1; - } -@@ -1015,6 +1006,10 @@ void x2apic_setup(void) - - if ( iommu_enable_IR() ) - { -+ if ( x2apic_enabled ) -+ panic("Interrupt remapping could not be enabled while " -+ "x2APIC is already enabled by BIOS!\n"); -+ - printk("Would not enable x2APIC due to interrupt remapping " - "cannot be enabled.\n"); - goto restore_out; -Index: xen-4.0.2-testing/xen/drivers/passthrough/vtd/intremap.c -=================================================================== ---- xen-4.0.2-testing.orig/xen/drivers/passthrough/vtd/intremap.c -+++ xen-4.0.2-testing/xen/drivers/passthrough/vtd/intremap.c -@@ -892,23 +892,3 @@ void iommu_disable_IR(void) - for_each_drhd_unit ( drhd ) - disable_qinval(drhd->iommu); - } -- --/* -- * Check if interrupt remapping is enabled or not -- * return 1: enabled -- * return 0: not enabled -- */ --int intremap_enabled(void) --{ -- struct acpi_drhd_unit *drhd; -- u32 sts; -- -- for_each_drhd_unit ( drhd ) -- { -- sts = dmar_readl(drhd->iommu->reg, DMAR_GSTS_REG); -- if ( !(sts & DMA_GSTS_IRES) ) -- return 0; -- } -- -- return 1; --} -Index: xen-4.0.2-testing/xen/include/xen/iommu.h -=================================================================== ---- xen-4.0.2-testing.orig/xen/include/xen/iommu.h -+++ xen-4.0.2-testing/xen/include/xen/iommu.h -@@ -62,7 +62,6 @@ int iommu_setup(void); - int iommu_supports_eim(void); - int iommu_enable_IR(void); - void iommu_disable_IR(void); --int intremap_enabled(void); - - int iommu_add_device(struct pci_dev *pdev); - int iommu_remove_device(struct pci_dev *pdev); diff --git a/22645-amd-flush-filter.patch b/22645-amd-flush-filter.patch deleted file mode 100644 index afc2f2d..0000000 --- a/22645-amd-flush-filter.patch +++ /dev/null @@ -1,60 +0,0 @@ -# HG changeset patch -# User Keir Fraser -# Date 1294220923 0 -# Node ID 76d897a06b316bf2278220b006d578faf31ce3fb -# Parent fece73d4d30985ce40ef87dcd379ce6beb8aadf3 -x86 amd: Revert 6382:b74c15e4dd4f (AMD flush filter configuration) - -Flush filter is not reliably supported by any processor, we already -have code to unconditionally disable the filter, so we don't need the -command-line config option. Remove it. - -Signed-off-by: Keir Fraser - -Index: xen-4.0.2-testing/xen/arch/x86/cpu/amd.c -=================================================================== ---- xen-4.0.2-testing.orig/xen/arch/x86/cpu/amd.c -+++ xen-4.0.2-testing/xen/arch/x86/cpu/amd.c -@@ -237,20 +237,6 @@ int cpu_has_amd_erratum(const struct cpu - return 0; - } - --/* -- * amd_flush_filter={on,off}. Forcibly Enable or disable the TLB flush -- * filter on AMD 64-bit processors. -- */ --static int flush_filter_force; --static void flush_filter(char *s) --{ -- if (!strcmp(s, "off")) -- flush_filter_force = -1; -- if (!strcmp(s, "on")) -- flush_filter_force = 1; --} --custom_param("amd_flush_filter", flush_filter); -- - #define num_physpages 0 - - /* -@@ -545,21 +531,6 @@ static void __devinit init_amd(struct cp - break; - } - -- if (c->x86 == 15) { -- rdmsr(MSR_K7_HWCR, l, h); -- printk(KERN_INFO "CPU%d: AMD Flush Filter %sabled", -- smp_processor_id(), (l & (1<<6)) ? "dis" : "en"); -- if ((flush_filter_force > 0) && (l & (1<<6))) { -- l &= ~(1<<6); -- printk(" -> Forcibly enabled"); -- } else if ((flush_filter_force < 0) && !(l & (1<<6))) { -- l |= 1<<6; -- printk(" -> Forcibly disabled"); -- } -- wrmsr(MSR_K7_HWCR, l, h); -- printk("\n"); -- } -- - display_cacheinfo(c); - - if (cpuid_eax(0x80000000) >= 0x80000008) { diff --git a/22693-fam10-mmio-conf-base-protect.patch b/22693-fam10-mmio-conf-base-protect.patch deleted file mode 100644 index 32cf722..0000000 --- a/22693-fam10-mmio-conf-base-protect.patch +++ /dev/null @@ -1,77 +0,0 @@ -# HG changeset patch -# User Keir Fraser -# Date 1294648952 0 -# Node ID 08bb0eefe87107c30a9bdc6d72f26b20c55ae687 -# Parent 66e8062894641e5622aa6adc54297d5700b1cea3 -x86-64: don't allow wrmsr to MSR_FAM10H_MMIO_CONF_BASE when Xen itself is using it - -Signed-off-by: Jan Beulich - -# HG changeset patch -# User Keir Fraser -# Date 1294741846 0 -# Node ID a2dcebb88bc4571d64b3f30c1fbb33cfe4f6e2c5 -# Parent 1ae74f060a39ae1305b3a434d0faa1a19853fdab -x86-64: refine access permission check for wrmsr to MSR_FAM10H_MMIO_CONF_BASE - -We really don't want the mmconf window to move/disappear whenever we -use is ourselves, not only when we enabled it. - -Signed-off-by: Jan Beulich - -Index: xen-4.0.2-testing/xen/arch/x86/traps.c -=================================================================== ---- xen-4.0.2-testing.orig/xen/arch/x86/traps.c -+++ xen-4.0.2-testing/xen/arch/x86/traps.c -@@ -1716,6 +1716,10 @@ static int is_cpufreq_controller(struct - (d->domain_id == 0)); - } - -+#ifdef CONFIG_X86_64 -+#include "x86_64/mmconfig.h" -+#endif -+ - static int emulate_privileged_op(struct cpu_user_regs *regs) - { - struct vcpu *v = current; -@@ -2275,7 +2279,13 @@ static int emulate_privileged_op(struct - goto fail; - if ( !IS_PRIV(v->domain) ) - break; -- if ( (rdmsr_safe(MSR_FAM10H_MMIO_CONF_BASE, l, h) != 0) || -+ if ( (rdmsr_safe(MSR_FAM10H_MMIO_CONF_BASE, l, h) != 0) ) -+ goto fail; -+ if ( -+#ifdef CONFIG_X86_64 -+ (pci_probe & PCI_PROBE_MASK) == PCI_PROBE_MMCONF ? -+ eax != l || edx != h : -+#endif - (((((u64)h << 32) | l) ^ val) & - ~( FAM10H_MMIO_CONF_ENABLE | - (FAM10H_MMIO_CONF_BUSRANGE_MASK << -Index: xen-4.0.2-testing/xen/arch/x86/x86_64/mmconfig.h -=================================================================== ---- xen-4.0.2-testing.orig/xen/arch/x86/x86_64/mmconfig.h -+++ xen-4.0.2-testing/xen/arch/x86/x86_64/mmconfig.h -@@ -34,6 +34,8 @@ - - #define PCI_VENDOR_ID_NVIDIA 0x10de - -+extern unsigned int pci_probe; -+ - /* - * AMD Fam10h CPUs are buggy, and cannot access MMIO config space - * on their northbrige except through the * %eax register. As such, you MUST -Index: xen-4.0.2-testing/xen/arch/x86/x86_64/mmconfig-shared.c -=================================================================== ---- xen-4.0.2-testing.orig/xen/arch/x86/x86_64/mmconfig-shared.c -+++ xen-4.0.2-testing/xen/arch/x86/x86_64/mmconfig-shared.c -@@ -24,7 +24,7 @@ - #include "mmconfig.h" - - static int __initdata known_bridge; --static unsigned int pci_probe = PCI_PROBE_CONF1 | PCI_PROBE_MMCONF; -+unsigned int pci_probe = PCI_PROBE_CONF1 | PCI_PROBE_MMCONF; - - static void __init parse_mmcfg(char *s) - { diff --git a/22694-x86_64-no-weak.patch b/22694-x86_64-no-weak.patch deleted file mode 100644 index 6e58518..0000000 --- a/22694-x86_64-no-weak.patch +++ /dev/null @@ -1,46 +0,0 @@ -# HG changeset patch -# User Keir Fraser -# Date 1294649119 0 -# Node ID 9b5d121c8805b40a4338248c346303e1e18d0c4e -# Parent 08bb0eefe87107c30a9bdc6d72f26b20c55ae687 -x86_64: don't use weak symbols on x86-64 -References: bnc#656369, bnc#658704 - -Various gcc versions inline functions that are both weak and hidden, -without even giving a warning. - -Certainly the risk exists that we'll see the problem again when -another weak function gets introduced, but I don't see a way to -protect us from that. - -Signed-off-by: Jan Beulich - -Just remove the weak attribute altogether. It's the only one in -non-ia64-specific code. We can get teh same effect with ifdefs which -although a bit unsightly is better than using compiler/linker features -we cannot trust. - -Signed-off-by: Keir Fraser - -Index: xen-4.0.2-testing/xen/drivers/acpi/numa.c -=================================================================== ---- xen-4.0.2-testing.orig/xen/drivers/acpi/numa.c -+++ xen-4.0.2-testing/xen/drivers/acpi/numa.c -@@ -120,14 +120,15 @@ static int __init acpi_parse_slit(struct - return 0; - } - --void __init __attribute__ ((weak)) -+#ifndef CONFIG_X86 -+void __init - acpi_numa_x2apic_affinity_init(struct acpi_srat_x2apic_cpu_affinity *pa) - { - printk(KERN_WARNING PREFIX - "Found unsupported x2apic [0x%08x] SRAT entry\n", pa->apic_id); - return; - } -- -+#endif - - static int __init - acpi_parse_x2apic_affinity(struct acpi_subtable_header *header, diff --git a/22707-x2apic-preenabled-check.patch b/22707-x2apic-preenabled-check.patch deleted file mode 100644 index 1b1922b..0000000 --- a/22707-x2apic-preenabled-check.patch +++ /dev/null @@ -1,109 +0,0 @@ -# HG changeset patch -# User Keir Fraser -# Date 1294746050 0 -# Node ID 2ff199e2842b7e4f08ea99558afc32536a77280c -# Parent ca10302ac2859b43a41afe425d79ae0df29f2a9c -x86: restore x2apic pre-enabled check logic -References: bnc#656369, bnc#658704 - -c/s 22475 removed the early checking without replacement, neglecting -the fact that x2apic_enabled must be set early for APIC register -accesses done during second stage ACPI table parsing (rooted at -acpi_boot_init()) to work correctly. Without this, particularly -determination of the boot CPU won't work, resulting in an attempt to -bring up that CPU again as a secondary one (which fails). - -Restore the functionality, now calling it from generic_apic_probe(). - -Signed-off-by: Jan Beulich - -Index: xen-4.0.2-testing/xen/arch/x86/apic.c -=================================================================== ---- xen-4.0.2-testing.orig/xen/arch/x86/apic.c -+++ xen-4.0.2-testing/xen/arch/x86/apic.c -@@ -948,7 +948,6 @@ no_apic: - void x2apic_setup(void) - { - struct IO_APIC_route_entry **ioapic_entries = NULL; -- u32 lo, hi; - - if ( smp_processor_id() != 0 ) - { -@@ -960,14 +959,6 @@ void x2apic_setup(void) - if ( !cpu_has_x2apic ) - return; - -- /* Check whether x2apic mode was already enabled by the BIOS. */ -- rdmsr(MSR_IA32_APICBASE, lo, hi); -- if ( lo & MSR_IA32_APICBASE_EXTD ) -- { -- printk("x2APIC mode is already enabled by BIOS.\n"); -- x2apic_enabled = 1; -- } -- - if ( !opt_x2apic ) - { - if ( !x2apic_enabled ) -Index: xen-4.0.2-testing/xen/arch/x86/genapic/probe.c -=================================================================== ---- xen-4.0.2-testing.orig/xen/arch/x86/genapic/probe.c -+++ xen-4.0.2-testing/xen/arch/x86/genapic/probe.c -@@ -59,8 +59,10 @@ custom_param("apic", genapic_apic_force) - - void __init generic_apic_probe(void) - { -- int i; -- int changed = cmdline_apic = (genapic != NULL); -+ int i, changed; -+ -+ check_x2apic_preenabled(); -+ cmdline_apic = changed = (genapic != NULL); - - for (i = 0; !changed && apic_probe[i]; i++) { - if (apic_probe[i]->probe()) { -Index: xen-4.0.2-testing/xen/arch/x86/genapic/x2apic.c -=================================================================== ---- xen-4.0.2-testing.orig/xen/arch/x86/genapic/x2apic.c -+++ xen-4.0.2-testing/xen/arch/x86/genapic/x2apic.c -@@ -20,6 +20,8 @@ - #include - #include - #include -+#include -+#include - #include - #include - -@@ -134,3 +136,20 @@ const struct genapic *apic_x2apic_probe( - { - return x2apic_phys ? &apic_x2apic_phys : &apic_x2apic_cluster; - } -+ -+void __init check_x2apic_preenabled(void) -+{ -+ u32 lo, hi; -+ -+ if ( !cpu_has_x2apic ) -+ return; -+ -+ /* Check whether x2apic mode was already enabled by the BIOS. */ -+ rdmsr(MSR_IA32_APICBASE, lo, hi); -+ if ( lo & MSR_IA32_APICBASE_EXTD ) -+ { -+ printk("x2APIC mode is already enabled by BIOS.\n"); -+ x2apic_enabled = 1; -+ genapic = apic_x2apic_probe(); -+ } -+} -Index: xen-4.0.2-testing/xen/include/asm-x86/apic.h -=================================================================== ---- xen-4.0.2-testing.orig/xen/include/asm-x86/apic.h -+++ xen-4.0.2-testing/xen/include/asm-x86/apic.h -@@ -25,6 +25,7 @@ extern int apic_verbosity; - extern int x2apic_enabled; - extern int directed_eoi_enabled; - -+void check_x2apic_preenabled(void); - void x2apic_setup(void); - const struct genapic *apic_x2apic_probe(void); - diff --git a/22708-xenctx-misc.patch b/22708-xenctx-misc.patch deleted file mode 100644 index ba87f99..0000000 --- a/22708-xenctx-misc.patch +++ /dev/null @@ -1,114 +0,0 @@ -# HG changeset patch -# User Keir Fraser -# Date 1294746099 0 -# Node ID 7926538a633297d65a5d6324bf9bd0eb158a6aff -# Parent 2ff199e2842b7e4f08ea99558afc32536a77280c -xenctx: misc adjustments - -- fix off-by-one errors during symbol insertion and lookup -- don't store the symbol type, as it wasn't needed at all so far and - is only needed now at parsing time -- don't insert certain kinds of symbols - -Signed-off-by: Jan Beulich - -Index: xen-4.0.2-testing/tools/xentrace/xenctx.c -=================================================================== ---- xen-4.0.2-testing.orig/tools/xentrace/xenctx.c -+++ xen-4.0.2-testing/tools/xentrace/xenctx.c -@@ -19,6 +19,7 @@ - #include - #include - #include -+#include - #include - #include - #include -@@ -58,7 +59,6 @@ int disp_tlb; - - struct symbol { - guest_word_t address; -- char type; - char *name; - struct symbol *next; - } *symbol_table = NULL; -@@ -112,12 +112,12 @@ static void insert_symbol(struct symbol - - /* The System.map is usually already sorted... */ - if (prev -- && prev->address < symbol->address -+ && prev->address <= symbol->address - && (!prev->next || prev->next->address > symbol->address)) { - s = prev; - } else { - /* ... otherwise do crappy/slow search for the correct place */ -- while(s && s->next && s->next->address < symbol->address) -+ while (s->next && s->next->address <= symbol->address) - s = s->next; - } - -@@ -130,13 +130,13 @@ static struct symbol *lookup_symbol(gues - { - struct symbol *s = symbol_table; - -- while(s && s->next && s->next->address < address) -- s = s->next; -+ if (!s) -+ return NULL; - -- if (s && s->address < address) -- return s; -+ while (s->next && s->next->address < address) -+ s = s->next; - -- return NULL; -+ return s->next && s->next->address <= address ? s->next : s; - } - - static void print_symbol(guest_word_t addr) -@@ -159,7 +159,7 @@ static void print_symbol(guest_word_t ad - - static void read_symbol_table(const char *symtab) - { -- char line[256]; -+ char type, line[256]; - char *p; - struct symbol *symbol; - FILE *f; -@@ -178,9 +178,13 @@ static void read_symbol_table(const char - - /* need more checks for syntax here... */ - symbol->address = strtoull(line, &p, 16); -- p++; -- symbol->type = *p++; -- p++; -+ if (!isspace(*p++)) -+ continue; -+ type = *p++; -+ if (!isalpha(type) && type != '?') -+ continue; -+ if (!isspace(*p++)) -+ continue; - - /* in the future we should handle the module name - * being appended here, this would allow us to use -@@ -190,7 +194,18 @@ static void read_symbol_table(const char - p[strlen(p)-1] = '\0'; - symbol->name = strdup(p); - -- insert_symbol(symbol); -+ switch (type) { -+ case 'A': /* global absolute */ -+ case 'a': /* local absolute */ -+ break; -+ case 'U': /* undefined */ -+ case 'v': /* undefined weak object */ -+ case 'w': /* undefined weak function */ -+ continue; -+ default: -+ insert_symbol(symbol); -+ break; -+ } - - if (strcmp(symbol->name, "_stext") == 0) - kernel_stext = symbol->address; diff --git a/22744-ept-pod-locking.patch b/22744-ept-pod-locking.patch deleted file mode 100644 index 173cd5b..0000000 --- a/22744-ept-pod-locking.patch +++ /dev/null @@ -1,47 +0,0 @@ -# HG changeset patch -# User Tim Deegan -# Date 1294933573 0 -# Node ID b01ef59c8c805df751a8f6ae63cdd5c6a4565255 -# Parent 54e91dcae649e23fd267d7afe623fbd52b1b4283 -x86/mm: fix EPT PoD locking to match the normal p2m case. - -This recursive-locking bug was fixed in the main p2m code in -20269:fd3d5d66c446 (in October 2009) but has lurked unseen in -the EPT side since then. Copy the fix across. - -Signed-off-by: Tim Deegan - -Index: xen-4.0.2-testing/xen/arch/x86/mm/hap/p2m-ept.c -=================================================================== ---- xen-4.0.2-testing.orig/xen/arch/x86/mm/hap/p2m-ept.c -+++ xen-4.0.2-testing/xen/arch/x86/mm/hap/p2m-ept.c -@@ -37,19 +37,26 @@ static int ept_pod_check_and_populate(st - ept_entry_t *entry, int order, - p2m_query_t q) - { -+ /* Only take the lock if we don't already have it. Otherwise it -+ * wouldn't be safe to do p2m lookups with the p2m lock held */ -+ int do_locking = !p2m_locked_by_me(d->arch.p2m); - int r; -- p2m_lock(d->arch.p2m); -+ -+ if ( do_locking ) -+ p2m_lock(d->arch.p2m); - - /* Check to make sure this is still PoD */ - if ( entry->avail1 != p2m_populate_on_demand ) - { -- p2m_unlock(d->arch.p2m); -+ if ( do_locking ) -+ p2m_unlock(d->arch.p2m); - return 0; - } - - r = p2m_pod_demand_populate(d, gfn, order, q); - -- p2m_unlock(d->arch.p2m); -+ if ( do_locking ) -+ p2m_unlock(d->arch.p2m); - - return r; - } diff --git a/22749-vtd-workarounds.patch b/22749-vtd-workarounds.patch deleted file mode 100644 index a961dc2..0000000 --- a/22749-vtd-workarounds.patch +++ /dev/null @@ -1,264 +0,0 @@ -References: bnc#633573 - -# HG changeset patch -# User Allen Kay -# Date 1294992706 0 -# Node ID 93e7bf0e1845f1a82441fb740522a9b9cb32beda -# Parent 47713825a3f910fc7cf7571947e8b3b4eab23d5f -vt-d: quirks for Sandybridge errata workaround, WLAN, VT-d fault escalation - -Adding errata workaround for newly released Sandybridge processor -graphics, additional WLAN device ID's for WLAN quirk, a quirk for -masking VT-d fault escalation to IOH HW that can cause system hangs on -some OEM hardware where the BIOS erroneously escalates VT-d faults to -the platform. - -Signed-off-by: Allen Kay - -# HG changeset patch -# User Keir Fraser -# Date 1295625672 0 -# Node ID 1637fdbfc21e2c732eca29136943a568f8f341cd -# Parent 43592043cefc8357e6e6a0ab9ba85ca480968cb1 -[VTD][QUIRK] turn off Sandybridge IGD quirk by default - -Turn off Sandybridge IGD quirk by default until potential issues such -as MMIO register conflict with OS device driver and proper locking in -preamble and postamble functions are addressed. - -Signed-off-by: Allen Kay - -# HG changeset patch -# User Allen Kay -# Date 1296587456 0 -# Node ID 3edd21ffe407ac0e853d51aa8302d9bdb4068749 -# Parent 0e2c8b75f7d233f15f8bb49d9db0579e7a350964 -passthrough/vtd: disable 64-bit MMCFG quirk on 32-bit Xen - -Attached patch disables pci_vtd_quirk for 32-bit Xen since 32-bit xen -does not support MMCFG access. - -Signed-off-by: Allen Kay -Committed-by: Ian Jackson - ---- a/xen/drivers/passthrough/vtd/extern.h -+++ b/xen/drivers/passthrough/vtd/extern.h -@@ -87,5 +87,6 @@ void __init platform_quirks_init(void); - void vtd_ops_preamble_quirk(struct iommu* iommu); - void vtd_ops_postamble_quirk(struct iommu* iommu); - void me_wifi_quirk(struct domain *domain, u8 bus, u8 devfn, int map); -+void pci_vtd_quirk(struct pci_dev *pdev); - - #endif // _VTD_EXTERN_H_ ---- a/xen/drivers/passthrough/vtd/iommu.c -+++ b/xen/drivers/passthrough/vtd/iommu.c -@@ -1845,6 +1845,7 @@ static void setup_dom0_devices(struct do - list_add(&pdev->domain_list, &d->arch.pdev_list); - domain_context_mapping(d, pdev->bus, pdev->devfn); - pci_enable_acs(pdev); -+ pci_vtd_quirk(pdev); - } - } - spin_unlock(&pcidevs_lock); ---- a/xen/drivers/passthrough/vtd/quirks.c -+++ b/xen/drivers/passthrough/vtd/quirks.c -@@ -47,11 +47,13 @@ - #define IS_CTG(id) (id == 0x2a408086) - #define IS_ILK(id) (id == 0x00408086 || id == 0x00448086 || id== 0x00628086 || id == 0x006A8086) - #define IS_CPT(id) (id == 0x01008086 || id == 0x01048086) -+#define IS_SNB_GFX(id) (id == 0x01068086 || id == 0x01168086 || id == 0x01268086 || id == 0x01028086 || id == 0x01128086 || id == 0x01228086 || id == 0x010A8086) - - u32 ioh_id; - u32 igd_id; - bool_t rwbf_quirk; - static int is_cantiga_b3; -+static int is_snb_gfx; - static u8 *igd_reg_va; - - /* -@@ -92,6 +94,12 @@ static void cantiga_b3_errata_init(void) - is_cantiga_b3 = 1; - } - -+/* check for Sandybridge IGD device ID's */ -+static void snb_errata_init(void) -+{ -+ is_snb_gfx = IS_SNB_GFX(igd_id); -+} -+ - /* - * QUIRK to workaround Cantiga IGD VT-d low power errata. - * This errata impacts IGD assignment on Cantiga systems -@@ -104,12 +112,15 @@ static void cantiga_b3_errata_init(void) - /* - * map IGD MMIO+0x2000 page to allow Xen access to IGD 3D register. - */ --static void map_igd_reg(void) -+static void *map_igd_reg(void) - { - u64 igd_mmio, igd_reg; - -- if ( !is_cantiga_b3 || igd_reg_va != NULL ) -- return; -+ if ( !is_cantiga_b3 && !is_snb_gfx ) -+ return NULL; -+ -+ if ( igd_reg_va ) -+ return igd_reg_va; - - /* get IGD mmio address in PCI BAR */ - igd_mmio = ((u64)pci_conf_read32(0, IGD_DEV, 0, 0x14) << 32) + -@@ -121,6 +132,7 @@ static void map_igd_reg(void) - /* ioremap this physical page */ - set_fixmap_nocache(FIX_IGD_MMIO, igd_reg); - igd_reg_va = (u8 *)fix_to_virt(FIX_IGD_MMIO); -+ return igd_reg_va; - } - - /* -@@ -134,6 +146,9 @@ static int cantiga_vtd_ops_preamble(stru - if ( !is_igd_drhd(drhd) || !is_cantiga_b3 ) - return 0; - -+ if ( !map_igd_reg() ) -+ return 0; -+ - /* - * read IGD register at IGD MMIO + 0x20A4 to force IGD - * to exit low power state. Since map_igd_reg() -@@ -144,11 +159,69 @@ static int cantiga_vtd_ops_preamble(stru - } - - /* -+ * Sandybridge RC6 power management inhibit state erratum. -+ * This can cause power high power consumption. -+ * Workaround is to prevent graphics get into RC6 -+ * state when doing VT-d IOTLB operations, do the VT-d -+ * IOTLB operation, and then re-enable RC6 state. -+ */ -+static void snb_vtd_ops_preamble(struct iommu* iommu) -+{ -+ struct intel_iommu *intel = iommu->intel; -+ struct acpi_drhd_unit *drhd = intel ? intel->drhd : NULL; -+ s_time_t start_time; -+ -+ if ( !is_igd_drhd(drhd) || !is_snb_gfx ) -+ return; -+ -+ if ( !map_igd_reg() ) -+ return; -+ -+ *((volatile u32 *)(igd_reg_va + 0x54)) = 0x000FFFFF; -+ *((volatile u32 *)(igd_reg_va + 0x700)) = 0; -+ -+ start_time = NOW(); -+ while ( (*((volatile u32 *)(igd_reg_va + 0x2AC)) & 0xF) != 0 ) -+ { -+ if ( NOW() > start_time + DMAR_OPERATION_TIMEOUT ) -+ { -+ dprintk(XENLOG_INFO VTDPREFIX, -+ "snb_vtd_ops_preamble: failed to disable idle handshake\n"); -+ break; -+ } -+ cpu_relax(); -+ } -+ -+ *((volatile u32*)(igd_reg_va + 0x50)) = 0x10001; -+} -+ -+static void snb_vtd_ops_postamble(struct iommu* iommu) -+{ -+ struct intel_iommu *intel = iommu->intel; -+ struct acpi_drhd_unit *drhd = intel ? intel->drhd : NULL; -+ -+ if ( !is_igd_drhd(drhd) || !is_snb_gfx ) -+ return; -+ -+ if ( !map_igd_reg() ) -+ return; -+ -+ *((volatile u32 *)(igd_reg_va + 0x54)) = 0xA; -+ *((volatile u32 *)(igd_reg_va + 0x50)) = 0x10000; -+} -+ -+/* - * call before VT-d translation enable and IOTLB flush operations. - */ -+ -+static int snb_igd_quirk; -+boolean_param("snb_igd_quirk", snb_igd_quirk); -+ - void vtd_ops_preamble_quirk(struct iommu* iommu) - { - cantiga_vtd_ops_preamble(iommu); -+ if ( snb_igd_quirk ) -+ snb_vtd_ops_preamble(iommu); - } - - /* -@@ -156,7 +229,8 @@ void vtd_ops_preamble_quirk(struct iommu - */ - void vtd_ops_postamble_quirk(struct iommu* iommu) - { -- return; -+ if ( snb_igd_quirk ) -+ snb_vtd_ops_postamble(iommu); - } - - /* initialize platform identification flags */ -@@ -175,6 +249,8 @@ void __init platform_quirks_init(void) - /* initialize cantiga B3 identification */ - cantiga_b3_errata_init(); - -+ snb_errata_init(); -+ - /* ioremap IGD MMIO+0x2000 page */ - map_igd_reg(); - } -@@ -246,11 +322,14 @@ void me_wifi_quirk(struct domain *domain - id = pci_conf_read32(bus, PCI_SLOT(devfn), PCI_FUNC(devfn), 0); - switch (id) - { -- case 0x00878086: -+ case 0x00878086: /* Kilmer Peak */ - case 0x00898086: -- case 0x00828086: -+ case 0x00828086: /* Taylor Peak */ - case 0x00858086: -- case 0x42388086: -+ case 0x008F8086: /* Rainbow Peak */ -+ case 0x00908086: -+ case 0x00918086: -+ case 0x42388086: /* Puma Peak */ - case 0x422b8086: - case 0x422c8086: - map_me_phantom_function(domain, 22, map); -@@ -258,6 +337,28 @@ void me_wifi_quirk(struct domain *domain - default: - break; - } -+ } -+} - -+/* -+ * Mask reporting Intel VT-d faults to IOH core logic: -+ * - Some platform escalates VT-d faults to platform errors -+ * - This can cause system failure upon non-fatal VT-d faults -+ * - Potential security issue if malicious guest trigger VT-d faults -+ */ -+void pci_vtd_quirk(struct pci_dev *pdev) -+{ -+#ifdef CONFIG_X86_64 -+ int bus = pdev->bus; -+ int dev = PCI_SLOT(pdev->devfn); -+ int func = PCI_FUNC(pdev->devfn); -+ int id, val; -+ -+ id = pci_conf_read32(bus, dev, func, 0); -+ if ( id == 0x342e8086 || id == 0x3c288086 ) -+ { -+ val = pci_conf_read32(bus, dev, func, 0x1AC); -+ pci_conf_write32(bus, dev, func, 0x1AC, val | (1 << 31)); - } -+#endif - } diff --git a/22777-vtd-ats-fixes.patch b/22777-vtd-ats-fixes.patch deleted file mode 100644 index 9b514c7..0000000 --- a/22777-vtd-ats-fixes.patch +++ /dev/null @@ -1,110 +0,0 @@ -# HG changeset patch -# User Jan Beulich -# Date 1295353690 0 -# Node ID 1e7594758b28706c2b72358598ecf632ddda247b -# Parent 78e2e5a50daa1702e3fd9dbceada700cdaefd511 -VT-d/ATS: misc fixes - -First of all there were three places potentially de-referencing NULL -(two after an allocation failure, and one after a failed lookup). - -Second, if ATS_ENABLE was already set, the device would not have got -added to the ats_devices list, potentially resulting in -dev_invalidate_iotlb() doing an incomplete job. - -Signed-off-by: Jan Beulich - -Index: xen-4.0.2-testing/xen/drivers/passthrough/vtd/x86/ats.c -=================================================================== ---- xen-4.0.2-testing.orig/xen/drivers/passthrough/vtd/x86/ats.c -+++ xen-4.0.2-testing/xen/drivers/passthrough/vtd/x86/ats.c -@@ -91,6 +91,9 @@ int ats_device(int seg, int bus, int dev - return 0; - - pdev = pci_get_pdev(bus, devfn); -+ if ( !pdev ) -+ return 0; -+ - drhd = acpi_find_matched_drhd_unit(pdev); - if ( !drhd ) - return 0; -@@ -108,6 +111,8 @@ int ats_device(int seg, int bus, int dev - if ( pos && (ats_drhd == NULL) ) - { - new_drhd = xmalloc(struct acpi_drhd_unit); -+ if ( !new_drhd ) -+ return 0; - memcpy(new_drhd, drhd, sizeof(struct acpi_drhd_unit)); - list_add_tail(&new_drhd->list, &ats_dev_drhd_units); - } -@@ -116,9 +121,8 @@ int ats_device(int seg, int bus, int dev - - int enable_ats_device(int seg, int bus, int devfn) - { -- struct pci_ats_dev *pdev; -+ struct pci_ats_dev *pdev = NULL; - u32 value; -- u16 queue_depth; - int pos; - - if ( !acpi_find_matched_atsr_unit(bus, devfn) ) -@@ -142,26 +146,43 @@ int enable_ats_device(int seg, int bus, - - /* BUGBUG: add back seg when multi-seg platform support is enabled */ - value = pci_conf_read16(bus, PCI_SLOT(devfn), -- PCI_FUNC(devfn), pos + ATS_REG_CAP); -- queue_depth = value & ATS_QUEUE_DEPTH_MASK; -- -- value = pci_conf_read16(bus, PCI_SLOT(devfn), - PCI_FUNC(devfn), pos + ATS_REG_CTL); - if ( value & ATS_ENABLE ) -- return 0; -+ { -+ list_for_each_entry ( pdev, &ats_devices, list ) -+ { -+ if ( pdev->bus == bus && pdev->devfn == devfn ) -+ { -+ pos = 0; -+ break; -+ } -+ } -+ } -+ if ( pos ) -+ pdev = xmalloc(struct pci_ats_dev); -+ if ( !pdev ) -+ return -ENOMEM; -+ -+ if ( !(value & ATS_ENABLE) ) -+ { -+ value |= ATS_ENABLE; -+ pci_conf_write16(bus, PCI_SLOT(devfn), PCI_FUNC(devfn), -+ pos + ATS_REG_CTL, value); -+ } -+ -+ if ( pos ) -+ { -+ pdev->bus = bus; -+ pdev->devfn = devfn; -+ value = pci_conf_read16(bus, PCI_SLOT(devfn), -+ PCI_FUNC(devfn), pos + ATS_REG_CAP); -+ pdev->ats_queue_depth = value & ATS_QUEUE_DEPTH_MASK; -+ list_add(&pdev->list, &ats_devices); -+ } - -- value |= ATS_ENABLE; -- pci_conf_write16(bus, PCI_SLOT(devfn), PCI_FUNC(devfn), -- pos + ATS_REG_CTL, value); -- -- pdev = xmalloc(struct pci_ats_dev); -- pdev->bus = bus; -- pdev->devfn = devfn; -- pdev->ats_queue_depth = queue_depth; -- list_add(&(pdev->list), &ats_devices); - if ( iommu_verbose ) -- dprintk(XENLOG_INFO VTDPREFIX, "%x:%x.%x: ATS is enabled\n", -- bus, PCI_SLOT(devfn), PCI_FUNC(devfn)); -+ dprintk(XENLOG_INFO VTDPREFIX, "%x:%x.%x: ATS %s enabled\n", -+ bus, PCI_SLOT(devfn), PCI_FUNC(devfn), pos ? "is" : "was"); - - return pos; - } diff --git a/22781-pod-hap-logdirty.patch b/22781-pod-hap-logdirty.patch deleted file mode 100644 index aae6044..0000000 --- a/22781-pod-hap-logdirty.patch +++ /dev/null @@ -1,64 +0,0 @@ -# HG changeset patch -# User George Dunlap -# Date 1295274541 0 -# Node ID 3decd02e0b18ae21fb926c6bad96a4cd02c48272 -# Parent 97ab84aca65cdcbce2ddccc51629fb24adb056cf -PoD,hap: Fix logdirty mode when using hardware assisted paging - -When writing a writable p2m entry for a pfn, we need to mark the pfn -dirty to avoid corruption when doing live migration. - -Marking the page dirty exposes another issue, where there are -excessive sweeps for zero pages if there's a mismatch between PoD -entries and cache entries. Only sweep for zero pages if we actually -need more memory. - -Signed-off-by: George Dunlap -Acked-by: Tim Deegan - -Index: xen-4.0.2-testing/xen/arch/x86/mm/p2m.c -=================================================================== ---- xen-4.0.2-testing.orig/xen/arch/x86/mm/p2m.c -+++ xen-4.0.2-testing/xen/arch/x86/mm/p2m.c -@@ -1064,14 +1064,22 @@ p2m_pod_demand_populate(struct domain *d - if ( unlikely(d->is_dying) ) - goto out_fail; - -- /* If we're low, start a sweep */ -- if ( order == 9 && page_list_empty(&p2md->pod.super) ) -- p2m_pod_emergency_sweep_super(d); -- -- if ( page_list_empty(&p2md->pod.single) && -- ( ( order == 0 ) -- || (order == 9 && page_list_empty(&p2md->pod.super) ) ) ) -- p2m_pod_emergency_sweep(d); -+ /* Once we've ballooned down enough that we can fill the remaining -+ * PoD entries from the cache, don't sweep even if the particular -+ * list we want to use is empty: that can lead to thrashing zero pages -+ * through the cache for no good reason. */ -+ if ( p2md->pod.entry_count > p2md->pod.count ) -+ { -+ -+ /* If we're low, start a sweep */ -+ if ( order == 9 && page_list_empty(&p2md->pod.super) ) -+ p2m_pod_emergency_sweep_super(d); -+ -+ if ( page_list_empty(&p2md->pod.single) && -+ ( ( order == 0 ) -+ || (order == 9 && page_list_empty(&p2md->pod.super) ) ) ) -+ p2m_pod_emergency_sweep(d); -+ } - - /* Keep track of the highest gfn demand-populated by a guest fault */ - if ( q == p2m_guest && gfn > p2md->pod.max_guest ) -@@ -1098,7 +1106,10 @@ p2m_pod_demand_populate(struct domain *d - set_p2m_entry(d, gfn_aligned, mfn, order, p2m_ram_rw); - - for( i = 0 ; i < (1UL << order) ; i++ ) -+ { - set_gpfn_from_mfn(mfn_x(mfn) + i, gfn_aligned + i); -+ paging_mark_dirty(d, mfn_x(mfn) + i); -+ } - - p2md->pod.entry_count -= (1 << order); /* Lock: p2m */ - BUG_ON(p2md->pod.entry_count < 0); diff --git a/22789-i386-no-x2apic.patch b/22789-i386-no-x2apic.patch deleted file mode 100644 index 2fc031c..0000000 --- a/22789-i386-no-x2apic.patch +++ /dev/null @@ -1,82 +0,0 @@ -# HG changeset patch -# User Keir Fraser -# Date 1295625507 0 -# Node ID 9bd5f65050f8014de7d0fcf9d89ed8c441f261fa -# Parent 5852612cd4c461e5219db73cc52de0c643c414e8 -x86:x2apic: Disable x2apic on x86-32 permanently - -x2apic initialization on x86_32 uses vcpu pointer before it is -initialized. As x2apic is unlikely to be used on x86_32, this patch -disables x2apic permanently on x86_32. It also asserts the sanity of -vcpu pointer before dereference to prevent further misuse. - -Signed-off-by: Fengzhe Zhang - -jb: Moved logic into check_x2apic_preenabled(), disabled dead code on - x86_32. - -Index: xen-4.0.2-testing/xen/arch/x86/apic.c -=================================================================== ---- xen-4.0.2-testing.orig/xen/arch/x86/apic.c -+++ xen-4.0.2-testing/xen/arch/x86/apic.c -@@ -959,6 +959,10 @@ void x2apic_setup(void) - if ( !cpu_has_x2apic ) - return; - -+#ifdef __i386__ -+ BUG(); -+#else -+ - if ( !opt_x2apic ) - { - if ( !x2apic_enabled ) -@@ -1020,6 +1024,7 @@ restore_out: - unmask_8259A(); - - out: -+#endif /* !__i386__ */ - if ( ioapic_entries ) - free_ioapic_entries(ioapic_entries); - } -Index: xen-4.0.2-testing/xen/arch/x86/genapic/x2apic.c -=================================================================== ---- xen-4.0.2-testing.orig/xen/arch/x86/genapic/x2apic.c -+++ xen-4.0.2-testing/xen/arch/x86/genapic/x2apic.c -@@ -25,6 +25,8 @@ - #include - #include - -+#ifndef __i386__ -+ - static int x2apic_phys; /* By default we use logical cluster mode. */ - boolean_param("x2apic_phys", x2apic_phys); - -@@ -137,6 +139,8 @@ const struct genapic *apic_x2apic_probe( - return x2apic_phys ? &apic_x2apic_phys : &apic_x2apic_cluster; - } - -+#endif /* !__i386__ */ -+ - void __init check_x2apic_preenabled(void) - { - u32 lo, hi; -@@ -149,7 +153,19 @@ void __init check_x2apic_preenabled(void - if ( lo & MSR_IA32_APICBASE_EXTD ) - { - printk("x2APIC mode is already enabled by BIOS.\n"); -+#ifndef __i386__ - x2apic_enabled = 1; - genapic = apic_x2apic_probe(); -+#else -+ lo &= ~(MSR_IA32_APICBASE_ENABLE | MSR_IA32_APICBASE_EXTD); -+ wrmsr(MSR_IA32_APICBASE, lo, hi); -+ lo |= MSR_IA32_APICBASE_ENABLE; -+ wrmsr(MSR_IA32_APICBASE, lo, hi); -+ printk("x2APIC disabled permanently on x86_32.\n"); -+#endif - } -+ -+#ifdef __i386__ -+ clear_bit(X86_FEATURE_X2APIC, boot_cpu_data.x86_capability); -+#endif - } diff --git a/22790-svm-resume-migrate-pirqs.patch b/22790-svm-resume-migrate-pirqs.patch deleted file mode 100644 index 9c44d0f..0000000 --- a/22790-svm-resume-migrate-pirqs.patch +++ /dev/null @@ -1,24 +0,0 @@ -# HG changeset patch -# User Keir Fraser -# Date 1295625605 0 -# Node ID 43592043cefc8357e6e6a0ab9ba85ca480968cb1 -# Parent 9bd5f65050f8014de7d0fcf9d89ed8c441f261fa -svm: migrate pirq with vcpu - -hvm_migrate_pirqs() is missing in svm_do_resume(). - -Signed-off-by: Wei Wang - -Index: xen-4.0.2-testing/xen/arch/x86/hvm/svm/svm.c -=================================================================== ---- xen-4.0.2-testing.orig/xen/arch/x86/hvm/svm/svm.c -+++ xen-4.0.2-testing/xen/arch/x86/hvm/svm/svm.c -@@ -697,7 +697,7 @@ static void svm_do_resume(struct vcpu *v - { - v->arch.hvm_svm.launch_core = smp_processor_id(); - hvm_migrate_timers(v); -- -+ hvm_migrate_pirqs(v); - /* Migrating to another ASID domain. Request a new ASID. */ - hvm_asid_flush_vcpu(v); - } diff --git a/32on64-extra-mem.patch b/32on64-extra-mem.patch index dd04837..5098f21 100644 --- a/32on64-extra-mem.patch +++ b/32on64-extra-mem.patch @@ -1,8 +1,8 @@ -Index: xen-4.0.2-testing/tools/python/xen/xend/XendDomainInfo.py +Index: xen-4.1.0-testing/tools/python/xen/xend/XendDomainInfo.py =================================================================== ---- xen-4.0.2-testing.orig/tools/python/xen/xend/XendDomainInfo.py -+++ xen-4.0.2-testing/tools/python/xen/xend/XendDomainInfo.py -@@ -2919,7 +2919,7 @@ class XendDomainInfo: +--- xen-4.1.0-testing.orig/tools/python/xen/xend/XendDomainInfo.py ++++ xen-4.1.0-testing/tools/python/xen/xend/XendDomainInfo.py +@@ -2912,7 +2912,7 @@ class XendDomainInfo: self.guest_bitsize = self.image.getBitSize() # Make sure there's enough RAM available for the domain diff --git a/7410-qemu-alt-gr.patch b/7410-qemu-alt-gr.patch deleted file mode 100644 index 6f861fe..0000000 --- a/7410-qemu-alt-gr.patch +++ /dev/null @@ -1,118 +0,0 @@ -# HG changeset patch -# User Ian Jackson -# Date 1284481903 -3600 -# Node ID f71a4c18e34e86e1011662fa42c10ec54bff0688 -# Parent 080b5a094d4e0acab6646125f91f988911409016 -ioemu: fix VNC altgr-insert behavior - -When access to a Xen DomU (Linux) from a VNC client in Windows, alt-gr -key is not working properly with Spanish keyboard. When Alt + another -key pressed, vncserver receives Altgr down, Altgr up and key down -messages in order, that causes incorrect output. - -With following patch, when vncerver receives key down message, it -first check if the keysym needs altgr modifer, if it needs altgr -modifier but altgr is not 'down', sending altgr keycode before sending -key keycode. - -Signed-off-by: Chunyan Liu - -committer: Ian Jackson -git-commit-id: f95d202ed6444dacb15fbea4dee185eb0e048d9a - -Index: xen-4.0.2-testing/tools/ioemu-qemu-xen/keymaps.c -=================================================================== ---- xen-4.0.2-testing.orig/tools/ioemu-qemu-xen/keymaps.c -+++ xen-4.0.2-testing/tools/ioemu-qemu-xen/keymaps.c -@@ -51,6 +51,7 @@ typedef struct { - struct key_range *numlock_range; - struct key_range *shift_range; - struct key_range *localstate_range; -+ struct key_range *altgr_range; - } kbd_layout_t; - - static void add_to_key_range(struct key_range **krp, int code) { -@@ -133,6 +134,10 @@ static kbd_layout_t *parse_keyboard_layo - add_to_key_range(&k->localstate_range, keycode); - //fprintf(stderr, "localstate keysym %04x keycode %d\n", keysym, keycode); - } -+ if (rest && strstr(rest, "altgr")) { -+ add_to_key_range(&k->altgr_range, keysym); -+ //fprintf(stderr, "altgr keysym %04x keycode %d\n", keysym, keycode); -+ } - - /* if(keycode&0x80) - keycode=(keycode<<8)^0x80e0; */ -@@ -233,3 +238,16 @@ static inline int keycode_is_shiftable(v - return 0; - return 1; - } -+ -+static inline int keysym_is_altgr(void *kbd_layout, int keysym) -+{ -+ kbd_layout_t *k = kbd_layout; -+ struct key_range *kr; -+ -+ for (kr = k->altgr_range; kr; kr = kr->next) -+ if (keysym >= kr->start && keysym <= kr->end){ -+ return 1; -+ } -+ return 0; -+} -+ -Index: xen-4.0.2-testing/tools/ioemu-qemu-xen/vnc.c -=================================================================== ---- xen-4.0.2-testing.orig/tools/ioemu-qemu-xen/vnc.c -+++ xen-4.0.2-testing/tools/ioemu-qemu-xen/vnc.c -@@ -1274,12 +1274,27 @@ static void press_key_shift_up(VncState - } - } - -+static void press_key_altgr_down(VncState *vs, int down) -+{ -+ kbd_put_keycode(0xe0); -+ if (down){ -+ kbd_put_keycode(0xb8 & 0x7f); -+ vs->modifiers_state[0xb8] = 1; -+ } -+ else { -+ kbd_put_keycode(0xb8 | 0x80); -+ vs->modifiers_state[0xb8] = 0; -+ } -+} -+ - static void do_key_event(VncState *vs, int down, uint32_t sym) - { - int keycode; - int shift_keys = 0; - int shift = 0; - int keypad = 0; -+ int altgr = 0; -+ int altgr_keys = 0; - - if (is_graphic_console()) { - if (sym >= 'A' && sym <= 'Z') { -@@ -1289,8 +1304,11 @@ static void do_key_event(VncState *vs, i - else { - shift = keysym_is_shift(vs->kbd_layout, sym & 0xFFFF); - } -+ -+ altgr = keysym_is_altgr(vs->kbd_layout, sym & 0xFFFF); - } - shift_keys = vs->modifiers_state[0x2a] | vs->modifiers_state[0x36]; -+ altgr_keys = vs->modifiers_state[0xb8]; - - keycode = keysym2scancode(vs->kbd_layout, sym & 0xFFFF); - if (keycode == 0) { -@@ -1357,6 +1375,11 @@ static void do_key_event(VncState *vs, i - } - - if (is_graphic_console()) { -+ -+ if (altgr && !altgr_keys) { -+ press_key_altgr_down(vs, down); -+ } -+ - /* If the shift state needs to change then simulate an additional - keypress before sending this one. Ignore for non shiftable keys. - */ diff --git a/7426-xenfb-depth.patch b/7426-xenfb-depth.patch deleted file mode 100644 index e5c5f14..0000000 --- a/7426-xenfb-depth.patch +++ /dev/null @@ -1,50 +0,0 @@ -Index: xen-4.0.2-testing/tools/ioemu-qemu-xen/hw/xenfb.c -=================================================================== ---- xen-4.0.2-testing.orig/tools/ioemu-qemu-xen/hw/xenfb.c -+++ xen-4.0.2-testing/tools/ioemu-qemu-xen/hw/xenfb.c -@@ -622,6 +622,18 @@ static void xenfb_guest_copy(struct XenF - oops = 1; - } - break; -+ case 16: -+ if (bpp == 16) { -+ for (line = y; line < (y+h); line++) { -+ memcpy (data + (line * linesize) + (x * bpp / 8), xenfb->pixels + xenfb->offset -+ + (line * xenfb->row_stride) + (x * xenfb->depth / 8), w * xenfb->depth / 8); -+ } -+ } else if (bpp == 32) { -+ BLT(uint16_t, uint32_t, 5, 6, 5, 8, 8, 8); -+ } else { -+ oops = 1; -+ } -+ break; - case 24: - if (bpp == 16) { - BLT(uint32_t, uint16_t, 8, 8, 8, 5, 6, 5); -@@ -631,6 +643,18 @@ static void xenfb_guest_copy(struct XenF - oops = 1; - } - break; -+ case 32: -+ if (bpp == 16) { -+ BLT(uint32_t, uint16_t, 8, 8, 8, 5, 6, 5); -+ } else if (bpp == 32) { -+ for (line = y; line < (y+h); line++) { -+ memcpy (data + (line * linesize) + (x * bpp / 8), xenfb->pixels + xenfb->offset -+ + (line * xenfb->row_stride) + (x * xenfb->depth / 8), w * xenfb->depth / 8); -+ } -+ } else { -+ oops = 1; -+ } -+ break; - default: - oops = 1; - } -@@ -784,6 +808,7 @@ static void xenfb_update(void *opaque) - static void xenfb_invalidate(void *opaque) - { - struct XenFB *xenfb = opaque; -+ xenfb->do_resize = 1; - xenfb->up_fullscreen = 1; - } - diff --git a/7433-qemu-altgr.patch b/7433-qemu-altgr.patch deleted file mode 100644 index 32f3ff8..0000000 --- a/7433-qemu-altgr.patch +++ /dev/null @@ -1,106 +0,0 @@ -# HG changeset patch -# User Chun Yan Liu -# Date 1294271316 0 -# Node ID a283996796c91dd29ecff444b78798e0ce902047 -# Parent 39df13908a3ad54e79dd3b53ed307e57f12f6d3d -fix '|' key display problem in en-us with altgr processing - -Commit f95d202ed644 handles altgr-insert problem. Unfortunately, with -that patch, there is a problem in En-us keyboard: '|' (bar) cannot be -displayed. After checking keymap files, we found there are two -definitions to "bar" in en-us: bar 0x56 altgr (in "common") bar 0x2b -shift (in "en-us") First line is actually invalid in en-us -lanuage. The 2nd definition will cover the 1st one. - -The previous change in didn't consider multi-definition case. It scans -keymap files, if keysym needs altgr, it will records that, after that, -if keysym is pressed but altgr not pressed, it will add an altgr press -opeartion. It is correct if all keysyms are unique and valid. But in -the above multi-definition case, there is problem: when reading bar -0x56 altgr (in "common") it will record altgr needed, but in fact, -that definition won't be used, it always use the 2nd definition and -won't need altgr. Then if the keysym is pressed, the code will still -add an altgr press operation, that will cause problem. - -So, if we cannot avoid multi-definition in keymap files, the altgr -flag (whether altgr needed or not) should also be refreshed according -to the 2nd defintion. In the above case, when reading the 1st line, it -records altgr needed; then reading 2nd line, 2nd definition will cover -the 1st, meanwhile the altgr flag should be reset (the 2nd definition -doesn't need altgr, so altgr flag should be removed.) - -Following patch supplements f95d202ed644, and solve the -problem. - -Signed-off-by: Chun Yan Liu -Signed-off-by: Ian Jackson - -committer: Ian Jackson -git-commit-id: 99d53fbb69d3e03be61ae10506a304a3d08d792f - -# HG changeset patch -# User Jan Beulich -# Date 1295287237 0 -# Node ID b47bf8f7a5e1959d6f5c62febaef9e81dc3231a0 -# Parent b6bbe8be0afa54774a19ef43767a029ebddb2666 -keymaps.c: fix use after free in del_key_range - -Commit 99d53fbb69d3e03be61ae10506a304a3d08d792f introduced this, and -the compiler indirectly warned about it. - -The patch is only compile tested (I don't even know how to reproduce -the original problem), but I suppose worth applying regardless. - -Signed-off-by: Jan Beulich -Cc: Chun Yan Liu - -committer: Ian Jackson -git-commit-id: fdb22f24bc8adb3455b771d804496e11b4570085 - -Index: xen-4.0.2-testing/tools/ioemu-qemu-xen/keymaps.c -=================================================================== ---- xen-4.0.2-testing.orig/tools/ioemu-qemu-xen/keymaps.c -+++ xen-4.0.2-testing/tools/ioemu-qemu-xen/keymaps.c -@@ -54,6 +54,17 @@ typedef struct { - struct key_range *altgr_range; - } kbd_layout_t; - -+static void del_key_range(struct key_range **krp, int code) { -+ struct key_range *kr; -+ while ((kr = *krp) != NULL) { -+ if (code >= kr->start && code <= kr->end) { -+ *krp = kr->next; -+ qemu_free(kr); -+ } else -+ krp = &kr->next; -+ } -+} -+ - static void add_to_key_range(struct key_range **krp, int code) { - struct key_range *kr; - for (kr = *krp; kr; kr = kr->next) { -@@ -137,6 +148,8 @@ static kbd_layout_t *parse_keyboard_layo - if (rest && strstr(rest, "altgr")) { - add_to_key_range(&k->altgr_range, keysym); - //fprintf(stderr, "altgr keysym %04x keycode %d\n", keysym, keycode); -+ } else { -+ del_key_range(&k->altgr_range, keysym); - } - - /* if(keycode&0x80) -Index: xen-4.0.2-testing/tools/ioemu-qemu-xen/vnc.c -=================================================================== ---- xen-4.0.2-testing.orig/tools/ioemu-qemu-xen/vnc.c -+++ xen-4.0.2-testing/tools/ioemu-qemu-xen/vnc.c -@@ -1279,11 +1279,9 @@ static void press_key_altgr_down(VncStat - kbd_put_keycode(0xe0); - if (down){ - kbd_put_keycode(0xb8 & 0x7f); -- vs->modifiers_state[0xb8] = 1; - } - else { - kbd_put_keycode(0xb8 | 0x80); -- vs->modifiers_state[0xb8] = 0; - } - } - diff --git a/7434-qemu-rlimit-as.patch b/7434-qemu-rlimit-as.patch deleted file mode 100644 index 5a5090c..0000000 --- a/7434-qemu-rlimit-as.patch +++ /dev/null @@ -1,36 +0,0 @@ -# HG changeset patch -# User Jan Beulich -# Date 1294771190 0 -# Node ID d224cef9d82c5c1ba9a6d73ca2628f288ce6f434 -# Parent a283996796c91dd29ecff444b78798e0ce902047 -bump RLIMIT_AS if restricted -References: bnc#641419 - -Mostly the same as is already being done for several other RLIMIT_* -values. - -Signed-off-by: Jan Beulich -Acked-by: Stefano Stabellini - -committer: Ian Jackson -git-commit-id: 2aa36d470e97f4baa219f78df82e2d3fe3d9f96d - - -Index: xen-4.0.2-testing/tools/ioemu-qemu-xen/vl.c -=================================================================== ---- xen-4.0.2-testing.orig/tools/ioemu-qemu-xen/vl.c -+++ xen-4.0.2-testing/tools/ioemu-qemu-xen/vl.c -@@ -4845,6 +4845,13 @@ int main(int argc, char **argv, char **e - rl.rlim_cur = rl.rlim_max; - if (setrlimit(RLIMIT_DATA, &rl) != 0) - perror("setrlimit(RLIMIT_DATA)"); -+ if (getrlimit(RLIMIT_AS, &rl) == 0) { -+ rl.rlim_cur = rl.rlim_max; -+ if (setrlimit(RLIMIT_AS, &rl) != 0) -+ perror("setrlimit(RLIMIT_AS)"); -+ } else { -+ perror("getrlimit(RLIMIT_AS)"); -+ } - rl.rlim_cur = RLIM_INFINITY; - rl.rlim_max = RLIM_INFINITY; - if (setrlimit(RLIMIT_RSS, &rl) != 0) diff --git a/altgr_2.patch b/altgr_2.patch index d6160b8..8a53d6d 100644 --- a/altgr_2.patch +++ b/altgr_2.patch @@ -29,10 +29,10 @@ keycodes up and down events and make sure the intentionally added altgr keycode Signed-off by Chunyan Liu (cyliu@novell.com) -Index: xen-4.0.2-testing/tools/ioemu-qemu-xen/vnc.c +Index: xen-4.1.0-testing/tools/ioemu-qemu-xen/vnc.c =================================================================== ---- xen-4.0.2-testing.orig/tools/ioemu-qemu-xen/vnc.c -+++ xen-4.0.2-testing/tools/ioemu-qemu-xen/vnc.c +--- xen-4.1.0-testing.orig/tools/ioemu-qemu-xen/vnc.c ++++ xen-4.1.0-testing/tools/ioemu-qemu-xen/vnc.c @@ -1308,6 +1308,9 @@ static void do_key_event(VncState *vs, i shift_keys = vs->modifiers_state[0x2a] | vs->modifiers_state[0x36]; altgr_keys = vs->modifiers_state[0xb8]; diff --git a/bdrv_default_rwflag.patch b/bdrv_default_rwflag.patch index 8b91b50..fb6de00 100644 --- a/bdrv_default_rwflag.patch +++ b/bdrv_default_rwflag.patch @@ -1,11 +1,11 @@ Subject: modify default read/write flag in bdrv_init. Signed-off by Chunyan Liu -Index: xen-4.0.2-testing/tools/ioemu-qemu-xen/vl.c +Index: xen-4.1.0-testing/tools/ioemu-qemu-xen/vl.c =================================================================== ---- xen-4.0.2-testing.orig/tools/ioemu-qemu-xen/vl.c -+++ xen-4.0.2-testing/tools/ioemu-qemu-xen/vl.c -@@ -2612,6 +2612,8 @@ int drive_init(struct drive_opt *arg, in +--- xen-4.1.0-testing.orig/tools/ioemu-qemu-xen/vl.c ++++ xen-4.1.0-testing/tools/ioemu-qemu-xen/vl.c +@@ -2617,6 +2617,8 @@ int drive_init(struct drive_opt *arg, in strncpy(drives_table[nb_drives].serial, serial, sizeof(serial)); nb_drives++; @@ -13,8 +13,8 @@ Index: xen-4.0.2-testing/tools/ioemu-qemu-xen/vl.c + switch(type) { case IF_IDE: - case IF_SCSI: -@@ -2624,6 +2626,7 @@ int drive_init(struct drive_opt *arg, in + case IF_XEN: +@@ -2630,6 +2632,7 @@ int drive_init(struct drive_opt *arg, in break; case MEDIA_CDROM: bdrv_set_type_hint(bdrv, BDRV_TYPE_CDROM); @@ -22,7 +22,7 @@ Index: xen-4.0.2-testing/tools/ioemu-qemu-xen/vl.c break; } break; -@@ -2644,7 +2647,6 @@ int drive_init(struct drive_opt *arg, in +@@ -2650,7 +2653,6 @@ int drive_init(struct drive_opt *arg, in } if (!file[0]) return -2; diff --git a/bdrv_open2_fix_flags.patch b/bdrv_open2_fix_flags.patch index 225606c..dfbb84e 100644 --- a/bdrv_open2_fix_flags.patch +++ b/bdrv_open2_fix_flags.patch @@ -1,7 +1,7 @@ -Index: xen-4.0.2-testing/tools/ioemu-qemu-xen/block.c +Index: xen-4.1.0-testing/tools/ioemu-qemu-xen/block.c =================================================================== ---- xen-4.0.2-testing.orig/tools/ioemu-qemu-xen/block.c -+++ xen-4.0.2-testing/tools/ioemu-qemu-xen/block.c +--- xen-4.1.0-testing.orig/tools/ioemu-qemu-xen/block.c ++++ xen-4.1.0-testing/tools/ioemu-qemu-xen/block.c @@ -350,7 +350,7 @@ int bdrv_file_open(BlockDriverState **pb int bdrv_open(BlockDriverState *bs, const char *filename, int flags) @@ -28,10 +28,10 @@ Index: xen-4.0.2-testing/tools/ioemu-qemu-xen/block.c ret = drv->bdrv_open(bs, filename, open_flags); if ((ret == -EACCES || ret == -EPERM) && !(flags & BDRV_O_FILE)) { ret = drv->bdrv_open(bs, filename, open_flags & ~BDRV_O_RDWR); -Index: xen-4.0.2-testing/tools/ioemu-qemu-xen/hw/usb-msd.c +Index: xen-4.1.0-testing/tools/ioemu-qemu-xen/hw/usb-msd.c =================================================================== ---- xen-4.0.2-testing.orig/tools/ioemu-qemu-xen/hw/usb-msd.c -+++ xen-4.0.2-testing/tools/ioemu-qemu-xen/hw/usb-msd.c +--- xen-4.1.0-testing.orig/tools/ioemu-qemu-xen/hw/usb-msd.c ++++ xen-4.1.0-testing/tools/ioemu-qemu-xen/hw/usb-msd.c @@ -551,7 +551,7 @@ USBDevice *usb_msd_init(const char *file s = qemu_mallocz(sizeof(MSDState)); @@ -41,10 +41,10 @@ Index: xen-4.0.2-testing/tools/ioemu-qemu-xen/hw/usb-msd.c goto fail; s->bs = bdrv; *pbs = bdrv; -Index: xen-4.0.2-testing/tools/ioemu-qemu-xen/qemu-img.c +Index: xen-4.1.0-testing/tools/ioemu-qemu-xen/qemu-img.c =================================================================== ---- xen-4.0.2-testing.orig/tools/ioemu-qemu-xen/qemu-img.c -+++ xen-4.0.2-testing/tools/ioemu-qemu-xen/qemu-img.c +--- xen-4.1.0-testing.orig/tools/ioemu-qemu-xen/qemu-img.c ++++ xen-4.1.0-testing/tools/ioemu-qemu-xen/qemu-img.c @@ -32,7 +32,7 @@ #endif diff --git a/bdrv_open2_flags_2.patch b/bdrv_open2_flags_2.patch index 906b1c5..e299095 100644 --- a/bdrv_open2_flags_2.patch +++ b/bdrv_open2_flags_2.patch @@ -1,7 +1,7 @@ -Index: xen-4.0.2-testing/tools/ioemu-qemu-xen/hw/xen_blktap.c +Index: xen-4.1.0-testing/tools/ioemu-qemu-xen/hw/xen_blktap.c =================================================================== ---- xen-4.0.2-testing.orig/tools/ioemu-qemu-xen/hw/xen_blktap.c -+++ xen-4.0.2-testing/tools/ioemu-qemu-xen/hw/xen_blktap.c +--- xen-4.1.0-testing.orig/tools/ioemu-qemu-xen/hw/xen_blktap.c ++++ xen-4.1.0-testing/tools/ioemu-qemu-xen/hw/xen_blktap.c @@ -237,6 +237,7 @@ static int open_disk(struct td_state *s, BlockDriver* drv; char* devname; @@ -19,10 +19,10 @@ Index: xen-4.0.2-testing/tools/ioemu-qemu-xen/hw/xen_blktap.c fprintf(stderr, "Could not open image file %s\n", path); return -ENOMEM; } -Index: xen-4.0.2-testing/tools/ioemu-qemu-xen/xenstore.c +Index: xen-4.1.0-testing/tools/ioemu-qemu-xen/xenstore.c =================================================================== ---- xen-4.0.2-testing.orig/tools/ioemu-qemu-xen/xenstore.c -+++ xen-4.0.2-testing/tools/ioemu-qemu-xen/xenstore.c +--- xen-4.1.0-testing.orig/tools/ioemu-qemu-xen/xenstore.c ++++ xen-4.1.0-testing/tools/ioemu-qemu-xen/xenstore.c @@ -136,7 +136,8 @@ static void insert_media(void *opaque) else format = &bdrv_raw; @@ -33,7 +33,7 @@ Index: xen-4.0.2-testing/tools/ioemu-qemu-xen/xenstore.c #ifdef CONFIG_STUBDOM { char *buf, *backend, *params_path, *params; -@@ -469,7 +470,8 @@ void xenstore_parse_domain_config(int hv +@@ -511,7 +512,8 @@ void xenstore_parse_domain_config(int hv } for (i = 0; i < num; i++) { @@ -43,7 +43,7 @@ Index: xen-4.0.2-testing/tools/ioemu-qemu-xen/xenstore.c /* read the backend path */ xenstore_get_backend_path(&bpath, "vbd", danger_path, hvm_domid, e_danger[i]); if (bpath == NULL) -@@ -555,6 +557,17 @@ void xenstore_parse_domain_config(int hv +@@ -597,6 +599,17 @@ void xenstore_parse_domain_config(int hv format = &bdrv_raw; } @@ -61,7 +61,7 @@ Index: xen-4.0.2-testing/tools/ioemu-qemu-xen/xenstore.c #if 0 /* Phantom VBDs are disabled because the use of paths * from guest-controlled areas in xenstore is unsafe. -@@ -622,7 +635,7 @@ void xenstore_parse_domain_config(int hv +@@ -664,7 +677,7 @@ void xenstore_parse_domain_config(int hv #ifdef CONFIG_STUBDOM if (pasprintf(&danger_buf, "%s/device/vbd/%s", danger_path, e_danger[i]) == -1) continue; @@ -70,7 +70,7 @@ Index: xen-4.0.2-testing/tools/ioemu-qemu-xen/xenstore.c pstrcpy(bs->filename, sizeof(bs->filename), params); } #else -@@ -668,7 +681,7 @@ void xenstore_parse_domain_config(int hv +@@ -710,7 +723,7 @@ void xenstore_parse_domain_config(int hv fprintf(stderr, "Using file %s in read-%s mode\n", bs->filename, is_readonly ? "only" : "write"); diff --git a/blktap-pv-cdrom.patch b/blktap-pv-cdrom.patch index 7beb692..26aae02 100644 --- a/blktap-pv-cdrom.patch +++ b/blktap-pv-cdrom.patch @@ -1,7 +1,7 @@ -Index: xen-4.0.2-testing/tools/blktap/drivers/block-cdrom.c +Index: xen-4.1.0-testing/tools/blktap/drivers/block-cdrom.c =================================================================== --- /dev/null -+++ xen-4.0.2-testing/tools/blktap/drivers/block-cdrom.c ++++ xen-4.1.0-testing/tools/blktap/drivers/block-cdrom.c @@ -0,0 +1,535 @@ +/* block-cdrom.c + * @@ -538,10 +538,10 @@ Index: xen-4.0.2-testing/tools/blktap/drivers/block-cdrom.c + .td_get_parent_id = tdcdrom_get_parent_id, + .td_validate_parent = tdcdrom_validate_parent +}; -Index: xen-4.0.2-testing/xen/include/public/io/cdromif.h +Index: xen-4.1.0-testing/xen/include/public/io/cdromif.h =================================================================== --- /dev/null -+++ xen-4.0.2-testing/xen/include/public/io/cdromif.h ++++ xen-4.1.0-testing/xen/include/public/io/cdromif.h @@ -0,0 +1,122 @@ +/****************************************************************************** + * cdromif.h @@ -665,19 +665,19 @@ Index: xen-4.0.2-testing/xen/include/public/io/cdromif.h + sizeof(struct vcd_generic_command) - sizeof(struct request_sense)) + +#endif -Index: xen-4.0.2-testing/tools/blktap/drivers/Makefile +Index: xen-4.1.0-testing/tools/blktap/drivers/Makefile =================================================================== ---- xen-4.0.2-testing.orig/tools/blktap/drivers/Makefile -+++ xen-4.0.2-testing/tools/blktap/drivers/Makefile +--- xen-4.1.0-testing.orig/tools/blktap/drivers/Makefile ++++ xen-4.1.0-testing/tools/blktap/drivers/Makefile @@ -28,8 +28,9 @@ CFLAGS += -DMEMSHR MEMSHRLIBS += $(MEMSHR_DIR)/libmemshr.a endif --LDFLAGS_blktapctrl := $(LDFLAGS_libxenctrl) $(LDFLAGS_libxenstore) $(MEMSHRLIBS) -L../lib -lblktap -lrt -lm -lpthread --LDFLAGS_img := $(LIBAIO_DIR)/libaio.a $(CRYPT_LIB) -lpthread -lz -+LDFLAGS_xen := $(LDFLAGS_libxenctrl) $(LDFLAGS_libxenstore) -+LDFLAGS_blktapctrl := $(LDFLAGS_xen) $(MEMSHRLIBS) -L../lib -lblktap -lrt -lm -lpthread $(LDFLAGS_xen) -+LDFLAGS_img := $(LIBAIO_DIR)/libaio.a $(CRYPT_LIB) -lpthread -lz $(LDFLAGS_xen) +-LDLIBS_blktapctrl := $(MEMSHRLIBS) $(LDLIBS_libxenctrl) $(LDLIBS_libxenstore) -L../lib -lblktap -lrt -lm -lpthread +-LDLIBS_img := $(LIBAIO_DIR)/libaio.a $(CRYPT_LIB) -lpthread -lz ++LDLIBS_xen := $(LDLIBS_libxenctrl) $(LDLIBS_libxenstore) ++LDLIBS_blktapctrl := $(MEMSHRLIBS) $(LDLIBS_xen) -L../lib -lblktap -lrt -lm -lpthread ++LDLIBS_img := $(LIBAIO_DIR)/libaio.a $(CRYPT_LIB) -lpthread -lz $(LDLIBS_xen) BLK-OBJS-y := block-aio.o BLK-OBJS-y += block-sync.o @@ -689,10 +689,10 @@ Index: xen-4.0.2-testing/tools/blktap/drivers/Makefile BLK-OBJS-y += aes.o BLK-OBJS-y += tapaio.o BLK-OBJS-$(CONFIG_Linux) += blk_linux.o -Index: xen-4.0.2-testing/tools/blktap/drivers/tapdisk.h +Index: xen-4.1.0-testing/tools/blktap/drivers/tapdisk.h =================================================================== ---- xen-4.0.2-testing.orig/tools/blktap/drivers/tapdisk.h -+++ xen-4.0.2-testing/tools/blktap/drivers/tapdisk.h +--- xen-4.1.0-testing.orig/tools/blktap/drivers/tapdisk.h ++++ xen-4.1.0-testing/tools/blktap/drivers/tapdisk.h @@ -137,6 +137,9 @@ struct tap_disk { int (*td_get_parent_id) (struct disk_driver *dd, struct disk_id *id); int (*td_validate_parent)(struct disk_driver *dd, @@ -737,10 +737,10 @@ Index: xen-4.0.2-testing/tools/blktap/drivers/tapdisk.h }; typedef struct driver_list_entry { -Index: xen-4.0.2-testing/tools/blktap/lib/blktaplib.h +Index: xen-4.1.0-testing/tools/blktap/lib/blktaplib.h =================================================================== ---- xen-4.0.2-testing.orig/tools/blktap/lib/blktaplib.h -+++ xen-4.0.2-testing/tools/blktap/lib/blktaplib.h +--- xen-4.1.0-testing.orig/tools/blktap/lib/blktaplib.h ++++ xen-4.1.0-testing/tools/blktap/lib/blktaplib.h @@ -225,6 +225,7 @@ typedef struct msg_pid { #define DISK_TYPE_RAM 3 #define DISK_TYPE_QCOW 4 @@ -749,25 +749,23 @@ Index: xen-4.0.2-testing/tools/blktap/lib/blktaplib.h /* xenstore/xenbus: */ #define DOMNAME "Domain-0" -Index: xen-4.0.2-testing/xen/include/public/io/blkif.h +Index: xen-4.1.0-testing/xen/include/public/io/blkif.h =================================================================== ---- xen-4.0.2-testing.orig/xen/include/public/io/blkif.h -+++ xen-4.0.2-testing/xen/include/public/io/blkif.h -@@ -76,6 +76,10 @@ - * "feature-flush-cache" node! +--- xen-4.1.0-testing.orig/xen/include/public/io/blkif.h ++++ xen-4.1.0-testing/xen/include/public/io/blkif.h +@@ -80,7 +80,7 @@ + * Used in SLES sources for device specific command packet + * contained within the request. Reserved for that purpose. */ - #define BLKIF_OP_FLUSH_DISKCACHE 3 -+/* -+ * Device specific command packet contained within the request -+ */ -+#define BLKIF_OP_PACKET 4 - +-#define BLKIF_OP_RESERVED_1 4 ++#define BLKIF_OP_PACKET 4 /* - * Maximum scatter/gather segments per request. -Index: xen-4.0.2-testing/tools/blktap/drivers/tapdisk.c + * Recognised only if "feature-trim" is present in backend xenbus info. + * The "feature-trim" node contains a boolean indicating whether trim +Index: xen-4.1.0-testing/tools/blktap/drivers/tapdisk.c =================================================================== ---- xen-4.0.2-testing.orig/tools/blktap/drivers/tapdisk.c -+++ xen-4.0.2-testing/tools/blktap/drivers/tapdisk.c +--- xen-4.1.0-testing.orig/tools/blktap/drivers/tapdisk.c ++++ xen-4.1.0-testing/tools/blktap/drivers/tapdisk.c @@ -735,6 +735,22 @@ static void get_io_request(struct td_sta goto out; } @@ -791,11 +789,11 @@ Index: xen-4.0.2-testing/tools/blktap/drivers/tapdisk.c default: DPRINTF("Unknown block operation\n"); break; -Index: xen-4.0.2-testing/tools/python/xen/xend/server/BlktapController.py +Index: xen-4.1.0-testing/tools/python/xen/xend/server/BlktapController.py =================================================================== ---- xen-4.0.2-testing.orig/tools/python/xen/xend/server/BlktapController.py -+++ xen-4.0.2-testing/tools/python/xen/xend/server/BlktapController.py -@@ -21,6 +21,7 @@ blktap1_disk_types = [ +--- xen-4.1.0-testing.orig/tools/python/xen/xend/server/BlktapController.py ++++ xen-4.1.0-testing/tools/python/xen/xend/server/BlktapController.py +@@ -15,6 +15,7 @@ blktap1_disk_types = [ 'ram', 'qcow', 'qcow2', diff --git a/blktap.patch b/blktap.patch index 7c7ac67..c55c388 100644 --- a/blktap.patch +++ b/blktap.patch @@ -1,11 +1,11 @@ bug #239173 bug #242953 -Index: xen-4.0.2-testing/tools/python/xen/xend/XendDomainInfo.py +Index: xen-4.1.0-testing/tools/python/xen/xend/XendDomainInfo.py =================================================================== ---- xen-4.0.2-testing.orig/tools/python/xen/xend/XendDomainInfo.py -+++ xen-4.0.2-testing/tools/python/xen/xend/XendDomainInfo.py -@@ -3291,7 +3291,7 @@ class XendDomainInfo: +--- xen-4.1.0-testing.orig/tools/python/xen/xend/XendDomainInfo.py ++++ xen-4.1.0-testing/tools/python/xen/xend/XendDomainInfo.py +@@ -3295,7 +3295,7 @@ class XendDomainInfo: (fn, BOOTLOADER_LOOPBACK_DEVICE)) vbd = { @@ -14,11 +14,11 @@ Index: xen-4.0.2-testing/tools/python/xen/xend/XendDomainInfo.py 'device': BOOTLOADER_LOOPBACK_DEVICE, } -Index: xen-4.0.2-testing/tools/ioemu-qemu-xen/xenstore.c +Index: xen-4.1.0-testing/tools/ioemu-qemu-xen/xenstore.c =================================================================== ---- xen-4.0.2-testing.orig/tools/ioemu-qemu-xen/xenstore.c -+++ xen-4.0.2-testing/tools/ioemu-qemu-xen/xenstore.c -@@ -397,9 +397,9 @@ void xenstore_parse_domain_config(int hv +--- xen-4.1.0-testing.orig/tools/ioemu-qemu-xen/xenstore.c ++++ xen-4.1.0-testing/tools/ioemu-qemu-xen/xenstore.c +@@ -447,9 +447,9 @@ void xenstore_parse_domain_config(int hv { char **e_danger = NULL; char *buf = NULL; @@ -30,7 +30,7 @@ Index: xen-4.0.2-testing/tools/ioemu-qemu-xen/xenstore.c unsigned int len, num, hd_index, pci_devid = 0; BlockDriverState *bs; BlockDriver *format; -@@ -444,6 +444,14 @@ void xenstore_parse_domain_config(int hv +@@ -486,6 +486,14 @@ void xenstore_parse_domain_config(int hv e_danger[i]); if (bpath == NULL) continue; @@ -45,7 +45,7 @@ Index: xen-4.0.2-testing/tools/ioemu-qemu-xen/xenstore.c /* read the name of the device */ if (pasprintf(&buf, "%s/dev", bpath) == -1) continue; -@@ -738,6 +746,7 @@ void xenstore_parse_domain_config(int hv +@@ -775,6 +783,7 @@ void xenstore_parse_domain_config(int hv free(mode); free(params); free(dev); diff --git a/blktap2.patch b/blktap2.patch deleted file mode 100644 index 61738d5..0000000 --- a/blktap2.patch +++ /dev/null @@ -1,26 +0,0 @@ -Calling function doesn't handle an "Exception" but only VmError, thus cleanup work won't been done if using Exception. -Change it to VmError. - -Signed-off-by ChunyanLiu - -Index: xen-4.0.2-testing/tools/python/xen/xend/server/BlktapController.py -=================================================================== ---- xen-4.0.2-testing.orig/tools/python/xen/xend/server/BlktapController.py -+++ xen-4.0.2-testing/tools/python/xen/xend/server/BlktapController.py -@@ -4,6 +4,7 @@ import string, re - from xen.xend.server.blkif import BlkifController - from xen.xend.XendLogging import log - from xen.util.xpopen import xPopen3 -+from xen.xend.XendError import VmError - - phantomDev = 0; - phantomId = 0; -@@ -209,7 +210,7 @@ class Blktap2Controller(BlktapController - out = stdout.read(); - stdout.close(); - stderr.close(); -- raise Exception, 'Failed to create device.\n stdout: %s\n stderr: %s\nCheck that target \"%s\" exists and that blktap2 driver installed in dom0.' % (out.rstrip(), err.rstrip(), file); -+ raise VmError('Failed to create device.\n stdout: %s\n stderr: %s\nCheck that target \"%s\" exists and that blktap2 driver installed in dom0.' % (out.rstrip(), err.rstrip(), file)); - - minor, device, control = parseDeviceString(stdout.readline()) - stdout.close(); diff --git a/blktapctrl-default-to-ioemu.patch b/blktapctrl-default-to-ioemu.patch index e7f3126..e48bf7f 100644 --- a/blktapctrl-default-to-ioemu.patch +++ b/blktapctrl-default-to-ioemu.patch @@ -1,7 +1,7 @@ -Index: xen-4.0.2-testing/tools/blktap/drivers/tapdisk.h +Index: xen-4.1.0-testing/tools/blktap/drivers/tapdisk.h =================================================================== ---- xen-4.0.2-testing.orig/tools/blktap/drivers/tapdisk.h -+++ xen-4.0.2-testing/tools/blktap/drivers/tapdisk.h +--- xen-4.1.0-testing.orig/tools/blktap/drivers/tapdisk.h ++++ xen-4.1.0-testing/tools/blktap/drivers/tapdisk.h @@ -168,7 +168,7 @@ static disk_info_t aio_disk = { "raw image (aio)", "aio", diff --git a/bridge-bonding.diff b/bridge-bonding.diff index 12f4655..cbe6cb4 100644 --- a/bridge-bonding.diff +++ b/bridge-bonding.diff @@ -1,8 +1,8 @@ -Index: xen-4.0.2-testing/tools/hotplug/Linux/network-bridge +Index: xen-4.1.0-testing/tools/hotplug/Linux/network-bridge =================================================================== ---- xen-4.0.2-testing.orig/tools/hotplug/Linux/network-bridge -+++ xen-4.0.2-testing/tools/hotplug/Linux/network-bridge -@@ -245,6 +245,9 @@ op_start () { +--- xen-4.1.0-testing.orig/tools/hotplug/Linux/network-bridge ++++ xen-4.1.0-testing/tools/hotplug/Linux/network-bridge +@@ -249,6 +249,9 @@ op_start () { claim_lock "network-bridge" @@ -12,14 +12,14 @@ Index: xen-4.0.2-testing/tools/hotplug/Linux/network-bridge vlans=$(find_active_vlans "${netdev}") for vlan in $vlans ; do ifdown $vlan ; done -@@ -262,18 +265,32 @@ op_start () { +@@ -266,18 +269,32 @@ op_start () { ip link set ${netdev} down ip addr flush ${netdev} fi - ip link set ${netdev} name ${pdev} - ip link set ${tdev} name ${bridge} - -- setup_bridge_port ${pdev} +- setup_physical_bridge_port ${pdev} - # Restore slaves - if [ -n "${slaves}" ]; then diff --git a/bridge-opensuse.patch b/bridge-opensuse.patch index 0e742fe..65e8474 100644 --- a/bridge-opensuse.patch +++ b/bridge-opensuse.patch @@ -1,8 +1,8 @@ -Index: xen-4.0.2-testing/tools/hotplug/Linux/network-bridge +Index: xen-4.1.0-testing/tools/hotplug/Linux/network-bridge =================================================================== ---- xen-4.0.2-testing.orig/tools/hotplug/Linux/network-bridge -+++ xen-4.0.2-testing/tools/hotplug/Linux/network-bridge -@@ -270,19 +270,19 @@ op_stop () { +--- xen-4.1.0-testing.orig/tools/hotplug/Linux/network-bridge ++++ xen-4.1.0-testing/tools/hotplug/Linux/network-bridge +@@ -278,19 +278,19 @@ op_stop () { transfer_addrs ${bridge} ${pdev} if ! ifdown ${bridge}; then get_ip_info ${bridge} diff --git a/bridge-record-creation.patch b/bridge-record-creation.patch index 965db3c..96bac9a 100644 --- a/bridge-record-creation.patch +++ b/bridge-record-creation.patch @@ -1,8 +1,8 @@ -Index: xen-4.0.2-testing/tools/hotplug/Linux/network-bridge +Index: xen-4.1.0-testing/tools/hotplug/Linux/network-bridge =================================================================== ---- xen-4.0.2-testing.orig/tools/hotplug/Linux/network-bridge -+++ xen-4.0.2-testing/tools/hotplug/Linux/network-bridge -@@ -253,6 +253,11 @@ op_start () { +--- xen-4.1.0-testing.orig/tools/hotplug/Linux/network-bridge ++++ xen-4.1.0-testing/tools/hotplug/Linux/network-bridge +@@ -257,6 +257,11 @@ op_start () { create_bridge ${tdev} @@ -14,7 +14,7 @@ Index: xen-4.0.2-testing/tools/hotplug/Linux/network-bridge preiftransfer ${netdev} transfer_addrs ${netdev} ${tdev} # Remember slaves for bonding interface. -@@ -330,6 +335,13 @@ op_stop () { +@@ -338,6 +343,13 @@ op_stop () { ip link set ${pdev} name ${netdev} do_ifup ${netdev} diff --git a/bridge-vlan.diff b/bridge-vlan.diff index bbe5ecc..c43f18b 100644 --- a/bridge-vlan.diff +++ b/bridge-vlan.diff @@ -1,7 +1,7 @@ -Index: xen-4.0.2-testing/tools/hotplug/Linux/network-bridge +Index: xen-4.1.0-testing/tools/hotplug/Linux/network-bridge =================================================================== ---- xen-4.0.2-testing.orig/tools/hotplug/Linux/network-bridge -+++ xen-4.0.2-testing/tools/hotplug/Linux/network-bridge +--- xen-4.1.0-testing.orig/tools/hotplug/Linux/network-bridge ++++ xen-4.1.0-testing/tools/hotplug/Linux/network-bridge @@ -193,6 +193,28 @@ antispoofing () { iptables -A FORWARD -m physdev --physdev-in ${pdev} -j ACCEPT } @@ -31,7 +31,7 @@ Index: xen-4.0.2-testing/tools/hotplug/Linux/network-bridge # Usage: show_status dev bridge # Print ifconfig and routes. show_status () { -@@ -223,6 +245,9 @@ op_start () { +@@ -227,6 +249,9 @@ op_start () { claim_lock "network-bridge" @@ -41,7 +41,7 @@ Index: xen-4.0.2-testing/tools/hotplug/Linux/network-bridge create_bridge ${tdev} preiftransfer ${netdev} -@@ -250,6 +275,8 @@ op_start () { +@@ -254,6 +279,8 @@ op_start () { add_to_bridge2 ${bridge} ${pdev} do_ifup ${bridge} @@ -50,7 +50,7 @@ Index: xen-4.0.2-testing/tools/hotplug/Linux/network-bridge if [ ${antispoof} = 'yes' ] ; then antispoofing fi -@@ -267,6 +294,9 @@ op_stop () { +@@ -275,6 +302,9 @@ op_stop () { claim_lock "network-bridge" @@ -60,7 +60,7 @@ Index: xen-4.0.2-testing/tools/hotplug/Linux/network-bridge transfer_addrs ${bridge} ${pdev} if ! ifdown ${bridge}; then get_ip_info ${bridge} -@@ -283,6 +313,8 @@ op_stop () { +@@ -291,6 +321,8 @@ op_stop () { ip link set ${pdev} name ${netdev} do_ifup ${netdev} diff --git a/build-tapdisk-ioemu.patch b/build-tapdisk-ioemu.patch index 344e36d..ab38c65 100644 --- a/build-tapdisk-ioemu.patch +++ b/build-tapdisk-ioemu.patch @@ -15,10 +15,10 @@ Signed-off-by: Kevin Wolf tapdisk-ioemu.c | 17 ----------------- 4 files changed, 17 insertions(+), 26 deletions(-) -Index: xen-4.0.2-testing/tools/ioemu-qemu-xen/Makefile +Index: xen-4.1.0-testing/tools/ioemu-qemu-xen/Makefile =================================================================== ---- xen-4.0.2-testing.orig/tools/ioemu-qemu-xen/Makefile -+++ xen-4.0.2-testing/tools/ioemu-qemu-xen/Makefile +--- xen-4.1.0-testing.orig/tools/ioemu-qemu-xen/Makefile ++++ xen-4.1.0-testing/tools/ioemu-qemu-xen/Makefile @@ -46,14 +46,6 @@ $(filter %-user,$(SUBDIR_RULES)): libqem recurse-all: $(SUBDIR_RULES) @@ -56,10 +56,10 @@ Index: xen-4.0.2-testing/tools/ioemu-qemu-xen/Makefile ###################################################################### # libqemu_common.a: Target independent part of system emulation. The # long term path is to suppress *all* target specific code in case of -Index: xen-4.0.2-testing/tools/ioemu-qemu-xen/configure +Index: xen-4.1.0-testing/tools/ioemu-qemu-xen/configure =================================================================== ---- xen-4.0.2-testing.orig/tools/ioemu-qemu-xen/configure -+++ xen-4.0.2-testing/tools/ioemu-qemu-xen/configure +--- xen-4.1.0-testing.orig/tools/ioemu-qemu-xen/configure ++++ xen-4.1.0-testing/tools/ioemu-qemu-xen/configure @@ -1511,7 +1511,7 @@ bsd) ;; esac @@ -69,10 +69,10 @@ Index: xen-4.0.2-testing/tools/ioemu-qemu-xen/configure if test `expr "$target_list" : ".*softmmu.*"` != 0 ; then tools="qemu-img\$(EXESUF) $tools" if [ "$linux" = "yes" ] ; then -Index: xen-4.0.2-testing/tools/ioemu-qemu-xen/qemu-tool.c +Index: xen-4.1.0-testing/tools/ioemu-qemu-xen/qemu-tool.c =================================================================== ---- xen-4.0.2-testing.orig/tools/ioemu-qemu-xen/qemu-tool.c -+++ xen-4.0.2-testing/tools/ioemu-qemu-xen/qemu-tool.c +--- xen-4.1.0-testing.orig/tools/ioemu-qemu-xen/qemu-tool.c ++++ xen-4.1.0-testing/tools/ioemu-qemu-xen/qemu-tool.c @@ -68,7 +68,7 @@ void qemu_bh_delete(QEMUBH *bh) qemu_free(bh); } @@ -82,10 +82,10 @@ Index: xen-4.0.2-testing/tools/ioemu-qemu-xen/qemu-tool.c IOCanRWHandler *fd_read_poll, IOHandler *fd_read, IOHandler *fd_write, -Index: xen-4.0.2-testing/tools/ioemu-qemu-xen/tapdisk-ioemu.c +Index: xen-4.1.0-testing/tools/ioemu-qemu-xen/tapdisk-ioemu.c =================================================================== ---- xen-4.0.2-testing.orig/tools/ioemu-qemu-xen/tapdisk-ioemu.c -+++ xen-4.0.2-testing/tools/ioemu-qemu-xen/tapdisk-ioemu.c +--- xen-4.1.0-testing.orig/tools/ioemu-qemu-xen/tapdisk-ioemu.c ++++ xen-4.1.0-testing/tools/ioemu-qemu-xen/tapdisk-ioemu.c @@ -12,34 +12,12 @@ extern void qemu_aio_init(void); diff --git a/capslock_enable.patch b/capslock_enable.patch index 67b55c3..da9a505 100644 --- a/capslock_enable.patch +++ b/capslock_enable.patch @@ -1,7 +1,7 @@ -Index: xen-4.0.2-testing/tools/ioemu-qemu-xen/vnc.c +Index: xen-4.1.0-testing/tools/ioemu-qemu-xen/vnc.c =================================================================== ---- xen-4.0.2-testing.orig/tools/ioemu-qemu-xen/vnc.c -+++ xen-4.0.2-testing/tools/ioemu-qemu-xen/vnc.c +--- xen-4.1.0-testing.orig/tools/ioemu-qemu-xen/vnc.c ++++ xen-4.1.0-testing/tools/ioemu-qemu-xen/vnc.c @@ -1342,6 +1342,11 @@ static void do_key_event(VncState *vs, i } break; diff --git a/cdrom-removable.patch b/cdrom-removable.patch index f4cda8c..004aa35 100644 --- a/cdrom-removable.patch +++ b/cdrom-removable.patch @@ -1,7 +1,7 @@ -Index: xen-4.0.2-testing/tools/python/xen/xend/server/HalDaemon.py +Index: xen-4.1.0-testing/tools/python/xen/xend/server/HalDaemon.py =================================================================== --- /dev/null -+++ xen-4.0.2-testing/tools/python/xen/xend/server/HalDaemon.py ++++ xen-4.1.0-testing/tools/python/xen/xend/server/HalDaemon.py @@ -0,0 +1,243 @@ +#!/usr/bin/env python +# -*- mode: python; -*- @@ -246,10 +246,10 @@ Index: xen-4.0.2-testing/tools/python/xen/xend/server/HalDaemon.py + print 'Falling off end' + + -Index: xen-4.0.2-testing/tools/python/xen/xend/server/Hald.py +Index: xen-4.1.0-testing/tools/python/xen/xend/server/Hald.py =================================================================== --- /dev/null -+++ xen-4.0.2-testing/tools/python/xen/xend/server/Hald.py ++++ xen-4.1.0-testing/tools/python/xen/xend/server/Hald.py @@ -0,0 +1,125 @@ +#============================================================================ +# This library is free software; you can redistribute it and/or @@ -376,11 +376,11 @@ Index: xen-4.0.2-testing/tools/python/xen/xend/server/Hald.py + watcher.run() + time.sleep(10) + watcher.shutdown() -Index: xen-4.0.2-testing/tools/python/xen/xend/server/SrvServer.py +Index: xen-4.1.0-testing/tools/python/xen/xend/server/SrvServer.py =================================================================== ---- xen-4.0.2-testing.orig/tools/python/xen/xend/server/SrvServer.py -+++ xen-4.0.2-testing/tools/python/xen/xend/server/SrvServer.py -@@ -56,6 +56,7 @@ from xen.web.SrvDir import SrvDir +--- xen-4.1.0-testing.orig/tools/python/xen/xend/server/SrvServer.py ++++ xen-4.1.0-testing/tools/python/xen/xend/server/SrvServer.py +@@ -57,6 +57,7 @@ from xen.web.SrvDir import SrvDir from SrvRoot import SrvRoot from XMLRPCServer import XMLRPCServer @@ -388,7 +388,7 @@ Index: xen-4.0.2-testing/tools/python/xen/xend/server/SrvServer.py xoptions = XendOptions.instance() -@@ -245,6 +246,8 @@ def _loadConfig(servers, root, reload): +@@ -252,6 +253,8 @@ def _loadConfig(servers, root, reload): if xoptions.get_xend_unix_xmlrpc_server(): servers.add(XMLRPCServer(XendAPI.AUTH_PAM, False)) @@ -397,10 +397,10 @@ Index: xen-4.0.2-testing/tools/python/xen/xend/server/SrvServer.py def create(): root = SrvDir() -Index: xen-4.0.2-testing/tools/ioemu-qemu-xen/xenstore.c +Index: xen-4.1.0-testing/tools/ioemu-qemu-xen/xenstore.c =================================================================== ---- xen-4.0.2-testing.orig/tools/ioemu-qemu-xen/xenstore.c -+++ xen-4.0.2-testing/tools/ioemu-qemu-xen/xenstore.c +--- xen-4.1.0-testing.orig/tools/ioemu-qemu-xen/xenstore.c ++++ xen-4.1.0-testing/tools/ioemu-qemu-xen/xenstore.c @@ -18,6 +18,7 @@ #include "exec-all.h" #include "sysemu.h" @@ -409,7 +409,7 @@ Index: xen-4.0.2-testing/tools/ioemu-qemu-xen/xenstore.c #include "hw.h" #include "pci.h" #include "qemu-timer.h" -@@ -553,6 +554,21 @@ void xenstore_parse_domain_config(int hv +@@ -595,6 +596,21 @@ void xenstore_parse_domain_config(int hv #endif bs = bdrv_new(dev); @@ -431,8 +431,8 @@ Index: xen-4.0.2-testing/tools/ioemu-qemu-xen/xenstore.c /* check if it is a cdrom */ if (danger_type && !strcmp(danger_type, "cdrom")) { bdrv_set_type_hint(bs, BDRV_TYPE_CDROM); -@@ -961,6 +977,50 @@ void xenstore_record_dm_state(const char - xenstore_record_dm("state", state); +@@ -1028,6 +1044,50 @@ static void xenstore_process_vcpu_set_ev + return; } +static void xenstore_process_media_change_event(char **vec) @@ -482,7 +482,7 @@ Index: xen-4.0.2-testing/tools/ioemu-qemu-xen/xenstore.c void xenstore_process_event(void *opaque) { char **vec, *offset, *bpath = NULL, *buf = NULL, *drv = NULL, *image = NULL; -@@ -991,6 +1051,11 @@ void xenstore_process_event(void *opaque +@@ -1063,6 +1123,11 @@ void xenstore_process_event(void *opaque xenstore_watch_callbacks[i].cb(vec[XS_WATCH_TOKEN], xenstore_watch_callbacks[i].opaque); diff --git a/change_home_server.patch b/change_home_server.patch index 5a6e7d5..9de74e2 100644 --- a/change_home_server.patch +++ b/change_home_server.patch @@ -1,8 +1,8 @@ -Index: xen-4.0.2-testing/tools/python/xen/xend/XendDomainInfo.py +Index: xen-4.1.0-testing/tools/python/xen/xend/XendDomainInfo.py =================================================================== ---- xen-4.0.2-testing.orig/tools/python/xen/xend/XendDomainInfo.py -+++ xen-4.0.2-testing/tools/python/xen/xend/XendDomainInfo.py -@@ -3135,6 +3135,11 @@ class XendDomainInfo: +--- xen-4.1.0-testing.orig/tools/python/xen/xend/XendDomainInfo.py ++++ xen-4.1.0-testing/tools/python/xen/xend/XendDomainInfo.py +@@ -3130,6 +3130,11 @@ class XendDomainInfo: self._cleanup_phantom_devs(paths) self._cleanupVm() diff --git a/check_device_status.patch b/check_device_status.patch index 1ade565..39767c1 100644 --- a/check_device_status.patch +++ b/check_device_status.patch @@ -5,10 +5,11 @@ get the signal, it will wait until timeout, thus incorrect device status is returned. To fix this problem, we do not depend on ev.wait() result, but read xenstore directly to get correct device status. -diff -r ce65e0e03a57 tools/python/xen/xend/server/DevController.py ---- a/tools/python/xen/xend/server/DevController.py Fri Aug 27 16:53:00 2010 +0800 -+++ b/tools/python/xen/xend/server/DevController.py Fri Aug 27 17:13:32 2010 +0800 -@@ -149,7 +149,10 @@ +Index: xen-4.1.0-testing/tools/python/xen/xend/server/DevController.py +=================================================================== +--- xen-4.1.0-testing.orig/tools/python/xen/xend/server/DevController.py ++++ xen-4.1.0-testing/tools/python/xen/xend/server/DevController.py +@@ -149,7 +149,10 @@ class DevController: (status, err) = self.waitForBackend(devid) if status == Timeout: @@ -20,7 +21,7 @@ diff -r ce65e0e03a57 tools/python/xen/xend/server/DevController.py raise VmError("Device %s (%s) could not be connected. " "Hotplug scripts not working." % (devid, self.deviceClass)) -@@ -554,7 +557,17 @@ +@@ -554,7 +557,17 @@ class DevController: xswatch(statusPath, hotplugStatusCallback, ev, result) @@ -39,7 +40,7 @@ diff -r ce65e0e03a57 tools/python/xen/xend/server/DevController.py err = xstransact.Read(backpath, HOTPLUG_ERROR_NODE) -@@ -571,7 +584,12 @@ +@@ -571,7 +584,12 @@ class DevController: xswatch(statusPath, deviceDestroyCallback, ev, result) diff --git a/checkpoint-rename.patch b/checkpoint-rename.patch index a2b5663..363d7f8 100644 --- a/checkpoint-rename.patch +++ b/checkpoint-rename.patch @@ -1,8 +1,8 @@ -Index: xen-4.0.2-testing/tools/python/xen/xend/XendCheckpoint.py +Index: xen-4.1.0-testing/tools/python/xen/xend/XendCheckpoint.py =================================================================== ---- xen-4.0.2-testing.orig/tools/python/xen/xend/XendCheckpoint.py -+++ xen-4.0.2-testing/tools/python/xen/xend/XendCheckpoint.py -@@ -165,7 +165,7 @@ def save(fd, dominfo, network, live, dst +--- xen-4.1.0-testing.orig/tools/python/xen/xend/XendCheckpoint.py ++++ xen-4.1.0-testing/tools/python/xen/xend/XendCheckpoint.py +@@ -172,7 +172,7 @@ def save(fd, dominfo, network, live, dst dominfo.destroy() dominfo.testDeviceComplete() try: diff --git a/cpu-pools-docs.patch b/cpu-pools-docs.patch deleted file mode 100644 index 1433af0..0000000 --- a/cpu-pools-docs.patch +++ /dev/null @@ -1,1484 +0,0 @@ -Index: xen-4.0.2-testing/docs/xen-api/coversheet.tex -=================================================================== ---- xen-4.0.2-testing.orig/docs/xen-api/coversheet.tex -+++ xen-4.0.2-testing/docs/xen-api/coversheet.tex -@@ -52,6 +52,7 @@ Mike Day, IBM & Daniel Veillard, Red Hat - Jim Fehlig, Novell & Tom Wilkie, University of Cambridge \\ - Jon Harrop, XenSource & Yosuke Iwamatsu, NEC \\ - Masaki Kanno, FUJITSU \\ -+Lutz Dube, FUJITSU TECHNOLOGY SOLUTIONS \\ - \end{tabular} - \end{large} - -Index: xen-4.0.2-testing/docs/xen-api/revision-history.tex -=================================================================== ---- xen-4.0.2-testing.orig/docs/xen-api/revision-history.tex -+++ xen-4.0.2-testing/docs/xen-api/revision-history.tex -@@ -50,6 +50,12 @@ - between classes. Added host.PSCSI\_HBAs and VM.DSCSI\_HBAs - fields.\tabularnewline - \hline -+ 1.0.10 & 10th Jan. 10 & L. Dube & -+ Added definitions of new classes cpu\_pool. Updated the table -+ and the diagram representing relationships between classes. -+ Added fields host.resident\_cpu\_pools, VM.cpu\_pool and -+ host\_cpu.cpu\_pool.\tabularnewline -+ \hline - \end{tabular} - \end{center} - \end{flushleft} -Index: xen-4.0.2-testing/docs/xen-api/xenapi-coversheet.tex -=================================================================== ---- xen-4.0.2-testing.orig/docs/xen-api/xenapi-coversheet.tex -+++ xen-4.0.2-testing/docs/xen-api/xenapi-coversheet.tex -@@ -17,12 +17,12 @@ - \newcommand{\coversheetlogo}{xen.eps} - - %% Document date --\newcommand{\datestring}{20th November 2009} -+\newcommand{\datestring}{10th January 2010} - - \newcommand{\releasestatement}{Stable Release} - - %% Document revision --\newcommand{\revstring}{API Revision 1.0.9} -+\newcommand{\revstring}{API Revision 1.0.10} - - %% Document authors - \newcommand{\docauthors}{ -Index: xen-4.0.2-testing/docs/xen-api/xenapi-datamodel-graph.dot -=================================================================== ---- xen-4.0.2-testing.orig/docs/xen-api/xenapi-datamodel-graph.dot -+++ xen-4.0.2-testing/docs/xen-api/xenapi-datamodel-graph.dot -@@ -14,7 +14,7 @@ fontname="Verdana"; - - node [ shape=box ]; session VM host network VIF PIF SR VDI VBD PBD user; - node [ shape=box ]; XSPolicy ACMPolicy DPCI PPCI host_cpu console VTPM; --node [ shape=box ]; DSCSI PSCSI DSCSI_HBA PSCSI_HBA; -+node [ shape=box ]; DSCSI PSCSI DSCSI_HBA PSCSI_HBA cpu_pool; - node [ shape=ellipse ]; VM_metrics VM_guest_metrics host_metrics; - node [ shape=ellipse ]; PIF_metrics VIF_metrics VBD_metrics PBD_metrics; - session -> host [ arrowhead="none" ] -@@ -51,4 +51,7 @@ DSCSI_HBA -> PSCSI_HBA [ arrowhead="crow - PSCSI -> host [ arrowhead="none", arrowtail="crow" ] - PSCSI_HBA -> host [ arrowhead="none", arrowtail="crow" ] - PSCSI -> PSCSI_HBA [ arrowhead="none", arrowtail="crow" ] -+cpu_pool -> host_cpu [ arrowhead="crow", arrowtail="none" ] -+cpu_pool -> VM [ arrowhead="crow", arrowtail="none" ] -+host -> cpu_pool [ arrowhead="crow", arrowtail="none" ] - } -Index: xen-4.0.2-testing/docs/xen-api/xenapi-datamodel.tex -=================================================================== ---- xen-4.0.2-testing.orig/docs/xen-api/xenapi-datamodel.tex -+++ xen-4.0.2-testing/docs/xen-api/xenapi-datamodel.tex -@@ -56,6 +56,7 @@ Name & Description \\ - {\tt debug} & A basic class for testing \\ - {\tt XSPolicy} & A class for handling Xen Security Policies \\ - {\tt ACMPolicy} & A class for handling ACM-type policies \\ -+{\tt cpu\_pool} & A container for VMs which should shared the same host\_cpu(s) \\ - \hline - \end{tabular}\end{center} - \section{Relationships Between Classes} -@@ -88,6 +89,9 @@ PSCSI.HBA & PSCSI\_HBA.PSCSIs & one-to-m - PSCSI\_HBA.host & host.PSCSI\_HBAs & one-to-many\\ - host.resident\_VMs & VM.resident\_on & many-to-one\\ - host.host\_CPUs & host\_cpu.host & many-to-one\\ -+host.resident\_cpu\_pools & cpu\_pool.resident\_on & many-to-one\\ -+cpu\_pool.started\_VMs & VM.cpu\_pool & many-to-one\\ -+cpu\_pool.host\_CPUs & host\_cpu.cpu\_pool & many-to-one\\ - \hline - \end{tabular}\end{center} - -@@ -499,6 +503,56 @@ error code and a message describing the - \begin{verbatim}SECURITY_ERROR(xserr, message)\end{verbatim} - \begin{center}\rule{10em}{0.1pt}\end{center} - -+\subsubsection{POOL\_BAD\_STATE} -+ -+You attempted an operation on a pool that was not in an appropriate state -+at the time; for example, you attempted to activate a pool that was -+already activated. -+ -+\vspace{0.3cm} -+{\bf Signature:} -+\begin{verbatim}POOL_BAD_STATE(current pool state)\end{verbatim} -+\begin{center}\rule{10em}{0.1pt}\end{center} -+ -+\subsubsection{INSUFFICIENT\_CPUS} -+ -+You attempted to activate a cpu\_pool but there are not enough -+unallocated CPUs to satisfy the request. -+ -+\vspace{0.3cm} -+{\bf Signature:} -+\begin{verbatim}INSUFFICIENT_CPUS(needed cpu count, available cpu count)\end{verbatim} -+\begin{center}\rule{10em}{0.1pt}\end{center} -+ -+\subsubsection{UNKOWN\_SCHED\_POLICY} -+ -+The specified scheduler policy is unkown to the host. -+ -+\vspace{0.3cm} -+{\bf Signature:} -+\begin{verbatim}UNKOWN_SCHED_POLICY()\end{verbatim} -+\begin{center}\rule{10em}{0.1pt}\end{center} -+ -+\subsubsection{INVALID\_CPU} -+ -+You tried to reconfigure a cpu\_pool with a CPU that is unkown to the host -+or has a wrong state. -+ -+\vspace{0.3cm} -+{\bf Signature:} -+\begin{verbatim}INVALID_CPU(message)\end{verbatim} -+\begin{center}\rule{10em}{0.1pt}\end{center} -+ -+\subsubsection{LAST\_CPU\_NOT\_REMOVEABLE} -+ -+You tried to remove the last CPU from a cpu\_pool that has one or more -+active domains. -+ -+\vspace{0.3cm} -+{\bf Signature:} -+\begin{verbatim}LAST_CPU_NOT_REMOVEABLE(message)\end{verbatim} -+\begin{center}\rule{10em}{0.1pt}\end{center} -+ - - \newpage - \section{Class: session} -@@ -4847,6 +4901,135 @@ references to objects with match names - \vspace{0.3cm} - \vspace{0.3cm} - \vspace{0.3cm} -+\subsubsection{RPC name:~get\_cpu\_pool} -+ -+{\bf Overview:} -+Get the cpu\_pool field of the given VM. -+ -+ \noindent {\bf Signature:} -+\begin{verbatim} ((cpu_pool ref) Set) get_cpu_pool (session_id s, VM ref self)\end{verbatim} -+ -+ -+\noindent{\bf Arguments:} -+ -+ -+\vspace{0.3cm} -+\begin{tabular}{|c|c|p{7cm}|} -+\hline -+{\bf type} & {\bf name} & {\bf description} \\ \hline -+{\tt VM ref } & self & reference to the object \\ \hline -+\end{tabular} -+ -+\vspace{0.3cm} -+ -+ \noindent {\bf Return Type:} -+{\tt -+(cpu\_pool ref) Set -+} -+ -+ -+references to cpu\_pool objects. -+\vspace{0.3cm} -+\vspace{0.3cm} -+\vspace{0.3cm} -+\subsubsection{RPC name:~get\_pool\_name} -+ -+{\bf Overview:} -+Get the pool\_name field of the given VM. -+ -+ \noindent {\bf Signature:} -+\begin{verbatim} string get_cpu_pool (session_id s, VM ref self)\end{verbatim} -+ -+ -+\noindent{\bf Arguments:} -+ -+ -+\vspace{0.3cm} -+\begin{tabular}{|c|c|p{7cm}|} -+\hline -+{\bf type} & {\bf name} & {\bf description} \\ \hline -+{\tt VM ref } & self & reference to the object \\ \hline -+\end{tabular} -+ -+\vspace{0.3cm} -+ -+ \noindent {\bf Return Type:} -+{\tt -+string -+} -+ -+ -+name of cpu pool to use -+\vspace{0.3cm} -+\vspace{0.3cm} -+\vspace{0.3cm} -+\subsubsection{RPC name:~cpu\_pool\_migrate} -+ -+{\bf Overview:} -+Migrate the VM to another cpu\_pool. -+ -+ \noindent {\bf Signature:} -+\begin{verbatim} void cpu_pool_migrate (session_id s, VM ref self, cpu_pool ref pool)\end{verbatim} -+ -+ -+\noindent{\bf Arguments:} -+ -+ -+\vspace{0.3cm} -+\begin{tabular}{|c|c|p{7cm}|} -+\hline -+{\bf type} & {\bf name} & {\bf description} \\ \hline -+{\tt VM ref } & self & reference to the object \\ \hline -+{\tt cpu\_pool ref} & pool & reference to new cpu\_pool \\ \hline -+\end{tabular} -+ -+\vspace{0.3cm} -+ -+ \noindent {\bf Return Type:} -+{\tt -+void -+} -+ -+\vspace{0.3cm} -+ -+\noindent{\bf Possible Error Codes:} {\tt POOL\_BAD\_STATE, VM\_BAD\_POWER\_STATE} -+ -+\vspace{0.3cm} -+\vspace{0.3cm} -+\vspace{0.3cm} -+\subsubsection{RPC name:~set\_pool\_name} -+ -+{\bf Overview:} -+Set cpu pool name to use for next activation. -+ -+ \noindent {\bf Signature:} -+\begin{verbatim} void set_pool_name (session_id s, VM ref self, string pool\_name)\end{verbatim} -+ -+ -+\noindent{\bf Arguments:} -+ -+ -+\vspace{0.3cm} -+\begin{tabular}{|c|c|p{7cm}|} -+\hline -+{\bf type} & {\bf name} & {\bf description} \\ \hline -+{\tt VM ref } & self & reference to the object \\ \hline -+{\tt string} & pool\_name & New pool name \\ \hline -+\end{tabular} -+ -+\vspace{0.3cm} -+ -+ \noindent {\bf Return Type:} -+{\tt -+void -+} -+ -+\vspace{0.3cm} -+\vspace{0.3cm} -+\vspace{0.3cm} -+ -+ -+ - - \vspace{1cm} - \newpage -@@ -5681,6 +5864,7 @@ $\mathit{RO}_\mathit{run}$ & {\tt PSCSI - $\mathit{RO}_\mathit{run}$ & {\tt PSCSI\_HBAs} & (PSCSI\_HBA ref) Set & physical SCSI host bus adapters \\ - $\mathit{RO}_\mathit{run}$ & {\tt host\_CPUs} & (host\_cpu ref) Set & The physical CPUs on this host \\ - $\mathit{RO}_\mathit{run}$ & {\tt metrics} & host\_metrics ref & metrics associated with this host \\ -+$\mathit{RO}_\mathit{run}$ & {\tt resident\_cpu\_pools} & (cpu\_pool ref) Set & list of cpu\_pools currently resident on the host \\ - \hline - \end{longtable} - \subsection{RPCs associated with class: host} -@@ -7229,6 +7413,38 @@ references to objects with match names - \vspace{0.3cm} - \vspace{0.3cm} - \vspace{0.3cm} -+\subsubsection{RPC name:~get\_resident\_cpu\_pools} -+ -+{\bf Overview:} -+Get the resident\_cpu\_pools field of the given host. -+ -+ \noindent {\bf Signature:} -+\begin{verbatim} ((cpu_pool ref) Set) get_resident_cpu_pools (session_id s, host ref self)\end{verbatim} -+ -+ -+\noindent{\bf Arguments:} -+ -+ -+\vspace{0.3cm} -+\begin{tabular}{|c|c|p{7cm}|} -+ \hline -+{\bf type} & {\bf name} & {\bf description} \\ \hline -+{\tt host ref } & self & reference to the object \\ \hline -+\end{tabular} -+ -+\vspace{0.3cm} -+ -+ \noindent {\bf Return Type:} -+{\tt -+(cpu\_pool ref) Set -+} -+ -+ -+references to all known cpu\_pools. -+\vspace{0.3cm} -+\vspace{0.3cm} -+\vspace{0.3cm} -+ - - \vspace{1cm} - \newpage -@@ -7484,6 +7700,7 @@ $\mathit{RO}_\mathit{run}$ & {\tt stepp - $\mathit{RO}_\mathit{run}$ & {\tt flags} & string & the flags of the physical CPU (a decoded version of the features field) \\ - $\mathit{RO}_\mathit{run}$ & {\tt features} & string & the physical CPU feature bitmap \\ - $\mathit{RO}_\mathit{run}$ & {\tt utilisation} & float & the current CPU utilisation \\ -+$\mathit{RO}_\mathit{run}$ & {\tt cpu\_pool} & (cpu\_pool ref) Set & reference to cpu\_pool the cpu belongs to \\ - \hline - \end{longtable} - \subsection{RPCs associated with class: host\_cpu} -@@ -7896,6 +8113,70 @@ all fields from the object - \vspace{0.3cm} - \vspace{0.3cm} - \vspace{0.3cm} -+\subsubsection{RPC name:~get\_cpu\_pool} -+ -+{\bf Overview:} -+Get the cpu\_pool field of the given host\_cpu. -+ -+ \noindent {\bf Signature:} -+\begin{verbatim} ((cpu_pool) Set) get_cpu_pool (session_id s, host_cpu ref self)\end{verbatim} -+ -+ -+\noindent{\bf Arguments:} -+ -+ -+\vspace{0.3cm} -+\begin{tabular}{|c|c|p{7cm}|} -+ \hline -+{\bf type} & {\bf name} & {\bf description} \\ \hline -+{\tt host\_cpu ref } & self & reference to the object \\ \hline -+ -+\end{tabular} -+ -+\vspace{0.3cm} -+ -+ \noindent {\bf Return Type:} -+{\tt -+(cpu\_pool) Set -+} -+ -+ -+value of the field -+\vspace{0.3cm} -+\vspace{0.3cm} -+\vspace{0.3cm} -+\subsubsection{RPC name:~get\_unassigned\_cpus} -+ -+{\bf Overview:} -+Get a reference to all cpus that are not assigend to any cpu\_pool. -+ -+ \noindent {\bf Signature:} -+\begin{verbatim} ((host_cpu) Set) get_unassigned_cpus (session_id s)\end{verbatim} -+ -+ -+\noindent{\bf Arguments:} -+ -+ -+\vspace{0.3cm} -+\begin{tabular}{|c|c|p{7cm}|} -+ \hline -+{\bf type} & {\bf name} & {\bf description} \\ \hline -+\end{tabular} -+ -+\vspace{0.3cm} -+ -+ \noindent {\bf Return Type:} -+{\tt -+(host\_cpu ref) Set -+} -+ -+ -+Set of free (not assigned) cpus -+\vspace{0.3cm} -+\vspace{0.3cm} -+\vspace{0.3cm} -+ -+ - - \vspace{1cm} - \newpage -@@ -18892,3 +19173,1073 @@ all fields from the object - \vspace{0.3cm} - \vspace{0.3cm} - -+\newpage -+\section{Class: cpu\_pool} -+\subsection{Fields for class: cpu\_pool} -+\begin{longtable}{|lllp{0.38\textwidth}|} -+\hline -+\multicolumn{1}{|l}{Name} & \multicolumn{3}{l|}{\bf cpu\_pool} \\ -+\multicolumn{1}{|l}{Description} & \multicolumn{3}{l|}{\parbox{11cm}{\em A CPU pool}} \\ -+\hline -+Quals & Field & Type & Description \\ -+\hline -+$\mathit{RO}_\mathit{run}$ & {\tt uuid} & string & unique identifier / object reference \\ -+$\mathit{RW}$ & {\tt name\_label} & string & name of cpu\_pool \\ -+$\mathit{RW}$ & {\tt name\_description} & string & cpu\_pool description \\ -+$\mathit{RO}_\mathit{run}$ & {\tt resident\_on} & host ref & the host the cpu\_pool is currently resident on \\ -+$\mathit{RW}$ & {\tt auto\_power\_on} & bool & True if this cpu\_pool should be activated automatically after host boot \\ -+$\mathit{RO}_\mathit{run}$ & {\tt started\_VMs} & (VM ref) Set & list of VMs currently started in this cpu\_pool \\ -+$\mathit{RW}$ & {\tt ncpu} & integer & number of host\_CPUs requested for this cpu\_pool at next start \\ -+$\mathit{RW}$ & {\tt sched\_policy} & string & scheduler policy on this cpu\_pool \\ -+$\mathit{RW}$ & {\tt proposed\_CPUs} & (string) Set & list of proposed host\_CPUs to assign at next activation \\ -+$\mathit{RO}_\mathit{run}$ & {\tt host\_CPUs} & (VM ref) Set & list of host\_cpus currently assigned to this cpu\_pool \\ -+$\mathit{RO}_\mathit{run}$ & {\tt activated} & bool & True if this cpu\_pool is activated \\ -+$\mathit{RW}$ & {\tt other\_config} & (string $\rightarrow$ string) Map & additional configuration \\ -+\hline -+\end{longtable} -+\subsection{RPCs associated with class: cpu\_pool} -+\subsubsection{RPC name:~activate} -+ -+{\bf Overview:} -+Activate the cpu\_pool and assign the given CPUs to it. -+CPUs specified in field proposed\_CPUs, that are not existing or not free, are -+ignored. If value of ncpu is greater than the number of CPUs in field -+proposed\_CPUs, additional free CPUs are assigned to the cpu\_pool. -+ -+ \noindent {\bf Signature:} -+\begin{verbatim} void activate (session_id s, cpu_pool ref self)\end{verbatim} -+ -+ -+\noindent{\bf Arguments:} -+ -+ -+\vspace{0.3cm} -+\begin{tabular}{|c|c|p{7cm}|} -+ \hline -+{\bf type} & {\bf name} & {\bf description} \\ \hline -+{\tt cpu\_pool ref } & self & reference to the object \\ \hline -+\end{tabular} -+ -+\vspace{0.3cm} -+ -+ \noindent {\bf Return Type:} -+{\tt -+void -+} -+ -+\vspace{0.3cm} -+ -+\noindent {\bf Possible Error Codes:} -+ {\tt POOL\_BAD\_STATE, INSUFFICIENT\_CPUS, UNKOWN\_SCHED\_POLICY} -+ -+\vspace{0.3cm} -+\vspace{0.3cm} -+\vspace{0.3cm} -+\subsubsection{RPC name:~create} -+ -+{\bf Overview:} -+Create a new cpu\_pool instance, and return its handle. -+ -+ \noindent {\bf Signature:} -+\begin{verbatim} (cpu_pool ref) create (session_id s, cpu_pool record args)\end{verbatim} -+ -+ -+\noindent{\bf Arguments:} -+ -+ -+\vspace{0.3cm} -+\begin{tabular}{|c|c|p{7cm}|} -+ \hline -+{\bf type} & {\bf name} & {\bf description} \\ \hline -+{\tt cpu\_pool record } & args & All constructor arguments \\ \hline -+\end{tabular} -+ -+\vspace{0.3cm} -+ -+ \noindent {\bf Return Type:} -+{\tt -+cpu\_pool ref -+} -+ -+ -+reference to the newly created object -+\vspace{0.3cm} -+\vspace{0.3cm} -+\vspace{0.3cm} -+\subsubsection{RPC name:~deactivate} -+ -+{\bf Overview:} -+Deactivate the cpu\_pool and release all CPUs assigned to it. -+This function can only be called if there are no domains active in the -+cpu\_pool. -+ -+ \noindent {\bf Signature:} -+\begin{verbatim} void deactivate (session_id s, cpu_pool ref self)\end{verbatim} -+ -+ -+\noindent{\bf Arguments:} -+ -+ -+\vspace{0.3cm} -+\begin{tabular}{|c|c|p{7cm}|} -+ \hline -+{\bf type} & {\bf name} & {\bf description} \\ \hline -+{\tt cpu\_pool ref } & self & reference to the object \\ \hline -+\end{tabular} -+ -+\vspace{0.3cm} -+ -+ \noindent {\bf Return Type:} -+{\tt -+void -+} -+ -+\vspace{0.3cm} -+ -+\noindent {\bf Possible Error Codes:} {\tt POOL\_BAD\_STATE} -+ -+\vspace{0.3cm} -+\vspace{0.3cm} -+\vspace{0.3cm} -+\subsubsection{RPC name:~destroy} -+ -+{\bf Overview:} -+Destroy the specified cpu\_pool. The cpu\_pool is completely removed from the -+system. -+This function can only be called if the cpu\_pool is deactivated. -+ -+ \noindent {\bf Signature:} -+\begin{verbatim} void destroy (session_id s, cpu_pool ref self)\end{verbatim} -+ -+ -+\noindent{\bf Arguments:} -+ -+ -+\vspace{0.3cm} -+\begin{tabular}{|c|c|p{7cm}|} -+ \hline -+{\bf type} & {\bf name} & {\bf description} \\ \hline -+{\tt cpu\_pool ref } & self & reference to the object \\ \hline -+\end{tabular} -+ -+\vspace{0.3cm} -+ -+ \noindent {\bf Return Type:} -+{\tt -+void -+} -+ -+\vspace{0.3cm} -+ -+\noindent {\bf Possible Error Codes:} {\tt POOL\_BAD\_STATE} -+ -+ -+\vspace{0.3cm} -+\vspace{0.3cm} -+\vspace{0.3cm} -+\subsubsection{RPC name:~add\_host\_CPU\_live} -+ -+ -+{\bf Overview:} -+Add a additional CPU immediatly to the cpu\_pool. -+ -+ \noindent {\bf Signature:} -+\begin{verbatim} void add_host_CPU_live (session_id s, cpu_pool ref self, host_cpu ref host_cpu)\end{verbatim} -+ -+ -+\noindent{\bf Arguments:} -+ -+ -+\vspace{0.3cm} -+\begin{tabular}{|c|c|p{7cm}|} -+ \hline -+{\bf type} & {\bf name} & {\bf description} \\ \hline -+{\tt cpu\_pool ref } & self & reference to the object \\ \hline -+{\tt host\_cpu ref } & host\_cpu & CPU to add \\ \hline -+\end{tabular} -+ -+\vspace{0.3cm} -+ -+ \noindent {\bf Return Type:} -+{\tt -+void -+} -+ -+\vspace{0.3cm} -+ -+\noindent {\bf Possible Error Codes:} -+ {\tt POOL\_BAD\_STATE, INVALID\_CPU} -+ -+ -+\vspace{0.3cm} -+\vspace{0.3cm} -+\vspace{0.3cm} -+\subsubsection{RPC name:~remove\_host\_CPU\_live} -+ -+ -+{\bf Overview:} -+Remove a CPU immediatly from the cpu\_pool. -+ -+ \noindent {\bf Signature:} -+\begin{verbatim} void remove_host_CPU_live (session_id s, cpu_pool ref self, host_cpu ref host_cpu)\end{verbatim} -+ -+ -+\noindent{\bf Arguments:} -+ -+ -+\vspace{0.3cm} -+\begin{tabular}{|c|c|p{7cm}|} -+ \hline -+{\bf type} & {\bf name} & {\bf description} \\ \hline -+{\tt cpu\_pool ref } & self & reference to the object \\ \hline -+{\tt host\_cpu ref } & host\_cpu & CPU to remove \\ \hline -+\end{tabular} -+ -+\vspace{0.3cm} -+ -+ \noindent {\bf Return Type:} -+{\tt -+void -+} -+ -+\vspace{0.3cm} -+ -+\noindent {\bf Possible Error Codes:} -+ {\tt POOL\_BAD\_STATE, INVALID\_CPU, LAST\_CPU\_NOT\_REMOVEABLE} -+ -+ -+\vspace{0.3cm} -+\vspace{0.3cm} -+\vspace{0.3cm} -+\subsubsection{RPC name:~get\_all} -+ -+ -+{\bf Overview:} -+Return a list of all the cpu pools known to the system. -+ -+ \noindent {\bf Signature:} -+\begin{verbatim} ((cpu_pool ref) Set) get_all (session_id s)\end{verbatim} -+ -+ -+ \noindent {\bf Return Type:} -+{\tt -+(cpu\_pool ref) Set -+} -+A list of all the IDs of the cpu pools. -+ -+\vspace{0.3cm} -+\vspace{0.3cm} -+\vspace{0.3cm} -+\subsubsection{RPC name:~get\_all\_records} -+ -+ -+{\bf Overview:} -+Return a map of all the cpu pool records known to the system. -+ -+ \noindent {\bf Signature:} -+\begin{verbatim} (((cpu_pool ref) -> (cpu_pool record)) Map) get_all_records (session_id s)\end{verbatim} -+ -+ -+ \noindent {\bf Return Type:} -+{\tt -+((cpu\_pool ref) $\rightarrow$ (cpu\_pool record)) Map -+} -+A map of all the cpu pool records indexed by cpu pool ref. -+ -+\vspace{0.3cm} -+\vspace{0.3cm} -+\vspace{0.3cm} -+\subsubsection{RPC name:~get\_by\_name\_label} -+ -+{\bf Overview:} -+Get all the cpu\_pool instances with the given label. -+ -+ \noindent {\bf Signature:} -+\begin{verbatim} ((cpu_pool ref) Set) get_by_name_label (session_id s, string label)\end{verbatim} -+ -+ -+\noindent{\bf Arguments:} -+ -+ -+\vspace{0.3cm} -+\begin{tabular}{|c|c|p{7cm}|} -+ \hline -+{\bf type} & {\bf name} & {\bf description} \\ \hline -+{\tt string } & label & label of object to return \\ \hline -+ -+\end{tabular} -+ -+\vspace{0.3cm} -+ -+ \noindent {\bf Return Type:} -+{\tt -+(cpu\_pool ref) Set -+} -+ -+ -+references to objects with matching names -+\vspace{0.3cm} -+\vspace{0.3cm} -+\vspace{0.3cm} -+\subsubsection{RPC name:~get\_by\_uuid} -+ -+{\bf Overview:} -+Get a reference to the cpu\_pool instance with the specified UUID. -+ -+ \noindent {\bf Signature:} -+\begin{verbatim} (cpu_pool ref) get_by_uuid (session_id s, string uuid)\end{verbatim} -+ -+ -+\noindent{\bf Arguments:} -+ -+ -+\vspace{0.3cm} -+\begin{tabular}{|c|c|p{7cm}|} -+ \hline -+{\bf type} & {\bf name} & {\bf description} \\ \hline -+{\tt string } & uuid & UUID of object to return \\ \hline -+ -+\end{tabular} -+ -+\vspace{0.3cm} -+ -+ \noindent {\bf Return Type:} -+{\tt -+cpu\_pool ref -+} -+ -+ -+reference to the object -+\vspace{0.3cm} -+\vspace{0.3cm} -+\vspace{0.3cm} -+\subsubsection{RPC name:~get\_activated} -+ -+ -+{\bf Overview:} -+Return the activation state of the cpu\_pool object. -+ -+ \noindent {\bf Signature:} -+\begin{verbatim} bool get_activated (session_id s, cpu_pool ref self)\end{verbatim} -+ -+ -+\noindent{\bf Arguments:} -+ -+ -+\vspace{0.3cm} -+\begin{tabular}{|c|c|p{7cm}|} -+ \hline -+{\bf type} & {\bf name} & {\bf description} \\ \hline -+{\tt cpu\_pool ref } & self & reference to the object \\ \hline -+\end{tabular} -+ -+\vspace{0.3cm} -+ -+ \noindent {\bf Return Type:} -+{\tt -+bool -+} -+Returns {\bf true} if cpu\_pool is active. -+ -+\vspace{0.3cm} -+\vspace{0.3cm} -+\vspace{0.3cm} -+\subsubsection{RPC name:~get\_auto\_power\_on} -+ -+ -+{\bf Overview:} -+Return the auto power attribute of the cpu\_pool object. -+ -+ \noindent {\bf Signature:} -+\begin{verbatim} bool get_auto_power_on (session_id s, cpu_pool ref self)\end{verbatim} -+ -+ -+\noindent{\bf Arguments:} -+ -+ -+\vspace{0.3cm} -+\begin{tabular}{|c|c|p{7cm}|} -+ \hline -+{\bf type} & {\bf name} & {\bf description} \\ \hline -+{\tt cpu\_pool ref } & self & reference to the object \\ \hline -+\end{tabular} -+ -+\vspace{0.3cm} -+ -+ \noindent {\bf Return Type:} -+{\tt -+bool -+} -+Returns {\bf true} if cpu\_pool has to be activated on xend start. -+ -+\vspace{0.3cm} -+\vspace{0.3cm} -+\vspace{0.3cm} -+\subsubsection{RPC name:~get\_host\_CPUs} -+ -+ -+{\bf Overview:} -+Return the list of host\_cpu refs assigned to the cpu\_pool object. -+ -+ \noindent {\bf Signature:} -+\begin{verbatim} ((host_cpu ref) Set) get_host_CPUs (session_id s, cpu_pool ref self)\end{verbatim} -+ -+ -+\noindent{\bf Arguments:} -+ -+ -+\vspace{0.3cm} -+\begin{tabular}{|c|c|p{7cm}|} -+ \hline -+{\bf type} & {\bf name} & {\bf description} \\ \hline -+{\tt cpu\_pool ref } & self & reference to the object \\ \hline -+\end{tabular} -+ -+\vspace{0.3cm} -+ -+ \noindent {\bf Return Type:} -+{\tt -+(host\_cpu ref) Set -+} -+Returns a list of references of all host cpus assigned to the cpu\_pool. -+ -+\vspace{0.3cm} -+\vspace{0.3cm} -+\vspace{0.3cm} -+\subsubsection{RPC name:~get\_name\_description} -+ -+{\bf Overview:} -+Get the name/description field of the given cpu\_pool. -+ -+ \noindent {\bf Signature:} -+\begin{verbatim} string get_name_description (session_id s, cpu_pool ref self)\end{verbatim} -+ -+ -+\noindent{\bf Arguments:} -+ -+ -+\vspace{0.3cm} -+\begin{tabular}{|c|c|p{7cm}|} -+ \hline -+{\bf type} & {\bf name} & {\bf description} \\ \hline -+{\tt cpu\_pool ref } & self & reference to the object \\ \hline -+ -+\end{tabular} -+ -+\vspace{0.3cm} -+ -+ \noindent {\bf Return Type:} -+{\tt -+string -+} -+ -+ -+value of the field -+\vspace{0.3cm} -+\vspace{0.3cm} -+\vspace{0.3cm} -+\subsubsection{RPC name:~get\_name\_label} -+ -+{\bf Overview:} -+Get the name/label field of the given cpu\_pool. -+ -+ \noindent {\bf Signature:} -+\begin{verbatim} string get_name_label (session_id s, cpu_pool ref self)\end{verbatim} -+ -+ -+\noindent{\bf Arguments:} -+ -+ -+\vspace{0.3cm} -+\begin{tabular}{|c|c|p{7cm}|} -+ \hline -+{\bf type} & {\bf name} & {\bf description} \\ \hline -+{\tt cpu\_pool ref } & self & reference to the object \\ \hline -+ -+\end{tabular} -+ -+\vspace{0.3cm} -+ -+ \noindent {\bf Return Type:} -+{\tt -+string -+} -+ -+ -+value of the field -+\vspace{0.3cm} -+\vspace{0.3cm} -+\vspace{0.3cm} -+\subsubsection{RPC name:~get\_ncpu} -+ -+{\bf Overview:} -+Get the ncpu field of the given cpu\_pool. -+ -+ \noindent {\bf Signature:} -+\begin{verbatim} int get_ncpu (session_id s, cpu_pool ref self)\end{verbatim} -+ -+ -+\noindent{\bf Arguments:} -+ -+ -+\vspace{0.3cm} -+\begin{tabular}{|c|c|p{7cm}|} -+ \hline -+{\bf type} & {\bf name} & {\bf description} \\ \hline -+{\tt cpu\_pool ref } & self & reference to the object \\ \hline -+ -+\end{tabular} -+ -+\vspace{0.3cm} -+ -+ \noindent {\bf Return Type:} -+{\tt -+int -+} -+ -+ -+value of the field -+\vspace{0.3cm} -+\vspace{0.3cm} -+\vspace{0.3cm} -+\subsubsection{RPC name:~get\_proposed\_CPUs} -+ -+{\bf Overview:} -+Get the proposed\_CPUs field of the given cpu\_pool. -+ -+ \noindent {\bf Signature:} -+\begin{verbatim} ((string) Set) get_proposed_CPUs (session_id s, cpu_pool ref self)\end{verbatim} -+ -+ -+\noindent{\bf Arguments:} -+ -+ -+\vspace{0.3cm} -+\begin{tabular}{|c|c|p{7cm}|} -+ \hline -+{\bf type} & {\bf name} & {\bf description} \\ \hline -+{\tt cpu\_pool ref } & self & reference to the object \\ \hline -+ -+\end{tabular} -+ -+\vspace{0.3cm} -+ -+ \noindent {\bf Return Type:} -+{\tt -+(string) Set -+} -+ -+ -+value of the field -+\vspace{0.3cm} -+\vspace{0.3cm} -+\vspace{0.3cm} -+\subsubsection{RPC name:~get\_other\_config} -+ -+{\bf Overview:} -+Get the other\_config field of the given cpu\_pool. -+ -+\noindent {\bf Signature:} -+\begin{verbatim} ((string -> string) Map) get_other_config (session_id s, cpu_pool ref self)\end{verbatim} -+ -+ -+\noindent{\bf Arguments:} -+ -+ -+\vspace{0.3cm} -+\begin{tabular}{|c|c|p{7cm}|} -+ \hline -+{\bf type} & {\bf name} & {\bf description} \\ \hline -+{\tt cpu\_pool ref } & self & reference to the object \\ \hline -+\end{tabular} -+ -+\vspace{0.3cm} -+ -+\noindent {\bf Return Type:} -+{\tt -+(string $\rightarrow$ string) Map -+} -+ -+ -+value of the field -+\vspace{0.3cm} -+\vspace{0.3cm} -+\vspace{0.3cm} -+\subsubsection{RPC name:~get\_record} -+ -+{\bf Overview:} -+Get a record containing the current state of the given cpu\_pool. -+ -+\noindent {\bf Signature:} -+\begin{verbatim} (cpu_pool record) get_record (session_id s, cpu_pool ref self)\end{verbatim} -+ -+ -+\noindent{\bf Arguments:} -+ -+ -+\vspace{0.3cm} -+\begin{tabular}{|c|c|p{7cm}|} -+ \hline -+{\bf type} & {\bf name} & {\bf description} \\ \hline -+{\tt cpu\_pool ref } & self & reference to the object \\ \hline -+\end{tabular} -+ -+\vspace{0.3cm} -+ -+\noindent {\bf Return Type:} -+{\tt -+cpu\_pool record -+} -+ -+ -+all fields of the object. -+\vspace{0.3cm} -+\vspace{0.3cm} -+\vspace{0.3cm} -+\subsubsection{RPC name:~get\_resident\_on} -+ -+{\bf Overview:} -+Get the resident\_on field of the given cpu\_pool. -+ -+\noindent {\bf Signature:} -+\begin{verbatim} (host ref) get_resident_on (session_id s, cpu_pool ref self)\end{verbatim} -+ -+ -+\noindent{\bf Arguments:} -+ -+ -+\vspace{0.3cm} -+\begin{tabular}{|c|c|p{7cm}|} -+ \hline -+{\bf type} & {\bf name} & {\bf description} \\ \hline -+{\tt cpu\_pool ref } & self & reference to the object \\ \hline -+\end{tabular} -+ -+\vspace{0.3cm} -+ -+\noindent {\bf Return Type:} -+{\tt -+host ref -+} -+ -+ -+value of the field -+\vspace{0.3cm} -+\vspace{0.3cm} -+\vspace{0.3cm} -+\subsubsection{RPC name:~get\_sched\_policy} -+ -+{\bf Overview:} -+Get the sched\_policy field of the given cpu\_pool. -+ -+\noindent {\bf Signature:} -+\begin{verbatim} string get_sched_policy (session_id s, cpu_pool ref self)\end{verbatim} -+ -+ -+\noindent{\bf Arguments:} -+ -+ -+\vspace{0.3cm} -+\begin{tabular}{|c|c|p{7cm}|} -+ \hline -+{\bf type} & {\bf name} & {\bf description} \\ \hline -+{\tt cpu\_pool ref } & self & reference to the object \\ \hline -+\end{tabular} -+ -+\vspace{0.3cm} -+ -+\noindent {\bf Return Type:} -+{\tt -+string -+} -+ -+ -+value of the field -+\vspace{0.3cm} -+\vspace{0.3cm} -+\vspace{0.3cm} -+\subsubsection{RPC name:~get\_started\_VMs} -+ -+{\bf Overview:} -+Get the started\_VMs field of the given cpu\_pool. -+ -+\noindent {\bf Signature:} -+\begin{verbatim} ((VM ref) Set) get_started_VMs (session_id s, cpu_pool ref self)\end{verbatim} -+ -+ -+\noindent{\bf Arguments:} -+ -+ -+\vspace{0.3cm} -+\begin{tabular}{|c|c|p{7cm}|} -+ \hline -+{\bf type} & {\bf name} & {\bf description} \\ \hline -+{\tt cpu\_pool ref } & self & reference to the object \\ \hline -+\end{tabular} -+ -+\vspace{0.3cm} -+ -+\noindent {\bf Return Type:} -+{\tt -+(VM ref) Set -+} -+ -+ -+value of the field -+\vspace{0.3cm} -+\vspace{0.3cm} -+\vspace{0.3cm} -+\subsubsection{RPC name:~get\_uuid} -+ -+{\bf Overview:} -+Get the uuid field of the given cpu\_pool. -+ -+ \noindent {\bf Signature:} -+\begin{verbatim} string get_uuid (session_id s, cpu_pool ref self)\end{verbatim} -+ -+ -+\noindent{\bf Arguments:} -+ -+ -+\vspace{0.3cm} -+\begin{tabular}{|c|c|p{7cm}|} -+ \hline -+{\bf type} & {\bf name} & {\bf description} \\ \hline -+{\tt cpu\_pool ref } & self & reference to the object \\ \hline -+\end{tabular} -+ -+\vspace{0.3cm} -+ -+ \noindent {\bf Return Type:} -+{\tt -+string -+} -+ -+ -+value of the field -+\vspace{0.3cm} -+\vspace{0.3cm} -+\vspace{0.3cm} -+\subsubsection{RPC name:~set\_auto\_power\_on} -+ -+{\bf Overview:} -+Set the auto\_power\_on field of the given cpu\_pool. -+ -+\noindent {\bf Signature:} -+\begin{verbatim} void set_auto_power_on (session_id s, cpu_pool ref self, bool value)\end{verbatim} -+ -+ -+\noindent{\bf Arguments:} -+ -+ -+\vspace{0.3cm} -+\begin{tabular}{|c|c|p{7cm}|} -+ \hline -+{\bf type} & {\bf name} & {\bf description} \\ \hline -+{\tt cpu\_pool ref } & self & reference to the object \\ \hline -+{\tt bool } & value & new auto\_power\_on value \\ \hline -+\end{tabular} -+ -+\vspace{0.3cm} -+ -+\noindent {\bf Return Type:} -+{\tt -+void -+} -+\vspace{0.3cm} -+\vspace{0.3cm} -+\vspace{0.3cm} -+\subsubsection{RPC name:~set\_proposed\_CPUs} -+ -+{\bf Overview:} -+Set the proposed\_CPUs field of the given cpu\_pool. -+ -+\noindent {\bf Signature:} -+\begin{verbatim} void set_proposed_CPUs (session_id s, cpu_pool ref self, string Set cpus)\end{verbatim} -+ -+ -+\noindent{\bf Arguments:} -+ -+ -+\vspace{0.3cm} -+\begin{tabular}{|c|c|p{7cm}|} -+ \hline -+{\bf type} & {\bf name} & {\bf description} \\ \hline -+{\tt cpu\_pool ref } & self & reference to the object \\ \hline -+{\tt string Set } & cpus & Set of preferred CPU (numbers) to use \\ \hline -+\end{tabular} -+ -+\vspace{0.3cm} -+ -+\noindent {\bf Return Type:} -+{\tt -+void -+} -+\vspace{0.3cm} -+ -+\noindent {\bf Possible Error Codes:} -+ {\tt POOL\_BAD\_STATE} -+ -+\vspace{0.3cm} -+\vspace{0.3cm} -+\vspace{0.3cm} -+\subsubsection{RPC name:add\_to\_proposed\_CPUs} -+ -+{\bf Overview:} -+Add a CPU (number) to the proposed\_CPUs field of the given cpu\_pool. -+ -+\noindent {\bf Signature:} -+\begin{verbatim} void add_to_proposed_CPUs (session_id s, cpu_pool ref self, integer cpu)\end{verbatim} -+ -+ -+\noindent{\bf Arguments:} -+ -+ -+\vspace{0.3cm} -+\begin{tabular}{|c|c|p{7cm}|} -+ \hline -+{\bf type} & {\bf name} & {\bf description} \\ \hline -+{\tt cpu\_pool ref } & self & reference to the object \\ \hline -+{\tt integer } & cpu & Number of CPU to add \\ \hline -+\end{tabular} -+ -+\vspace{0.3cm} -+ -+\noindent {\bf Return Type:} -+{\tt -+void -+} -+\vspace{0.3cm} -+ -+\noindent {\bf Possible Error Codes:} -+ {\tt POOL\_BAD\_STATE} -+ -+\vspace{0.3cm} -+\vspace{0.3cm} -+\vspace{0.3cm} -+\subsubsection{RPC name:remove\_from\_proposed\_CPUs} -+ -+{\bf Overview:} -+Remove a CPU (number) from the proposed\_CPUs field of the given cpu\_pool. -+ -+\noindent {\bf Signature:} -+\begin{verbatim} void remove_from_proposed_CPUs (session_id s, cpu_pool ref self, integer cpu)\end{verbatim} -+ -+ -+\noindent{\bf Arguments:} -+ -+ -+\vspace{0.3cm} -+\begin{tabular}{|c|c|p{7cm}|} -+\hline -+{\bf type} & {\bf name} & {\bf description} \\ \hline -+{\tt cpu\_pool ref } & self & reference to the object \\ \hline -+{\tt integer } & cpu & Number of CPU to remove \\ \hline -+\end{tabular} -+ -+\vspace{0.3cm} -+ -+\noindent {\bf Return Type:} -+{\tt -+void -+} -+\vspace{0.3cm} -+ -+\noindent {\bf Possible Error Codes:} -+ {\tt POOL\_BAD\_STATE} -+ -+\vspace{0.3cm} -+\vspace{0.3cm} -+\vspace{0.3cm} -+\subsubsection{RPC name:~set\_name\_label} -+ -+{\bf Overview:} -+Set the name/label field of the given cpu\_pool. -+ -+ \noindent {\bf Signature:} -+\begin{verbatim} void set_name_label (session_id s, cpu_pool ref self, string value)\end{verbatim} -+ -+ -+\noindent{\bf Arguments:} -+ -+ -+\vspace{0.3cm} -+\begin{tabular}{|c|c|p{7cm}|} -+\hline -+{\bf type} & {\bf name} & {\bf description} \\ \hline -+{\tt cpu\_pool ref } & self & reference to the object \\ \hline -+{\tt string } & value & New value to set \\ \hline -+\end{tabular} -+ -+\vspace{0.3cm} -+ -+ \noindent {\bf Return Type:} -+{\tt -+void -+} -+ -+ -+ -+\vspace{0.3cm} -+\vspace{0.3cm} -+\vspace{0.3cm} -+\subsubsection{RPC name:~set\_ncpu} -+ -+{\bf Overview:} -+Set the ncpu field of the given cpu\_pool. -+ -+ \noindent {\bf Signature:} -+\begin{verbatim} void set_ncpu (session_id s, cpu_pool ref self, integer value)\end{verbatim} -+ -+ -+\noindent{\bf Arguments:} -+ -+ -+\vspace{0.3cm} -+\begin{tabular}{|c|c|p{7cm}|} -+\hline -+{\bf type} & {\bf name} & {\bf description} \\ \hline -+{\tt cpu\_pool ref } & self & reference to the object \\ \hline -+{\tt integer } & value & Number of cpus to use \\ \hline -+\end{tabular} -+ -+\vspace{0.3cm} -+ -+ \noindent {\bf Return Type:} -+{\tt -+void -+} -+ -+\vspace{0.3cm} -+ -+\noindent {\bf Possible Error Codes:} -+ {\tt POOL\_BAD\_STATE} -+ -+\vspace{0.3cm} -+\vspace{0.3cm} -+\vspace{0.3cm} -+\subsubsection{RPC name:~set\_other\_config} -+ -+{\bf Overview:} -+Set the other\_config field of the given cpu\_pool. -+ -+ \noindent {\bf Signature:} -+\begin{verbatim} void set_other_config (session_id s, cpu_pool ref self, (string -> string) Map value)\end{verbatim} -+ -+ -+\noindent{\bf Arguments:} -+ -+ -+\vspace{0.3cm} -+\begin{tabular}{|c|c|p{7cm}|} -+\hline -+{\bf type} & {\bf name} & {\bf description} \\ \hline -+{\tt cpu\_pool ref } & self & reference to the object \\ \hline -+{\tt (string $\rightarrow$ string) Map } & value & New value to set \\ \hline -+\end{tabular} -+ -+\vspace{0.3cm} -+ -+\noindent {\bf Return Type:} -+{\tt -+void -+} -+ -+ -+ -+\vspace{0.3cm} -+\vspace{0.3cm} -+\vspace{0.3cm} -+\subsubsection{RPC name:~add\_to\_other\_config} -+ -+{\bf Overview:} -+Add the given key-value pair to the other\_config field of the given cpu\_pool. -+ -+ \noindent {\bf Signature:} -+\begin{verbatim} void add_to_other_config (session_id s, cpu_pool ref self, string key, string value)\end{verbatim} -+ -+ -+\noindent{\bf Arguments:} -+ -+ -+\vspace{0.3cm} -+\begin{tabular}{|c|c|p{7cm}|} -+\hline -+{\bf type} & {\bf name} & {\bf description} \\ \hline -+{\tt cpu\_pool ref } & self & reference to the object \\ \hline -+{\tt string } & key & Key to add \\ \hline -+{\tt string } & value & Value to add \\ \hline -+\end{tabular} -+ -+\vspace{0.3cm} -+ -+ \noindent {\bf Return Type:} -+{\tt -+void -+} -+ -+ -+ -+\vspace{0.3cm} -+\vspace{0.3cm} -+\vspace{0.3cm} -+\subsubsection{RPC name:~remove\_from\_other\_config} -+ -+{\bf Overview:} -+Remove the given key and its corresponding value from the other\_config -+field of the given cpu\_pool. If the key is not in that Map, then do nothing. -+ -+ \noindent {\bf Signature:} -+\begin{verbatim} void remove_from_other_config (session_id s, cpu_pool ref self, string key)\end{verbatim} -+ -+ -+\noindent{\bf Arguments:} -+ -+ -+\vspace{0.3cm} -+\begin{tabular}{|c|c|p{7cm}|} -+\hline -+{\bf type} & {\bf name} & {\bf description} \\ \hline -+{\tt cpu\_pool ref } & self & reference to the object \\ \hline -+{\tt string } & key & Key to remove \\ \hline -+\end{tabular} -+ -+\vspace{0.3cm} -+ -+\noindent {\bf Return Type:} -+{\tt -+void -+} -+ -+ -+ -+\vspace{0.3cm} -+\vspace{0.3cm} -+\vspace{0.3cm} -+\subsubsection{RPC name:~set\_sched\_policy} -+ -+{\bf Overview:} -+Set the sched\_policy field of the given cpu\_pool. -+ -+ \noindent {\bf Signature:} -+\begin{verbatim} void set_sched_policy (session_id s, cpu_pool ref self, string new_sched_policy)\end{verbatim} -+ -+ -+\noindent{\bf Arguments:} -+ -+ -+\vspace{0.3cm} -+\begin{tabular}{|c|c|p{7cm}|} -+\hline -+{\bf type} & {\bf name} & {\bf description} \\ \hline -+{\tt cpu\_pool ref } & self & reference to the object \\ \hline -+{\tt string } & new\_sched\_policy & New value to set \\ \hline -+\end{tabular} -+\vspace{0.3cm} -+ -+\noindent {\bf Return Type:} -+{\tt -+void -+} -+ -+ diff --git a/cpu-pools-libxc.patch b/cpu-pools-libxc.patch deleted file mode 100644 index a265d06..0000000 --- a/cpu-pools-libxc.patch +++ /dev/null @@ -1,307 +0,0 @@ -Index: xen-4.0.2-testing/tools/libxc/Makefile -=================================================================== ---- xen-4.0.2-testing.orig/tools/libxc/Makefile -+++ xen-4.0.2-testing/tools/libxc/Makefile -@@ -8,6 +8,7 @@ CTRL_SRCS-y := - CTRL_SRCS-y += xc_core.c - CTRL_SRCS-$(CONFIG_X86) += xc_core_x86.c - CTRL_SRCS-$(CONFIG_IA64) += xc_core_ia64.c -+CTRL_SRCS-y += xc_cpupool.c - CTRL_SRCS-y += xc_domain.c - CTRL_SRCS-y += xc_evtchn.c - CTRL_SRCS-y += xc_misc.c -Index: xen-4.0.2-testing/tools/libxc/xc_cpupool.c -=================================================================== ---- /dev/null -+++ xen-4.0.2-testing/tools/libxc/xc_cpupool.c -@@ -0,0 +1,165 @@ -+/****************************************************************************** -+ * xc_cpupool.c -+ * -+ * API for manipulating and obtaining information on cpupools. -+ * -+ * Copyright (c) 2009, J Gross. -+ */ -+ -+#include -+#include "xc_private.h" -+ -+static int do_sysctl_save(int xc_handle, struct xen_sysctl *sysctl) -+{ -+ int ret; -+ -+ do { -+ ret = do_sysctl(xc_handle, sysctl); -+ } while ( (ret < 0) && (errno == EAGAIN) ); -+ -+ return ret; -+} -+ -+int xc_cpupool_create(int xc_handle, -+ uint32_t *ppoolid, -+ uint32_t sched_id) -+{ -+ int err; -+ DECLARE_SYSCTL; -+ -+ sysctl.cmd = XEN_SYSCTL_cpupool_op; -+ sysctl.u.cpupool_op.op = XEN_SYSCTL_CPUPOOL_OP_CREATE; -+ sysctl.u.cpupool_op.cpupool_id = (*ppoolid == 0) ? -+ XEN_SYSCTL_CPUPOOL_PAR_ANY : *ppoolid; -+ sysctl.u.cpupool_op.sched_id = sched_id; -+ if ( (err = do_sysctl_save(xc_handle, &sysctl)) != 0 ) -+ return err; -+ -+ *ppoolid = sysctl.u.cpupool_op.cpupool_id; -+ return 0; -+} -+ -+int xc_cpupool_destroy(int xc_handle, -+ uint32_t poolid) -+{ -+ DECLARE_SYSCTL; -+ -+ sysctl.cmd = XEN_SYSCTL_cpupool_op; -+ sysctl.u.cpupool_op.op = XEN_SYSCTL_CPUPOOL_OP_DESTROY; -+ sysctl.u.cpupool_op.cpupool_id = poolid; -+ return do_sysctl_save(xc_handle, &sysctl); -+} -+ -+int xc_cpupool_getinfo(int xc_handle, -+ uint32_t first_poolid, -+ uint32_t n_max, -+ xc_cpupoolinfo_t *info) -+{ -+ int err = 0; -+ int p; -+ uint32_t poolid = first_poolid; -+ uint8_t local[sizeof (info->cpumap)]; -+ DECLARE_SYSCTL; -+ -+ memset(info, 0, n_max * sizeof(xc_cpupoolinfo_t)); -+ -+ for (p = 0; p < n_max; p++) -+ { -+ sysctl.cmd = XEN_SYSCTL_cpupool_op; -+ sysctl.u.cpupool_op.op = XEN_SYSCTL_CPUPOOL_OP_INFO; -+ sysctl.u.cpupool_op.cpupool_id = poolid; -+ set_xen_guest_handle(sysctl.u.cpupool_op.cpumap.bitmap, local); -+ sysctl.u.cpupool_op.cpumap.nr_cpus = sizeof(info->cpumap) * 8; -+ -+ if ( (err = lock_pages(local, sizeof(local))) != 0 ) -+ { -+ PERROR("Could not lock memory for Xen hypercall"); -+ break; -+ } -+ err = do_sysctl_save(xc_handle, &sysctl); -+ unlock_pages(local, sizeof (local)); -+ -+ if ( err < 0 ) -+ break; -+ -+ info->cpupool_id = sysctl.u.cpupool_op.cpupool_id; -+ info->sched_id = sysctl.u.cpupool_op.sched_id; -+ info->n_dom = sysctl.u.cpupool_op.n_dom; -+ bitmap_byte_to_64(&(info->cpumap), local, sizeof(local) * 8); -+ poolid = sysctl.u.cpupool_op.cpupool_id + 1; -+ info++; -+ } -+ -+ if ( p == 0 ) -+ return err; -+ -+ return p; -+} -+ -+int xc_cpupool_addcpu(int xc_handle, -+ uint32_t poolid, -+ int cpu) -+{ -+ DECLARE_SYSCTL; -+ -+ sysctl.cmd = XEN_SYSCTL_cpupool_op; -+ sysctl.u.cpupool_op.op = XEN_SYSCTL_CPUPOOL_OP_ADDCPU; -+ sysctl.u.cpupool_op.cpupool_id = poolid; -+ sysctl.u.cpupool_op.cpu = (cpu < 0) ? XEN_SYSCTL_CPUPOOL_PAR_ANY : cpu; -+ return do_sysctl_save(xc_handle, &sysctl); -+} -+ -+int xc_cpupool_removecpu(int xc_handle, -+ uint32_t poolid, -+ int cpu) -+{ -+ DECLARE_SYSCTL; -+ -+ sysctl.cmd = XEN_SYSCTL_cpupool_op; -+ sysctl.u.cpupool_op.op = XEN_SYSCTL_CPUPOOL_OP_RMCPU; -+ sysctl.u.cpupool_op.cpupool_id = poolid; -+ sysctl.u.cpupool_op.cpu = (cpu < 0) ? XEN_SYSCTL_CPUPOOL_PAR_ANY : cpu; -+ return do_sysctl_save(xc_handle, &sysctl); -+} -+ -+int xc_cpupool_movedomain(int xc_handle, -+ uint32_t poolid, -+ uint32_t domid) -+{ -+ DECLARE_SYSCTL; -+ -+ sysctl.cmd = XEN_SYSCTL_cpupool_op; -+ sysctl.u.cpupool_op.op = XEN_SYSCTL_CPUPOOL_OP_MOVEDOMAIN; -+ sysctl.u.cpupool_op.cpupool_id = poolid; -+ sysctl.u.cpupool_op.domid = domid; -+ return do_sysctl_save(xc_handle, &sysctl); -+} -+ -+int xc_cpupool_freeinfo(int xc_handle, -+ uint64_t *cpumap) -+{ -+ int err; -+ uint8_t local[sizeof (*cpumap)]; -+ DECLARE_SYSCTL; -+ -+ sysctl.cmd = XEN_SYSCTL_cpupool_op; -+ sysctl.u.cpupool_op.op = XEN_SYSCTL_CPUPOOL_OP_FREEINFO; -+ set_xen_guest_handle(sysctl.u.cpupool_op.cpumap.bitmap, local); -+ sysctl.u.cpupool_op.cpumap.nr_cpus = sizeof(*cpumap) * 8; -+ -+ if ( (err = lock_pages(local, sizeof(local))) != 0 ) -+ { -+ PERROR("Could not lock memory for Xen hypercall"); -+ return err; -+ } -+ -+ err = do_sysctl_save(xc_handle, &sysctl); -+ unlock_pages(local, sizeof (local)); -+ -+ if (err < 0) -+ return err; -+ -+ bitmap_byte_to_64(cpumap, local, sizeof(local) * 8); -+ -+ return 0; -+} -Index: xen-4.0.2-testing/tools/libxc/xc_domain.c -=================================================================== ---- xen-4.0.2-testing.orig/tools/libxc/xc_domain.c -+++ xen-4.0.2-testing/tools/libxc/xc_domain.c -@@ -220,6 +220,7 @@ int xc_domain_getinfo(int xc_handle, - info->cpu_time = domctl.u.getdomaininfo.cpu_time; - info->nr_online_vcpus = domctl.u.getdomaininfo.nr_online_vcpus; - info->max_vcpu_id = domctl.u.getdomaininfo.max_vcpu_id; -+ info->cpupool = domctl.u.getdomaininfo.cpupool; - - memcpy(info->handle, domctl.u.getdomaininfo.handle, - sizeof(xen_domain_handle_t)); -Index: xen-4.0.2-testing/tools/libxc/xenctrl.h -=================================================================== ---- xen-4.0.2-testing.orig/tools/libxc/xenctrl.h -+++ xen-4.0.2-testing/tools/libxc/xenctrl.h -@@ -161,6 +161,7 @@ typedef struct xc_dominfo { - unsigned int nr_online_vcpus; - unsigned int max_vcpu_id; - xen_domain_handle_t handle; -+ unsigned int cpupool; - } xc_dominfo_t; - - typedef xen_domctl_getdomaininfo_t xc_domaininfo_t; -@@ -492,6 +493,100 @@ int xc_domain_setdebugging(int xc_handle - unsigned int enable); - - /* -+ * CPUPOOL MANAGEMENT FUNCTIONS -+ */ -+ -+typedef struct xc_cpupoolinfo { -+ uint32_t cpupool_id; -+ uint32_t sched_id; -+ uint32_t n_dom; -+ uint64_t cpumap; -+} xc_cpupoolinfo_t; -+ -+/** -+ * Create a new cpupool. -+ * -+ * @parm xc_handle a handle to an open hypervisor interface -+ * @parm ppoolid pointer to the new cpupool id (in/out) -+ * @parm sched_id id of scheduler to use for pool -+ * return 0 on success, -1 on failure -+ */ -+int xc_cpupool_create(int xc_handle, -+ uint32_t *ppoolid, -+ uint32_t sched_id); -+ -+/** -+ * Destroy a cpupool. Pool must be unused and have no cpu assigned. -+ * -+ * @parm xc_handle a handle to an open hypervisor interface -+ * @parm poolid id of the cpupool to destroy -+ * return 0 on success, -1 on failure -+ */ -+int xc_cpupool_destroy(int xc_handle, -+ uint32_t poolid); -+ -+/** -+ * Get cpupool info. Returns info for up to the specified number of cpupools -+ * starting at the given id. -+ * @parm xc_handle a handle to an open hypervisor interface -+ * @parm first_poolid lowest id for which info is returned -+ * @parm n_max maximum number of cpupools to return info -+ * @parm info pointer to xc_cpupoolinfo_t array -+ * return number of cpupool infos -+ */ -+int xc_cpupool_getinfo(int xc_handle, -+ uint32_t first_poolid, -+ uint32_t n_max, -+ xc_cpupoolinfo_t *info); -+ -+/** -+ * Add cpu to a cpupool. cpu may be -1 indicating the first unassigned. -+ * -+ * @parm xc_handle a handle to an open hypervisor interface -+ * @parm poolid id of the cpupool -+ * @parm cpu cpu number to add -+ * return 0 on success, -1 on failure -+ */ -+int xc_cpupool_addcpu(int xc_handle, -+ uint32_t poolid, -+ int cpu); -+ -+/** -+ * Remove cpu from cpupool. cpu may be -1 indicating the last cpu of the pool. -+ * -+ * @parm xc_handle a handle to an open hypervisor interface -+ * @parm poolid id of the cpupool -+ * @parm cpu cpu number to remove -+ * return 0 on success, -1 on failure -+ */ -+int xc_cpupool_removecpu(int xc_handle, -+ uint32_t poolid, -+ int cpu); -+ -+/** -+ * Move domain to another cpupool. -+ * -+ * @parm xc_handle a handle to an open hypervisor interface -+ * @parm poolid id of the destination cpupool -+ * @parm domid id of the domain to move -+ * return 0 on success, -1 on failure -+ */ -+int xc_cpupool_movedomain(int xc_handle, -+ uint32_t poolid, -+ uint32_t domid); -+ -+/** -+ * Return map of cpus not in any cpupool. -+ * -+ * @parm xc_handle a handle to an open hypervisor interface -+ * @parm cpumap pointer where to store the cpumap -+ * return 0 on success, -1 on failure -+ */ -+int xc_cpupool_freeinfo(int xc_handle, -+ uint64_t *cpumap); -+ -+ -+/* - * EVENT CHANNEL FUNCTIONS - */ - diff --git a/cpu-pools-libxen.patch b/cpu-pools-libxen.patch deleted file mode 100644 index 280afd2..0000000 --- a/cpu-pools-libxen.patch +++ /dev/null @@ -1,2180 +0,0 @@ -Index: xen-4.0.2-testing/tools/libxen/include/xen/api/xen_all.h -=================================================================== ---- xen-4.0.2-testing.orig/tools/libxen/include/xen/api/xen_all.h -+++ xen-4.0.2-testing/tools/libxen/include/xen/api/xen_all.h -@@ -37,4 +37,5 @@ - #include - #include - #include -+#include - #endif -Index: xen-4.0.2-testing/tools/libxen/include/xen/api/xen_cpu_pool.h -=================================================================== ---- /dev/null -+++ xen-4.0.2-testing/tools/libxen/include/xen/api/xen_cpu_pool.h -@@ -0,0 +1,424 @@ -+/* -+ * Copyright (c) 2006-2007, XenSource Inc. -+ * -+ * This library is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Lesser General Public -+ * License as published by the Free Software Foundation; either -+ * version 2.1 of the License, or (at your option) any later version. -+ * -+ * This library 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 -+ * Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public -+ * License along with this library; if not, write to the Free Software -+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -+ */ -+ -+#ifndef XEN_CPU_POOL_H -+#define XEN_CPU_POOL_H -+ -+#include -+#include -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+/* -+ * The cpu_pool class. -+ * -+ * Management of CPU pools. -+ */ -+ -+ -+/** -+ * Free the given xen_cpu_pool. The given handle must have been allocated -+ * by this library. -+ */ -+extern void -+xen_cpu_pool_free(xen_cpu_pool cpu_pool); -+ -+ -+typedef struct xen_cpu_pool_set -+{ -+ size_t size; -+ xen_cpu_pool *contents[]; -+} xen_cpu_pool_set; -+ -+/** -+ * Allocate a xen_cpu_pool_set of the given size. -+ */ -+extern xen_cpu_pool_set * -+xen_cpu_pool_set_alloc(size_t size); -+ -+/** -+ * Free the given xen_cpu_pool_set. The given set must have been allocated -+ * by this library. -+ */ -+extern void -+xen_cpu_pool_set_free(xen_cpu_pool_set *set); -+ -+ -+typedef struct xen_cpu_pool_record -+{ -+ xen_cpu_pool handle; -+ char *uuid; -+ char *name_label; -+ char *name_description; -+ struct xen_host_record_opt *resident_on; -+ bool auto_power_on; -+ struct xen_vm_record_opt_set *started_vms; -+ int64_t ncpu; -+ char *sched_policy; -+ struct xen_string_set *proposed_cpus; -+ struct xen_host_cpu_record_opt_set *host_cpus; -+ bool activated; -+ xen_string_string_map *other_config; -+} xen_cpu_pool_record; -+ -+/** -+ * Allocate a xen_cpu_pool_record. -+ */ -+extern xen_cpu_pool_record * -+xen_cpu_pool_record_alloc(void); -+ -+/** -+ * Free the given xen_cpu_pool_record, and all referenced values. The given -+ * record must have been allocated by this library. -+ */ -+extern void -+xen_cpu_pool_record_free(xen_cpu_pool_record *record); -+ -+ -+typedef struct xen_cpu_pool_record_opt -+{ -+ bool is_record; -+ union -+ { -+ xen_cpu_pool handle; -+ xen_cpu_pool_record *record; -+ } u; -+} xen_cpu_pool_record_opt; -+ -+/** -+ * Allocate a xen_cpu_pool_record_opt. -+ */ -+extern xen_cpu_pool_record_opt * -+xen_cpu_pool_record_opt_alloc(void); -+ -+/** -+ * Free the given xen_cpu_pool_record_opt, and all referenced values. The -+ * given record_opt must have been allocated by this library. -+ */ -+extern void -+xen_cpu_pool_record_opt_free(xen_cpu_pool_record_opt *record_opt); -+ -+ -+typedef struct xen_cpu_pool_record_set -+{ -+ size_t size; -+ xen_cpu_pool_record *contents[]; -+} xen_cpu_pool_record_set; -+ -+/** -+ * Allocate a xen_cpu_pool_record_set of the given size. -+ */ -+extern xen_cpu_pool_record_set * -+xen_cpu_pool_record_set_alloc(size_t size); -+ -+/** -+ * Free the given xen_cpu_pool_record_set, and all referenced values. The -+ * given set must have been allocated by this library. -+ */ -+extern void -+xen_cpu_pool_record_set_free(xen_cpu_pool_record_set *set); -+ -+ -+ -+typedef struct xen_cpu_pool_record_opt_set -+{ -+ size_t size; -+ xen_cpu_pool_record_opt *contents[]; -+} xen_cpu_pool_record_opt_set; -+ -+/** -+ * Allocate a xen_cpu_pool_record_opt_set of the given size. -+ */ -+extern xen_cpu_pool_record_opt_set * -+xen_cpu_pool_record_opt_set_alloc(size_t size); -+ -+/** -+ * Free the given xen_cpu_pool_record_opt_set, and all referenced values. -+ * The given set must have been allocated by this library. -+ */ -+extern void -+xen_cpu_pool_record_opt_set_free(xen_cpu_pool_record_opt_set *set); -+ -+ -+/** -+ * Get a record containing the current state of the given cpu_pool. -+ */ -+extern bool -+xen_cpu_pool_get_record(xen_session *session, xen_cpu_pool_record **result, -+ xen_cpu_pool cpu_pool); -+ -+ -+/** -+ * Get a reference to the cpu_pool instance with the specified UUID. -+ */ -+extern bool -+xen_cpu_pool_get_by_uuid(xen_session *session, xen_cpu_pool *result, char *uuid); -+ -+ -+/** -+ * Create a new cpu_pool instance, and return its handle. -+ */ -+extern bool -+xen_cpu_pool_create(xen_session *session, xen_cpu_pool *result, -+ xen_cpu_pool_record *record); -+ -+ -+/** -+ * Destroy the specified VBD instance. -+ */ -+extern bool -+xen_cpu_pool_destroy(xen_session *session, xen_cpu_pool cpu_pool); -+ -+ -+/** -+ * Get the uuid field of the given cpu_pool. -+ */ -+extern bool -+xen_cpu_pool_get_uuid(xen_session *session, char **result, xen_cpu_pool cpu_pool); -+ -+ -+/** -+ * Deactivate the given cpu_pool. -+ */ -+extern bool -+xen_cpu_pool_deactivate(xen_session *session, xen_cpu_pool cpu_pool); -+ -+ -+/** -+ * Activate the given cpu_pool. -+ */ -+extern bool -+xen_cpu_pool_activate(xen_session *session, xen_cpu_pool cpu_pool); -+ -+ -+/** -+ * Add a physical cpu to the active pool. -+ */ -+extern bool -+xen_cpu_pool_add_host_CPU_live(xen_session *session, xen_cpu_pool cpu_pool, -+ xen_host_cpu host_cpu); -+ -+ -+/** -+ * Remove a physical cpu from the active pool. -+ */ -+extern bool -+xen_cpu_pool_remove_host_CPU_live(xen_session *session, xen_cpu_pool cpu_pool, -+ xen_host_cpu host_cpu); -+ -+ -+/** -+ * Return a list of all the cpu_pools known to the system. -+ */ -+extern bool -+xen_cpu_pool_get_all(xen_session *session, struct xen_cpu_pool_set **result); -+ -+ -+/** -+ * Get the uuid field of the cpu_pool with given name. -+ */ -+extern bool -+xen_cpu_pool_get_by_name_label(xen_session *session, -+ struct xen_cpu_pool_set **result, char *label); -+ -+ -+/** -+ * Get activation state of given cpu_pool. -+ */ -+extern bool -+xen_cpu_pool_get_activated(xen_session *session, bool *result, -+ xen_cpu_pool cpu_pool); -+ -+ -+/** -+ * Get auto_power_on option of given cpu_pool. -+ */ -+extern bool -+xen_cpu_pool_get_auto_power_on(xen_session *session, bool *result, -+ xen_cpu_pool cpu_pool); -+ -+ -+/** -+ * Get host_cpu refs of all physical cpus of cpu_pool. -+ */ -+extern bool -+xen_cpu_pool_get_host_CPUs(xen_session *session, struct xen_host_cpu_set **result, -+ xen_cpu_pool cpu_pool); -+ -+ -+/** -+ * Get name description field of given cpu_pool. -+ */ -+extern bool -+xen_cpu_pool_get_name_description(xen_session *session, char **result, -+ xen_cpu_pool cpu_pool); -+ -+ -+/** -+ * Get name label field of given cpu_pool. -+ */ -+extern bool -+xen_cpu_pool_get_name_label(xen_session *session, char **result, -+ xen_cpu_pool cpu_pool); -+ -+ -+/** -+ * Get count of physical cpus to attach to cpu_pool on activation. -+ */ -+extern bool -+xen_cpu_pool_get_ncpu(xen_session *session, int64_t *result, -+ xen_cpu_pool cpu_pool); -+ -+ -+/** -+ * Get proposed_CPUs field of given cpu_pool. -+ */ -+extern bool -+xen_cpu_pool_get_proposed_CPUs(xen_session *session, struct xen_string_set **result, -+ xen_cpu_pool cpu_pool); -+ -+ -+/** -+ * Get the other_config field of the given cpu_pool. -+ */ -+extern bool -+xen_cpu_pool_get_other_config(xen_session *session, xen_string_string_map **result, -+ xen_cpu_pool cpu_pool); -+ -+ -+/** -+ * Get host the cpu_pool is resident on. -+ */ -+extern bool -+xen_cpu_pool_get_resident_on(xen_session *session, xen_host *result, -+ xen_cpu_pool cpu_pool); -+ -+ -+/** -+ * Get sched_policy field of given cpu_pool. -+ */ -+extern bool -+xen_cpu_pool_get_sched_policy(xen_session *session, char **result, -+ xen_cpu_pool cpu_pool); -+ -+ -+/** -+ * Get set of started vms in given cpu_pool. -+ */ -+extern bool -+xen_cpu_pool_get_started_VMs(xen_session *session, xen_vm_set **result, -+ xen_cpu_pool cpu_pool); -+ -+ -+/** -+ * Set auto_power_on field of given cpu_pool. -+ */ -+extern bool -+xen_cpu_pool_set_auto_power_on(xen_session *session, xen_cpu_pool cpu_pool, -+ bool auto_power_on); -+ -+ -+/** -+ * Set proposed_CPUs field of given cpu_pool. -+ */ -+extern bool -+xen_cpu_pool_set_proposed_CPUs(xen_session *session, xen_cpu_pool cpu_pool, -+ xen_string_set *proposed_cpus); -+ -+ -+/** -+ * Add a proposed cpu to proposed_CPUs field of given cpu_pool. -+ */ -+extern bool -+xen_cpu_pool_add_to_proposed_CPUs(xen_session *session, xen_cpu_pool cpu_pool, -+ char* proposed_cpu); -+ -+ -+/** -+ * Remove a proposed cpu from proposed_CPUs field of given cpu_pool. -+ */ -+extern bool -+xen_cpu_pool_remove_from_proposed_CPUs(xen_session *session, xen_cpu_pool cpu_pool, -+ char* proposed_cpu); -+ -+ -+/** -+ * Set name_label field of given cpu_pool. -+ */ -+extern bool -+xen_cpu_pool_set_name_label(xen_session *session, xen_cpu_pool cpu_pool, -+ char *label); -+ -+ -+/** -+ * Set name_description field of given cpu_pool. -+ */ -+extern bool -+xen_cpu_pool_set_name_description(xen_session *session, xen_cpu_pool cpu_pool, -+ char *descr); -+ -+ -+/** -+ * Set ncpu field of given cpu_pool. -+ */ -+extern bool -+xen_cpu_pool_set_ncpu(xen_session *session, xen_cpu_pool cpu_pool, int64_t ncpu); -+ -+ -+/** -+ * Set the other_config field of the given cpu_pool. -+ */ -+extern bool -+xen_cpu_pool_set_other_config(xen_session *session, xen_cpu_pool cpu_pool, -+ xen_string_string_map *other_config); -+ -+ -+/** -+ * Add the given key-value pair to the other_config field of the given -+ * cpu_pool. -+ */ -+extern bool -+xen_cpu_pool_add_to_other_config(xen_session *session, xen_cpu_pool cpu_pool, -+ char *key, char *value); -+ -+ -+/** -+ * Remove the given key and its corresponding value from the -+ * other_config field of the given cpu_pool. If the key is not in that Map, then -+ * do nothing. -+ */ -+extern bool -+xen_cpu_pool_remove_from_other_config(xen_session *session, xen_cpu_pool cpu_pool, -+ char *key); -+ -+/** -+ * Set sched_policy of given cpu_pool. -+ */ -+extern bool -+xen_cpu_pool_set_sched_policy(xen_session *session, xen_cpu_pool cpu_pool, -+ char *sched_policy); -+ -+ -+#endif -Index: xen-4.0.2-testing/tools/libxen/include/xen/api/xen_cpu_pool_decl.h -=================================================================== ---- /dev/null -+++ xen-4.0.2-testing/tools/libxen/include/xen/api/xen_cpu_pool_decl.h -@@ -0,0 +1,30 @@ -+/* -+ * Copyright (c) 2006-2007, XenSource Inc. -+ * -+ * This library is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Lesser General Public -+ * License as published by the Free Software Foundation; either -+ * version 2.1 of the License, or (at your option) any later version. -+ * -+ * This library 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 -+ * Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public -+ * License along with this library; if not, write to the Free Software -+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -+ */ -+ -+#ifndef XEN_CPU_POOL_DECL_H -+#define XEN_CPU_POOL_DECL_H -+ -+typedef void *xen_cpu_pool; -+ -+struct xen_cpu_pool_set; -+struct xen_cpu_pool_record; -+struct xen_cpu_pool_record_set; -+struct xen_cpu_pool_record_opt; -+struct xen_cpu_pool_record_opt_set; -+ -+#endif -Index: xen-4.0.2-testing/tools/libxen/include/xen/api/xen_host.h -=================================================================== ---- xen-4.0.2-testing.orig/tools/libxen/include/xen/api/xen_host.h -+++ xen-4.0.2-testing/tools/libxen/include/xen/api/xen_host.h -@@ -29,7 +29,7 @@ - #include - #include - #include -- -+#include - - /* - * The host class. -@@ -91,6 +91,7 @@ typedef struct xen_host_record - struct xen_pbd_record_opt_set *pbds; - struct xen_host_cpu_record_opt_set *host_cpus; - struct xen_host_metrics_record_opt *metrics; -+ struct xen_cpu_pool_record_opt_set *resident_cpu_pools; - } xen_host_record; - - /** -@@ -494,4 +495,11 @@ extern bool - xen_host_get_all(xen_session *session, struct xen_host_set **result); - - -+/** -+ * Get list of resident cpu pools. -+ */ -+extern bool -+xen_host_get_resident_cpu_pools(xen_session *session, struct xen_cpu_pool_set **result, -+ xen_host host); -+ - #endif -Index: xen-4.0.2-testing/tools/libxen/include/xen/api/xen_host_cpu.h -=================================================================== ---- xen-4.0.2-testing.orig/tools/libxen/include/xen/api/xen_host_cpu.h -+++ xen-4.0.2-testing/tools/libxen/include/xen/api/xen_host_cpu.h -@@ -22,6 +22,7 @@ - #include - #include - #include -+#include - - - /* -@@ -72,6 +73,7 @@ typedef struct xen_host_cpu_record - char *flags; - char *features; - double utilisation; -+ struct xen_cpu_pool_record_opt_set *cpu_pools; - } xen_host_cpu_record; - - /** -@@ -244,4 +246,18 @@ extern bool - xen_host_cpu_get_all(xen_session *session, struct xen_host_cpu_set **result); - - -+/** -+ * Get the ref of the cpu_pool to which the host_cpu belongs. -+ */ -+extern bool -+xen_host_cpu_get_cpu_pool(xen_session *session, struct xen_cpu_pool_set **result, xen_host_cpu host_cpu); -+ -+ -+/** -+ * Return a list of all the host_cpus not assigned to a cpu_pool. -+ */ -+extern bool -+xen_host_cpu_get_unassigned_cpus(xen_session *session, struct xen_host_cpu_set **result); -+ -+ - #endif -Index: xen-4.0.2-testing/tools/libxen/include/xen/api/xen_vm.h -=================================================================== ---- xen-4.0.2-testing.orig/tools/libxen/include/xen/api/xen_vm.h -+++ xen-4.0.2-testing/tools/libxen/include/xen/api/xen_vm.h -@@ -34,6 +34,7 @@ - #include - #include - #include -+#include - - - /* -@@ -113,6 +114,8 @@ typedef struct xen_vm_record - struct xen_vm_metrics_record_opt *metrics; - struct xen_vm_guest_metrics_record_opt *guest_metrics; - char *security_label; -+ char *pool_name; -+ struct xen_cpu_pool_record_opt_set *cpu_pool; - } xen_vm_record; - - /** -@@ -905,4 +908,33 @@ xen_vm_set_security_label(xen_session *s - extern bool - xen_vm_get_security_label(xen_session *session, char **result, xen_vm vm); - -+ -+/** -+ * Get the cpu_pool ref field of a domain. -+ */ -+extern bool -+xen_vm_get_cpu_pool(xen_session *session, struct xen_cpu_pool_set **result, xen_vm vm); -+ -+ -+/** -+ * Get the pool_name field of a domain. -+ */ -+extern bool -+xen_vm_get_pool_name(xen_session *session, char **result, xen_vm vm); -+ -+ -+/** -+ * Set the pool_name field of a domain. -+ */ -+extern bool -+xen_vm_set_pool_name(xen_session *session, xen_vm vm, char *pool_name); -+ -+ -+/** -+ * Migrate the VM to another cpu_pool (on the same host). This can only be -+ * called when the specified VM is in the Running state. -+ */ -+extern bool -+xen_vm_cpu_pool_migrate(xen_session *session, xen_vm vm, xen_cpu_pool cpu_pool); -+ - #endif -Index: xen-4.0.2-testing/tools/libxen/src/xen_cpu_pool.c -=================================================================== ---- /dev/null -+++ xen-4.0.2-testing/tools/libxen/src/xen_cpu_pool.c -@@ -0,0 +1,671 @@ -+/* -+ * Copyright (c) 2006-2007, XenSource Inc. -+ * -+ * This library is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Lesser General Public -+ * License as published by the Free Software Foundation; either -+ * version 2.1 of the License, or (at your option) any later version. -+ * -+ * This library 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 -+ * Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public -+ * License along with this library; if not, write to the Free Software -+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -+ */ -+ -+ -+#include -+#include -+ -+#include "xen_internal.h" -+#include -+#include -+#include -+ -+XEN_FREE(xen_cpu_pool) -+XEN_SET_ALLOC_FREE(xen_cpu_pool) -+XEN_ALLOC(xen_cpu_pool_record) -+XEN_SET_ALLOC_FREE(xen_cpu_pool_record) -+XEN_ALLOC(xen_cpu_pool_record_opt) -+XEN_RECORD_OPT_FREE(xen_cpu_pool) -+XEN_SET_ALLOC_FREE(xen_cpu_pool_record_opt) -+ -+ -+static const struct_member xen_cpu_pool_record_struct_members[] = -+ { -+ { .key = "uuid", -+ .type = &abstract_type_string, -+ .offset = offsetof(xen_cpu_pool_record, uuid) }, -+ { .key = "name_label", -+ .type = &abstract_type_string, -+ .offset = offsetof(xen_cpu_pool_record, name_label) }, -+ { .key = "name_description", -+ .type = &abstract_type_string, -+ .offset = offsetof(xen_cpu_pool_record, name_description) }, -+ { .key = "resident_on", -+ .type = &abstract_type_ref, -+ .offset = offsetof(xen_cpu_pool_record, resident_on) }, -+ { .key = "auto_power_on", -+ .type = &abstract_type_bool, -+ .offset = offsetof(xen_cpu_pool_record, auto_power_on) }, -+ { .key = "started_VMs", -+ .type = &abstract_type_ref_set, -+ .offset = offsetof(xen_cpu_pool_record, started_vms) }, -+ { .key = "ncpu", -+ .type = &abstract_type_int, -+ .offset = offsetof(xen_cpu_pool_record, ncpu) }, -+ { .key = "sched_policy", -+ .type = &abstract_type_string, -+ .offset = offsetof(xen_cpu_pool_record, sched_policy) }, -+ { .key = "proposed_CPUs", -+ .type = &abstract_type_string_set, -+ .offset = offsetof(xen_cpu_pool_record, proposed_cpus) }, -+ { .key = "host_CPUs", -+ .type = &abstract_type_ref_set, -+ .offset = offsetof(xen_cpu_pool_record, host_cpus) }, -+ { .key = "activated", -+ .type = &abstract_type_bool, -+ .offset = offsetof(xen_cpu_pool_record, activated) }, -+ { .key = "other_config", -+ .type = &abstract_type_string_string_map, -+ .offset = offsetof(xen_cpu_pool_record, other_config) }, -+ }; -+ -+ -+const abstract_type xen_cpu_pool_record_abstract_type_ = -+ { -+ .typename = STRUCT, -+ .struct_size = sizeof(xen_cpu_pool_record), -+ .member_count = -+ sizeof(xen_cpu_pool_record_struct_members) / sizeof(struct_member), -+ .members = xen_cpu_pool_record_struct_members -+ }; -+ -+ -+void -+xen_cpu_pool_record_free(xen_cpu_pool_record *record) -+{ -+ if (record == NULL) -+ { -+ return; -+ } -+ free(record->handle); -+ free(record->uuid); -+ free(record->name_label); -+ free(record->name_description); -+ xen_host_record_opt_free(record->resident_on); -+ xen_vm_record_opt_set_free(record->started_vms); -+ free(record->sched_policy); -+ xen_string_set_free(record->proposed_cpus); -+ xen_host_cpu_record_opt_set_free(record->host_cpus); -+ xen_string_string_map_free(record->other_config); -+ free(record); -+} -+ -+ -+bool -+xen_cpu_pool_get_record(xen_session *session, xen_cpu_pool_record **result, -+ xen_cpu_pool cpu_pool) -+{ -+ abstract_value param_values[] = -+ { -+ { .type = &abstract_type_string, -+ .u.string_val = cpu_pool } -+ }; -+ -+ abstract_type result_type = xen_cpu_pool_record_abstract_type_; -+ -+ *result = NULL; -+ XEN_CALL_("cpu_pool.get_record"); -+ -+ if (session->ok) -+ { -+ (*result)->handle = xen_strdup_((*result)->uuid); -+ } -+ -+ return session->ok; -+} -+ -+ -+bool -+xen_cpu_pool_get_by_uuid(xen_session *session, xen_cpu_pool *result, char *uuid) -+{ -+ abstract_value param_values[] = -+ { -+ { .type = &abstract_type_string, -+ .u.string_val = uuid } -+ }; -+ -+ abstract_type result_type = abstract_type_string; -+ -+ *result = NULL; -+ XEN_CALL_("cpu_pool.get_by_uuid"); -+ return session->ok; -+} -+ -+ -+bool -+xen_cpu_pool_create(xen_session *session, xen_cpu_pool *result, -+ xen_cpu_pool_record *record) -+{ -+ abstract_value param_values[] = -+ { -+ { .type = &xen_cpu_pool_record_abstract_type_, -+ .u.struct_val = record } -+ }; -+ -+ abstract_type result_type = abstract_type_string; -+ -+ *result = NULL; -+ XEN_CALL_("cpu_pool.create"); -+ return session->ok; -+} -+ -+ -+bool -+xen_cpu_pool_destroy(xen_session *session, xen_cpu_pool cpu_pool) -+{ -+ abstract_value param_values[] = -+ { -+ { .type = &abstract_type_string, -+ .u.string_val = cpu_pool } -+ }; -+ -+ xen_call_(session, "cpu_pool.destroy", param_values, 1, NULL, NULL); -+ return session->ok; -+} -+ -+ -+bool -+xen_cpu_pool_get_uuid(xen_session *session, char **result, xen_cpu_pool cpu_pool) -+{ -+ abstract_value param_values[] = -+ { -+ { .type = &abstract_type_string, -+ .u.string_val = cpu_pool } -+ }; -+ -+ abstract_type result_type = abstract_type_string; -+ -+ *result = NULL; -+ XEN_CALL_("cpu_pool.get_uuid"); -+ return session->ok; -+} -+ -+ -+bool -+xen_cpu_pool_deactivate(xen_session *session, xen_cpu_pool cpu_pool) -+{ -+ abstract_value param_values[] = -+ { -+ { .type = &abstract_type_string, -+ .u.string_val = cpu_pool }, -+ }; -+ -+ xen_call_(session, "cpu_pool.deactivate", param_values, 1, NULL, NULL); -+ return session->ok; -+} -+ -+ -+bool -+xen_cpu_pool_activate(xen_session *session, xen_cpu_pool cpu_pool) -+{ -+ abstract_value param_values[] = -+ { -+ { .type = &abstract_type_string, -+ .u.string_val = cpu_pool }, -+ }; -+ -+ xen_call_(session, "cpu_pool.activate", param_values, 1, NULL, NULL); -+ return session->ok; -+} -+ -+ -+bool -+xen_cpu_pool_add_host_CPU_live(xen_session *session, xen_cpu_pool cpu_pool, -+ xen_host_cpu host_cpu) -+{ -+ abstract_value param_values[] = -+ { -+ { .type = &abstract_type_string, -+ .u.string_val = cpu_pool }, -+ { .type = &abstract_type_string, -+ .u.string_val = host_cpu }, -+ }; -+ -+ xen_call_(session, "cpu_pool.add_host_CPU_live", param_values, 2, NULL, NULL); -+ return session->ok; -+} -+ -+ -+bool -+xen_cpu_pool_remove_host_CPU_live(xen_session *session, xen_cpu_pool cpu_pool, -+ xen_host_cpu host_cpu) -+{ -+ abstract_value param_values[] = -+ { -+ { .type = &abstract_type_string, -+ .u.string_val = cpu_pool }, -+ { .type = &abstract_type_string, -+ .u.string_val = host_cpu }, -+ }; -+ -+ xen_call_(session, "cpu_pool.remove_host_CPU_live", param_values, 2, NULL, NULL); -+ return session->ok; -+} -+ -+ -+bool -+xen_cpu_pool_get_all(xen_session *session, struct xen_cpu_pool_set **result) -+{ -+ abstract_type result_type = abstract_type_string_set; -+ -+ *result = NULL; -+ xen_call_(session, "cpu_pool.get_all", NULL, 0, &result_type, result); -+ return session->ok; -+} -+ -+ -+bool -+xen_cpu_pool_get_by_name_label(xen_session *session, -+ struct xen_cpu_pool_set **result, char *label) -+{ -+ abstract_value param_values[] = -+ { -+ { .type = &abstract_type_string, -+ .u.string_val = label } -+ }; -+ -+ abstract_type result_type = abstract_type_string_set; -+ -+ *result = NULL; -+ XEN_CALL_("cpu_pool.get_by_name_label"); -+ return session->ok; -+} -+ -+ -+bool -+xen_cpu_pool_get_activated(xen_session *session, bool *result, -+ xen_cpu_pool cpu_pool) -+{ -+ abstract_value param_values[] = -+ { -+ { .type = &abstract_type_string, -+ .u.string_val = cpu_pool } -+ }; -+ -+ abstract_type result_type = abstract_type_bool; -+ -+ XEN_CALL_("cpu_pool.get_activated"); -+ return session->ok; -+} -+ -+ -+bool -+xen_cpu_pool_get_auto_power_on(xen_session *session, bool *result, -+ xen_cpu_pool cpu_pool) -+{ -+ abstract_value param_values[] = -+ { -+ { .type = &abstract_type_string, -+ .u.string_val = cpu_pool } -+ }; -+ -+ abstract_type result_type = abstract_type_bool; -+ -+ XEN_CALL_("cpu_pool.get_auto_power_on"); -+ return session->ok; -+} -+ -+ -+bool -+xen_cpu_pool_get_host_CPUs(xen_session *session, struct xen_host_cpu_set **result, -+ xen_cpu_pool cpu_pool) -+{ -+ abstract_value param_values[] = -+ { -+ { .type = &abstract_type_string, -+ .u.string_val = cpu_pool } -+ }; -+ -+ abstract_type result_type = abstract_type_string_set; -+ -+ *result = NULL; -+ XEN_CALL_("cpu_pool.get_host_CPUs"); -+ return session->ok; -+} -+ -+ -+bool -+xen_cpu_pool_get_name_description(xen_session *session, char **result, -+ xen_cpu_pool cpu_pool) -+{ -+ abstract_value param_values[] = -+ { -+ { .type = &abstract_type_string, -+ .u.string_val = cpu_pool } -+ }; -+ -+ abstract_type result_type = abstract_type_string; -+ -+ *result = NULL; -+ XEN_CALL_("cpu_pool.get_name_description"); -+ return session->ok; -+} -+ -+ -+bool -+xen_cpu_pool_get_name_label(xen_session *session, char **result, -+ xen_cpu_pool cpu_pool) -+{ -+ abstract_value param_values[] = -+ { -+ { .type = &abstract_type_string, -+ .u.string_val = cpu_pool } -+ }; -+ -+ abstract_type result_type = abstract_type_string; -+ -+ *result = NULL; -+ XEN_CALL_("cpu_pool.get_name_label"); -+ return session->ok; -+} -+ -+ -+bool -+xen_cpu_pool_get_ncpu(xen_session *session, int64_t *result, -+ xen_cpu_pool cpu_pool) -+{ -+ abstract_value param_values[] = -+ { -+ { .type = &abstract_type_string, -+ .u.string_val = cpu_pool } -+ }; -+ -+ abstract_type result_type = abstract_type_int; -+ -+ XEN_CALL_("cpu_pool.get_ncpu"); -+ return session->ok; -+} -+ -+ -+bool -+xen_cpu_pool_get_proposed_CPUs(xen_session *session, struct xen_string_set **result, -+ xen_cpu_pool cpu_pool) -+{ -+ abstract_value param_values[] = -+ { -+ { .type = &abstract_type_string, -+ .u.string_val = cpu_pool } -+ }; -+ -+ abstract_type result_type = abstract_type_string_set; -+ -+ *result = NULL; -+ XEN_CALL_("cpu_pool.get_proposed_CPUs"); -+ return session->ok; -+} -+ -+ -+bool -+xen_cpu_pool_get_other_config(xen_session *session, xen_string_string_map **result, -+ xen_cpu_pool cpu_pool) -+{ -+ abstract_value param_values[] = -+ { -+ { .type = &abstract_type_string, -+ .u.string_val = cpu_pool } -+ }; -+ -+ abstract_type result_type = abstract_type_string_string_map; -+ -+ *result = NULL; -+ XEN_CALL_("cpu_pool.get_other_config"); -+ return session->ok; -+} -+ -+ -+bool -+xen_cpu_pool_get_resident_on(xen_session *session, xen_host *result, -+ xen_cpu_pool cpu_pool) -+{ -+ abstract_value param_values[] = -+ { -+ { .type = &abstract_type_string, -+ .u.string_val = cpu_pool } -+ }; -+ -+ abstract_type result_type = abstract_type_string; -+ -+ *result = NULL; -+ XEN_CALL_("cpu_pool.get_resident_on"); -+ return session->ok; -+} -+ -+ -+bool -+xen_cpu_pool_get_sched_policy(xen_session *session, char **result, -+ xen_cpu_pool cpu_pool) -+{ -+ abstract_value param_values[] = -+ { -+ { .type = &abstract_type_string, -+ .u.string_val = cpu_pool } -+ }; -+ -+ abstract_type result_type = abstract_type_string; -+ -+ *result = NULL; -+ XEN_CALL_("cpu_pool.get_sched_policy"); -+ return session->ok; -+} -+ -+ -+bool -+xen_cpu_pool_get_started_VMs(xen_session *session, xen_vm_set **result, -+ xen_cpu_pool cpu_pool) -+{ -+ abstract_value param_values[] = -+ { -+ { .type = &abstract_type_string, -+ .u.string_val = cpu_pool } -+ }; -+ -+ abstract_type result_type = abstract_type_string_set; -+ -+ *result = NULL; -+ XEN_CALL_("cpu_pool.get_started_VMs"); -+ return session->ok; -+} -+ -+ -+bool -+xen_cpu_pool_set_auto_power_on(xen_session *session, xen_cpu_pool cpu_pool, -+ bool auto_power_on) -+{ -+ abstract_value param_values[] = -+ { -+ { .type = &abstract_type_string, -+ .u.string_val = cpu_pool }, -+ { .type = &abstract_type_bool, -+ .u.bool_val = auto_power_on } -+ }; -+ -+ xen_call_(session, "cpu_pool.set_auto_power_on", param_values, 2, NULL, NULL); -+ return session->ok; -+} -+ -+ -+bool -+xen_cpu_pool_set_proposed_CPUs(xen_session *session, xen_cpu_pool cpu_pool, -+ xen_string_set *proposed_cpus) -+{ -+ abstract_value param_values[] = -+ { -+ { .type = &abstract_type_string, -+ .u.string_val = cpu_pool }, -+ { .type = &abstract_type_string_set, -+ .u.set_val = (arbitrary_set *)proposed_cpus } -+ }; -+ -+ xen_call_(session, "cpu_pool.set_proposed_CPUs", param_values, 2, NULL, NULL); -+ return session->ok; -+} -+ -+ -+bool -+xen_cpu_pool_add_to_proposed_CPUs(xen_session *session, xen_cpu_pool cpu_pool, -+ char* proposed_cpu) -+{ -+ abstract_value param_values[] = -+ { -+ { .type = &abstract_type_string, -+ .u.string_val = cpu_pool }, -+ { .type = &abstract_type_string, -+ .u.string_val = proposed_cpu } -+ }; -+ -+ xen_call_(session, "cpu_pool.add_to_proposed_CPUs", param_values, 2, NULL, NULL); -+ return session->ok; -+} -+ -+ -+bool -+xen_cpu_pool_remove_from_proposed_CPUs(xen_session *session, xen_cpu_pool cpu_pool, -+ char* proposed_cpu) -+{ -+ abstract_value param_values[] = -+ { -+ { .type = &abstract_type_string, -+ .u.string_val = cpu_pool }, -+ { .type = &abstract_type_string, -+ .u.string_val = proposed_cpu } -+ }; -+ -+ xen_call_(session, "cpu_pool.remove_from_proposed_CPUs", param_values, 2, NULL, NULL); -+ return session->ok; -+} -+ -+ -+bool -+xen_cpu_pool_set_name_label(xen_session *session, xen_cpu_pool cpu_pool, -+ char *label) -+{ -+ abstract_value param_values[] = -+ { -+ { .type = &abstract_type_string, -+ .u.string_val = cpu_pool }, -+ { .type = &abstract_type_string, -+ .u.string_val = label } -+ }; -+ -+ xen_call_(session, "cpu_pool.set_name_label", param_values, 2, NULL, NULL); -+ return session->ok; -+} -+ -+ -+bool -+xen_cpu_pool_set_name_description(xen_session *session, xen_cpu_pool cpu_pool, -+ char *descr) -+{ -+ abstract_value param_values[] = -+ { -+ { .type = &abstract_type_string, -+ .u.string_val = cpu_pool }, -+ { .type = &abstract_type_string, -+ .u.string_val = descr } -+ }; -+ -+ xen_call_(session, "cpu_pool.set_name_description", param_values, 2, NULL, NULL); -+ return session->ok; -+} -+ -+ -+bool -+xen_cpu_pool_set_ncpu(xen_session *session, xen_cpu_pool cpu_pool, int64_t ncpu) -+{ -+ abstract_value param_values[] = -+ { -+ { .type = &abstract_type_string, -+ .u.string_val = cpu_pool }, -+ { .type = &abstract_type_int, -+ .u.int_val = ncpu } -+ }; -+ -+ xen_call_(session, "cpu_pool.set_ncpu", param_values, 2, NULL, NULL); -+ return session->ok; -+} -+ -+ -+bool -+xen_cpu_pool_set_other_config(xen_session *session, xen_cpu_pool cpu_pool, -+ xen_string_string_map *other_config) -+{ -+ abstract_value param_values[] = -+ { -+ { .type = &abstract_type_string, -+ .u.string_val = cpu_pool }, -+ { .type = &abstract_type_string_string_map, -+ .u.set_val = (arbitrary_set *)other_config } -+ }; -+ -+ xen_call_(session, "cpu_pool.set_other_config", param_values, 2, NULL, NULL); -+ return session->ok; -+} -+ -+ -+bool -+xen_cpu_pool_add_to_other_config(xen_session *session, xen_cpu_pool cpu_pool, -+ char *key, char *value) -+{ -+ abstract_value param_values[] = -+ { -+ { .type = &abstract_type_string, -+ .u.string_val = cpu_pool }, -+ { .type = &abstract_type_string, -+ .u.string_val = key }, -+ { .type = &abstract_type_string, -+ .u.string_val = value } -+ }; -+ -+ xen_call_(session, "cpu_pool.add_to_other_config", param_values, 3, NULL, NULL); -+ return session->ok; -+} -+ -+ -+bool -+xen_cpu_pool_remove_from_other_config(xen_session *session, xen_cpu_pool cpu_pool, -+ char *key) -+{ -+ abstract_value param_values[] = -+ { -+ { .type = &abstract_type_string, -+ .u.string_val = cpu_pool }, -+ { .type = &abstract_type_string, -+ .u.string_val = key } -+ }; -+ -+ xen_call_(session, "cpu_pool.remove_from_other_config", param_values, 2, NULL, NULL); -+ return session->ok; -+} -+ -+ -+bool -+xen_cpu_pool_set_sched_policy(xen_session *session, xen_cpu_pool cpu_pool, -+ char *sched_policy) -+{ -+ abstract_value param_values[] = -+ { -+ { .type = &abstract_type_string, -+ .u.string_val = cpu_pool }, -+ { .type = &abstract_type_string, -+ .u.string_val = sched_policy } -+ }; -+ -+ xen_call_(session, "cpu_pool.set_sched_policy", param_values, 2, NULL, NULL); -+ return session->ok; -+} -+ -Index: xen-4.0.2-testing/tools/libxen/src/xen_host.c -=================================================================== ---- xen-4.0.2-testing.orig/tools/libxen/src/xen_host.c -+++ xen-4.0.2-testing/tools/libxen/src/xen_host.c -@@ -30,6 +30,7 @@ - #include - #include - #include -+#include - - - XEN_FREE(xen_host) -@@ -108,7 +109,10 @@ static const struct_member xen_host_reco - .offset = offsetof(xen_host_record, host_cpus) }, - { .key = "metrics", - .type = &abstract_type_ref, -- .offset = offsetof(xen_host_record, metrics) } -+ .offset = offsetof(xen_host_record, metrics) }, -+ { .key = "resident_cpu_pools", -+ .type = &abstract_type_ref_set, -+ .offset = offsetof(xen_host_record, resident_cpu_pools) } - }; - - const abstract_type xen_host_record_abstract_type_ = -@@ -148,6 +152,7 @@ xen_host_record_free(xen_host_record *re - xen_pbd_record_opt_set_free(record->pbds); - xen_host_cpu_record_opt_set_free(record->host_cpus); - xen_host_metrics_record_opt_free(record->metrics); -+ xen_cpu_pool_record_opt_set_free(record->resident_cpu_pools); - free(record); - } - -@@ -889,3 +894,22 @@ xen_host_get_uuid(xen_session *session, - XEN_CALL_("host.get_uuid"); - return session->ok; - } -+ -+ -+bool -+xen_host_get_resident_cpu_pools(xen_session *session, struct xen_cpu_pool_set **result, -+ xen_host host) -+{ -+ abstract_value param_values[] = -+ { -+ { .type = &abstract_type_string, -+ .u.string_val = host } -+ }; -+ -+ abstract_type result_type = abstract_type_string_set; -+ -+ *result = NULL; -+ XEN_CALL_("host.get_resident_cpu_pools"); -+ return session->ok; -+} -+ -Index: xen-4.0.2-testing/tools/libxen/src/xen_host_cpu.c -=================================================================== ---- xen-4.0.2-testing.orig/tools/libxen/src/xen_host_cpu.c -+++ xen-4.0.2-testing/tools/libxen/src/xen_host_cpu.c -@@ -24,6 +24,7 @@ - #include - #include - #include -+#include - - - XEN_FREE(xen_host_cpu) -@@ -66,7 +67,10 @@ static const struct_member xen_host_cpu_ - .offset = offsetof(xen_host_cpu_record, features) }, - { .key = "utilisation", - .type = &abstract_type_float, -- .offset = offsetof(xen_host_cpu_record, utilisation) } -+ .offset = offsetof(xen_host_cpu_record, utilisation) }, -+ { .key = "cpu_pool", -+ .type = &abstract_type_ref_set, -+ .offset = offsetof(xen_host_cpu_record, cpu_pools) }, - }; - - const abstract_type xen_host_cpu_record_abstract_type_ = -@@ -94,6 +98,7 @@ xen_host_cpu_record_free(xen_host_cpu_re - free(record->stepping); - free(record->flags); - free(record->features); -+ xen_cpu_pool_record_opt_set_free(record->cpu_pools); - free(record); - } - -@@ -315,3 +320,34 @@ xen_host_cpu_get_uuid(xen_session *sessi - XEN_CALL_("host_cpu.get_uuid"); - return session->ok; - } -+ -+ -+bool -+xen_host_cpu_get_cpu_pool(xen_session *session, struct xen_cpu_pool_set **result, xen_host_cpu host_cpu) -+{ -+ abstract_value param_values[] = -+ { -+ { .type = &abstract_type_string, -+ .u.string_val = host_cpu } -+ }; -+ -+ abstract_type result_type = abstract_type_string_set; -+ -+ *result = NULL; -+ XEN_CALL_("host_cpu.get_cpu_pool"); -+ return session->ok; -+} -+ -+ -+bool -+xen_host_cpu_get_unassigned_cpus(xen_session *session, struct xen_host_cpu_set **result) -+{ -+ abstract_type result_type = abstract_type_string_set; -+ -+ *result = NULL; -+ xen_call_(session, "host_cpu.get_unassigned_cpus", NULL, 0, &result_type, result); -+ return session->ok; -+} -+ -+ -+ -Index: xen-4.0.2-testing/tools/libxen/src/xen_vm.c -=================================================================== ---- xen-4.0.2-testing.orig/tools/libxen/src/xen_vm.c -+++ xen-4.0.2-testing/tools/libxen/src/xen_vm.c -@@ -36,6 +36,7 @@ - #include - #include - #include -+#include - - - XEN_FREE(xen_vm) -@@ -165,7 +166,13 @@ static const struct_member xen_vm_record - .offset = offsetof(xen_vm_record, guest_metrics) }, - { .key = "security_label", - .type = &abstract_type_string, -- .offset = offsetof(xen_vm_record, security_label) } -+ .offset = offsetof(xen_vm_record, security_label) }, -+ { .key = "pool_name", -+ .type = &abstract_type_string, -+ .offset = offsetof(xen_vm_record, pool_name) }, -+ { .key = "cpu_pool", -+ .type = &abstract_type_ref_set, -+ .offset = offsetof(xen_vm_record, cpu_pool) }, - }; - - const abstract_type xen_vm_record_abstract_type_ = -@@ -209,6 +216,7 @@ xen_vm_record_free(xen_vm_record *record - xen_string_string_map_free(record->other_config); - xen_vm_metrics_record_opt_free(record->metrics); - xen_vm_guest_metrics_record_opt_free(record->guest_metrics); -+ xen_cpu_pool_record_opt_set_free(record->cpu_pool); - free(record->security_label); - free(record); - } -@@ -1781,3 +1789,71 @@ xen_vm_get_security_label(xen_session *s - XEN_CALL_("VM.get_security_label"); - return session->ok; - } -+ -+ -+bool -+xen_vm_get_cpu_pool(xen_session *session, struct xen_cpu_pool_set **result, xen_vm vm) -+{ -+ abstract_value param_values[] = -+ { -+ { .type = &abstract_type_string, -+ .u.string_val = vm }, -+ }; -+ -+ abstract_type result_type = abstract_type_string_set; -+ -+ *result = NULL; -+ XEN_CALL_("VM.get_cpu_pool"); -+ return session->ok; -+} -+ -+ -+bool -+xen_vm_get_pool_name(xen_session *session, char **result, xen_vm vm) -+{ -+ abstract_value param_values[] = -+ { -+ { .type = &abstract_type_string, -+ .u.string_val = vm }, -+ }; -+ -+ abstract_type result_type = abstract_type_string; -+ -+ *result = NULL; -+ XEN_CALL_("VM.get_pool_name"); -+ return session->ok; -+} -+ -+ -+bool -+xen_vm_set_pool_name(xen_session *session, xen_vm vm, char *pool_name) -+{ -+ abstract_value param_values[] = -+ { -+ { .type = &abstract_type_string, -+ .u.string_val = vm }, -+ { .type = &abstract_type_string, -+ .u.string_val = pool_name } -+ }; -+ -+ xen_call_(session, "VM.set_pool_name", param_values, 2, NULL, NULL); -+ return session->ok; -+} -+ -+ -+bool -+xen_vm_cpu_pool_migrate(xen_session *session, xen_vm vm, xen_cpu_pool cpu_pool) -+{ -+ abstract_value param_values[] = -+ { -+ { .type = &abstract_type_string, -+ .u.string_val = vm }, -+ { .type = &abstract_type_string, -+ .u.string_val = cpu_pool } -+ }; -+ -+ xen_call_(session, "VM.cpu_pool_migrate", param_values, 2, NULL, NULL); -+ return session->ok; -+} -+ -+ -Index: xen-4.0.2-testing/tools/libxen/test/test_bindings.c -=================================================================== ---- xen-4.0.2-testing.orig/tools/libxen/test/test_bindings.c -+++ xen-4.0.2-testing/tools/libxen/test/test_bindings.c -@@ -28,6 +28,7 @@ - #include - - //#define PRINT_XML -+//////////////#define POOL_TESTS - - static void usage() - { -@@ -125,6 +126,649 @@ static void print_error(xen_session *ses - } - - -+#ifdef POOL_TESTS -+#define NAME_DESCRIPTION "TestPool" -+#define NAME_DESCRIPTION_2 "TestPool-2" -+#define NAME_LABEL "Pool-1" -+#define NAME_LABEL_2 "Pool-2" -+#define SCHED_NAME "credit" -+#define NCPU_VAL 2 -+#define NCPU_VAL_2 1 -+ -+ -+static int pool_tests(xen_session *session, xen_host host) -+{ -+ int rc = 1; -+ xen_cpu_pool_set *pools = NULL; -+ xen_host_record *host_record = NULL; -+ xen_cpu_pool_record_opt *cpu_pool_opt = NULL; -+ xen_cpu_pool_record *cpu_pool_rec = NULL; -+ xen_host_cpu_set *host_cpu_set = NULL; -+ xen_host_cpu_record *host_cpu_record = NULL; -+ xen_vm_set *vm_set = NULL; -+ xen_cpu_pool pool = NULL; -+ xen_cpu_pool pool_out = NULL; -+ xen_string_string_map *pool_other_config = NULL; -+ xen_vm_record *vm_record = NULL; -+ xen_string_set *proposed_cpus = NULL; -+ xen_host res_host = NULL; -+ char *name_description = NULL; -+ char *name_label = NULL; -+ char *sched_policy = NULL; -+ char *pool_uuid = NULL; -+ int64_t ncpu; -+ -+ for (int loop= 0; loop < 1; loop++) -+ { -+ // Test extensions of class host -+ printf("Test cpu_pool extension of host class -----------------------------------------\n"); -+ -+ printf("host.get_resident_cpu_pools\n"); -+ if (!xen_host_get_resident_cpu_pools(session, &pools, host)) -+ { -+ break; -+ } -+ if (pools->size != 1) -+ { -+ printf("Wrong pool count; only one pool expected\n"); -+ break; -+ } -+ printf("Pool UUID %s\n", (char*)pools->contents[0]); -+ xen_cpu_pool_set_free(pools); -+ pools = NULL; -+ -+ printf("host.get_record\n"); -+ if (!xen_host_get_record(session, &host_record, host)) -+ { -+ break; -+ } -+ printf("Pool count %d\n", (int)host_record->resident_cpu_pools->size); -+ if (host_record->resident_cpu_pools->size != 1) -+ { -+ break; -+ } -+ cpu_pool_opt = host_record->resident_cpu_pools->contents[0]; -+ printf("Pool UUID %s\n", (char*)cpu_pool_opt->u.handle); -+ xen_host_record_free(host_record); -+ host_record = NULL; -+ cpu_pool_opt = NULL; -+ -+ -+ // Test extensions of class host_cpu -+ printf("host_cpu.get_all\n"); -+ if (!xen_host_cpu_get_all(session, &host_cpu_set)) -+ { -+ break; -+ } -+ -+ printf("host_cpu.get_cpu_pool & host_cpu.get_record\n"); -+ for (int i= 0; i < host_cpu_set->size; i++) -+ { -+ if (!xen_host_cpu_get_cpu_pool(session, &pools, host_cpu_set->contents[i])) -+ { -+ break; -+ } -+ if (pools->size > 1) -+ { -+ printf("Wrong pool count (xen_host_cpu_get_cpu_pool)\n"); -+ break; -+ } -+ -+ printf("host_cpu (get_cpu_pool) %s, cpu_pool %s\n", (char*)host_cpu_set->contents[i], -+ pools->size != 0 ? (char*)pools->contents[0] : "(None)"); -+ -+ if (!xen_host_cpu_get_record(session, &host_cpu_record, host_cpu_set->contents[i])) -+ { -+ break; -+ } -+ if (host_cpu_record->cpu_pools->size > 1) -+ { -+ printf("Wrong pool count (xen_host_cpu_get_record)\n"); -+ break; -+ } -+ -+ printf("host_cpu (get_record) %s, cpu_pool %s\n", (char*)host_cpu_set->contents[i], -+ host_cpu_record->cpu_pools->size != 0 -+ ? (char*)((xen_cpu_pool_record_opt*)(host_cpu_record->cpu_pools->contents[0])->u.handle) -+ : "(None)"); -+ -+ } -+ xen_host_cpu_record_free(host_cpu_record); -+ host_cpu_record = NULL; -+ xen_host_cpu_set_free(host_cpu_set); -+ host_cpu_set = NULL; -+ xen_cpu_pool_set_free(pools); -+ pools = NULL; -+ -+ printf("host_cpu.get_unassigned_cpus\n"); -+ if (!xen_host_cpu_get_unassigned_cpus(session, &host_cpu_set)) -+ { -+ break; -+ } -+ printf("Free cpus (not bound to a pool)\n"); -+ for (int i= 0; i < host_cpu_set->size; i++) -+ { -+ printf(" cpu UUID %s\n", (char*)host_cpu_set->contents[i]); -+ } -+ xen_host_cpu_set_free(host_cpu_set); -+ host_cpu_set = NULL; -+ -+ -+ printf("vm.get_record\n"); -+ if (!xen_vm_get_all(session, &vm_set)) -+ { -+ break; -+ } -+ -+ if (!xen_vm_get_record(session, &vm_record, vm_set->contents[0])) -+ { -+ break; -+ } -+ printf("VM %s, pool_name %s, cpu_pool %s\n", (char*)vm_set->contents[0], -+ vm_record->pool_name, (char*)vm_record->cpu_pool->contents[0]); -+ -+ xen_vm_record_free(vm_record); -+ vm_record = NULL; -+ -+ printf("vm.get_cpu_pool\n"); -+ if (!xen_vm_get_cpu_pool(session, &pools, vm_set->contents[0])) -+ { -+ break; -+ } -+ printf("vm_get_cpu_pool %s\n", (char*)pools->contents[0]); -+ -+ xen_vm_set_free(vm_set); -+ xen_cpu_pool_set_free(pools); -+ vm_set = NULL; -+ pools = NULL; -+ -+ -+ // Class cpu_pool -+ -+ // create -+ pool_other_config = xen_string_string_map_alloc(1); -+ pool_other_config->contents[0].key = strdup("type"); -+ pool_other_config->contents[0].val = strdup("bs2000"); -+ xen_string_set *proposed_CPUs_set = xen_string_set_alloc(1); -+ proposed_CPUs_set->contents[0] = strdup("3"); -+ -+ xen_cpu_pool_record new_cpu_pool_record = -+ { -+ .name_label = NAME_LABEL, -+ .name_description = NAME_DESCRIPTION, -+ .auto_power_on = false, -+ .ncpu = NCPU_VAL, -+ .sched_policy = SCHED_NAME, -+ .proposed_cpus = proposed_CPUs_set, -+ .other_config = pool_other_config, -+ }; -+ -+ printf("cpu_pool.create\n"); -+ if (!xen_cpu_pool_create(session, &pool, &new_cpu_pool_record)) -+ { -+ break; -+ } -+ printf("New Pool UUID %s\n", (char*)pool); -+ xen_string_set_free(proposed_CPUs_set); -+ proposed_CPUs_set = NULL; -+ xen_string_string_map_free(pool_other_config); -+ pool_other_config = NULL; -+ -+ // get_by_name_label -+ printf("cpu_pool.get_by_name_label\n"); -+ if (!xen_cpu_pool_get_by_name_label(session, &pools, "Pool-1")) -+ { -+ break; -+ } -+ if (strcmp((char*)pools->contents[0], (char*)pool) != 0) -+ { -+ break; -+ } -+ xen_cpu_pool_set_free(pools); -+ pools = NULL; -+ -+ -+ // get_by_uuid -+ printf("cpu_pool.get_by_uuid\n"); -+ if (!xen_cpu_pool_get_by_uuid(session, &pool_out, pool)) -+ { -+ break; -+ } -+ if (strcmp((char*)pool_out, (char*)pool) != 0) -+ { -+ printf("Wrong pool returned\n"); -+ break; -+ } -+ xen_cpu_pool_free(pool_out); -+ pool_out = NULL; -+ -+ // get_all -+ printf("cpu_pool.get_all\n"); -+ if (!xen_cpu_pool_get_all(session, &pools)) -+ { -+ break; -+ } -+ if (pools->size != 2) -+ { -+ printf("Wrong pool count (%d)\n", (int)pools->size); -+ break; -+ } -+ xen_cpu_pool_set_free(pools); -+ pools = NULL; -+ -+ -+ // get_activated -+ printf("cpu_pool.get_activated\n"); -+ bool activated_state = true; -+ if (!xen_cpu_pool_get_activated(session, &activated_state, pool)) -+ { -+ break; -+ } -+ if (activated_state) -+ { -+ printf("Pool must not be activated\n"); -+ break; -+ } -+ -+ -+ // get_auto_power_on -+ printf("cpu_pool.get_auto_power_on\n"); -+ bool power_state = true; -+ if (!xen_cpu_pool_get_auto_power_on(session, &power_state, pool)) -+ { -+ break; -+ } -+ if (power_state) -+ { -+ printf("Pool must not have attibute 'auto_power_on'\n"); -+ break; -+ } -+ -+ // get_host_CPUs -+ printf("cpu_pool.get_host_CPUs\n"); -+ if (!xen_cpu_pool_get_host_CPUs(session, &host_cpu_set, pool)) -+ { -+ break; -+ } -+ if (host_cpu_set->size != 0) -+ { -+ printf("Pool must not have any attached cpus\n"); -+ break; -+ } -+ xen_host_cpu_set_free(host_cpu_set); -+ host_cpu_set = NULL; -+ -+ -+ // get_name_description -+ printf("cpu_pool.get_name_description\n"); -+ if (!xen_cpu_pool_get_name_description(session, &name_description, pool)) -+ { -+ break; -+ } -+ if (strcmp(NAME_DESCRIPTION, name_description) != 0) -+ { -+ printf("Pool has wrong name_description\n"); -+ break; -+ } -+ free(name_description); -+ name_description = NULL; -+ -+ -+ // get_name_label -+ printf("cpu_pool.get_name_label\n"); -+ if (!xen_cpu_pool_get_name_label(session, &name_label, pool)) -+ { -+ break; -+ } -+ if (strcmp(NAME_LABEL, name_label) != 0) -+ { -+ printf("Pool has wrong name_label\n"); -+ break; -+ } -+ free(name_label); -+ name_label = NULL; -+ -+ // get_ncpu -+ printf("cpu_pool.get_ncpu\n"); -+ if (!xen_cpu_pool_get_ncpu(session, &ncpu, pool)) -+ { -+ break; -+ } -+ if (NCPU_VAL != ncpu) -+ { -+ printf("Pool has wrong ncpu\n"); -+ break; -+ } -+ -+ // get_proposed_CPUs -+ printf("cpu_pool.get_proposed_CPUs\n"); -+ if (!xen_cpu_pool_get_proposed_CPUs(session, &proposed_cpus, pool)) -+ { -+ break; -+ } -+ if (proposed_cpus->size != 1) -+ { -+ printf("Pool has wrong proposed_cpus count\n"); -+ break; -+ } -+ xen_string_set_free(proposed_cpus); -+ proposed_cpus = NULL; -+ -+ -+ // get_other_config -+ printf("cpu_pool.get_other_config\n"); -+ if (!xen_cpu_pool_get_other_config(session, &pool_other_config, pool)) -+ { -+ break; -+ } -+ if (pool_other_config->size != 1) -+ { -+ printf("Pool has wrong other_config element count\n"); -+ break; -+ } -+ if ((strcmp(pool_other_config->contents[0].key, "type") != 0) || -+ (strcmp(pool_other_config->contents[0].val, "bs2000") != 0)) -+ { -+ printf("Pool has wrong other_config attributes\n"); -+ break; -+ } -+ xen_string_string_map_free(pool_other_config); -+ pool_other_config = NULL; -+ -+ -+ // get_record -+ printf("cpu_pool.get_record\n"); -+ if (!xen_cpu_pool_get_record(session, &cpu_pool_rec, pool)) -+ { -+ break; -+ } -+ if ( (strcmp(cpu_pool_rec->name_label, NAME_LABEL) != 0) || -+ (strcmp(cpu_pool_rec->name_description, NAME_DESCRIPTION) != 0) || -+ (cpu_pool_rec->auto_power_on) || -+ (cpu_pool_rec->ncpu != NCPU_VAL) || -+ (cpu_pool_rec->started_vms->size != 0) || -+ (strcmp(cpu_pool_rec->sched_policy, SCHED_NAME) != 0) || -+ (cpu_pool_rec->proposed_cpus->size != 1) || -+ (cpu_pool_rec->host_cpus->size != 0) || -+ (cpu_pool_rec->activated) || -+ (strcmp(cpu_pool_rec->resident_on->u.handle, host) != 0) || -+ (strcmp(cpu_pool_rec->uuid, pool) != 0) || -+ (cpu_pool_rec->other_config->size != 1)) -+ { -+ printf("Wrong record output\n"); -+ break; -+ } -+ xen_cpu_pool_record_free(cpu_pool_rec); -+ cpu_pool_rec = NULL; -+ -+ -+ // get_resident_on -+ printf("cpu_pool.get_resident_on\n"); -+ if (!xen_cpu_pool_get_resident_on(session, &res_host, pool)) -+ { -+ break; -+ } -+ if (strcmp(res_host, host) != 0) -+ { -+ printf("Wrong resident host returned\n"); -+ break; -+ } -+ xen_host_free(res_host); -+ res_host = NULL; -+ -+ -+ // get_sched_policy -+ printf("cpu_pool.get_sched_policy\n"); -+ if (!xen_cpu_pool_get_sched_policy(session, &sched_policy, pool)) -+ { -+ break; -+ } -+ if (strcmp(sched_policy, SCHED_NAME) != 0) -+ { -+ printf("Wrong sched_policy returned\n"); -+ break; -+ } -+ free(sched_policy); -+ sched_policy = NULL; -+ -+ -+ // get_started_VMs -+ printf("cpu_pool.get_started_VMs\n"); -+ if (!xen_cpu_pool_get_started_VMs(session, &vm_set, pool)) -+ { -+ break; -+ } -+ if (vm_set->size != 0) -+ { -+ printf("Wrong count of started VMs\n"); -+ break; -+ } -+ xen_vm_set_free(vm_set); -+ vm_set = NULL; -+ -+ -+ // get_uuid -+ printf("cpu_pool.get_uuid\n"); -+ if (!xen_cpu_pool_get_uuid(session, &pool_uuid, pool)) -+ { -+ break; -+ } -+ if (strcmp(pool_uuid, pool) != 0) -+ { -+ printf("Wrong Pool UUID returnd\n"); -+ break; -+ } -+ free(pool_uuid); -+ pool_uuid = NULL; -+ -+ -+ // set_auto_power_on -+ printf("cpu_pool.set_auto_power_on\n"); -+ if (!xen_cpu_pool_set_auto_power_on(session, pool, true)) -+ break; -+ -+ -+ // set_proposed_CPUs -+ printf("cpu_pool.set_proposed_CPUs\n"); -+ proposed_CPUs_set = xen_string_set_alloc(2); -+ proposed_CPUs_set->contents[0] = strdup("2"); -+ proposed_CPUs_set->contents[1] = strdup("4"); -+ if (!xen_cpu_pool_set_proposed_CPUs(session, pool, proposed_CPUs_set)) -+ break; -+ xen_string_set_free(proposed_CPUs_set); -+ proposed_CPUs_set = NULL; -+ -+ -+ // add_to_proposed_CPUs -+ printf("cpu_pool.add_to_proposed_CPUs\n"); -+ if (!xen_cpu_pool_add_to_proposed_CPUs(session, pool, "3")) -+ break; -+ -+ -+ // remove_from_proposed_CPUs -+ printf("cpu_pool.remove_from_proposed_CPUs\n"); -+ if (!xen_cpu_pool_remove_from_proposed_CPUs(session, pool, "4")) -+ break; -+ -+ -+ // set_name_label -+ printf("cpu_pool.set_name_label\n"); -+ if (!xen_cpu_pool_set_name_label(session, pool, NAME_LABEL_2)) -+ break; -+ -+ -+ // set_name_description -+ printf("cpu_pool.set_name_description\n"); -+ if (!xen_cpu_pool_set_name_description(session, pool, NAME_DESCRIPTION_2)) -+ break; -+ -+ -+ // set_ncpu -+ printf("cpu_pool.set_ncpu\n"); -+ if (!xen_cpu_pool_set_ncpu(session, pool, NCPU_VAL_2)) -+ break; -+ -+ -+ // set_other_config -+ printf("cpu_pool.set_other_config\n"); -+ pool_other_config = xen_string_string_map_alloc(2); -+ pool_other_config->contents[0].key = strdup("test1"); -+ pool_other_config->contents[0].val = strdup("field1"); -+ pool_other_config->contents[1].key = strdup("test2"); -+ pool_other_config->contents[1].val = strdup("field2"); -+ if (!xen_cpu_pool_set_other_config(session, pool, pool_other_config)) -+ break; -+ xen_string_string_map_free(pool_other_config); -+ pool_other_config = NULL; -+ -+ -+ // add_to_other_config -+ printf("cpu_pool.add_to_other_config\n"); -+ if (!xen_cpu_pool_add_to_other_config(session, pool, "test3", "field3")) -+ break; -+ -+ -+ // remove_from_other_config -+ printf("cpu_pool.remove_from_other_config\n"); -+ if (!xen_cpu_pool_remove_from_other_config(session, pool, "test2")) -+ break; -+ -+ -+ // set_sched_policy -+ printf("cpu_pool.set_sched_policy\n"); -+ if (!xen_cpu_pool_set_sched_policy(session, pool, SCHED_NAME)) -+ break; -+ -+ -+ // check get_record again -+ printf("check cpu_pool record\n"); -+ if (!xen_cpu_pool_get_record(session, &cpu_pool_rec, pool)) -+ { -+ break; -+ } -+ if ( (strcmp(cpu_pool_rec->name_label, NAME_LABEL_2) != 0) || -+ (strcmp(cpu_pool_rec->name_description, NAME_DESCRIPTION_2) != 0) || -+ (!cpu_pool_rec->auto_power_on) || -+ (cpu_pool_rec->ncpu != NCPU_VAL_2) || -+ (cpu_pool_rec->started_vms->size != 0) || -+ (strcmp(cpu_pool_rec->sched_policy, SCHED_NAME) != 0) || -+ (cpu_pool_rec->proposed_cpus->size != 2) || -+ (cpu_pool_rec->host_cpus->size != 0) || -+ (cpu_pool_rec->activated) || -+ (strcmp(cpu_pool_rec->resident_on->u.handle, host) != 0) || -+ (strcmp(cpu_pool_rec->uuid, pool) != 0) || -+ (cpu_pool_rec->other_config->size != 2)) -+ { -+ printf("Wrong record output\n"); -+ break; -+ } -+ xen_cpu_pool_record_free(cpu_pool_rec); -+ cpu_pool_rec = NULL; -+ -+ -+ // activate pool -+ printf("cpu_pool.activate\n"); -+ if (!xen_cpu_pool_activate(session, pool)) -+ break; -+ -+ -+ // add_host_CPU_live -+ printf("cpu_pool.add_host_CPU_live\n"); -+ if (!xen_host_cpu_get_unassigned_cpus(session, &host_cpu_set)) -+ { -+ break; -+ } -+ if (host_cpu_set->size < 1) -+ { -+ printf("No free CPU found\n"); -+ break; -+ } -+ if (!xen_cpu_pool_add_host_CPU_live(session, pool, host_cpu_set->contents[0])) -+ break; -+ -+ -+ // remove_host_CPU_live -+ printf("cpu_pool.remove_host_CPU_live\n"); -+ if (!xen_cpu_pool_remove_host_CPU_live(session, pool, host_cpu_set->contents[0])) -+ break; -+ -+ xen_host_cpu_set_free(host_cpu_set); -+ host_cpu_set = NULL; -+ -+ -+ // check get_record again -+ printf("check cpu_pool record\n"); -+ if (!xen_cpu_pool_get_record(session, &cpu_pool_rec, pool)) -+ { -+ break; -+ } -+ if ( (strcmp(cpu_pool_rec->name_label, NAME_LABEL_2) != 0) || -+ (strcmp(cpu_pool_rec->name_description, NAME_DESCRIPTION_2) != 0) || -+ (!cpu_pool_rec->auto_power_on) || -+ (cpu_pool_rec->ncpu != NCPU_VAL_2) || -+ (cpu_pool_rec->started_vms->size != 0) || -+ (strcmp(cpu_pool_rec->sched_policy, SCHED_NAME) != 0) || -+ (cpu_pool_rec->proposed_cpus->size != 2) || -+ (cpu_pool_rec->host_cpus->size != 1) || -+ (!cpu_pool_rec->activated) || -+ (strcmp(cpu_pool_rec->resident_on->u.handle, host) != 0) || -+ (strcmp(cpu_pool_rec->uuid, pool) != 0) || -+ (cpu_pool_rec->other_config->size != 2)) -+ { -+ printf("Wrong record output\n"); -+ break; -+ } -+ xen_cpu_pool_record_free(cpu_pool_rec); -+ cpu_pool_rec = NULL; -+ -+ -+ // deactivate pool -+ printf("cpu_pool.deactivate\n"); -+ if (!xen_cpu_pool_deactivate(session, pool)) -+ break; -+ -+ -+ // Pool delete -+ if (!xen_cpu_pool_destroy(session, pool)) -+ { -+ break; -+ } -+ xen_cpu_pool_free(pool); -+ pool = NULL; -+ -+ // Tests OK -+ printf("Pool Tests OK\n"); -+ rc= 0; -+ } -+ -+ if (rc != 0) -+ { -+ print_error(session); -+ } -+ -+ xen_cpu_pool_set_free(pools); -+ xen_host_record_free(host_record); -+ xen_cpu_pool_record_opt_free(cpu_pool_opt); -+ xen_host_cpu_set_free(host_cpu_set); -+ xen_host_cpu_record_free(host_cpu_record); -+ xen_vm_set_free(vm_set); -+ xen_cpu_pool_free(pool); -+ xen_cpu_pool_free(pool_out); -+ xen_string_string_map_free(pool_other_config); -+ xen_vm_record_free(vm_record); -+ xen_string_set_free(proposed_cpus); -+ free(name_description); -+ free(name_label); -+ free(sched_policy); -+ free(pool_uuid); -+ xen_cpu_pool_record_free(cpu_pool_rec); -+ xen_host_free(res_host); -+ -+ return rc; -+} -+#endif -+ -+ - int main(int argc, char **argv) - { - if (argc != 4) -@@ -365,6 +1009,11 @@ int main(int argc, char **argv) - - xen_vm_record_free(vm_record); - -+#ifdef POOL_TESTS -+ if (pool_tests(session, host) != 0) -+ return 1; -+#endif -+ - xen_host_free(host); - xen_string_string_map_free(versions); - free(dmesg); diff --git a/cpu-pools-python.patch b/cpu-pools-python.patch deleted file mode 100644 index 404c259..0000000 --- a/cpu-pools-python.patch +++ /dev/null @@ -1,2531 +0,0 @@ -Index: xen-4.0.2-testing/tools/python/xen/lowlevel/xc/xc.c -=================================================================== ---- xen-4.0.2-testing.orig/tools/python/xen/lowlevel/xc/xc.c -+++ xen-4.0.2-testing/tools/python/xen/lowlevel/xc/xc.c -@@ -106,8 +106,8 @@ static PyObject *pyxc_domain_create(XcOb - - static char *kwd_list[] = { "domid", "ssidref", "handle", "flags", "target", NULL }; - -- if ( !PyArg_ParseTupleAndKeywords(args, kwds, "|iiOii", kwd_list, -- &dom, &ssidref, &pyhandle, &flags, &target)) -+ if ( !PyArg_ParseTupleAndKeywords(args, kwds, "|iiOii", kwd_list, &dom, -+ &ssidref, &pyhandle, &flags, &target)) - return NULL; - if ( pyhandle != NULL ) - { -@@ -329,7 +329,7 @@ static PyObject *pyxc_domain_getinfo(XcO - { - info_dict = Py_BuildValue( - "{s:i,s:i,s:i,s:i,s:i,s:i,s:i,s:i,s:i,s:i" -- ",s:L,s:L,s:L,s:i,s:i}", -+ ",s:L,s:L,s:L,s:i,s:i,s:i}", - "domid", (int)info[i].domid, - "online_vcpus", info[i].nr_online_vcpus, - "max_vcpu_id", info[i].max_vcpu_id, -@@ -344,7 +344,8 @@ static PyObject *pyxc_domain_getinfo(XcO - "cpu_time", (long long)info[i].cpu_time, - "maxmem_kb", (long long)info[i].max_memkb, - "ssidref", (int)info[i].ssidref, -- "shutdown_reason", info[i].shutdown_reason); -+ "shutdown_reason", info[i].shutdown_reason, -+ "cpupool", (int)info[i].cpupool); - pyhandle = PyList_New(sizeof(xen_domain_handle_t)); - if ( (pyhandle == NULL) || (info_dict == NULL) ) - { -@@ -1751,6 +1752,179 @@ static PyObject *pyxc_dom_set_memshr(XcO - return zero; - } - -+static PyObject *cpumap_to_cpulist(uint64_t cpumap) -+{ -+ PyObject *cpulist = NULL; -+ uint32_t i; -+ -+ cpulist = PyList_New(0); -+ for ( i = 0; cpumap != 0; i++ ) -+ { -+ if ( cpumap & 1 ) -+ { -+ PyObject* pyint = PyInt_FromLong(i); -+ -+ PyList_Append(cpulist, pyint); -+ Py_DECREF(pyint); -+ } -+ cpumap >>= 1; -+ } -+ return cpulist; -+} -+ -+static PyObject *pyxc_cpupool_create(XcObject *self, -+ PyObject *args, -+ PyObject *kwds) -+{ -+ uint32_t cpupool = 0, sched = XEN_SCHEDULER_CREDIT; -+ -+ static char *kwd_list[] = { "pool", "sched", NULL }; -+ -+ if ( !PyArg_ParseTupleAndKeywords(args, kwds, "|ii", kwd_list, &cpupool, -+ &sched)) -+ return NULL; -+ -+ if ( xc_cpupool_create(self->xc_handle, &cpupool, sched) < 0 ) -+ return pyxc_error_to_exception(); -+ -+ return PyInt_FromLong(cpupool); -+} -+ -+static PyObject *pyxc_cpupool_destroy(XcObject *self, -+ PyObject *args) -+{ -+ uint32_t cpupool; -+ -+ if (!PyArg_ParseTuple(args, "i", &cpupool)) -+ return NULL; -+ -+ if (xc_cpupool_destroy(self->xc_handle, cpupool) != 0) -+ return pyxc_error_to_exception(); -+ -+ Py_INCREF(zero); -+ return zero; -+} -+ -+static PyObject *pyxc_cpupool_getinfo(XcObject *self, -+ PyObject *args, -+ PyObject *kwds) -+{ -+ PyObject *list, *info_dict; -+ -+ uint32_t first_pool = 0; -+ int max_pools = 1024, nr_pools, i; -+ xc_cpupoolinfo_t *info; -+ -+ static char *kwd_list[] = { "first_pool", "max_pools", NULL }; -+ -+ if ( !PyArg_ParseTupleAndKeywords(args, kwds, "|ii", kwd_list, -+ &first_pool, &max_pools) ) -+ return NULL; -+ -+ info = calloc(max_pools, sizeof(xc_cpupoolinfo_t)); -+ if (info == NULL) -+ return PyErr_NoMemory(); -+ -+ nr_pools = xc_cpupool_getinfo(self->xc_handle, first_pool, max_pools, info); -+ -+ if (nr_pools < 0) -+ { -+ free(info); -+ return pyxc_error_to_exception(); -+ } -+ -+ list = PyList_New(nr_pools); -+ for ( i = 0 ; i < nr_pools; i++ ) -+ { -+ info_dict = Py_BuildValue( -+ "{s:i,s:i,s:i,s:N}", -+ "cpupool", (int)info[i].cpupool_id, -+ "sched", info[i].sched_id, -+ "n_dom", info[i].n_dom, -+ "cpulist", cpumap_to_cpulist(info[i].cpumap)); -+ if ( info_dict == NULL ) -+ { -+ Py_DECREF(list); -+ if ( info_dict != NULL ) { Py_DECREF(info_dict); } -+ free(info); -+ return NULL; -+ } -+ PyList_SetItem(list, i, info_dict); -+ } -+ -+ free(info); -+ -+ return list; -+} -+ -+static PyObject *pyxc_cpupool_addcpu(XcObject *self, -+ PyObject *args, -+ PyObject *kwds) -+{ -+ uint32_t cpupool; -+ int cpu = -1; -+ -+ static char *kwd_list[] = { "cpupool", "cpu", NULL }; -+ -+ if ( !PyArg_ParseTupleAndKeywords(args, kwds, "i|i", kwd_list, -+ &cpupool, &cpu) ) -+ return NULL; -+ -+ if (xc_cpupool_addcpu(self->xc_handle, cpupool, cpu) != 0) -+ return pyxc_error_to_exception(); -+ -+ Py_INCREF(zero); -+ return zero; -+} -+ -+static PyObject *pyxc_cpupool_removecpu(XcObject *self, -+ PyObject *args, -+ PyObject *kwds) -+{ -+ uint32_t cpupool; -+ int cpu = -1; -+ -+ static char *kwd_list[] = { "cpupool", "cpu", NULL }; -+ -+ if ( !PyArg_ParseTupleAndKeywords(args, kwds, "i|i", kwd_list, -+ &cpupool, &cpu) ) -+ return NULL; -+ -+ if (xc_cpupool_removecpu(self->xc_handle, cpupool, cpu) != 0) -+ return pyxc_error_to_exception(); -+ -+ Py_INCREF(zero); -+ return zero; -+} -+ -+static PyObject *pyxc_cpupool_movedomain(XcObject *self, -+ PyObject *args, -+ PyObject *kwds) -+{ -+ uint32_t cpupool, domid; -+ -+ static char *kwd_list[] = { "cpupool", "domid", NULL }; -+ -+ if ( !PyArg_ParseTupleAndKeywords(args, kwds, "ii", kwd_list, -+ &cpupool, &domid) ) -+ return NULL; -+ -+ if (xc_cpupool_movedomain(self->xc_handle, cpupool, domid) != 0) -+ return pyxc_error_to_exception(); -+ -+ Py_INCREF(zero); -+ return zero; -+} -+ -+static PyObject *pyxc_cpupool_freeinfo(XcObject *self) -+{ -+ uint64_t cpumap; -+ -+ if (xc_cpupool_freeinfo(self->xc_handle, &cpumap) != 0) -+ return pyxc_error_to_exception(); -+ -+ return cpumap_to_cpulist(cpumap); -+} - - static PyMethodDef pyxc_methods[] = { - { "handle", -@@ -1866,7 +2040,8 @@ static PyMethodDef pyxc_methods[] = { - " maxmem_kb [int]: Maximum memory limit, in kilobytes\n" - " cpu_time [long]: CPU time consumed, in nanoseconds\n" - " shutdown_reason [int]: Numeric code from guest OS, explaining " -- "reason why it shut itself down.\n" }, -+ "reason why it shut itself down.\n" -+ " cpupool [int] Id of cpupool domain is bound to.\n" }, - - { "vcpu_getinfo", - (PyCFunction)pyxc_vcpu_getinfo, -@@ -2264,6 +2439,66 @@ static PyMethodDef pyxc_methods[] = { - " enable [int,0|1]: Disable or enable?\n" - "Returns: [int] 0 on success; -1 on error.\n" }, - -+ { "cpupool_create", -+ (PyCFunction)pyxc_cpupool_create, -+ METH_VARARGS | METH_KEYWORDS, "\n" -+ "Create new cpupool.\n" -+ " pool [int, 0]: cpupool identifier to use (allocated if zero).\n" -+ " sched [int]: scheduler to use (credit if unspecified).\n\n" -+ "Returns: [int] new cpupool identifier; -1 on error.\n" }, -+ -+ { "cpupool_destroy", -+ (PyCFunction)pyxc_cpupool_destroy, -+ METH_VARARGS, "\n" -+ "Destroy a cpupool.\n" -+ " pool [int]: Identifier of cpupool to be destroyed.\n\n" -+ "Returns: [int] 0 on success; -1 on error.\n" }, -+ -+ { "cpupool_getinfo", -+ (PyCFunction)pyxc_cpupool_getinfo, -+ METH_VARARGS | METH_KEYWORDS, "\n" -+ "Get information regarding a set of cpupools, in increasing id order.\n" -+ " first_pool [int, 0]: First cpupool to retrieve info about.\n" -+ " max_pools [int, 1024]: Maximum number of cpupools to retrieve info" -+ " about.\n\n" -+ "Returns: [list of dicts] if list length is less than 'max_pools'\n" -+ " parameter then there was an error, or the end of the\n" -+ " cpupool-id space was reached.\n" -+ " pool [int]: Identifier of cpupool to which this info pertains\n" -+ " sched [int]: Scheduler used for this cpupool\n" -+ " n_dom [int]: Number of Domains in this cpupool\n" -+ " cpulist [list]: List of CPUs this cpupool is using\n" }, -+ -+ { "cpupool_addcpu", -+ (PyCFunction)pyxc_cpupool_addcpu, -+ METH_VARARGS | METH_KEYWORDS, "\n" -+ "Add a cpu to a cpupool.\n" -+ " pool [int]: Identifier of cpupool.\n" -+ " cpu [int, -1]: Cpu to add (lowest free if -1)\n\n" -+ "Returns: [int] 0 on success; -1 on error.\n" }, -+ -+ { "cpupool_removecpu", -+ (PyCFunction)pyxc_cpupool_removecpu, -+ METH_VARARGS | METH_KEYWORDS, "\n" -+ "Remove a cpu from a cpupool.\n" -+ " pool [int]: Identifier of cpupool.\n" -+ " cpu [int, -1]: Cpu to remove (highest used if -1)\n\n" -+ "Returns: [int] 0 on success; -1 on error.\n" }, -+ -+ { "cpupool_movedomain", -+ (PyCFunction)pyxc_cpupool_movedomain, -+ METH_VARARGS | METH_KEYWORDS, "\n" -+ "Move a domain to another cpupool.\n" -+ " pool [int]: Identifier of cpupool to move domain to.\n" -+ " dom [int]: Domain to move\n\n" -+ "Returns: [int] 0 on success; -1 on error.\n" }, -+ -+ { "cpupool_freeinfo", -+ (PyCFunction)pyxc_cpupool_freeinfo, -+ METH_NOARGS, "\n" -+ "Get info about cpus not in any cpupool.\n" -+ "Returns: [list]: List of CPUs\n" }, -+ - { NULL, NULL, 0, NULL } - }; - -Index: xen-4.0.2-testing/tools/python/xen/util/sxputils.py -=================================================================== ---- /dev/null -+++ xen-4.0.2-testing/tools/python/xen/util/sxputils.py -@@ -0,0 +1,64 @@ -+#============================================================================ -+# This library is free software; you can redistribute it and/or -+# modify it under the terms of version 2.1 of the GNU Lesser General Public -+# License as published by the Free Software Foundation. -+# -+# This library 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 -+# Lesser General Public License for more details. -+# -+# You should have received a copy of the GNU Lesser General Public -+# License along with this library; if not, write to the Free Software -+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -+#============================================================================ -+# Copyright (c) 2009 Fujitsu Technology Solutions -+#============================================================================ -+ -+""" convert sxp to map / map to sxp. -+""" -+ -+import types -+from xen.xend import sxp -+ -+def map2sxp(map_val): -+ """ conversion of all key-value pairs of a map (recursively) to sxp. -+ @param map_val: map; if a value contains a list or dict it is also -+ converted to sxp -+ @type map_val: dict -+ @return sxp expr -+ @rtype: list -+ """ -+ sxp_vals = [] -+ for (k, v) in map_val.items(): -+ if isinstance(v, types.DictionaryType): -+ sxp_vals += [[k] + map2sxp(v)] -+ elif isinstance(v, types.ListType): -+ sxp_vals += [[k] + v] -+ else: -+ sxp_vals += [[k, v]] -+ return sxp_vals -+ -+def sxp2map( s ): -+ """ conversion of sxp to map. -+ @param s: sxp expr -+ @type s: list -+ @return: map -+ @rtype: dict -+ """ -+ sxphash = {} -+ -+ for child in sxp.children( s ): -+ if isinstance( child, types.ListType ) and len( child ) > 1: -+ if isinstance( child[1], types.ListType ) and len( child[1] ) > 1: -+ sxphash[ child[0] ] = sxp2map( child ) -+ else: -+ childs = sxp.children(child) -+ if len(childs) > 1: -+ sxphash[ child[0] ] = childs -+ else: -+ sxphash[ child[0] ] = childs[0] -+ -+ return sxphash -+ -+ -Index: xen-4.0.2-testing/tools/python/xen/xend/XendAPI.py -=================================================================== ---- xen-4.0.2-testing.orig/tools/python/xen/xend/XendAPI.py -+++ xen-4.0.2-testing/tools/python/xen/xend/XendAPI.py -@@ -51,6 +51,7 @@ from XendDPCI import XendDPCI - from XendPSCSI import XendPSCSI, XendPSCSI_HBA - from XendDSCSI import XendDSCSI, XendDSCSI_HBA - from XendXSPolicy import XendXSPolicy, XendACMPolicy -+from xen.xend.XendCPUPool import XendCPUPool - - from XendAPIConstants import * - from xen.util.xmlrpclib2 import stringify -@@ -498,6 +499,7 @@ classes = { - 'PSCSI_HBA' : valid_object("PSCSI_HBA"), - 'DSCSI' : valid_object("DSCSI"), - 'DSCSI_HBA' : valid_object("DSCSI_HBA"), -+ 'cpu_pool' : valid_object("cpu_pool"), - } - - autoplug_classes = { -@@ -514,6 +516,7 @@ autoplug_classes = { - 'DSCSI_HBA' : XendDSCSI_HBA, - 'XSPolicy' : XendXSPolicy, - 'ACMPolicy' : XendACMPolicy, -+ 'cpu_pool' : XendCPUPool, - } - - class XendAPI(object): -@@ -914,7 +917,8 @@ class XendAPI(object): - 'API_version_minor', - 'API_version_vendor', - 'API_version_vendor_implementation', -- 'enabled'] -+ 'enabled', -+ 'resident_cpu_pools'] - - host_attr_rw = ['name_label', - 'name_description', -@@ -1014,6 +1018,8 @@ class XendAPI(object): - return xen_api_todo() - def host_get_logging(self, _, host_ref): - return xen_api_todo() -+ def host_get_resident_cpu_pools(self, _, host_ref): -+ return xen_api_success(XendCPUPool.get_all()) - - # object methods - def host_disable(self, session, host_ref): -@@ -1076,7 +1082,9 @@ class XendAPI(object): - 'PBDs': XendPBD.get_all(), - 'PPCIs': XendPPCI.get_all(), - 'PSCSIs': XendPSCSI.get_all(), -- 'PSCSI_HBAs': XendPSCSI_HBA.get_all()} -+ 'PSCSI_HBAs': XendPSCSI_HBA.get_all(), -+ 'resident_cpu_pools': XendCPUPool.get_all(), -+ } - return xen_api_success(record) - - def host_tmem_thaw(self, _, host_ref, cli_id): -@@ -1185,7 +1193,10 @@ class XendAPI(object): - 'stepping', - 'flags', - 'utilisation', -- 'features'] -+ 'features', -+ 'cpu_pool'] -+ -+ host_cpu_funcs = [('get_unassigned_cpus', 'Set(host_cpu)')] - - # attributes - def _host_cpu_get(self, ref, field): -@@ -1210,21 +1221,28 @@ class XendAPI(object): - return self._host_cpu_get(ref, 'flags') - def host_cpu_get_utilisation(self, _, ref): - return xen_api_success(XendNode.instance().get_host_cpu_load(ref)) -+ def host_cpu_get_cpu_pool(self, _, ref): -+ return xen_api_success(XendCPUPool.get_cpu_pool_by_cpu_ref(ref)) - - # object methods - def host_cpu_get_record(self, _, ref): - node = XendNode.instance() - record = dict([(f, node.get_host_cpu_field(ref, f)) - for f in self.host_cpu_attr_ro -- if f not in ['uuid', 'host', 'utilisation']]) -+ if f not in ['uuid', 'host', 'utilisation', 'cpu_pool']]) - record['uuid'] = ref - record['host'] = node.uuid - record['utilisation'] = node.get_host_cpu_load(ref) -+ record['cpu_pool'] = XendCPUPool.get_cpu_pool_by_cpu_ref(ref) - return xen_api_success(record) - - # class methods - def host_cpu_get_all(self, session): - return xen_api_success(XendNode.instance().get_host_cpu_refs()) -+ def host_cpu_get_unassigned_cpus(self, session): -+ return xen_api_success( -+ [ref for ref in XendNode.instance().get_host_cpu_refs() -+ if len(XendCPUPool.get_cpu_pool_by_cpu_ref(ref)) == 0]) - - - # Xen API: Class host_metrics -@@ -1284,6 +1302,7 @@ class XendAPI(object): - 'is_control_domain', - 'metrics', - 'crash_dumps', -+ 'cpu_pool', - ] - - VM_attr_rw = ['name_label', -@@ -1312,7 +1331,9 @@ class XendAPI(object): - 'platform', - 'PCI_bus', - 'other_config', -- 'security_label'] -+ 'security_label', -+ 'pool_name', -+ ] - - VM_methods = [('clone', 'VM'), - ('start', None), -@@ -1340,7 +1361,9 @@ class XendAPI(object): - ('set_memory_dynamic_min_live', None), - ('send_trigger', None), - ('migrate', None), -- ('destroy', None)] -+ ('destroy', None), -+ ('cpu_pool_migrate', None), -+ ] - - VM_funcs = [('create', 'VM'), - ('restore', None), -@@ -1540,6 +1563,17 @@ class XendAPI(object): - return xen_api_success( - xd.get_vm_by_uuid(vm_ref) == xd.privilegedDomain()) - -+ def VM_get_cpu_pool(self, session, vm_ref): -+ dom = XendDomain.instance().get_vm_by_uuid(vm_ref) -+ pool_ref = XendCPUPool.query_pool_ref(dom.get_cpu_pool()) -+ return xen_api_success(pool_ref) -+ -+ def VM_get_pool_name(self, session, vm_ref): -+ return self.VM_get('pool_name', session, vm_ref) -+ -+ def VM_set_pool_name(self, session, vm_ref, value): -+ return self.VM_set('pool_name', session, vm_ref, value) -+ - def VM_set_name_label(self, session, vm_ref, label): - dom = XendDomain.instance().get_vm_by_uuid(vm_ref) - dom.setName(label) -@@ -1618,7 +1652,8 @@ class XendAPI(object): - if key.startswith("cpumap"): - vcpu = int(key[6:]) - try: -- xendom.domain_pincpu(xeninfo.getDomid(), vcpu, value) -+ cpus = map(int, value.split(",")) -+ xendom.domain_pincpu(xeninfo.getDomid(), vcpu, cpus) - except Exception, ex: - log.exception(ex) - -@@ -1836,7 +1871,9 @@ class XendAPI(object): - 'is_control_domain': xeninfo.info['is_control_domain'], - 'metrics': xeninfo.get_metrics(), - 'security_label': xeninfo.get_security_label(), -- 'crash_dumps': [] -+ 'crash_dumps': [], -+ 'pool_name': xeninfo.info.get('pool_name'), -+ 'cpu_pool' : XendCPUPool.query_pool_ref(xeninfo.get_cpu_pool()), - } - return xen_api_success(record) - -@@ -1934,6 +1971,25 @@ class XendAPI(object): - xendom.domain_restore(src, bool(paused)) - return xen_api_success_void() - -+ def VM_cpu_pool_migrate(self, session, vm_ref, cpu_pool_ref): -+ xendom = XendDomain.instance() -+ xeninfo = xendom.get_vm_by_uuid(vm_ref) -+ domid = xeninfo.getDomid() -+ pool = XendAPIStore.get(cpu_pool_ref, XendCPUPool.getClass()) -+ if pool == None: -+ return xen_api_error(['HANDLE_INVALID', 'cpu_pool', cpu_pool_ref]) -+ if domid is not None: -+ if domid == 0: -+ return xen_api_error(['OPERATION_NOT_ALLOWED', -+ 'could not move Domain-0']) -+ try: -+ XendCPUPool.move_domain(cpu_pool_ref, domid) -+ except Exception, ex: -+ return xen_api_error(['INTERNAL_ERROR', -+ 'could not move domain']) -+ self.VM_set('pool_name', session, vm_ref, pool.get_name_label()) -+ return xen_api_success_void() -+ - - # Xen API: Class VBD - # ---------------------------------------------------------------- -Index: xen-4.0.2-testing/tools/python/xen/xend/XendCPUPool.py -=================================================================== ---- /dev/null -+++ xen-4.0.2-testing/tools/python/xen/xend/XendCPUPool.py -@@ -0,0 +1,903 @@ -+#============================================================================ -+# This library is free software; you can redistribute it and/or -+# modify it under the terms of version 2.1 of the GNU Lesser General Public -+# License as published by the Free Software Foundation. -+# -+# This library 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 -+# Lesser General Public License for more details. -+# -+# You should have received a copy of the GNU Lesser General Public -+# License along with this library; if not, write to the Free Software -+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -+#============================================================================ -+# Copyright (c) 2009 Fujitsu Technology Solutions. -+#============================================================================ -+ -+""" CPU Pool support including XEN-API and Legacy API. -+""" -+ -+import types -+import threading -+import re -+import xen.lowlevel.xc -+import XendNode -+import XendDomain -+from xen.xend.XendLogging import log -+from xen.xend.XendBase import XendBase -+from xen.xend import XendAPIStore -+from xen.xend.XendConstants import XS_POOLROOT -+from xen.xend import uuid as genuuid -+from xen.xend.XendError import VmError, XendAPIError, PoolError -+from xen.xend.xenstore.xstransact import xstransact -+from xen.util.sxputils import sxp2map, map2sxp -+ -+ -+XEND_ERROR_INTERNAL = 'INTERNAL_ERROR' -+XEND_ERROR_UNKOWN_SCHED_POLICY = 'UNKOWN_SCHED_POLICY' -+XEND_ERROR_BAD_POOL_STATE = 'POOL_BAD_STATE' -+XEND_ERROR_POOL_PARAM = 'PARAMETER_ERROR' -+XEND_ERROR_INSUFFICIENT_CPUS = 'INSUFFICIENT_CPUS' -+XEND_ERROR_POOL_RECONF = 'POOL_RECONF' -+XEND_ERROR_INVALID_CPU = 'INVAILD_CPU' -+XEND_ERROR_LAST_CPU_NOT_REM = 'LAST_CPU_NOT_REMOVEABLE' -+ -+ -+XEN_SCHEDULER_TO_ID = { -+ 'credit' : xen.lowlevel.xc.XEN_SCHEDULER_CREDIT, -+ 'sedf' : xen.lowlevel.xc.XEN_SCHEDULER_SEDF, -+ } -+ -+xc = xen.lowlevel.xc.xc() -+ -+class XendCPUPool(XendBase): -+ """ CPU Pool management. -+ @ivar pool_lock: Lock to secure modification of pool data -+ @type pool_lock: Rlock -+ """ -+ -+ pool_lock = threading.RLock() -+ -+ def getClass(cls): -+ return "cpu_pool" -+ -+ def getAttrRO(cls): -+ attrRO = ['resident_on', -+ 'started_VMs', -+ 'host_CPUs', -+ 'activated', -+ ] -+ return XendBase.getAttrRO() + attrRO -+ -+ def getAttrRW(cls): -+ attrRW = ['name_label', -+ 'name_description', -+ 'auto_power_on', -+ 'ncpu', -+ 'sched_policy', -+ 'proposed_CPUs', -+ 'other_config', -+ ] -+ return XendBase.getAttrRW() + attrRW -+ -+ def getMethods(cls): -+ methods = ['destroy', -+ 'activate', -+ 'deactivate', -+ 'add_host_CPU_live', -+ 'remove_host_CPU_live', -+ 'add_to_proposed_CPUs', -+ 'remove_from_proposed_CPUs', -+ 'add_to_other_config', -+ 'remove_from_other_config', -+ ] -+ return XendBase.getMethods() + methods -+ -+ def getFuncs(cls): -+ funcs = ['create', -+ 'get_by_name_label', -+ ] -+ return XendBase.getFuncs() + funcs -+ -+ getClass = classmethod(getClass) -+ getAttrRO = classmethod(getAttrRO) -+ getAttrRW = classmethod(getAttrRW) -+ getMethods = classmethod(getMethods) -+ getFuncs = classmethod(getFuncs) -+ -+ -+ # -+ # XenAPI function calls -+ # -+ -+ def create(cls, record): -+ """ Create a new managed pool instance. -+ @param record: attributes of pool -+ @type record: dict -+ @return: uuid of created pool -+ @rtype: str -+ """ -+ new_uuid = genuuid.createString() -+ XendCPUPool(record, new_uuid) -+ XendNode.instance().save_cpu_pools() -+ return new_uuid -+ -+ create = classmethod(create) -+ -+ -+ def get_by_name_label(cls, name_label): -+ """ Query a Pool(ref) by its name. -+ @return: ref of pool -+ @rtype: str -+ """ -+ cls.pool_lock.acquire() -+ try: -+ return [ inst.get_uuid() -+ for inst in XendAPIStore.get_all(cls.getClass()) -+ if inst.name_label == name_label -+ ] -+ finally: -+ cls.pool_lock.release() -+ -+ get_by_name_label = classmethod(get_by_name_label) -+ -+ -+ def get_cpu_pool_by_cpu_ref(cls, host_cpu): -+ """ Query cpu_pool ref the given cpu belongs to. -+ @param host_cpu: ref of host_cpu to lookup -+ @type host_cpu: str -+ @return: list cpu_pool refs (list contains not more than one element) -+ @rtype: list of str -+ """ -+ node = XendNode.instance() -+ cpu_nr = node.get_host_cpu_field(host_cpu, 'number') -+ for pool_rec in xc.cpupool_getinfo(): -+ if cpu_nr in pool_rec['cpulist']: -+ # pool found; return the ref -+ return cls.query_pool_ref(pool_rec['cpupool']) -+ return [] -+ -+ get_cpu_pool_by_cpu_ref = classmethod(get_cpu_pool_by_cpu_ref) -+ -+ -+ def get_all_managed(cls): -+ """ Query all managed pools. -+ @return: uuids of all managed pools -+ @rtype: list of str -+ """ -+ cls.pool_lock.acquire() -+ try: -+ managed_pools = [ inst.get_uuid() -+ for inst in XendAPIStore.get_all(cls.getClass()) -+ if inst.is_managed() ] -+ finally: -+ cls.pool_lock.release() -+ return managed_pools -+ -+ get_all_managed = classmethod(get_all_managed) -+ -+ -+ # -+ # XenAPI methods calls -+ # -+ -+ def __init__(self, record, new_uuid, managed_pool=True): -+ XendBase.__init__(self, new_uuid, record) -+ try: -+ self._managed = managed_pool -+ self.name_label = None -+ -+ name = record.get('name_label', 'Pool-Unnamed') -+ self._checkName(name) -+ self.name_label = name -+ self.name_description = record.get('name_description', -+ self.name_label) -+ self.proposed_cpus = [ int(cpu) -+ for cpu in record.get('proposed_CPUs', []) ] -+ self.auto_power_on = bool(record.get('auto_power_on', False)) -+ self.ncpu = int(record.get('ncpu', 1)) -+ self.sched_policy = record.get('sched_policy', '') -+ self.other_config = record.get('other_config', {}) -+ except Exception, ex: -+ XendBase.destroy(self) -+ raise ex -+ -+ -+ def get_resident_on(self): -+ """ Always return uuid of own node. -+ @return: uuid of this node -+ @rytpe: str -+ """ -+ return XendNode.instance().uuid -+ -+ def get_started_VMs(self): -+ """ Query all VMs currently assigned to pool. -+ @return: ref of all VMs assigned to pool; if pool is not active, -+ an empty list will be returned -+ @rtype: list of str -+ """ -+ if self.get_activated(): -+ # search VMs related to this pool -+ pool_id = self.query_pool_id() -+ started_VMs = [ vm.get_uuid() -+ for vm in XendDomain.instance().list('all') -+ if vm.get_cpu_pool() == pool_id ] -+ else: -+ # pool not active, so it couldn't have any started VMs -+ started_VMs = [] -+ -+ return started_VMs -+ -+ def get_host_CPUs(self): -+ """ Query all cpu refs of this pool currently asisgned . -+ - Read pool id of this pool from xenstore -+ - Read cpu configuration from hypervisor -+ - lookup cpu number -> cpu ref -+ @return: host_cpu refs -+ @rtype: list of str -+ """ -+ if self.get_activated(): -+ node = XendNode.instance() -+ pool_id = self.query_pool_id() -+ if pool_id == None: -+ raise PoolError(XEND_ERROR_INTERNAL, -+ [self.getClass(), 'get_host_CPUs']) -+ cpus = [] -+ for pool_rec in xc.cpupool_getinfo(): -+ if pool_rec['cpupool'] == pool_id: -+ cpus = pool_rec['cpulist'] -+ -+ # query host_cpu ref for any cpu of the pool -+ host_CPUs = [ cpu_ref -+ for cpu_ref in node.get_host_cpu_refs() -+ if node.get_host_cpu_field(cpu_ref, 'number') -+ in cpus ] -+ else: -+ # pool not active, so it couldn't have any assigned cpus -+ host_CPUs = [] -+ -+ return host_CPUs -+ -+ def get_activated(self): -+ """ Query if the pool is registered in XendStore. -+ If pool uuid is not in XenStore, the pool is not activated. -+ @return: True, if activated -+ @rtype: bool -+ """ -+ return self.query_pool_id() != None -+ -+ def get_name_label(self): -+ return self.name_label -+ -+ def get_name_description(self): -+ return self.name_description -+ -+ def get_auto_power_on(self): -+ return self.auto_power_on -+ -+ def get_ncpu(self): -+ return self.ncpu -+ -+ def get_sched_policy(self): -+ if len(self.sched_policy) == 0: -+ # default scheduler selected -+ return XendNode.instance().get_vcpus_policy() -+ else: -+ return self.sched_policy -+ -+ def get_proposed_CPUs(self): -+ return [ str(cpu) for cpu in self.proposed_cpus ] -+ -+ def get_other_config(self): -+ return self.other_config -+ -+ def set_name_label(self, name_label): -+ self._checkName(name_label) -+ self.name_label = name_label -+ if self._managed: -+ XendNode.instance().save_cpu_pools() -+ -+ def set_name_description(self, name_descr): -+ self.name_description = name_descr -+ if self._managed: -+ XendNode.instance().save_cpu_pools() -+ -+ def set_auto_power_on(self, auto_power_on): -+ self.auto_power_on = bool(int(auto_power_on)) -+ if self._managed: -+ XendNode.instance().save_cpu_pools() -+ -+ def set_ncpu(self, ncpu): -+ _ncpu = int(ncpu) -+ if _ncpu < 1: -+ raise PoolError(XEND_ERROR_POOL_PARAM, 'ncpu') -+ self.ncpu = _ncpu -+ if self._managed: -+ XendNode.instance().save_cpu_pools() -+ -+ def set_sched_policy(self, sched_policy): -+ if self.get_activated(): -+ raise PoolError(XEND_ERROR_BAD_POOL_STATE, 'activated') -+ self.sched_policy = sched_policy -+ if self._managed: -+ XendNode.instance().save_cpu_pools() -+ -+ def set_proposed_CPUs(self, proposed_cpus): -+ if self.get_activated(): -+ raise PoolError(XEND_ERROR_BAD_POOL_STATE, 'activated') -+ self.proposed_cpus = [ int(cpu) for cpu in proposed_cpus ] -+ if self._managed: -+ XendNode.instance().save_cpu_pools() -+ -+ def set_other_config(self, other_config): -+ self.other_config = other_config -+ if self._managed: -+ XendNode.instance().save_cpu_pools() -+ -+ def destroy(self): -+ """ In order to destroy a cpu pool, it must be deactivated """ -+ self.pool_lock.acquire() -+ try: -+ if self.get_activated(): -+ raise PoolError(XEND_ERROR_BAD_POOL_STATE, 'activated') -+ XendBase.destroy(self) -+ finally: -+ self.pool_lock.release() -+ XendNode.instance().save_cpu_pools() -+ -+ def activate(self): -+ """ Create pool in hypervisor and add cpus. -+ Preconditions: -+ - pool not already active -+ - enough unbound cpus available -+ Actions: -+ - create pool in hypervisor -+ - select free cpus (preferred from proposed_CPUs list) and bind it to -+ the pool -+ - create entries in Xenstore -+ """ -+ self.pool_lock.acquire() -+ try: -+ if self.get_activated(): -+ raise PoolError(XEND_ERROR_BAD_POOL_STATE, 'activated') -+ if self.sched_policy != XendNode.instance().get_vcpus_policy(): -+ raise PoolError(XEND_ERROR_UNKOWN_SCHED_POLICY) -+ unbound_cpus = set(self.unbound_cpus()) -+ if len(unbound_cpus) < self.ncpu: -+ raise PoolError(XEND_ERROR_INSUFFICIENT_CPUS, -+ [str(self.ncpu), str(len(unbound_cpus))]) -+ -+ # build list of cpu numbers to bind to pool -+ cpu_set = set(self.proposed_cpus).intersection(unbound_cpus) -+ if len(cpu_set) < self.ncpu: -+ pool_cpus = (list(cpu_set) + -+ list(unbound_cpus.difference(cpu_set))) -+ else: -+ pool_cpus = list(cpu_set) -+ pool_cpus = pool_cpus[0:self.ncpu] -+ -+ # create pool in hypervisor -+ pool_id = xc.cpupool_create( -+ sched = XEN_SCHEDULER_TO_ID.get(self.sched_policy, 0)) -+ -+ self.update_XS(pool_id) -+ # add cpus -+ for cpu in pool_cpus: -+ xc.cpupool_addcpu(pool_id, cpu) -+ -+ finally: -+ self.pool_lock.release() -+ -+ def deactivate(self): -+ """ Delete pool in hypervisor -+ Preconditions: -+ - pool is activated -+ - no running VMs in pool -+ Actions: -+ - call hypervisor for deletion -+ - remove path of pool in xenstore -+ """ -+ self.pool_lock.acquire() -+ try: -+ if not self.get_activated(): -+ raise PoolError(XEND_ERROR_BAD_POOL_STATE, 'deactivated') -+ if len(self.get_started_VMs()) != 0: -+ raise PoolError(XEND_ERROR_BAD_POOL_STATE, 'in use') -+ -+ pool_id = self.query_pool_id() -+ # remove cpus from pool -+ cpus = [] -+ for pool_rec in xc.cpupool_getinfo(): -+ if pool_rec['cpupool'] == pool_id: -+ cpus = pool_rec['cpulist'] -+ for cpu_number in cpus: -+ xc.cpupool_removecpu(pool_id, cpu_number) -+ xc.cpupool_destroy(pool_id) -+ -+ # update XenStore -+ xs_path = XS_POOLROOT + "%s/" % pool_id -+ xstransact.Remove(xs_path) -+ finally: -+ self.pool_lock.release() -+ -+ def add_host_CPU_live(self, cpu_ref): -+ """ Add cpu to pool, if it is currently not assigned to a pool. -+ @param cpu_ref: reference of host_cpu instance to add -+ @type cpu_ref: str -+ """ -+ if not self.get_activated(): -+ raise PoolError(XEND_ERROR_BAD_POOL_STATE, 'deactivated') -+ node = XendNode.instance() -+ number = node.get_host_cpu_field(cpu_ref, 'number') -+ -+ self.pool_lock.acquire() -+ try: -+ pool_id = self.query_pool_id() -+ other_pool_ref = self.get_cpu_pool_by_cpu_ref(cpu_ref) -+ if len(other_pool_ref) != 0: -+ raise PoolError(XEND_ERROR_INVALID_CPU, -+ 'cpu already assigned to pool "%s"' % other_pool_ref[0]) -+ xc.cpupool_addcpu(pool_id, number) -+ finally: -+ self.pool_lock.release() -+ -+ if number not in self.proposed_cpus: -+ self.proposed_cpus.append(number) -+ self._update_ncpu(pool_id) -+ if self._managed: -+ XendNode.instance().save_cpu_pools() -+ -+ def remove_host_CPU_live(self, cpu_ref): -+ """ Remove cpu from pool. -+ After successfull call, the cpu is free. -+ Remove of the last cpu of the pool is rejected. -+ @param cpu_ref: reference of host_cpu instance to remove -+ @type cpu_ref: str -+ """ -+ if not self.get_activated(): -+ raise PoolError(XEND_ERROR_BAD_POOL_STATE, 'deactivated') -+ node = XendNode.instance() -+ number = node.get_host_cpu_field(cpu_ref, 'number') -+ -+ self.pool_lock.acquire() -+ try: -+ pool_id = self.query_pool_id() -+ pool_rec = {} -+ for pool in xc.cpupool_getinfo(): -+ if pool['cpupool'] == pool_id: -+ pool_rec = pool -+ break -+ -+ if number in pool_rec['cpulist']: -+ if len(pool_rec['cpulist']) < 2 and pool_rec['n_dom'] > 0: -+ raise PoolError(XEND_ERROR_LAST_CPU_NOT_REM, -+ 'could not remove last cpu') -+ xc.cpupool_removecpu(pool_id, number) -+ else: -+ raise PoolError(XEND_ERROR_INVALID_CPU, -+ 'CPU not assigned to pool') -+ finally: -+ self.pool_lock.release() -+ -+ if number in self.proposed_cpus: -+ self.proposed_cpus.remove(number) -+ self._update_ncpu(pool_id) -+ if self._managed: -+ XendNode.instance().save_cpu_pools() -+ -+ def add_to_proposed_CPUs(self, cpu): -+ if self.get_activated(): -+ raise PoolError(XEND_ERROR_BAD_POOL_STATE, 'activated') -+ -+ _cpu = int(cpu) -+ if _cpu not in self.proposed_cpus: -+ self.proposed_cpus.append(_cpu) -+ self.proposed_cpus.sort() -+ if self._managed: -+ XendNode.instance().save_cpu_pools() -+ -+ def remove_from_proposed_CPUs(self, cpu): -+ if self.get_activated(): -+ raise PoolError(XEND_ERROR_BAD_POOL_STATE, 'activated') -+ _cpu = int(cpu) -+ if _cpu in self.proposed_cpus: -+ self.proposed_cpus.remove(_cpu) -+ if self._managed: -+ XendNode.instance().save_cpu_pools() -+ -+ def add_to_other_config(self, key, value): -+ self.other_config[key] = value -+ if self._managed: -+ XendNode.instance().save_cpu_pools() -+ -+ def remove_from_other_config(self, key): -+ if key in self.other_config: -+ del self.other_config[key] -+ if self._managed: -+ XendNode.instance().save_cpu_pools() -+ -+ -+ # -+ # Legacy RPC calls -+ # -+ def pool_new(cls, config): -+ try: -+ record = sxp2map(config) -+ if record.has_key('proposed_CPUs') and \ -+ not isinstance(record['proposed_CPUs'], types.ListType): -+ record['proposed_CPUs'] = [record['proposed_CPUs']] -+ new_uuid = cls.create(record) -+ except XendAPIError, ex: -+ raise VmError(ex.get_api_error()) -+ return new_uuid -+ -+ def pool_create(cls, config): -+ try: -+ record = sxp2map(config) -+ if record.has_key('proposed_CPUs') and \ -+ not isinstance(record['proposed_CPUs'], types.ListType): -+ record['proposed_CPUs'] = [record['proposed_CPUs']] -+ new_uuid = genuuid.createString() -+ pool = XendCPUPool(record, new_uuid, False) -+ pool.activate() -+ except XendAPIError, ex: -+ raise VmError(ex.get_api_error()) -+ -+ def pool_start(cls, poolname): -+ pool = cls.lookup_pool(poolname) -+ if not pool: -+ raise VmError('unknown pool %s' % poolname) -+ try: -+ pool.activate() -+ except XendAPIError, ex: -+ raise VmError(ex.get_api_error()) -+ -+ def pool_list(cls, names): -+ sxprs = [] -+ try: -+ node = XendNode.instance() -+ xd = XendDomain.instance() -+ pools = cls.get_all_records() -+ for (pool_uuid, pool_vals) in pools.items(): -+ if pool_vals['name_label'] in names or len(names) == 0: -+ # conv host_cpu refs to cpu number -+ cpus = [ node.get_host_cpu_field(cpu_ref, 'number') -+ for cpu_ref in pool_vals['host_CPUs'] ] -+ cpus.sort() -+ pool_vals['host_CPU_numbers'] = cpus -+ # query VMs names. Take in account, that a VM -+ # returned by get_all_records could be destroy, now -+ vm_names = [ vm.getName() -+ for vm in map(xd.get_vm_by_uuid, -+ pool_vals['started_VMs']) -+ if vm ] -+ pool_vals['started_VM_names'] = vm_names -+ pool_vals['auto_power_on'] = int(pool_vals['auto_power_on']) -+ sxprs += [[pool_uuid] + map2sxp(pool_vals)] -+ except XendAPIError, ex: -+ raise VmError(ex.get_api_error()) -+ return sxprs -+ -+ def pool_destroy(cls, poolname): -+ pool = cls.lookup_pool(poolname) -+ if not pool: -+ raise VmError('unknown pool %s' % poolname) -+ try: -+ pool.deactivate() -+ if not pool.is_managed(): -+ pool.destroy() -+ except XendAPIError, ex: -+ raise VmError(ex.get_api_error()) -+ -+ def pool_delete(cls, poolname): -+ pool = cls.lookup_pool(poolname) -+ if not pool: -+ raise VmError('unknown pool %s' % poolname) -+ try: -+ pool.destroy() -+ except XendAPIError, ex: -+ raise VmError(ex.get_api_error()) -+ -+ def pool_cpu_add(cls, poolname, cpu): -+ pool = cls.lookup_pool(poolname) -+ if not pool: -+ raise VmError('unknown pool %s' % poolname) -+ try: -+ cpu_ref = cls._cpu_number_to_ref(int(cpu)) -+ if cpu_ref: -+ pool.add_host_CPU_live(cpu_ref) -+ else: -+ raise PoolError(XEND_ERROR_INVALID_CPU, -+ 'CPU unknown') -+ except XendAPIError, ex: -+ raise VmError(ex.get_api_error()) -+ -+ def pool_cpu_remove(cls, poolname, cpu): -+ pool = cls.lookup_pool(poolname) -+ if not pool: -+ raise VmError('unknown pool %s' % poolname) -+ try: -+ cpu_ref = cls._cpu_number_to_ref(int(cpu)) -+ if cpu_ref: -+ pool.remove_host_CPU_live(cpu_ref) -+ else: -+ raise PoolError(XEND_ERROR_INVALID_CPU, -+ 'CPU unknown') -+ except XendAPIError, ex: -+ raise VmError(ex.get_api_error()) -+ -+ def pool_migrate(cls, domname, poolname): -+ dom = XendDomain.instance() -+ pool = cls.lookup_pool(poolname) -+ if not pool: -+ raise VmError('unknown pool %s' % poolname) -+ dominfo = dom.domain_lookup_nr(domname) -+ if not dominfo: -+ raise VmError('unknown domain %s' % domname) -+ domid = dominfo.getDomid() -+ if domid is not None: -+ if domid == 0: -+ raise VmError('could not move Domain-0') -+ try: -+ cls.move_domain(pool.get_uuid(), domid) -+ except Exception, ex: -+ raise VmError('could not move domain') -+ dominfo.info['pool_name'] = poolname -+ dom.managed_config_save(dominfo) -+ -+ pool_new = classmethod(pool_new) -+ pool_create = classmethod(pool_create) -+ pool_start = classmethod(pool_start) -+ pool_list = classmethod(pool_list) -+ pool_destroy = classmethod(pool_destroy) -+ pool_delete = classmethod(pool_delete) -+ pool_cpu_add = classmethod(pool_cpu_add) -+ pool_cpu_remove = classmethod(pool_cpu_remove) -+ pool_migrate = classmethod(pool_migrate) -+ -+ -+ # -+ # methods -+ # -+ -+ def is_managed(self): -+ """ Check, if pool is managed. -+ @return: True, if managed -+ @rtype: bool -+ """ -+ return self._managed -+ -+ def query_pool_id(self): -+ """ Get corresponding pool-id of pool instance from XenStore. -+ @return: pool id or None -+ @rytpe: int -+ """ -+ self.pool_lock.acquire() -+ try: -+ for pool_id in xstransact.List(XS_POOLROOT): -+ uuid = xstransact.Read(XS_POOLROOT + "%s/" % pool_id, 'uuid') -+ if uuid == self.get_uuid(): -+ return int(pool_id) -+ finally: -+ self.pool_lock.release() -+ -+ return None -+ -+ def update_XS(self, pool_id): -+ """ Write (or update) data in xenstore taken from instance. -+ @param pool_id: Pool id to build path to pool data in xenstore -+ @type pool_id: int -+ """ -+ self.pool_lock.acquire() -+ try: -+ xs_path = XS_POOLROOT + "%s/" % pool_id -+ xs_entries = { 'uuid' : self.get_uuid(), -+ 'name' : self.name_label, -+ 'description' : self.name_description -+ } -+ xstransact.Mkdir(xs_path) -+ xstransact.Mkdir(xs_path, 'other_config') -+ xstransact.Write(xs_path, xs_entries) -+ xstransact.Write('%s%s' % (xs_path, 'other_config'), -+ self.other_config) -+ finally: -+ self.pool_lock.release() -+ -+ def _update_ncpu(self, pool_id): -+ for pool_rec in xc.cpupool_getinfo(): -+ if pool_rec['cpupool'] == pool_id: -+ self.ncpu = len(pool_rec['cpulist']) -+ -+ def _checkName(self, name): -+ """ Check if a pool name is valid. Valid names contain alphabetic -+ characters, digits, or characters in '_-.:/+'. -+ The same name cannot be used for more than one pool at the same -+ time. -+ @param name: name -+ @type name: str -+ @raise: PoolError if invalid -+ """ -+ if name is None or name == '': -+ raise PoolError(XEND_ERROR_POOL_PARAM, 'Missing Pool Name') -+ if not re.search(r'^[A-Za-z0-9_\-\.\:\/\+]+$', name): -+ raise PoolError(XEND_ERROR_POOL_PARAM, 'Invalid Pool Name') -+ -+ pool = self.lookup_pool(name) -+ if pool and pool.get_uuid() != self.get_uuid(): -+ raise PoolError(XEND_ERROR_POOL_PARAM, -+ 'Pool name "%s" already exists' % name) -+ -+ -+ # -+ # class methods -+ # -+ -+ def recreate_active_pools(cls): -+ """ Read active pool config from hypervisor and create pool instances. -+ - Query pool ids and assigned CPUs from hypervisor. -+ - Query additional information for any pool from xenstore. -+ If an entry for a pool id is missing in xenstore, it will be -+ recreated with a new uuid and generic name (this is an error case) -+ - Create an XendCPUPool instance for any pool id -+ Function have to be called after recreation of managed pools. -+ """ -+ log.debug('recreate_active_pools') -+ -+ for pool_rec in xc.cpupool_getinfo(): -+ pool = pool_rec['cpupool'] -+ -+ # read pool data from xenstore -+ path = XS_POOLROOT + "%s/" % pool -+ uuid = xstransact.Read(path, 'uuid') -+ if not uuid: -+ # xenstore entry missing / invaild; create entry with new uuid -+ uuid = genuuid.createString() -+ name = "Pool-%s" % pool -+ try: -+ inst = XendCPUPool( { 'name_label' : name }, uuid, False ) -+ inst.update_XS(pool) -+ except PoolError, ex: -+ # log error and skip domain -+ log.error('cannot recreate pool %s; skipping (reason: %s)' \ -+ % (name, ex)) -+ else: -+ (name, descr) = xstransact.Read(path, 'name', 'description') -+ other_config = {} -+ for key in xstransact.List(path + 'other_config'): -+ other_config[key] = xstransact.Read( -+ path + 'other_config/%s' % key) -+ -+ # check existance of pool instance -+ inst = XendAPIStore.get(uuid, cls.getClass()) -+ if inst: -+ # update attributes of existing instance -+ inst.name_label = name -+ inst.name_description = descr -+ inst.other_config = other_config -+ else: -+ # recreate instance -+ try: -+ inst = XendCPUPool( -+ { 'name_label' : name, -+ 'name_description' : descr, -+ 'other_config' : other_config, -+ 'proposed_CPUs' : pool_rec['cpulist'], -+ 'ncpu' : len(pool_rec['cpulist']), -+ }, -+ uuid, False ) -+ except PoolError, ex: -+ # log error and skip domain -+ log.error( -+ 'cannot recreate pool %s; skipping (reason: %s)' \ -+ % (name, ex)) -+ -+ recreate_active_pools = classmethod(recreate_active_pools) -+ -+ -+ def recreate(cls, record, current_uuid): -+ """ Recreate a pool instance while xend restart. -+ @param record: attributes of pool -+ @type record: dict -+ @param current_uuid: uuid of pool to create -+ @type current_uuid: str -+ """ -+ XendCPUPool(record, current_uuid) -+ -+ recreate = classmethod(recreate) -+ -+ -+ def autostart_pools(cls): -+ """ Start managed pools that are marked as autostart pools. -+ Function is called after recreation of managed domains while -+ xend restart. -+ """ -+ cls.pool_lock.acquire() -+ try: -+ for inst in XendAPIStore.get_all(cls.getClass()): -+ if inst.is_managed() and inst.auto_power_on and \ -+ inst.query_pool_id() == None: -+ inst.activate() -+ finally: -+ cls.pool_lock.release() -+ -+ autostart_pools = classmethod(autostart_pools) -+ -+ -+ def move_domain(cls, pool_ref, domid): -+ cls.pool_lock.acquire() -+ try: -+ pool = XendAPIStore.get(pool_ref, cls.getClass()) -+ pool_id = pool.query_pool_id() -+ -+ xc.cpupool_movedomain(pool_id, domid) -+ finally: -+ cls.pool_lock.release() -+ -+ move_domain = classmethod(move_domain) -+ -+ -+ def query_pool_ref(cls, pool_id): -+ """ Get pool ref by pool id. -+ Take the ref from xenstore. -+ @param pool_id: -+ @type pool_id: int -+ @return: ref -+ @rtype: str -+ """ -+ uuid = xstransact.Read(XS_POOLROOT + "%s/" % pool_id, 'uuid') -+ if uuid: -+ return [uuid] -+ else: -+ return [] -+ -+ query_pool_ref = classmethod(query_pool_ref) -+ -+ -+ def lookup_pool(cls, id_or_name): -+ """ Search XendCPUPool instance with given id_or_name. -+ @param id_or_name: pool id or pool nameto search -+ @type id_or_name: [int, str] -+ @return: instane or None if not found -+ @rtype: XendCPUPool -+ """ -+ pool_uuid = None -+ try: -+ pool_id = int(id_or_name) -+ # pool id given ? -+ pool_uuid = cls.query_pool_ref(pool_id) -+ if not pool_uuid: -+ # not found -> search name -+ pool_uuid = cls.get_by_name_label(id_or_name) -+ except ValueError: -+ # pool name given -+ pool_uuid = cls.get_by_name_label(id_or_name) -+ -+ if len(pool_uuid) > 0: -+ return XendAPIStore.get(pool_uuid[0], cls.getClass()) -+ else: -+ return None -+ -+ lookup_pool = classmethod(lookup_pool) -+ -+ -+ def _cpu_number_to_ref(cls, number): -+ node = XendNode.instance() -+ for cpu_ref in node.get_host_cpu_refs(): -+ if node.get_host_cpu_field(cpu_ref, 'number') == number: -+ return cpu_ref -+ return None -+ -+ _cpu_number_to_ref = classmethod(_cpu_number_to_ref) -+ -+ -+ def unbound_cpus(cls): -+ """ Build list containing the numbers of all cpus not bound to a pool. -+ Info is taken from Hypervisor. -+ @return: list of cpu numbers -+ @rytpe: list of int -+ """ -+ return xc.cpupool_freeinfo() -+ -+ unbound_cpus = classmethod(unbound_cpus) -+ -Index: xen-4.0.2-testing/tools/python/xen/xend/XendConfig.py -=================================================================== ---- xen-4.0.2-testing.orig/tools/python/xen/xend/XendConfig.py -+++ xen-4.0.2-testing/tools/python/xen/xend/XendConfig.py -@@ -134,6 +134,7 @@ XENAPI_CFG_TO_LEGACY_CFG = { - 'PV_bootloader': 'bootloader', - 'PV_bootloader_args': 'bootloader_args', - 'Description': 'description', -+ 'pool_name' : 'pool_name', - } - - LEGACY_CFG_TO_XENAPI_CFG = reverse_dict(XENAPI_CFG_TO_LEGACY_CFG) -@@ -240,6 +241,7 @@ XENAPI_CFG_TYPES = { - 'superpages' : int, - 'memory_sharing': int, - 'Description': str, -+ 'pool_name' : str, - } - - # List of legacy configuration keys that have no equivalent in the -@@ -285,6 +287,7 @@ LEGACY_CFG_TYPES = { - 'bootloader': str, - 'bootloader_args': str, - 'description': str, -+ 'pool_name': str, - } - - # Values that should be stored in xenstore's /vm/ that is used -@@ -306,6 +309,7 @@ LEGACY_XENSTORE_VM_PARAMS = [ - 'on_xend_stop', - 'bootloader', - 'bootloader_args', -+ 'pool_name', - ] - - ## -@@ -414,6 +418,7 @@ class XendConfig(dict): - 'other_config': {}, - 'platform': {}, - 'target': 0, -+ 'pool_name' : 'Pool-0', - 'superpages': 0, - 'description': '', - } -Index: xen-4.0.2-testing/tools/python/xen/xend/XendConstants.py -=================================================================== ---- xen-4.0.2-testing.orig/tools/python/xen/xend/XendConstants.py -+++ xen-4.0.2-testing/tools/python/xen/xend/XendConstants.py -@@ -133,6 +133,8 @@ VTPM_DELETE_SCRIPT = auxbin.scripts_dir( - - XS_VMROOT = "/vm/" - -+XS_POOLROOT = "/local/pool/" -+ - NR_PCI_FUNC = 8 - NR_PCI_DEV = 32 - NR_PCI_DEVFN = NR_PCI_FUNC * NR_PCI_DEV -Index: xen-4.0.2-testing/tools/python/xen/xend/XendDomainInfo.py -=================================================================== ---- xen-4.0.2-testing.orig/tools/python/xen/xend/XendDomainInfo.py -+++ xen-4.0.2-testing/tools/python/xen/xend/XendDomainInfo.py -@@ -60,6 +60,7 @@ from xen.xend.xenstore.xsutil import Get - from xen.xend.xenstore.xswatch import xswatch - from xen.xend.XendConstants import * - from xen.xend.XendAPIConstants import * -+from xen.xend.XendCPUPool import XendCPUPool - from xen.xend.server.DevConstants import xenbusState - from xen.xend.server.BlktapController import TAPDISK_DEVICE, parseDeviceString - -@@ -2569,6 +2570,19 @@ class XendDomainInfo: - oos = self.info['platform'].get('oos', 1) - oos_off = 1 - int(oos) - -+ # look-up pool id to use -+ pool_name = self.info['pool_name'] -+ if len(pool_name) == 0: -+ pool_name = "Pool-0" -+ -+ pool = XendCPUPool.lookup_pool(pool_name) -+ -+ if pool is None: -+ raise VmError("unknown pool %s" % pool_name) -+ pool_id = pool.query_pool_id() -+ if pool_id is None: -+ raise VmError("pool %s not activated" % pool_name) -+ - flags = (int(hvm) << 0) | (int(hap) << 1) | (int(s3_integrity) << 2) | (int(oos_off) << 3) - - try: -@@ -2590,6 +2604,11 @@ class XendDomainInfo: - failmsg += ', error=%i' % int(self.domid) - raise VmError(failmsg) - -+ try: -+ xc.cpupool_movedomain(pool_id, self.domid) -+ except Exception, e: -+ raise VmError('Moving domain to target pool failed') -+ - self.dompath = GetDomainPath(self.domid) - - self._recreateDom() -@@ -3618,6 +3637,11 @@ class XendDomainInfo: - - retval = xc.sched_credit_domain_get(self.getDomid()) - return retval -+ def get_cpu_pool(self): -+ if self.getDomid() is None: -+ return None -+ xeninfo = dom_get(self.domid) -+ return xeninfo['cpupool'] - def get_power_state(self): - return XEN_API_VM_POWER_STATE[self._stateGet()] - def get_platform(self): -Index: xen-4.0.2-testing/tools/python/xen/xend/XendError.py -=================================================================== ---- xen-4.0.2-testing.orig/tools/python/xen/xend/XendError.py -+++ xen-4.0.2-testing/tools/python/xen/xend/XendError.py -@@ -18,6 +18,7 @@ - - from xmlrpclib import Fault - -+import types - import XendClient - - class XendInvalidDomain(Fault): -@@ -186,6 +187,26 @@ class DirectPCIError(XendAPIError): - def __str__(self): - return 'DIRECT_PCI_ERROR: %s' % self.error - -+class PoolError(XendAPIError): -+ def __init__(self, error, spec=None): -+ XendAPIError.__init__(self) -+ self.spec = [] -+ if spec: -+ if isinstance(spec, types.ListType): -+ self.spec = spec -+ else: -+ self.spec = [spec] -+ self.error = error -+ -+ def get_api_error(self): -+ return [self.error] + self.spec -+ -+ def __str__(self): -+ if self.spec: -+ return '%s: %s' % (self.error, self.spec) -+ else: -+ return '%s' % self.error -+ - class VDIError(XendAPIError): - def __init__(self, error, vdi): - XendAPIError.__init__(self) -Index: xen-4.0.2-testing/tools/python/xen/xend/XendNode.py -=================================================================== ---- xen-4.0.2-testing.orig/tools/python/xen/xend/XendNode.py -+++ xen-4.0.2-testing/tools/python/xen/xend/XendNode.py -@@ -43,6 +43,7 @@ from XendStateStore import XendStateStor - from XendMonitor import XendMonitor - from XendPPCI import XendPPCI - from XendPSCSI import XendPSCSI, XendPSCSI_HBA -+from xen.xend.XendCPUPool import XendCPUPool - - class XendNode: - """XendNode - Represents a Domain 0 Host.""" -@@ -159,6 +160,8 @@ class XendNode: - - self._init_PSCSIs() - -+ self._init_cpu_pools() -+ - - def _init_networks(self): - # Initialise networks -@@ -366,6 +369,18 @@ class XendNode: - for physical_host, pscsi_HBA_uuid in pscsi_HBA_table.items(): - XendPSCSI_HBA(pscsi_HBA_uuid, {'physical_host': physical_host}) - -+ def _init_cpu_pools(self): -+ # Initialise cpu_pools -+ saved_cpu_pools = self.state_store.load_state(XendCPUPool.getClass()) -+ if saved_cpu_pools: -+ for cpu_pool_uuid, cpu_pool in saved_cpu_pools.items(): -+ try: -+ XendCPUPool.recreate(cpu_pool, cpu_pool_uuid) -+ except CreateUnspecifiedAttributeError: -+ log.warn("Error recreating %s %s", -+ (XendCPUPool.getClass(), cpu_pool_uuid)) -+ XendCPUPool.recreate_active_pools() -+ - - def add_network(self, interface): - # TODO -@@ -586,6 +601,7 @@ class XendNode: - self.save_PPCIs() - self.save_PSCSIs() - self.save_PSCSI_HBAs() -+ self.save_cpu_pools() - - def save_PIFs(self): - pif_records = dict([(pif_uuid, XendAPIStore.get( -@@ -628,6 +644,12 @@ class XendNode: - for pscsi_HBA_uuid in XendPSCSI_HBA.get_all()]) - self.state_store.save_state('pscsi_HBA', pscsi_HBA_records) - -+ def save_cpu_pools(self): -+ cpu_pool_records = dict([(cpu_pool_uuid, XendAPIStore.get( -+ cpu_pool_uuid, XendCPUPool.getClass()).get_record()) -+ for cpu_pool_uuid in XendCPUPool.get_all_managed()]) -+ self.state_store.save_state(XendCPUPool.getClass(), cpu_pool_records) -+ - def shutdown(self): - return 0 - -@@ -939,6 +961,7 @@ class XendNode: - self.format_node_to_memory(info, 'node_to_memory') - info['node_to_dma32_mem'] = \ - self.format_node_to_memory(info, 'node_to_dma32_mem') -+ info['free_cpus'] = len(XendCPUPool.unbound_cpus()) - - # FIXME: These are hard-coded to be the inverse of the getXenMemory - # functions in image.py. Find a cleaner way. -@@ -958,6 +981,7 @@ class XendNode: - 'virt_caps', - 'total_memory', - 'free_memory', -+ 'free_cpus', - 'max_free_memory', - 'max_para_memory', - 'max_hvm_memory', -Index: xen-4.0.2-testing/tools/python/xen/xend/server/SrvServer.py -=================================================================== ---- xen-4.0.2-testing.orig/tools/python/xen/xend/server/SrvServer.py -+++ xen-4.0.2-testing/tools/python/xen/xend/server/SrvServer.py -@@ -52,6 +52,7 @@ from xen.xend import XendNode, XendOptio - from xen.xend.XendLogging import log - from xen.xend.XendClient import XEN_API_SOCKET - from xen.xend.XendDomain import instance as xenddomain -+from xen.xend.XendCPUPool import XendCPUPool - from xen.web.SrvDir import SrvDir - - from SrvRoot import SrvRoot -@@ -147,6 +148,12 @@ class XendServers: - status.close() - status = None - -+ # auto start pools before domains are started -+ try: -+ XendCPUPool.autostart_pools() -+ except Exception, e: -+ log.exception("Failed while autostarting pools") -+ - # Reaching this point means we can auto start domains - try: - xenddomain().autostart_domains() -Index: xen-4.0.2-testing/tools/python/xen/xend/server/XMLRPCServer.py -=================================================================== ---- xen-4.0.2-testing.orig/tools/python/xen/xend/server/XMLRPCServer.py -+++ xen-4.0.2-testing/tools/python/xen/xend/server/XMLRPCServer.py -@@ -33,6 +33,7 @@ from xen.xend.XendClient import XML_RPC_ - from xen.xend.XendConstants import DOM_STATE_RUNNING - from xen.xend.XendLogging import log - from xen.xend.XendError import XendInvalidDomain -+from xen.xend.XendCPUPool import XendCPUPool - - # vcpu_avail is a long and is not needed by the clients. It's far easier - # to just remove it then to try and marshal the long. -@@ -98,6 +99,10 @@ methods = ['device_create', 'device_conf - - exclude = ['domain_create', 'domain_restore'] - -+POOL_FUNCS = ['pool_create', 'pool_new', 'pool_start', 'pool_list', -+ 'pool_destroy', 'pool_delete', 'pool_cpu_add', 'pool_cpu_remove', -+ 'pool_migrate'] -+ - class XMLRPCServer: - def __init__(self, auth, use_xenapi, use_tcp = False, - ssl_key_file = None, ssl_cert_file = None, -@@ -197,6 +202,11 @@ class XMLRPCServer: - if name not in exclude: - self.server.register_function(fn, "xend.domain.%s" % name[7:]) - -+ # Functions in XendPool -+ for name in POOL_FUNCS: -+ fn = getattr(XendCPUPool, name) -+ self.server.register_function(fn, "xend.cpu_pool.%s" % name[5:]) -+ - # Functions in XendNode and XendDmesg - for type, lst, n in [(XendNode, - ['info', 'pciinfo', 'send_debug_keys', -Index: xen-4.0.2-testing/tools/python/xen/xm/create.dtd -=================================================================== ---- xen-4.0.2-testing.orig/tools/python/xen/xm/create.dtd -+++ xen-4.0.2-testing/tools/python/xen/xm/create.dtd -@@ -50,6 +50,7 @@ - s3_integrity CDATA #REQUIRED - vcpus_max CDATA #REQUIRED - vcpus_at_startup CDATA #REQUIRED -+ pool_name CDATA #REQUIRED - actions_after_shutdown %NORMAL_EXIT; #REQUIRED - actions_after_reboot %NORMAL_EXIT; #REQUIRED - actions_after_crash %CRASH_BEHAVIOUR; #REQUIRED -Index: xen-4.0.2-testing/tools/python/xen/xm/create.py -=================================================================== ---- xen-4.0.2-testing.orig/tools/python/xen/xm/create.py -+++ xen-4.0.2-testing/tools/python/xen/xm/create.py -@@ -659,6 +659,10 @@ gopts.var('suppress_spurious_page_faults - fn=set_bool, default=None, - use="""Do not inject spurious page faults into this guest""") - -+gopts.var('pool', val='POOL NAME', -+ fn=set_value, default=None, -+ use="""CPU pool to use for the VM""") -+ - gopts.var('pci_msitranslate', val='TRANSLATE', - fn=set_int, default=1, - use="""Global PCI MSI-INTx translation flag (0=disable; -@@ -1157,6 +1161,8 @@ def make_config(vals): - config.append(['localtime', vals.localtime]) - if vals.oos: - config.append(['oos', vals.oos]) -+ if vals.pool: -+ config.append(['pool_name', vals.pool]) - - config_image = configure_image(vals) - if vals.bootloader: -Index: xen-4.0.2-testing/tools/python/xen/xm/main.py -=================================================================== ---- xen-4.0.2-testing.orig/tools/python/xen/xm/main.py -+++ xen-4.0.2-testing/tools/python/xen/xm/main.py -@@ -56,6 +56,7 @@ from xen.util.xmlrpcclient import Server - import xen.util.xsm.xsm as security - from xen.util.xsm.xsm import XSMError - from xen.util.acmpolicy import ACM_LABEL_UNLABELED_DISPLAY -+from xen.util.sxputils import sxp2map, map2sxp as map_to_sxp - from xen.util import auxbin - - import XenAPI -@@ -237,6 +238,23 @@ SUBCOMMAND_HELP = { - 'tmem-freeable' : ('', 'Print freeable tmem (in MiB).'), - 'tmem-shared-auth' : ('[|-a|--all] [--uuid=] [--auth=<0|1>]', 'De/authenticate shared tmem pool.'), - -+ # -+ # pool commands -+ # -+ 'pool-create' : (' [vars]', -+ 'Create a CPU pool based an ConfigFile.'), -+ 'pool-new' : (' [vars]', -+ 'Adds a CPU pool to Xend CPU pool management'), -+ 'pool-start' : ('', 'Starts a Xend CPU pool'), -+ 'pool-list' : ('[] [-l|--long] [-c|--cpus]', 'List CPU pools on host'), -+ 'pool-destroy' : ('', 'Deactivates a CPU pool'), -+ 'pool-delete' : ('', -+ 'Removes a CPU pool from Xend management'), -+ 'pool-cpu-add' : (' ', 'Adds a CPU to a CPU pool'), -+ 'pool-cpu-remove': (' ', 'Removes a CPU from a CPU pool'), -+ 'pool-migrate' : (' ', -+ 'Moves a domain into a CPU pool'), -+ - # security - - 'addlabel' : ('