diff -Nru xen-4.1.3/debian/changelog xen-4.1.3/debian/changelog --- xen-4.1.3/debian/changelog 2012-09-18 13:26:51.000000000 +0200 +++ xen-4.1.3/debian/changelog 2012-09-28 11:56:53.000000000 +0200 @@ -1,3 +1,24 @@ +xen (4.1.3-3ubuntu1) unstable; urgency=low + + * Merge from Debian unstable. Remaining changes: + - libxenstore3.0: Conflict and replaces libxen3. + - libxen-dev: Conflict and replaces libxen3-dev. + - xenstore-utils: Conflict and replaces libxen3. + - xen-utils-4.1: Conflict and replaces libxen3, python-xen-3.3, + and xen-utils-4.1. + - Change depend back to ipxe as we do not have ipxe-qemu. + - etherboot: Change the config back to include the 8086100e.rom + - Dropped: + - Make sure the LDFLAGS value passed is suitable for use by ld + rather than gcc. Right now there seem to be no LDFLAGS passed. + * Backported AMD specific improvements from upstream Xen (LP: #1009098): + - svm: Do not intercept RDTSC(P) when TSC scaling is supported by hardware + - x86: Use deep C states for off-lined CPUs + - x86/AMD: Add support for AMD's OSVW feature in guests. + - hvm: vpmu: Enable HVM VPMU for AMD Family 12h and 14h processors + + -- Stefan Bader Thu, 27 Sep 2012 21:27:44 +0200 + xen (4.1.3-3) unstable; urgency=low * Xen domain init script: @@ -57,6 +78,25 @@ -- Bastian Blank Sat, 28 Jul 2012 10:23:26 +0200 +xen (4.1.3~rc1+hg-20120614.a9c0a89c08f2-4ubuntu1) quantal; urgency=low + + [ Ubuntu Merge-o-Matic ] + * Merge from Debian unstable. Remaining changes: + - Thanks to Stefan Bader. + - libxenstore3.0: Conflict and replaces libxen3. + - libxen-dev: Conflict and replaces libxen3-dev. + - xenstore-utils: Conflict and replaces libxen3. + - xen-utils-4.1: Conflict and replaces libxen3, python-xen-3.3, + and xen-utils-4.1. + - Change depend back to ipxe as we do not have ipxe-qemu. + - etherboot: Change the config back to include the 8086100e.rom + - Dropped: + - Make sure the LDFLAGS value passed is suitable for use by ld + rather than gcc. Right now there seem to be no LDFLAGS passed. + + + -- Chuck Short Tue, 03 Jul 2012 08:43:03 -0400 + xen (4.1.3~rc1+hg-20120614.a9c0a89c08f2-4) unstable; urgency=low * Add Build-Using info to xen-utils package. @@ -159,6 +199,32 @@ -- Bastian Blank Wed, 01 Feb 2012 19:28:28 +0100 +xen (4.1.2-2ubuntu2) precise; urgency=low + + * etherboot: Change the config back to include the 8086100e.rom + (LP: #948333) + + -- Stefan Bader Tue, 06 Mar 2012 20:58:14 +0100 + +xen (4.1.2-2ubuntu1) precise; urgency=low + + * Merge from Debian testing. Remaining changes: + - libxenstore3.0: Conflict and replaces libxen3. + - libxen-dev: Conflict and replaces libxen3-dev. + - xenstore-utils: Conflict and replaces libxen3. + - xen-utils-4.1: Conflict and replaces libxen3, python-xen-3.3, + and xen-utils-4.1. + - Make sure the LDFLAGS value passed is suitable for use by ld + rather than gcc. + - Dropped: + - debian/patches/upstream-23044:d4ca456c0c25 + - debian/patches/upstream-23104:1976adbf2b80 + - debian/patches/upstream-changeset-23146.patch + - debian/patches/upstream-changeset-23147.patch + - debian/patches/xen-pirq-resubmit-irq.patch + + -- Chuck Short Thu, 22 Dec 2011 04:53:35 +0000 + xen (4.1.2-2) unstable; urgency=low [ Jon Ludlam ] @@ -180,6 +246,24 @@ -- Bastian Blank Sat, 26 Nov 2011 18:28:06 +0100 +xen (4.1.1-3ubuntu1) precise; urgency=low + + * Merge from Debian testing. Remaining changes: + - libxenstore3.0: Conflict and replaces libxen3. + - libxen-dev: Conflict and replaces libxen3-dev. + - xenstore-utils: Conflict and replaces libxen3. + - xen-utils-4.1: Conflict and replaces libxen3, python-xen-3.3, + and xen-utils-4.1. + - Make sure the LDFLAGS value passed is suitable for use by ld + rather than gcc. + - debian/patches/upstream-changeset-23146.patch, + debian/patches/upstream-changeset-23147.patch: Fix booting with hvm + domU. (LP: #832207) + - debian/patches/xen-pirq-resubmit-irq.patch: Retrigger pirq events + when asserted while processing. (LP: #854829) + + -- Chuck Short Sun, 06 Nov 2011 05:51:08 +0000 + xen (4.1.1-3) unstable; urgency=low [ Julien Danjou ] @@ -194,12 +278,69 @@ -- Bastian Blank Wed, 26 Oct 2011 14:42:33 +0200 +xen (4.1.1-2ubuntu4.1) oneiric-proposed; urgency=low + + * debian/patches/xen-pirq-resubmit-irq.patch: Retrigger + pirq events when asserted while processing. Thanks to Stefan Bader + (LP: #854829) + + -- Chuck Short Mon, 10 Oct 2011 19:30:09 -0400 + +xen (4.1.1-2ubuntu4) oneiric; urgency=low + + * Rebuild to drop build records on armel and powerpc. LP: #823714. + + -- Matthias Klose Thu, 06 Oct 2011 14:15:35 +0200 + +xen (4.1.1-2ubuntu2) oneiric; urgency=low + + * Clean up patches. + * debian/patches/upstream-changeset-23146.patch, + debian/patches/upstream-changeset-23147.patch: Fix booting with hvm + domU. (LP: #832207) + + -- Chuck Short Thu, 01 Sep 2011 13:13:47 -0400 + +xen (4.1.1-2ubuntu1) oneiric; urgency=low + + * Merge from debian unstable. Remaining changes: + - libxenstore3.0: Conflict and replaces libxen3. + - libxen-dev: Conflict and replaces libxen3-dev. + - xenstore-utils: Conflict and replaces libxen3. + - xen-utils-4.1: Conflict and replaces libxen3, python-xen-3.3, + and xen-utils-4.1. + + Make sure the LDFLAGS value passed is suitable for use by ld + rather than gcc. + + -- Chuck Short Thu, 11 Aug 2011 14:18:41 +0000 + xen (4.1.1-2) unstable; urgency=low * Fix hvmloader with gcc 4.6. -- Bastian Blank Fri, 05 Aug 2011 23:58:36 +0200 +xen (4.1.1-1ubuntu1) oneiric; urgency=low + + * Merge from debian unstable. Remaining changes: + + Xen 3.3 -> Xen 4.1 migration: + - libxenstore3.0: Conflict and replaces libxen3. + - libxen-dev: Conflict and replaces libxen3-dev. + - xenstore-utils: Conflict and replaces libxen3. + - xen-utils-4.1: Conflict and replaces libxen3, python-xen-3.3, + and xen-utils-4.1. + + Make sure the LDFLAGS value passed is suitable for use by ld + rather than gcc. + + Dropped upstream patches: + - debian/patches/disable-unused-but-not-set-error.patch: + Applied upstream. + - debian/patches/xc-dom-restore-set-but-not-used.patch: + Applied upstream. + - debian/patches/xc-dom-restore-set-but-not-used.patch: + Applied upstream. + + -- Chuck Short Tue, 19 Jul 2011 00:11:08 +0000 + xen (4.1.1-1) unstable; urgency=low * New upstream release. @@ -208,6 +349,43 @@ -- Bastian Blank Mon, 18 Jul 2011 19:38:38 +0200 +xen (4.1.0-3ubuntu4) oneiric; urgency=low + + * Fix xen 3.3 -> xen 4.1 migration. + + -- Chuck Short Sat, 04 Jun 2011 15:37:17 -0400 + +xen (4.1.0-3ubuntu3) oneiric; urgency=low + + * debian/control: Use python2.7 as a build dependency. + + -- Chuck Short Tue, 31 May 2011 14:50:03 -0400 + +xen (4.1.0-3ubuntu2) oneiric; urgency=low + + * debian/control: + + Move to python 2.7. + + Xen 3.3 -> Xen4.1 migration: + - libxenstore3.0: Conflict and replaces libxen3. + - libxen-dev: Conflict and replaces libxen3-dev. + - xenstore-tuils: Conflict and replaces libxen3 + - xen-utils-4.1: Confflict and replaces libxen3, python-xen3.3, + and xen-utils-3.3 + + -- Chuck Short Tue, 31 May 2011 13:15:08 -0400 + +xen (4.1.0-3ubuntu1) oneiric; urgency=low + + * Make sure the LDFLAGS value passed is suitable for use by ld, + rather than gcc. + * Import a set of gcc 4.6 related build fixes from upstream hg. + (disable-unused-but-not-set-error.patch, + ioapic-uninitialised-variables.patch, + patches/xc-dom-restore-set-but-not-used.patch, + xc-tmem-set-but-not-used.patch) + + -- Soren Hansen Thu, 26 May 2011 14:27:18 +0200 + xen (4.1.0-3) unstable; urgency=low * Add ghostscript to build-deps. @@ -829,3 +1007,4 @@ * Initial version. -- Adam Heath Tue, 02 Mar 2004 13:21:52 -0600 + diff -Nru xen-4.1.3/debian/control xen-4.1.3/debian/control --- xen-4.1.3/debian/control 2012-09-18 13:27:30.000000000 +0200 +++ xen-4.1.3/debian/control 2012-09-27 21:26:22.000000000 +0200 @@ -2,9 +2,10 @@ Section: kernel Priority: optional Maintainer: Debian Xen Team +XSBC-Original-Maintainer: Debian Xen Team Uploaders: Guido Trotter , Bastian Blank Standards-Version: 3.9.2 -Build-Depends: debhelper (>> 7), dpkg-dev (>= 1.16.0~), lsb-release, python-dev, bcc, gcc-multilib, e2fslibs-dev, iasl, ipxe-qemu, libaio-dev, libgnutls-dev, liblzma-dev, libncurses5-dev, libpci-dev, pkg-config, uuid-dev, zlib1g-dev, ocaml-nox, dh-ocaml, ocaml-findlib +Build-Depends: debhelper (>> 7), dpkg-dev (>= 1.16.0~), lsb-release, python-dev, bcc, gcc-multilib, e2fslibs-dev, iasl, ipxe, libaio-dev, libgnutls-dev, liblzma-dev, libncurses5-dev, libpci-dev, pkg-config, uuid-dev, zlib1g-dev, ocaml-nox, dh-ocaml, ocaml-findlib Build-Depends-Indep: graphviz, ghostscript, texlive-fonts-recommended, texlive-font-utils, texlive-latex-recommended XS-Python-Version: current @@ -28,6 +29,8 @@ Architecture: amd64 i386 Section: libs Depends: ${shlibs:Depends}, ${misc:Depends} +Replaces: libxen3 (<= 3.3.0-1ubuntu12) +Conflicts: libxen3 (<= 3.3.0-1ubuntu12) Description: Xenstore communications library for Xen This package contains the public libxenstore. @@ -35,6 +38,8 @@ Architecture: amd64 i386 Section: libdevel Depends: libxen-4.1 (= ${binary:Version}), libxenstore3.0 (= ${binary:Version}), ${misc:Depends} +Replaces: libxen3-dev (<= 3.3.0-1ubuntu12) +Conflicts: libxen3-dev (<= 3.3.0-1ubuntu12) Description: Public headers and libs for Xen This package contains the public headers and static libraries for Xen. @@ -42,8 +47,8 @@ Architecture: amd64 i386 Section: admin Depends: ${shlibs:Depends}, ${misc:Depends} -Replaces: xen-utils-common (<= 3.1.0-1) -Conflicts: xen-utils-common (<= 3.1.0-1) +Replaces: xen-utils-common (<= 3.1.0-1), libxen3 (<= 3.3.0-1ubuntu12) +Conflicts: xen-utils-common (<= 3.1.0-1), libxen3 (<= 3.3.0-1ubuntu12) Description: Xenstore utilities for Xen This package contains the Xenstore utilities. @@ -78,6 +83,8 @@ Depends: ${shlibs:Depends}, ${misc:Depends}, ${python:Depends}, xen-utils-common (>= ${source:Version}) Recommends: bridge-utils, libc6-xen [i386], xen-hypervisor-4.1, qemu-keymaps, qemu-utils Suggests: xen-docs-4.1 +Replaces: xen-utils-3.3 (<= 3.3.0-1ubuntu12), libxen3 (<= 3.3.0-1ubuntu12), python-xen-3.3 (<= 3.3.0-1ubuntu12) +Conflicts: xen-utils-3.3 (<= 3.3.0-1ubuntu12), libxen3 (<= 3.3.0-1ubuntu12), python-xen-3.3 (<= 3.3.0-1ubuntu12) Description: XEN administrative tools The userspace tools to manage a system virtualized through the XEN virtual machine monitor. diff -Nru xen-4.1.3/debian/patches/series xen-4.1.3/debian/patches/series --- xen-4.1.3/debian/patches/series 2012-09-07 19:38:58.000000000 +0200 +++ xen-4.1.3/debian/patches/series 2012-09-28 11:52:26.000000000 +0200 @@ -74,3 +74,8 @@ tools-libxl-sxp.diff tools-ocaml-fix-build.diff tools-xenstore-compatibility.diff +tools-firmware-etherboot-fix-e1000.patch +xen-amd01-ed9c557f8a35.patch +xen-amd03-50a70b652b43.patch +xen-amd04-eae25241d571.patch +xen-amd10-23e33ea79cac.patch diff -Nru xen-4.1.3/debian/patches/tools-firmware-etherboot-fix-e1000.patch xen-4.1.3/debian/patches/tools-firmware-etherboot-fix-e1000.patch --- xen-4.1.3/debian/patches/tools-firmware-etherboot-fix-e1000.patch 1970-01-01 01:00:00.000000000 +0100 +++ xen-4.1.3/debian/patches/tools-firmware-etherboot-fix-e1000.patch 2012-09-27 21:22:44.000000000 +0200 @@ -0,0 +1,20 @@ +UBUNTU: Fix pxe boot with e1000 emulation + +This seems to be a slight revert as the same rom name has been used before. +The main problem is that ipxe builds the e1000_82540.rom with invalid +pci id in the rom header. Which is required by the hvmloader. +The 8086100e.rom is just the same but with a name the build engine can +cope with. + +Signed-off-by: Stefan Bader +Index: xen-4.1.2/tools/firmware/etherboot/Config +=================================================================== +--- xen-4.1.2.orig/tools/firmware/etherboot/Config 2012-03-06 20:50:36.000000000 +0100 ++++ xen-4.1.2/tools/firmware/etherboot/Config 2012-03-06 20:54:11.275153857 +0100 +@@ -1,5 +1,5 @@ + +-NICS = rtl8139 e1000_82540 ++NICS = rtl8139 8086100e + + CFLAGS += -UPXE_DHCP_STRICT + CFLAGS += -DPXE_DHCP_STRICT diff -Nru xen-4.1.3/debian/patches/xen-amd01-ed9c557f8a35.patch xen-4.1.3/debian/patches/xen-amd01-ed9c557f8a35.patch --- xen-4.1.3/debian/patches/xen-amd01-ed9c557f8a35.patch 1970-01-01 01:00:00.000000000 +0100 +++ xen-4.1.3/debian/patches/xen-amd01-ed9c557f8a35.patch 2012-09-28 10:54:58.000000000 +0200 @@ -0,0 +1,42 @@ + +# HG changeset patch +# User Boris Ostrovsky +# Date 1335358394 -3600 +# Node ID ed9c557f8a35a6deb7e6df0679f24a2121fd1172 +# Parent 7ba11d9b1d23633b5c42fadddad17b6dcb686141 +svm: Do not intercept RDTSC(P) when TSC scaling is supported by hardware + +When running in TSC_MODE_ALWAYS_EMULATE mode on processors that +support TSC scaling we don't need to intercept RDTSC/RDTSCP +instructions. + +Signed-off-by: Boris Ostrovsky +Acked-by: Wei Huang +Tested-by: Wei Huang +Committed-by: Keir Fraser + +Index: xen-4.1.3/xen/arch/x86/hvm/svm/svm.c +=================================================================== +--- xen-4.1.3.orig/xen/arch/x86/hvm/svm/svm.c 2012-08-09 22:08:08.000000000 +0200 ++++ xen-4.1.3/xen/arch/x86/hvm/svm/svm.c 2012-09-28 10:54:24.901786306 +0200 +@@ -611,12 +611,19 @@ static void svm_set_rdtsc_exiting(struct + { + struct vmcb_struct *vmcb = v->arch.hvm_svm.vmcb; + u32 general1_intercepts = vmcb_get_general1_intercepts(vmcb); ++ u32 general2_intercepts = vmcb_get_general2_intercepts(vmcb); + + general1_intercepts &= ~GENERAL1_INTERCEPT_RDTSC; +- if ( enable ) ++ general2_intercepts &= ~GENERAL2_INTERCEPT_RDTSCP; ++ ++ if ( enable && !cpu_has_tsc_ratio ) ++ { + general1_intercepts |= GENERAL1_INTERCEPT_RDTSC; ++ general2_intercepts |= GENERAL2_INTERCEPT_RDTSCP; ++ } + + vmcb_set_general1_intercepts(vmcb, general1_intercepts); ++ vmcb_set_general2_intercepts(vmcb, general2_intercepts); + } + + static unsigned int svm_get_insn_bytes(struct vcpu *v, uint8_t *buf) diff -Nru xen-4.1.3/debian/patches/xen-amd03-50a70b652b43.patch xen-4.1.3/debian/patches/xen-amd03-50a70b652b43.patch --- xen-4.1.3/debian/patches/xen-amd03-50a70b652b43.patch 1970-01-01 01:00:00.000000000 +0100 +++ xen-4.1.3/debian/patches/xen-amd03-50a70b652b43.patch 2012-09-28 11:11:15.000000000 +0200 @@ -0,0 +1,51 @@ + +# HG changeset patch +# User Boris Ostrovsky +# Date 1331105430 0 +# Node ID 50a70b652b43aacbf923007ba8f645c5024ab698 +# Parent 031e696b03d75320dab652a9ec50ef2d91b5a5d0 +x86: Use deep C states for off-lined CPUs + +Currently when a core is taken off-line it is placed in C1 state +(unless MONITOR/MWAIT is used). This patch allows a core to go to +deeper C states resulting in significantly higher power savings. + +Signed-off-by: Boris Ostrovsky +Committed-by: Keir Fraser + +Index: xen-4.1.3/xen/arch/x86/acpi/cpu_idle.c +=================================================================== +--- xen-4.1.3.orig/xen/arch/x86/acpi/cpu_idle.c 2012-08-09 22:08:08.000000000 +0200 ++++ xen-4.1.3/xen/arch/x86/acpi/cpu_idle.c 2012-09-28 11:11:10.782703813 +0200 +@@ -563,6 +563,7 @@ static void acpi_dead_idle(void) + { + struct acpi_processor_power *power; + struct acpi_processor_cx *cx; ++ struct cpuinfo_x86 *c = ¤t_cpu_data; + void *mwait_ptr; + + if ( (power = processor_powers[smp_processor_id()]) == NULL ) +@@ -600,6 +601,23 @@ static void acpi_dead_idle(void) + __mwait(cx->address, 0); + } + } ++ else if ( c->x86_vendor == X86_VENDOR_AMD && ++ cx->entry_method == ACPI_CSTATE_EM_SYSIO ) ++ { ++ /* Intel prefers not to use SYSIO */ ++ ++ /* Avoid references to shared data after the cache flush */ ++ u32 address = cx->address; ++ u32 pmtmr_ioport_local = pmtmr_ioport; ++ ++ wbinvd(); ++ ++ while ( 1 ) ++ { ++ inb(address); ++ inl(pmtmr_ioport_local); ++ } ++ } + + default_halt: + wbinvd(); diff -Nru xen-4.1.3/debian/patches/xen-amd04-eae25241d571.patch xen-4.1.3/debian/patches/xen-amd04-eae25241d571.patch --- xen-4.1.3/debian/patches/xen-amd04-eae25241d571.patch 1970-01-01 01:00:00.000000000 +0100 +++ xen-4.1.3/debian/patches/xen-amd04-eae25241d571.patch 2012-09-28 12:11:54.000000000 +0200 @@ -0,0 +1,446 @@ + +# HG changeset patch +# User Boris Ostrovsky +# Date 1328623519 -3600 +# Node ID eae25241d571ecad4d4b69ac89b0accc9e0fbf6c +# Parent 3574f4d67843733ccaabab5f8ebb859c99d7314a +x86/AMD: Add support for AMD's OSVW feature in guests. + +In some cases guests should not provide workarounds for errata even when the +physical processor is affected. For example, because of erratum 400 on family +10h processors a Linux guest will read an MSR (resulting in VMEXIT) before +going to idle in order to avoid getting stuck in a non-C0 state. This is not +necessary: HLT and IO instructions are intercepted and therefore there is no +reason for erratum 400 workaround in the guest. + +This patch allows us to present a guest with certain errata as fixed, +regardless of the state of actual hardware. + +Signed-off-by: Boris Ostrovsky +Acked-by: Christoph Egger +Signed-off-by: Jan Beulich +Acked-by: Keir Fraser +Committed-by: Jan Beulich + +Index: xen-4.1.3/tools/libxc/xc_cpuid_x86.c +=================================================================== +--- xen-4.1.3.orig/tools/libxc/xc_cpuid_x86.c 2012-09-28 11:53:18.031058912 +0200 ++++ xen-4.1.3/tools/libxc/xc_cpuid_x86.c 2012-09-28 11:53:25.795096853 +0200 +@@ -102,6 +102,7 @@ static void amd_xc_cpuid_policy( + bitmaskof(X86_FEATURE_SSE4A) | + bitmaskof(X86_FEATURE_MISALIGNSSE) | + bitmaskof(X86_FEATURE_3DNOWPREFETCH) | ++ bitmaskof(X86_FEATURE_OSVW) | + bitmaskof(X86_FEATURE_XOP) | + bitmaskof(X86_FEATURE_FMA4) | + bitmaskof(X86_FEATURE_TBM)); +Index: xen-4.1.3/xen/arch/x86/hvm/svm/svm.c +=================================================================== +--- xen-4.1.3.orig/xen/arch/x86/hvm/svm/svm.c 2012-09-28 11:53:25.715096467 +0200 ++++ xen-4.1.3/xen/arch/x86/hvm/svm/svm.c 2012-09-28 12:11:50.068495374 +0200 +@@ -75,6 +75,10 @@ static DEFINE_PER_CPU_READ_MOSTLY(void * + + static bool_t amd_erratum383_found __read_mostly; + ++/* OSVW bits */ ++static uint64_t osvw_length, osvw_status; ++static DEFINE_SPINLOCK(osvw_lock); ++ + static void inline __update_guest_eip( + struct cpu_user_regs *regs, unsigned int inst_len) + { +@@ -766,6 +770,69 @@ static void svm_do_resume(struct vcpu *v + reset_stack_and_jump(svm_asm_do_resume); + } + ++static void svm_guest_osvw_init(struct vcpu *vcpu) ++{ ++ if ( boot_cpu_data.x86_vendor != X86_VENDOR_AMD ) ++ return; ++ ++ /* ++ * Guests should see errata 400 and 415 as fixed (assuming that ++ * HLT and IO instructions are intercepted). ++ */ ++ vcpu->arch.hvm_svm.osvw.length = (osvw_length >= 3) ? osvw_length : 3; ++ vcpu->arch.hvm_svm.osvw.status = osvw_status & ~(6ULL); ++ ++ /* ++ * By increasing VCPU's osvw.length to 3 we are telling the guest that ++ * all osvw.status bits inside that length, including bit 0 (which is ++ * reserved for erratum 298), are valid. However, if host processor's ++ * osvw_len is 0 then osvw_status[0] carries no information. We need to ++ * be conservative here and therefore we tell the guest that erratum 298 ++ * is present (because we really don't know). ++ */ ++ if ( osvw_length == 0 && boot_cpu_data.x86 == 0x10 ) ++ vcpu->arch.hvm_svm.osvw.status |= 1; ++} ++ ++void svm_host_osvw_reset() ++{ ++ spin_lock(&osvw_lock); ++ ++ osvw_length = 64; /* One register (MSRC001_0141) worth of errata */ ++ osvw_status = 0; ++ ++ spin_unlock(&osvw_lock); ++} ++ ++void svm_host_osvw_init() ++{ ++ spin_lock(&osvw_lock); ++ ++ /* ++ * Get OSVW bits. If bits are not the same on different processors then ++ * choose the worst case (i.e. if erratum is present on one processor and ++ * not on another assume that the erratum is present everywhere). ++ */ ++ if ( test_bit(X86_FEATURE_OSVW, &boot_cpu_data.x86_capability) ) ++ { ++ uint64_t len, status; ++ ++ if ( rdmsr_safe(MSR_AMD_OSVW_ID_LENGTH, len) || ++ rdmsr_safe(MSR_AMD_OSVW_STATUS, status) ) ++ len = status = 0; ++ ++ if (len < osvw_length) ++ osvw_length = len; ++ ++ osvw_status |= status; ++ osvw_status &= (1ULL << osvw_length) - 1; ++ } ++ else ++ osvw_length = osvw_status = 0; ++ ++ spin_unlock(&osvw_lock); ++} ++ + static int svm_domain_initialise(struct domain *d) + { + return 0; +@@ -794,6 +861,9 @@ static int svm_vcpu_initialise(struct vc + } + + vpmu_initialise(v); ++ ++ svm_guest_osvw_init(v); ++ + return 0; + } + +@@ -908,6 +978,27 @@ static void svm_init_erratum_383(struct + } + } + ++static int svm_handle_osvw(struct vcpu *v, uint32_t msr, uint64_t *val, bool_t read) ++{ ++ uint eax, ebx, ecx, edx; ++ ++ /* Guest OSVW support */ ++ hvm_cpuid(0x80000001, &eax, &ebx, &ecx, &edx); ++ if ( !test_bit((X86_FEATURE_OSVW & 31), &ecx) ) ++ return -1; ++ ++ if ( read ) ++ { ++ if (msr == MSR_AMD_OSVW_ID_LENGTH) ++ *val = v->arch.hvm_svm.osvw.length; ++ else ++ *val = v->arch.hvm_svm.osvw.status; ++ } ++ /* Writes are ignored */ ++ ++ return 0; ++} ++ + static int svm_cpu_up(void) + { + uint64_t msr_content; +@@ -958,6 +1049,9 @@ static int svm_cpu_up(void) + } + #endif + ++ /* Initialize OSVW bits to be used by guests */ ++ svm_host_osvw_init(); ++ + return 0; + } + +@@ -968,6 +1062,8 @@ struct hvm_function_table * __init start + if ( !test_bit(X86_FEATURE_SVM, &boot_cpu_data.x86_capability) ) + return NULL; + ++ svm_host_osvw_reset(); ++ + if ( svm_cpu_up() ) + { + printk("SVM: failed to initialise.\n"); +@@ -1195,6 +1291,12 @@ static int svm_msr_read_intercept(unsign + vpmu_do_rdmsr(msr, msr_content); + break; + ++ case MSR_AMD_OSVW_ID_LENGTH: ++ case MSR_AMD_OSVW_STATUS: ++ if (svm_handle_osvw(v, msr, msr_content, 1) < 0) ++ goto gpf; ++ break; ++ + default: + + if ( rdmsr_viridian_regs(msr, msr_content) || +@@ -1323,6 +1425,12 @@ static int svm_msr_write_intercept(unsig + */ + break; + ++ case MSR_AMD_OSVW_ID_LENGTH: ++ case MSR_AMD_OSVW_STATUS: ++ if (svm_handle_osvw(v, msr, &msr_content, 0) < 0) ++ goto gpf; ++ break; ++ + default: + if ( wrmsr_viridian_regs(msr, msr_content) ) + break; +Index: xen-4.1.3/xen/arch/x86/microcode.c +=================================================================== +--- xen-4.1.3.orig/xen/arch/x86/microcode.c 2012-09-28 11:53:17.903058265 +0200 ++++ xen-4.1.3/xen/arch/x86/microcode.c 2012-09-28 11:53:25.799096876 +0200 +@@ -160,5 +160,15 @@ int microcode_update(XEN_GUEST_HANDLE(co + info->error = 0; + info->cpu = first_cpu(cpu_online_map); + ++ if ( microcode_ops->start_update ) ++ { ++ ret = microcode_ops->start_update(); ++ if ( ret != 0 ) ++ { ++ xfree(info); ++ return ret; ++ } ++ } ++ + return continue_hypercall_on_cpu(info->cpu, do_microcode_update, info); + } +Index: xen-4.1.3/xen/arch/x86/microcode_amd.c +=================================================================== +--- xen-4.1.3.orig/xen/arch/x86/microcode_amd.c 2012-09-28 11:53:17.875058141 +0200 ++++ xen-4.1.3/xen/arch/x86/microcode_amd.c 2012-09-28 11:53:25.799096876 +0200 +@@ -26,6 +26,7 @@ + #include + #include + #include ++#include + + #define pr_debug(x...) ((void)0) + +@@ -44,6 +45,7 @@ static DEFINE_SPINLOCK(microcode_update_ + + struct equiv_cpu_entry *equiv_cpu_table; + ++/* See comment in start_update() for cases when this routine fails */ + static int collect_cpu_info(int cpu, struct cpu_signature *csig) + { + struct cpuinfo_x86 *c = &cpu_data[cpu]; +@@ -275,14 +277,16 @@ static int cpu_request_microcode(int cpu + { + printk(KERN_ERR "microcode: error! Wrong " + "microcode patch file magic\n"); +- return -EINVAL; ++ error = -EINVAL; ++ goto out; + } + + error = install_equiv_cpu_table(buf, (uint32_t)(buf_pos[2]), &offset); + if ( error ) + { + printk(KERN_ERR "microcode: installing equivalent cpu table failed\n"); +- return -EINVAL; ++ error = -EINVAL; ++ goto out; + } + + mc_amd = xmalloc(struct microcode_amd); +@@ -290,6 +294,8 @@ static int cpu_request_microcode(int cpu + { + printk(KERN_ERR "microcode: error! " + "Can not allocate memory for microcode patch\n"); ++ xfree(equiv_cpu_table); ++ equiv_cpu_table = NULL; + error = -ENOMEM; + goto out; + } +@@ -321,14 +327,16 @@ static int cpu_request_microcode(int cpu + /* On success keep the microcode patch for + * re-apply on resume. + */ +- if (error == 0) { ++ if (error == 1) { + xfree(mc_old); +- return 0; ++ error = 0; ++ } else { ++ xfree(equiv_cpu_table); ++ equiv_cpu_table = NULL; + } + + out: +- xfree(equiv_cpu_table); +- equiv_cpu_table = NULL; ++ svm_host_osvw_init(); + + return error; + } +@@ -338,11 +346,28 @@ static int microcode_resume_match(int cp + return 0; + } + ++static int start_update(void) ++{ ++ /* ++ * We assume here that svm_host_osvw_init() will be called on each cpu (from ++ * cpu_request_microcode()). ++ * ++ * Note that if collect_cpu_info() returns an error then ++ * cpu_request_microcode() will not invoked thus leaving OSVW bits not ++ * updated. Currently though collect_cpu_info() will not fail on processors ++ * supporting OSVW so we will not deal with this possibility. ++ */ ++ svm_host_osvw_reset(); ++ ++ return 0; ++} ++ + static const struct microcode_ops microcode_amd_ops = { + .microcode_resume_match = microcode_resume_match, + .cpu_request_microcode = cpu_request_microcode, + .collect_cpu_info = collect_cpu_info, + .apply_microcode = apply_microcode, ++ .start_update = start_update, + }; + + static __init int microcode_init_amd(void) +Index: xen-4.1.3/xen/arch/x86/platform_hypercall.c +=================================================================== +--- xen-4.1.3.orig/xen/arch/x86/platform_hypercall.c 2012-09-28 11:53:17.843057974 +0200 ++++ xen-4.1.3/xen/arch/x86/platform_hypercall.c 2012-09-28 11:53:25.803096905 +0200 +@@ -169,7 +169,23 @@ ret_t do_platform_op(XEN_GUEST_HANDLE(xe + break; + + guest_from_compat_handle(data, op->u.microcode.data); ++ ++ /* ++ * alloc_vcpu() will access data which is modified during ++ * microcode update ++ */ ++ while ( !spin_trylock(&vcpu_alloc_lock) ) ++ { ++ if ( hypercall_preempt_check() ) ++ { ++ ret = hypercall_create_continuation( ++ __HYPERVISOR_platform_op, "h", u_xenpf_op); ++ goto out; ++ } ++ } ++ + ret = microcode_update(data, op->u.microcode.length); ++ spin_unlock(&vcpu_alloc_lock); + } + break; + +Index: xen-4.1.3/xen/common/domctl.c +=================================================================== +--- xen-4.1.3.orig/xen/common/domctl.c 2012-09-28 11:53:17.987058678 +0200 ++++ xen-4.1.3/xen/common/domctl.c 2012-09-28 11:53:25.803096905 +0200 +@@ -27,6 +27,7 @@ + #include + + static DEFINE_SPINLOCK(domctl_lock); ++DEFINE_SPINLOCK(vcpu_alloc_lock); + + extern long arch_do_domctl( + struct xen_domctl *op, XEN_GUEST_HANDLE(xen_domctl_t) u_domctl); +@@ -488,6 +489,20 @@ long do_domctl(XEN_GUEST_HANDLE(xen_domc + /* Needed, for example, to ensure writable p.t. state is synced. */ + domain_pause(d); + ++ /* ++ * Certain operations (e.g. CPU microcode updates) modify data which is ++ * used during VCPU allocation/initialization ++ */ ++ while ( !spin_trylock(&vcpu_alloc_lock) ) ++ { ++ if ( hypercall_preempt_check() ) ++ { ++ ret = hypercall_create_continuation( ++ __HYPERVISOR_domctl, "h", u_domctl); ++ goto maxvcpu_out_novcpulock; ++ } ++ } ++ + /* We cannot reduce maximum VCPUs. */ + ret = -EINVAL; + if ( (max < d->max_vcpus) && (d->vcpu[max] != NULL) ) +@@ -538,6 +553,9 @@ long do_domctl(XEN_GUEST_HANDLE(xen_domc + ret = 0; + + maxvcpu_out: ++ spin_unlock(&vcpu_alloc_lock); ++ ++ maxvcpu_out_novcpulock: + domain_unpause(d); + rcu_unlock_domain(d); + } +Index: xen-4.1.3/xen/include/asm-x86/hvm/svm/svm.h +=================================================================== +--- xen-4.1.3.orig/xen/include/asm-x86/hvm/svm/svm.h 2012-09-28 11:53:17.731057420 +0200 ++++ xen-4.1.3/xen/include/asm-x86/hvm/svm/svm.h 2012-09-28 11:53:25.803096905 +0200 +@@ -91,4 +91,7 @@ extern u32 svm_feature_flags; + ~TSC_RATIO_RSVD_BITS ) + #define vcpu_tsc_ratio(v) TSC_RATIO((v)->domain->arch.tsc_khz, cpu_khz) + ++extern void svm_host_osvw_reset(void); ++extern void svm_host_osvw_init(void); ++ + #endif /* __ASM_X86_HVM_SVM_H__ */ +Index: xen-4.1.3/xen/include/asm-x86/hvm/svm/vmcb.h +=================================================================== +--- xen-4.1.3.orig/xen/include/asm-x86/hvm/svm/vmcb.h 2012-09-28 11:53:17.771057616 +0200 ++++ xen-4.1.3/xen/include/asm-x86/hvm/svm/vmcb.h 2012-09-28 11:53:25.803096905 +0200 +@@ -509,6 +509,12 @@ struct arch_svm_struct { + uint64_t guest_sysenter_cs; + uint64_t guest_sysenter_esp; + uint64_t guest_sysenter_eip; ++ ++ /* OSVW MSRs */ ++ struct { ++ u64 length; ++ u64 status; ++ } osvw; + }; + + struct vmcb_struct *alloc_vmcb(void); +Index: xen-4.1.3/xen/include/asm-x86/microcode.h +=================================================================== +--- xen-4.1.3.orig/xen/include/asm-x86/microcode.h 2012-09-28 11:53:17.699057275 +0200 ++++ xen-4.1.3/xen/include/asm-x86/microcode.h 2012-09-28 11:53:25.807096920 +0200 +@@ -11,6 +11,7 @@ struct microcode_ops { + int (*cpu_request_microcode)(int cpu, const void *buf, size_t size); + int (*collect_cpu_info)(int cpu, struct cpu_signature *csig); + int (*apply_microcode)(int cpu); ++ int (*start_update)(void); + }; + + struct microcode_header_intel { +Index: xen-4.1.3/xen/include/xen/domain.h +=================================================================== +--- xen-4.1.3.orig/xen/include/xen/domain.h 2012-09-28 11:53:17.811057818 +0200 ++++ xen-4.1.3/xen/include/xen/domain.h 2012-09-28 11:53:25.807096920 +0200 +@@ -59,6 +59,7 @@ void arch_dump_domain_info(struct domain + + void arch_vcpu_reset(struct vcpu *v); + ++extern spinlock_t vcpu_alloc_lock; + bool_t domctl_lock_acquire(void); + void domctl_lock_release(void); + diff -Nru xen-4.1.3/debian/patches/xen-amd10-23e33ea79cac.patch xen-4.1.3/debian/patches/xen-amd10-23e33ea79cac.patch --- xen-4.1.3/debian/patches/xen-amd10-23e33ea79cac.patch 1970-01-01 01:00:00.000000000 +0100 +++ xen-4.1.3/debian/patches/xen-amd10-23e33ea79cac.patch 2012-09-28 11:49:42.000000000 +0200 @@ -0,0 +1,38 @@ + +# HG changeset patch +# User Jacob Shin +# Date 1305188046 -3600 +# Node ID 23e33ea79cac0303c729d4e82905054cded16348 +# Parent fabdd682420c0c7b5e81f07f2f54211ebc11babe +hvm: vpmu: Enable HVM VPMU for AMD Family 12h and 14h processors + +HVM VPMU support can be enabled for AMD Family 12h and 14h processors +by taking the same code path as 10h. + +Signed-off-by: Jacob Shin + +diff -r fabdd682420c -r 23e33ea79cac xen/arch/x86/hvm/svm/vpmu.c +--- a/xen/arch/x86/hvm/svm/vpmu.c Thu May 12 09:13:18 2011 +0100 ++++ b/xen/arch/x86/hvm/svm/vpmu.c Thu May 12 09:14:06 2011 +0100 +@@ -317,6 +317,8 @@ static void amd_vpmu_initialise(struct v + k7_counters_mirrored = 1; + break; + case 0x10: ++ case 0x12: ++ case 0x14: + default: + num_counters = F10H_NUM_COUNTERS; + counters = AMD_F10H_COUNTERS; +diff -r fabdd682420c -r 23e33ea79cac xen/arch/x86/hvm/vpmu.c +--- a/xen/arch/x86/hvm/vpmu.c Thu May 12 09:13:18 2011 +0100 ++++ b/xen/arch/x86/hvm/vpmu.c Thu May 12 09:14:06 2011 +0100 +@@ -101,6 +101,8 @@ void vpmu_initialise(struct vcpu *v) + switch ( family ) + { + case 0x10: ++ case 0x12: ++ case 0x14: + case 0x15: + vpmu->arch_vpmu_ops = &amd_vpmu_ops; + break; + diff -Nru xen-4.1.3/debian/rules xen-4.1.3/debian/rules --- xen-4.1.3/debian/rules 2012-07-01 15:27:28.000000000 +0200 +++ xen-4.1.3/debian/rules 2012-09-27 21:22:44.000000000 +0200 @@ -3,6 +3,11 @@ # Uncomment this to turn on verbose mode. #export DH_VERBOSE=1 +# Ubuntu passes a default LDFLAGS value of -Wl,-Bsymbolic-functions +# Xen passed LDFLAGS directly to ld (not through gcc), so this fails. +# We should update this if the default LDFLAGS is changed. +LDFLAGS = -Bsymbolic-functions + DEB_HOST_ARCH := $(shell dpkg-architecture -qDEB_HOST_ARCH) DEB_BUILD_ARCH := $(shell dpkg-architecture -qDEB_BUILD_ARCH)