From 0fa6ba3589754a7a3e77b5344b062e5704389cc4 Mon Sep 17 00:00:00 2001 From: Dirk Mueller Date: Mon, 22 Apr 2013 22:37:10 +0200 Subject: [PATCH] Update to 3.9-rc8: * Remove obsolete arm related patches * Refresh Xen patches * Update config --- config/arm64/default | 2 +- config/armv5tel/versatile | 3 +- config/armv7hl/cubox | 2 +- config/armv7hl/default | 2 +- config/armv7hl/exynos | 2 +- config/armv7hl/lpae | 2 +- config/i386/debug | 4 +- config/i386/default | 4 +- config/i386/desktop | 4 +- config/i386/ec2 | 2 +- config/i386/pae | 4 +- config/i386/trace | 4 +- config/i386/xen | 4 +- config/ia64/debug | 4 +- config/ia64/default | 4 +- config/ia64/trace | 4 +- config/ppc/default | 3 +- config/ppc64/debug | 3 +- config/ppc64/default | 3 +- config/ppc64/trace | 3 +- config/s390/s390 | 2 +- config/s390/trace | 2 +- config/s390x/default | 2 +- config/s390x/trace | 2 +- config/x86_64/debug | 4 +- config/x86_64/default | 4 +- config/x86_64/desktop | 4 +- config/x86_64/ec2 | 2 +- config/x86_64/trace | 4 +- config/x86_64/xen | 4 +- patches.arch/arm-fix-build-ux500-module.diff | 18 - patches.xen/xen-x86-EFI | 55 +- patches.xen/xen3-auto-xen-kconfig.diff | 84 +- patches.xen/xen3-patch-2.6.23 | 5899 ++++----- patches.xen/xen3-patch-2.6.24 | 17245 +++++++++++++------------ patches.xen/xen3-patch-3.9-rc5 | 392 +- rpm/config.sh | 2 +- series.conf | 3 +- 38 files changed, 12093 insertions(+), 11698 deletions(-) delete mode 100644 patches.arch/arm-fix-build-ux500-module.diff diff --git a/config/arm64/default b/config/arm64/default index 7919c4d..54bb69b 100644 --- a/config/arm64/default +++ b/config/arm64/default @@ -1,6 +1,6 @@ # # Automatically generated file; DO NOT EDIT. -# Linux/arm64 3.9.0-rc6 Kernel Configuration +# Linux/arm64 3.9.0-rc8 Kernel Configuration # CONFIG_ARM64=y CONFIG_64BIT=y diff --git a/config/armv5tel/versatile b/config/armv5tel/versatile index a50f537..8b15b47 100644 --- a/config/armv5tel/versatile +++ b/config/armv5tel/versatile @@ -1,6 +1,6 @@ # # Automatically generated file; DO NOT EDIT. -# Linux/arm 3.9.0-rc6 Kernel Configuration +# Linux/arm 3.9.0-rc8 Kernel Configuration # CONFIG_ARM=y CONFIG_MIGHT_HAVE_PCI=y @@ -2218,6 +2218,7 @@ CONFIG_RT2800USB_RT35XX=y CONFIG_RT2800USB_RT53XX=y CONFIG_RT2800USB_UNKNOWN=y CONFIG_RT2800_LIB=m +CONFIG_RT2X00_LIB_MMIO=m CONFIG_RT2X00_LIB_PCI=m CONFIG_RT2X00_LIB_USB=m CONFIG_RT2X00_LIB=m diff --git a/config/armv7hl/cubox b/config/armv7hl/cubox index a9d64c2..d708e7c 100644 --- a/config/armv7hl/cubox +++ b/config/armv7hl/cubox @@ -1,6 +1,6 @@ # # Automatically generated file; DO NOT EDIT. -# Linux/arm 3.9.0-rc6 Kernel Configuration +# Linux/arm 3.9.0-rc8 Kernel Configuration # CONFIG_ARM=y CONFIG_MIGHT_HAVE_PCI=y diff --git a/config/armv7hl/default b/config/armv7hl/default index 69906e5..dfc6916 100644 --- a/config/armv7hl/default +++ b/config/armv7hl/default @@ -1,6 +1,6 @@ # # Automatically generated file; DO NOT EDIT. -# Linux/arm 3.9.0-rc6 Kernel Configuration +# Linux/arm 3.9.0-rc8 Kernel Configuration # CONFIG_ARM=y CONFIG_SYS_SUPPORTS_APM_EMULATION=y diff --git a/config/armv7hl/exynos b/config/armv7hl/exynos index 3267060..349878e 100644 --- a/config/armv7hl/exynos +++ b/config/armv7hl/exynos @@ -1,6 +1,6 @@ # # Automatically generated file; DO NOT EDIT. -# Linux/arm 3.9.0-rc6 Kernel Configuration +# Linux/arm 3.9.0-rc8 Kernel Configuration # CONFIG_ARM=y CONFIG_SYS_SUPPORTS_APM_EMULATION=y diff --git a/config/armv7hl/lpae b/config/armv7hl/lpae index 946f9fc..d791acd 100644 --- a/config/armv7hl/lpae +++ b/config/armv7hl/lpae @@ -1,6 +1,6 @@ # # Automatically generated file; DO NOT EDIT. -# Linux/arm 3.9.0-rc6 Kernel Configuration +# Linux/arm 3.9.0-rc8 Kernel Configuration # CONFIG_ARM=y CONFIG_SYS_SUPPORTS_APM_EMULATION=y diff --git a/config/i386/debug b/config/i386/debug index 7e22892..91e19ab 100644 --- a/config/i386/debug +++ b/config/i386/debug @@ -1,6 +1,6 @@ # # Automatically generated file; DO NOT EDIT. -# Linux/i386 3.9.0-rc6 Kernel Configuration +# Linux/i386 3.9.0-rc8 Kernel Configuration # # CONFIG_64BIT is not set CONFIG_X86_32=y @@ -2651,6 +2651,7 @@ CONFIG_RT2800USB_RT35XX=y CONFIG_RT2800USB_RT53XX=y CONFIG_RT2800USB_UNKNOWN=y CONFIG_RT2800_LIB=m +CONFIG_RT2X00_LIB_MMIO=m CONFIG_RT2X00_LIB_PCI=m CONFIG_RT2X00_LIB_USB=m CONFIG_RT2X00_LIB=m @@ -6305,3 +6306,4 @@ CONFIG_CORDIC=m CONFIG_DDR=y CONFIG_MPILIB=m CONFIG_OID_REGISTRY=m +CONFIG_UCS2_STRING=y diff --git a/config/i386/default b/config/i386/default index f6cb5eb..c064064 100644 --- a/config/i386/default +++ b/config/i386/default @@ -1,6 +1,6 @@ # # Automatically generated file; DO NOT EDIT. -# Linux/i386 3.9.0-rc6 Kernel Configuration +# Linux/i386 3.9.0-rc8 Kernel Configuration # # CONFIG_64BIT is not set CONFIG_X86_32=y @@ -2651,6 +2651,7 @@ CONFIG_RT2800USB_RT35XX=y CONFIG_RT2800USB_RT53XX=y CONFIG_RT2800USB_UNKNOWN=y CONFIG_RT2800_LIB=m +CONFIG_RT2X00_LIB_MMIO=m CONFIG_RT2X00_LIB_PCI=m CONFIG_RT2X00_LIB_USB=m CONFIG_RT2X00_LIB=m @@ -6320,3 +6321,4 @@ CONFIG_CORDIC=m CONFIG_DDR=y CONFIG_MPILIB=m CONFIG_OID_REGISTRY=m +CONFIG_UCS2_STRING=y diff --git a/config/i386/desktop b/config/i386/desktop index 67c76e3..559d94a 100644 --- a/config/i386/desktop +++ b/config/i386/desktop @@ -1,6 +1,6 @@ # # Automatically generated file; DO NOT EDIT. -# Linux/i386 3.9.0-rc6 Kernel Configuration +# Linux/i386 3.9.0-rc8 Kernel Configuration # # CONFIG_64BIT is not set CONFIG_X86_32=y @@ -2599,6 +2599,7 @@ CONFIG_RT2800USB_RT35XX=y CONFIG_RT2800USB_RT53XX=y CONFIG_RT2800USB_UNKNOWN=y CONFIG_RT2800_LIB=m +CONFIG_RT2X00_LIB_MMIO=m CONFIG_RT2X00_LIB_PCI=m CONFIG_RT2X00_LIB_USB=m CONFIG_RT2X00_LIB=m @@ -6189,3 +6190,4 @@ CONFIG_CORDIC=m CONFIG_DDR=y CONFIG_MPILIB=m CONFIG_OID_REGISTRY=m +CONFIG_UCS2_STRING=y diff --git a/config/i386/ec2 b/config/i386/ec2 index c7bbdad..f5cbc8c 100644 --- a/config/i386/ec2 +++ b/config/i386/ec2 @@ -1,6 +1,6 @@ # # Automatically generated file; DO NOT EDIT. -# Linux/i386 3.9.0-rc6 Kernel Configuration +# Linux/i386 3.9.0-rc8 Kernel Configuration # # CONFIG_64BIT is not set CONFIG_X86_32=y diff --git a/config/i386/pae b/config/i386/pae index a803ea2..e9055fa 100644 --- a/config/i386/pae +++ b/config/i386/pae @@ -1,6 +1,6 @@ # # Automatically generated file; DO NOT EDIT. -# Linux/i386 3.9.0-rc6 Kernel Configuration +# Linux/i386 3.9.0-rc8 Kernel Configuration # # CONFIG_64BIT is not set CONFIG_X86_32=y @@ -2600,6 +2600,7 @@ CONFIG_RT2800USB_RT35XX=y CONFIG_RT2800USB_RT53XX=y CONFIG_RT2800USB_UNKNOWN=y CONFIG_RT2800_LIB=m +CONFIG_RT2X00_LIB_MMIO=m CONFIG_RT2X00_LIB_PCI=m CONFIG_RT2X00_LIB_USB=m CONFIG_RT2X00_LIB=m @@ -6188,3 +6189,4 @@ CONFIG_CORDIC=m CONFIG_DDR=y CONFIG_MPILIB=m CONFIG_OID_REGISTRY=m +CONFIG_UCS2_STRING=y diff --git a/config/i386/trace b/config/i386/trace index b293615..c6e6f1e 100644 --- a/config/i386/trace +++ b/config/i386/trace @@ -1,6 +1,6 @@ # # Automatically generated file; DO NOT EDIT. -# Linux/i386 3.9.0-rc6 Kernel Configuration +# Linux/i386 3.9.0-rc8 Kernel Configuration # # CONFIG_64BIT is not set CONFIG_X86_32=y @@ -2601,6 +2601,7 @@ CONFIG_RT2800USB_RT35XX=y CONFIG_RT2800USB_RT53XX=y CONFIG_RT2800USB_UNKNOWN=y CONFIG_RT2800_LIB=m +CONFIG_RT2X00_LIB_MMIO=m CONFIG_RT2X00_LIB_PCI=m CONFIG_RT2X00_LIB_USB=m CONFIG_RT2X00_LIB=m @@ -6198,3 +6199,4 @@ CONFIG_CORDIC=m CONFIG_DDR=y CONFIG_MPILIB=m CONFIG_OID_REGISTRY=m +CONFIG_UCS2_STRING=y diff --git a/config/i386/xen b/config/i386/xen index 366970a..bfd7891 100644 --- a/config/i386/xen +++ b/config/i386/xen @@ -1,6 +1,6 @@ # # Automatically generated file; DO NOT EDIT. -# Linux/i386 3.9.0-rc6 Kernel Configuration +# Linux/i386 3.9.0-rc8 Kernel Configuration # # CONFIG_64BIT is not set CONFIG_X86_32=y @@ -2427,6 +2427,7 @@ CONFIG_RT2800USB_RT35XX=y CONFIG_RT2800USB_RT53XX=y CONFIG_RT2800USB_UNKNOWN=y CONFIG_RT2800_LIB=m +CONFIG_RT2X00_LIB_MMIO=m CONFIG_RT2X00_LIB_PCI=m CONFIG_RT2X00_LIB_USB=m CONFIG_RT2X00_LIB=m @@ -5972,3 +5973,4 @@ CONFIG_CORDIC=m CONFIG_DDR=y CONFIG_MPILIB=m CONFIG_OID_REGISTRY=m +CONFIG_UCS2_STRING=y diff --git a/config/ia64/debug b/config/ia64/debug index ebc0bc8..ea4baf9 100644 --- a/config/ia64/debug +++ b/config/ia64/debug @@ -1,6 +1,6 @@ # # Automatically generated file; DO NOT EDIT. -# Linux/ia64 3.9.0-rc6 Kernel Configuration +# Linux/ia64 3.9.0-rc8 Kernel Configuration # CONFIG_SUSE_KERNEL=y # CONFIG_SUSE_KERNEL_SUPPORTED is not set @@ -2200,6 +2200,7 @@ CONFIG_RT2800USB_RT35XX=y CONFIG_RT2800USB_RT53XX=y CONFIG_RT2800USB_UNKNOWN=y CONFIG_RT2800_LIB=m +CONFIG_RT2X00_LIB_MMIO=m CONFIG_RT2X00_LIB_PCI=m CONFIG_RT2X00_LIB_USB=m CONFIG_RT2X00_LIB=m @@ -5326,4 +5327,5 @@ CONFIG_CORDIC=m CONFIG_DDR=y CONFIG_MPILIB=m CONFIG_OID_REGISTRY=m +CONFIG_UCS2_STRING=y CONFIG_IOMMU_HELPER=y diff --git a/config/ia64/default b/config/ia64/default index 2412df1..95ba2b5 100644 --- a/config/ia64/default +++ b/config/ia64/default @@ -1,6 +1,6 @@ # # Automatically generated file; DO NOT EDIT. -# Linux/ia64 3.9.0-rc6 Kernel Configuration +# Linux/ia64 3.9.0-rc8 Kernel Configuration # CONFIG_SUSE_KERNEL=y # CONFIG_SUSE_KERNEL_SUPPORTED is not set @@ -2190,6 +2190,7 @@ CONFIG_RT2800USB_RT35XX=y CONFIG_RT2800USB_RT53XX=y CONFIG_RT2800USB_UNKNOWN=y CONFIG_RT2800_LIB=m +CONFIG_RT2X00_LIB_MMIO=m CONFIG_RT2X00_LIB_PCI=m CONFIG_RT2X00_LIB_USB=m CONFIG_RT2X00_LIB=m @@ -5312,4 +5313,5 @@ CONFIG_CORDIC=m CONFIG_DDR=y CONFIG_MPILIB=m CONFIG_OID_REGISTRY=m +CONFIG_UCS2_STRING=y CONFIG_IOMMU_HELPER=y diff --git a/config/ia64/trace b/config/ia64/trace index 2dca262..a60ee4c 100644 --- a/config/ia64/trace +++ b/config/ia64/trace @@ -1,6 +1,6 @@ # # Automatically generated file; DO NOT EDIT. -# Linux/ia64 3.9.0-rc6 Kernel Configuration +# Linux/ia64 3.9.0-rc8 Kernel Configuration # CONFIG_SUSE_KERNEL=y # CONFIG_SUSE_KERNEL_SUPPORTED is not set @@ -2190,6 +2190,7 @@ CONFIG_RT2800USB_RT35XX=y CONFIG_RT2800USB_RT53XX=y CONFIG_RT2800USB_UNKNOWN=y CONFIG_RT2800_LIB=m +CONFIG_RT2X00_LIB_MMIO=m CONFIG_RT2X00_LIB_PCI=m CONFIG_RT2X00_LIB_USB=m CONFIG_RT2X00_LIB=m @@ -5312,4 +5313,5 @@ CONFIG_CORDIC=m CONFIG_DDR=y CONFIG_MPILIB=m CONFIG_OID_REGISTRY=m +CONFIG_UCS2_STRING=y CONFIG_IOMMU_HELPER=y diff --git a/config/ppc/default b/config/ppc/default index 5ce3876..8ed0ded 100644 --- a/config/ppc/default +++ b/config/ppc/default @@ -1,6 +1,6 @@ # # Automatically generated file; DO NOT EDIT. -# Linux/powerpc 3.9.0-rc6 Kernel Configuration +# Linux/powerpc 3.9.0-rc8 Kernel Configuration # # CONFIG_PPC64 is not set @@ -2139,6 +2139,7 @@ CONFIG_RT2800USB_RT35XX=y CONFIG_RT2800USB_RT53XX=y CONFIG_RT2800USB_UNKNOWN=y CONFIG_RT2800_LIB=m +CONFIG_RT2X00_LIB_MMIO=m CONFIG_RT2X00_LIB_PCI=m CONFIG_RT2X00_LIB_USB=m CONFIG_RT2X00_LIB=m diff --git a/config/ppc64/debug b/config/ppc64/debug index b68d2ae..23d4309 100644 --- a/config/ppc64/debug +++ b/config/ppc64/debug @@ -1,6 +1,6 @@ # # Automatically generated file; DO NOT EDIT. -# Linux/powerpc 3.9.0-rc6 Kernel Configuration +# Linux/powerpc 3.9.0-rc8 Kernel Configuration # CONFIG_PPC64=y @@ -2266,6 +2266,7 @@ CONFIG_RT2800USB_RT35XX=y CONFIG_RT2800USB_RT53XX=y CONFIG_RT2800USB_UNKNOWN=y CONFIG_RT2800_LIB=m +CONFIG_RT2X00_LIB_MMIO=m CONFIG_RT2X00_LIB_PCI=m CONFIG_RT2X00_LIB_USB=m CONFIG_RT2X00_LIB=m diff --git a/config/ppc64/default b/config/ppc64/default index 3ddccfd..8f57ee9 100644 --- a/config/ppc64/default +++ b/config/ppc64/default @@ -1,6 +1,6 @@ # # Automatically generated file; DO NOT EDIT. -# Linux/powerpc 3.9.0-rc6 Kernel Configuration +# Linux/powerpc 3.9.0-rc8 Kernel Configuration # CONFIG_PPC64=y @@ -2257,6 +2257,7 @@ CONFIG_RT2800USB_RT35XX=y CONFIG_RT2800USB_RT53XX=y CONFIG_RT2800USB_UNKNOWN=y CONFIG_RT2800_LIB=m +CONFIG_RT2X00_LIB_MMIO=m CONFIG_RT2X00_LIB_PCI=m CONFIG_RT2X00_LIB_USB=m CONFIG_RT2X00_LIB=m diff --git a/config/ppc64/trace b/config/ppc64/trace index c8496e4..1533797 100644 --- a/config/ppc64/trace +++ b/config/ppc64/trace @@ -1,6 +1,6 @@ # # Automatically generated file; DO NOT EDIT. -# Linux/powerpc 3.9.0-rc6 Kernel Configuration +# Linux/powerpc 3.9.0-rc8 Kernel Configuration # CONFIG_PPC64=y @@ -2257,6 +2257,7 @@ CONFIG_RT2800USB_RT35XX=y CONFIG_RT2800USB_RT53XX=y CONFIG_RT2800USB_UNKNOWN=y CONFIG_RT2800_LIB=m +CONFIG_RT2X00_LIB_MMIO=m CONFIG_RT2X00_LIB_PCI=m CONFIG_RT2X00_LIB_USB=m CONFIG_RT2X00_LIB=m diff --git a/config/s390/s390 b/config/s390/s390 index 520f150..3d860ce 100644 --- a/config/s390/s390 +++ b/config/s390/s390 @@ -1,6 +1,6 @@ # # Automatically generated file; DO NOT EDIT. -# Linux/s390 3.9.0-rc6 Kernel Configuration +# Linux/s390 3.9.0-rc8 Kernel Configuration # CONFIG_MMU=y CONFIG_ZONE_DMA=y diff --git a/config/s390/trace b/config/s390/trace index 193ef6d..8fe96bb 100644 --- a/config/s390/trace +++ b/config/s390/trace @@ -1,6 +1,6 @@ # # Automatically generated file; DO NOT EDIT. -# Linux/s390 3.9.0-rc6 Kernel Configuration +# Linux/s390 3.9.0-rc8 Kernel Configuration # CONFIG_MMU=y CONFIG_ZONE_DMA=y diff --git a/config/s390x/default b/config/s390x/default index fa1029f..ee75fac 100644 --- a/config/s390x/default +++ b/config/s390x/default @@ -1,6 +1,6 @@ # # Automatically generated file; DO NOT EDIT. -# Linux/s390 3.9.0-rc6 Kernel Configuration +# Linux/s390 3.9.0-rc8 Kernel Configuration # CONFIG_MMU=y CONFIG_ZONE_DMA=y diff --git a/config/s390x/trace b/config/s390x/trace index 5727c73..ab14973 100644 --- a/config/s390x/trace +++ b/config/s390x/trace @@ -1,6 +1,6 @@ # # Automatically generated file; DO NOT EDIT. -# Linux/s390 3.9.0-rc6 Kernel Configuration +# Linux/s390 3.9.0-rc8 Kernel Configuration # CONFIG_MMU=y CONFIG_ZONE_DMA=y diff --git a/config/x86_64/debug b/config/x86_64/debug index 48c4f98..9bea296 100644 --- a/config/x86_64/debug +++ b/config/x86_64/debug @@ -1,6 +1,6 @@ # # Automatically generated file; DO NOT EDIT. -# Linux/x86_64 3.9.0-rc6 Kernel Configuration +# Linux/x86_64 3.9.0-rc8 Kernel Configuration # CONFIG_64BIT=y CONFIG_X86_64=y @@ -2560,6 +2560,7 @@ CONFIG_RT2800USB_RT35XX=y CONFIG_RT2800USB_RT53XX=y CONFIG_RT2800USB_UNKNOWN=y CONFIG_RT2800_LIB=m +CONFIG_RT2X00_LIB_MMIO=m CONFIG_RT2X00_LIB_PCI=m CONFIG_RT2X00_LIB_USB=m CONFIG_RT2X00_LIB=m @@ -6105,3 +6106,4 @@ CONFIG_CORDIC=m CONFIG_DDR=y CONFIG_MPILIB=m CONFIG_OID_REGISTRY=m +CONFIG_UCS2_STRING=y diff --git a/config/x86_64/default b/config/x86_64/default index 628b122..c7ae74a 100644 --- a/config/x86_64/default +++ b/config/x86_64/default @@ -1,6 +1,6 @@ # # Automatically generated file; DO NOT EDIT. -# Linux/x86_64 3.9.0-rc6 Kernel Configuration +# Linux/x86_64 3.9.0-rc8 Kernel Configuration # CONFIG_64BIT=y CONFIG_X86_64=y @@ -2552,6 +2552,7 @@ CONFIG_RT2800USB_RT35XX=y CONFIG_RT2800USB_RT53XX=y CONFIG_RT2800USB_UNKNOWN=y CONFIG_RT2800_LIB=m +CONFIG_RT2X00_LIB_MMIO=m CONFIG_RT2X00_LIB_PCI=m CONFIG_RT2X00_LIB_USB=m CONFIG_RT2X00_LIB=m @@ -6127,3 +6128,4 @@ CONFIG_CORDIC=m CONFIG_DDR=y CONFIG_MPILIB=m CONFIG_OID_REGISTRY=m +CONFIG_UCS2_STRING=y diff --git a/config/x86_64/desktop b/config/x86_64/desktop index 68a4dfd..eb8324e 100644 --- a/config/x86_64/desktop +++ b/config/x86_64/desktop @@ -1,6 +1,6 @@ # # Automatically generated file; DO NOT EDIT. -# Linux/x86_64 3.9.0-rc6 Kernel Configuration +# Linux/x86_64 3.9.0-rc8 Kernel Configuration # CONFIG_64BIT=y CONFIG_X86_64=y @@ -2551,6 +2551,7 @@ CONFIG_RT2800USB_RT35XX=y CONFIG_RT2800USB_RT53XX=y CONFIG_RT2800USB_UNKNOWN=y CONFIG_RT2800_LIB=m +CONFIG_RT2X00_LIB_MMIO=m CONFIG_RT2X00_LIB_PCI=m CONFIG_RT2X00_LIB_USB=m CONFIG_RT2X00_LIB=m @@ -6128,3 +6129,4 @@ CONFIG_CORDIC=m CONFIG_DDR=y CONFIG_MPILIB=m CONFIG_OID_REGISTRY=m +CONFIG_UCS2_STRING=y diff --git a/config/x86_64/ec2 b/config/x86_64/ec2 index 0f59650..c549d09 100644 --- a/config/x86_64/ec2 +++ b/config/x86_64/ec2 @@ -1,6 +1,6 @@ # # Automatically generated file; DO NOT EDIT. -# Linux/x86_64 3.9.0-rc6 Kernel Configuration +# Linux/x86_64 3.9.0-rc8 Kernel Configuration # CONFIG_64BIT=y CONFIG_X86_64=y diff --git a/config/x86_64/trace b/config/x86_64/trace index c4ee2fe..4ad2356 100644 --- a/config/x86_64/trace +++ b/config/x86_64/trace @@ -1,6 +1,6 @@ # # Automatically generated file; DO NOT EDIT. -# Linux/x86_64 3.9.0-rc6 Kernel Configuration +# Linux/x86_64 3.9.0-rc8 Kernel Configuration # CONFIG_64BIT=y CONFIG_X86_64=y @@ -2553,6 +2553,7 @@ CONFIG_RT2800USB_RT35XX=y CONFIG_RT2800USB_RT53XX=y CONFIG_RT2800USB_UNKNOWN=y CONFIG_RT2800_LIB=m +CONFIG_RT2X00_LIB_MMIO=m CONFIG_RT2X00_LIB_PCI=m CONFIG_RT2X00_LIB_USB=m CONFIG_RT2X00_LIB=m @@ -6137,3 +6138,4 @@ CONFIG_CORDIC=m CONFIG_DDR=y CONFIG_MPILIB=m CONFIG_OID_REGISTRY=m +CONFIG_UCS2_STRING=y diff --git a/config/x86_64/xen b/config/x86_64/xen index e42be1f..4fea94a 100644 --- a/config/x86_64/xen +++ b/config/x86_64/xen @@ -1,6 +1,6 @@ # # Automatically generated file; DO NOT EDIT. -# Linux/x86_64 3.9.0-rc6 Kernel Configuration +# Linux/x86_64 3.9.0-rc8 Kernel Configuration # CONFIG_64BIT=y CONFIG_X86_64=y @@ -2401,6 +2401,7 @@ CONFIG_RT2800USB_RT35XX=y CONFIG_RT2800USB_RT53XX=y CONFIG_RT2800USB_UNKNOWN=y CONFIG_RT2800_LIB=m +CONFIG_RT2X00_LIB_MMIO=m CONFIG_RT2X00_LIB_PCI=m CONFIG_RT2X00_LIB_USB=m CONFIG_RT2X00_LIB=m @@ -5926,3 +5927,4 @@ CONFIG_CORDIC=m CONFIG_DDR=y CONFIG_MPILIB=m CONFIG_OID_REGISTRY=m +CONFIG_UCS2_STRING=y diff --git a/patches.arch/arm-fix-build-ux500-module.diff b/patches.arch/arm-fix-build-ux500-module.diff deleted file mode 100644 index 6c11032..0000000 --- a/patches.arch/arm-fix-build-ux500-module.diff +++ /dev/null @@ -1,18 +0,0 @@ -From: dmueller@suse.com -Subject: Fix syntax error in ux500 driver -Patch-mainline: no - -Fix syntax error in ux500 driver - -Signed-off-by: Dirk Mueller ---- linux-3.6-rc7-master/drivers/crypto/ux500/cryp/cryp_core.c -+++ linux-3.6-rc7-master/drivers/crypto/ux500/cryp/cryp_core.c -@@ -1750,7 +1750,7 @@ - .shutdown = ux500_cryp_shutdown, - .driver = { - .owner = THIS_MODULE, -- .name = "cryp1" -+ .name = "cryp1", - .pm = &ux500_cryp_pm, - } - }; diff --git a/patches.xen/xen-x86-EFI b/patches.xen/xen-x86-EFI index 92e3185..1c23a68 100644 --- a/patches.xen/xen-x86-EFI +++ b/patches.xen/xen-x86-EFI @@ -3,18 +3,29 @@ From: jbeulich@novell.com Patch-mainline: n/a References: fate#311376, fate#311529, bnc#578927, bnc#628554 ---- head.orig/arch/x86/Kconfig 2013-03-25 16:36:53.000000000 +0100 -+++ head/arch/x86/Kconfig 2013-03-25 16:37:10.000000000 +0100 +--- + arch/x86/Kconfig | 4 + arch/x86/include/mach-xen/asm/setup.h | 6 + arch/x86/kernel/setup-xen.c | 2 + arch/x86/platform/efi/Makefile | 2 + arch/x86/platform/efi/efi-xen.c | 547 ++++++++++++++++++++++++++++++++++ + drivers/rtc/Kconfig | 2 + drivers/xen/console/console.c | 5 + include/linux/efi.h | 4 + 8 files changed, 569 insertions(+), 3 deletions(-) + +--- a/arch/x86/Kconfig ++++ b/arch/x86/Kconfig @@ -1594,7 +1594,7 @@ config X86_SMAP config EFI bool "EFI runtime service support" - depends on ACPI && !XEN + depends on ACPI && !XEN_UNPRIVILEGED_GUEST + select UCS2_STRING ---help--- This enables the kernel to use EFI runtime services that are - available (such as the EFI variable services). -@@ -1608,7 +1608,7 @@ config EFI +@@ -1609,7 +1609,7 @@ config EFI config EFI_STUB bool "EFI stub support" @@ -23,8 +34,8 @@ References: fate#311376, fate#311529, bnc#578927, bnc#628554 ---help--- This kernel feature allows a bzImage to be loaded directly by EFI firmware without the use of a bootloader. ---- head.orig/arch/x86/include/mach-xen/asm/setup.h 2011-02-01 14:54:13.000000000 +0100 -+++ head/arch/x86/include/mach-xen/asm/setup.h 2011-07-04 12:32:43.000000000 +0200 +--- a/arch/x86/include/mach-xen/asm/setup.h ++++ b/arch/x86/include/mach-xen/asm/setup.h @@ -3,6 +3,12 @@ void xen_start_kernel(void); void xen_arch_setup(void); @@ -38,8 +49,8 @@ References: fate#311376, fate#311529, bnc#578927, bnc#628554 #endif #include_next ---- head.orig/arch/x86/kernel/setup-xen.c 2013-03-25 16:33:28.000000000 +0100 -+++ head/arch/x86/kernel/setup-xen.c 2013-03-25 16:37:16.000000000 +0100 +--- a/arch/x86/kernel/setup-xen.c ++++ b/arch/x86/kernel/setup-xen.c @@ -1066,6 +1066,8 @@ void __init setup_arch(char **cmdline_p) xen_start_info->console.dom0.info_size); xen_start_info->console.domU.mfn = 0; @@ -49,15 +60,15 @@ References: fate#311376, fate#311529, bnc#578927, bnc#628554 } else screen_info.orig_video_isVGA = 0; copy_edid(); ---- head.orig/arch/x86/platform/efi/Makefile 2012-12-11 04:30:57.000000000 +0100 -+++ head/arch/x86/platform/efi/Makefile 2012-12-04 14:49:35.000000000 +0100 +--- a/arch/x86/platform/efi/Makefile ++++ b/arch/x86/platform/efi/Makefile @@ -1,2 +1,4 @@ obj-$(CONFIG_EFI) += efi.o efi_$(BITS).o efi_stub_$(BITS).o obj-$(CONFIG_ACPI_BGRT) += efi-bgrt.o +ccflags-$(CONFIG_XEN) += -fshort-wchar +disabled-obj-$(CONFIG_XEN) := efi_%$(BITS).o ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ head/arch/x86/platform/efi/efi-xen.c 2013-02-05 11:21:21.000000000 +0100 +--- /dev/null ++++ b/arch/x86/platform/efi/efi-xen.c @@ -0,0 +1,547 @@ +/* + * Common EFI (Extensible Firmware Interface) support functions @@ -606,8 +617,8 @@ References: fate#311376, fate#311529, bnc#578927, bnc#628554 + info->mem.size = 0; + return HYPERVISOR_platform_op(&op) ? 0 : info->mem.attr; +} ---- head.orig/drivers/rtc/Kconfig 2013-03-21 11:15:03.000000000 +0100 -+++ head/drivers/rtc/Kconfig 2013-03-25 16:37:24.000000000 +0100 +--- a/drivers/rtc/Kconfig ++++ b/drivers/rtc/Kconfig @@ -691,7 +691,7 @@ config RTC_DRV_DA9055 config RTC_DRV_EFI @@ -617,9 +628,9 @@ References: fate#311376, fate#311529, bnc#578927, bnc#628554 help If you say yes here you will get support for the EFI Real Time Clock. ---- head.orig/drivers/xen/console/console.c 2012-03-22 14:31:13.000000000 +0100 -+++ head/drivers/xen/console/console.c 2012-03-22 15:29:12.000000000 +0100 -@@ -307,6 +307,7 @@ void __init dom0_init_screen_info(const +--- a/drivers/xen/console/console.c ++++ b/drivers/xen/console/console.c +@@ -307,6 +307,7 @@ void __init dom0_init_screen_info(const break; case XEN_VGATYPE_VESA_LFB: @@ -627,7 +638,7 @@ References: fate#311376, fate#311529, bnc#578927, bnc#628554 if (size < offsetof(struct dom0_vga_console_info, u.vesa_lfb.gbl_caps)) break; -@@ -325,6 +326,10 @@ void __init dom0_init_screen_info(const +@@ -325,6 +326,10 @@ void __init dom0_init_screen_info(const screen_info.blue_pos = info->u.vesa_lfb.blue_pos; screen_info.rsvd_size = info->u.vesa_lfb.rsvd_size; screen_info.rsvd_pos = info->u.vesa_lfb.rsvd_pos; @@ -638,9 +649,9 @@ References: fate#311376, fate#311529, bnc#578927, bnc#628554 if (size >= offsetof(struct dom0_vga_console_info, u.vesa_lfb.gbl_caps) + sizeof(info->u.vesa_lfb.gbl_caps)) ---- head.orig/include/linux/efi.h 2013-03-21 11:15:20.000000000 +0100 -+++ head/include/linux/efi.h 2013-01-10 12:03:08.000000000 +0100 -@@ -527,7 +527,9 @@ typedef struct { +--- a/include/linux/efi.h ++++ b/include/linux/efi.h +@@ -528,7 +528,9 @@ typedef struct { * All runtime access to EFI goes through this structure: */ extern struct efi { @@ -650,7 +661,7 @@ References: fate#311376, fate#311529, bnc#578927, bnc#628554 unsigned int runtime_version; /* Runtime services version */ unsigned long mps; /* MPS table */ unsigned long acpi; /* ACPI table (IA64 ext 0.71) */ -@@ -549,8 +551,10 @@ extern struct efi { +@@ -550,8 +552,10 @@ extern struct efi { efi_update_capsule_t *update_capsule; efi_query_capsule_caps_t *query_capsule_caps; efi_get_next_high_mono_count_t *get_next_high_mono_count; diff --git a/patches.xen/xen3-auto-xen-kconfig.diff b/patches.xen/xen3-auto-xen-kconfig.diff index ad592c6..85b8250 100644 --- a/patches.xen/xen3-auto-xen-kconfig.diff +++ b/patches.xen/xen3-auto-xen-kconfig.diff @@ -4,8 +4,22 @@ From: xen-devel@lists.xen.org Patch-mainline: n/a Acked-by: jbeulich@suse.com ---- head.orig/arch/x86/Kconfig 2013-03-21 11:15:32.000000000 +0100 -+++ head/arch/x86/Kconfig 2013-03-21 11:53:02.000000000 +0100 +--- + arch/x86/Kconfig | 99 ++++++++-- + arch/x86/Kconfig.cpu | 3 + arch/x86/Kconfig.debug | 2 + drivers/acpi/Kconfig | 10 + + drivers/char/Kconfig | 2 + drivers/char/tpm/Kconfig | 9 + drivers/cpufreq/Kconfig | 1 + drivers/tty/serial/8250/Kconfig | 1 + drivers/xen/Kconfig | 392 +++++++++++++++++++++++++++++++++++++++- + fs/Kconfig | 1 + kernel/Kconfig.preempt | 1 + 11 files changed, 498 insertions(+), 23 deletions(-) + +--- a/arch/x86/Kconfig ++++ b/arch/x86/Kconfig @@ -240,7 +240,17 @@ config X86_64_SMP config X86_HT @@ -214,10 +228,10 @@ Acked-by: jbeulich@suse.com bool "EFI runtime service support" - depends on ACPI + depends on ACPI && !XEN + select UCS2_STRING ---help--- This enables the kernel to use EFI runtime services that are - available (such as the EFI variable services). -@@ -1605,6 +1649,7 @@ source kernel/Kconfig.hz +@@ -1606,6 +1650,7 @@ source kernel/Kconfig.hz config KEXEC bool "kexec system call" @@ -225,7 +239,7 @@ Acked-by: jbeulich@suse.com ---help--- kexec is a system call that implements the ability to shutdown your current kernel, and to start another kernel. It is like a reboot -@@ -1622,6 +1667,7 @@ config KEXEC +@@ -1623,6 +1668,7 @@ config KEXEC config CRASH_DUMP bool "kernel crash dumps" depends on X86_64 || (X86_32 && HIGHMEM) @@ -233,7 +247,7 @@ Acked-by: jbeulich@suse.com ---help--- Generate crash dump after being started by kexec. This should be normally only set in special crash dump kernels -@@ -1784,6 +1830,7 @@ config COMPAT_VDSO +@@ -1785,6 +1831,7 @@ config COMPAT_VDSO def_bool y prompt "Compat VDSO support" depends on X86_32 || IA32_EMULATION @@ -241,7 +255,7 @@ Acked-by: jbeulich@suse.com ---help--- Map the 32-bit VDSO to the predictable old-style address too. -@@ -1851,6 +1898,7 @@ config USE_PERCPU_NUMA_NODE_ID +@@ -1852,6 +1899,7 @@ config USE_PERCPU_NUMA_NODE_ID depends on NUMA menu "Power management and ACPI options" @@ -249,7 +263,7 @@ Acked-by: jbeulich@suse.com config ARCH_HIBERNATION_HEADER def_bool y -@@ -1868,7 +1916,7 @@ config X86_APM_BOOT +@@ -1869,7 +1917,7 @@ config X86_APM_BOOT menuconfig APM tristate "APM (Advanced Power Management) BIOS support" @@ -258,7 +272,7 @@ Acked-by: jbeulich@suse.com ---help--- APM is a BIOS specification for saving power using several different techniques. This is mostly useful for battery powered laptops with -@@ -2030,6 +2078,7 @@ choice +@@ -2031,6 +2079,7 @@ choice config PCI_GOBIOS bool "BIOS" @@ -266,7 +280,7 @@ Acked-by: jbeulich@suse.com config PCI_GOMMCONFIG bool "MMConfig" -@@ -2041,6 +2090,13 @@ config PCI_GOOLPC +@@ -2042,6 +2091,13 @@ config PCI_GOOLPC bool "OLPC XO-1" depends on OLPC @@ -280,7 +294,7 @@ Acked-by: jbeulich@suse.com config PCI_GOANY bool "Any" -@@ -2048,7 +2104,7 @@ endchoice +@@ -2049,7 +2105,7 @@ endchoice config PCI_BIOS def_bool y @@ -289,7 +303,7 @@ Acked-by: jbeulich@suse.com # x86-64 doesn't support PCI BIOS access from long mode so always go direct. config PCI_DIRECT -@@ -2089,6 +2145,22 @@ config PCI_CNB20LE_QUIRK +@@ -2090,6 +2146,22 @@ config PCI_CNB20LE_QUIRK You should say N unless you know you need this. @@ -312,7 +326,7 @@ Acked-by: jbeulich@suse.com source "drivers/pci/pcie/Kconfig" source "drivers/pci/Kconfig" -@@ -2105,6 +2177,7 @@ if X86_32 +@@ -2106,6 +2178,7 @@ if X86_32 config ISA bool "ISA support" @@ -320,7 +334,7 @@ Acked-by: jbeulich@suse.com ---help--- Find out whether you have ISA slots on your motherboard. ISA is the name of a bus system, i.e. the way the CPU talks to the other stuff -@@ -2335,7 +2408,9 @@ source "net/Kconfig" +@@ -2336,7 +2409,9 @@ source "net/Kconfig" source "drivers/Kconfig" @@ -330,15 +344,15 @@ Acked-by: jbeulich@suse.com source "fs/Kconfig" -@@ -2347,4 +2422,6 @@ source "crypto/Kconfig" +@@ -2348,4 +2423,6 @@ source "crypto/Kconfig" source "arch/x86/kvm/Kconfig" +source "drivers/xen/Kconfig" + source "lib/Kconfig" ---- head.orig/arch/x86/Kconfig.cpu 2013-02-19 00:58:34.000000000 +0100 -+++ head/arch/x86/Kconfig.cpu 2013-01-08 09:10:04.000000000 +0100 +--- a/arch/x86/Kconfig.cpu ++++ b/arch/x86/Kconfig.cpu @@ -319,7 +319,7 @@ config X86_PPRO_FENCE config X86_F00F_BUG @@ -356,8 +370,8 @@ Acked-by: jbeulich@suse.com config X86_CMPXCHG64 def_bool y ---- head.orig/arch/x86/Kconfig.debug 2012-10-01 01:47:46.000000000 +0200 -+++ head/arch/x86/Kconfig.debug 2012-02-08 10:28:21.000000000 +0100 +--- a/arch/x86/Kconfig.debug ++++ b/arch/x86/Kconfig.debug @@ -122,7 +122,7 @@ config DEBUG_NX_TEST config DOUBLEFAULT default y @@ -367,8 +381,8 @@ Acked-by: jbeulich@suse.com ---help--- This option allows trapping of rare doublefault exceptions that would otherwise cause a system to silently reboot. Disabling this ---- head.orig/drivers/acpi/Kconfig 2013-03-21 11:14:44.000000000 +0100 -+++ head/drivers/acpi/Kconfig 2013-03-21 11:52:45.000000000 +0100 +--- a/drivers/acpi/Kconfig ++++ b/drivers/acpi/Kconfig @@ -319,6 +319,7 @@ config ACPI_PCI_SLOT config X86_PM_TIMER bool "Power Management Timer Support" if EXPERT @@ -391,8 +405,8 @@ Acked-by: jbeulich@suse.com + depends on (X86 || IA64) && XEN + default y endif # ACPI ---- head.orig/drivers/char/Kconfig 2013-03-21 11:15:32.000000000 +0100 -+++ head/drivers/char/Kconfig 2013-03-21 11:52:40.000000000 +0100 +--- a/drivers/char/Kconfig ++++ b/drivers/char/Kconfig @@ -520,7 +520,7 @@ config MAX_RAW_DEVS config HPET bool "HPET - High Precision Event Timer" if (X86 || IA64) @@ -402,8 +416,8 @@ Acked-by: jbeulich@suse.com help If you say Y here, you will have a miscdevice named "/dev/hpet/". Each open selects one of the timers supported by the HPET. The timers are ---- head.orig/drivers/char/tpm/Kconfig 2013-03-21 11:14:46.000000000 +0100 -+++ head/drivers/char/tpm/Kconfig 2013-03-21 11:52:29.000000000 +0100 +--- a/drivers/char/tpm/Kconfig ++++ b/drivers/char/tpm/Kconfig @@ -91,4 +91,13 @@ config TCG_ST33_I2C To compile this driver as a module, choose M here; the module will be called tpm_stm_st33_i2c. @@ -418,8 +432,8 @@ Acked-by: jbeulich@suse.com + will be called tpm_xenu. + endif # TCG_TPM ---- head.orig/drivers/cpufreq/Kconfig 2013-03-21 11:14:46.000000000 +0100 -+++ head/drivers/cpufreq/Kconfig 2011-06-30 15:36:01.000000000 +0200 +--- a/drivers/cpufreq/Kconfig ++++ b/drivers/cpufreq/Kconfig @@ -2,6 +2,7 @@ menu "CPU Frequency scaling" config CPU_FREQ @@ -428,8 +442,8 @@ Acked-by: jbeulich@suse.com help CPU Frequency scaling allows you to change the clock speed of CPUs on the fly. This is a nice method to save power, because ---- head.orig/drivers/tty/serial/8250/Kconfig 2013-03-21 11:15:10.000000000 +0100 -+++ head/drivers/tty/serial/8250/Kconfig 2012-02-08 10:28:04.000000000 +0100 +--- a/drivers/tty/serial/8250/Kconfig ++++ b/drivers/tty/serial/8250/Kconfig @@ -5,6 +5,7 @@ config SERIAL_8250 @@ -438,8 +452,8 @@ Acked-by: jbeulich@suse.com select SERIAL_CORE ---help--- This selects whether you want to include the driver for the standard ---- head.orig/drivers/xen/Kconfig 2013-03-21 11:15:18.000000000 +0100 -+++ head/drivers/xen/Kconfig 2012-10-31 10:43:26.000000000 +0100 +--- a/drivers/xen/Kconfig ++++ b/drivers/xen/Kconfig @@ -1,9 +1,381 @@ +# +# This Kconfig describe xen options @@ -848,8 +862,8 @@ Acked-by: jbeulich@suse.com If in doubt, say yes. config XEN_DEV_EVTCHN ---- head.orig/fs/Kconfig 2013-03-21 11:15:32.000000000 +0100 -+++ head/fs/Kconfig 2013-01-30 10:32:38.000000000 +0100 +--- a/fs/Kconfig ++++ b/fs/Kconfig @@ -160,6 +160,7 @@ config HUGETLBFS bool "HugeTLB file system support" depends on X86 || IA64 || SPARC64 || (S390 && 64BIT) || \ @@ -858,8 +872,8 @@ Acked-by: jbeulich@suse.com help hugetlbfs is a filesystem backing for HugeTLB pages, based on ramfs. For architectures that support it, say Y here and read ---- head.orig/kernel/Kconfig.preempt 2013-03-21 11:15:32.000000000 +0100 -+++ head/kernel/Kconfig.preempt 2012-04-10 15:16:13.000000000 +0200 +--- a/kernel/Kconfig.preempt ++++ b/kernel/Kconfig.preempt @@ -36,6 +36,7 @@ config PREEMPT_VOLUNTARY config PREEMPT diff --git a/patches.xen/xen3-patch-2.6.23 b/patches.xen/xen3-patch-2.6.23 index 4eeb1cc..ad2b085 100644 --- a/patches.xen/xen3-patch-2.6.23 +++ b/patches.xen/xen3-patch-2.6.23 @@ -5,8 +5,125 @@ Patch-mainline: 2.6.23 Automatically created from "patches.kernel.org/patch-2.6.23" by xen-port-patches.py Acked-by: jbeulich@novell.com ---- head.orig/arch/x86/Kbuild 2012-07-21 22:58:29.000000000 +0200 -+++ head/arch/x86/Kbuild 2012-06-13 15:13:30.000000000 +0200 +--- + arch/x86/Kbuild | 2 + arch/x86/ia32/ia32entry-xen.S | 8 + arch/x86/include/asm/thread_info.h | 3 + arch/x86/include/asm/xen/interface.h | 25 - + arch/x86/include/mach-xen/asm/fixmap_32.h | 2 + arch/x86/include/mach-xen/asm/fixmap_64.h | 10 + arch/x86/include/mach-xen/asm/highmem.h | 3 + arch/x86/include/mach-xen/asm/maddr_32.h | 1 + arch/x86/include/mach-xen/asm/mmu_context_32.h | 6 + arch/x86/include/mach-xen/asm/mmu_context_64.h | 4 + arch/x86/include/mach-xen/asm/pgalloc_32.h | 8 + arch/x86/include/mach-xen/asm/pgalloc_64.h | 6 + arch/x86/include/mach-xen/asm/pgtable-3level.h | 17 - + arch/x86/include/mach-xen/asm/pgtable_32.h | 70 +---- + arch/x86/include/mach-xen/asm/pgtable_64.h | 33 -- + arch/x86/include/mach-xen/asm/processor_32.h | 17 - + arch/x86/include/mach-xen/asm/processor_64.h | 17 - + arch/x86/include/mach-xen/asm/tlbflush_32.h | 6 + arch/x86/include/mach-xen/asm/tlbflush_64.h | 6 + arch/x86/kernel/apic/io_apic-xen.c | 79 ++++- + arch/x86/kernel/asm-offsets.c | 4 + arch/x86/kernel/cpu/common-xen.c | 4 + arch/x86/kernel/cpu/mtrr/main-xen.c | 2 + arch/x86/kernel/e820-xen.c | 150 +++++----- + arch/x86/kernel/early_printk-xen.c | 9 + arch/x86/kernel/entry_32-xen.S | 3 + arch/x86/kernel/entry_32.S | 4 + arch/x86/kernel/entry_64-xen.S | 6 + arch/x86/kernel/head64-xen.c | 2 + arch/x86/kernel/head_32-xen.S | 49 +-- + arch/x86/kernel/head_64-xen.S | 44 +-- + arch/x86/kernel/ldt-xen.c | 4 + arch/x86/kernel/microcode_core-xen.c | 1 + arch/x86/kernel/pci-dma-xen.c | 2 + arch/x86/kernel/process_32-xen.c | 78 +++-- + arch/x86/kernel/process_64-xen.c | 10 + arch/x86/kernel/setup_32-xen.c | 25 - + arch/x86/kernel/setup_64-xen.c | 33 +- + arch/x86/kernel/smp_32-xen.c | 5 + arch/x86/kernel/smp_64-xen.c | 16 - + arch/x86/kernel/time-xen.c | 55 --- + arch/x86/kernel/traps_32-xen.c | 85 ++++-- + arch/x86/kernel/traps_64-xen.c | 21 + + arch/x86/kernel/vsyscall_64-xen.c | 22 - + arch/x86/mach-xen/setup.c | 17 + + arch/x86/mm/fault_32-xen.c | 41 +- + arch/x86/mm/fault_64-xen.c | 57 ++-- + arch/x86/mm/highmem_32-xen.c | 7 + arch/x86/mm/init_32-xen.c | 18 - + arch/x86/mm/init_64-xen.c | 72 ++--- + arch/x86/mm/ioremap-xen.c | 3 + arch/x86/mm/pageattr_64-xen.c | 33 +- + arch/x86/mm/pgtable_32-xen.c | 24 - + arch/x86/oprofile/xenoprof.c | 2 + arch/x86/vdso/vdso32/note.S | 6 + arch/x86/xen/Kconfig | 2 + arch/x86/xen/xen-head.S | 4 + drivers/Makefile | 2 + drivers/block/Kconfig | 4 + drivers/block/Makefile | 2 + drivers/net/Kconfig | 4 + drivers/net/Makefile | 2 + drivers/tty/hvc/Kconfig | 2 + drivers/xen/Kconfig | 3 + drivers/xen/Makefile | 16 - + drivers/xen/balloon/balloon.c | 4 + drivers/xen/blkback/blkback.c | 2 + drivers/xen/blkback/common.h | 3 + drivers/xen/blkback/interface.c | 2 + drivers/xen/blkback/xenbus.c | 6 + drivers/xen/blkfront/blkfront.c | 10 + drivers/xen/blkfront/block.h | 4 + drivers/xen/blkfront/vbd.c | 2 + drivers/xen/blktap/common.h | 3 + drivers/xen/blktap/interface.c | 2 + drivers/xen/blktap/xenbus.c | 6 + drivers/xen/blktap2/blktap.h | 1 + drivers/xen/blktap2/control.c | 12 + drivers/xen/blktap2/device.c | 7 + drivers/xen/blktap2/sysfs.c | 30 +- + drivers/xen/core/gnttab.c | 1 + drivers/xen/core/reboot.c | 1 + drivers/xen/core/xen_proc.c | 10 + drivers/xen/netback/common.h | 1 + drivers/xen/scsiback/common.h | 1 + drivers/xen/scsiback/interface.c | 2 + drivers/xen/scsifront/scsifront.c | 8 + drivers/xen/sfc_netback/accel_solarflare.c | 1 + drivers/xen/sfc_netutil/accel_util.c | 1 + drivers/xen/tpmback/common.h | 1 + drivers/xen/tpmback/interface.c | 3 + drivers/xen/usbback/usbback.h | 1 + drivers/xen/usbfront/xenbus.c | 2 + drivers/xen/util.c | 47 --- + drivers/xen/xenbus/xenbus_backend_client.c | 2 + drivers/xen/xenbus/xenbus_client.c | 346 ++++++++++++++++++++++++- + drivers/xen/xenbus/xenbus_comms.c | 27 + + drivers/xen/xenbus/xenbus_dev.c | 8 + drivers/xen/xenbus/xenbus_probe.c | 100 +++++-- + drivers/xen/xenbus/xenbus_probe.h | 4 + drivers/xen/xenbus/xenbus_probe_backend.c | 2 + drivers/xen/xenbus/xenbus_xs.c | 26 + + drivers/xen/xenoprof/xenoprofile.c | 1 + include/linux/elfnote.h | 2 + include/linux/page-flags.h | 11 + include/xen/driver_util.h | 12 + include/xen/features.h | 3 + include/xen/interface/arch-x86/xen.h | 3 + include/xen/interface/event_channel.h | 1 + include/xen/interface/io/netif.h | 14 + + include/xen/interface/memory.h | 3 + include/xen/interface/sched.h | 2 + include/xen/interface/version.h | 9 + include/xen/interface/xen.h | 18 + + include/xen/xenbus.h | 32 ++ + +--- a/arch/x86/Kbuild ++++ b/arch/x86/Kbuild @@ -1,7 +1,7 @@ obj-$(CONFIG_KVM) += kvm/ @@ -16,1852 +133,2246 @@ Acked-by: jbeulich@novell.com # lguest paravirtualization support obj-$(CONFIG_LGUEST_GUEST) += lguest/ ---- head.orig/arch/x86/kernel/asm-offsets.c 2012-12-11 04:30:57.000000000 +0100 -+++ head/arch/x86/kernel/asm-offsets.c 2011-04-13 12:42:43.000000000 +0200 -@@ -17,7 +17,7 @@ - #include - #include +--- a/arch/x86/ia32/ia32entry-xen.S ++++ b/arch/x86/ia32/ia32entry-xen.S +@@ -105,7 +105,7 @@ ENTRY(ia32_sysenter_target) + movl $VSYSCALL32_SYSEXIT,8(%rsp) + movq %rax,(%rsp) + cld +- SAVE_ARGS 0,0,0 ++ SAVE_ARGS 0,0,1 + /* no need to do an access_ok check here because rbp has been + 32bit zero extended */ + 1: movl (%rbp),%r9d +@@ -244,7 +244,7 @@ ia32_badarg: + */ --#ifdef CONFIG_XEN -+#if defined(CONFIG_XEN) || defined(CONFIG_PARAVIRT_XEN) - #include + ENTRY(ia32_syscall) +- CFI_STARTPROC simple ++ CFI_STARTPROC32 simple + CFI_SIGNAL_FRAME + CFI_DEF_CFA rsp,SS+8-RIP+16 + /*CFI_REL_OFFSET ss,SS-RIP+16*/ +@@ -280,6 +280,7 @@ ia32_sysret: + + ia32_tracesys: + SAVE_REST ++ CLEAR_RREGS + movq $-ENOSYS,RAX(%rsp) /* really needed? */ + movq %rsp,%rdi /* &pt_regs -> arg1 */ + call syscall_trace_enter +@@ -476,7 +477,7 @@ ia32_sys_call_table: + .quad sys_init_module + .quad sys_delete_module + .quad quiet_ni_syscall /* 130 get_kernel_syms */ +- .quad sys_quotactl ++ .quad sys32_quotactl + .quad sys_getpgid + .quad sys_fchdir + .quad quiet_ni_syscall /* bdflush */ +@@ -669,4 +670,5 @@ ia32_sys_call_table: + .quad compat_sys_signalfd + .quad compat_sys_timerfd + .quad sys_eventfd ++ .quad sys32_fallocate + ia32_syscall_end: +--- a/arch/x86/include/asm/thread_info.h ++++ b/arch/x86/include/asm/thread_info.h +@@ -157,7 +157,8 @@ struct thread_info { + #define _TIF_WORK_CTXSW_PREV (_TIF_WORK_CTXSW|_TIF_USER_RETURN_NOTIFY) + #define _TIF_WORK_CTXSW_NEXT (_TIF_WORK_CTXSW|_TIF_DEBUG) + #else +-#define _TIF_WORK_CTXSW _TIF_DEBUG ++#define _TIF_WORK_CTXSW_NEXT (_TIF_NOTSC | _TIF_DEBUG) ++#define _TIF_WORK_CTXSW_PREV (_TIF_NOTSC) #endif -@@ -55,7 +55,7 @@ void common(void) { - OFFSET(PV_MMU_read_cr2, pv_mmu_ops, read_cr2); + #define PREEMPT_ACTIVE 0x10000000 +--- a/arch/x86/include/asm/xen/interface.h ++++ b/arch/x86/include/asm/xen/interface.h +@@ -10,17 +10,20 @@ + #define _ASM_X86_XEN_INTERFACE_H + + #ifdef __XEN__ +-#define __DEFINE_GUEST_HANDLE(name, type) \ ++#define ___DEFINE_XEN_GUEST_HANDLE(name, type) \ + typedef struct { type *p; } __guest_handle_ ## name + #else +-#define __DEFINE_GUEST_HANDLE(name, type) \ ++#define ___DEFINE_XEN_GUEST_HANDLE(name, type) \ + typedef type * __guest_handle_ ## name #endif --#ifdef CONFIG_XEN -+#ifdef CONFIG_PARAVIRT_XEN - BLANK(); - OFFSET(XEN_vcpu_info_mask, vcpu_info, evtchn_upcall_mask); - OFFSET(XEN_vcpu_info_pending, vcpu_info, evtchn_upcall_pending); ---- head.orig/arch/x86/kernel/cpu/common-xen.c 2012-07-05 11:42:58.000000000 +0200 -+++ head/arch/x86/kernel/cpu/common-xen.c 2012-07-05 10:49:35.000000000 +0200 -@@ -369,6 +369,8 @@ static void __cpuinit generic_identify(s - if ( xlvl >= 0x80000004 ) - get_model_name(c); /* Default name */ - } -+ -+ init_scattered_cpuid_features(c); - } ++#define __DEFINE_XEN_GUEST_HANDLE(name, type) \ ++ ___DEFINE_XEN_GUEST_HANDLE(name, type); \ ++ ___DEFINE_XEN_GUEST_HANDLE(const_##name, const type) + #define DEFINE_GUEST_HANDLE_STRUCT(name) \ +- __DEFINE_GUEST_HANDLE(name, struct name) +-#define DEFINE_GUEST_HANDLE(name) __DEFINE_GUEST_HANDLE(name, name) +-#define GUEST_HANDLE(name) __guest_handle_ ## name ++ __DEFINE_XEN_GUEST_HANDLE(name, struct name) ++#define DEFINE_XEN_GUEST_HANDLE(name) __DEFINE_XEN_GUEST_HANDLE(name, name) ++#define XEN_GUEST_HANDLE(name) __guest_handle_ ## name - early_intel_workaround(c); -@@ -620,7 +622,6 @@ extern int nsc_init_cpu(void); - extern int amd_init_cpu(void); - extern int centaur_init_cpu(void); - extern int transmeta_init_cpu(void); --extern int rise_init_cpu(void); - extern int nexgen_init_cpu(void); - extern int umc_init_cpu(void); + #ifdef __XEN__ + #if defined(__i386__) +@@ -54,16 +57,6 @@ typedef unsigned long xen_pfn_t; + #define PRI_xen_pfn "lx" + typedef unsigned long xen_ulong_t; + #define PRI_xen_ulong "lx" +-/* Guest handles for primitive C types. */ +-__DEFINE_GUEST_HANDLE(uchar, unsigned char); +-__DEFINE_GUEST_HANDLE(uint, unsigned int); +-DEFINE_GUEST_HANDLE(char); +-DEFINE_GUEST_HANDLE(int); +-DEFINE_GUEST_HANDLE(void); +-DEFINE_GUEST_HANDLE(uint64_t); +-DEFINE_GUEST_HANDLE(uint32_t); +-DEFINE_GUEST_HANDLE(xen_pfn_t); +-DEFINE_GUEST_HANDLE(xen_ulong_t); + #endif -@@ -632,7 +633,6 @@ void __init early_cpu_init(void) - amd_init_cpu(); - centaur_init_cpu(); - transmeta_init_cpu(); -- rise_init_cpu(); - nexgen_init_cpu(); - umc_init_cpu(); - early_cpu_detect(); ---- head.orig/arch/x86/kernel/cpu/mtrr/main-xen.c 2011-01-31 17:32:29.000000000 +0100 -+++ head/arch/x86/kernel/cpu/mtrr/main-xen.c 2011-01-31 17:49:31.000000000 +0100 -@@ -167,7 +167,7 @@ mtrr_del(int reg, unsigned long base, un - EXPORT_SYMBOL(mtrr_add); - EXPORT_SYMBOL(mtrr_del); + #ifndef HYPERVISOR_VIRT_START +@@ -75,7 +68,7 @@ DEFINE_GUEST_HANDLE(xen_ulong_t); + #define MACH2PHYS_NR_ENTRIES ((MACH2PHYS_VIRT_END-MACH2PHYS_VIRT_START)>>__MACH2PHYS_SHIFT) --__init void mtrr_bp_init(void) -+void __init mtrr_bp_init(void) - { + /* Maximum number of virtual CPUs in multi-processor guests. */ +-#define MAX_VIRT_CPUS 32 ++#define XEN_LEGACY_MAX_VCPUS 32 + + /* + * SEGMENT DESCRIPTOR TABLES +--- a/arch/x86/include/mach-xen/asm/fixmap_32.h ++++ b/arch/x86/include/mach-xen/asm/fixmap_32.h +@@ -53,6 +53,8 @@ extern unsigned long __FIXADDR_TOP; + enum fixed_addresses { + FIX_HOLE, + FIX_VDSO, ++ FIX_DBGP_BASE, ++ FIX_EARLYCON_MEM_BASE, + #ifdef CONFIG_X86_LOCAL_APIC + FIX_APIC_BASE, /* local (CPU) APIC) -- required for SMP or not */ + #endif +--- a/arch/x86/include/mach-xen/asm/fixmap_64.h ++++ b/arch/x86/include/mach-xen/asm/fixmap_64.h +@@ -23,9 +23,9 @@ + * compile time, but to set the physical address only + * in the boot process. + * +- * these 'compile-time allocated' memory buffers are +- * fixed-size 4k pages. (or larger if used with an increment +- * highger than 1) use fixmap_set(idx,phys) to associate ++ * These 'compile-time allocated' memory buffers are ++ * fixed-size 4k pages (or larger if used with an increment ++ * higher than 1). Use set_fixmap(idx,phys) to associate + * physical memory with fixmap indices. + * + * TLB entries of such buffers will not be flushed across +@@ -36,6 +36,8 @@ enum fixed_addresses { + VSYSCALL_LAST_PAGE, + VSYSCALL_FIRST_PAGE = VSYSCALL_LAST_PAGE + ((VSYSCALL_END-VSYSCALL_START) >> PAGE_SHIFT) - 1, + VSYSCALL_HPET, ++ FIX_DBGP_BASE, ++ FIX_EARLYCON_MEM_BASE, + FIX_HPET_BASE, + #ifdef CONFIG_X86_LOCAL_APIC + FIX_APIC_BASE, /* local (CPU) APIC) -- required for SMP or not */ +@@ -105,7 +107,7 @@ static __always_inline unsigned long fix + if (idx >= __end_of_fixed_addresses) + __this_fixmap_does_not_exist(); + +- return __fix_to_virt(idx); ++ return __fix_to_virt(idx); } ---- head.orig/arch/x86/kernel/entry_32.S 2013-03-21 12:25:22.000000000 +0100 -+++ head/arch/x86/kernel/entry_32.S 2013-03-21 14:16:45.000000000 +0100 -@@ -994,7 +994,7 @@ END(spurious_interrupt_bug) - */ - .popsection + #endif +--- a/arch/x86/include/mach-xen/asm/highmem.h ++++ b/arch/x86/include/mach-xen/asm/highmem.h +@@ -75,8 +75,7 @@ struct page *kmap_atomic_to_page(void *p --#ifdef CONFIG_XEN -+#ifdef CONFIG_PARAVIRT_XEN - /* Xen doesn't set %esp to be precisely what the normal sysenter - entrypoint expects, so fix it up before using the normal path. */ - ENTRY(xen_sysenter_target) -@@ -1084,7 +1084,7 @@ ENDPROC(xen_failsafe_callback) - BUILD_INTERRUPT3(xen_hvm_callback_vector, HYPERVISOR_CALLBACK_VECTOR, - xen_evtchn_do_upcall) + #define kmap_atomic_pte(page, type) \ + kmap_atomic_prot(page, type, \ +- test_bit(PG_pinned, &(page)->flags) \ +- ? PAGE_KERNEL_RO : kmap_prot) ++ PagePinned(page) ? PAGE_KERNEL_RO : kmap_prot) --#endif /* CONFIG_XEN */ -+#endif /* CONFIG_PARAVIRT_XEN */ + #define flush_cache_kmaps() do { } while (0) - #if IS_ENABLED(CONFIG_HYPERV) +--- a/arch/x86/include/mach-xen/asm/maddr_32.h ++++ b/arch/x86/include/mach-xen/asm/maddr_32.h +@@ -155,6 +155,7 @@ static inline paddr_t pte_machine_to_phy ---- head.orig/arch/x86/kernel/entry_32-xen.S 2011-01-31 17:32:29.000000000 +0100 -+++ head/arch/x86/kernel/entry_32-xen.S 2013-01-30 10:36:16.000000000 +0100 -@@ -452,9 +452,6 @@ restore_nocheck_notrace: - 1: INTERRUPT_RETURN - .section .fixup,"ax" - iret_exc: --#ifndef CONFIG_XEN -- ENABLE_INTERRUPTS(CLBR_NONE) --#endif - pushl $0 # no error code - pushl $do_iret_error - jmp error_code ---- head.orig/arch/x86/kernel/head_32-xen.S 2012-12-06 16:06:48.000000000 +0100 -+++ head/arch/x86/kernel/head_32-xen.S 2012-12-06 16:07:12.000000000 +0100 -@@ -93,7 +93,10 @@ ENTRY(_stext) - /* - * BSS section - */ --.section ".bss.page_aligned","w" -+.section ".bss.page_aligned","wa" -+ .align PAGE_SIZE_asm -+ENTRY(swapper_pg_pmd) -+ .fill 1024,4,0 - ENTRY(empty_zero_page) - .fill 4096,1,0 + #ifdef CONFIG_X86_PAE + #define __pte_ma(x) ((pte_t) { (x), (maddr_t)(x) >> 32 } ) ++extern unsigned long long __supported_pte_mask; + static inline pte_t pfn_pte_ma(unsigned long page_nr, pgprot_t pgprot) + { + pte_t pte; +--- a/arch/x86/include/mach-xen/asm/mmu_context_32.h ++++ b/arch/x86/include/mach-xen/asm/mmu_context_32.h +@@ -16,7 +16,7 @@ void mm_pin_all(void); + static inline void xen_activate_mm(struct mm_struct *prev, + struct mm_struct *next) + { +- if (!test_bit(PG_pinned, &virt_to_page(next->pgd)->flags)) ++ if (!PagePinned(virt_to_page(next->pgd))) + mm_pin(next); + } -@@ -155,36 +158,36 @@ ENTRY(empty_zero_page) - #endif /* CONFIG_XEN_COMPAT <= 0x030002 */ +@@ -51,6 +51,8 @@ static inline void __prepare_arch_switch + : : "r" (0) ); + } ++void leave_mm(unsigned long cpu); ++ + static inline void switch_mm(struct mm_struct *prev, + struct mm_struct *next, + struct task_struct *tsk) +@@ -60,7 +62,7 @@ static inline void switch_mm(struct mm_s -- ELFNOTE(Xen, XEN_ELFNOTE_GUEST_OS, .asciz, "linux") -- ELFNOTE(Xen, XEN_ELFNOTE_GUEST_VERSION, .asciz, "2.6") -- ELFNOTE(Xen, XEN_ELFNOTE_XEN_VERSION, .asciz, "xen-3.0") -- ELFNOTE(Xen, XEN_ELFNOTE_VIRT_BASE, .long, __PAGE_OFFSET) -+ ELFNOTE(Xen, XEN_ELFNOTE_GUEST_OS, .asciz "linux") -+ ELFNOTE(Xen, XEN_ELFNOTE_GUEST_VERSION, .asciz "2.6") -+ ELFNOTE(Xen, XEN_ELFNOTE_XEN_VERSION, .asciz "xen-3.0") -+ ELFNOTE(Xen, XEN_ELFNOTE_VIRT_BASE, .long __PAGE_OFFSET) - #if CONFIG_XEN_COMPAT <= 0x030002 -- ELFNOTE(Xen, XEN_ELFNOTE_PADDR_OFFSET, .long, __PAGE_OFFSET) -+ ELFNOTE(Xen, XEN_ELFNOTE_PADDR_OFFSET, .long __PAGE_OFFSET) - #else -- ELFNOTE(Xen, XEN_ELFNOTE_PADDR_OFFSET, .long, 0) -+ ELFNOTE(Xen, XEN_ELFNOTE_PADDR_OFFSET, .long 0) - #endif -- ELFNOTE(Xen, XEN_ELFNOTE_ENTRY, .long, startup_32) -- ELFNOTE(Xen, XEN_ELFNOTE_HYPERCALL_PAGE, .long, hypercall_page) -- ELFNOTE(Xen, XEN_ELFNOTE_HV_START_LOW, .long, HYPERVISOR_VIRT_START) -- ELFNOTE(Xen, XEN_ELFNOTE_FEATURES, .ascii, "writable_page_tables"; -- .ascii "|writable_descriptor_tables"; -- .ascii "|auto_translated_physmap"; -- .ascii "|pae_pgdir_above_4gb"; -- .ascii "|supervisor_mode_kernel"; -- .asciz XEN_DOM0_CAP_STR) -- ELFNOTE(Xen, XEN_ELFNOTE_SUPPORTED_FEATURES, .long, XEN_DOM0_CAP | -+ ELFNOTE(Xen, XEN_ELFNOTE_ENTRY, .long startup_32) -+ ELFNOTE(Xen, XEN_ELFNOTE_HYPERCALL_PAGE, .long hypercall_page) -+ ELFNOTE(Xen, XEN_ELFNOTE_HV_START_LOW, .long HYPERVISOR_VIRT_START) -+ ELFNOTE(Xen, XEN_ELFNOTE_FEATURES, .ascii "writable_page_tables"; -+ .ascii "|writable_descriptor_tables"; -+ .ascii "|auto_translated_physmap"; -+ .ascii "|pae_pgdir_above_4gb"; -+ .ascii "|supervisor_mode_kernel"; -+ .asciz XEN_DOM0_CAP_STR) -+ ELFNOTE(Xen, XEN_ELFNOTE_SUPPORTED_FEATURES, .long XEN_DOM0_CAP | - (1 << XENFEAT_writable_page_tables) | - (1 << XENFEAT_writable_descriptor_tables) | - (1 << XENFEAT_auto_translated_physmap) | - (1 << XENFEAT_pae_pgdir_above_4gb) | - (1 << XENFEAT_supervisor_mode_kernel)) - #ifdef CONFIG_X86_PAE -- ELFNOTE(Xen, XEN_ELFNOTE_PAE_MODE, .asciz, "yes") -- ELFNOTE(Xen, XEN_ELFNOTE_L1_MFN_VALID, .quad, _PAGE_PRESENT,_PAGE_PRESENT) -+ ELFNOTE(Xen, XEN_ELFNOTE_PAE_MODE, .asciz "yes") -+ ELFNOTE(Xen, XEN_ELFNOTE_L1_MFN_VALID, .quad _PAGE_PRESENT, _PAGE_PRESENT) - #else -- ELFNOTE(Xen, XEN_ELFNOTE_PAE_MODE, .asciz, "no") -- ELFNOTE(Xen, XEN_ELFNOTE_L1_MFN_VALID, .long, _PAGE_PRESENT,_PAGE_PRESENT) -+ ELFNOTE(Xen, XEN_ELFNOTE_PAE_MODE, .asciz "no") -+ ELFNOTE(Xen, XEN_ELFNOTE_L1_MFN_VALID, .long _PAGE_PRESENT, _PAGE_PRESENT) - #endif -- ELFNOTE(Xen, XEN_ELFNOTE_LOADER, .asciz, "generic") -- ELFNOTE(Xen, XEN_ELFNOTE_SUSPEND_CANCEL, .long, 1) -+ ELFNOTE(Xen, XEN_ELFNOTE_LOADER, .asciz "generic") -+ ELFNOTE(Xen, XEN_ELFNOTE_SUSPEND_CANCEL, .long 1) ---- head.orig/arch/x86/kernel/microcode_core-xen.c 2011-12-01 15:01:09.000000000 +0100 -+++ head/arch/x86/kernel/microcode_core-xen.c 2011-01-31 17:49:31.000000000 +0100 -@@ -33,6 +33,7 @@ - #include - #include - #include -+#include - #include - #include - #include ---- head.orig/arch/x86/kernel/pci-dma-xen.c 2011-01-31 17:32:29.000000000 +0100 -+++ head/arch/x86/kernel/pci-dma-xen.c 2011-01-31 17:49:31.000000000 +0100 -@@ -24,7 +24,7 @@ - #include + if (likely(prev != next)) { + BUG_ON(!xen_feature(XENFEAT_writable_page_tables) && +- !test_bit(PG_pinned, &virt_to_page(next->pgd)->flags)); ++ !PagePinned(virt_to_page(next->pgd))); - #ifdef __x86_64__ --#include -+#include + /* stop flush ipis for the previous mm */ + cpu_clear(cpu, prev->cpu_vm_mask); +--- a/arch/x86/include/mach-xen/asm/mmu_context_64.h ++++ b/arch/x86/include/mach-xen/asm/mmu_context_64.h +@@ -76,7 +76,7 @@ static inline void switch_mm(struct mm_s - int iommu_merge __read_mostly = 0; - EXPORT_SYMBOL(iommu_merge); ---- head.orig/arch/x86/kernel/process_32-xen.c 2012-07-05 10:49:20.000000000 +0200 -+++ head/arch/x86/kernel/process_32-xen.c 2012-07-05 10:49:33.000000000 +0200 -@@ -241,6 +241,7 @@ early_param("idle", idle_setup); - void show_regs(struct pt_regs * regs) - { - unsigned long cr0 = 0L, cr2 = 0L, cr3 = 0L, cr4 = 0L; -+ unsigned long d0, d1, d2, d3, d6, d7; + if (likely(prev != next)) { + BUG_ON(!xen_feature(XENFEAT_writable_page_tables) && +- !next->context.pinned); ++ !PagePinned(virt_to_page(next->pgd))); - printk("\n"); - printk("Pid: %d, comm: %20s\n", current->pid, current->comm); -@@ -265,6 +266,17 @@ void show_regs(struct pt_regs * regs) - cr3 = read_cr3(); - cr4 = read_cr4_safe(); - printk("CR0: %08lx CR2: %08lx CR3: %08lx CR4: %08lx\n", cr0, cr2, cr3, cr4); -+ -+ get_debugreg(d0, 0); -+ get_debugreg(d1, 1); -+ get_debugreg(d2, 2); -+ get_debugreg(d3, 3); -+ printk("DR0: %08lx DR1: %08lx DR2: %08lx DR3: %08lx\n", -+ d0, d1, d2, d3); -+ get_debugreg(d6, 6); -+ get_debugreg(d7, 7); -+ printk("DR6: %08lx DR7: %08lx\n", d6, d7); -+ - show_trace(NULL, regs, ®s->esp); - } + /* stop flush ipis for the previous mm */ + cpu_clear(cpu, prev->cpu_vm_mask); +@@ -131,7 +131,7 @@ static inline void switch_mm(struct mm_s -@@ -473,7 +485,30 @@ int dump_task_regs(struct task_struct *t - return 1; + static inline void activate_mm(struct mm_struct *prev, struct mm_struct *next) + { +- if (!next->context.pinned) ++ if (!PagePinned(virt_to_page(next->pgd))) + mm_pin(next); + switch_mm(prev, next, NULL); } +--- a/arch/x86/include/mach-xen/asm/pgalloc_32.h ++++ b/arch/x86/include/mach-xen/asm/pgalloc_32.h +@@ -5,7 +5,7 @@ + #include /* for struct page */ + #include /* for phys_to_virt and page_to_pseudophys */ --static noinline void __switch_to_xtra(struct task_struct *next_p) -+#ifdef CONFIG_SECCOMP -+void hard_disable_TSC(void) -+{ -+ write_cr4(read_cr4() | X86_CR4_TSD); -+} -+void disable_TSC(void) -+{ -+ preempt_disable(); -+ if (!test_and_set_thread_flag(TIF_NOTSC)) -+ /* -+ * Must flip the CPU state synchronously with -+ * TIF_NOTSC in the current running context. -+ */ -+ hard_disable_TSC(); -+ preempt_enable(); -+} -+void hard_enable_TSC(void) -+{ -+ write_cr4(read_cr4() & ~X86_CR4_TSD); -+} -+#endif /* CONFIG_SECCOMP */ -+ -+static noinline void -+__switch_to_xtra(struct task_struct *prev_p, struct task_struct *next_p) +-#define paravirt_alloc_pt(pfn) do { } while (0) ++#define paravirt_alloc_pt(mm, pfn) do { } while (0) + #define paravirt_alloc_pd(pfn) do { } while (0) + #define paravirt_alloc_pd(pfn) do { } while (0) + #define paravirt_alloc_pd_clone(pfn, clonepfn, start, count) do { } while (0) +@@ -14,15 +14,15 @@ + + #define pmd_populate_kernel(mm, pmd, pte) \ + do { \ +- paravirt_alloc_pt(__pa(pte) >> PAGE_SHIFT); \ ++ paravirt_alloc_pt(mm, __pa(pte) >> PAGE_SHIFT); \ + set_pmd(pmd, __pmd(_PAGE_TABLE + __pa(pte))); \ + } while (0) + + #define pmd_populate(mm, pmd, pte) \ + do { \ + unsigned long pfn = page_to_pfn(pte); \ +- paravirt_alloc_pt(pfn); \ +- if (test_bit(PG_pinned, &virt_to_page((mm)->pgd)->flags)) { \ ++ paravirt_alloc_pt(mm, pfn); \ ++ if (PagePinned(virt_to_page((mm)->pgd))) { \ + if (!PageHighMem(pte)) \ + BUG_ON(HYPERVISOR_update_va_mapping( \ + (unsigned long)__va(pfn << PAGE_SHIFT), \ +--- a/arch/x86/include/mach-xen/asm/pgalloc_64.h ++++ b/arch/x86/include/mach-xen/asm/pgalloc_64.h +@@ -21,7 +21,7 @@ static inline void pmd_populate_kernel(s + + static inline void pmd_populate(struct mm_struct *mm, pmd_t *pmd, struct page *pte) { - struct thread_struct *next; +- if (unlikely((mm)->context.pinned)) { ++ if (unlikely(PagePinned(virt_to_page((mm)->pgd)))) { + BUG_ON(HYPERVISOR_update_va_mapping( + (unsigned long)__va(page_to_pfn(pte) << PAGE_SHIFT), + pfn_pte(page_to_pfn(pte), PAGE_KERNEL_RO), 0)); +@@ -33,7 +33,7 @@ static inline void pmd_populate(struct m -@@ -488,33 +523,17 @@ static noinline void __switch_to_xtra(st - set_debugreg(next->debugreg[6], 6); - set_debugreg(next->debugreg[7], 7); - } --} + static inline void pud_populate(struct mm_struct *mm, pud_t *pud, pmd_t *pmd) + { +- if (unlikely((mm)->context.pinned)) { ++ if (unlikely(PagePinned(virt_to_page((mm)->pgd)))) { + BUG_ON(HYPERVISOR_update_va_mapping( + (unsigned long)pmd, + pfn_pte(virt_to_phys(pmd)>>PAGE_SHIFT, +@@ -50,7 +50,7 @@ static inline void pud_populate(struct m + */ + static inline void pgd_populate(struct mm_struct *mm, pgd_t *pgd, pud_t *pud) + { +- if (unlikely((mm)->context.pinned)) { ++ if (unlikely(PagePinned(virt_to_page((mm)->pgd)))) { + BUG_ON(HYPERVISOR_update_va_mapping( + (unsigned long)pud, + pfn_pte(virt_to_phys(pud)>>PAGE_SHIFT, +--- a/arch/x86/include/mach-xen/asm/pgtable-3level.h ++++ b/arch/x86/include/mach-xen/asm/pgtable-3level.h +@@ -23,26 +23,11 @@ + #define pud_present(pud) 1 --/* -- * This function selects if the context switch from prev to next -- * has to tweak the TSC disable bit in the cr4. + /* +- * Is the pte executable? - */ --static inline void disable_tsc(struct task_struct *prev_p, -- struct task_struct *next_p) +-static inline int pte_x(pte_t pte) -{ -- struct thread_info *prev, *next; -- -- /* -- * gcc should eliminate the ->thread_info dereference if -- * has_secure_computing returns 0 at compile time (SECCOMP=n). -- */ -- prev = task_thread_info(prev_p); -- next = task_thread_info(next_p); +- return !(__pte_val(pte) & _PAGE_NX); +-} - -- if (has_secure_computing(prev) || has_secure_computing(next)) { -- /* slow path here */ -- if (has_secure_computing(prev) && -- !has_secure_computing(next)) { -- write_cr4(read_cr4() & ~X86_CR4_TSD); -- } else if (!has_secure_computing(prev) && -- has_secure_computing(next)) -- write_cr4(read_cr4() | X86_CR4_TSD); -+#ifdef CONFIG_SECCOMP -+ if (test_tsk_thread_flag(prev_p, TIF_NOTSC) ^ -+ test_tsk_thread_flag(next_p, TIF_NOTSC)) { -+ /* prev and next are different */ -+ if (test_tsk_thread_flag(next_p, TIF_NOTSC)) -+ hard_disable_TSC(); -+ else -+ hard_enable_TSC(); - } -+#endif +-/* +- * All present user-pages with !NX bit are user-executable: +- */ +-static inline int pte_exec(pte_t pte) +-{ +- return pte_user(pte) && pte_x(pte); +-} +-/* + * All present pages with !NX bit are kernel-executable: + */ + static inline int pte_exec_kernel(pte_t pte) + { +- return pte_x(pte); ++ return !(__pte_val(pte) & _PAGE_NX); } - /* -@@ -655,10 +674,9 @@ struct task_struct fastcall * __switch_t - /* - * Now maybe handle debug registers - */ -- if (unlikely(task_thread_info(next_p)->flags & _TIF_WORK_CTXSW)) -- __switch_to_xtra(next_p); -- -- disable_tsc(prev_p, next_p); -+ if (unlikely(task_thread_info(prev_p)->flags & _TIF_WORK_CTXSW_PREV || -+ task_thread_info(next_p)->flags & _TIF_WORK_CTXSW_NEXT)) -+ __switch_to_xtra(prev_p, next_p); + /* Rules for using set_pte: the pte being assigned *must* be +--- a/arch/x86/include/mach-xen/asm/pgtable_32.h ++++ b/arch/x86/include/mach-xen/asm/pgtable_32.h +@@ -26,9 +26,6 @@ + #include + #include + +-/* Is this pagetable pinned? */ +-#define PG_pinned PG_arch_1 +- + struct vm_area_struct; - /* - * Leave lazy mode, flushing any hypercalls made here. ---- head.orig/arch/x86/kernel/setup_32-xen.c 2012-06-06 13:49:07.000000000 +0200 -+++ head/arch/x86/kernel/setup_32-xen.c 2012-06-06 13:52:42.000000000 +0200 -@@ -114,19 +114,10 @@ static unsigned int highmem_pages = -1; /* - * Setup options +@@ -82,7 +79,7 @@ void paging_init(void); + * area for the same reason. ;) */ --struct drive_info_struct { char dummy[32]; } drive_info; --#if defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_HD) || \ -- defined(CONFIG_BLK_DEV_IDE_MODULE) || defined(CONFIG_BLK_DEV_HD_MODULE) --EXPORT_SYMBOL(drive_info); --#endif - struct screen_info screen_info; - EXPORT_SYMBOL(screen_info); - struct apm_info apm_info; - EXPORT_SYMBOL(apm_info); --struct sys_desc_table_struct { -- unsigned short length; -- unsigned char table[0]; --}; - struct edid_info edid_info; - EXPORT_SYMBOL_GPL(edid_info); - #ifndef CONFIG_XEN -@@ -149,7 +140,7 @@ unsigned long saved_videomode; + #define VMALLOC_OFFSET (8*1024*1024) +-#define VMALLOC_START (((unsigned long) high_memory + vmalloc_earlyreserve + \ ++#define VMALLOC_START (((unsigned long) high_memory + \ + 2*VMALLOC_OFFSET-1) & ~(VMALLOC_OFFSET-1)) + #ifdef CONFIG_HIGHMEM + # define VMALLOC_END (PKMAP_BASE-2*PAGE_SIZE) +@@ -231,8 +228,6 @@ extern unsigned long pg0[]; + * The following only work if pte_present() is true. + * Undefined behaviour if not.. + */ +-static inline int pte_user(pte_t pte) { return (pte).pte_low & _PAGE_USER; } +-static inline int pte_read(pte_t pte) { return (pte).pte_low & _PAGE_USER; } + static inline int pte_dirty(pte_t pte) { return (pte).pte_low & _PAGE_DIRTY; } + static inline int pte_young(pte_t pte) { return (pte).pte_low & _PAGE_ACCESSED; } + static inline int pte_write(pte_t pte) { return (pte).pte_low & _PAGE_RW; } +@@ -243,13 +238,9 @@ static inline int pte_huge(pte_t pte) { + */ + static inline int pte_file(pte_t pte) { return (pte).pte_low & _PAGE_FILE; } - static char __initdata command_line[COMMAND_LINE_SIZE]; +-static inline pte_t pte_rdprotect(pte_t pte) { (pte).pte_low &= ~_PAGE_USER; return pte; } +-static inline pte_t pte_exprotect(pte_t pte) { (pte).pte_low &= ~_PAGE_USER; return pte; } + static inline pte_t pte_mkclean(pte_t pte) { (pte).pte_low &= ~_PAGE_DIRTY; return pte; } + static inline pte_t pte_mkold(pte_t pte) { (pte).pte_low &= ~_PAGE_ACCESSED; return pte; } + static inline pte_t pte_wrprotect(pte_t pte) { (pte).pte_low &= ~_PAGE_RW; return pte; } +-static inline pte_t pte_mkread(pte_t pte) { (pte).pte_low |= _PAGE_USER; return pte; } +-static inline pte_t pte_mkexec(pte_t pte) { (pte).pte_low |= _PAGE_USER; return pte; } + static inline pte_t pte_mkdirty(pte_t pte) { (pte).pte_low |= _PAGE_DIRTY; return pte; } + static inline pte_t pte_mkyoung(pte_t pte) { (pte).pte_low |= _PAGE_ACCESSED; return pte; } + static inline pte_t pte_mkwrite(pte_t pte) { (pte).pte_low |= _PAGE_RW; return pte; } +@@ -295,22 +286,20 @@ static inline pte_t xen_local_ptep_get_a + #define ptep_set_access_flags(vma, address, ptep, entry, dirty) \ + ({ \ + int __changed = !pte_same(*(ptep), entry); \ +- if (__changed && (dirty)) \ +- ptep_establish(vma, address, ptep, entry); \ ++ if (__changed && (dirty)) { \ ++ if ( likely((vma)->vm_mm == current->mm) ) { \ ++ BUG_ON(HYPERVISOR_update_va_mapping(address, \ ++ entry, \ ++ (unsigned long)(vma)->vm_mm->cpu_vm_mask.bits| \ ++ UVMF_INVLPG|UVMF_MULTI)); \ ++ } else { \ ++ xen_l1_entry_update(ptep, entry); \ ++ flush_tlb_page(vma, address); \ ++ } \ ++ } \ + __changed; \ + }) --unsigned char __initdata boot_params[PARAM_SIZE]; -+struct boot_params __initdata boot_params; +-#define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_DIRTY +-#define ptep_test_and_clear_dirty(vma, addr, ptep) ({ \ +- int __ret = 0; \ +- if (pte_dirty(*(ptep))) \ +- __ret = test_and_clear_bit(_PAGE_BIT_DIRTY, \ +- &(ptep)->pte_low); \ +- if (__ret) \ +- pte_update((vma)->vm_mm, addr, ptep); \ +- __ret; \ +-}) +- + #define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_YOUNG + #define ptep_test_and_clear_young(vma, addr, ptep) ({ \ + int __ret = 0; \ +@@ -322,44 +311,13 @@ static inline pte_t xen_local_ptep_get_a + __ret; \ + }) - /* - * Point at the empty zero page to start with. We map the real shared_info -@@ -316,18 +307,18 @@ unsigned long __init find_max_low_pfn(vo - printk(KERN_WARNING "Warning only %ldMB will be used.\n", - MAXMEM>>20); - if (max_pfn > MAX_NONPAE_PFN) -- printk(KERN_WARNING "Use a PAE enabled kernel.\n"); -+ printk(KERN_WARNING "Use a HIGHMEM64G enabled kernel.\n"); +-/* +- * Rules for using ptep_establish: the pte MUST be a user pte, and +- * must be a present->present transition. +- */ +-#define __HAVE_ARCH_PTEP_ESTABLISH +-#define ptep_establish(vma, address, ptep, pteval) \ +-do { \ +- if ( likely((vma)->vm_mm == current->mm) ) { \ +- BUG_ON(HYPERVISOR_update_va_mapping(address, \ +- pteval, \ +- (unsigned long)(vma)->vm_mm->cpu_vm_mask.bits| \ +- UVMF_INVLPG|UVMF_MULTI)); \ +- } else { \ +- xen_l1_entry_update(ptep, pteval); \ +- flush_tlb_page(vma, address); \ +- } \ +-} while (0) +- +-#define __HAVE_ARCH_PTEP_CLEAR_DIRTY_FLUSH +-#define ptep_clear_flush_dirty(vma, address, ptep) \ +-({ \ +- pte_t __pte = *(ptep); \ +- int __dirty = pte_dirty(__pte); \ +- __pte = pte_mkclean(__pte); \ +- if (test_bit(PG_pinned, &virt_to_page((vma)->vm_mm->pgd)->flags)) \ +- (void)ptep_set_access_flags(vma, address, ptep, __pte, __dirty); \ +- else if (__dirty) \ +- (ptep)->pte_low = __pte.pte_low; \ +- __dirty; \ +-}) +- + #define __HAVE_ARCH_PTEP_CLEAR_YOUNG_FLUSH + #define ptep_clear_flush_young(vma, address, ptep) \ + ({ \ + pte_t __pte = *(ptep); \ + int __young = pte_young(__pte); \ + __pte = pte_mkold(__pte); \ +- if (test_bit(PG_pinned, &virt_to_page((vma)->vm_mm->pgd)->flags)) \ ++ if (PagePinned(virt_to_page((vma)->vm_mm->pgd))) \ + (void)ptep_set_access_flags(vma, address, ptep, __pte, __young); \ + else if (__young) \ + (ptep)->pte_low = __pte.pte_low; \ +@@ -383,7 +341,7 @@ static inline pte_t ptep_get_and_clear(s + #define ptep_get_and_clear_full(mm, addr, ptep, full) \ + ((full) ? ({ \ + pte_t __res = *(ptep); \ +- if (test_bit(PG_pinned, &virt_to_page((mm)->pgd)->flags)) \ ++ if (PagePinned(virt_to_page((mm)->pgd))) \ + xen_l1_entry_update(ptep, __pte(0)); \ + else \ + *(ptep) = __pte(0); \ +--- a/arch/x86/include/mach-xen/asm/pgtable_64.h ++++ b/arch/x86/include/mach-xen/asm/pgtable_64.h +@@ -304,7 +304,7 @@ static inline pte_t ptep_get_and_clear_f + { + if (full) { + pte_t pte = *ptep; +- if (mm->context.pinned) ++ if (PagePinned(virt_to_page(mm->pgd))) + xen_l1_entry_update(ptep, __pte(0)); else - printk(KERN_WARNING "Use a HIGHMEM enabled kernel.\n"); - max_pfn = MAXMEM_PFN; - #else /* !CONFIG_HIGHMEM */ --#ifndef CONFIG_X86_PAE -+#ifndef CONFIG_HIGHMEM64G - if (max_pfn > MAX_NONPAE_PFN) { - max_pfn = MAX_NONPAE_PFN; - printk(KERN_WARNING "Warning only 4GB will be used.\n"); -- printk(KERN_WARNING "Use a PAE enabled kernel.\n"); -+ printk(KERN_WARNING "Use a HIGHMEM64G enabled kernel.\n"); - } --#endif /* !CONFIG_X86_PAE */ -+#endif /* !CONFIG_HIGHMEM64G */ - #endif /* !CONFIG_HIGHMEM */ - } else { - if (highmem_pages == -1) -@@ -516,7 +507,7 @@ void __init setup_bootmem_allocator(void - * - * This should all compile down to nothing when NUMA is off. + *ptep = __pte(0); +@@ -333,21 +333,15 @@ static inline pte_t ptep_get_and_clear_f + * Undefined behaviour if not.. */ --void __init remapped_pgdat_init(void) -+static void __init remapped_pgdat_init(void) - { - int nid; - -@@ -591,7 +582,6 @@ void __init setup_arch(char **cmdline_p) - properly. Setting ROOT_DEV to default to /dev/ram0 breaks initrd. - */ - ROOT_DEV = MKDEV(UNNAMED_MAJOR,0); -- drive_info = DRIVE_INFO; - screen_info = SCREEN_INFO; - copy_edid(); - apm_info.bios = APM_BIOS_INFO; -@@ -767,6 +757,8 @@ void __init setup_arch(char **cmdline_p) - * NOTE: at this point the bootmem allocator is fully available. - */ - -+ paravirt_post_allocator_init(); -+ - if (is_initial_xendomain()) - dmi_scan_machine(); - -@@ -814,6 +806,7 @@ void __init setup_arch(char **cmdline_p) - #endif - - e820_register_memory(); -+ e820_mark_nosave_regions(); + #define __LARGE_PTE (_PAGE_PSE|_PAGE_PRESENT) +-static inline int pte_user(pte_t pte) { return __pte_val(pte) & _PAGE_USER; } +-static inline int pte_read(pte_t pte) { return __pte_val(pte) & _PAGE_USER; } +-static inline int pte_exec(pte_t pte) { return !(__pte_val(pte) & _PAGE_NX); } + static inline int pte_dirty(pte_t pte) { return __pte_val(pte) & _PAGE_DIRTY; } + static inline int pte_young(pte_t pte) { return __pte_val(pte) & _PAGE_ACCESSED; } + static inline int pte_write(pte_t pte) { return __pte_val(pte) & _PAGE_RW; } + static inline int pte_file(pte_t pte) { return __pte_val(pte) & _PAGE_FILE; } + static inline int pte_huge(pte_t pte) { return __pte_val(pte) & _PAGE_PSE; } - if (is_initial_xendomain()) { - #ifdef CONFIG_VT ---- head.orig/arch/x86/kernel/smp_32-xen.c 2011-01-31 17:32:29.000000000 +0100 -+++ head/arch/x86/kernel/smp_32-xen.c 2011-01-31 17:49:31.000000000 +0100 -@@ -22,6 +22,7 @@ +-static inline pte_t pte_rdprotect(pte_t pte) { __pte_val(pte) &= ~_PAGE_USER; return pte; } +-static inline pte_t pte_exprotect(pte_t pte) { __pte_val(pte) &= ~_PAGE_USER; return pte; } + static inline pte_t pte_mkclean(pte_t pte) { __pte_val(pte) &= ~_PAGE_DIRTY; return pte; } + static inline pte_t pte_mkold(pte_t pte) { __pte_val(pte) &= ~_PAGE_ACCESSED; return pte; } + static inline pte_t pte_wrprotect(pte_t pte) { __pte_val(pte) &= ~_PAGE_RW; return pte; } +-static inline pte_t pte_mkread(pte_t pte) { __pte_val(pte) |= _PAGE_USER; return pte; } + static inline pte_t pte_mkexec(pte_t pte) { __pte_val(pte) &= ~_PAGE_NX; return pte; } + static inline pte_t pte_mkdirty(pte_t pte) { __pte_val(pte) |= _PAGE_DIRTY; return pte; } + static inline pte_t pte_mkyoung(pte_t pte) { __pte_val(pte) |= _PAGE_ACCESSED; return pte; } +@@ -355,13 +349,6 @@ static inline pte_t pte_mkwrite(pte_t pt + static inline pte_t pte_mkhuge(pte_t pte) { __pte_val(pte) |= _PAGE_PSE; return pte; } + static inline pte_t pte_clrhuge(pte_t pte) { __pte_val(pte) &= ~_PAGE_PSE; return pte; } - #include - #include -+#include - #if 0 - #include - #endif -@@ -217,13 +218,13 @@ static unsigned long flush_va; - static DEFINE_SPINLOCK(tlbstate_lock); +-static inline int ptep_test_and_clear_dirty(struct vm_area_struct *vma, unsigned long addr, pte_t *ptep) +-{ +- if (!pte_dirty(*ptep)) +- return 0; +- return test_and_clear_bit(_PAGE_BIT_DIRTY, &ptep->pte); +-} +- + static inline int ptep_test_and_clear_young(struct vm_area_struct *vma, unsigned long addr, pte_t *ptep) + { + if (!pte_young(*ptep)) +@@ -500,26 +487,13 @@ static inline pte_t pte_modify(pte_t pte + __changed; \ + }) - /* -- * We cannot call mmdrop() because we are in interrupt context, -+ * We cannot call mmdrop() because we are in interrupt context, - * instead update mm->cpu_vm_mask. - * - * We need to reload %cr3 since the page tables may be going - * away from under us.. - */ --static inline void leave_mm (unsigned long cpu) -+void leave_mm(unsigned long cpu) - { - if (per_cpu(cpu_tlbstate, cpu).state == TLBSTATE_OK) - BUG(); ---- head.orig/arch/x86/kernel/time-xen.c 2012-02-10 13:26:34.000000000 +0100 -+++ head/arch/x86/kernel/time-xen.c 2012-02-10 13:26:46.000000000 +0100 -@@ -74,11 +74,12 @@ - #include - #include +-#define __HAVE_ARCH_PTEP_CLEAR_DIRTY_FLUSH +-#define ptep_clear_flush_dirty(vma, address, ptep) \ +-({ \ +- pte_t __pte = *(ptep); \ +- int __dirty = pte_dirty(__pte); \ +- __pte = pte_mkclean(__pte); \ +- if ((vma)->vm_mm->context.pinned) \ +- (void)ptep_set_access_flags(vma, address, ptep, __pte, __dirty); \ +- else if (__dirty) \ +- set_pte(ptep, __pte); \ +- __dirty; \ +-}) +- + #define __HAVE_ARCH_PTEP_CLEAR_YOUNG_FLUSH + #define ptep_clear_flush_young(vma, address, ptep) \ + ({ \ + pte_t __pte = *(ptep); \ + int __young = pte_young(__pte); \ + __pte = pte_mkold(__pte); \ +- if ((vma)->vm_mm->context.pinned) \ ++ if (PagePinned(virt_to_page((vma)->vm_mm->pgd))) \ + (void)ptep_set_access_flags(vma, address, ptep, __pte, __young); \ + else if (__young) \ + set_pte(ptep, __pte); \ +@@ -566,6 +540,8 @@ int xen_change_pte_range(struct mm_struc + #define arch_change_pte_range(mm, pmd, addr, end, newprot, dirty_accountable) \ + xen_change_pte_range(mm, pmd, addr, end, newprot, dirty_accountable) --#ifdef CONFIG_X86_32 - #include - DEFINE_SPINLOCK(i8253_lock); - EXPORT_SYMBOL(i8253_lock); --#else ++pte_t *lookup_address(unsigned long addr); + -+#ifdef CONFIG_X86_64 -+#include - volatile unsigned long __jiffies __section_jiffies = INITIAL_JIFFIES; - #endif + #define io_remap_pfn_range(vma, vaddr, pfn, size, prot) \ + direct_remap_pfn_range(vma,vaddr,pfn,size,prot,DOMID_IO) -@@ -772,56 +773,10 @@ unsigned long read_persistent_clock(void - return retval; +@@ -583,7 +559,6 @@ int xen_change_pte_range(struct mm_struc + (((o) & (1UL << (__VIRTUAL_MASK_SHIFT-1))) ? ((o) | (~__VIRTUAL_MASK)) : (o)) + + #define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_YOUNG +-#define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_DIRTY + #define __HAVE_ARCH_PTEP_GET_AND_CLEAR + #define __HAVE_ARCH_PTEP_GET_AND_CLEAR_FULL + #define __HAVE_ARCH_PTEP_CLEAR_FLUSH +--- a/arch/x86/include/mach-xen/asm/processor_32.h ++++ b/arch/x86/include/mach-xen/asm/processor_32.h +@@ -89,7 +89,6 @@ struct cpuinfo_x86 { + #define X86_VENDOR_UMC 3 + #define X86_VENDOR_NEXGEN 4 + #define X86_VENDOR_CENTAUR 5 +-#define X86_VENDOR_RISE 6 + #define X86_VENDOR_TRANSMETA 7 + #define X86_VENDOR_NSC 8 + #define X86_VENDOR_NUM 9 +@@ -122,6 +121,7 @@ void __init cpu_detect(struct cpuinfo_x8 + extern void identify_boot_cpu(void); + extern void identify_secondary_cpu(struct cpuinfo_x86 *); + extern void print_cpu_info(struct cpuinfo_x86 *); ++extern void init_scattered_cpuid_features(struct cpuinfo_x86 *c); + extern unsigned int init_intel_cacheinfo(struct cpuinfo_x86 *c); + extern unsigned short num_cache_leaves; + +@@ -171,17 +171,6 @@ static inline void clear_in_cr4 (unsigne + write_cr4(cr4); } --static void sync_cmos_clock(unsigned long dummy); -- --static DEFINE_TIMER(sync_cmos_timer, sync_cmos_clock, 0, 0); --int no_sync_cmos_clock; +-/* +- * NSC/Cyrix CPU indexed register access macros +- */ - --static void sync_cmos_clock(unsigned long dummy) --{ -- struct timeval now, next; -- int fail = 1; +-#define getCx86(reg) ({ outb((reg), 0x22); inb(0x23); }) - -- /* -- * If we have an externally synchronized Linux clock, then update -- * CMOS clock accordingly every ~11 minutes. Set_rtc_mmss() has to be -- * called as close as possible to 500 ms before the new second starts. -- * This code is run on a timer. If the clock is set, that timer -- * may not expire at the correct time. Thus, we adjust... -- */ -- if (!ntp_synced()) -- /* -- * Not synced, exit, do not restart a timer (if one is -- * running, let it run out). -- */ -- return; +-#define setCx86(reg, data) do { \ +- outb((reg), 0x22); \ +- outb((data), 0x23); \ +-} while (0) - -- do_gettimeofday(&now); -- if (now.tv_usec >= USEC_AFTER - ((unsigned) TICK_SIZE) / 2 && -- now.tv_usec <= USEC_BEFORE + ((unsigned) TICK_SIZE) / 2) -- fail = set_rtc_mmss(now.tv_sec); + /* Stop speculative execution */ + static inline void sync_core(void) + { +@@ -230,6 +219,10 @@ extern int bootloader_type; + + #define HAVE_ARCH_PICK_MMAP_LAYOUT + ++extern void hard_disable_TSC(void); ++extern void disable_TSC(void); ++extern void hard_enable_TSC(void); ++ + /* + * Size of io_bitmap. + */ +--- a/arch/x86/include/mach-xen/asm/processor_64.h ++++ b/arch/x86/include/mach-xen/asm/processor_64.h +@@ -83,7 +83,6 @@ struct cpuinfo_x86 { + #define X86_VENDOR_UMC 3 + #define X86_VENDOR_NEXGEN 4 + #define X86_VENDOR_CENTAUR 5 +-#define X86_VENDOR_RISE 6 + #define X86_VENDOR_TRANSMETA 7 + #define X86_VENDOR_NUM 8 + #define X86_VENDOR_UNKNOWN 0xff +@@ -100,6 +99,7 @@ extern char ignore_irq13; + + extern void identify_cpu(struct cpuinfo_x86 *); + extern void print_cpu_info(struct cpuinfo_x86 *); ++extern void init_scattered_cpuid_features(struct cpuinfo_x86 *c); + extern unsigned int init_intel_cacheinfo(struct cpuinfo_x86 *c); + extern unsigned short num_cache_leaves; + +@@ -377,12 +377,10 @@ static inline void sync_core(void) + asm volatile("cpuid" : "=a" (tmp) : "0" (1) : "ebx","ecx","edx","memory"); + } + +-#define cpu_has_fpu 1 - -- next.tv_usec = USEC_AFTER - now.tv_usec; -- if (next.tv_usec <= 0) -- next.tv_usec += USEC_PER_SEC; + #define ARCH_HAS_PREFETCH + static inline void prefetch(void *x) + { +- asm volatile("prefetcht0 %0" :: "m" (*(unsigned long *)x)); ++ asm volatile("prefetcht0 (%0)" :: "r" (x)); + } + + #define ARCH_HAS_PREFETCHW 1 +@@ -400,17 +398,6 @@ static inline void prefetchw(void *x) + + #define cpu_relax() rep_nop() + +-/* +- * NSC/Cyrix CPU indexed register access macros +- */ - -- if (!fail) -- next.tv_sec = 659; -- else -- next.tv_sec = 0; +-#define getCx86(reg) ({ outb((reg), 0x22); inb(0x23); }) - -- if (next.tv_usec >= USEC_PER_SEC) { -- next.tv_sec++; -- next.tv_usec -= USEC_PER_SEC; -- } -- mod_timer(&sync_cmos_timer, jiffies + timeval_to_jiffies(&next)); --} +-#define setCx86(reg, data) do { \ +- outb((reg), 0x22); \ +- outb((data), 0x23); \ +-} while (0) - --void notify_arch_cmos_timer(void) -+int update_persistent_clock(struct timespec now) + static inline void serialize_cpu(void) { -- if (!no_sync_cmos_clock) -- mod_timer(&sync_cmos_timer, jiffies + 1); - mod_timer(&sync_xen_wallclock_timer, jiffies + 1); -+ return set_rtc_mmss(now.tv_sec); - } + __asm__ __volatile__ ("cpuid" : : : "ax", "bx", "cx", "dx"); +--- a/arch/x86/include/mach-xen/asm/tlbflush_32.h ++++ b/arch/x86/include/mach-xen/asm/tlbflush_32.h +@@ -91,7 +91,11 @@ struct tlb_state + DECLARE_PER_CPU(struct tlb_state, cpu_tlbstate); + #endif /* SMP */ + +-#define flush_tlb_kernel_range(start, end) flush_tlb_all() ++static inline void flush_tlb_kernel_range(unsigned long start, ++ unsigned long end) ++{ ++ flush_tlb_all(); ++} + + static inline void flush_tlb_pgtables(struct mm_struct *mm, + unsigned long start, unsigned long end) +--- a/arch/x86/include/mach-xen/asm/tlbflush_64.h ++++ b/arch/x86/include/mach-xen/asm/tlbflush_64.h +@@ -89,7 +89,11 @@ static inline void flush_tlb_range(struc - extern void (*late_time_init)(void); ---- head.orig/arch/x86/kernel/traps_32-xen.c 2011-01-31 17:32:29.000000000 +0100 -+++ head/arch/x86/kernel/traps_32-xen.c 2012-06-18 09:23:11.000000000 +0200 -@@ -41,6 +41,10 @@ - #include #endif -+#if defined(CONFIG_EDAC) -+#include -+#endif -+ - #include - #include - #include -@@ -102,36 +106,45 @@ asmlinkage void machine_check(void); - int kstack_depth_to_print = 24; - static unsigned int code_bytes = 64; +-#define flush_tlb_kernel_range(start, end) flush_tlb_all() ++static inline void flush_tlb_kernel_range(unsigned long start, ++ unsigned long end) ++{ ++ flush_tlb_all(); ++} --static inline int valid_stack_ptr(struct thread_info *tinfo, void *p) -+static inline int valid_stack_ptr(struct thread_info *tinfo, void *p, unsigned size) - { - return p > (void *)tinfo && -- p < (void *)tinfo + THREAD_SIZE - 3; -+ p <= (void *)tinfo + THREAD_SIZE - size; + static inline void flush_tlb_pgtables(struct mm_struct *mm, + unsigned long start, unsigned long end) +--- a/arch/x86/kernel/apic/io_apic-xen.c ++++ b/arch/x86/kernel/apic/io_apic-xen.c +@@ -165,7 +165,9 @@ static inline void io_apic_write(unsigne + #endif } -+/* The form of the top of the frame on the stack */ -+struct stack_frame { -+ struct stack_frame *next_frame; -+ unsigned long return_address; -+}; +-#ifndef CONFIG_XEN ++#ifdef CONFIG_XEN ++#define io_apic_modify io_apic_write ++#else + /* + * Re-write a value: to be used for read-modify-write + * cycles where the read already set up the index register. +@@ -175,8 +177,32 @@ static inline void io_apic_modify(unsign + struct io_apic __iomem *io_apic = io_apic_base(apic); + writel(value, &io_apic->data); + } +-#else +-#define io_apic_modify io_apic_write + - static inline unsigned long print_context_stack(struct thread_info *tinfo, - unsigned long *stack, unsigned long ebp, - struct stacktrace_ops *ops, void *data) - { -- unsigned long addr; -- - #ifdef CONFIG_FRAME_POINTER -- while (valid_stack_ptr(tinfo, (void *)ebp)) { -- unsigned long new_ebp; -- addr = *(unsigned long *)(ebp + 4); -+ struct stack_frame *frame = (struct stack_frame *)ebp; -+ while (valid_stack_ptr(tinfo, frame, sizeof(*frame))) { -+ struct stack_frame *next; -+ unsigned long addr; ++static int io_apic_level_ack_pending(unsigned int irq) ++{ ++ struct irq_pin_list *entry; ++ unsigned long flags; ++ int pending = 0; + -+ addr = frame->return_address; - ops->address(data, addr); - /* - * break out of recursive entries (such as - * end_of_stack_stop_unwind_function). Also, - * we can never allow a frame pointer to - * move downwards! -- */ -- new_ebp = *(unsigned long *)ebp; -- if (new_ebp <= ebp) -+ */ -+ next = frame->next_frame; -+ if (next <= frame) - break; -- ebp = new_ebp; -+ frame = next; - } - #else -- while (valid_stack_ptr(tinfo, stack)) { -+ while (valid_stack_ptr(tinfo, stack, sizeof(*stack))) { -+ unsigned long addr; ++ spin_lock_irqsave(&ioapic_lock, flags); ++ entry = irq_2_pin + irq; ++ for (;;) { ++ unsigned int reg; ++ int pin; + - addr = *stack++; - if (__kernel_text_address(addr)) - ops->address(data, addr); -@@ -154,7 +167,7 @@ void dump_trace(struct task_struct *task - if (!stack) { - unsigned long dummy; - stack = &dummy; -- if (task && task != current) -+ if (task != current) - stack = (unsigned long *)task->thread.esp; - } ++ pin = entry->pin; ++ if (pin == -1) ++ break; ++ reg = io_apic_read(entry->apic, 0x10 + pin*2); ++ /* Is the remote IRR bit set? */ ++ pending |= (reg >> 14) & 1; ++ if (!entry->next) ++ break; ++ entry = irq_2_pin + entry->next; ++ } ++ spin_unlock_irqrestore(&ioapic_lock, flags); ++ return pending; ++} + #endif -@@ -213,6 +226,7 @@ static void print_trace_address(void *da + /* +@@ -406,14 +432,12 @@ static void clear_IO_APIC (void) + int skip_ioapic_setup; + int ioapic_force; + +-/* dummy parsing: see setup.c */ +- +-static int __init disable_ioapic_setup(char *str) ++static int __init parse_noapic(char *str) { - printk("%s [<%08lx>] ", (char *)data, addr); - print_symbol("%s\n", addr); -+ touch_nmi_watchdog(); +- skip_ioapic_setup = 1; ++ disable_ioapic_setup(); + return 0; } +-early_param("noapic", disable_ioapic_setup); ++early_param("noapic", parse_noapic); - static struct stacktrace_ops print_trace_ops = { -@@ -396,7 +410,7 @@ void die(const char * str, struct pt_reg - unsigned long esp; - unsigned short ss; - -- report_bug(regs->eip); -+ report_bug(regs->eip, regs); - - printk(KERN_EMERG "%s: %04lx [#%d]\n", str, err & 0xffff, ++die_counter); - #ifdef CONFIG_PREEMPT -@@ -439,6 +453,7 @@ void die(const char * str, struct pt_reg + /* Actually the next is obsolete, but keep it for paranoid reasons -AK */ + static int __init disable_timer_pin_setup(char *arg) +@@ -765,12 +789,15 @@ static struct irq_chip ioapic_chip; - bust_spinlocks(0); - die.lock_owner = -1; -+ add_taint(TAINT_DIE); - spin_unlock_irqrestore(&die.lock, flags); + static void ioapic_register_intr(int irq, unsigned long trigger) + { +- if (trigger) ++ if (trigger) { ++ irq_desc[irq].status |= IRQ_LEVEL; + set_irq_chip_and_handler_name(irq, &ioapic_chip, + handle_fasteoi_irq, "fasteoi"); +- else ++ } else { ++ irq_desc[irq].status &= ~IRQ_LEVEL; + set_irq_chip_and_handler_name(irq, &ioapic_chip, + handle_edge_irq, "edge"); ++ } + } + #else + #define ioapic_register_intr(irq, trigger) evtchn_register_pirq(irq) +@@ -1419,9 +1446,37 @@ static void ack_apic_level(unsigned int + ack_APIC_irq(); - if (!regs) -@@ -523,10 +538,12 @@ fastcall void do_##name(struct pt_regs * - do_trap(trapnr, signr, str, 0, regs, error_code, NULL); \ + /* Now we can move and renable the irq */ +- move_masked_irq(irq); +- if (unlikely(do_unmask_irq)) ++ if (unlikely(do_unmask_irq)) { ++ /* Only migrate the irq if the ack has been received. ++ * ++ * On rare occasions the broadcast level triggered ack gets ++ * delayed going to ioapics, and if we reprogram the ++ * vector while Remote IRR is still set the irq will never ++ * fire again. ++ * ++ * To prevent this scenario we read the Remote IRR bit ++ * of the ioapic. This has two effects. ++ * - On any sane system the read of the ioapic will ++ * flush writes (and acks) going to the ioapic from ++ * this cpu. ++ * - We get to see if the ACK has actually been delivered. ++ * ++ * Based on failed experiments of reprogramming the ++ * ioapic entry from outside of irq context starting ++ * with masking the ioapic entry and then polling until ++ * Remote IRR was clear before reprogramming the ++ * ioapic I don't trust the Remote IRR bit to be ++ * completey accurate. ++ * ++ * However there appears to be no other way to plug ++ * this race, so if the Remote IRR bit is not ++ * accurate and is causing problems then it is a hardware bug ++ * and you can go talk to the chipset vendor about it. ++ */ ++ if (!io_apic_level_ack_pending(irq)) ++ move_masked_irq(irq); + unmask_IO_APIC_irq(irq); ++ } } --#define DO_ERROR_INFO(trapnr, signr, str, name, sicode, siaddr) \ -+#define DO_ERROR_INFO(trapnr, signr, str, name, sicode, siaddr, irq) \ - fastcall void do_##name(struct pt_regs * regs, long error_code) \ - { \ - siginfo_t info; \ -+ if (irq) \ -+ local_irq_enable(); \ - info.si_signo = signr; \ - info.si_errno = 0; \ - info.si_code = sicode; \ -@@ -566,13 +583,13 @@ DO_VM86_ERROR( 3, SIGTRAP, "int3", int3) + static struct irq_chip ioapic_chip __read_mostly = { +--- a/arch/x86/kernel/asm-offsets.c ++++ b/arch/x86/kernel/asm-offsets.c +@@ -17,7 +17,7 @@ + #include + #include + +-#ifdef CONFIG_XEN ++#if defined(CONFIG_XEN) || defined(CONFIG_PARAVIRT_XEN) + #include #endif - DO_VM86_ERROR( 4, SIGSEGV, "overflow", overflow) - DO_VM86_ERROR( 5, SIGSEGV, "bounds", bounds) --DO_ERROR_INFO( 6, SIGILL, "invalid opcode", invalid_op, ILL_ILLOPN, regs->eip) -+DO_ERROR_INFO( 6, SIGILL, "invalid opcode", invalid_op, ILL_ILLOPN, regs->eip, 0) - DO_ERROR( 9, SIGFPE, "coprocessor segment overrun", coprocessor_segment_overrun) - DO_ERROR(10, SIGSEGV, "invalid TSS", invalid_TSS) - DO_ERROR(11, SIGBUS, "segment not present", segment_not_present) - DO_ERROR(12, SIGBUS, "stack segment", stack_segment) --DO_ERROR_INFO(17, SIGBUS, "alignment check", alignment_check, BUS_ADRALN, 0) --DO_ERROR_INFO(32, SIGSEGV, "iret exception", iret_error, ILL_BADSTK, 0) -+DO_ERROR_INFO(17, SIGBUS, "alignment check", alignment_check, BUS_ADRALN, 0, 0) -+DO_ERROR_INFO(32, SIGSEGV, "iret exception", iret_error, ILL_BADSTK, 0, 1) - fastcall void __kprobes do_general_protection(struct pt_regs * regs, - long error_code) -@@ -585,6 +602,13 @@ fastcall void __kprobes do_general_prote +@@ -55,7 +55,7 @@ void common(void) { + OFFSET(PV_MMU_read_cr2, pv_mmu_ops, read_cr2); + #endif - current->thread.error_code = error_code; - current->thread.trap_no = 13; -+ if (show_unhandled_signals && unhandled_signal(current, SIGSEGV) && -+ printk_ratelimit()) -+ printk(KERN_INFO -+ "%s[%d] general protection eip:%lx esp:%lx error:%lx\n", -+ current->comm, current->pid, -+ regs->eip, regs->esp, error_code); +-#ifdef CONFIG_XEN ++#ifdef CONFIG_PARAVIRT_XEN + BLANK(); + OFFSET(XEN_vcpu_info_mask, vcpu_info, evtchn_upcall_mask); + OFFSET(XEN_vcpu_info_pending, vcpu_info, evtchn_upcall_pending); +--- a/arch/x86/kernel/cpu/common-xen.c ++++ b/arch/x86/kernel/cpu/common-xen.c +@@ -369,6 +369,8 @@ static void __cpuinit generic_identify(s + if ( xlvl >= 0x80000004 ) + get_model_name(c); /* Default name */ + } + - force_sig(SIGSEGV, current); - return; ++ init_scattered_cpuid_features(c); + } -@@ -610,6 +634,14 @@ mem_parity_error(unsigned char reason, s - printk(KERN_EMERG "Uhhuh. NMI received for unknown reason %02x on " - "CPU %d.\n", reason, smp_processor_id()); - printk(KERN_EMERG "You have some hardware problem, likely on the PCI bus.\n"); -+ -+#if defined(CONFIG_EDAC) -+ if(edac_handler_set()) { -+ edac_atomic_assert_error(); -+ return; -+ } -+#endif -+ - if (panic_on_unrecovered_nmi) - panic("NMI: Not continuing"); + early_intel_workaround(c); +@@ -620,7 +622,6 @@ extern int nsc_init_cpu(void); + extern int amd_init_cpu(void); + extern int centaur_init_cpu(void); + extern int transmeta_init_cpu(void); +-extern int rise_init_cpu(void); + extern int nexgen_init_cpu(void); + extern int umc_init_cpu(void); -@@ -720,6 +752,8 @@ static __kprobes void default_do_nmi(str - reassert_nmi(); - } +@@ -632,7 +633,6 @@ void __init early_cpu_init(void) + amd_init_cpu(); + centaur_init_cpu(); + transmeta_init_cpu(); +- rise_init_cpu(); + nexgen_init_cpu(); + umc_init_cpu(); + early_cpu_detect(); +--- a/arch/x86/kernel/cpu/mtrr/main-xen.c ++++ b/arch/x86/kernel/cpu/mtrr/main-xen.c +@@ -167,7 +167,7 @@ mtrr_del(int reg, unsigned long base, un + EXPORT_SYMBOL(mtrr_add); + EXPORT_SYMBOL(mtrr_del); -+static int ignore_nmis; -+ - fastcall __kprobes void do_nmi(struct pt_regs * regs, long error_code) +-__init void mtrr_bp_init(void) ++void __init mtrr_bp_init(void) { - int cpu; -@@ -730,11 +764,24 @@ fastcall __kprobes void do_nmi(struct pt - - ++nmi_count(cpu); + } -- default_do_nmi(regs); -+ if (!ignore_nmis) -+ default_do_nmi(regs); +--- a/arch/x86/kernel/e820-xen.c ++++ b/arch/x86/kernel/e820-xen.c +@@ -224,37 +224,6 @@ unsigned long __init e820_end_of_ram(voi + } - nmi_exit(); + /* +- * Find the hole size in the range. +- */ +-unsigned long __init e820_hole_size(unsigned long start, unsigned long end) +-{ +- unsigned long ram = 0; +- int i; +- +- for (i = 0; i < e820.nr_map; i++) { +- struct e820entry *ei = &e820.map[i]; +- unsigned long last, addr; +- +- if (ei->type != E820_RAM || +- ei->addr+ei->size <= start || +- ei->addr >= end) +- continue; +- +- addr = round_up(ei->addr, PAGE_SIZE); +- if (addr < start) +- addr = start; +- +- last = round_down(ei->addr + ei->size, PAGE_SIZE); +- if (last >= end) +- last = end; +- +- if (last > addr) +- ram += last - addr; +- } +- return ((end - start) - ram); +-} +- +-/* + * Mark e820 reserved areas as busy for the resource manager. + */ + void __init e820_reserve_resources(struct e820entry *e820, int nr_map) +@@ -327,54 +296,66 @@ void __init e820_mark_nosave_regions(voi } + #endif -+void stop_nmi(void) ++/* ++ * Finds an active region in the address range from start_pfn to end_pfn and ++ * returns its range in ei_startpfn and ei_endpfn for the e820 entry. ++ */ ++static int __init e820_find_active_region(const struct e820entry *ei, ++ unsigned long start_pfn, ++ unsigned long end_pfn, ++ unsigned long *ei_startpfn, ++ unsigned long *ei_endpfn) +{ -+ acpi_nmi_disable(); -+ ignore_nmis++; -+} ++#ifdef CONFIG_XEN ++ if (end_pfn > xen_start_info->nr_pages) ++ end_pfn = xen_start_info->nr_pages; ++#endif + -+void restart_nmi(void) -+{ -+ ignore_nmis--; -+ acpi_nmi_enable(); ++ *ei_startpfn = round_up(ei->addr, PAGE_SIZE) >> PAGE_SHIFT; ++ *ei_endpfn = round_down(ei->addr + ei->size, PAGE_SIZE) >> PAGE_SHIFT; ++ ++ /* Skip map entries smaller than a page */ ++ if (*ei_startpfn >= *ei_endpfn) ++ return 0; ++ ++ /* Check if end_pfn_map should be updated */ ++ if (ei->type != E820_RAM && *ei_endpfn > end_pfn_map) ++ end_pfn_map = *ei_endpfn; ++ ++ /* Skip if map is outside the node */ ++ if (ei->type != E820_RAM || *ei_endpfn <= start_pfn || ++ *ei_startpfn >= end_pfn) ++ return 0; ++ ++ /* Check for overlaps */ ++ if (*ei_startpfn < start_pfn) ++ *ei_startpfn = start_pfn; ++ if (*ei_endpfn > end_pfn) ++ *ei_endpfn = end_pfn; ++ ++ /* Obey end_user_pfn to save on memmap */ ++ if (*ei_startpfn >= end_user_pfn) ++ return 0; ++ if (*ei_endpfn > end_user_pfn) ++ *ei_endpfn = end_user_pfn; ++ ++ return 1; +} + - #ifdef CONFIG_KPROBES - fastcall void __kprobes do_int3(struct pt_regs *regs, long error_code) + /* Walk the e820 map and register active regions within a node */ + void __init + e820_register_active_regions(int nid, unsigned long start_pfn, + unsigned long end_pfn) { ---- head.orig/arch/x86/mach-xen/setup.c 2011-08-09 10:35:06.000000000 +0200 -+++ head/arch/x86/mach-xen/setup.c 2011-09-07 15:28:26.000000000 +0200 -@@ -12,6 +12,7 @@ - #include - #include - #include -+#include - - #include - #include -@@ -100,7 +101,7 @@ void __init pre_setup_arch_hook(void) - - init_mm.pgd = swapper_pg_dir = (pgd_t *)xen_start_info->pt_base; ++ unsigned long ei_startpfn; ++ unsigned long ei_endpfn; + int i; +- unsigned long ei_startpfn, ei_endpfn; +- for (i = 0; i < e820.nr_map; i++) { +- struct e820entry *ei = &e820.map[i]; +- ei_startpfn = round_up(ei->addr, PAGE_SIZE) >> PAGE_SHIFT; +- ei_endpfn = round_down(ei->addr + ei->size, PAGE_SIZE) +- >> PAGE_SHIFT; +- +- /* Skip map entries smaller than a page */ +- if (ei_startpfn >= ei_endpfn) +- continue; +- +- /* Check if end_pfn_map should be updated */ +- if (ei->type != E820_RAM && ei_endpfn > end_pfn_map) +- end_pfn_map = ei_endpfn; +- +- /* Skip if map is outside the node */ +- if (ei->type != E820_RAM || +- ei_endpfn <= start_pfn || +- ei_startpfn >= end_pfn) +- continue; +- +- /* Check for overlaps */ +- if (ei_startpfn < start_pfn) +- ei_startpfn = start_pfn; +- if (ei_endpfn > end_pfn) +- ei_endpfn = end_pfn; +- +- /* Obey end_user_pfn to save on memmap */ +- if (ei_startpfn >= end_user_pfn) +- continue; +- if (ei_endpfn > end_user_pfn) +- ei_endpfn = end_user_pfn; -- setup_xen_features(); -+ xen_setup_features(); +-#ifdef CONFIG_XEN +- if (ei_startpfn >= xen_start_info->nr_pages) +- continue; +- if (ei_endpfn > xen_start_info->nr_pages) +- ei_endpfn = xen_start_info->nr_pages; +-#endif +- +- add_active_range(nid, ei_startpfn, ei_endpfn); +- } ++ for (i = 0; i < e820.nr_map; i++) ++ if (e820_find_active_region(&e820.map[i], ++ start_pfn, end_pfn, ++ &ei_startpfn, &ei_endpfn)) ++ add_active_range(nid, ei_startpfn, ei_endpfn); + #ifdef CONFIG_XEN + BUG_ON(nid); + add_active_range(nid, end_pfn, end_pfn); +@@ -399,12 +380,35 @@ void __init add_memory_region(unsigned l + e820.nr_map++; + } - if (HYPERVISOR_xen_version(XENVER_platform_parameters, &pp) == 0) { - hypervisor_virt_start = pp.virt_start; -@@ -157,4 +158,18 @@ void __init machine_specific_arch_setup( - HYPERVISOR_nmi_op(XENNMI_register_callback, &cb); - } - #endif -+ -+ /* Do an early initialization of the fixmap area */ -+ { -+ extern pte_t swapper_pg_pmd[PTRS_PER_PTE]; -+ unsigned long addr = __fix_to_virt(FIX_EARLYCON_MEM_BASE); -+ pgd_t *pgd = (pgd_t *)xen_start_info->pt_base; -+ pud_t *pud = pud_offset(pgd + pgd_index(addr), addr); -+ pmd_t *pmd = pmd_offset(pud, addr); ++/* ++ * Find the hole size (in bytes) in the memory range. ++ * @start: starting address of the memory range to scan ++ * @end: ending address of the memory range to scan ++ */ ++unsigned long __init e820_hole_size(unsigned long start, unsigned long end) ++{ ++ unsigned long start_pfn = start >> PAGE_SHIFT; ++ unsigned long end_pfn = end >> PAGE_SHIFT; ++ unsigned long ei_startpfn; ++ unsigned long ei_endpfn; ++ unsigned long ram = 0; ++ int i; + -+ swapper_pg_dir = pgd; -+ init_mm.pgd = pgd; -+ make_lowmem_page_readonly(swapper_pg_pmd, XENFEAT_writable_page_tables); -+ set_pmd(pmd, __pmd(__pa_symbol(swapper_pg_pmd) | _PAGE_TABLE)); ++ for (i = 0; i < e820.nr_map; i++) { ++ if (e820_find_active_region(&e820.map[i], ++ start_pfn, end_pfn, ++ &ei_startpfn, &ei_endpfn)) ++ ram += ei_endpfn - ei_startpfn; + } - } ---- head.orig/arch/x86/mm/fault_32-xen.c 2011-01-31 17:32:29.000000000 +0100 -+++ head/arch/x86/mm/fault_32-xen.c 2011-01-31 17:49:31.000000000 +0100 -@@ -346,7 +346,10 @@ static inline pmd_t *vmalloc_sync_one(pg - pmd_k = pmd_offset(pud_k, address); - if (!pmd_present(*pmd_k)) - return NULL; -- if (!pmd_present(*pmd)) -+ if (!pmd_present(*pmd)) { -+ bool lazy = x86_read_percpu(xen_lazy_mmu); ++ return end - start - (ram << PAGE_SHIFT); ++} + -+ x86_write_percpu(xen_lazy_mmu, false); - #if CONFIG_XEN_COMPAT > 0x030002 - set_pmd(pmd, *pmd_k); - #else -@@ -356,7 +359,8 @@ static inline pmd_t *vmalloc_sync_one(pg - */ - set_pmd(pmd, __pmd(pmd_val(*pmd_k))); + void __init e820_print_map(char *who) + { + int i; + + for (i = 0; i < e820.nr_map; i++) { +- printk(" %s: %016Lx - %016Lx ", who, ++ printk(KERN_INFO " %s: %016Lx - %016Lx ", who, + (unsigned long long) e820.map[i].addr, + (unsigned long long) (e820.map[i].addr + e820.map[i].size)); + switch (e820.map[i].type) { +--- a/arch/x86/kernel/early_printk-xen.c ++++ b/arch/x86/kernel/early_printk-xen.c +@@ -174,6 +174,7 @@ static __init void early_serial_init(cha + * mappings. Someone should fix this for domain 0. For now, use fake serial. + */ + #define early_vga_console early_serial_console ++#define xenboot_console early_serial_console + #endif -- else -+ x86_write_percpu(xen_lazy_mmu, lazy); -+ } else - BUG_ON(pmd_page(*pmd) != pmd_page(*pmd_k)); - return pmd_k; - } -@@ -388,6 +392,8 @@ static inline int vmalloc_fault(unsigned - return 0; - } -+int show_unhandled_signals = 1; -+ - /* - * This routine handles page faults. It determines the address, - * and the problem, and then passes it off to one of the appropriate -@@ -408,6 +414,7 @@ fastcall void __kprobes do_page_fault(st - struct vm_area_struct * vma; - unsigned long address; - int write, si_code; -+ int fault; - - /* get the address */ - address = read_cr2(); -@@ -541,20 +548,18 @@ good_area: - * make sure we exit gracefully rather than endlessly redo - * the fault. - */ -- switch (handle_mm_fault(mm, vma, address, write)) { -- case VM_FAULT_MINOR: -- tsk->min_flt++; -- break; -- case VM_FAULT_MAJOR: -- tsk->maj_flt++; -- break; -- case VM_FAULT_SIGBUS: -- goto do_sigbus; -- case VM_FAULT_OOM: -+ fault = handle_mm_fault(mm, vma, address, write); -+ if (unlikely(fault & VM_FAULT_ERROR)) { -+ if (fault & VM_FAULT_OOM) - goto out_of_memory; -- default: -- BUG(); -+ else if (fault & VM_FAULT_SIGBUS) -+ goto do_sigbus; -+ BUG(); +@@ -261,20 +262,22 @@ static int __init setup_early_printk(cha + } else if (!strncmp(buf, "ttyS", 4)) { + early_serial_init(buf); + early_console = &early_serial_console; +- } else if (!strncmp(buf, "vga", 3) ++ } else if (!strncmp(buf, "vga", 3)) { + #ifndef CONFIG_XEN + && SCREEN_INFO.orig_video_isVGA == 1) { + max_xpos = SCREEN_INFO.orig_video_cols; + max_ypos = SCREEN_INFO.orig_video_lines; + current_ypos = SCREEN_INFO.orig_y; +-#else +- || !strncmp(buf, "xen", 3)) { + #endif + early_console = &early_vga_console; + } else if (!strncmp(buf, "simnow", 6)) { + simnow_init(buf + 6); + early_console = &simnow_console; + keep_early = 1; ++#ifdef CONFIG_XEN ++ } else if (!strncmp(buf, "xen", 3)) { ++ early_console = &xenboot_console; ++#endif } -+ if (fault & VM_FAULT_MAJOR) -+ tsk->maj_flt++; -+ else -+ tsk->min_flt++; - /* - * Did it hit the DOS screen memory VA from vm86 mode? -@@ -589,6 +594,14 @@ bad_area_nosemaphore: - if (is_prefetch(regs, address, error_code)) - return; + if (keep_early) +--- a/arch/x86/kernel/entry_32-xen.S ++++ b/arch/x86/kernel/entry_32-xen.S +@@ -452,9 +452,6 @@ restore_nocheck_notrace: + 1: INTERRUPT_RETURN + .section .fixup,"ax" + iret_exc: +-#ifndef CONFIG_XEN +- ENABLE_INTERRUPTS(CLBR_NONE) +-#endif + pushl $0 # no error code + pushl $do_iret_error + jmp error_code +--- a/arch/x86/kernel/entry_32.S ++++ b/arch/x86/kernel/entry_32.S +@@ -994,7 +994,7 @@ END(spurious_interrupt_bug) + */ + .popsection -+ if (show_unhandled_signals && unhandled_signal(tsk, SIGSEGV) && -+ printk_ratelimit()) { -+ printk("%s%s[%d]: segfault at %08lx eip %08lx " -+ "esp %08lx error %lx\n", -+ tsk->pid > 1 ? KERN_INFO : KERN_EMERG, -+ tsk->comm, tsk->pid, address, regs->eip, -+ regs->esp, error_code); -+ } - tsk->thread.cr2 = address; - /* Kernel addresses are always protection faults */ - tsk->thread.error_code = error_code | (address >= TASK_SIZE); ---- head.orig/arch/x86/mm/highmem_32-xen.c 2011-01-31 17:32:29.000000000 +0100 -+++ head/arch/x86/mm/highmem_32-xen.c 2011-01-31 17:49:31.000000000 +0100 -@@ -34,17 +34,16 @@ void *kmap_atomic_prot(struct page *page - /* even !CONFIG_PREEMPT needs this, for in_atomic in do_page_fault */ - pagefault_disable(); +-#ifdef CONFIG_XEN ++#ifdef CONFIG_PARAVIRT_XEN + /* Xen doesn't set %esp to be precisely what the normal sysenter + entrypoint expects, so fix it up before using the normal path. */ + ENTRY(xen_sysenter_target) +@@ -1084,7 +1084,7 @@ ENDPROC(xen_failsafe_callback) + BUILD_INTERRUPT3(xen_hvm_callback_vector, HYPERVISOR_CALLBACK_VECTOR, + xen_evtchn_do_upcall) -- idx = type + KM_TYPE_NR*smp_processor_id(); -- BUG_ON(!pte_none(*(kmap_pte-idx))); -- - if (!PageHighMem(page)) - return page_address(page); +-#endif /* CONFIG_XEN */ ++#endif /* CONFIG_PARAVIRT_XEN */ -+ idx = type + KM_TYPE_NR*smp_processor_id(); - vaddr = __fix_to_virt(FIX_KMAP_BEGIN + idx); -+ BUG_ON(!pte_none(*(kmap_pte-idx))); - set_pte_at(&init_mm, vaddr, kmap_pte-idx, mk_pte(page, prot)); - /*arch_flush_lazy_mmu_mode();*/ + #if IS_ENABLED(CONFIG_HYPERV) -- return (void*) vaddr; -+ return (void *)vaddr; - } +--- a/arch/x86/kernel/entry_64-xen.S ++++ b/arch/x86/kernel/entry_64-xen.S +@@ -313,7 +313,7 @@ sysret_signal: + TRACE_IRQS_ON + /* sti */ + XEN_UNBLOCK_EVENTS(%rsi) +- testl $(_TIF_SIGPENDING|_TIF_NOTIFY_RESUME|_TIF_SINGLESTEP),%edx ++ testl $(_TIF_SIGPENDING|_TIF_SINGLESTEP|_TIF_MCE_NOTIFY),%edx + jz 1f - void *kmap_atomic(struct page *page, enum km_type type) ---- head.orig/arch/x86/mm/init_32-xen.c 2011-01-31 17:32:29.000000000 +0100 -+++ head/arch/x86/mm/init_32-xen.c 2011-01-31 17:49:31.000000000 +0100 -@@ -96,7 +96,7 @@ static pte_t * __init one_page_table_ini - #endif - pte_t *page_table = (pte_t *) alloc_bootmem_low_pages(PAGE_SIZE); + /* Really a signal */ +@@ -412,7 +412,7 @@ int_very_careful: + jmp int_restore_rest + + int_signal: +- testl $(_TIF_NOTIFY_RESUME|_TIF_SIGPENDING|_TIF_SINGLESTEP),%edx ++ testl $(_TIF_SIGPENDING|_TIF_SINGLESTEP|_TIF_MCE_NOTIFY),%edx + jz 1f + movq %rsp,%rdi # &ptregs -> arg1 + xorl %esi,%esi # oldset -> arg2 +@@ -555,7 +555,7 @@ retint_careful: + jmp retint_check + + retint_signal: +- testl $(_TIF_SIGPENDING|_TIF_NOTIFY_RESUME|_TIF_SINGLESTEP),%edx ++ testl $(_TIF_SIGPENDING|_TIF_SINGLESTEP|_TIF_MCE_NOTIFY),%edx + jz retint_restore_args + TRACE_IRQS_ON + XEN_UNBLOCK_EVENTS(%rsi) +--- a/arch/x86/kernel/head64-xen.c ++++ b/arch/x86/kernel/head64-xen.c +@@ -89,7 +89,7 @@ void __init x86_64_start_kernel(char * r + struct xen_machphys_mapping mapping; + int i; -- paravirt_alloc_pt(__pa(page_table) >> PAGE_SHIFT); -+ paravirt_alloc_pt(&init_mm, __pa(page_table) >> PAGE_SHIFT); - make_lowmem_page_readonly(page_table, - XENFEAT_writable_page_tables); - set_pmd(pmd, __pmd(__pa(page_table) | _PAGE_TABLE)); -@@ -453,7 +453,7 @@ static void __init pagetable_init (void) - xen_pagetable_setup_done(pgd_base); - } +- setup_xen_features(); ++ xen_setup_features(); --#if defined(CONFIG_SOFTWARE_SUSPEND) || defined(CONFIG_ACPI_SLEEP) -+#if defined(CONFIG_HIBERNATION) || defined(CONFIG_ACPI) + xen_start_info = (struct start_info *)real_mode_data; + if (!xen_feature(XENFEAT_auto_translated_physmap)) +--- a/arch/x86/kernel/head_32-xen.S ++++ b/arch/x86/kernel/head_32-xen.S +@@ -93,7 +93,10 @@ ENTRY(_stext) /* - * Swap suspend & friends need this for resume because things like the intel-agp - * driver might have split up a kernel 4MB mapping. -@@ -492,9 +492,13 @@ void zap_low_mappings (void) - flush_tlb_all(); - } + * BSS section + */ +-.section ".bss.page_aligned","w" ++.section ".bss.page_aligned","wa" ++ .align PAGE_SIZE_asm ++ENTRY(swapper_pg_pmd) ++ .fill 1024,4,0 + ENTRY(empty_zero_page) + .fill 4096,1,0 -+int nx_enabled = 0; -+ -+#ifdef CONFIG_X86_PAE -+ - static int disable_nx __initdata = 0; - u64 __supported_pte_mask __read_mostly = ~_PAGE_NX; --EXPORT_SYMBOL(__supported_pte_mask); -+EXPORT_SYMBOL_GPL(__supported_pte_mask); +@@ -155,36 +158,36 @@ ENTRY(empty_zero_page) + #endif /* CONFIG_XEN_COMPAT <= 0x030002 */ - /* - * noexec = on|off -@@ -521,9 +525,6 @@ static int __init noexec_setup(char *str - } - early_param("noexec", noexec_setup); --int nx_enabled = 0; --#ifdef CONFIG_X86_PAE -- - static void __init set_nx(void) - { - unsigned int v[4], l, h; -@@ -770,7 +771,7 @@ void __init mem_init(void) - zap_low_mappings(); +- ELFNOTE(Xen, XEN_ELFNOTE_GUEST_OS, .asciz, "linux") +- ELFNOTE(Xen, XEN_ELFNOTE_GUEST_VERSION, .asciz, "2.6") +- ELFNOTE(Xen, XEN_ELFNOTE_XEN_VERSION, .asciz, "xen-3.0") +- ELFNOTE(Xen, XEN_ELFNOTE_VIRT_BASE, .long, __PAGE_OFFSET) ++ ELFNOTE(Xen, XEN_ELFNOTE_GUEST_OS, .asciz "linux") ++ ELFNOTE(Xen, XEN_ELFNOTE_GUEST_VERSION, .asciz "2.6") ++ ELFNOTE(Xen, XEN_ELFNOTE_XEN_VERSION, .asciz "xen-3.0") ++ ELFNOTE(Xen, XEN_ELFNOTE_VIRT_BASE, .long __PAGE_OFFSET) + #if CONFIG_XEN_COMPAT <= 0x030002 +- ELFNOTE(Xen, XEN_ELFNOTE_PADDR_OFFSET, .long, __PAGE_OFFSET) ++ ELFNOTE(Xen, XEN_ELFNOTE_PADDR_OFFSET, .long __PAGE_OFFSET) + #else +- ELFNOTE(Xen, XEN_ELFNOTE_PADDR_OFFSET, .long, 0) ++ ELFNOTE(Xen, XEN_ELFNOTE_PADDR_OFFSET, .long 0) + #endif +- ELFNOTE(Xen, XEN_ELFNOTE_ENTRY, .long, startup_32) +- ELFNOTE(Xen, XEN_ELFNOTE_HYPERCALL_PAGE, .long, hypercall_page) +- ELFNOTE(Xen, XEN_ELFNOTE_HV_START_LOW, .long, HYPERVISOR_VIRT_START) +- ELFNOTE(Xen, XEN_ELFNOTE_FEATURES, .ascii, "writable_page_tables"; +- .ascii "|writable_descriptor_tables"; +- .ascii "|auto_translated_physmap"; +- .ascii "|pae_pgdir_above_4gb"; +- .ascii "|supervisor_mode_kernel"; +- .asciz XEN_DOM0_CAP_STR) +- ELFNOTE(Xen, XEN_ELFNOTE_SUPPORTED_FEATURES, .long, XEN_DOM0_CAP | ++ ELFNOTE(Xen, XEN_ELFNOTE_ENTRY, .long startup_32) ++ ELFNOTE(Xen, XEN_ELFNOTE_HYPERCALL_PAGE, .long hypercall_page) ++ ELFNOTE(Xen, XEN_ELFNOTE_HV_START_LOW, .long HYPERVISOR_VIRT_START) ++ ELFNOTE(Xen, XEN_ELFNOTE_FEATURES, .ascii "writable_page_tables"; ++ .ascii "|writable_descriptor_tables"; ++ .ascii "|auto_translated_physmap"; ++ .ascii "|pae_pgdir_above_4gb"; ++ .ascii "|supervisor_mode_kernel"; ++ .asciz XEN_DOM0_CAP_STR) ++ ELFNOTE(Xen, XEN_ELFNOTE_SUPPORTED_FEATURES, .long XEN_DOM0_CAP | + (1 << XENFEAT_writable_page_tables) | + (1 << XENFEAT_writable_descriptor_tables) | + (1 << XENFEAT_auto_translated_physmap) | + (1 << XENFEAT_pae_pgdir_above_4gb) | + (1 << XENFEAT_supervisor_mode_kernel)) + #ifdef CONFIG_X86_PAE +- ELFNOTE(Xen, XEN_ELFNOTE_PAE_MODE, .asciz, "yes") +- ELFNOTE(Xen, XEN_ELFNOTE_L1_MFN_VALID, .quad, _PAGE_PRESENT,_PAGE_PRESENT) ++ ELFNOTE(Xen, XEN_ELFNOTE_PAE_MODE, .asciz "yes") ++ ELFNOTE(Xen, XEN_ELFNOTE_L1_MFN_VALID, .quad _PAGE_PRESENT, _PAGE_PRESENT) + #else +- ELFNOTE(Xen, XEN_ELFNOTE_PAE_MODE, .asciz, "no") +- ELFNOTE(Xen, XEN_ELFNOTE_L1_MFN_VALID, .long, _PAGE_PRESENT,_PAGE_PRESENT) ++ ELFNOTE(Xen, XEN_ELFNOTE_PAE_MODE, .asciz "no") ++ ELFNOTE(Xen, XEN_ELFNOTE_L1_MFN_VALID, .long _PAGE_PRESENT, _PAGE_PRESENT) #endif +- ELFNOTE(Xen, XEN_ELFNOTE_LOADER, .asciz, "generic") +- ELFNOTE(Xen, XEN_ELFNOTE_SUSPEND_CANCEL, .long, 1) ++ ELFNOTE(Xen, XEN_ELFNOTE_LOADER, .asciz "generic") ++ ELFNOTE(Xen, XEN_ELFNOTE_SUSPEND_CANCEL, .long 1) +--- a/arch/x86/kernel/head_64-xen.S ++++ b/arch/x86/kernel/head_64-xen.S +@@ -25,7 +25,7 @@ + #include + #include -- set_bit(PG_pinned, &virt_to_page(init_mm.pgd)->flags); -+ SetPagePinned(virt_to_page(init_mm.pgd)); - } - - #ifdef CONFIG_MEMORY_HOTPLUG -@@ -802,8 +803,7 @@ void __init pgtable_cache_init(void) - PTRS_PER_PMD*sizeof(pmd_t), - PTRS_PER_PMD*sizeof(pmd_t), - SLAB_PANIC, -- pmd_ctor, -- NULL); -+ pmd_ctor); - if (!SHARED_KERNEL_PMD) { - /* If we're in PAE mode and have a non-shared - kernel pmd, then the pgd size must be a ---- head.orig/arch/x86/mm/ioremap-xen.c 2011-01-31 17:32:29.000000000 +0100 -+++ head/arch/x86/mm/ioremap-xen.c 2011-02-07 15:38:30.000000000 +0100 -@@ -344,9 +344,8 @@ void iounmap(volatile void __iomem *addr - - /* Reset the direct mapping. Can block */ - if ((p->flags >> 20) && is_local_lowmem(p->phys_addr)) { -- /* p->size includes the guard page, but cpa doesn't like that */ - change_page_attr(virt_to_page(bus_to_virt(p->phys_addr)), -- (p->size - PAGE_SIZE) >> PAGE_SHIFT, -+ get_vm_area_size(p) >> PAGE_SHIFT, - PAGE_KERNEL); - global_flush_tlb(); - } ---- head.orig/arch/x86/mm/pgtable_32-xen.c 2011-01-31 17:32:29.000000000 +0100 -+++ head/arch/x86/mm/pgtable_32-xen.c 2011-01-31 17:49:31.000000000 +0100 -@@ -198,7 +198,7 @@ void pte_free(struct page *pte) - va, pfn_pte(pfn, PAGE_KERNEL), 0)) - BUG(); - } else -- clear_bit(PG_pinned, &pte->flags); -+ ClearPagePinned(pte); +- .section .bootstrap.text, "ax", @progbits ++ .section .text.head, "ax", @progbits + .code64 + .globl startup_64 + startup_64: +@@ -41,7 +41,7 @@ startup_64: - ClearPageForeign(pte); - init_page_count(pte); -@@ -249,7 +249,7 @@ static inline void pgd_list_del(pgd_t *p + #define NEXT_PAGE(name) \ + .balign PAGE_SIZE; \ +- phys_##name = . - .bootstrap.text; \ ++ phys_##name = . - .text.head; \ + ENTRY(name) - #if (PTRS_PER_PMD == 1) - /* Non-PAE pgd constructor */ --void pgd_ctor(void *pgd) -+static void pgd_ctor(void *pgd) - { - unsigned long flags; + NEXT_PAGE(init_level4_pgt) +@@ -65,6 +65,12 @@ NEXT_PAGE(level3_kernel_pgt) + NEXT_PAGE(level3_user_pgt) + .fill 512,8,0 -@@ -272,7 +272,7 @@ void pgd_ctor(void *pgd) - } - #else /* PTRS_PER_PMD > 1 */ - /* PAE pgd constructor */ --void pgd_ctor(void *pgd) -+static void pgd_ctor(void *pgd) - { - /* PAE, kernel PMD may be shared */ ++NEXT_PAGE(level2_fixmap_pgt) ++ .fill 512,8,0 ++ ++NEXT_PAGE(level1_fixmap_pgt) ++ .fill 512,8,0 ++ + NEXT_PAGE(hypercall_page) + CFI_STARTPROC + i = 0 +@@ -197,27 +203,27 @@ ENTRY(empty_zero_page) + .byte 0 + #endif /* CONFIG_XEN_COMPAT <= 0x030002 */ + +- ELFNOTE(Xen, XEN_ELFNOTE_GUEST_OS, .asciz, "linux") +- ELFNOTE(Xen, XEN_ELFNOTE_GUEST_VERSION, .asciz, "2.6") +- ELFNOTE(Xen, XEN_ELFNOTE_XEN_VERSION, .asciz, "xen-3.0") +- ELFNOTE(Xen, XEN_ELFNOTE_VIRT_BASE, .quad, __START_KERNEL_map) ++ ELFNOTE(Xen, XEN_ELFNOTE_GUEST_OS, .asciz "linux") ++ ELFNOTE(Xen, XEN_ELFNOTE_GUEST_VERSION, .asciz "2.6") ++ ELFNOTE(Xen, XEN_ELFNOTE_XEN_VERSION, .asciz "xen-3.0") ++ ELFNOTE(Xen, XEN_ELFNOTE_VIRT_BASE, .quad __START_KERNEL_map) + #if CONFIG_XEN_COMPAT <= 0x030002 +- ELFNOTE(Xen, XEN_ELFNOTE_PADDR_OFFSET, .quad, __START_KERNEL_map) ++ ELFNOTE(Xen, XEN_ELFNOTE_PADDR_OFFSET, .quad __START_KERNEL_map) + #else +- ELFNOTE(Xen, XEN_ELFNOTE_PADDR_OFFSET, .quad, 0) ++ ELFNOTE(Xen, XEN_ELFNOTE_PADDR_OFFSET, .quad 0) + #endif +- ELFNOTE(Xen, XEN_ELFNOTE_ENTRY, .quad, startup_64) +- ELFNOTE(Xen, XEN_ELFNOTE_HYPERCALL_PAGE, .quad, hypercall_page) +- ELFNOTE(Xen, XEN_ELFNOTE_L1_MFN_VALID, .quad, _PAGE_PRESENT,_PAGE_PRESENT) +- ELFNOTE(Xen, XEN_ELFNOTE_FEATURES, .ascii, "writable_page_tables"; +- .ascii "|writable_descriptor_tables"; +- .ascii "|auto_translated_physmap"; +- .ascii "|supervisor_mode_kernel"; +- .asciz XEN_DOM0_CAP_STR) +- ELFNOTE(Xen, XEN_ELFNOTE_SUPPORTED_FEATURES, .long, XEN_DOM0_CAP | ++ ELFNOTE(Xen, XEN_ELFNOTE_ENTRY, .quad startup_64) ++ ELFNOTE(Xen, XEN_ELFNOTE_HYPERCALL_PAGE, .quad hypercall_page) ++ ELFNOTE(Xen, XEN_ELFNOTE_L1_MFN_VALID, .quad _PAGE_PRESENT, _PAGE_PRESENT) ++ ELFNOTE(Xen, XEN_ELFNOTE_FEATURES, .ascii "writable_page_tables"; ++ .ascii "|writable_descriptor_tables"; ++ .ascii "|auto_translated_physmap"; ++ .ascii "|supervisor_mode_kernel"; ++ .asciz XEN_DOM0_CAP_STR) ++ ELFNOTE(Xen, XEN_ELFNOTE_SUPPORTED_FEATURES, .long XEN_DOM0_CAP | + (1 << XENFEAT_writable_page_tables) | + (1 << XENFEAT_writable_descriptor_tables) | + (1 << XENFEAT_auto_translated_physmap) | + (1 << XENFEAT_supervisor_mode_kernel)) +- ELFNOTE(Xen, XEN_ELFNOTE_LOADER, .asciz, "generic") +- ELFNOTE(Xen, XEN_ELFNOTE_SUSPEND_CANCEL, .long, 1) ++ ELFNOTE(Xen, XEN_ELFNOTE_LOADER, .asciz "generic") ++ ELFNOTE(Xen, XEN_ELFNOTE_SUSPEND_CANCEL, .long 1) +--- a/arch/x86/kernel/ldt-xen.c ++++ b/arch/x86/kernel/ldt-xen.c +@@ -114,6 +114,8 @@ int init_new_context(struct task_struct + memset(&mm->context, 0, sizeof(mm->context)); + init_MUTEX(&mm->context.sem); + old_mm = current->mm; ++ if (old_mm) ++ mm->context.vdso = old_mm->context.vdso; + if (old_mm && old_mm->context.size > 0) { + down(&old_mm->context.sem); + retval = copy_ldt(&mm->context, &old_mm->context); +@@ -146,7 +148,7 @@ void destroy_context(struct mm_struct *m + kfree(mm->context.ldt); + mm->context.size = 0; + } +- if (!mm->context.pinned) { ++ if (!PagePinned(virt_to_page(mm->pgd))) { + spin_lock(&mm_unpinned_lock); + list_del(&mm->context.unpinned); + spin_unlock(&mm_unpinned_lock); +--- a/arch/x86/kernel/microcode_core-xen.c ++++ b/arch/x86/kernel/microcode_core-xen.c +@@ -33,6 +33,7 @@ + #include + #include + #include ++#include + #include + #include + #include +--- a/arch/x86/kernel/pci-dma-xen.c ++++ b/arch/x86/kernel/pci-dma-xen.c +@@ -24,7 +24,7 @@ + #include -@@ -286,7 +286,7 @@ void pgd_ctor(void *pgd) - } - #endif /* PTRS_PER_PMD */ + #ifdef __x86_64__ +-#include ++#include --void pgd_dtor(void *pgd) -+static void pgd_dtor(void *pgd) + int iommu_merge __read_mostly = 0; + EXPORT_SYMBOL(iommu_merge); +--- a/arch/x86/kernel/process_32-xen.c ++++ b/arch/x86/kernel/process_32-xen.c +@@ -241,6 +241,7 @@ early_param("idle", idle_setup); + void show_regs(struct pt_regs * regs) { - unsigned long flags; /* can be called from interrupt context */ - -@@ -644,9 +644,9 @@ static inline unsigned int pgd_walk_set_ + unsigned long cr0 = 0L, cr2 = 0L, cr3 = 0L, cr4 = 0L; ++ unsigned long d0, d1, d2, d3, d6, d7; - if (PageHighMem(page)) { - if (pgprot_val(flags) & _PAGE_RW) -- clear_bit(PG_pinned, &page->flags); -+ ClearPagePinned(page); - else -- set_bit(PG_pinned, &page->flags); -+ SetPagePinned(page); - } else { - MULTI_update_va_mapping(per_cpu(pb_mcl, cpu) + seq, - (unsigned long)__va(pfn << PAGE_SHIFT), -@@ -716,19 +716,19 @@ static void __pgd_pin(pgd_t *pgd) - pgd_walk(pgd, PAGE_KERNEL_RO); - kmap_flush_unused(); - xen_pgd_pin(__pa(pgd)); -- set_bit(PG_pinned, &virt_to_page(pgd)->flags); -+ SetPagePinned(virt_to_page(pgd)); + printk("\n"); + printk("Pid: %d, comm: %20s\n", current->pid, current->comm); +@@ -265,6 +266,17 @@ void show_regs(struct pt_regs * regs) + cr3 = read_cr3(); + cr4 = read_cr4_safe(); + printk("CR0: %08lx CR2: %08lx CR3: %08lx CR4: %08lx\n", cr0, cr2, cr3, cr4); ++ ++ get_debugreg(d0, 0); ++ get_debugreg(d1, 1); ++ get_debugreg(d2, 2); ++ get_debugreg(d3, 3); ++ printk("DR0: %08lx DR1: %08lx DR2: %08lx DR3: %08lx\n", ++ d0, d1, d2, d3); ++ get_debugreg(d6, 6); ++ get_debugreg(d7, 7); ++ printk("DR6: %08lx DR7: %08lx\n", d6, d7); ++ + show_trace(NULL, regs, ®s->esp); } - static void __pgd_unpin(pgd_t *pgd) - { - xen_pgd_unpin(__pa(pgd)); - pgd_walk(pgd, PAGE_KERNEL); -- clear_bit(PG_pinned, &virt_to_page(pgd)->flags); -+ ClearPagePinned(virt_to_page(pgd)); +@@ -473,7 +485,30 @@ int dump_task_regs(struct task_struct *t + return 1; } - static void pgd_test_and_unpin(pgd_t *pgd) +-static noinline void __switch_to_xtra(struct task_struct *next_p) ++#ifdef CONFIG_SECCOMP ++void hard_disable_TSC(void) ++{ ++ write_cr4(read_cr4() | X86_CR4_TSD); ++} ++void disable_TSC(void) ++{ ++ preempt_disable(); ++ if (!test_and_set_thread_flag(TIF_NOTSC)) ++ /* ++ * Must flip the CPU state synchronously with ++ * TIF_NOTSC in the current running context. ++ */ ++ hard_disable_TSC(); ++ preempt_enable(); ++} ++void hard_enable_TSC(void) ++{ ++ write_cr4(read_cr4() & ~X86_CR4_TSD); ++} ++#endif /* CONFIG_SECCOMP */ ++ ++static noinline void ++__switch_to_xtra(struct task_struct *prev_p, struct task_struct *next_p) { -- if (test_bit(PG_pinned, &virt_to_page(pgd)->flags)) -+ if (PagePinned(virt_to_page(pgd))) - __pgd_unpin(pgd); - } + struct thread_struct *next; -@@ -766,7 +766,7 @@ void mm_pin_all(void) - */ - spin_lock_irqsave(&pgd_lock, flags); - for (page = pgd_list; page; page = (struct page *)page->index) { -- if (!test_bit(PG_pinned, &page->flags)) -+ if (!PagePinned(page)) - __pgd_pin((pgd_t *)page_address(page)); +@@ -488,33 +523,17 @@ static noinline void __switch_to_xtra(st + set_debugreg(next->debugreg[6], 6); + set_debugreg(next->debugreg[7], 7); } - spin_unlock_irqrestore(&pgd_lock, flags); -@@ -774,7 +774,7 @@ void mm_pin_all(void) - - void arch_dup_mmap(struct mm_struct *oldmm, struct mm_struct *mm) - { -- if (!test_bit(PG_pinned, &virt_to_page(mm->pgd)->flags)) -+ if (!PagePinned(virt_to_page(mm->pgd))) - mm_pin(mm); - } - -@@ -800,7 +800,7 @@ void arch_exit_mmap(struct mm_struct *mm +-} - task_unlock(tsk); +-/* +- * This function selects if the context switch from prev to next +- * has to tweak the TSC disable bit in the cr4. +- */ +-static inline void disable_tsc(struct task_struct *prev_p, +- struct task_struct *next_p) +-{ +- struct thread_info *prev, *next; +- +- /* +- * gcc should eliminate the ->thread_info dereference if +- * has_secure_computing returns 0 at compile time (SECCOMP=n). +- */ +- prev = task_thread_info(prev_p); +- next = task_thread_info(next_p); +- +- if (has_secure_computing(prev) || has_secure_computing(next)) { +- /* slow path here */ +- if (has_secure_computing(prev) && +- !has_secure_computing(next)) { +- write_cr4(read_cr4() & ~X86_CR4_TSD); +- } else if (!has_secure_computing(prev) && +- has_secure_computing(next)) +- write_cr4(read_cr4() | X86_CR4_TSD); ++#ifdef CONFIG_SECCOMP ++ if (test_tsk_thread_flag(prev_p, TIF_NOTSC) ^ ++ test_tsk_thread_flag(next_p, TIF_NOTSC)) { ++ /* prev and next are different */ ++ if (test_tsk_thread_flag(next_p, TIF_NOTSC)) ++ hard_disable_TSC(); ++ else ++ hard_enable_TSC(); + } ++#endif + } -- if (test_bit(PG_pinned, &virt_to_page(mm->pgd)->flags) && -+ if (PagePinned(virt_to_page(mm->pgd)) && - (atomic_read(&mm->mm_count) == 1) && - !mm->context.has_foreign_mappings) - mm_unpin(mm); ---- head.orig/arch/x86/xen/Kconfig 2013-02-19 00:58:34.000000000 +0100 -+++ head/arch/x86/xen/Kconfig 2011-01-31 17:49:31.000000000 +0100 -@@ -2,7 +2,7 @@ - # This Kconfig describes xen options - # + /* +@@ -655,10 +674,9 @@ struct task_struct fastcall * __switch_t + /* + * Now maybe handle debug registers + */ +- if (unlikely(task_thread_info(next_p)->flags & _TIF_WORK_CTXSW)) +- __switch_to_xtra(next_p); +- +- disable_tsc(prev_p, next_p); ++ if (unlikely(task_thread_info(prev_p)->flags & _TIF_WORK_CTXSW_PREV || ++ task_thread_info(next_p)->flags & _TIF_WORK_CTXSW_NEXT)) ++ __switch_to_xtra(prev_p, next_p); --config XEN -+config PARAVIRT_XEN - bool "Xen guest support" - select PARAVIRT - select PARAVIRT_CLOCK ---- head.orig/arch/x86/xen/xen-head.S 2012-12-11 04:30:57.000000000 +0100 -+++ head/arch/x86/xen/xen-head.S 2012-10-23 14:49:29.000000000 +0200 -@@ -1,7 +1,7 @@ - /* Xen-specific pieces of head.S, intended to be included in the right - place in head.S */ + /* + * Leave lazy mode, flushing any hypercalls made here. +--- a/arch/x86/kernel/process_64-xen.c ++++ b/arch/x86/kernel/process_64-xen.c +@@ -26,6 +26,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -248,6 +249,7 @@ early_param("idle", idle_setup); + void __show_regs(struct pt_regs * regs) + { + unsigned long fs, gs, shadowgs; ++ unsigned long d0, d1, d2, d3, d6, d7; + unsigned int fsindex,gsindex; + unsigned int ds,cs,es; --#ifdef CONFIG_XEN -+#ifdef CONFIG_PARAVIRT_XEN +@@ -287,6 +289,14 @@ void __show_regs(struct pt_regs * regs) + fs,fsindex,gs,gsindex,shadowgs); + printk("CS: %04x DS: %04x ES: %04x\n", cs, ds, es); - #include - #include -@@ -104,4 +104,4 @@ NEXT_HYPERCALL(arch_6) - ELFNOTE(Xen, XEN_ELFNOTE_HV_START_LOW, _ASM_PTR __HYPERVISOR_VIRT_START) - ELFNOTE(Xen, XEN_ELFNOTE_PADDR_OFFSET, _ASM_PTR 0) ++ get_debugreg(d0, 0); ++ get_debugreg(d1, 1); ++ get_debugreg(d2, 2); ++ printk("DR0: %016lx DR1: %016lx DR2: %016lx\n", d0, d1, d2); ++ get_debugreg(d3, 3); ++ get_debugreg(d6, 6); ++ get_debugreg(d7, 7); ++ printk("DR3: %016lx DR6: %016lx DR7: %016lx\n", d3, d6, d7); + } --#endif /*CONFIG_XEN */ -+#endif /* CONFIG_PARAVIRT_XEN */ ---- head.orig/arch/x86/ia32/ia32entry-xen.S 2011-01-31 17:32:29.000000000 +0100 -+++ head/arch/x86/ia32/ia32entry-xen.S 2011-01-31 17:49:31.000000000 +0100 -@@ -105,7 +105,7 @@ ENTRY(ia32_sysenter_target) - movl $VSYSCALL32_SYSEXIT,8(%rsp) - movq %rax,(%rsp) - cld -- SAVE_ARGS 0,0,0 -+ SAVE_ARGS 0,0,1 - /* no need to do an access_ok check here because rbp has been - 32bit zero extended */ - 1: movl (%rbp),%r9d -@@ -244,7 +244,7 @@ ia32_badarg: - */ + void show_regs(struct pt_regs *regs) +--- a/arch/x86/kernel/setup_32-xen.c ++++ b/arch/x86/kernel/setup_32-xen.c +@@ -114,19 +114,10 @@ static unsigned int highmem_pages = -1; + /* + * Setup options + */ +-struct drive_info_struct { char dummy[32]; } drive_info; +-#if defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_HD) || \ +- defined(CONFIG_BLK_DEV_IDE_MODULE) || defined(CONFIG_BLK_DEV_HD_MODULE) +-EXPORT_SYMBOL(drive_info); +-#endif + struct screen_info screen_info; + EXPORT_SYMBOL(screen_info); + struct apm_info apm_info; + EXPORT_SYMBOL(apm_info); +-struct sys_desc_table_struct { +- unsigned short length; +- unsigned char table[0]; +-}; + struct edid_info edid_info; + EXPORT_SYMBOL_GPL(edid_info); + #ifndef CONFIG_XEN +@@ -149,7 +140,7 @@ unsigned long saved_videomode; - ENTRY(ia32_syscall) -- CFI_STARTPROC simple -+ CFI_STARTPROC32 simple - CFI_SIGNAL_FRAME - CFI_DEF_CFA rsp,SS+8-RIP+16 - /*CFI_REL_OFFSET ss,SS-RIP+16*/ -@@ -280,6 +280,7 @@ ia32_sysret: + static char __initdata command_line[COMMAND_LINE_SIZE]; - ia32_tracesys: - SAVE_REST -+ CLEAR_RREGS - movq $-ENOSYS,RAX(%rsp) /* really needed? */ - movq %rsp,%rdi /* &pt_regs -> arg1 */ - call syscall_trace_enter -@@ -476,7 +477,7 @@ ia32_sys_call_table: - .quad sys_init_module - .quad sys_delete_module - .quad quiet_ni_syscall /* 130 get_kernel_syms */ -- .quad sys_quotactl -+ .quad sys32_quotactl - .quad sys_getpgid - .quad sys_fchdir - .quad quiet_ni_syscall /* bdflush */ -@@ -669,4 +670,5 @@ ia32_sys_call_table: - .quad compat_sys_signalfd - .quad compat_sys_timerfd - .quad sys_eventfd -+ .quad sys32_fallocate - ia32_syscall_end: ---- head.orig/arch/x86/kernel/e820-xen.c 2011-01-31 17:32:29.000000000 +0100 -+++ head/arch/x86/kernel/e820-xen.c 2011-01-31 17:49:31.000000000 +0100 -@@ -224,37 +224,6 @@ unsigned long __init e820_end_of_ram(voi - } +-unsigned char __initdata boot_params[PARAM_SIZE]; ++struct boot_params __initdata boot_params; /* -- * Find the hole size in the range. -- */ --unsigned long __init e820_hole_size(unsigned long start, unsigned long end) --{ -- unsigned long ram = 0; -- int i; -- -- for (i = 0; i < e820.nr_map; i++) { -- struct e820entry *ei = &e820.map[i]; -- unsigned long last, addr; -- -- if (ei->type != E820_RAM || -- ei->addr+ei->size <= start || -- ei->addr >= end) -- continue; -- -- addr = round_up(ei->addr, PAGE_SIZE); -- if (addr < start) -- addr = start; -- -- last = round_down(ei->addr + ei->size, PAGE_SIZE); -- if (last >= end) -- last = end; -- -- if (last > addr) -- ram += last - addr; -- } -- return ((end - start) - ram); --} -- --/* - * Mark e820 reserved areas as busy for the resource manager. + * Point at the empty zero page to start with. We map the real shared_info +@@ -316,18 +307,18 @@ unsigned long __init find_max_low_pfn(vo + printk(KERN_WARNING "Warning only %ldMB will be used.\n", + MAXMEM>>20); + if (max_pfn > MAX_NONPAE_PFN) +- printk(KERN_WARNING "Use a PAE enabled kernel.\n"); ++ printk(KERN_WARNING "Use a HIGHMEM64G enabled kernel.\n"); + else + printk(KERN_WARNING "Use a HIGHMEM enabled kernel.\n"); + max_pfn = MAXMEM_PFN; + #else /* !CONFIG_HIGHMEM */ +-#ifndef CONFIG_X86_PAE ++#ifndef CONFIG_HIGHMEM64G + if (max_pfn > MAX_NONPAE_PFN) { + max_pfn = MAX_NONPAE_PFN; + printk(KERN_WARNING "Warning only 4GB will be used.\n"); +- printk(KERN_WARNING "Use a PAE enabled kernel.\n"); ++ printk(KERN_WARNING "Use a HIGHMEM64G enabled kernel.\n"); + } +-#endif /* !CONFIG_X86_PAE */ ++#endif /* !CONFIG_HIGHMEM64G */ + #endif /* !CONFIG_HIGHMEM */ + } else { + if (highmem_pages == -1) +@@ -516,7 +507,7 @@ void __init setup_bootmem_allocator(void + * + * This should all compile down to nothing when NUMA is off. */ - void __init e820_reserve_resources(struct e820entry *e820, int nr_map) -@@ -327,54 +296,66 @@ void __init e820_mark_nosave_regions(voi - } +-void __init remapped_pgdat_init(void) ++static void __init remapped_pgdat_init(void) + { + int nid; + +@@ -591,7 +582,6 @@ void __init setup_arch(char **cmdline_p) + properly. Setting ROOT_DEV to default to /dev/ram0 breaks initrd. + */ + ROOT_DEV = MKDEV(UNNAMED_MAJOR,0); +- drive_info = DRIVE_INFO; + screen_info = SCREEN_INFO; + copy_edid(); + apm_info.bios = APM_BIOS_INFO; +@@ -767,6 +757,8 @@ void __init setup_arch(char **cmdline_p) + * NOTE: at this point the bootmem allocator is fully available. + */ + ++ paravirt_post_allocator_init(); ++ + if (is_initial_xendomain()) + dmi_scan_machine(); + +@@ -814,6 +806,7 @@ void __init setup_arch(char **cmdline_p) #endif -+/* -+ * Finds an active region in the address range from start_pfn to end_pfn and -+ * returns its range in ei_startpfn and ei_endpfn for the e820 entry. -+ */ -+static int __init e820_find_active_region(const struct e820entry *ei, -+ unsigned long start_pfn, -+ unsigned long end_pfn, -+ unsigned long *ei_startpfn, -+ unsigned long *ei_endpfn) -+{ -+#ifdef CONFIG_XEN -+ if (end_pfn > xen_start_info->nr_pages) -+ end_pfn = xen_start_info->nr_pages; -+#endif -+ -+ *ei_startpfn = round_up(ei->addr, PAGE_SIZE) >> PAGE_SHIFT; -+ *ei_endpfn = round_down(ei->addr + ei->size, PAGE_SIZE) >> PAGE_SHIFT; -+ -+ /* Skip map entries smaller than a page */ -+ if (*ei_startpfn >= *ei_endpfn) -+ return 0; + e820_register_memory(); ++ e820_mark_nosave_regions(); + + if (is_initial_xendomain()) { + #ifdef CONFIG_VT +--- a/arch/x86/kernel/setup_64-xen.c ++++ b/arch/x86/kernel/setup_64-xen.c +@@ -826,6 +826,8 @@ static void __cpuinit init_amd(struct cp + level = cpuid_eax(1); + if (c->x86 == 15 && ((level >= 0x0f48 && level < 0x0f50) || level >= 0x0f58)) + set_bit(X86_FEATURE_REP_GOOD, &c->x86_capability); ++ if (c->x86 == 0x10) ++ set_bit(X86_FEATURE_REP_GOOD, &c->x86_capability); + + /* Enable workaround for FXSAVE leak */ + if (c->x86 >= 6) +@@ -851,8 +853,14 @@ static void __cpuinit init_amd(struct cp + if (c->extended_cpuid_level >= 0x80000008) + amd_detect_cmp(c); + +- /* Fix cpuid4 emulation for more */ +- num_cache_leaves = 3; ++ if (c->extended_cpuid_level >= 0x80000006 && ++ (cpuid_edx(0x80000006) & 0xf000)) ++ num_cache_leaves = 4; ++ else ++ num_cache_leaves = 3; + -+ /* Check if end_pfn_map should be updated */ -+ if (ei->type != E820_RAM && *ei_endpfn > end_pfn_map) -+ end_pfn_map = *ei_endpfn; ++ if (c->x86 == 0xf || c->x86 == 0x10 || c->x86 == 0x11) ++ set_bit(X86_FEATURE_K8, &c->x86_capability); + + /* RDTSC can be speculated around */ + clear_bit(X86_FEATURE_SYNC_RDTSC, &c->x86_capability); +@@ -1097,6 +1105,8 @@ void __cpuinit identify_cpu(struct cpuin + c->x86_capability[2] = cpuid_edx(0x80860001); + } + ++ init_scattered_cpuid_features(c); + -+ /* Skip if map is outside the node */ -+ if (ei->type != E820_RAM || *ei_endpfn <= start_pfn || -+ *ei_startpfn >= end_pfn) -+ return 0; + #ifndef CONFIG_XEN + c->apicid = phys_pkg_id(0); + #endif +@@ -1184,7 +1194,7 @@ static int show_cpuinfo(struct seq_file + "fpu", "vme", "de", "pse", "tsc", "msr", "pae", "mce", + "cx8", "apic", NULL, "sep", "mtrr", "pge", "mca", "cmov", + "pat", "pse36", "pn", "clflush", NULL, "dts", "acpi", "mmx", +- "fxsr", "sse", "sse2", "ss", "ht", "tm", "ia64", NULL, ++ "fxsr", "sse", "sse2", "ss", "ht", "tm", "ia64", "pbe", + + /* AMD-defined */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, +@@ -1200,10 +1210,11 @@ static int show_cpuinfo(struct seq_file + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + + /* Other (Linux-defined) */ +- "cxmmx", NULL, "cyrix_arr", "centaur_mcr", NULL, +- "constant_tsc", NULL, NULL, +- "up", NULL, NULL, NULL, NULL, NULL, NULL, NULL, +- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, ++ "cxmmx", "k6_mtrr", "cyrix_arr", "centaur_mcr", ++ NULL, NULL, NULL, NULL, ++ "constant_tsc", "up", NULL, "arch_perfmon", ++ "pebs", "bts", NULL, "sync_rdtsc", ++ "rep_good", NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + + /* Intel-defined (#2) */ +@@ -1214,7 +1225,7 @@ static int show_cpuinfo(struct seq_file + + /* VIA/Cyrix/Centaur-defined */ + NULL, NULL, "rng", "rng_en", NULL, NULL, "ace", "ace_en", +- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, ++ "ace2", "ace2_en", "phe", "phe_en", "pmm", "pmm_en", NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + +@@ -1225,6 +1236,12 @@ static int show_cpuinfo(struct seq_file + "osvw", "ibs", NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + -+ /* Check for overlaps */ -+ if (*ei_startpfn < start_pfn) -+ *ei_startpfn = start_pfn; -+ if (*ei_endpfn > end_pfn) -+ *ei_endpfn = end_pfn; ++ /* Auxiliary (Linux-defined) */ ++ "ida", NULL, NULL, NULL, NULL, NULL, NULL, NULL, ++ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, ++ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, ++ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + }; + static char *x86_power_flags[] = { + "ts", /* temperature sensor */ +--- a/arch/x86/kernel/smp_32-xen.c ++++ b/arch/x86/kernel/smp_32-xen.c +@@ -22,6 +22,7 @@ + + #include + #include ++#include + #if 0 + #include + #endif +@@ -217,13 +218,13 @@ static unsigned long flush_va; + static DEFINE_SPINLOCK(tlbstate_lock); + + /* +- * We cannot call mmdrop() because we are in interrupt context, ++ * We cannot call mmdrop() because we are in interrupt context, + * instead update mm->cpu_vm_mask. + * + * We need to reload %cr3 since the page tables may be going + * away from under us.. + */ +-static inline void leave_mm (unsigned long cpu) ++void leave_mm(unsigned long cpu) + { + if (per_cpu(cpu_tlbstate, cpu).state == TLBSTATE_OK) + BUG(); +--- a/arch/x86/kernel/smp_64-xen.c ++++ b/arch/x86/kernel/smp_64-xen.c +@@ -362,7 +362,7 @@ __smp_call_function_single(int cpu, void + } + + /* +- * smp_call_function_single - Run a function on another CPU ++ * smp_call_function_single - Run a function on a specific CPU + * @func: The function to run. This must be fast and non-blocking. + * @info: An arbitrary pointer to pass to the function. + * @nonatomic: Currently unused. +@@ -379,17 +379,21 @@ int smp_call_function_single (int cpu, v + { + /* prevent preemption and reschedule on another processor */ + int me = get_cpu(); + -+ /* Obey end_user_pfn to save on memmap */ -+ if (*ei_startpfn >= end_user_pfn) -+ return 0; -+ if (*ei_endpfn > end_user_pfn) -+ *ei_endpfn = end_user_pfn; ++ /* Can deadlock when called with interrupts disabled */ ++ WARN_ON(irqs_disabled()); + -+ return 1; -+} + if (cpu == me) { ++ local_irq_disable(); ++ func(info); ++ local_irq_enable(); + put_cpu(); + return 0; + } + +- /* Can deadlock when called with interrupts disabled */ +- WARN_ON(irqs_disabled()); +- +- spin_lock_bh(&call_lock); ++ spin_lock(&call_lock); + __smp_call_function_single(cpu, func, info, nonatomic, wait); +- spin_unlock_bh(&call_lock); ++ spin_unlock(&call_lock); + put_cpu(); + return 0; + } +--- a/arch/x86/kernel/time-xen.c ++++ b/arch/x86/kernel/time-xen.c +@@ -74,11 +74,12 @@ + #include + #include + +-#ifdef CONFIG_X86_32 + #include + DEFINE_SPINLOCK(i8253_lock); + EXPORT_SYMBOL(i8253_lock); +-#else + - /* Walk the e820 map and register active regions within a node */ - void __init - e820_register_active_regions(int nid, unsigned long start_pfn, - unsigned long end_pfn) - { -+ unsigned long ei_startpfn; -+ unsigned long ei_endpfn; - int i; -- unsigned long ei_startpfn, ei_endpfn; -- for (i = 0; i < e820.nr_map; i++) { -- struct e820entry *ei = &e820.map[i]; -- ei_startpfn = round_up(ei->addr, PAGE_SIZE) >> PAGE_SHIFT; -- ei_endpfn = round_down(ei->addr + ei->size, PAGE_SIZE) -- >> PAGE_SHIFT; ++#ifdef CONFIG_X86_64 ++#include + volatile unsigned long __jiffies __section_jiffies = INITIAL_JIFFIES; + #endif + +@@ -772,56 +773,10 @@ unsigned long read_persistent_clock(void + return retval; + } + +-static void sync_cmos_clock(unsigned long dummy); - -- /* Skip map entries smaller than a page */ -- if (ei_startpfn >= ei_endpfn) -- continue; +-static DEFINE_TIMER(sync_cmos_timer, sync_cmos_clock, 0, 0); +-int no_sync_cmos_clock; - -- /* Check if end_pfn_map should be updated */ -- if (ei->type != E820_RAM && ei_endpfn > end_pfn_map) -- end_pfn_map = ei_endpfn; +-static void sync_cmos_clock(unsigned long dummy) +-{ +- struct timeval now, next; +- int fail = 1; - -- /* Skip if map is outside the node */ -- if (ei->type != E820_RAM || -- ei_endpfn <= start_pfn || -- ei_startpfn >= end_pfn) -- continue; +- /* +- * If we have an externally synchronized Linux clock, then update +- * CMOS clock accordingly every ~11 minutes. Set_rtc_mmss() has to be +- * called as close as possible to 500 ms before the new second starts. +- * This code is run on a timer. If the clock is set, that timer +- * may not expire at the correct time. Thus, we adjust... +- */ +- if (!ntp_synced()) +- /* +- * Not synced, exit, do not restart a timer (if one is +- * running, let it run out). +- */ +- return; - -- /* Check for overlaps */ -- if (ei_startpfn < start_pfn) -- ei_startpfn = start_pfn; -- if (ei_endpfn > end_pfn) -- ei_endpfn = end_pfn; +- do_gettimeofday(&now); +- if (now.tv_usec >= USEC_AFTER - ((unsigned) TICK_SIZE) / 2 && +- now.tv_usec <= USEC_BEFORE + ((unsigned) TICK_SIZE) / 2) +- fail = set_rtc_mmss(now.tv_sec); - -- /* Obey end_user_pfn to save on memmap */ -- if (ei_startpfn >= end_user_pfn) -- continue; -- if (ei_endpfn > end_user_pfn) -- ei_endpfn = end_user_pfn; +- next.tv_usec = USEC_AFTER - now.tv_usec; +- if (next.tv_usec <= 0) +- next.tv_usec += USEC_PER_SEC; - --#ifdef CONFIG_XEN -- if (ei_startpfn >= xen_start_info->nr_pages) -- continue; -- if (ei_endpfn > xen_start_info->nr_pages) -- ei_endpfn = xen_start_info->nr_pages; --#endif - -- add_active_range(nid, ei_startpfn, ei_endpfn); +- if (!fail) +- next.tv_sec = 659; +- else +- next.tv_sec = 0; +- +- if (next.tv_usec >= USEC_PER_SEC) { +- next.tv_sec++; +- next.tv_usec -= USEC_PER_SEC; - } -+ for (i = 0; i < e820.nr_map; i++) -+ if (e820_find_active_region(&e820.map[i], -+ start_pfn, end_pfn, -+ &ei_startpfn, &ei_endpfn)) -+ add_active_range(nid, ei_startpfn, ei_endpfn); - #ifdef CONFIG_XEN - BUG_ON(nid); - add_active_range(nid, end_pfn, end_pfn); -@@ -399,12 +380,35 @@ void __init add_memory_region(unsigned l - e820.nr_map++; +- mod_timer(&sync_cmos_timer, jiffies + timeval_to_jiffies(&next)); +-} +- +-void notify_arch_cmos_timer(void) ++int update_persistent_clock(struct timespec now) + { +- if (!no_sync_cmos_clock) +- mod_timer(&sync_cmos_timer, jiffies + 1); + mod_timer(&sync_xen_wallclock_timer, jiffies + 1); ++ return set_rtc_mmss(now.tv_sec); } -+/* -+ * Find the hole size (in bytes) in the memory range. -+ * @start: starting address of the memory range to scan -+ * @end: ending address of the memory range to scan -+ */ -+unsigned long __init e820_hole_size(unsigned long start, unsigned long end) -+{ -+ unsigned long start_pfn = start >> PAGE_SHIFT; -+ unsigned long end_pfn = end >> PAGE_SHIFT; -+ unsigned long ei_startpfn; -+ unsigned long ei_endpfn; -+ unsigned long ram = 0; -+ int i; + extern void (*late_time_init)(void); +--- a/arch/x86/kernel/traps_32-xen.c ++++ b/arch/x86/kernel/traps_32-xen.c +@@ -41,6 +41,10 @@ + #include + #endif + ++#if defined(CONFIG_EDAC) ++#include ++#endif + -+ for (i = 0; i < e820.nr_map; i++) { -+ if (e820_find_active_region(&e820.map[i], -+ start_pfn, end_pfn, -+ &ei_startpfn, &ei_endpfn)) -+ ram += ei_endpfn - ei_startpfn; -+ } -+ return end - start - (ram << PAGE_SHIFT); -+} + #include + #include + #include +@@ -102,36 +106,45 @@ asmlinkage void machine_check(void); + int kstack_depth_to_print = 24; + static unsigned int code_bytes = 64; + +-static inline int valid_stack_ptr(struct thread_info *tinfo, void *p) ++static inline int valid_stack_ptr(struct thread_info *tinfo, void *p, unsigned size) + { + return p > (void *)tinfo && +- p < (void *)tinfo + THREAD_SIZE - 3; ++ p <= (void *)tinfo + THREAD_SIZE - size; + } + ++/* The form of the top of the frame on the stack */ ++struct stack_frame { ++ struct stack_frame *next_frame; ++ unsigned long return_address; ++}; + - void __init e820_print_map(char *who) + static inline unsigned long print_context_stack(struct thread_info *tinfo, + unsigned long *stack, unsigned long ebp, + struct stacktrace_ops *ops, void *data) { - int i; +- unsigned long addr; +- + #ifdef CONFIG_FRAME_POINTER +- while (valid_stack_ptr(tinfo, (void *)ebp)) { +- unsigned long new_ebp; +- addr = *(unsigned long *)(ebp + 4); ++ struct stack_frame *frame = (struct stack_frame *)ebp; ++ while (valid_stack_ptr(tinfo, frame, sizeof(*frame))) { ++ struct stack_frame *next; ++ unsigned long addr; ++ ++ addr = frame->return_address; + ops->address(data, addr); + /* + * break out of recursive entries (such as + * end_of_stack_stop_unwind_function). Also, + * we can never allow a frame pointer to + * move downwards! +- */ +- new_ebp = *(unsigned long *)ebp; +- if (new_ebp <= ebp) ++ */ ++ next = frame->next_frame; ++ if (next <= frame) + break; +- ebp = new_ebp; ++ frame = next; + } + #else +- while (valid_stack_ptr(tinfo, stack)) { ++ while (valid_stack_ptr(tinfo, stack, sizeof(*stack))) { ++ unsigned long addr; ++ + addr = *stack++; + if (__kernel_text_address(addr)) + ops->address(data, addr); +@@ -154,7 +167,7 @@ void dump_trace(struct task_struct *task + if (!stack) { + unsigned long dummy; + stack = &dummy; +- if (task && task != current) ++ if (task != current) + stack = (unsigned long *)task->thread.esp; + } - for (i = 0; i < e820.nr_map; i++) { -- printk(" %s: %016Lx - %016Lx ", who, -+ printk(KERN_INFO " %s: %016Lx - %016Lx ", who, - (unsigned long long) e820.map[i].addr, - (unsigned long long) (e820.map[i].addr + e820.map[i].size)); - switch (e820.map[i].type) { ---- head.orig/arch/x86/kernel/early_printk-xen.c 2011-01-31 17:32:29.000000000 +0100 -+++ head/arch/x86/kernel/early_printk-xen.c 2011-01-31 17:49:31.000000000 +0100 -@@ -174,6 +174,7 @@ static __init void early_serial_init(cha - * mappings. Someone should fix this for domain 0. For now, use fake serial. - */ - #define early_vga_console early_serial_console -+#define xenboot_console early_serial_console +@@ -213,6 +226,7 @@ static void print_trace_address(void *da + { + printk("%s [<%08lx>] ", (char *)data, addr); + print_symbol("%s\n", addr); ++ touch_nmi_watchdog(); + } - #endif + static struct stacktrace_ops print_trace_ops = { +@@ -396,7 +410,7 @@ void die(const char * str, struct pt_reg + unsigned long esp; + unsigned short ss; -@@ -261,20 +262,22 @@ static int __init setup_early_printk(cha - } else if (!strncmp(buf, "ttyS", 4)) { - early_serial_init(buf); - early_console = &early_serial_console; -- } else if (!strncmp(buf, "vga", 3) -+ } else if (!strncmp(buf, "vga", 3)) { - #ifndef CONFIG_XEN - && SCREEN_INFO.orig_video_isVGA == 1) { - max_xpos = SCREEN_INFO.orig_video_cols; - max_ypos = SCREEN_INFO.orig_video_lines; - current_ypos = SCREEN_INFO.orig_y; --#else -- || !strncmp(buf, "xen", 3)) { - #endif - early_console = &early_vga_console; - } else if (!strncmp(buf, "simnow", 6)) { - simnow_init(buf + 6); - early_console = &simnow_console; - keep_early = 1; -+#ifdef CONFIG_XEN -+ } else if (!strncmp(buf, "xen", 3)) { -+ early_console = &xenboot_console; -+#endif - } +- report_bug(regs->eip); ++ report_bug(regs->eip, regs); - if (keep_early) ---- head.orig/arch/x86/kernel/entry_64-xen.S 2011-10-06 11:55:00.000000000 +0200 -+++ head/arch/x86/kernel/entry_64-xen.S 2011-10-07 11:21:43.000000000 +0200 -@@ -313,7 +313,7 @@ sysret_signal: - TRACE_IRQS_ON - /* sti */ - XEN_UNBLOCK_EVENTS(%rsi) -- testl $(_TIF_SIGPENDING|_TIF_NOTIFY_RESUME|_TIF_SINGLESTEP),%edx -+ testl $(_TIF_SIGPENDING|_TIF_SINGLESTEP|_TIF_MCE_NOTIFY),%edx - jz 1f + printk(KERN_EMERG "%s: %04lx [#%d]\n", str, err & 0xffff, ++die_counter); + #ifdef CONFIG_PREEMPT +@@ -439,6 +453,7 @@ void die(const char * str, struct pt_reg - /* Really a signal */ -@@ -412,7 +412,7 @@ int_very_careful: - jmp int_restore_rest - - int_signal: -- testl $(_TIF_NOTIFY_RESUME|_TIF_SIGPENDING|_TIF_SINGLESTEP),%edx -+ testl $(_TIF_SIGPENDING|_TIF_SINGLESTEP|_TIF_MCE_NOTIFY),%edx - jz 1f - movq %rsp,%rdi # &ptregs -> arg1 - xorl %esi,%esi # oldset -> arg2 -@@ -555,7 +555,7 @@ retint_careful: - jmp retint_check - - retint_signal: -- testl $(_TIF_SIGPENDING|_TIF_NOTIFY_RESUME|_TIF_SINGLESTEP),%edx -+ testl $(_TIF_SIGPENDING|_TIF_SINGLESTEP|_TIF_MCE_NOTIFY),%edx - jz retint_restore_args - TRACE_IRQS_ON - XEN_UNBLOCK_EVENTS(%rsi) ---- head.orig/arch/x86/kernel/head_64-xen.S 2013-03-05 12:30:52.000000000 +0100 -+++ head/arch/x86/kernel/head_64-xen.S 2013-03-05 12:31:06.000000000 +0100 -@@ -25,7 +25,7 @@ - #include - #include + bust_spinlocks(0); + die.lock_owner = -1; ++ add_taint(TAINT_DIE); + spin_unlock_irqrestore(&die.lock, flags); -- .section .bootstrap.text, "ax", @progbits -+ .section .text.head, "ax", @progbits - .code64 - .globl startup_64 - startup_64: -@@ -41,7 +41,7 @@ startup_64: + if (!regs) +@@ -523,10 +538,12 @@ fastcall void do_##name(struct pt_regs * + do_trap(trapnr, signr, str, 0, regs, error_code, NULL); \ + } - #define NEXT_PAGE(name) \ - .balign PAGE_SIZE; \ -- phys_##name = . - .bootstrap.text; \ -+ phys_##name = . - .text.head; \ - ENTRY(name) +-#define DO_ERROR_INFO(trapnr, signr, str, name, sicode, siaddr) \ ++#define DO_ERROR_INFO(trapnr, signr, str, name, sicode, siaddr, irq) \ + fastcall void do_##name(struct pt_regs * regs, long error_code) \ + { \ + siginfo_t info; \ ++ if (irq) \ ++ local_irq_enable(); \ + info.si_signo = signr; \ + info.si_errno = 0; \ + info.si_code = sicode; \ +@@ -566,13 +583,13 @@ DO_VM86_ERROR( 3, SIGTRAP, "int3", int3) + #endif + DO_VM86_ERROR( 4, SIGSEGV, "overflow", overflow) + DO_VM86_ERROR( 5, SIGSEGV, "bounds", bounds) +-DO_ERROR_INFO( 6, SIGILL, "invalid opcode", invalid_op, ILL_ILLOPN, regs->eip) ++DO_ERROR_INFO( 6, SIGILL, "invalid opcode", invalid_op, ILL_ILLOPN, regs->eip, 0) + DO_ERROR( 9, SIGFPE, "coprocessor segment overrun", coprocessor_segment_overrun) + DO_ERROR(10, SIGSEGV, "invalid TSS", invalid_TSS) + DO_ERROR(11, SIGBUS, "segment not present", segment_not_present) + DO_ERROR(12, SIGBUS, "stack segment", stack_segment) +-DO_ERROR_INFO(17, SIGBUS, "alignment check", alignment_check, BUS_ADRALN, 0) +-DO_ERROR_INFO(32, SIGSEGV, "iret exception", iret_error, ILL_BADSTK, 0) ++DO_ERROR_INFO(17, SIGBUS, "alignment check", alignment_check, BUS_ADRALN, 0, 0) ++DO_ERROR_INFO(32, SIGSEGV, "iret exception", iret_error, ILL_BADSTK, 0, 1) - NEXT_PAGE(init_level4_pgt) -@@ -65,6 +65,12 @@ NEXT_PAGE(level3_kernel_pgt) - NEXT_PAGE(level3_user_pgt) - .fill 512,8,0 + fastcall void __kprobes do_general_protection(struct pt_regs * regs, + long error_code) +@@ -585,6 +602,13 @@ fastcall void __kprobes do_general_prote -+NEXT_PAGE(level2_fixmap_pgt) -+ .fill 512,8,0 -+ -+NEXT_PAGE(level1_fixmap_pgt) -+ .fill 512,8,0 + current->thread.error_code = error_code; + current->thread.trap_no = 13; ++ if (show_unhandled_signals && unhandled_signal(current, SIGSEGV) && ++ printk_ratelimit()) ++ printk(KERN_INFO ++ "%s[%d] general protection eip:%lx esp:%lx error:%lx\n", ++ current->comm, current->pid, ++ regs->eip, regs->esp, error_code); + - NEXT_PAGE(hypercall_page) - CFI_STARTPROC - i = 0 -@@ -197,27 +203,27 @@ ENTRY(empty_zero_page) - .byte 0 - #endif /* CONFIG_XEN_COMPAT <= 0x030002 */ - -- ELFNOTE(Xen, XEN_ELFNOTE_GUEST_OS, .asciz, "linux") -- ELFNOTE(Xen, XEN_ELFNOTE_GUEST_VERSION, .asciz, "2.6") -- ELFNOTE(Xen, XEN_ELFNOTE_XEN_VERSION, .asciz, "xen-3.0") -- ELFNOTE(Xen, XEN_ELFNOTE_VIRT_BASE, .quad, __START_KERNEL_map) -+ ELFNOTE(Xen, XEN_ELFNOTE_GUEST_OS, .asciz "linux") -+ ELFNOTE(Xen, XEN_ELFNOTE_GUEST_VERSION, .asciz "2.6") -+ ELFNOTE(Xen, XEN_ELFNOTE_XEN_VERSION, .asciz "xen-3.0") -+ ELFNOTE(Xen, XEN_ELFNOTE_VIRT_BASE, .quad __START_KERNEL_map) - #if CONFIG_XEN_COMPAT <= 0x030002 -- ELFNOTE(Xen, XEN_ELFNOTE_PADDR_OFFSET, .quad, __START_KERNEL_map) -+ ELFNOTE(Xen, XEN_ELFNOTE_PADDR_OFFSET, .quad __START_KERNEL_map) - #else -- ELFNOTE(Xen, XEN_ELFNOTE_PADDR_OFFSET, .quad, 0) -+ ELFNOTE(Xen, XEN_ELFNOTE_PADDR_OFFSET, .quad 0) - #endif -- ELFNOTE(Xen, XEN_ELFNOTE_ENTRY, .quad, startup_64) -- ELFNOTE(Xen, XEN_ELFNOTE_HYPERCALL_PAGE, .quad, hypercall_page) -- ELFNOTE(Xen, XEN_ELFNOTE_L1_MFN_VALID, .quad, _PAGE_PRESENT,_PAGE_PRESENT) -- ELFNOTE(Xen, XEN_ELFNOTE_FEATURES, .ascii, "writable_page_tables"; -- .ascii "|writable_descriptor_tables"; -- .ascii "|auto_translated_physmap"; -- .ascii "|supervisor_mode_kernel"; -- .asciz XEN_DOM0_CAP_STR) -- ELFNOTE(Xen, XEN_ELFNOTE_SUPPORTED_FEATURES, .long, XEN_DOM0_CAP | -+ ELFNOTE(Xen, XEN_ELFNOTE_ENTRY, .quad startup_64) -+ ELFNOTE(Xen, XEN_ELFNOTE_HYPERCALL_PAGE, .quad hypercall_page) -+ ELFNOTE(Xen, XEN_ELFNOTE_L1_MFN_VALID, .quad _PAGE_PRESENT, _PAGE_PRESENT) -+ ELFNOTE(Xen, XEN_ELFNOTE_FEATURES, .ascii "writable_page_tables"; -+ .ascii "|writable_descriptor_tables"; -+ .ascii "|auto_translated_physmap"; -+ .ascii "|supervisor_mode_kernel"; -+ .asciz XEN_DOM0_CAP_STR) -+ ELFNOTE(Xen, XEN_ELFNOTE_SUPPORTED_FEATURES, .long XEN_DOM0_CAP | - (1 << XENFEAT_writable_page_tables) | - (1 << XENFEAT_writable_descriptor_tables) | - (1 << XENFEAT_auto_translated_physmap) | - (1 << XENFEAT_supervisor_mode_kernel)) -- ELFNOTE(Xen, XEN_ELFNOTE_LOADER, .asciz, "generic") -- ELFNOTE(Xen, XEN_ELFNOTE_SUSPEND_CANCEL, .long, 1) -+ ELFNOTE(Xen, XEN_ELFNOTE_LOADER, .asciz "generic") -+ ELFNOTE(Xen, XEN_ELFNOTE_SUSPEND_CANCEL, .long 1) ---- head.orig/arch/x86/kernel/head64-xen.c 2011-08-09 10:37:35.000000000 +0200 -+++ head/arch/x86/kernel/head64-xen.c 2011-08-09 10:41:42.000000000 +0200 -@@ -89,7 +89,7 @@ void __init x86_64_start_kernel(char * r - struct xen_machphys_mapping mapping; - int i; + force_sig(SIGSEGV, current); + return; -- setup_xen_features(); -+ xen_setup_features(); +@@ -610,6 +634,14 @@ mem_parity_error(unsigned char reason, s + printk(KERN_EMERG "Uhhuh. NMI received for unknown reason %02x on " + "CPU %d.\n", reason, smp_processor_id()); + printk(KERN_EMERG "You have some hardware problem, likely on the PCI bus.\n"); ++ ++#if defined(CONFIG_EDAC) ++ if(edac_handler_set()) { ++ edac_atomic_assert_error(); ++ return; ++ } ++#endif ++ + if (panic_on_unrecovered_nmi) + panic("NMI: Not continuing"); - xen_start_info = (struct start_info *)real_mode_data; - if (!xen_feature(XENFEAT_auto_translated_physmap)) ---- head.orig/arch/x86/kernel/apic/io_apic-xen.c 2011-01-31 17:32:29.000000000 +0100 -+++ head/arch/x86/kernel/apic/io_apic-xen.c 2011-01-31 17:49:31.000000000 +0100 -@@ -165,7 +165,9 @@ static inline void io_apic_write(unsigne - #endif +@@ -720,6 +752,8 @@ static __kprobes void default_do_nmi(str + reassert_nmi(); } --#ifndef CONFIG_XEN -+#ifdef CONFIG_XEN -+#define io_apic_modify io_apic_write -+#else - /* - * Re-write a value: to be used for read-modify-write - * cycles where the read already set up the index register. -@@ -175,8 +177,32 @@ static inline void io_apic_modify(unsign - struct io_apic __iomem *io_apic = io_apic_base(apic); - writel(value, &io_apic->data); - } --#else --#define io_apic_modify io_apic_write ++static int ignore_nmis; + -+static int io_apic_level_ack_pending(unsigned int irq) + fastcall __kprobes void do_nmi(struct pt_regs * regs, long error_code) + { + int cpu; +@@ -730,11 +764,24 @@ fastcall __kprobes void do_nmi(struct pt + + ++nmi_count(cpu); + +- default_do_nmi(regs); ++ if (!ignore_nmis) ++ default_do_nmi(regs); + + nmi_exit(); + } + ++void stop_nmi(void) +{ -+ struct irq_pin_list *entry; -+ unsigned long flags; -+ int pending = 0; -+ -+ spin_lock_irqsave(&ioapic_lock, flags); -+ entry = irq_2_pin + irq; -+ for (;;) { -+ unsigned int reg; -+ int pin; ++ acpi_nmi_disable(); ++ ignore_nmis++; ++} + -+ pin = entry->pin; -+ if (pin == -1) -+ break; -+ reg = io_apic_read(entry->apic, 0x10 + pin*2); -+ /* Is the remote IRR bit set? */ -+ pending |= (reg >> 14) & 1; -+ if (!entry->next) -+ break; -+ entry = irq_2_pin + entry->next; -+ } -+ spin_unlock_irqrestore(&ioapic_lock, flags); -+ return pending; ++void restart_nmi(void) ++{ ++ ignore_nmis--; ++ acpi_nmi_enable(); +} - #endif ++ + #ifdef CONFIG_KPROBES + fastcall void __kprobes do_int3(struct pt_regs *regs, long error_code) + { +--- a/arch/x86/kernel/traps_64-xen.c ++++ b/arch/x86/kernel/traps_64-xen.c +@@ -34,6 +34,10 @@ + #include + #include - /* -@@ -406,14 +432,12 @@ static void clear_IO_APIC (void) - int skip_ioapic_setup; - int ioapic_force; ++#if defined(CONFIG_EDAC) ++#include ++#endif ++ + #include + #include + #include +@@ -332,6 +336,7 @@ static int print_trace_stack(void *data, --/* dummy parsing: see setup.c */ -- --static int __init disable_ioapic_setup(char *str) -+static int __init parse_noapic(char *str) + static void print_trace_address(void *data, unsigned long addr) { -- skip_ioapic_setup = 1; -+ disable_ioapic_setup(); - return 0; ++ touch_nmi_watchdog(); + printk_address(addr); } --early_param("noapic", disable_ioapic_setup); -+early_param("noapic", parse_noapic); - /* Actually the next is obsolete, but keep it for paranoid reasons -AK */ - static int __init disable_timer_pin_setup(char *arg) -@@ -765,12 +789,15 @@ static struct irq_chip ioapic_chip; +@@ -520,6 +525,7 @@ void __kprobes __die(const char * str, s + printk("\n"); + notify_die(DIE_OOPS, str, regs, err, current->thread.trap_no, SIGSEGV); + show_registers(regs); ++ add_taint(TAINT_DIE); + /* Executive summary in case the oops scrolled away */ + printk(KERN_ALERT "RIP "); + printk_address(regs->rip); +@@ -533,7 +539,7 @@ void die(const char * str, struct pt_reg + unsigned long flags = oops_begin(); - static void ioapic_register_intr(int irq, unsigned long trigger) - { -- if (trigger) -+ if (trigger) { -+ irq_desc[irq].status |= IRQ_LEVEL; - set_irq_chip_and_handler_name(irq, &ioapic_chip, - handle_fasteoi_irq, "fasteoi"); -- else -+ } else { -+ irq_desc[irq].status &= ~IRQ_LEVEL; - set_irq_chip_and_handler_name(irq, &ioapic_chip, - handle_edge_irq, "edge"); + if (!user_mode(regs)) +- report_bug(regs->rip); ++ report_bug(regs->rip, regs); + + __die(str, regs, err); + oops_end(flags); +@@ -582,7 +588,8 @@ static void __kprobes do_trap(int trapnr + tsk->thread.error_code = error_code; + tsk->thread.trap_no = trapnr; + +- if (exception_trace && unhandled_signal(tsk, signr)) ++ if (show_unhandled_signals && unhandled_signal(tsk, signr) && ++ printk_ratelimit()) + printk(KERN_INFO + "%s[%d] trap %s rip:%lx rsp:%lx error:%lx\n", + tsk->comm, tsk->pid, str, +@@ -686,7 +693,8 @@ asmlinkage void __kprobes do_general_pro + tsk->thread.error_code = error_code; + tsk->thread.trap_no = 13; + +- if (exception_trace && unhandled_signal(tsk, SIGSEGV)) ++ if (show_unhandled_signals && unhandled_signal(tsk, SIGSEGV) && ++ printk_ratelimit()) + printk(KERN_INFO + "%s[%d] general protection rip:%lx rsp:%lx error:%lx\n", + tsk->comm, tsk->pid, +@@ -721,6 +729,13 @@ mem_parity_error(unsigned char reason, s + reason); + printk(KERN_EMERG "You have some hardware problem, likely on the PCI bus.\n"); + ++#if defined(CONFIG_EDAC) ++ if(edac_handler_set()) { ++ edac_atomic_assert_error(); ++ return; + } - } - #else - #define ioapic_register_intr(irq, trigger) evtchn_register_pirq(irq) -@@ -1419,9 +1446,37 @@ static void ack_apic_level(unsigned int - ack_APIC_irq(); ++#endif ++ + if (panic_on_unrecovered_nmi) + panic("NMI: Not continuing"); - /* Now we can move and renable the irq */ -- move_masked_irq(irq); -- if (unlikely(do_unmask_irq)) -+ if (unlikely(do_unmask_irq)) { -+ /* Only migrate the irq if the ack has been received. -+ * -+ * On rare occasions the broadcast level triggered ack gets -+ * delayed going to ioapics, and if we reprogram the -+ * vector while Remote IRR is still set the irq will never -+ * fire again. -+ * -+ * To prevent this scenario we read the Remote IRR bit -+ * of the ioapic. This has two effects. -+ * - On any sane system the read of the ioapic will -+ * flush writes (and acks) going to the ioapic from -+ * this cpu. -+ * - We get to see if the ACK has actually been delivered. -+ * -+ * Based on failed experiments of reprogramming the -+ * ioapic entry from outside of irq context starting -+ * with masking the ioapic entry and then polling until -+ * Remote IRR was clear before reprogramming the -+ * ioapic I don't trust the Remote IRR bit to be -+ * completey accurate. -+ * -+ * However there appears to be no other way to plug -+ * this race, so if the Remote IRR bit is not -+ * accurate and is causing problems then it is a hardware bug -+ * and you can go talk to the chipset vendor about it. -+ */ -+ if (!io_apic_level_ack_pending(irq)) -+ move_masked_irq(irq); - unmask_IO_APIC_irq(irq); -+ } - } - - static struct irq_chip ioapic_chip __read_mostly = { ---- head.orig/arch/x86/kernel/ldt-xen.c 2011-01-31 17:32:29.000000000 +0100 -+++ head/arch/x86/kernel/ldt-xen.c 2011-01-31 17:49:31.000000000 +0100 -@@ -114,6 +114,8 @@ int init_new_context(struct task_struct - memset(&mm->context, 0, sizeof(mm->context)); - init_MUTEX(&mm->context.sem); - old_mm = current->mm; -+ if (old_mm) -+ mm->context.vdso = old_mm->context.vdso; - if (old_mm && old_mm->context.size > 0) { - down(&old_mm->context.sem); - retval = copy_ldt(&mm->context, &old_mm->context); -@@ -146,7 +148,7 @@ void destroy_context(struct mm_struct *m - kfree(mm->context.ldt); - mm->context.size = 0; - } -- if (!mm->context.pinned) { -+ if (!PagePinned(virt_to_page(mm->pgd))) { - spin_lock(&mm_unpinned_lock); - list_del(&mm->context.unpinned); - spin_unlock(&mm_unpinned_lock); ---- head.orig/arch/x86/kernel/process_64-xen.c 2011-02-02 08:31:39.000000000 +0100 -+++ head/arch/x86/kernel/process_64-xen.c 2011-02-02 08:31:50.000000000 +0100 -@@ -26,6 +26,7 @@ - #include - #include - #include -+#include - #include - #include - #include -@@ -248,6 +249,7 @@ early_param("idle", idle_setup); - void __show_regs(struct pt_regs * regs) - { - unsigned long fs, gs, shadowgs; -+ unsigned long d0, d1, d2, d3, d6, d7; - unsigned int fsindex,gsindex; - unsigned int ds,cs,es; +--- a/arch/x86/kernel/vsyscall_64-xen.c ++++ b/arch/x86/kernel/vsyscall_64-xen.c +@@ -42,6 +42,7 @@ + #include + #include + #include ++#include -@@ -287,6 +289,14 @@ void __show_regs(struct pt_regs * regs) - fs,fsindex,gs,gsindex,shadowgs); - printk("CS: %04x DS: %04x ES: %04x\n", cs, ds, es); + #define __vsyscall(nr) __attribute__ ((unused,__section__(".vsyscall_" #nr))) + #define __syscall_clobber "r11","rcx","memory" +@@ -57,26 +58,9 @@ + * - writen by timer interrupt or systcl (/proc/sys/kernel/vsyscall64) + * Try to keep this structure as small as possible to avoid cache line ping pongs + */ +-struct vsyscall_gtod_data_t { +- seqlock_t lock; +- +- /* open coded 'struct timespec' */ +- time_t wall_time_sec; +- u32 wall_time_nsec; +- +- int sysctl_enabled; +- struct timezone sys_tz; +- struct { /* extract of a clocksource struct */ +- cycle_t (*vread)(void); +- cycle_t cycle_last; +- cycle_t mask; +- u32 mult; +- u32 shift; +- } clock; +-}; + int __vgetcpu_mode __section_vgetcpu_mode; -+ get_debugreg(d0, 0); -+ get_debugreg(d1, 1); -+ get_debugreg(d2, 2); -+ printk("DR0: %016lx DR1: %016lx DR2: %016lx\n", d0, d1, d2); -+ get_debugreg(d3, 3); -+ get_debugreg(d6, 6); -+ get_debugreg(d7, 7); -+ printk("DR3: %016lx DR6: %016lx DR7: %016lx\n", d3, d6, d7); +-struct vsyscall_gtod_data_t __vsyscall_gtod_data __section_vsyscall_gtod_data = ++struct vsyscall_gtod_data __vsyscall_gtod_data __section_vsyscall_gtod_data = + { + .lock = SEQLOCK_UNLOCKED, + .sysctl_enabled = 1, +@@ -96,6 +80,8 @@ void update_vsyscall(struct timespec *wa + vsyscall_gtod_data.wall_time_sec = wall_time->tv_sec; + vsyscall_gtod_data.wall_time_nsec = wall_time->tv_nsec; + vsyscall_gtod_data.sys_tz = sys_tz; ++ vsyscall_gtod_data.wall_time_nsec = wall_time->tv_nsec; ++ vsyscall_gtod_data.wall_to_monotonic = wall_to_monotonic; + write_sequnlock_irqrestore(&vsyscall_gtod_data.lock, flags); } - void show_regs(struct pt_regs *regs) ---- head.orig/arch/x86/kernel/setup_64-xen.c 2012-06-06 13:49:31.000000000 +0200 -+++ head/arch/x86/kernel/setup_64-xen.c 2012-06-06 13:52:43.000000000 +0200 -@@ -826,6 +826,8 @@ static void __cpuinit init_amd(struct cp - level = cpuid_eax(1); - if (c->x86 == 15 && ((level >= 0x0f48 && level < 0x0f50) || level >= 0x0f58)) - set_bit(X86_FEATURE_REP_GOOD, &c->x86_capability); -+ if (c->x86 == 0x10) -+ set_bit(X86_FEATURE_REP_GOOD, &c->x86_capability); +--- a/arch/x86/mach-xen/setup.c ++++ b/arch/x86/mach-xen/setup.c +@@ -12,6 +12,7 @@ + #include + #include + #include ++#include - /* Enable workaround for FXSAVE leak */ - if (c->x86 >= 6) -@@ -851,8 +853,14 @@ static void __cpuinit init_amd(struct cp - if (c->extended_cpuid_level >= 0x80000008) - amd_detect_cmp(c); + #include + #include +@@ -100,7 +101,7 @@ void __init pre_setup_arch_hook(void) -- /* Fix cpuid4 emulation for more */ -- num_cache_leaves = 3; -+ if (c->extended_cpuid_level >= 0x80000006 && -+ (cpuid_edx(0x80000006) & 0xf000)) -+ num_cache_leaves = 4; -+ else -+ num_cache_leaves = 3; -+ -+ if (c->x86 == 0xf || c->x86 == 0x10 || c->x86 == 0x11) -+ set_bit(X86_FEATURE_K8, &c->x86_capability); + init_mm.pgd = swapper_pg_dir = (pgd_t *)xen_start_info->pt_base; - /* RDTSC can be speculated around */ - clear_bit(X86_FEATURE_SYNC_RDTSC, &c->x86_capability); -@@ -1097,6 +1105,8 @@ void __cpuinit identify_cpu(struct cpuin - c->x86_capability[2] = cpuid_edx(0x80860001); - } +- setup_xen_features(); ++ xen_setup_features(); -+ init_scattered_cpuid_features(c); -+ - #ifndef CONFIG_XEN - c->apicid = phys_pkg_id(0); + if (HYPERVISOR_xen_version(XENVER_platform_parameters, &pp) == 0) { + hypervisor_virt_start = pp.virt_start; +@@ -157,4 +158,18 @@ void __init machine_specific_arch_setup( + HYPERVISOR_nmi_op(XENNMI_register_callback, &cb); + } #endif -@@ -1184,7 +1194,7 @@ static int show_cpuinfo(struct seq_file - "fpu", "vme", "de", "pse", "tsc", "msr", "pae", "mce", - "cx8", "apic", NULL, "sep", "mtrr", "pge", "mca", "cmov", - "pat", "pse36", "pn", "clflush", NULL, "dts", "acpi", "mmx", -- "fxsr", "sse", "sse2", "ss", "ht", "tm", "ia64", NULL, -+ "fxsr", "sse", "sse2", "ss", "ht", "tm", "ia64", "pbe", - - /* AMD-defined */ - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, -@@ -1200,10 +1210,11 @@ static int show_cpuinfo(struct seq_file - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, - - /* Other (Linux-defined) */ -- "cxmmx", NULL, "cyrix_arr", "centaur_mcr", NULL, -- "constant_tsc", NULL, NULL, -- "up", NULL, NULL, NULL, NULL, NULL, NULL, NULL, -- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, -+ "cxmmx", "k6_mtrr", "cyrix_arr", "centaur_mcr", -+ NULL, NULL, NULL, NULL, -+ "constant_tsc", "up", NULL, "arch_perfmon", -+ "pebs", "bts", NULL, "sync_rdtsc", -+ "rep_good", NULL, NULL, NULL, NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, - - /* Intel-defined (#2) */ -@@ -1214,7 +1225,7 @@ static int show_cpuinfo(struct seq_file - - /* VIA/Cyrix/Centaur-defined */ - NULL, NULL, "rng", "rng_en", NULL, NULL, "ace", "ace_en", -- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, -+ "ace2", "ace2_en", "phe", "phe_en", "pmm", "pmm_en", NULL, NULL, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, - -@@ -1225,6 +1236,12 @@ static int show_cpuinfo(struct seq_file - "osvw", "ibs", NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + -+ /* Auxiliary (Linux-defined) */ -+ "ida", NULL, NULL, NULL, NULL, NULL, NULL, NULL, -+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, -+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, -+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, - }; - static char *x86_power_flags[] = { - "ts", /* temperature sensor */ ---- head.orig/arch/x86/kernel/smp_64-xen.c 2011-01-31 17:32:29.000000000 +0100 -+++ head/arch/x86/kernel/smp_64-xen.c 2011-01-31 17:49:31.000000000 +0100 -@@ -362,7 +362,7 @@ __smp_call_function_single(int cpu, void ++ /* Do an early initialization of the fixmap area */ ++ { ++ extern pte_t swapper_pg_pmd[PTRS_PER_PTE]; ++ unsigned long addr = __fix_to_virt(FIX_EARLYCON_MEM_BASE); ++ pgd_t *pgd = (pgd_t *)xen_start_info->pt_base; ++ pud_t *pud = pud_offset(pgd + pgd_index(addr), addr); ++ pmd_t *pmd = pmd_offset(pud, addr); ++ ++ swapper_pg_dir = pgd; ++ init_mm.pgd = pgd; ++ make_lowmem_page_readonly(swapper_pg_pmd, XENFEAT_writable_page_tables); ++ set_pmd(pmd, __pmd(__pa_symbol(swapper_pg_pmd) | _PAGE_TABLE)); ++ } + } +--- a/arch/x86/mm/fault_32-xen.c ++++ b/arch/x86/mm/fault_32-xen.c +@@ -346,7 +346,10 @@ static inline pmd_t *vmalloc_sync_one(pg + pmd_k = pmd_offset(pud_k, address); + if (!pmd_present(*pmd_k)) + return NULL; +- if (!pmd_present(*pmd)) ++ if (!pmd_present(*pmd)) { ++ bool lazy = x86_read_percpu(xen_lazy_mmu); ++ ++ x86_write_percpu(xen_lazy_mmu, false); + #if CONFIG_XEN_COMPAT > 0x030002 + set_pmd(pmd, *pmd_k); + #else +@@ -356,7 +359,8 @@ static inline pmd_t *vmalloc_sync_one(pg + */ + set_pmd(pmd, __pmd(pmd_val(*pmd_k))); + #endif +- else ++ x86_write_percpu(xen_lazy_mmu, lazy); ++ } else + BUG_ON(pmd_page(*pmd) != pmd_page(*pmd_k)); + return pmd_k; + } +@@ -388,6 +392,8 @@ static inline int vmalloc_fault(unsigned + return 0; } - /* -- * smp_call_function_single - Run a function on another CPU -+ * smp_call_function_single - Run a function on a specific CPU - * @func: The function to run. This must be fast and non-blocking. - * @info: An arbitrary pointer to pass to the function. - * @nonatomic: Currently unused. -@@ -379,17 +379,21 @@ int smp_call_function_single (int cpu, v - { - /* prevent preemption and reschedule on another processor */ - int me = get_cpu(); ++int show_unhandled_signals = 1; + -+ /* Can deadlock when called with interrupts disabled */ -+ WARN_ON(irqs_disabled()); -+ - if (cpu == me) { -+ local_irq_disable(); -+ func(info); -+ local_irq_enable(); - put_cpu(); - return 0; - } - -- /* Can deadlock when called with interrupts disabled */ -- WARN_ON(irqs_disabled()); -- -- spin_lock_bh(&call_lock); -+ spin_lock(&call_lock); - __smp_call_function_single(cpu, func, info, nonatomic, wait); -- spin_unlock_bh(&call_lock); -+ spin_unlock(&call_lock); - put_cpu(); - return 0; - } ---- head.orig/arch/x86/kernel/traps_64-xen.c 2011-01-31 17:32:29.000000000 +0100 -+++ head/arch/x86/kernel/traps_64-xen.c 2011-01-31 17:49:31.000000000 +0100 -@@ -34,6 +34,10 @@ - #include - #include - -+#if defined(CONFIG_EDAC) -+#include -+#endif -+ - #include - #include - #include -@@ -332,6 +336,7 @@ static int print_trace_stack(void *data, - - static void print_trace_address(void *data, unsigned long addr) - { -+ touch_nmi_watchdog(); - printk_address(addr); - } - -@@ -520,6 +525,7 @@ void __kprobes __die(const char * str, s - printk("\n"); - notify_die(DIE_OOPS, str, regs, err, current->thread.trap_no, SIGSEGV); - show_registers(regs); -+ add_taint(TAINT_DIE); - /* Executive summary in case the oops scrolled away */ - printk(KERN_ALERT "RIP "); - printk_address(regs->rip); -@@ -533,7 +539,7 @@ void die(const char * str, struct pt_reg - unsigned long flags = oops_begin(); - - if (!user_mode(regs)) -- report_bug(regs->rip); -+ report_bug(regs->rip, regs); + /* + * This routine handles page faults. It determines the address, + * and the problem, and then passes it off to one of the appropriate +@@ -408,6 +414,7 @@ fastcall void __kprobes do_page_fault(st + struct vm_area_struct * vma; + unsigned long address; + int write, si_code; ++ int fault; - __die(str, regs, err); - oops_end(flags); -@@ -582,7 +588,8 @@ static void __kprobes do_trap(int trapnr - tsk->thread.error_code = error_code; - tsk->thread.trap_no = trapnr; + /* get the address */ + address = read_cr2(); +@@ -541,20 +548,18 @@ good_area: + * make sure we exit gracefully rather than endlessly redo + * the fault. + */ +- switch (handle_mm_fault(mm, vma, address, write)) { +- case VM_FAULT_MINOR: +- tsk->min_flt++; +- break; +- case VM_FAULT_MAJOR: +- tsk->maj_flt++; +- break; +- case VM_FAULT_SIGBUS: +- goto do_sigbus; +- case VM_FAULT_OOM: ++ fault = handle_mm_fault(mm, vma, address, write); ++ if (unlikely(fault & VM_FAULT_ERROR)) { ++ if (fault & VM_FAULT_OOM) + goto out_of_memory; +- default: +- BUG(); ++ else if (fault & VM_FAULT_SIGBUS) ++ goto do_sigbus; ++ BUG(); + } ++ if (fault & VM_FAULT_MAJOR) ++ tsk->maj_flt++; ++ else ++ tsk->min_flt++; -- if (exception_trace && unhandled_signal(tsk, signr)) -+ if (show_unhandled_signals && unhandled_signal(tsk, signr) && -+ printk_ratelimit()) - printk(KERN_INFO - "%s[%d] trap %s rip:%lx rsp:%lx error:%lx\n", - tsk->comm, tsk->pid, str, -@@ -686,7 +693,8 @@ asmlinkage void __kprobes do_general_pro - tsk->thread.error_code = error_code; - tsk->thread.trap_no = 13; + /* + * Did it hit the DOS screen memory VA from vm86 mode? +@@ -589,6 +594,14 @@ bad_area_nosemaphore: + if (is_prefetch(regs, address, error_code)) + return; -- if (exception_trace && unhandled_signal(tsk, SIGSEGV)) + if (show_unhandled_signals && unhandled_signal(tsk, SIGSEGV) && -+ printk_ratelimit()) - printk(KERN_INFO - "%s[%d] general protection rip:%lx rsp:%lx error:%lx\n", - tsk->comm, tsk->pid, -@@ -721,6 +729,13 @@ mem_parity_error(unsigned char reason, s - reason); - printk(KERN_EMERG "You have some hardware problem, likely on the PCI bus.\n"); - -+#if defined(CONFIG_EDAC) -+ if(edac_handler_set()) { -+ edac_atomic_assert_error(); -+ return; -+ } -+#endif -+ - if (panic_on_unrecovered_nmi) - panic("NMI: Not continuing"); - ---- head.orig/arch/x86/kernel/vsyscall_64-xen.c 2011-01-31 17:32:29.000000000 +0100 -+++ head/arch/x86/kernel/vsyscall_64-xen.c 2011-01-31 17:49:31.000000000 +0100 -@@ -42,6 +42,7 @@ - #include - #include - #include -+#include - - #define __vsyscall(nr) __attribute__ ((unused,__section__(".vsyscall_" #nr))) - #define __syscall_clobber "r11","rcx","memory" -@@ -57,26 +58,9 @@ - * - writen by timer interrupt or systcl (/proc/sys/kernel/vsyscall64) - * Try to keep this structure as small as possible to avoid cache line ping pongs - */ --struct vsyscall_gtod_data_t { -- seqlock_t lock; -- -- /* open coded 'struct timespec' */ -- time_t wall_time_sec; -- u32 wall_time_nsec; -- -- int sysctl_enabled; -- struct timezone sys_tz; -- struct { /* extract of a clocksource struct */ -- cycle_t (*vread)(void); -- cycle_t cycle_last; -- cycle_t mask; -- u32 mult; -- u32 shift; -- } clock; --}; - int __vgetcpu_mode __section_vgetcpu_mode; - --struct vsyscall_gtod_data_t __vsyscall_gtod_data __section_vsyscall_gtod_data = -+struct vsyscall_gtod_data __vsyscall_gtod_data __section_vsyscall_gtod_data = - { - .lock = SEQLOCK_UNLOCKED, - .sysctl_enabled = 1, -@@ -96,6 +80,8 @@ void update_vsyscall(struct timespec *wa - vsyscall_gtod_data.wall_time_sec = wall_time->tv_sec; - vsyscall_gtod_data.wall_time_nsec = wall_time->tv_nsec; - vsyscall_gtod_data.sys_tz = sys_tz; -+ vsyscall_gtod_data.wall_time_nsec = wall_time->tv_nsec; -+ vsyscall_gtod_data.wall_to_monotonic = wall_to_monotonic; - write_sequnlock_irqrestore(&vsyscall_gtod_data.lock, flags); - } - ---- head.orig/arch/x86/mm/fault_64-xen.c 2011-07-26 09:27:41.000000000 +0200 -+++ head/arch/x86/mm/fault_64-xen.c 2011-08-15 10:44:41.000000000 +0200 ++ printk_ratelimit()) { ++ printk("%s%s[%d]: segfault at %08lx eip %08lx " ++ "esp %08lx error %lx\n", ++ tsk->pid > 1 ? KERN_INFO : KERN_EMERG, ++ tsk->comm, tsk->pid, address, regs->eip, ++ regs->esp, error_code); ++ } + tsk->thread.cr2 = address; + /* Kernel addresses are always protection faults */ + tsk->thread.error_code = error_code | (address >= TASK_SIZE); +--- a/arch/x86/mm/fault_64-xen.c ++++ b/arch/x86/mm/fault_64-xen.c @@ -160,7 +160,9 @@ void dump_pagetable(unsigned long addres pmd_t *pmd; pte_t *pte; @@ -1983,70 +2494,157 @@ Acked-by: jbeulich@novell.com goto no_context; do_sigbus: ---- head.orig/arch/x86/mm/init_64-xen.c 2011-11-03 12:08:43.000000000 +0100 -+++ head/arch/x86/mm/init_64-xen.c 2011-01-31 17:49:31.000000000 +0100 -@@ -66,6 +66,9 @@ int after_bootmem; - DEFINE_PER_CPU(struct mmu_gather, mmu_gathers); - extern unsigned long start_pfn; - -+extern pmd_t level2_fixmap_pgt[PTRS_PER_PMD]; -+extern pte_t level1_fixmap_pgt[PTRS_PER_PTE]; -+ - /* - * Use this until direct mapping is established, i.e. before __va() is - * available in init_memory_mapping(). -@@ -362,6 +365,10 @@ __set_fixmap (enum fixed_addresses idx, - set_pte_phys(address, phys, prot, 0); - set_pte_phys(address, phys, prot, 1); - break; -+ case FIX_EARLYCON_MEM_BASE: -+ xen_l1_entry_update(level1_fixmap_pgt + pte_index(address), -+ pfn_pte_ma(phys >> PAGE_SHIFT, prot)); -+ break; - default: - set_pte_phys_ma(address, phys, prot); - break; -@@ -595,6 +602,19 @@ void __init xen_init_pt(void) - __user_pgd(init_level4_pgt)[pgd_index(VSYSCALL_START)] = - __pgd(__pa_symbol(level3_user_pgt) | _PAGE_TABLE); +--- a/arch/x86/mm/highmem_32-xen.c ++++ b/arch/x86/mm/highmem_32-xen.c +@@ -34,17 +34,16 @@ void *kmap_atomic_prot(struct page *page + /* even !CONFIG_PREEMPT needs this, for in_atomic in do_page_fault */ + pagefault_disable(); -+ /* Do an early initialization of the fixmap area. */ -+ addr = __fix_to_virt(FIX_EARLYCON_MEM_BASE); -+ if (pud_present(level3_kernel_pgt[pud_index(addr)])) { -+ unsigned long adr = page[pud_index(addr)]; -+ -+ addr_to_page(adr, page); -+ copy_page(level2_fixmap_pgt, page); -+ } -+ level3_kernel_pgt[pud_index(addr)] = -+ __pud(__pa_symbol(level2_fixmap_pgt) | _PAGE_TABLE); -+ level2_fixmap_pgt[pmd_index(addr)] = -+ __pmd(__pa_symbol(level1_fixmap_pgt) | _PAGE_TABLE); -+ - early_make_page_readonly(init_level4_pgt, - XENFEAT_writable_page_tables); - early_make_page_readonly(__user_pgd(init_level4_pgt), -@@ -603,6 +623,10 @@ void __init xen_init_pt(void) - XENFEAT_writable_page_tables); - early_make_page_readonly(level3_user_pgt, - XENFEAT_writable_page_tables); -+ early_make_page_readonly(level2_fixmap_pgt, -+ XENFEAT_writable_page_tables); -+ early_make_page_readonly(level1_fixmap_pgt, -+ XENFEAT_writable_page_tables); +- idx = type + KM_TYPE_NR*smp_processor_id(); +- BUG_ON(!pte_none(*(kmap_pte-idx))); +- + if (!PageHighMem(page)) + return page_address(page); - if (!xen_feature(XENFEAT_writable_page_tables)) { - xen_pgd_pin(__pa_symbol(init_level4_pgt)); -@@ -832,7 +856,7 @@ void __init paging_init(void) - sparse_init(); - free_area_init_nodes(max_zone_pfns); ++ idx = type + KM_TYPE_NR*smp_processor_id(); + vaddr = __fix_to_virt(FIX_KMAP_BEGIN + idx); ++ BUG_ON(!pte_none(*(kmap_pte-idx))); + set_pte_at(&init_mm, vaddr, kmap_pte-idx, mk_pte(page, prot)); + /*arch_flush_lazy_mmu_mode();*/ -- init_mm.context.pinned = 1; -+ SetPagePinned(virt_to_page(init_mm.pgd)); +- return (void*) vaddr; ++ return (void *)vaddr; } - #endif -@@ -1155,41 +1179,6 @@ int kern_addr_valid(unsigned long addr) + void *kmap_atomic(struct page *page, enum km_type type) +--- a/arch/x86/mm/init_32-xen.c ++++ b/arch/x86/mm/init_32-xen.c +@@ -96,7 +96,7 @@ static pte_t * __init one_page_table_ini + #endif + pte_t *page_table = (pte_t *) alloc_bootmem_low_pages(PAGE_SIZE); + +- paravirt_alloc_pt(__pa(page_table) >> PAGE_SHIFT); ++ paravirt_alloc_pt(&init_mm, __pa(page_table) >> PAGE_SHIFT); + make_lowmem_page_readonly(page_table, + XENFEAT_writable_page_tables); + set_pmd(pmd, __pmd(__pa(page_table) | _PAGE_TABLE)); +@@ -453,7 +453,7 @@ static void __init pagetable_init (void) + xen_pagetable_setup_done(pgd_base); + } + +-#if defined(CONFIG_SOFTWARE_SUSPEND) || defined(CONFIG_ACPI_SLEEP) ++#if defined(CONFIG_HIBERNATION) || defined(CONFIG_ACPI) + /* + * Swap suspend & friends need this for resume because things like the intel-agp + * driver might have split up a kernel 4MB mapping. +@@ -492,9 +492,13 @@ void zap_low_mappings (void) + flush_tlb_all(); + } + ++int nx_enabled = 0; ++ ++#ifdef CONFIG_X86_PAE ++ + static int disable_nx __initdata = 0; + u64 __supported_pte_mask __read_mostly = ~_PAGE_NX; +-EXPORT_SYMBOL(__supported_pte_mask); ++EXPORT_SYMBOL_GPL(__supported_pte_mask); + + /* + * noexec = on|off +@@ -521,9 +525,6 @@ static int __init noexec_setup(char *str + } + early_param("noexec", noexec_setup); + +-int nx_enabled = 0; +-#ifdef CONFIG_X86_PAE +- + static void __init set_nx(void) + { + unsigned int v[4], l, h; +@@ -770,7 +771,7 @@ void __init mem_init(void) + zap_low_mappings(); + #endif + +- set_bit(PG_pinned, &virt_to_page(init_mm.pgd)->flags); ++ SetPagePinned(virt_to_page(init_mm.pgd)); + } + + #ifdef CONFIG_MEMORY_HOTPLUG +@@ -802,8 +803,7 @@ void __init pgtable_cache_init(void) + PTRS_PER_PMD*sizeof(pmd_t), + PTRS_PER_PMD*sizeof(pmd_t), + SLAB_PANIC, +- pmd_ctor, +- NULL); ++ pmd_ctor); + if (!SHARED_KERNEL_PMD) { + /* If we're in PAE mode and have a non-shared + kernel pmd, then the pgd size must be a +--- a/arch/x86/mm/init_64-xen.c ++++ b/arch/x86/mm/init_64-xen.c +@@ -66,6 +66,9 @@ int after_bootmem; + DEFINE_PER_CPU(struct mmu_gather, mmu_gathers); + extern unsigned long start_pfn; + ++extern pmd_t level2_fixmap_pgt[PTRS_PER_PMD]; ++extern pte_t level1_fixmap_pgt[PTRS_PER_PTE]; ++ + /* + * Use this until direct mapping is established, i.e. before __va() is + * available in init_memory_mapping(). +@@ -362,6 +365,10 @@ __set_fixmap (enum fixed_addresses idx, + set_pte_phys(address, phys, prot, 0); + set_pte_phys(address, phys, prot, 1); + break; ++ case FIX_EARLYCON_MEM_BASE: ++ xen_l1_entry_update(level1_fixmap_pgt + pte_index(address), ++ pfn_pte_ma(phys >> PAGE_SHIFT, prot)); ++ break; + default: + set_pte_phys_ma(address, phys, prot); + break; +@@ -595,6 +602,19 @@ void __init xen_init_pt(void) + __user_pgd(init_level4_pgt)[pgd_index(VSYSCALL_START)] = + __pgd(__pa_symbol(level3_user_pgt) | _PAGE_TABLE); + ++ /* Do an early initialization of the fixmap area. */ ++ addr = __fix_to_virt(FIX_EARLYCON_MEM_BASE); ++ if (pud_present(level3_kernel_pgt[pud_index(addr)])) { ++ unsigned long adr = page[pud_index(addr)]; ++ ++ addr_to_page(adr, page); ++ copy_page(level2_fixmap_pgt, page); ++ } ++ level3_kernel_pgt[pud_index(addr)] = ++ __pud(__pa_symbol(level2_fixmap_pgt) | _PAGE_TABLE); ++ level2_fixmap_pgt[pmd_index(addr)] = ++ __pmd(__pa_symbol(level1_fixmap_pgt) | _PAGE_TABLE); ++ + early_make_page_readonly(init_level4_pgt, + XENFEAT_writable_page_tables); + early_make_page_readonly(__user_pgd(init_level4_pgt), +@@ -603,6 +623,10 @@ void __init xen_init_pt(void) + XENFEAT_writable_page_tables); + early_make_page_readonly(level3_user_pgt, + XENFEAT_writable_page_tables); ++ early_make_page_readonly(level2_fixmap_pgt, ++ XENFEAT_writable_page_tables); ++ early_make_page_readonly(level1_fixmap_pgt, ++ XENFEAT_writable_page_tables); + + if (!xen_feature(XENFEAT_writable_page_tables)) { + xen_pgd_pin(__pa_symbol(init_level4_pgt)); +@@ -832,7 +856,7 @@ void __init paging_init(void) + sparse_init(); + free_area_init_nodes(max_zone_pfns); + +- init_mm.context.pinned = 1; ++ SetPagePinned(virt_to_page(init_mm.pgd)); + } + #endif + +@@ -1155,41 +1179,6 @@ int kern_addr_valid(unsigned long addr) return pfn_valid(pte_pfn(*pte)); } @@ -2108,8 +2706,21 @@ Acked-by: jbeulich@novell.com + return "[vsyscall]"; + return NULL; +} ---- head.orig/arch/x86/mm/pageattr_64-xen.c 2011-01-31 17:32:29.000000000 +0100 -+++ head/arch/x86/mm/pageattr_64-xen.c 2011-01-31 17:49:31.000000000 +0100 +--- a/arch/x86/mm/ioremap-xen.c ++++ b/arch/x86/mm/ioremap-xen.c +@@ -344,9 +344,8 @@ void iounmap(volatile void __iomem *addr + + /* Reset the direct mapping. Can block */ + if ((p->flags >> 20) && is_local_lowmem(p->phys_addr)) { +- /* p->size includes the guard page, but cpa doesn't like that */ + change_page_attr(virt_to_page(bus_to_virt(p->phys_addr)), +- (p->size - PAGE_SIZE) >> PAGE_SHIFT, ++ get_vm_area_size(p) >> PAGE_SHIFT, + PAGE_KERNEL); + global_flush_tlb(); + } +--- a/arch/x86/mm/pageattr_64-xen.c ++++ b/arch/x86/mm/pageattr_64-xen.c @@ -171,7 +171,7 @@ void mm_pin(struct mm_struct *mm) mm_walk(mm, PAGE_KERNEL_RO); xen_pgd_pin(__pa(mm->pgd)); /* kernel */ @@ -2214,8 +2825,108 @@ Acked-by: jbeulich@novell.com ClearPagePrivate(pg); __free_page(pg); } ---- head.orig/arch/x86/oprofile/xenoprof.c 2008-01-28 12:24:19.000000000 +0100 -+++ head/arch/x86/oprofile/xenoprof.c 2011-01-31 17:49:31.000000000 +0100 +--- a/arch/x86/mm/pgtable_32-xen.c ++++ b/arch/x86/mm/pgtable_32-xen.c +@@ -198,7 +198,7 @@ void pte_free(struct page *pte) + va, pfn_pte(pfn, PAGE_KERNEL), 0)) + BUG(); + } else +- clear_bit(PG_pinned, &pte->flags); ++ ClearPagePinned(pte); + + ClearPageForeign(pte); + init_page_count(pte); +@@ -249,7 +249,7 @@ static inline void pgd_list_del(pgd_t *p + + #if (PTRS_PER_PMD == 1) + /* Non-PAE pgd constructor */ +-void pgd_ctor(void *pgd) ++static void pgd_ctor(void *pgd) + { + unsigned long flags; + +@@ -272,7 +272,7 @@ void pgd_ctor(void *pgd) + } + #else /* PTRS_PER_PMD > 1 */ + /* PAE pgd constructor */ +-void pgd_ctor(void *pgd) ++static void pgd_ctor(void *pgd) + { + /* PAE, kernel PMD may be shared */ + +@@ -286,7 +286,7 @@ void pgd_ctor(void *pgd) + } + #endif /* PTRS_PER_PMD */ + +-void pgd_dtor(void *pgd) ++static void pgd_dtor(void *pgd) + { + unsigned long flags; /* can be called from interrupt context */ + +@@ -644,9 +644,9 @@ static inline unsigned int pgd_walk_set_ + + if (PageHighMem(page)) { + if (pgprot_val(flags) & _PAGE_RW) +- clear_bit(PG_pinned, &page->flags); ++ ClearPagePinned(page); + else +- set_bit(PG_pinned, &page->flags); ++ SetPagePinned(page); + } else { + MULTI_update_va_mapping(per_cpu(pb_mcl, cpu) + seq, + (unsigned long)__va(pfn << PAGE_SHIFT), +@@ -716,19 +716,19 @@ static void __pgd_pin(pgd_t *pgd) + pgd_walk(pgd, PAGE_KERNEL_RO); + kmap_flush_unused(); + xen_pgd_pin(__pa(pgd)); +- set_bit(PG_pinned, &virt_to_page(pgd)->flags); ++ SetPagePinned(virt_to_page(pgd)); + } + + static void __pgd_unpin(pgd_t *pgd) + { + xen_pgd_unpin(__pa(pgd)); + pgd_walk(pgd, PAGE_KERNEL); +- clear_bit(PG_pinned, &virt_to_page(pgd)->flags); ++ ClearPagePinned(virt_to_page(pgd)); + } + + static void pgd_test_and_unpin(pgd_t *pgd) + { +- if (test_bit(PG_pinned, &virt_to_page(pgd)->flags)) ++ if (PagePinned(virt_to_page(pgd))) + __pgd_unpin(pgd); + } + +@@ -766,7 +766,7 @@ void mm_pin_all(void) + */ + spin_lock_irqsave(&pgd_lock, flags); + for (page = pgd_list; page; page = (struct page *)page->index) { +- if (!test_bit(PG_pinned, &page->flags)) ++ if (!PagePinned(page)) + __pgd_pin((pgd_t *)page_address(page)); + } + spin_unlock_irqrestore(&pgd_lock, flags); +@@ -774,7 +774,7 @@ void mm_pin_all(void) + + void arch_dup_mmap(struct mm_struct *oldmm, struct mm_struct *mm) + { +- if (!test_bit(PG_pinned, &virt_to_page(mm->pgd)->flags)) ++ if (!PagePinned(virt_to_page(mm->pgd))) + mm_pin(mm); + } + +@@ -800,7 +800,7 @@ void arch_exit_mmap(struct mm_struct *mm + + task_unlock(tsk); + +- if (test_bit(PG_pinned, &virt_to_page(mm->pgd)->flags) && ++ if (PagePinned(virt_to_page(mm->pgd)) && + (atomic_read(&mm->mm_count) == 1) && + !mm->context.has_foreign_mappings) + mm_unpin(mm); +--- a/arch/x86/oprofile/xenoprof.c ++++ b/arch/x86/oprofile/xenoprof.c @@ -18,9 +18,9 @@ #include #include @@ -2227,8 +2938,8 @@ Acked-by: jbeulich@novell.com #include #include #include ---- head.orig/arch/x86/vdso/vdso32/note.S 2008-04-17 04:49:44.000000000 +0200 -+++ head/arch/x86/vdso/vdso32/note.S 2011-01-31 17:49:31.000000000 +0100 +--- a/arch/x86/vdso/vdso32/note.S ++++ b/arch/x86/vdso/vdso32/note.S @@ -13,7 +13,7 @@ ELFNOTE_START(Linux, 0, "a") .long LINUX_VERSION_CODE ELFNOTE_END @@ -2251,8 +2962,36 @@ Acked-by: jbeulich@novell.com .byte VDSO_NOTE_NONEGSEG_BIT; .asciz "nosegneg" /* bit, name */ ELFNOTE_END #endif ---- head.orig/drivers/Makefile 2012-10-22 17:22:16.000000000 +0200 -+++ head/drivers/Makefile 2013-03-21 14:16:56.000000000 +0100 +--- a/arch/x86/xen/Kconfig ++++ b/arch/x86/xen/Kconfig +@@ -2,7 +2,7 @@ + # This Kconfig describes xen options + # + +-config XEN ++config PARAVIRT_XEN + bool "Xen guest support" + select PARAVIRT + select PARAVIRT_CLOCK +--- a/arch/x86/xen/xen-head.S ++++ b/arch/x86/xen/xen-head.S +@@ -1,7 +1,7 @@ + /* Xen-specific pieces of head.S, intended to be included in the right + place in head.S */ + +-#ifdef CONFIG_XEN ++#ifdef CONFIG_PARAVIRT_XEN + + #include + #include +@@ -104,4 +104,4 @@ NEXT_HYPERCALL(arch_6) + ELFNOTE(Xen, XEN_ELFNOTE_HV_START_LOW, _ASM_PTR __HYPERVISOR_VIRT_START) + ELFNOTE(Xen, XEN_ELFNOTE_PADDR_OFFSET, _ASM_PTR 0) + +-#endif /*CONFIG_XEN */ ++#endif /* CONFIG_PARAVIRT_XEN */ +--- a/drivers/Makefile ++++ b/drivers/Makefile @@ -32,7 +32,7 @@ obj-y += amba/ obj-$(CONFIG_DMADEVICES) += dma/ @@ -2262,8 +3001,8 @@ Acked-by: jbeulich@novell.com # regulators early, since some subsystems rely on them to initialize obj-$(CONFIG_REGULATOR) += regulator/ ---- head.orig/drivers/block/Kconfig 2013-03-21 11:14:45.000000000 +0100 -+++ head/drivers/block/Kconfig 2013-03-21 14:17:01.000000000 +0100 +--- a/drivers/block/Kconfig ++++ b/drivers/block/Kconfig @@ -464,9 +464,9 @@ config XILINX_SYSACE help Include support for the Xilinx SystemACE CompactFlash interface @@ -2276,8 +3015,8 @@ Acked-by: jbeulich@novell.com default y select XEN_XENBUS_FRONTEND help ---- head.orig/drivers/block/Makefile 2013-03-21 11:14:45.000000000 +0100 -+++ head/drivers/block/Makefile 2013-03-21 14:17:06.000000000 +0100 +--- a/drivers/block/Makefile ++++ b/drivers/block/Makefile @@ -34,7 +34,7 @@ obj-$(CONFIG_VIODASD) += viodasd.o obj-$(CONFIG_BLK_DEV_SX8) += sx8.o obj-$(CONFIG_BLK_DEV_HD) += hd.o @@ -2287,19 +3026,8 @@ Acked-by: jbeulich@novell.com obj-$(CONFIG_XEN_BLKDEV_BACKEND) += xen-blkback/ obj-$(CONFIG_BLK_DEV_DRBD) += drbd/ obj-$(CONFIG_BLK_DEV_RBD) += rbd.o ---- head.orig/drivers/tty/hvc/Kconfig 2013-03-21 11:15:10.000000000 +0100 -+++ head/drivers/tty/hvc/Kconfig 2013-03-21 14:17:16.000000000 +0100 -@@ -61,7 +61,7 @@ config HVC_IUCV - - config HVC_XEN - bool "Xen Hypervisor Console support" -- depends on XEN -+ depends on PARAVIRT_XEN - select HVC_DRIVER - select HVC_IRQ - default y ---- head.orig/drivers/net/Kconfig 2013-03-21 11:14:56.000000000 +0100 -+++ head/drivers/net/Kconfig 2013-03-21 14:17:28.000000000 +0100 +--- a/drivers/net/Kconfig ++++ b/drivers/net/Kconfig @@ -306,9 +306,9 @@ source "drivers/net/wan/Kconfig" source "drivers/net/ieee802154/Kconfig" @@ -2312,8 +3040,8 @@ Acked-by: jbeulich@novell.com select XEN_XENBUS_FRONTEND default y help ---- head.orig/drivers/net/Makefile 2013-03-21 11:14:56.000000000 +0100 -+++ head/drivers/net/Makefile 2012-10-23 14:49:15.000000000 +0200 +--- a/drivers/net/Makefile ++++ b/drivers/net/Makefile @@ -57,7 +57,7 @@ obj-$(CONFIG_WIMAX) += wimax/ obj-$(CONFIG_IEEE802154) += ieee802154/ @@ -2323,8 +3051,19 @@ Acked-by: jbeulich@novell.com obj-$(CONFIG_XEN_NETDEV_BACKEND) += xen-netback/ obj-$(CONFIG_USB_CATC) += usb/ ---- head.orig/drivers/xen/Kconfig 2012-10-04 11:50:42.000000000 +0200 -+++ head/drivers/xen/Kconfig 2011-01-31 17:49:31.000000000 +0100 +--- a/drivers/tty/hvc/Kconfig ++++ b/drivers/tty/hvc/Kconfig +@@ -61,7 +61,7 @@ config HVC_IUCV + + config HVC_XEN + bool "Xen Hypervisor Console support" +- depends on XEN ++ depends on PARAVIRT_XEN + select HVC_DRIVER + select HVC_IRQ + default y +--- a/drivers/xen/Kconfig ++++ b/drivers/xen/Kconfig @@ -23,6 +23,9 @@ config XEN_PRIVILEGED_GUEST config XEN_UNPRIVILEGED_GUEST def_bool !XEN_PRIVILEGED_GUEST @@ -2335,8 +3074,8 @@ Acked-by: jbeulich@novell.com config XEN_PRIVCMD def_bool y ---- head.orig/drivers/xen/Makefile 2011-10-19 10:32:29.000000000 +0200 -+++ head/drivers/xen/Makefile 2011-01-31 17:49:31.000000000 +0100 +--- a/drivers/xen/Makefile ++++ b/drivers/xen/Makefile @@ -1,10 +1,14 @@ -obj-y += core/ -obj-y += console/ @@ -2358,8 +3097,8 @@ Acked-by: jbeulich@novell.com obj-$(CONFIG_XEN_BALLOON) += balloon/ obj-$(CONFIG_XEN_BLKDEV_BACKEND) += blkback/ obj-$(CONFIG_XEN_BLKDEV_TAP) += blktap/ ---- head.orig/drivers/xen/balloon/balloon.c 2012-06-06 13:48:56.000000000 +0200 -+++ head/drivers/xen/balloon/balloon.c 2012-06-06 13:52:53.000000000 +0200 +--- a/drivers/xen/balloon/balloon.c ++++ b/drivers/xen/balloon/balloon.c @@ -317,13 +317,9 @@ static int increase_reservation(unsigned #ifndef MODULE @@ -2374,8 +3113,8 @@ Acked-by: jbeulich@novell.com vm_total_pages = nr_free_pagecache_pages(); #endif ---- head.orig/drivers/xen/blkback/blkback.c 2012-03-26 12:21:29.000000000 +0200 -+++ head/drivers/xen/blkback/blkback.c 2012-03-26 12:21:55.000000000 +0200 +--- a/drivers/xen/blkback/blkback.c ++++ b/drivers/xen/blkback/blkback.c @@ -157,7 +157,7 @@ static void unplug_queue(blkif_t *blkif) static void plug_queue(blkif_t *blkif, struct block_device *bdev) @@ -2385,8 +3124,8 @@ Acked-by: jbeulich@novell.com if (q == blkif->plug) return; ---- head.orig/drivers/xen/blkback/common.h 2012-06-06 13:46:49.000000000 +0200 -+++ head/drivers/xen/blkback/common.h 2012-06-06 13:52:57.000000000 +0200 +--- a/drivers/xen/blkback/common.h ++++ b/drivers/xen/blkback/common.h @@ -35,7 +35,6 @@ #include #include @@ -2404,8 +3143,8 @@ Acked-by: jbeulich@novell.com /* statistics */ unsigned long st_print; ---- head.orig/drivers/xen/blkback/interface.c 2011-04-11 14:29:25.000000000 +0200 -+++ head/drivers/xen/blkback/interface.c 2012-04-04 10:14:31.000000000 +0200 +--- a/drivers/xen/blkback/interface.c ++++ b/drivers/xen/blkback/interface.c @@ -133,5 +133,5 @@ void blkif_free(blkif_t *blkif) void __init blkif_interface_init(void) { @@ -2413,8 +3152,8 @@ Acked-by: jbeulich@novell.com - 0, 0, NULL, NULL); + 0, 0, NULL); } ---- head.orig/drivers/xen/blkback/xenbus.c 2012-12-18 10:47:37.000000000 +0100 -+++ head/drivers/xen/blkback/xenbus.c 2012-12-18 11:59:09.000000000 +0100 +--- a/drivers/xen/blkback/xenbus.c ++++ b/drivers/xen/blkback/xenbus.c @@ -27,8 +27,6 @@ pr_debug("blkback/xenbus (%s:%d) " fmt ".\n", \ __FUNCTION__, __LINE__, ##args) @@ -2424,7 +3163,7 @@ Acked-by: jbeulich@novell.com static void connect(struct backend_info *); static int connect_ring(struct backend_info *); static void backend_changed(struct xenbus_watch *, const char **, -@@ -110,10 +108,8 @@ static void update_blkif_status(blkif_t +@@ -110,10 +108,8 @@ static void update_blkif_status(blkif_t if (!get_device(_dev)) \ return ret; \ dev = to_xenbus_device(_dev); \ @@ -2451,8 +3190,8 @@ Acked-by: jbeulich@novell.com return 0; } ---- head.orig/drivers/xen/blkfront/blkfront.c 2012-03-12 13:33:33.000000000 +0100 -+++ head/drivers/xen/blkfront/blkfront.c 2012-10-04 11:53:51.000000000 +0200 +--- a/drivers/xen/blkfront/blkfront.c ++++ b/drivers/xen/blkfront/blkfront.c @@ -603,14 +603,20 @@ int blkif_ioctl(struct inode *inode, str return -EINVAL; @@ -2484,8 +3223,8 @@ Acked-by: jbeulich@novell.com { struct blkfront_info *info = NULL; struct request *req; ---- head.orig/drivers/xen/blkfront/block.h 2012-06-06 13:16:59.000000000 +0200 -+++ head/drivers/xen/blkfront/block.h 2012-06-06 13:53:02.000000000 +0200 +--- a/drivers/xen/blkfront/block.h ++++ b/drivers/xen/blkfront/block.h @@ -101,7 +101,7 @@ struct blkfront_info struct scatterlist sg[BLKIF_MAX_SEGMENTS_PER_REQUEST]; unsigned int irq; @@ -2504,8 +3243,8 @@ Acked-by: jbeulich@novell.com /* Virtual block-device subsystem. */ /* Note that xlvbd_add doesn't call add_disk for you: you're expected ---- head.orig/drivers/xen/blkfront/vbd.c 2012-03-12 12:51:05.000000000 +0100 -+++ head/drivers/xen/blkfront/vbd.c 2012-03-12 13:38:18.000000000 +0100 +--- a/drivers/xen/blkfront/vbd.c ++++ b/drivers/xen/blkfront/vbd.c @@ -357,7 +357,7 @@ static int xlvbd_init_blk_queue(struct gendisk *gd, u16 sector_size, struct blkfront_info *info) @@ -2515,8 +3254,8 @@ Acked-by: jbeulich@novell.com rq = blk_init_queue(do_blkif_request, &info->io_lock); if (rq == NULL) ---- head.orig/drivers/xen/blktap/common.h 2013-02-06 14:51:48.000000000 +0100 -+++ head/drivers/xen/blktap/common.h 2013-02-06 14:52:29.000000000 +0100 +--- a/drivers/xen/blktap/common.h ++++ b/drivers/xen/blktap/common.h @@ -34,7 +34,6 @@ #include #include @@ -2534,8 +3273,8 @@ Acked-by: jbeulich@novell.com /* statistics */ unsigned long st_print; ---- head.orig/drivers/xen/blktap/interface.c 2011-04-11 14:29:39.000000000 +0200 -+++ head/drivers/xen/blktap/interface.c 2012-04-04 10:14:34.000000000 +0200 +--- a/drivers/xen/blktap/interface.c ++++ b/drivers/xen/blktap/interface.c @@ -129,5 +129,5 @@ void tap_blkif_kmem_cache_free(blkif_t * void __init tap_blkif_interface_init(void) { @@ -2543,8 +3282,8 @@ Acked-by: jbeulich@novell.com - 0, 0, NULL, NULL); + 0, 0, NULL); } ---- head.orig/drivers/xen/blktap/xenbus.c 2012-04-04 08:57:09.000000000 +0200 -+++ head/drivers/xen/blktap/xenbus.c 2012-02-16 12:30:42.000000000 +0100 +--- a/drivers/xen/blktap/xenbus.c ++++ b/drivers/xen/blktap/xenbus.c @@ -50,8 +50,6 @@ struct backend_info int group_added; }; @@ -2581,8 +3320,8 @@ Acked-by: jbeulich@novell.com return 0; } ---- head.orig/drivers/xen/blktap2/blktap.h 2012-06-06 13:16:59.000000000 +0200 -+++ head/drivers/xen/blktap2/blktap.h 2012-06-06 13:53:14.000000000 +0200 +--- a/drivers/xen/blktap2/blktap.h ++++ b/drivers/xen/blktap2/blktap.h @@ -204,6 +204,7 @@ blktap_validate_params(struct blktap *ta } @@ -2591,8 +3330,8 @@ Acked-by: jbeulich@novell.com int blktap_ring_init(int *); int blktap_ring_free(void); ---- head.orig/drivers/xen/blktap2/control.c 2011-04-11 13:43:15.000000000 +0200 -+++ head/drivers/xen/blktap2/control.c 2011-01-31 17:49:31.000000000 +0100 +--- a/drivers/xen/blktap2/control.c ++++ b/drivers/xen/blktap2/control.c @@ -194,14 +194,20 @@ blktap_control_destroy_device(struct blk clear_bit(BLKTAP_SHUTDOWN_REQUESTED, &tap->dev_inuse); @@ -2617,8 +3356,8 @@ Acked-by: jbeulich@novell.com static int __init blktap_control_init(void) { ---- head.orig/drivers/xen/blktap2/device.c 2012-02-16 11:09:01.000000000 +0100 -+++ head/drivers/xen/blktap2/device.c 2012-02-16 12:30:32.000000000 +0100 +--- a/drivers/xen/blktap2/device.c ++++ b/drivers/xen/blktap2/device.c @@ -811,7 +811,7 @@ static void blktap_device_run_queue(struct blktap *tap) { @@ -2645,8 +3384,8 @@ Acked-by: jbeulich@novell.com - BTERR("blktap device unregister failed\n"); + unregister_blkdev(blktap_device_major, "tapdev"); } ---- head.orig/drivers/xen/blktap2/sysfs.c 2011-01-31 17:29:16.000000000 +0100 -+++ head/drivers/xen/blktap2/sysfs.c 2011-01-31 17:49:31.000000000 +0100 +--- a/drivers/xen/blktap2/sysfs.c ++++ b/drivers/xen/blktap2/sysfs.c @@ -334,6 +334,24 @@ blktap_sysfs_create(struct blktap *tap) return err; } @@ -2691,8 +3430,8 @@ Acked-by: jbeulich@novell.com } static ssize_t ---- head.orig/drivers/xen/core/gnttab.c 2012-10-18 12:21:44.000000000 +0200 -+++ head/drivers/xen/core/gnttab.c 2012-03-12 13:38:38.000000000 +0100 +--- a/drivers/xen/core/gnttab.c ++++ b/drivers/xen/core/gnttab.c @@ -43,7 +43,6 @@ #include #include @@ -2701,8 +3440,8 @@ Acked-by: jbeulich@novell.com #include #ifdef HAVE_XEN_PLATFORM_COMPAT_H ---- head.orig/drivers/xen/core/reboot.c 2011-01-31 17:32:16.000000000 +0100 -+++ head/drivers/xen/core/reboot.c 2011-01-31 17:49:31.000000000 +0100 +--- a/drivers/xen/core/reboot.c ++++ b/drivers/xen/core/reboot.c @@ -3,6 +3,7 @@ #include #include @@ -2711,8 +3450,8 @@ Acked-by: jbeulich@novell.com #include #include #include ---- head.orig/drivers/xen/core/xen_proc.c 2011-04-11 13:43:15.000000000 +0200 -+++ head/drivers/xen/core/xen_proc.c 2011-04-01 13:07:57.000000000 +0200 +--- a/drivers/xen/core/xen_proc.c ++++ b/drivers/xen/core/xen_proc.c @@ -1,11 +1,15 @@ - +#include @@ -2740,8 +3479,8 @@ Acked-by: jbeulich@novell.com void remove_xen_proc_entry(const char *name) { ---- head.orig/drivers/xen/netback/common.h 2013-02-20 11:28:28.000000000 +0100 -+++ head/drivers/xen/netback/common.h 2012-06-06 13:53:20.000000000 +0200 +--- a/drivers/xen/netback/common.h ++++ b/drivers/xen/netback/common.h @@ -39,7 +39,6 @@ #include #include @@ -2750,8 +3489,8 @@ Acked-by: jbeulich@novell.com #include #include ---- head.orig/drivers/xen/scsiback/common.h 2012-06-06 13:48:05.000000000 +0200 -+++ head/drivers/xen/scsiback/common.h 2012-06-06 13:53:26.000000000 +0200 +--- a/drivers/xen/scsiback/common.h ++++ b/drivers/xen/scsiback/common.h @@ -48,7 +48,6 @@ #include #include @@ -2760,8 +3499,8 @@ Acked-by: jbeulich@novell.com #include #include #include ---- head.orig/drivers/xen/scsiback/interface.c 2011-04-11 14:30:02.000000000 +0200 -+++ head/drivers/xen/scsiback/interface.c 2011-04-11 14:52:22.000000000 +0200 +--- a/drivers/xen/scsiback/interface.c ++++ b/drivers/xen/scsiback/interface.c @@ -126,7 +126,7 @@ void scsiback_free(struct vscsibk_info * int __init scsiback_interface_init(void) { @@ -2771,8 +3510,8 @@ Acked-by: jbeulich@novell.com if (!scsiback_cachep) { printk(KERN_ERR "scsiback: can't init scsi cache\n"); return -ENOMEM; ---- head.orig/drivers/xen/scsifront/scsifront.c 2012-12-06 16:05:56.000000000 +0100 -+++ head/drivers/xen/scsifront/scsifront.c 2012-12-06 16:07:02.000000000 +0100 +--- a/drivers/xen/scsifront/scsifront.c ++++ b/drivers/xen/scsifront/scsifront.c @@ -146,7 +146,7 @@ static void scsifront_cdb_cmd_done(struc add_id_to_freelist(info, id); @@ -2802,8 +3541,8 @@ Acked-by: jbeulich@novell.com vscsiif_request_t *ring_req; uint16_t rqid; ---- head.orig/drivers/xen/sfc_netback/accel_solarflare.c 2011-01-31 17:32:29.000000000 +0100 -+++ head/drivers/xen/sfc_netback/accel_solarflare.c 2011-01-31 17:49:31.000000000 +0100 +--- a/drivers/xen/sfc_netback/accel_solarflare.c ++++ b/drivers/xen/sfc_netback/accel_solarflare.c @@ -37,7 +37,6 @@ #include "ci/efhw/public.h" @@ -2812,8 +3551,8 @@ Acked-by: jbeulich@novell.com #include #include ---- head.orig/drivers/xen/sfc_netutil/accel_util.c 2010-09-23 15:39:04.000000000 +0200 -+++ head/drivers/xen/sfc_netutil/accel_util.c 2011-01-31 17:49:31.000000000 +0100 +--- a/drivers/xen/sfc_netutil/accel_util.c ++++ b/drivers/xen/sfc_netutil/accel_util.c @@ -28,7 +28,6 @@ #include #include @@ -2822,8 +3561,8 @@ Acked-by: jbeulich@novell.com #include #include "accel_util.h" ---- head.orig/drivers/xen/tpmback/common.h 2011-11-28 09:46:47.000000000 +0100 -+++ head/drivers/xen/tpmback/common.h 2011-11-28 09:47:23.000000000 +0100 +--- a/drivers/xen/tpmback/common.h ++++ b/drivers/xen/tpmback/common.h @@ -9,7 +9,6 @@ #include #include @@ -2832,8 +3571,8 @@ Acked-by: jbeulich@novell.com #include #include #include ---- head.orig/drivers/xen/tpmback/interface.c 2011-04-11 14:31:42.000000000 +0200 -+++ head/drivers/xen/tpmback/interface.c 2011-04-11 14:52:30.000000000 +0200 +--- a/drivers/xen/tpmback/interface.c ++++ b/drivers/xen/tpmback/interface.c @@ -13,6 +13,7 @@ #include "common.h" @@ -2851,8 +3590,8 @@ Acked-by: jbeulich@novell.com return tpmif_cachep ? 0 : -ENOMEM; } ---- head.orig/drivers/xen/usbback/usbback.h 2012-06-06 13:48:22.000000000 +0200 -+++ head/drivers/xen/usbback/usbback.h 2012-06-06 13:53:31.000000000 +0200 +--- a/drivers/xen/usbback/usbback.h ++++ b/drivers/xen/usbback/usbback.h @@ -55,7 +55,6 @@ #include #include @@ -2861,8 +3600,8 @@ Acked-by: jbeulich@novell.com #include #include #include ---- head.orig/drivers/xen/usbfront/xenbus.c 2012-03-12 13:33:24.000000000 +0100 -+++ head/drivers/xen/usbfront/xenbus.c 2012-10-04 11:53:32.000000000 +0200 +--- a/drivers/xen/usbfront/xenbus.c ++++ b/drivers/xen/usbfront/xenbus.c @@ -392,7 +392,7 @@ static int __init usbfront_init(void) return -ENODEV; @@ -2872,8 +3611,8 @@ Acked-by: jbeulich@novell.com if (!xenhcd_urbp_cachep) { printk(KERN_ERR "usbfront failed to create kmem cache\n"); return -ENOMEM; ---- head.orig/drivers/xen/util.c 2007-07-10 09:42:30.000000000 +0200 -+++ head/drivers/xen/util.c 2011-01-31 17:49:31.000000000 +0100 +--- a/drivers/xen/util.c ++++ b/drivers/xen/util.c @@ -1,8 +1,5 @@ -#include +#include @@ -2930,8 +3669,8 @@ Acked-by: jbeulich@novell.com -} -EXPORT_SYMBOL_GPL(free_vm_area); -#endif /* CONFIG_X86 */ ---- head.orig/drivers/xen/xenbus/xenbus_backend_client.c 2011-04-11 13:43:15.000000000 +0200 -+++ head/drivers/xen/xenbus/xenbus_backend_client.c 2011-01-31 17:49:31.000000000 +0100 +--- a/drivers/xen/xenbus/xenbus_backend_client.c ++++ b/drivers/xen/xenbus/xenbus_backend_client.c @@ -32,9 +32,9 @@ #include @@ -2943,8 +3682,8 @@ Acked-by: jbeulich@novell.com /* Based on Rusty Russell's skeleton driver's map_page */ struct vm_struct *xenbus_map_ring_valloc(struct xenbus_device *dev, grant_ref_t gnt_ref) ---- head.orig/drivers/xen/xenbus/xenbus_client.c 2011-11-28 09:44:25.000000000 +0100 -+++ head/drivers/xen/xenbus/xenbus_client.c 2011-06-30 16:10:27.000000000 +0200 +--- a/drivers/xen/xenbus/xenbus_client.c ++++ b/drivers/xen/xenbus/xenbus_client.c @@ -30,19 +30,25 @@ * IN THE SOFTWARE. */ @@ -3378,1154 +4117,532 @@ Acked-by: jbeulich@novell.com +} +EXPORT_SYMBOL_GPL(xenbus_unmap_ring); +#endif -+ -+ -+/** -+ * xenbus_read_driver_state -+ * @path: path for driver -+ * -+ * Return the state of the driver rooted at the given store path, or -+ * XenbusStateUnknown if no state can be read. -+ */ - enum xenbus_state xenbus_read_driver_state(const char *path) - { - int result; ---- head.orig/drivers/xen/xenbus/xenbus_comms.c 2011-01-31 17:32:16.000000000 +0100 -+++ head/drivers/xen/xenbus/xenbus_comms.c 2011-04-11 14:52:53.000000000 +0200 -@@ -34,12 +34,15 @@ - #include - #include - #include --#include --#include --#include - #include -- -+#if defined(CONFIG_XEN) || defined(MODULE) -+#include - #include -+#else -+#include -+#include -+#include -+#endif - - #include "xenbus_comms.h" - -@@ -49,7 +52,6 @@ - - static int xenbus_irq; - --extern void xenbus_probe(struct work_struct *); - static DECLARE_WORK(probe_work, xenbus_probe); - - static DECLARE_WAIT_QUEUE_HEAD(xb_waitq); -@@ -112,6 +114,13 @@ static const void *get_input_chunk(XENST - return buf + MASK_XENSTORE_IDX(cons); - } - -+/** -+ * xb_write - low level write -+ * @data: buffer to send -+ * @len: length of buffer -+ * -+ * Returns 0 on success, error otherwise. -+ */ - int xb_write(const void *data, unsigned len) - { - struct xenstore_domain_interface *intf = xen_store_interface; -@@ -220,7 +229,9 @@ int xb_read(void *data, unsigned len) - return 0; - } - --/* Set up interrupt handler off store event channel. */ -+/** -+ * xb_init_comms - Set up interrupt handler off store event channel. -+ */ - int xb_init_comms(void) - { - struct xenstore_domain_interface *intf = xen_store_interface; -@@ -242,7 +253,11 @@ int xb_init_comms(void) - if (xenbus_irq) - unbind_from_irqhandler(xenbus_irq, &xb_waitq); - -+#if defined(CONFIG_XEN) || defined(MODULE) - err = bind_caller_port_to_irqhandler( -+#else -+ err = bind_evtchn_to_irqhandler( -+#endif - xen_store_evtchn, wake_waiting, - 0, "xenbus", &xb_waitq); - if (err <= 0) { ---- head.orig/drivers/xen/xenbus/xenbus_dev.c 2012-10-31 10:29:18.000000000 +0100 -+++ head/drivers/xen/xenbus/xenbus_dev.c 2012-02-16 12:30:22.000000000 +0100 -@@ -493,7 +493,13 @@ static const struct file_operations xenb - #endif - }; - --int xenbus_dev_init(void) -+int -+#ifndef MODULE -+__init -+#else -+__devinit -+#endif -+xenbus_dev_init(void) - { - xenbus_dev_intf = create_xen_proc_entry("xenbus", 0400); - if (xenbus_dev_intf) ---- head.orig/drivers/xen/xenbus/xenbus_probe.c 2012-03-12 13:31:47.000000000 +0100 -+++ head/drivers/xen/xenbus/xenbus_probe.c 2012-03-12 13:39:04.000000000 +0100 -@@ -43,21 +43,26 @@ - #include - #include - #include --#include --#include -+#include - --#include - #include --#include - #include -+#if defined(CONFIG_XEN) || defined(MODULE) - #include - #include - #include - #include - #include -+#include - #ifdef MODULE - #include - #endif -+#else -+#include -+#include -+#include -+#include -+#endif - - #include "xenbus_comms.h" - #include "xenbus_probe.h" -@@ -170,7 +175,7 @@ static int read_backend_details(struct x - return read_otherend_details(xendev, "backend-id", "backend"); - } - --#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) && (defined(CONFIG_XEN) || defined(MODULE)) - static int xenbus_uevent_frontend(struct device *dev, char **envp, - int num_envp, char *buffer, int buffer_size) - { -@@ -209,12 +214,16 @@ static struct xen_bus_type xenbus_fronte - .probe = xenbus_dev_probe, - .remove = xenbus_dev_remove, - .shutdown = xenbus_dev_shutdown, -+#if defined(CONFIG_XEN) || defined(MODULE) - .uevent = xenbus_uevent_frontend, - #endif -+#endif - }, -+#if defined(CONFIG_XEN) || defined(MODULE) - .dev = { - .bus_id = "xen", - }, -+#endif - }; - - static void otherend_changed(struct xenbus_watch *watch, -@@ -230,14 +239,15 @@ static void otherend_changed(struct xenb - if (!dev->otherend || - strncmp(dev->otherend, vec[XS_WATCH_PATH], - strlen(dev->otherend))) { -- DPRINTK("Ignoring watch at %s", vec[XS_WATCH_PATH]); -+ dev_dbg(&dev->dev, "Ignoring watch at %s", vec[XS_WATCH_PATH]); - return; - } - - state = xenbus_read_driver_state(dev->otherend); - -- DPRINTK("state is %d (%s), %s, %s", state, xenbus_strstate(state), -- dev->otherend_watch.node, vec[XS_WATCH_PATH]); -+ dev_dbg(&dev->dev, "state is %d (%s), %s, %s", -+ state, xenbus_strstate(state), dev->otherend_watch.node, -+ vec[XS_WATCH_PATH]); - - #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) - /* -@@ -274,8 +284,13 @@ static int talk_to_otherend(struct xenbu - - static int watch_otherend(struct xenbus_device *dev) - { -+#if defined(CONFIG_XEN) || defined(MODULE) - return xenbus_watch_path2(dev, dev->otherend, "state", - &dev->otherend_watch, otherend_changed); -+#else -+ return xenbus_watch_pathfmt(dev, &dev->otherend_watch, otherend_changed, -+ "%s/%s", dev->otherend, "state"); -+#endif - } - - -@@ -301,9 +316,9 @@ int xenbus_dev_probe(struct device *_dev - - err = talk_to_otherend(dev); - if (err) { -- printk(KERN_WARNING -- "xenbus_probe: talk_to_otherend on %s failed.\n", -- dev->nodename); -+ dev_warn(&dev->dev, -+ "xenbus_probe: talk_to_otherend on %s failed.\n", -+ dev->nodename); - return err; - } - -@@ -313,9 +328,9 @@ int xenbus_dev_probe(struct device *_dev - - err = watch_otherend(dev); - if (err) { -- printk(KERN_WARNING -- "xenbus_probe: watch_otherend on %s failed.\n", -- dev->nodename); -+ dev_warn(&dev->dev, -+ "xenbus_probe: watch_otherend on %s failed.\n", -+ dev->nodename); - return err; - } - -@@ -361,8 +376,8 @@ static void xenbus_dev_shutdown(struct d - - get_device(&dev->dev); - if (dev->state != XenbusStateConnected) { -- printk("%s: %s: %s != Connected, skipping\n", __FUNCTION__, -- dev->nodename, xenbus_strstate(dev->state)); -+ dev_info(&dev->dev, "%s: %s: %s != Connected, skipping\n", __FUNCTION__, -+ dev->nodename, xenbus_strstate(dev->state)); - goto out; - } - xenbus_switch_state(dev, XenbusStateClosing); -@@ -372,7 +387,8 @@ static void xenbus_dev_shutdown(struct d - - timeout = wait_for_completion_timeout(&dev->down, timeout); - if (!timeout) -- printk("%s: %s timeout closing device\n", __FUNCTION__, dev->nodename); -+ dev_info(&dev->dev, "%s: %s timeout closing device\n", -+ __FUNCTION__, dev->nodename); - out: - put_device(&dev->dev); - } -@@ -548,7 +564,9 @@ int xenbus_probe_node(struct xen_bus_typ - xendev->devicetype = tmpstring; - init_completion(&xendev->down); - -+#if defined(CONFIG_XEN) || defined(MODULE) - xendev->dev.parent = &bus->dev; -+#endif - xendev->dev.bus = &bus->bus; - xendev->dev.release = xenbus_dev_release; - -@@ -563,15 +581,16 @@ int xenbus_probe_node(struct xen_bus_typ - - err = device_create_file(&xendev->dev, &dev_attr_nodename); - if (err) -- goto unregister; -+ goto fail_unregister; -+ - err = device_create_file(&xendev->dev, &dev_attr_devtype); - if (err) -- goto unregister; -+ goto fail_remove_file; - - return 0; --unregister: -+fail_remove_file: - device_remove_file(&xendev->dev, &dev_attr_nodename); -- device_remove_file(&xendev->dev, &dev_attr_devtype); -+fail_unregister: - device_unregister(&xendev->dev); - fail: - kfree(xendev); -@@ -587,7 +606,8 @@ static int xenbus_probe_frontend(const c - if (!strcmp(type, "console")) - return 0; - -- nodename = kasprintf(GFP_KERNEL, "%s/%s/%s", xenbus_frontend.root, type, name); -+ nodename = kasprintf(GFP_KERNEL, "%s/%s/%s", -+ xenbus_frontend.root, type, name); - if (!nodename) - return -ENOMEM; - -@@ -665,7 +685,7 @@ static int strsep_len(const char *str, c - return (len == 0) ? i : -ERANGE; - } - --void dev_changed(const char *node, struct xen_bus_type *bus) -+void xenbus_dev_changed(const char *node, struct xen_bus_type *bus) - { - int exists, rootlen; - struct xenbus_device *dev; -@@ -673,7 +693,7 @@ void dev_changed(const char *node, struc - const char *p, *root; - - if (bus->error || char_count(node, '/') < 2) -- return; -+ return; - - exists = xenbus_exists(XBT_NIL, node, ""); - if (!exists) { -@@ -707,7 +727,7 @@ static void frontend_changed(struct xenb - { - DPRINTK(""); - -- dev_changed(vec[XS_WATCH_PATH], &xenbus_frontend); -+ xenbus_dev_changed(vec[XS_WATCH_PATH], &xenbus_frontend); - } - - /* We watch for devices appearing and vanishing. */ -@@ -1119,10 +1139,18 @@ fail0: - #endif - #endif /* CONFIG_XEN_PRIVILEGED_GUEST */ - --static int xenbus_probe_init(void) -+static int -+#ifndef MODULE -+__init -+#else -+__devinit -+#endif -+xenbus_probe_init(void) - { - int err = 0; -+#if defined(CONFIG_XEN) || defined(MODULE) - unsigned long page = 0; -+#endif - - DPRINTK(""); - -@@ -1141,6 +1169,7 @@ static int xenbus_probe_init(void) - * Domain0 doesn't have a store_evtchn or store_mfn yet. - */ - if (is_initial_xendomain()) { -+#if defined(CONFIG_XEN) || defined(MODULE) - struct evtchn_alloc_unbound alloc_unbound; - - /* Allocate Xenstore page */ -@@ -1179,10 +1208,13 @@ static int xenbus_probe_init(void) - if (xsd_port_intf) - xsd_port_intf->read_proc = xsd_port_read; - #endif -+#else -+ /* dom0 not yet supported */ -+#endif - xen_store_interface = mfn_to_virt(xen_store_mfn); - } else { - atomic_set(&xenbus_xsd_state, XENBUS_XSD_FOREIGN_READY); --#ifdef CONFIG_XEN -+#ifndef MODULE - xen_store_evtchn = xen_start_info->store_evtchn; - xen_store_mfn = xen_start_info->store_mfn; - xen_store_interface = mfn_to_virt(xen_store_mfn); -@@ -1198,7 +1230,9 @@ static int xenbus_probe_init(void) - goto err; - } - -+#if defined(CONFIG_XEN) || defined(MODULE) - xenbus_dev_init(); -+#endif - - /* Initialize the interface to xenstore. */ - err = xs_init(); -@@ -1208,6 +1242,7 @@ static int xenbus_probe_init(void) - goto err; - } - -+#if defined(CONFIG_XEN) || defined(MODULE) - /* Register ourselves with the kernel device subsystem */ - if (!xenbus_frontend.error) { - xenbus_frontend.error = device_register(&xenbus_frontend.dev); -@@ -1218,6 +1253,7 @@ static int xenbus_probe_init(void) - xenbus_frontend.error); - } - } -+#endif - xenbus_backend_device_register(); - - if (!is_initial_xendomain()) -@@ -1232,16 +1268,22 @@ static int xenbus_probe_init(void) - * registered. - */ - -+#if defined(CONFIG_XEN) || defined(MODULE) - if (page != 0) - free_page(page); -+#endif - return err; - } - --#ifdef CONFIG_XEN -+#ifndef MODULE - postcore_initcall(xenbus_probe_init); -+#ifdef CONFIG_XEN - MODULE_LICENSE("Dual BSD/GPL"); - #else --int xenbus_init(void) -+MODULE_LICENSE("GPL"); -+#endif -+#else -+int __devinit xenbus_init(void) - { - return xenbus_probe_init(); - } ---- head.orig/drivers/xen/xenbus/xenbus_probe.h 2011-09-07 15:18:14.000000000 +0200 -+++ head/drivers/xen/xenbus/xenbus_probe.h 2011-12-21 10:50:52.000000000 +0100 -@@ -61,7 +61,9 @@ struct xen_bus_type { - int (*get_bus_id)(char bus_id[XEN_BUS_ID_SIZE], const char *nodename); - int (*probe)(const char *type, const char *dir); - struct bus_type bus; -+#if defined(CONFIG_XEN) || defined(MODULE) - struct device dev; -+#endif - }; - - extern int xenbus_match(struct device *_dev, struct device_driver *_drv); -@@ -74,6 +76,6 @@ extern int xenbus_probe_node(struct xen_ - const char *nodename); - extern int xenbus_probe_devices(struct xen_bus_type *bus); - --extern void dev_changed(const char *node, struct xen_bus_type *bus); -+extern void xenbus_dev_changed(const char *node, struct xen_bus_type *bus); - - #endif ---- head.orig/drivers/xen/xenbus/xenbus_probe_backend.c 2011-09-07 15:18:19.000000000 +0200 -+++ head/drivers/xen/xenbus/xenbus_probe_backend.c 2011-12-21 10:51:23.000000000 +0100 -@@ -234,7 +234,7 @@ static void backend_changed(struct xenbu - { - DPRINTK(""); - -- dev_changed(vec[XS_WATCH_PATH], &xenbus_backend); -+ xenbus_dev_changed(vec[XS_WATCH_PATH], &xenbus_backend); - } - - static struct xenbus_watch be_watch = { ---- head.orig/drivers/xen/xenbus/xenbus_xs.c 2011-06-30 16:06:45.000000000 +0200 -+++ head/drivers/xen/xenbus/xenbus_xs.c 2012-01-20 14:47:34.000000000 +0100 -@@ -626,7 +626,7 @@ static struct xenbus_watch *find_watch(c - - static void xs_reset_watches(void) ++ ++ ++/** ++ * xenbus_read_driver_state ++ * @path: path for driver ++ * ++ * Return the state of the driver rooted at the given store path, or ++ * XenbusStateUnknown if no state can be read. ++ */ + enum xenbus_state xenbus_read_driver_state(const char *path) { --#ifndef CONFIG_XEN -+#ifdef MODULE - int err, supported = 0; - - err = xenbus_scanf(XBT_NIL, "control", -@@ -677,7 +677,9 @@ void unregister_xenbus_watch(struct xenb - char token[sizeof(watch) * 2 + 1]; - int err; - + int result; +--- a/drivers/xen/xenbus/xenbus_comms.c ++++ b/drivers/xen/xenbus/xenbus_comms.c +@@ -34,12 +34,15 @@ + #include + #include + #include +-#include +-#include +-#include + #include +- +#if defined(CONFIG_XEN) || defined(MODULE) - BUG_ON(watch->flags & XBWF_new_thread); ++#include + #include ++#else ++#include ++#include ++#include +#endif - sprintf(token, "%lX", (long)watch); - -@@ -696,6 +698,11 @@ void unregister_xenbus_watch(struct xenb + #include "xenbus_comms.h" - up_read(&xs_state.watch_mutex); +@@ -49,7 +52,6 @@ -+ /* Make sure there are no callbacks running currently (unless -+ its us) */ -+ if (current->pid != xenwatch_pid) -+ mutex_lock(&xenwatch_mutex); -+ - /* Cancel pending watch events. */ - spin_lock(&watch_events_lock); - list_for_each_entry_safe(msg, tmp, &watch_events, list) { -@@ -707,11 +714,8 @@ void unregister_xenbus_watch(struct xenb - } - spin_unlock(&watch_events_lock); + static int xenbus_irq; -- /* Flush any currently-executing callback, unless we are it. :-) */ -- if (current->pid != xenwatch_pid) { -- mutex_lock(&xenwatch_mutex); -+ if (current->pid != xenwatch_pid) - mutex_unlock(&xenwatch_mutex); -- } - } - EXPORT_SYMBOL_GPL(unregister_xenbus_watch); +-extern void xenbus_probe(struct work_struct *); + static DECLARE_WORK(probe_work, xenbus_probe); -@@ -749,6 +753,7 @@ void xs_suspend_cancel(void) - mutex_unlock(&xs_state.transaction_mutex); + static DECLARE_WAIT_QUEUE_HEAD(xb_waitq); +@@ -112,6 +114,13 @@ static const void *get_input_chunk(XENST + return buf + MASK_XENSTORE_IDX(cons); } -+#if defined(CONFIG_XEN) || defined(MODULE) - static int xenwatch_handle_callback(void *data) ++/** ++ * xb_write - low level write ++ * @data: buffer to send ++ * @len: length of buffer ++ * ++ * Returns 0 on success, error otherwise. ++ */ + int xb_write(const void *data, unsigned len) { - struct xs_stored_msg *msg = data; -@@ -766,6 +771,7 @@ static int xenwatch_handle_callback(void - + struct xenstore_domain_interface *intf = xen_store_interface; +@@ -220,7 +229,9 @@ int xb_read(void *data, unsigned len) return 0; } -+#endif - static int xenwatch_thread(void *unused) +-/* Set up interrupt handler off store event channel. */ ++/** ++ * xb_init_comms - Set up interrupt handler off store event channel. ++ */ + int xb_init_comms(void) { -@@ -795,6 +801,7 @@ static int xenwatch_thread(void *unused) - - msg = list_entry(ent, struct xs_stored_msg, list); + struct xenstore_domain_interface *intf = xen_store_interface; +@@ -242,7 +253,11 @@ int xb_init_comms(void) + if (xenbus_irq) + unbind_from_irqhandler(xenbus_irq, &xb_waitq); +#if defined(CONFIG_XEN) || defined(MODULE) - /* - * Unlock the mutex before running an XBWF_new_thread - * handler. kthread_run can block which can deadlock -@@ -811,6 +818,15 @@ static int xenwatch_thread(void *unused) - xenwatch_handle_callback(msg); - mutex_unlock(&xenwatch_mutex); - } + err = bind_caller_port_to_irqhandler( +#else -+ msg->u.watch.handle->callback( -+ msg->u.watch.handle, -+ (const char **)msg->u.watch.vec, -+ msg->u.watch.vec_size); -+ mutex_unlock(&xenwatch_mutex); -+ kfree(msg->u.watch.vec); -+ kfree(msg); ++ err = bind_evtchn_to_irqhandler( +#endif - } + xen_store_evtchn, wake_waiting, + 0, "xenbus", &xb_waitq); + if (err <= 0) { +--- a/drivers/xen/xenbus/xenbus_dev.c ++++ b/drivers/xen/xenbus/xenbus_dev.c +@@ -493,7 +493,13 @@ static const struct file_operations xenb + #endif + }; - return 0; ---- head.orig/drivers/xen/xenoprof/xenoprofile.c 2012-02-16 12:29:42.000000000 +0100 -+++ head/drivers/xen/xenoprof/xenoprofile.c 2011-01-31 17:49:31.000000000 +0100 -@@ -26,7 +26,6 @@ +-int xenbus_dev_init(void) ++int ++#ifndef MODULE ++__init ++#else ++__devinit ++#endif ++xenbus_dev_init(void) + { + xenbus_dev_intf = create_xen_proc_entry("xenbus", 0400); + if (xenbus_dev_intf) +--- a/drivers/xen/xenbus/xenbus_probe.c ++++ b/drivers/xen/xenbus/xenbus_probe.c +@@ -43,21 +43,26 @@ + #include + #include + #include +-#include +-#include ++#include + +-#include + #include +-#include #include ++#if defined(CONFIG_XEN) || defined(MODULE) + #include + #include + #include #include - #include --#include - #include - #include - #include "../../../drivers/oprofile/cpu_buffer.h" ---- head.orig/arch/x86/include/mach-xen/asm/fixmap_32.h 2011-01-31 17:32:29.000000000 +0100 -+++ head/arch/x86/include/mach-xen/asm/fixmap_32.h 2011-01-31 17:49:31.000000000 +0100 -@@ -53,6 +53,8 @@ extern unsigned long __FIXADDR_TOP; - enum fixed_addresses { - FIX_HOLE, - FIX_VDSO, -+ FIX_DBGP_BASE, -+ FIX_EARLYCON_MEM_BASE, - #ifdef CONFIG_X86_LOCAL_APIC - FIX_APIC_BASE, /* local (CPU) APIC) -- required for SMP or not */ + #include ++#include + #ifdef MODULE + #include #endif ---- head.orig/arch/x86/include/mach-xen/asm/highmem.h 2011-01-31 17:32:29.000000000 +0100 -+++ head/arch/x86/include/mach-xen/asm/highmem.h 2011-01-31 17:49:31.000000000 +0100 -@@ -75,8 +75,7 @@ struct page *kmap_atomic_to_page(void *p ++#else ++#include ++#include ++#include ++#include ++#endif - #define kmap_atomic_pte(page, type) \ - kmap_atomic_prot(page, type, \ -- test_bit(PG_pinned, &(page)->flags) \ -- ? PAGE_KERNEL_RO : kmap_prot) -+ PagePinned(page) ? PAGE_KERNEL_RO : kmap_prot) + #include "xenbus_comms.h" + #include "xenbus_probe.h" +@@ -170,7 +175,7 @@ static int read_backend_details(struct x + return read_otherend_details(xendev, "backend-id", "backend"); + } - #define flush_cache_kmaps() do { } while (0) +-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) && (defined(CONFIG_XEN) || defined(MODULE)) + static int xenbus_uevent_frontend(struct device *dev, char **envp, + int num_envp, char *buffer, int buffer_size) + { +@@ -209,12 +214,16 @@ static struct xen_bus_type xenbus_fronte + .probe = xenbus_dev_probe, + .remove = xenbus_dev_remove, + .shutdown = xenbus_dev_shutdown, ++#if defined(CONFIG_XEN) || defined(MODULE) + .uevent = xenbus_uevent_frontend, + #endif ++#endif + }, ++#if defined(CONFIG_XEN) || defined(MODULE) + .dev = { + .bus_id = "xen", + }, ++#endif + }; ---- head.orig/arch/x86/include/mach-xen/asm/maddr_32.h 2011-08-08 12:54:10.000000000 +0200 -+++ head/arch/x86/include/mach-xen/asm/maddr_32.h 2011-01-31 17:49:31.000000000 +0100 -@@ -155,6 +155,7 @@ static inline paddr_t pte_machine_to_phy + static void otherend_changed(struct xenbus_watch *watch, +@@ -230,14 +239,15 @@ static void otherend_changed(struct xenb + if (!dev->otherend || + strncmp(dev->otherend, vec[XS_WATCH_PATH], + strlen(dev->otherend))) { +- DPRINTK("Ignoring watch at %s", vec[XS_WATCH_PATH]); ++ dev_dbg(&dev->dev, "Ignoring watch at %s", vec[XS_WATCH_PATH]); + return; + } - #ifdef CONFIG_X86_PAE - #define __pte_ma(x) ((pte_t) { (x), (maddr_t)(x) >> 32 } ) -+extern unsigned long long __supported_pte_mask; - static inline pte_t pfn_pte_ma(unsigned long page_nr, pgprot_t pgprot) - { - pte_t pte; ---- head.orig/arch/x86/include/mach-xen/asm/mmu_context_32.h 2011-01-31 17:32:29.000000000 +0100 -+++ head/arch/x86/include/mach-xen/asm/mmu_context_32.h 2011-01-31 17:49:31.000000000 +0100 -@@ -16,7 +16,7 @@ void mm_pin_all(void); - static inline void xen_activate_mm(struct mm_struct *prev, - struct mm_struct *next) + state = xenbus_read_driver_state(dev->otherend); + +- DPRINTK("state is %d (%s), %s, %s", state, xenbus_strstate(state), +- dev->otherend_watch.node, vec[XS_WATCH_PATH]); ++ dev_dbg(&dev->dev, "state is %d (%s), %s, %s", ++ state, xenbus_strstate(state), dev->otherend_watch.node, ++ vec[XS_WATCH_PATH]); + + #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) + /* +@@ -274,8 +284,13 @@ static int talk_to_otherend(struct xenbu + + static int watch_otherend(struct xenbus_device *dev) { -- if (!test_bit(PG_pinned, &virt_to_page(next->pgd)->flags)) -+ if (!PagePinned(virt_to_page(next->pgd))) - mm_pin(next); ++#if defined(CONFIG_XEN) || defined(MODULE) + return xenbus_watch_path2(dev, dev->otherend, "state", + &dev->otherend_watch, otherend_changed); ++#else ++ return xenbus_watch_pathfmt(dev, &dev->otherend_watch, otherend_changed, ++ "%s/%s", dev->otherend, "state"); ++#endif } -@@ -51,6 +51,8 @@ static inline void __prepare_arch_switch - : : "r" (0) ); - } -+void leave_mm(unsigned long cpu); -+ - static inline void switch_mm(struct mm_struct *prev, - struct mm_struct *next, - struct task_struct *tsk) -@@ -60,7 +62,7 @@ static inline void switch_mm(struct mm_s +@@ -301,9 +316,9 @@ int xenbus_dev_probe(struct device *_dev - if (likely(prev != next)) { - BUG_ON(!xen_feature(XENFEAT_writable_page_tables) && -- !test_bit(PG_pinned, &virt_to_page(next->pgd)->flags)); -+ !PagePinned(virt_to_page(next->pgd))); + err = talk_to_otherend(dev); + if (err) { +- printk(KERN_WARNING +- "xenbus_probe: talk_to_otherend on %s failed.\n", +- dev->nodename); ++ dev_warn(&dev->dev, ++ "xenbus_probe: talk_to_otherend on %s failed.\n", ++ dev->nodename); + return err; + } - /* stop flush ipis for the previous mm */ - cpu_clear(cpu, prev->cpu_vm_mask); ---- head.orig/arch/x86/include/mach-xen/asm/pgalloc_32.h 2011-01-31 17:32:29.000000000 +0100 -+++ head/arch/x86/include/mach-xen/asm/pgalloc_32.h 2011-01-31 17:49:31.000000000 +0100 -@@ -5,7 +5,7 @@ - #include /* for struct page */ - #include /* for phys_to_virt and page_to_pseudophys */ +@@ -313,9 +328,9 @@ int xenbus_dev_probe(struct device *_dev --#define paravirt_alloc_pt(pfn) do { } while (0) -+#define paravirt_alloc_pt(mm, pfn) do { } while (0) - #define paravirt_alloc_pd(pfn) do { } while (0) - #define paravirt_alloc_pd(pfn) do { } while (0) - #define paravirt_alloc_pd_clone(pfn, clonepfn, start, count) do { } while (0) -@@ -14,15 +14,15 @@ + err = watch_otherend(dev); + if (err) { +- printk(KERN_WARNING +- "xenbus_probe: watch_otherend on %s failed.\n", +- dev->nodename); ++ dev_warn(&dev->dev, ++ "xenbus_probe: watch_otherend on %s failed.\n", ++ dev->nodename); + return err; + } - #define pmd_populate_kernel(mm, pmd, pte) \ - do { \ -- paravirt_alloc_pt(__pa(pte) >> PAGE_SHIFT); \ -+ paravirt_alloc_pt(mm, __pa(pte) >> PAGE_SHIFT); \ - set_pmd(pmd, __pmd(_PAGE_TABLE + __pa(pte))); \ - } while (0) +@@ -361,8 +376,8 @@ static void xenbus_dev_shutdown(struct d - #define pmd_populate(mm, pmd, pte) \ - do { \ - unsigned long pfn = page_to_pfn(pte); \ -- paravirt_alloc_pt(pfn); \ -- if (test_bit(PG_pinned, &virt_to_page((mm)->pgd)->flags)) { \ -+ paravirt_alloc_pt(mm, pfn); \ -+ if (PagePinned(virt_to_page((mm)->pgd))) { \ - if (!PageHighMem(pte)) \ - BUG_ON(HYPERVISOR_update_va_mapping( \ - (unsigned long)__va(pfn << PAGE_SHIFT), \ ---- head.orig/arch/x86/include/mach-xen/asm/pgtable_32.h 2011-02-07 15:38:07.000000000 +0100 -+++ head/arch/x86/include/mach-xen/asm/pgtable_32.h 2011-02-07 15:38:23.000000000 +0100 -@@ -26,9 +26,6 @@ - #include - #include + get_device(&dev->dev); + if (dev->state != XenbusStateConnected) { +- printk("%s: %s: %s != Connected, skipping\n", __FUNCTION__, +- dev->nodename, xenbus_strstate(dev->state)); ++ dev_info(&dev->dev, "%s: %s: %s != Connected, skipping\n", __FUNCTION__, ++ dev->nodename, xenbus_strstate(dev->state)); + goto out; + } + xenbus_switch_state(dev, XenbusStateClosing); +@@ -372,7 +387,8 @@ static void xenbus_dev_shutdown(struct d --/* Is this pagetable pinned? */ --#define PG_pinned PG_arch_1 -- - struct vm_area_struct; + timeout = wait_for_completion_timeout(&dev->down, timeout); + if (!timeout) +- printk("%s: %s timeout closing device\n", __FUNCTION__, dev->nodename); ++ dev_info(&dev->dev, "%s: %s timeout closing device\n", ++ __FUNCTION__, dev->nodename); + out: + put_device(&dev->dev); + } +@@ -548,7 +564,9 @@ int xenbus_probe_node(struct xen_bus_typ + xendev->devicetype = tmpstring; + init_completion(&xendev->down); - /* -@@ -82,7 +79,7 @@ void paging_init(void); - * area for the same reason. ;) - */ - #define VMALLOC_OFFSET (8*1024*1024) --#define VMALLOC_START (((unsigned long) high_memory + vmalloc_earlyreserve + \ -+#define VMALLOC_START (((unsigned long) high_memory + \ - 2*VMALLOC_OFFSET-1) & ~(VMALLOC_OFFSET-1)) - #ifdef CONFIG_HIGHMEM - # define VMALLOC_END (PKMAP_BASE-2*PAGE_SIZE) -@@ -231,8 +228,6 @@ extern unsigned long pg0[]; - * The following only work if pte_present() is true. - * Undefined behaviour if not.. - */ --static inline int pte_user(pte_t pte) { return (pte).pte_low & _PAGE_USER; } --static inline int pte_read(pte_t pte) { return (pte).pte_low & _PAGE_USER; } - static inline int pte_dirty(pte_t pte) { return (pte).pte_low & _PAGE_DIRTY; } - static inline int pte_young(pte_t pte) { return (pte).pte_low & _PAGE_ACCESSED; } - static inline int pte_write(pte_t pte) { return (pte).pte_low & _PAGE_RW; } -@@ -243,13 +238,9 @@ static inline int pte_huge(pte_t pte) { - */ - static inline int pte_file(pte_t pte) { return (pte).pte_low & _PAGE_FILE; } ++#if defined(CONFIG_XEN) || defined(MODULE) + xendev->dev.parent = &bus->dev; ++#endif + xendev->dev.bus = &bus->bus; + xendev->dev.release = xenbus_dev_release; --static inline pte_t pte_rdprotect(pte_t pte) { (pte).pte_low &= ~_PAGE_USER; return pte; } --static inline pte_t pte_exprotect(pte_t pte) { (pte).pte_low &= ~_PAGE_USER; return pte; } - static inline pte_t pte_mkclean(pte_t pte) { (pte).pte_low &= ~_PAGE_DIRTY; return pte; } - static inline pte_t pte_mkold(pte_t pte) { (pte).pte_low &= ~_PAGE_ACCESSED; return pte; } - static inline pte_t pte_wrprotect(pte_t pte) { (pte).pte_low &= ~_PAGE_RW; return pte; } --static inline pte_t pte_mkread(pte_t pte) { (pte).pte_low |= _PAGE_USER; return pte; } --static inline pte_t pte_mkexec(pte_t pte) { (pte).pte_low |= _PAGE_USER; return pte; } - static inline pte_t pte_mkdirty(pte_t pte) { (pte).pte_low |= _PAGE_DIRTY; return pte; } - static inline pte_t pte_mkyoung(pte_t pte) { (pte).pte_low |= _PAGE_ACCESSED; return pte; } - static inline pte_t pte_mkwrite(pte_t pte) { (pte).pte_low |= _PAGE_RW; return pte; } -@@ -295,22 +286,20 @@ static inline pte_t xen_local_ptep_get_a - #define ptep_set_access_flags(vma, address, ptep, entry, dirty) \ - ({ \ - int __changed = !pte_same(*(ptep), entry); \ -- if (__changed && (dirty)) \ -- ptep_establish(vma, address, ptep, entry); \ -+ if (__changed && (dirty)) { \ -+ if ( likely((vma)->vm_mm == current->mm) ) { \ -+ BUG_ON(HYPERVISOR_update_va_mapping(address, \ -+ entry, \ -+ (unsigned long)(vma)->vm_mm->cpu_vm_mask.bits| \ -+ UVMF_INVLPG|UVMF_MULTI)); \ -+ } else { \ -+ xen_l1_entry_update(ptep, entry); \ -+ flush_tlb_page(vma, address); \ -+ } \ -+ } \ - __changed; \ - }) +@@ -563,15 +581,16 @@ int xenbus_probe_node(struct xen_bus_typ --#define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_DIRTY --#define ptep_test_and_clear_dirty(vma, addr, ptep) ({ \ -- int __ret = 0; \ -- if (pte_dirty(*(ptep))) \ -- __ret = test_and_clear_bit(_PAGE_BIT_DIRTY, \ -- &(ptep)->pte_low); \ -- if (__ret) \ -- pte_update((vma)->vm_mm, addr, ptep); \ -- __ret; \ --}) -- - #define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_YOUNG - #define ptep_test_and_clear_young(vma, addr, ptep) ({ \ - int __ret = 0; \ -@@ -322,44 +311,13 @@ static inline pte_t xen_local_ptep_get_a - __ret; \ - }) + err = device_create_file(&xendev->dev, &dev_attr_nodename); + if (err) +- goto unregister; ++ goto fail_unregister; ++ + err = device_create_file(&xendev->dev, &dev_attr_devtype); + if (err) +- goto unregister; ++ goto fail_remove_file; --/* -- * Rules for using ptep_establish: the pte MUST be a user pte, and -- * must be a present->present transition. -- */ --#define __HAVE_ARCH_PTEP_ESTABLISH --#define ptep_establish(vma, address, ptep, pteval) \ --do { \ -- if ( likely((vma)->vm_mm == current->mm) ) { \ -- BUG_ON(HYPERVISOR_update_va_mapping(address, \ -- pteval, \ -- (unsigned long)(vma)->vm_mm->cpu_vm_mask.bits| \ -- UVMF_INVLPG|UVMF_MULTI)); \ -- } else { \ -- xen_l1_entry_update(ptep, pteval); \ -- flush_tlb_page(vma, address); \ -- } \ --} while (0) -- --#define __HAVE_ARCH_PTEP_CLEAR_DIRTY_FLUSH --#define ptep_clear_flush_dirty(vma, address, ptep) \ --({ \ -- pte_t __pte = *(ptep); \ -- int __dirty = pte_dirty(__pte); \ -- __pte = pte_mkclean(__pte); \ -- if (test_bit(PG_pinned, &virt_to_page((vma)->vm_mm->pgd)->flags)) \ -- (void)ptep_set_access_flags(vma, address, ptep, __pte, __dirty); \ -- else if (__dirty) \ -- (ptep)->pte_low = __pte.pte_low; \ -- __dirty; \ --}) -- - #define __HAVE_ARCH_PTEP_CLEAR_YOUNG_FLUSH - #define ptep_clear_flush_young(vma, address, ptep) \ - ({ \ - pte_t __pte = *(ptep); \ - int __young = pte_young(__pte); \ - __pte = pte_mkold(__pte); \ -- if (test_bit(PG_pinned, &virt_to_page((vma)->vm_mm->pgd)->flags)) \ -+ if (PagePinned(virt_to_page((vma)->vm_mm->pgd))) \ - (void)ptep_set_access_flags(vma, address, ptep, __pte, __young); \ - else if (__young) \ - (ptep)->pte_low = __pte.pte_low; \ -@@ -383,7 +341,7 @@ static inline pte_t ptep_get_and_clear(s - #define ptep_get_and_clear_full(mm, addr, ptep, full) \ - ((full) ? ({ \ - pte_t __res = *(ptep); \ -- if (test_bit(PG_pinned, &virt_to_page((mm)->pgd)->flags)) \ -+ if (PagePinned(virt_to_page((mm)->pgd))) \ - xen_l1_entry_update(ptep, __pte(0)); \ - else \ - *(ptep) = __pte(0); \ ---- head.orig/arch/x86/include/mach-xen/asm/pgtable-3level.h 2011-01-31 17:32:29.000000000 +0100 -+++ head/arch/x86/include/mach-xen/asm/pgtable-3level.h 2011-01-31 17:49:31.000000000 +0100 -@@ -23,26 +23,11 @@ - #define pud_present(pud) 1 + return 0; +-unregister: ++fail_remove_file: + device_remove_file(&xendev->dev, &dev_attr_nodename); +- device_remove_file(&xendev->dev, &dev_attr_devtype); ++fail_unregister: + device_unregister(&xendev->dev); + fail: + kfree(xendev); +@@ -587,7 +606,8 @@ static int xenbus_probe_frontend(const c + if (!strcmp(type, "console")) + return 0; - /* -- * Is the pte executable? -- */ --static inline int pte_x(pte_t pte) --{ -- return !(__pte_val(pte) & _PAGE_NX); --} -- --/* -- * All present user-pages with !NX bit are user-executable: -- */ --static inline int pte_exec(pte_t pte) --{ -- return pte_user(pte) && pte_x(pte); --} --/* - * All present pages with !NX bit are kernel-executable: - */ - static inline int pte_exec_kernel(pte_t pte) - { -- return pte_x(pte); -+ return !(__pte_val(pte) & _PAGE_NX); +- nodename = kasprintf(GFP_KERNEL, "%s/%s/%s", xenbus_frontend.root, type, name); ++ nodename = kasprintf(GFP_KERNEL, "%s/%s/%s", ++ xenbus_frontend.root, type, name); + if (!nodename) + return -ENOMEM; + +@@ -665,7 +685,7 @@ static int strsep_len(const char *str, c + return (len == 0) ? i : -ERANGE; } - /* Rules for using set_pte: the pte being assigned *must* be ---- head.orig/arch/x86/include/mach-xen/asm/processor_32.h 2011-01-31 17:32:29.000000000 +0100 -+++ head/arch/x86/include/mach-xen/asm/processor_32.h 2011-01-31 17:49:31.000000000 +0100 -@@ -89,7 +89,6 @@ struct cpuinfo_x86 { - #define X86_VENDOR_UMC 3 - #define X86_VENDOR_NEXGEN 4 - #define X86_VENDOR_CENTAUR 5 --#define X86_VENDOR_RISE 6 - #define X86_VENDOR_TRANSMETA 7 - #define X86_VENDOR_NSC 8 - #define X86_VENDOR_NUM 9 -@@ -122,6 +121,7 @@ void __init cpu_detect(struct cpuinfo_x8 - extern void identify_boot_cpu(void); - extern void identify_secondary_cpu(struct cpuinfo_x86 *); - extern void print_cpu_info(struct cpuinfo_x86 *); -+extern void init_scattered_cpuid_features(struct cpuinfo_x86 *c); - extern unsigned int init_intel_cacheinfo(struct cpuinfo_x86 *c); - extern unsigned short num_cache_leaves; +-void dev_changed(const char *node, struct xen_bus_type *bus) ++void xenbus_dev_changed(const char *node, struct xen_bus_type *bus) + { + int exists, rootlen; + struct xenbus_device *dev; +@@ -673,7 +693,7 @@ void dev_changed(const char *node, struc + const char *p, *root; -@@ -171,17 +171,6 @@ static inline void clear_in_cr4 (unsigne - write_cr4(cr4); - } + if (bus->error || char_count(node, '/') < 2) +- return; ++ return; --/* -- * NSC/Cyrix CPU indexed register access macros -- */ -- --#define getCx86(reg) ({ outb((reg), 0x22); inb(0x23); }) -- --#define setCx86(reg, data) do { \ -- outb((reg), 0x22); \ -- outb((data), 0x23); \ --} while (0) -- - /* Stop speculative execution */ - static inline void sync_core(void) + exists = xenbus_exists(XBT_NIL, node, ""); + if (!exists) { +@@ -707,7 +727,7 @@ static void frontend_changed(struct xenb { -@@ -230,6 +219,10 @@ extern int bootloader_type; + DPRINTK(""); - #define HAVE_ARCH_PICK_MMAP_LAYOUT +- dev_changed(vec[XS_WATCH_PATH], &xenbus_frontend); ++ xenbus_dev_changed(vec[XS_WATCH_PATH], &xenbus_frontend); + } -+extern void hard_disable_TSC(void); -+extern void disable_TSC(void); -+extern void hard_enable_TSC(void); -+ - /* - * Size of io_bitmap. - */ ---- head.orig/arch/x86/include/mach-xen/asm/tlbflush_32.h 2011-01-31 17:32:29.000000000 +0100 -+++ head/arch/x86/include/mach-xen/asm/tlbflush_32.h 2011-01-31 17:49:31.000000000 +0100 -@@ -91,7 +91,11 @@ struct tlb_state - DECLARE_PER_CPU(struct tlb_state, cpu_tlbstate); - #endif /* SMP */ + /* We watch for devices appearing and vanishing. */ +@@ -1119,10 +1139,18 @@ fail0: + #endif + #endif /* CONFIG_XEN_PRIVILEGED_GUEST */ --#define flush_tlb_kernel_range(start, end) flush_tlb_all() -+static inline void flush_tlb_kernel_range(unsigned long start, -+ unsigned long end) -+{ -+ flush_tlb_all(); -+} +-static int xenbus_probe_init(void) ++static int ++#ifndef MODULE ++__init ++#else ++__devinit ++#endif ++xenbus_probe_init(void) + { + int err = 0; ++#if defined(CONFIG_XEN) || defined(MODULE) + unsigned long page = 0; ++#endif - static inline void flush_tlb_pgtables(struct mm_struct *mm, - unsigned long start, unsigned long end) ---- head.orig/arch/x86/include/mach-xen/asm/fixmap_64.h 2011-01-31 17:32:29.000000000 +0100 -+++ head/arch/x86/include/mach-xen/asm/fixmap_64.h 2011-01-31 17:49:31.000000000 +0100 -@@ -23,9 +23,9 @@ - * compile time, but to set the physical address only - * in the boot process. - * -- * these 'compile-time allocated' memory buffers are -- * fixed-size 4k pages. (or larger if used with an increment -- * highger than 1) use fixmap_set(idx,phys) to associate -+ * These 'compile-time allocated' memory buffers are -+ * fixed-size 4k pages (or larger if used with an increment -+ * higher than 1). Use set_fixmap(idx,phys) to associate - * physical memory with fixmap indices. - * - * TLB entries of such buffers will not be flushed across -@@ -36,6 +36,8 @@ enum fixed_addresses { - VSYSCALL_LAST_PAGE, - VSYSCALL_FIRST_PAGE = VSYSCALL_LAST_PAGE + ((VSYSCALL_END-VSYSCALL_START) >> PAGE_SHIFT) - 1, - VSYSCALL_HPET, -+ FIX_DBGP_BASE, -+ FIX_EARLYCON_MEM_BASE, - FIX_HPET_BASE, - #ifdef CONFIG_X86_LOCAL_APIC - FIX_APIC_BASE, /* local (CPU) APIC) -- required for SMP or not */ -@@ -105,7 +107,7 @@ static __always_inline unsigned long fix - if (idx >= __end_of_fixed_addresses) - __this_fixmap_does_not_exist(); + DPRINTK(""); -- return __fix_to_virt(idx); -+ return __fix_to_virt(idx); - } +@@ -1141,6 +1169,7 @@ static int xenbus_probe_init(void) + * Domain0 doesn't have a store_evtchn or store_mfn yet. + */ + if (is_initial_xendomain()) { ++#if defined(CONFIG_XEN) || defined(MODULE) + struct evtchn_alloc_unbound alloc_unbound; + /* Allocate Xenstore page */ +@@ -1179,10 +1208,13 @@ static int xenbus_probe_init(void) + if (xsd_port_intf) + xsd_port_intf->read_proc = xsd_port_read; #endif ---- head.orig/arch/x86/include/mach-xen/asm/mmu_context_64.h 2011-01-31 17:32:29.000000000 +0100 -+++ head/arch/x86/include/mach-xen/asm/mmu_context_64.h 2011-01-31 17:49:31.000000000 +0100 -@@ -76,7 +76,7 @@ static inline void switch_mm(struct mm_s - - if (likely(prev != next)) { - BUG_ON(!xen_feature(XENFEAT_writable_page_tables) && -- !next->context.pinned); -+ !PagePinned(virt_to_page(next->pgd))); ++#else ++ /* dom0 not yet supported */ ++#endif + xen_store_interface = mfn_to_virt(xen_store_mfn); + } else { + atomic_set(&xenbus_xsd_state, XENBUS_XSD_FOREIGN_READY); +-#ifdef CONFIG_XEN ++#ifndef MODULE + xen_store_evtchn = xen_start_info->store_evtchn; + xen_store_mfn = xen_start_info->store_mfn; + xen_store_interface = mfn_to_virt(xen_store_mfn); +@@ -1198,7 +1230,9 @@ static int xenbus_probe_init(void) + goto err; + } - /* stop flush ipis for the previous mm */ - cpu_clear(cpu, prev->cpu_vm_mask); -@@ -131,7 +131,7 @@ static inline void switch_mm(struct mm_s ++#if defined(CONFIG_XEN) || defined(MODULE) + xenbus_dev_init(); ++#endif - static inline void activate_mm(struct mm_struct *prev, struct mm_struct *next) - { -- if (!next->context.pinned) -+ if (!PagePinned(virt_to_page(next->pgd))) - mm_pin(next); - switch_mm(prev, next, NULL); - } ---- head.orig/arch/x86/include/mach-xen/asm/pgalloc_64.h 2011-01-31 17:32:29.000000000 +0100 -+++ head/arch/x86/include/mach-xen/asm/pgalloc_64.h 2011-01-31 17:49:31.000000000 +0100 -@@ -21,7 +21,7 @@ static inline void pmd_populate_kernel(s + /* Initialize the interface to xenstore. */ + err = xs_init(); +@@ -1208,6 +1242,7 @@ static int xenbus_probe_init(void) + goto err; + } - static inline void pmd_populate(struct mm_struct *mm, pmd_t *pmd, struct page *pte) - { -- if (unlikely((mm)->context.pinned)) { -+ if (unlikely(PagePinned(virt_to_page((mm)->pgd)))) { - BUG_ON(HYPERVISOR_update_va_mapping( - (unsigned long)__va(page_to_pfn(pte) << PAGE_SHIFT), - pfn_pte(page_to_pfn(pte), PAGE_KERNEL_RO), 0)); -@@ -33,7 +33,7 @@ static inline void pmd_populate(struct m ++#if defined(CONFIG_XEN) || defined(MODULE) + /* Register ourselves with the kernel device subsystem */ + if (!xenbus_frontend.error) { + xenbus_frontend.error = device_register(&xenbus_frontend.dev); +@@ -1218,6 +1253,7 @@ static int xenbus_probe_init(void) + xenbus_frontend.error); + } + } ++#endif + xenbus_backend_device_register(); - static inline void pud_populate(struct mm_struct *mm, pud_t *pud, pmd_t *pmd) - { -- if (unlikely((mm)->context.pinned)) { -+ if (unlikely(PagePinned(virt_to_page((mm)->pgd)))) { - BUG_ON(HYPERVISOR_update_va_mapping( - (unsigned long)pmd, - pfn_pte(virt_to_phys(pmd)>>PAGE_SHIFT, -@@ -50,7 +50,7 @@ static inline void pud_populate(struct m - */ - static inline void pgd_populate(struct mm_struct *mm, pgd_t *pgd, pud_t *pud) - { -- if (unlikely((mm)->context.pinned)) { -+ if (unlikely(PagePinned(virt_to_page((mm)->pgd)))) { - BUG_ON(HYPERVISOR_update_va_mapping( - (unsigned long)pud, - pfn_pte(virt_to_phys(pud)>>PAGE_SHIFT, ---- head.orig/arch/x86/include/mach-xen/asm/pgtable_64.h 2011-02-07 15:38:08.000000000 +0100 -+++ head/arch/x86/include/mach-xen/asm/pgtable_64.h 2011-02-07 15:38:18.000000000 +0100 -@@ -304,7 +304,7 @@ static inline pte_t ptep_get_and_clear_f - { - if (full) { - pte_t pte = *ptep; -- if (mm->context.pinned) -+ if (PagePinned(virt_to_page(mm->pgd))) - xen_l1_entry_update(ptep, __pte(0)); - else - *ptep = __pte(0); -@@ -333,21 +333,15 @@ static inline pte_t ptep_get_and_clear_f - * Undefined behaviour if not.. - */ - #define __LARGE_PTE (_PAGE_PSE|_PAGE_PRESENT) --static inline int pte_user(pte_t pte) { return __pte_val(pte) & _PAGE_USER; } --static inline int pte_read(pte_t pte) { return __pte_val(pte) & _PAGE_USER; } --static inline int pte_exec(pte_t pte) { return !(__pte_val(pte) & _PAGE_NX); } - static inline int pte_dirty(pte_t pte) { return __pte_val(pte) & _PAGE_DIRTY; } - static inline int pte_young(pte_t pte) { return __pte_val(pte) & _PAGE_ACCESSED; } - static inline int pte_write(pte_t pte) { return __pte_val(pte) & _PAGE_RW; } - static inline int pte_file(pte_t pte) { return __pte_val(pte) & _PAGE_FILE; } - static inline int pte_huge(pte_t pte) { return __pte_val(pte) & _PAGE_PSE; } + if (!is_initial_xendomain()) +@@ -1232,16 +1268,22 @@ static int xenbus_probe_init(void) + * registered. + */ --static inline pte_t pte_rdprotect(pte_t pte) { __pte_val(pte) &= ~_PAGE_USER; return pte; } --static inline pte_t pte_exprotect(pte_t pte) { __pte_val(pte) &= ~_PAGE_USER; return pte; } - static inline pte_t pte_mkclean(pte_t pte) { __pte_val(pte) &= ~_PAGE_DIRTY; return pte; } - static inline pte_t pte_mkold(pte_t pte) { __pte_val(pte) &= ~_PAGE_ACCESSED; return pte; } - static inline pte_t pte_wrprotect(pte_t pte) { __pte_val(pte) &= ~_PAGE_RW; return pte; } --static inline pte_t pte_mkread(pte_t pte) { __pte_val(pte) |= _PAGE_USER; return pte; } - static inline pte_t pte_mkexec(pte_t pte) { __pte_val(pte) &= ~_PAGE_NX; return pte; } - static inline pte_t pte_mkdirty(pte_t pte) { __pte_val(pte) |= _PAGE_DIRTY; return pte; } - static inline pte_t pte_mkyoung(pte_t pte) { __pte_val(pte) |= _PAGE_ACCESSED; return pte; } -@@ -355,13 +349,6 @@ static inline pte_t pte_mkwrite(pte_t pt - static inline pte_t pte_mkhuge(pte_t pte) { __pte_val(pte) |= _PAGE_PSE; return pte; } - static inline pte_t pte_clrhuge(pte_t pte) { __pte_val(pte) &= ~_PAGE_PSE; return pte; } ++#if defined(CONFIG_XEN) || defined(MODULE) + if (page != 0) + free_page(page); ++#endif + return err; + } --static inline int ptep_test_and_clear_dirty(struct vm_area_struct *vma, unsigned long addr, pte_t *ptep) --{ -- if (!pte_dirty(*ptep)) -- return 0; -- return test_and_clear_bit(_PAGE_BIT_DIRTY, &ptep->pte); --} -- - static inline int ptep_test_and_clear_young(struct vm_area_struct *vma, unsigned long addr, pte_t *ptep) +-#ifdef CONFIG_XEN ++#ifndef MODULE + postcore_initcall(xenbus_probe_init); ++#ifdef CONFIG_XEN + MODULE_LICENSE("Dual BSD/GPL"); + #else +-int xenbus_init(void) ++MODULE_LICENSE("GPL"); ++#endif ++#else ++int __devinit xenbus_init(void) { - if (!pte_young(*ptep)) -@@ -500,26 +487,13 @@ static inline pte_t pte_modify(pte_t pte - __changed; \ - }) + return xenbus_probe_init(); + } +--- a/drivers/xen/xenbus/xenbus_probe.h ++++ b/drivers/xen/xenbus/xenbus_probe.h +@@ -61,7 +61,9 @@ struct xen_bus_type { + int (*get_bus_id)(char bus_id[XEN_BUS_ID_SIZE], const char *nodename); + int (*probe)(const char *type, const char *dir); + struct bus_type bus; ++#if defined(CONFIG_XEN) || defined(MODULE) + struct device dev; ++#endif + }; --#define __HAVE_ARCH_PTEP_CLEAR_DIRTY_FLUSH --#define ptep_clear_flush_dirty(vma, address, ptep) \ --({ \ -- pte_t __pte = *(ptep); \ -- int __dirty = pte_dirty(__pte); \ -- __pte = pte_mkclean(__pte); \ -- if ((vma)->vm_mm->context.pinned) \ -- (void)ptep_set_access_flags(vma, address, ptep, __pte, __dirty); \ -- else if (__dirty) \ -- set_pte(ptep, __pte); \ -- __dirty; \ --}) -- - #define __HAVE_ARCH_PTEP_CLEAR_YOUNG_FLUSH - #define ptep_clear_flush_young(vma, address, ptep) \ - ({ \ - pte_t __pte = *(ptep); \ - int __young = pte_young(__pte); \ - __pte = pte_mkold(__pte); \ -- if ((vma)->vm_mm->context.pinned) \ -+ if (PagePinned(virt_to_page((vma)->vm_mm->pgd))) \ - (void)ptep_set_access_flags(vma, address, ptep, __pte, __young); \ - else if (__young) \ - set_pte(ptep, __pte); \ -@@ -566,6 +540,8 @@ int xen_change_pte_range(struct mm_struc - #define arch_change_pte_range(mm, pmd, addr, end, newprot, dirty_accountable) \ - xen_change_pte_range(mm, pmd, addr, end, newprot, dirty_accountable) + extern int xenbus_match(struct device *_dev, struct device_driver *_drv); +@@ -74,6 +76,6 @@ extern int xenbus_probe_node(struct xen_ + const char *nodename); + extern int xenbus_probe_devices(struct xen_bus_type *bus); -+pte_t *lookup_address(unsigned long addr); -+ - #define io_remap_pfn_range(vma, vaddr, pfn, size, prot) \ - direct_remap_pfn_range(vma,vaddr,pfn,size,prot,DOMID_IO) +-extern void dev_changed(const char *node, struct xen_bus_type *bus); ++extern void xenbus_dev_changed(const char *node, struct xen_bus_type *bus); -@@ -583,7 +559,6 @@ int xen_change_pte_range(struct mm_struc - (((o) & (1UL << (__VIRTUAL_MASK_SHIFT-1))) ? ((o) | (~__VIRTUAL_MASK)) : (o)) + #endif +--- a/drivers/xen/xenbus/xenbus_probe_backend.c ++++ b/drivers/xen/xenbus/xenbus_probe_backend.c +@@ -234,7 +234,7 @@ static void backend_changed(struct xenbu + { + DPRINTK(""); - #define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_YOUNG --#define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_DIRTY - #define __HAVE_ARCH_PTEP_GET_AND_CLEAR - #define __HAVE_ARCH_PTEP_GET_AND_CLEAR_FULL - #define __HAVE_ARCH_PTEP_CLEAR_FLUSH ---- head.orig/arch/x86/include/mach-xen/asm/processor_64.h 2011-01-31 17:32:29.000000000 +0100 -+++ head/arch/x86/include/mach-xen/asm/processor_64.h 2011-01-31 17:49:31.000000000 +0100 -@@ -83,7 +83,6 @@ struct cpuinfo_x86 { - #define X86_VENDOR_UMC 3 - #define X86_VENDOR_NEXGEN 4 - #define X86_VENDOR_CENTAUR 5 --#define X86_VENDOR_RISE 6 - #define X86_VENDOR_TRANSMETA 7 - #define X86_VENDOR_NUM 8 - #define X86_VENDOR_UNKNOWN 0xff -@@ -100,6 +99,7 @@ extern char ignore_irq13; +- dev_changed(vec[XS_WATCH_PATH], &xenbus_backend); ++ xenbus_dev_changed(vec[XS_WATCH_PATH], &xenbus_backend); + } - extern void identify_cpu(struct cpuinfo_x86 *); - extern void print_cpu_info(struct cpuinfo_x86 *); -+extern void init_scattered_cpuid_features(struct cpuinfo_x86 *c); - extern unsigned int init_intel_cacheinfo(struct cpuinfo_x86 *c); - extern unsigned short num_cache_leaves; + static struct xenbus_watch be_watch = { +--- a/drivers/xen/xenbus/xenbus_xs.c ++++ b/drivers/xen/xenbus/xenbus_xs.c +@@ -626,7 +626,7 @@ static struct xenbus_watch *find_watch(c -@@ -377,12 +377,10 @@ static inline void sync_core(void) - asm volatile("cpuid" : "=a" (tmp) : "0" (1) : "ebx","ecx","edx","memory"); - } + static void xs_reset_watches(void) + { +-#ifndef CONFIG_XEN ++#ifdef MODULE + int err, supported = 0; --#define cpu_has_fpu 1 -- - #define ARCH_HAS_PREFETCH - static inline void prefetch(void *x) - { -- asm volatile("prefetcht0 %0" :: "m" (*(unsigned long *)x)); -+ asm volatile("prefetcht0 (%0)" :: "r" (x)); - } + err = xenbus_scanf(XBT_NIL, "control", +@@ -677,7 +677,9 @@ void unregister_xenbus_watch(struct xenb + char token[sizeof(watch) * 2 + 1]; + int err; - #define ARCH_HAS_PREFETCHW 1 -@@ -400,17 +398,6 @@ static inline void prefetchw(void *x) ++#if defined(CONFIG_XEN) || defined(MODULE) + BUG_ON(watch->flags & XBWF_new_thread); ++#endif - #define cpu_relax() rep_nop() + sprintf(token, "%lX", (long)watch); --/* -- * NSC/Cyrix CPU indexed register access macros -- */ -- --#define getCx86(reg) ({ outb((reg), 0x22); inb(0x23); }) -- --#define setCx86(reg, data) do { \ -- outb((reg), 0x22); \ -- outb((data), 0x23); \ --} while (0) -- - static inline void serialize_cpu(void) - { - __asm__ __volatile__ ("cpuid" : : : "ax", "bx", "cx", "dx"); ---- head.orig/arch/x86/include/mach-xen/asm/tlbflush_64.h 2011-01-31 17:32:29.000000000 +0100 -+++ head/arch/x86/include/mach-xen/asm/tlbflush_64.h 2011-01-31 17:49:31.000000000 +0100 -@@ -89,7 +89,11 @@ static inline void flush_tlb_range(struc +@@ -696,6 +698,11 @@ void unregister_xenbus_watch(struct xenb - #endif + up_read(&xs_state.watch_mutex); --#define flush_tlb_kernel_range(start, end) flush_tlb_all() -+static inline void flush_tlb_kernel_range(unsigned long start, -+ unsigned long end) -+{ -+ flush_tlb_all(); -+} ++ /* Make sure there are no callbacks running currently (unless ++ its us) */ ++ if (current->pid != xenwatch_pid) ++ mutex_lock(&xenwatch_mutex); ++ + /* Cancel pending watch events. */ + spin_lock(&watch_events_lock); + list_for_each_entry_safe(msg, tmp, &watch_events, list) { +@@ -707,11 +714,8 @@ void unregister_xenbus_watch(struct xenb + } + spin_unlock(&watch_events_lock); - static inline void flush_tlb_pgtables(struct mm_struct *mm, - unsigned long start, unsigned long end) ---- head.orig/arch/x86/include/asm/thread_info.h 2013-03-21 13:55:22.000000000 +0100 -+++ head/arch/x86/include/asm/thread_info.h 2013-03-21 14:16:36.000000000 +0100 -@@ -157,7 +157,8 @@ struct thread_info { - #define _TIF_WORK_CTXSW_PREV (_TIF_WORK_CTXSW|_TIF_USER_RETURN_NOTIFY) - #define _TIF_WORK_CTXSW_NEXT (_TIF_WORK_CTXSW|_TIF_DEBUG) - #else --#define _TIF_WORK_CTXSW _TIF_DEBUG -+#define _TIF_WORK_CTXSW_NEXT (_TIF_NOTSC | _TIF_DEBUG) -+#define _TIF_WORK_CTXSW_PREV (_TIF_NOTSC) - #endif +- /* Flush any currently-executing callback, unless we are it. :-) */ +- if (current->pid != xenwatch_pid) { +- mutex_lock(&xenwatch_mutex); ++ if (current->pid != xenwatch_pid) + mutex_unlock(&xenwatch_mutex); +- } + } + EXPORT_SYMBOL_GPL(unregister_xenbus_watch); - #define PREEMPT_ACTIVE 0x10000000 ---- head.orig/arch/x86/include/asm/xen/interface.h 2013-02-19 00:58:34.000000000 +0100 -+++ head/arch/x86/include/asm/xen/interface.h 2013-01-08 11:43:52.000000000 +0100 -@@ -10,17 +10,20 @@ - #define _ASM_X86_XEN_INTERFACE_H +@@ -749,6 +753,7 @@ void xs_suspend_cancel(void) + mutex_unlock(&xs_state.transaction_mutex); + } - #ifdef __XEN__ --#define __DEFINE_GUEST_HANDLE(name, type) \ -+#define ___DEFINE_XEN_GUEST_HANDLE(name, type) \ - typedef struct { type *p; } __guest_handle_ ## name - #else --#define __DEFINE_GUEST_HANDLE(name, type) \ -+#define ___DEFINE_XEN_GUEST_HANDLE(name, type) \ - typedef type * __guest_handle_ ## name - #endif ++#if defined(CONFIG_XEN) || defined(MODULE) + static int xenwatch_handle_callback(void *data) + { + struct xs_stored_msg *msg = data; +@@ -766,6 +771,7 @@ static int xenwatch_handle_callback(void -+#define __DEFINE_XEN_GUEST_HANDLE(name, type) \ -+ ___DEFINE_XEN_GUEST_HANDLE(name, type); \ -+ ___DEFINE_XEN_GUEST_HANDLE(const_##name, const type) - #define DEFINE_GUEST_HANDLE_STRUCT(name) \ -- __DEFINE_GUEST_HANDLE(name, struct name) --#define DEFINE_GUEST_HANDLE(name) __DEFINE_GUEST_HANDLE(name, name) --#define GUEST_HANDLE(name) __guest_handle_ ## name -+ __DEFINE_XEN_GUEST_HANDLE(name, struct name) -+#define DEFINE_XEN_GUEST_HANDLE(name) __DEFINE_XEN_GUEST_HANDLE(name, name) -+#define XEN_GUEST_HANDLE(name) __guest_handle_ ## name + return 0; + } ++#endif - #ifdef __XEN__ - #if defined(__i386__) -@@ -54,16 +57,6 @@ typedef unsigned long xen_pfn_t; - #define PRI_xen_pfn "lx" - typedef unsigned long xen_ulong_t; - #define PRI_xen_ulong "lx" --/* Guest handles for primitive C types. */ --__DEFINE_GUEST_HANDLE(uchar, unsigned char); --__DEFINE_GUEST_HANDLE(uint, unsigned int); --DEFINE_GUEST_HANDLE(char); --DEFINE_GUEST_HANDLE(int); --DEFINE_GUEST_HANDLE(void); --DEFINE_GUEST_HANDLE(uint64_t); --DEFINE_GUEST_HANDLE(uint32_t); --DEFINE_GUEST_HANDLE(xen_pfn_t); --DEFINE_GUEST_HANDLE(xen_ulong_t); - #endif + static int xenwatch_thread(void *unused) + { +@@ -795,6 +801,7 @@ static int xenwatch_thread(void *unused) - #ifndef HYPERVISOR_VIRT_START -@@ -75,7 +68,7 @@ DEFINE_GUEST_HANDLE(xen_ulong_t); - #define MACH2PHYS_NR_ENTRIES ((MACH2PHYS_VIRT_END-MACH2PHYS_VIRT_START)>>__MACH2PHYS_SHIFT) + msg = list_entry(ent, struct xs_stored_msg, list); - /* Maximum number of virtual CPUs in multi-processor guests. */ --#define MAX_VIRT_CPUS 32 -+#define XEN_LEGACY_MAX_VCPUS 32 ++#if defined(CONFIG_XEN) || defined(MODULE) + /* + * Unlock the mutex before running an XBWF_new_thread + * handler. kthread_run can block which can deadlock +@@ -811,6 +818,15 @@ static int xenwatch_thread(void *unused) + xenwatch_handle_callback(msg); + mutex_unlock(&xenwatch_mutex); + } ++#else ++ msg->u.watch.handle->callback( ++ msg->u.watch.handle, ++ (const char **)msg->u.watch.vec, ++ msg->u.watch.vec_size); ++ mutex_unlock(&xenwatch_mutex); ++ kfree(msg->u.watch.vec); ++ kfree(msg); ++#endif + } - /* - * SEGMENT DESCRIPTOR TABLES ---- head.orig/include/linux/elfnote.h 2008-04-17 04:49:44.000000000 +0200 -+++ head/include/linux/elfnote.h 2011-01-31 17:49:31.000000000 +0100 + return 0; +--- a/drivers/xen/xenoprof/xenoprofile.c ++++ b/drivers/xen/xenoprof/xenoprofile.c +@@ -26,7 +26,6 @@ + #include + #include + #include +-#include + #include + #include + #include "../../../drivers/oprofile/cpu_buffer.h" +--- a/include/linux/elfnote.h ++++ b/include/linux/elfnote.h @@ -52,7 +52,7 @@ 4484:.balign 4 ; \ .popsection ; @@ -4535,8 +4652,8 @@ Acked-by: jbeulich@novell.com ELFNOTE_START(name, type, "") \ desc ; \ ELFNOTE_END ---- head.orig/include/linux/page-flags.h 2013-03-21 13:54:31.000000000 +0100 -+++ head/include/linux/page-flags.h 2013-03-21 14:16:21.000000000 +0100 +--- a/include/linux/page-flags.h ++++ b/include/linux/page-flags.h @@ -126,8 +126,15 @@ enum pageflags { PG_fscache = PG_private_2, /* page backed by cache */ @@ -4565,8 +4682,8 @@ Acked-by: jbeulich@novell.com #else # define __PG_XEN (1 << PG_foreign) #endif ---- head.orig/include/xen/driver_util.h 2007-06-12 13:14:19.000000000 +0200 -+++ head/include/xen/driver_util.h 2011-01-31 17:49:31.000000000 +0100 +--- a/include/xen/driver_util.h ++++ b/include/xen/driver_util.h @@ -1,14 +1,8 @@ +#ifndef __XEN_DRIVER_UTIL_H__ +#define __XEN_DRIVER_UTIL_H__ @@ -4585,8 +4702,8 @@ Acked-by: jbeulich@novell.com -#endif /* __ASM_XEN_DRIVER_UTIL_H__ */ +#endif /* __XEN_DRIVER_UTIL_H__ */ ---- head.orig/include/xen/features.h 2007-10-09 22:31:38.000000000 +0200 -+++ head/include/xen/features.h 2011-01-31 17:49:31.000000000 +0100 +--- a/include/xen/features.h ++++ b/include/xen/features.h @@ -10,6 +10,7 @@ #define __XEN_FEATURES_H__ @@ -4601,8 +4718,8 @@ Acked-by: jbeulich@novell.com -#endif /* __ASM_XEN_FEATURES_H__ */ +#endif /* __XEN_FEATURES_H__ */ ---- head.orig/include/xen/interface/arch-x86/xen.h 2012-12-18 10:47:37.000000000 +0100 -+++ head/include/xen/interface/arch-x86/xen.h 2012-12-18 11:59:24.000000000 +0100 +--- a/include/xen/interface/arch-x86/xen.h ++++ b/include/xen/interface/arch-x86/xen.h @@ -59,6 +59,9 @@ #endif #define set_xen_guest_handle(hnd, val) set_xen_guest_handle_raw(hnd, val) @@ -4613,8 +4730,8 @@ Acked-by: jbeulich@novell.com #if defined(__i386__) #include "xen-x86_32.h" #elif defined(__x86_64__) ---- head.orig/include/xen/interface/event_channel.h 2013-01-08 09:32:21.000000000 +0100 -+++ head/include/xen/interface/event_channel.h 2012-04-04 10:14:18.000000000 +0200 +--- a/include/xen/interface/event_channel.h ++++ b/include/xen/interface/event_channel.h @@ -278,6 +278,7 @@ struct evtchn_op { struct evtchn_unmask unmask; } u; @@ -4623,8 +4740,8 @@ Acked-by: jbeulich@novell.com typedef struct evtchn_op evtchn_op_t; DEFINE_XEN_GUEST_HANDLE(evtchn_op_t); ---- head.orig/include/xen/interface/io/netif.h 2011-01-31 15:14:12.000000000 +0100 -+++ head/include/xen/interface/io/netif.h 2011-01-31 17:49:31.000000000 +0100 +--- a/include/xen/interface/io/netif.h ++++ b/include/xen/interface/io/netif.h @@ -187,8 +187,22 @@ typedef struct netif_rx_response netif_r * Generate netif ring structures and types. */ @@ -4648,8 +4765,8 @@ Acked-by: jbeulich@novell.com #define NETIF_RSP_DROPPED -2 #define NETIF_RSP_ERROR -1 ---- head.orig/include/xen/interface/memory.h 2013-01-08 09:36:50.000000000 +0100 -+++ head/include/xen/interface/memory.h 2013-01-08 11:44:16.000000000 +0100 +--- a/include/xen/interface/memory.h ++++ b/include/xen/interface/memory.h @@ -94,6 +94,7 @@ struct xen_memory_reservation { */ domid_t domid; @@ -4674,8 +4791,8 @@ Acked-by: jbeulich@novell.com typedef struct xen_add_to_physmap xen_add_to_physmap_t; DEFINE_XEN_GUEST_HANDLE(xen_add_to_physmap_t); ---- head.orig/include/xen/interface/sched.h 2012-12-18 10:47:37.000000000 +0100 -+++ head/include/xen/interface/sched.h 2012-12-18 12:00:51.000000000 +0100 +--- a/include/xen/interface/sched.h ++++ b/include/xen/interface/sched.h @@ -122,6 +122,7 @@ struct sched_shutdown { unsigned int reason; /* SHUTDOWN_* => enum sched_shutdown_reason */ @@ -4692,8 +4809,8 @@ Acked-by: jbeulich@novell.com typedef struct sched_poll sched_poll_t; DEFINE_XEN_GUEST_HANDLE(sched_poll_t); ---- head.orig/include/xen/interface/version.h 2012-12-18 10:47:37.000000000 +0100 -+++ head/include/xen/interface/version.h 2012-12-18 12:00:21.000000000 +0100 +--- a/include/xen/interface/version.h ++++ b/include/xen/interface/version.h @@ -38,6 +38,9 @@ /* arg == xen_extraversion_t. */ #define XENVER_extraversion 1 @@ -4721,8 +4838,8 @@ Acked-by: jbeulich@novell.com #define XEN_CHANGESET_INFO_LEN (sizeof(xen_changeset_info_t)) #define XENVER_platform_parameters 5 ---- head.orig/include/xen/interface/xen.h 2012-12-18 10:47:37.000000000 +0100 -+++ head/include/xen/interface/xen.h 2012-12-18 12:00:21.000000000 +0100 +--- a/include/xen/interface/xen.h ++++ b/include/xen/interface/xen.h @@ -32,7 +32,9 @@ #include #endif @@ -4785,8 +4902,8 @@ Acked-by: jbeulich@novell.com typedef struct multicall_entry multicall_entry_t; DEFINE_XEN_GUEST_HANDLE(multicall_entry_t); ---- head.orig/include/xen/xenbus.h 2011-12-21 10:42:02.000000000 +0100 -+++ head/include/xen/xenbus.h 2011-12-21 10:50:40.000000000 +0100 +--- a/include/xen/xenbus.h ++++ b/include/xen/xenbus.h @@ -58,16 +58,20 @@ struct xenbus_watch void (*callback)(struct xenbus_watch *, const char **vec, unsigned int len); diff --git a/patches.xen/xen3-patch-2.6.24 b/patches.xen/xen3-patch-2.6.24 index e0a8305..803559c 100644 --- a/patches.xen/xen3-patch-2.6.24 +++ b/patches.xen/xen3-patch-2.6.24 @@ -7,8 +7,177 @@ Acked-by: jbeulich@novell.com 2.6.33/kernel/sysctl_check.c (would need to be reverted there) ---- head.orig/arch/x86/Kconfig 2013-03-21 14:14:30.000000000 +0100 -+++ head/arch/x86/Kconfig 2013-03-21 14:20:50.000000000 +0100 +--- + arch/x86/Kconfig | 23 - + arch/x86/Makefile | 6 + arch/x86/ia32/ia32entry-xen.S | 19 - + arch/x86/include/asm/acpi.h | 8 + arch/x86/include/asm/mmu.h | 3 + arch/x86/include/mach-xen/asm/agp.h | 30 + + arch/x86/include/mach-xen/asm/cmpxchg_32.h | 2 + arch/x86/include/mach-xen/asm/cmpxchg_64.h | 2 + arch/x86/include/mach-xen/asm/desc.h | 5 + arch/x86/include/mach-xen/asm/desc_64.h | 34 ++ + arch/x86/include/mach-xen/asm/dma-mapping.h | 5 + arch/x86/include/mach-xen/asm/fixmap.h | 5 + arch/x86/include/mach-xen/asm/hypercall.h | 424 +++++++++++++++++++++++++++ + arch/x86/include/mach-xen/asm/hypercall_32.h | 399 ------------------------- + arch/x86/include/mach-xen/asm/hypercall_64.h | 401 ------------------------- + arch/x86/include/mach-xen/asm/hypervisor.h | 4 + arch/x86/include/mach-xen/asm/io.h | 5 + arch/x86/include/mach-xen/asm/irqflags.h | 5 + arch/x86/include/mach-xen/asm/irqflags_32.h | 30 + + arch/x86/include/mach-xen/asm/irqflags_64.h | 30 + + arch/x86/include/mach-xen/asm/maddr.h | 5 + arch/x86/include/mach-xen/asm/mmu_context.h | 5 + arch/x86/include/mach-xen/asm/pci.h | 100 ++++++ + arch/x86/include/mach-xen/asm/pgalloc.h | 5 + arch/x86/include/mach-xen/asm/pgalloc_64.h | 26 - + arch/x86/include/mach-xen/asm/pgtable.h | 5 + arch/x86/include/mach-xen/asm/pgtable_32.h | 7 + arch/x86/include/mach-xen/asm/pgtable_64.h | 3 + arch/x86/include/mach-xen/asm/processor.h | 5 + arch/x86/include/mach-xen/asm/processor_32.h | 53 ++- + arch/x86/include/mach-xen/asm/processor_64.h | 53 ++- + arch/x86/include/mach-xen/asm/smp.h | 5 + arch/x86/include/mach-xen/asm/smp_32.h | 15 + arch/x86/include/mach-xen/asm/smp_64.h | 20 - + arch/x86/include/mach-xen/asm/swiotlb.h | 5 + arch/x86/include/mach-xen/asm/tlbflush.h | 5 + arch/x86/include/mach-xen/asm/tlbflush_32.h | 7 + arch/x86/include/mach-xen/asm/tlbflush_64.h | 9 + arch/x86/include/mach-xen/asm/xor.h | 21 + + arch/x86/kernel/Makefile | 2 + arch/x86/kernel/acpi/processor_extcntl_xen.c | 4 + arch/x86/kernel/apic/io_apic-xen.c | 114 ++++++- + arch/x86/kernel/cpu/Makefile | 2 + arch/x86/kernel/cpu/common-xen.c | 4 + arch/x86/kernel/cpu/intel.c | 4 + arch/x86/kernel/cpu/intel_cacheinfo.c | 9 + arch/x86/kernel/cpu/mcheck/mce_dom0.c | 8 + arch/x86/kernel/e820-xen.c | 41 ++ + arch/x86/kernel/early_printk-xen.c | 17 - + arch/x86/kernel/entry_32-xen.S | 8 + arch/x86/kernel/entry_64-xen.S | 16 - + arch/x86/kernel/fixup.c | 2 + arch/x86/kernel/head64-xen.c | 24 - + arch/x86/kernel/ioport-xen.c | 2 + arch/x86/kernel/ldt-xen.c | 26 - + arch/x86/kernel/mpparse-xen.c | 8 + arch/x86/kernel/pci-dma-xen.c | 42 +- + arch/x86/kernel/process_32-xen.c | 71 +++- + arch/x86/kernel/process_64-xen.c | 20 + + arch/x86/kernel/quirks.c | 4 + arch/x86/kernel/setup_32-xen.c | 139 +++++--- + arch/x86/kernel/setup_64-xen.c | 225 +++++++++----- + arch/x86/kernel/smp_32-xen.c | 9 + arch/x86/kernel/smp_64-xen.c | 125 ++++--- + arch/x86/kernel/time-xen.c | 33 +- + arch/x86/kernel/traps_32-xen.c | 105 ++---- + arch/x86/kernel/traps_64-xen.c | 49 +-- + arch/x86/kernel/vsyscall_64-xen.c | 34 +- + arch/x86/mm/fault_32-xen.c | 72 ++-- + arch/x86/mm/fault_64-xen.c | 71 +--- + arch/x86/mm/hypervisor.c | 55 +++ + arch/x86/mm/init_32-xen.c | 47 +- + arch/x86/mm/init_64-xen.c | 61 ++- + arch/x86/mm/pageattr_64-xen.c | 104 +++--- + arch/x86/mm/pgtable_32-xen.c | 5 + arch/x86/pci/pcifront.c | 2 + drivers/acpi/processor_core.c | 10 + drivers/acpi/processor_extcntl.c | 2 + drivers/acpi/processor_idle.c | 8 + drivers/char/tpm/tpm_xen.c | 4 + drivers/cpuidle/Kconfig | 1 + drivers/dma/Kconfig | 2 + drivers/dma/ioat/Makefile | 3 + drivers/dma/ioat/dca.c | 12 + drivers/dma/ioat/dma.h | 18 + + drivers/dma/ioat/pci.c | 7 + drivers/firmware/dell_rbu.c | 5 + drivers/hwmon/coretemp-xen.c | 17 - + drivers/oprofile/cpu_buffer.c | 33 ++ + drivers/pci/msi-xen.c | 16 - + drivers/xen/balloon/balloon.c | 10 + drivers/xen/blkback/blkback-pagemap.c | 8 + drivers/xen/blkback/blkback.c | 7 + drivers/xen/blkback/vbd.c | 10 + drivers/xen/blkback/xenbus.c | 18 - + drivers/xen/blkfront/blkfront.c | 34 -- + drivers/xen/blkfront/block.h | 2 + drivers/xen/blkfront/vbd.c | 22 - + drivers/xen/blktap/blktap.c | 4 + drivers/xen/blktap/common.h | 3 + drivers/xen/blktap/xenbus.c | 11 + drivers/xen/blktap2/control.c | 1 + drivers/xen/blktap2/device.c | 13 + drivers/xen/console/console.c | 12 + drivers/xen/console/xencons_ring.c | 2 + drivers/xen/core/cpu_hotplug.c | 14 + drivers/xen/core/evtchn.c | 11 + drivers/xen/core/firmware.c | 1 + drivers/xen/core/gnttab.c | 6 + drivers/xen/core/machine_kexec.c | 18 + + drivers/xen/core/machine_reboot.c | 3 + drivers/xen/core/reboot.c | 21 - + drivers/xen/core/smpboot.c | 69 ---- + drivers/xen/fbfront/xenfb.c | 4 + drivers/xen/fbfront/xenkbd.c | 4 + drivers/xen/gntdev/gntdev.c | 51 +-- + drivers/xen/netback/common.h | 5 + drivers/xen/netback/interface.c | 10 + drivers/xen/netback/netback.c | 36 +- + drivers/xen/netback/xenbus.c | 21 - + drivers/xen/netfront/accel.c | 12 + drivers/xen/netfront/netfront.c | 70 ++-- + drivers/xen/netfront/netfront.h | 2 + drivers/xen/pcifront/Makefile | 4 + drivers/xen/scsiback/emulate.c | 39 +- + drivers/xen/scsiback/interface.c | 4 + drivers/xen/scsiback/scsiback.c | 72 +--- + drivers/xen/scsiback/translate.c | 6 + drivers/xen/scsiback/xenbus.c | 18 - + drivers/xen/scsifront/scsifront.c | 30 + + drivers/xen/sfc_netback/accel_fwd.c | 16 - + drivers/xen/sfc_netback/accel_msg.c | 4 + drivers/xen/sfc_netfront/accel_msg.c | 23 - + drivers/xen/sfc_netfront/accel_vi.c | 11 + drivers/xen/sfc_netutil/accel_msg_iface.c | 2 + drivers/xen/sfc_netutil/accel_util.h | 3 + drivers/xen/tpmback/interface.c | 2 + drivers/xen/tpmback/tpmback.c | 5 + drivers/xen/usbback/usbback.c | 54 ++- + drivers/xen/usbback/usbstub.c | 4 + drivers/xen/usbback/xenbus.c | 10 + drivers/xen/usbfront/usbfront-dbg.c | 4 + drivers/xen/usbfront/usbfront-hcd.c | 5 + drivers/xen/usbfront/usbfront-q.c | 5 + drivers/xen/usbfront/usbfront.h | 1 + drivers/xen/usbfront/xenbus.c | 2 + drivers/xen/util.c | 2 + drivers/xen/xen-pciback/slot.c | 6 + drivers/xen/xenbus/xenbus_comms.c | 10 + drivers/xen/xenbus/xenbus_probe.c | 84 ++--- + drivers/xen/xenbus/xenbus_probe_backend.c | 37 -- + drivers/xen/xenbus/xenbus_xs.c | 22 - + drivers/xen/xenoprof/xenoprofile.c | 8 + include/linux/kexec.h | 7 + include/linux/oprofile.h | 2 + include/uapi/linux/sysctl.h | 1 + include/xen/cpu_hotplug.h | 4 + include/xen/gnttab.h | 8 + include/xen/hvm.h | 3 + include/xen/net-util.h | 2 + include/xen/pcifront.h | 20 - + include/xen/sysctl.h | 11 + include/xen/xenbus.h | 2 + kernel/kexec.c | 19 + + kernel/sysctl_binary.c | 11 + lib/swiotlb-xen.c | 29 + + 166 files changed, 2488 insertions(+), 2135 deletions(-) + +--- a/arch/x86/Kconfig ++++ b/arch/x86/Kconfig @@ -101,10 +101,10 @@ config X86 select HAVE_ARCH_SECCOMP_FILTER select BUILDTIME_EXTABLE_SORT @@ -81,7 +250,7 @@ Acked-by: jbeulich@novell.com ---help--- Linux can emulate a math coprocessor (used for floating point operations) if you don't have one. 486DX and Pentium processors have -@@ -1891,6 +1893,7 @@ endmenu +@@ -1892,6 +1894,7 @@ endmenu config ARCH_ENABLE_MEMORY_HOTPLUG def_bool y depends on X86_64 || (X86_32 && HIGHMEM) @@ -89,7 +258,7 @@ Acked-by: jbeulich@novell.com config ARCH_ENABLE_MEMORY_HOTREMOVE def_bool y -@@ -2082,7 +2085,7 @@ choice +@@ -2083,7 +2086,7 @@ choice config PCI_GOBIOS bool "BIOS" @@ -98,7 +267,7 @@ Acked-by: jbeulich@novell.com config PCI_GOMMCONFIG bool "MMConfig" -@@ -2151,7 +2154,7 @@ config PCI_CNB20LE_QUIRK +@@ -2152,7 +2155,7 @@ config PCI_CNB20LE_QUIRK config XEN_PCIDEV_FRONTEND bool "Xen PCI Frontend" if X86_64 @@ -107,8 +276,8 @@ Acked-by: jbeulich@novell.com select HOTPLUG default y help ---- head.orig/arch/x86/Makefile 2013-03-21 12:24:35.000000000 +0100 -+++ head/arch/x86/Makefile 2013-03-21 14:20:53.000000000 +0100 +--- a/arch/x86/Makefile ++++ b/arch/x86/Makefile @@ -196,8 +196,8 @@ BOOT_TARGETS = bzlilo bzdisk fdimage fdi PHONY += bzImage vmlinuz $(BOOT_TARGETS) @@ -129,9 +298,9 @@ Acked-by: jbeulich@novell.com else # Default kernel to build all: bzImage ---- head.orig/arch/x86/ia32/ia32entry-xen.S 2011-01-31 17:49:31.000000000 +0100 -+++ head/arch/x86/ia32/ia32entry-xen.S 2011-01-31 17:56:27.000000000 +0100 -@@ -125,20 +125,16 @@ sysenter_do_call: +--- a/arch/x86/ia32/ia32entry-xen.S ++++ b/arch/x86/ia32/ia32entry-xen.S +@@ -125,20 +125,16 @@ sysenter_do_call: jmp int_ret_from_sys_call sysenter_tracesys: @@ -155,7 +324,7 @@ Acked-by: jbeulich@novell.com jmp sysenter_do_call CFI_ENDPROC ENDPROC(ia32_sysenter_target) -@@ -200,20 +196,17 @@ cstar_do_call: +@@ -200,20 +196,17 @@ cstar_do_call: jmp int_ret_from_sys_call cstar_tracesys: @@ -179,9250 +348,9250 @@ Acked-by: jbeulich@novell.com jmp cstar_do_call END(ia32_cstar_target) ---- head.orig/arch/x86/kernel/Makefile 2013-03-21 14:14:28.000000000 +0100 -+++ head/arch/x86/kernel/Makefile 2013-03-21 14:20:59.000000000 +0100 -@@ -124,4 +124,4 @@ endif - disabled-obj-$(CONFIG_XEN) := early-quirks.o hpet.o i8237.o i8253.o i8259_$(BITS).o \ - reboot.o smpboot_$(BITS).o tsc_$(BITS).o tsc_sync.o - disabled-obj-$(CONFIG_XEN_UNPRIVILEGED_GUEST) += mpparse_64.o --%/head_64.o %/head_64.s: $(if $(CONFIG_XEN),EXTRA_AFLAGS,dummy) := -+%/head_64.o %/head_64.s: asflags-$(CONFIG_XEN) := ---- head.orig/arch/x86/kernel/acpi/processor_extcntl_xen.c 2010-03-22 12:00:53.000000000 +0100 -+++ head/arch/x86/kernel/acpi/processor_extcntl_xen.c 2011-01-31 17:56:27.000000000 +0100 -@@ -68,7 +68,7 @@ static int xen_cx_notifier(struct acpi_p - - /* Get dependency relationships */ - if (cx->csd_count) { -- printk("Wow! _CSD is found. Not support for now!\n"); -+ pr_warning("_CSD found: Not supported for now!\n"); - kfree(buf); - return -EINVAL; - } else { -@@ -81,7 +81,7 @@ static int xen_cx_notifier(struct acpi_p - } +--- a/arch/x86/include/asm/acpi.h ++++ b/arch/x86/include/asm/acpi.h +@@ -31,7 +31,7 @@ + #include + #include - if (!count) { -- printk("No available Cx info for cpu %d\n", pr->acpi_id); -+ pr_info("No available Cx info for cpu %d\n", pr->acpi_id); - kfree(buf); - return -EINVAL; - } ---- head.orig/arch/x86/kernel/cpu/Makefile 2012-12-11 04:30:57.000000000 +0100 -+++ head/arch/x86/kernel/cpu/Makefile 2012-08-20 10:38:35.000000000 +0200 -@@ -42,6 +42,8 @@ obj-$(CONFIG_MTRR) += mtrr/ +-#ifdef CONFIG_XEN ++#ifdef CONFIG_XEN_PRIVILEGED_GUEST + #include + #endif - obj-$(CONFIG_X86_LOCAL_APIC) += perfctr-watchdog.o perf_event_amd_ibs.o +@@ -120,7 +120,7 @@ extern int acpi_suspend_lowlevel(void); + /* Physical address to resume after wakeup */ + #define acpi_wakeup_address ((unsigned long)(real_mode_header->wakeup_start)) -+disabled-obj-$(CONFIG_XEN) := perfctr-watchdog.o -+ - quiet_cmd_mkcapflags = MKCAP $@ - cmd_mkcapflags = $(PERL) $(srctree)/$(src)/mkcapflags.pl $< $@ +-#ifdef CONFIG_XEN ++#ifdef CONFIG_XEN_PRIVILEGED_GUEST + static inline int acpi_notify_hypervisor_state(u8 sleep_state, + u32 pm1a_cnt_val, + u32 pm1b_cnt_val) +@@ -139,13 +139,14 @@ static inline int acpi_notify_hypervisor ---- head.orig/arch/x86/kernel/cpu/common-xen.c 2012-07-05 10:49:35.000000000 +0200 -+++ head/arch/x86/kernel/cpu/common-xen.c 2012-07-05 10:50:04.000000000 +0200 -@@ -221,7 +221,7 @@ static void __cpuinit get_cpu_vendor(str + return HYPERVISOR_platform_op(&op); + } +-#endif /* CONFIG_XEN */ ++#endif - static int __init x86_fxsr_setup(char * s) + /* + * Check if the CPU can handle C2 and deeper + */ + static inline unsigned int acpi_processor_cstate_check(unsigned int max_cstate) { -- /* Tell all the other CPU's to not use it... */ -+ /* Tell all the other CPUs to not use it... */ - disable_x86_fxsr = 1; - ++#ifndef CONFIG_PROCESSOR_EXTERNAL_CONTROL /* -@@ -419,7 +419,9 @@ static void __cpuinit identify_cpu(struc - c->x86_model = c->x86_mask = 0; /* So far unknown... */ - c->x86_vendor_id[0] = '\0'; /* Unset */ - c->x86_model_id[0] = '\0'; /* Unset */ -+#ifndef CONFIG_XEN - c->x86_max_cores = 1; + * Early models (<=5) of AMD Opterons are not supposed to go into + * C2 state. +@@ -160,6 +161,7 @@ static inline unsigned int acpi_processo + else if (amd_e400_c1e_detected) + return 1; + else +#endif - c->x86_clflush_size = 32; - memset(&c->x86_capability, 0, sizeof c->x86_capability); + return max_cstate; + } ---- head.orig/arch/x86/kernel/cpu/intel.c 2013-03-21 11:14:40.000000000 +0100 -+++ head/arch/x86/kernel/cpu/intel.c 2013-03-21 14:21:04.000000000 +0100 -@@ -301,6 +301,7 @@ static void __cpuinit srat_detect_node(s +--- a/arch/x86/include/asm/mmu.h ++++ b/arch/x86/include/asm/mmu.h +@@ -16,6 +16,9 @@ typedef struct { + /* True if mm supports a task running in 32 bit compatibility mode. */ + unsigned short ia32_compat; #endif - } ++#ifdef CONFIG_XEN ++ bool has_foreign_mappings:1; ++#endif -+#ifndef CONFIG_XEN - /* - * find out the number of processor cores on the die + struct mutex lock; + void *vdso; +--- a/arch/x86/include/mach-xen/asm/agp.h ++++ b/arch/x86/include/mach-xen/asm/agp.h +@@ -1,20 +1,22 @@ +-#ifndef AGP_H +-#define AGP_H 1 ++#ifndef _ASM_X86_AGP_H ++#define _ASM_X86_AGP_H + + #include + #include + #include + +-/* +- * Functions to keep the agpgart mappings coherent with the MMU. +- * The GART gives the CPU a physical alias of pages in memory. The alias region is +- * mapped uncacheable. Make sure there are no conflicting mappings +- * with different cachability attributes for the same page. This avoids +- * data corruption on some CPUs. ++/* ++ * Functions to keep the agpgart mappings coherent with the MMU. The ++ * GART gives the CPU a physical alias of pages in memory. The alias ++ * region is mapped uncacheable. Make sure there are no conflicting ++ * mappings with different cachability attributes for the same ++ * page. This avoids data corruption on some CPUs. */ -@@ -318,6 +319,7 @@ static int __cpuinit intel_num_cpu_cores - else - return 1; - } -+#endif - static void __cpuinit detect_vmx_virtcap(struct cpuinfo_x86 *c) +-/* Caller's responsibility to call global_flush_tlb() for +- * performance reasons */ ++/* ++ * Caller's responsibility to call global_flush_tlb() for performance ++ * reasons ++ */ + #define map_page_into_agp(page) ( \ + xen_create_contiguous_region((unsigned long)page_address(page), 0, 32) \ + ?: change_page_attr(page, 1, PAGE_KERNEL_NOCACHE)) +@@ -24,9 +26,11 @@ + change_page_attr(page, 1, PAGE_KERNEL)) + #define flush_agp_mappings() global_flush_tlb() + +-/* Could use CLFLUSH here if the cpu supports it. But then it would +- need to be called for each cacheline of the whole page so it may not be +- worth it. Would need a page for it. */ ++/* ++ * Could use CLFLUSH here if the cpu supports it. But then it would ++ * need to be called for each cacheline of the whole page so it may ++ * not be worth it. Would need a page for it. ++ */ + #define flush_agp_cache() wbinvd() + + /* Convert a physical address to an address suitable for the GART. */ +--- a/arch/x86/include/mach-xen/asm/cmpxchg_32.h ++++ b/arch/x86/include/mach-xen/asm/cmpxchg_32.h +@@ -1,8 +1,6 @@ + #ifndef _ASM_X86_XEN_CMPXCHG_32_H + #define _ASM_X86_XEN_CMPXCHG_32_H + +-#include_next +- + static inline u64 get_64bit(const volatile u64 *ptr) { -@@ -439,6 +441,7 @@ static void __cpuinit init_intel(struct - set_cpu_cap(c, X86_FEATURE_P3); - #endif + u64 res; +--- a/arch/x86/include/mach-xen/asm/cmpxchg_64.h ++++ b/arch/x86/include/mach-xen/asm/cmpxchg_64.h +@@ -1,8 +1,6 @@ + #ifndef _ASM_X86_XEN_CMPXCHG_64_H + #define _ASM_X86_XEN_CMPXCHG_64_H -+#ifndef CONFIG_XEN - if (!cpu_has(c, X86_FEATURE_XTOPOLOGY)) { - /* - * let's use the legacy cpuid vector 0x1 and 0x4 for topology -@@ -449,6 +452,7 @@ static void __cpuinit init_intel(struct - detect_ht(c); - #endif - } +-#include_next +- + static inline u64 get_64bit(const volatile u64 *ptr) + { + return *ptr; +--- /dev/null ++++ b/arch/x86/include/mach-xen/asm/desc.h +@@ -0,0 +1,5 @@ ++#ifdef CONFIG_X86_32 ++# include "desc_32.h" ++#else ++# include "desc_64.h" +#endif +--- a/arch/x86/include/mach-xen/asm/desc_64.h ++++ b/arch/x86/include/mach-xen/asm/desc_64.h +@@ -34,6 +34,18 @@ static inline void clear_LDT(void) + put_cpu(); + } - /* Work around errata */ - srat_detect_node(c); ---- head.orig/arch/x86/kernel/cpu/intel_cacheinfo.c 2013-02-20 11:27:30.000000000 +0100 -+++ head/arch/x86/kernel/cpu/intel_cacheinfo.c 2013-02-20 11:28:55.000000000 +0100 -@@ -279,8 +279,9 @@ amd_cpuid4(int leaf, union _cpuid4_leaf_ - eax->split.type = types[leaf]; - eax->split.level = levels[leaf]; - eax->split.num_threads_sharing = 0; -+#ifndef CONFIG_XEN - eax->split.num_cores_on_die = __this_cpu_read(cpu_info.x86_max_cores) - 1; -- ++#ifndef CONFIG_X86_NO_TSS ++static inline unsigned long __store_tr(void) ++{ ++ unsigned long tr; ++ ++ asm volatile ("str %w0":"=r" (tr)); ++ return tr; ++} ++ ++#define store_tr(tr) (tr) = __store_tr() +#endif ++ + /* + * This is the ldt that every process will get unless we need + * something other than this. +@@ -47,6 +59,18 @@ extern struct desc_ptr cpu_gdt_descr[]; + /* the cpu gdt accessor */ + #define cpu_gdt(_cpu) ((struct desc_struct *)cpu_gdt_descr[_cpu].address) - if (assoc == 0xffff) - eax->split.is_fully_associative = 1; -@@ -599,8 +600,8 @@ unsigned int __cpuinit init_intel_cachei - unsigned int trace = 0, l1i = 0, l1d = 0, l2 = 0, l3 = 0; - unsigned int new_l1d = 0, new_l1i = 0; /* Cache sizes from cpuid(4) */ - unsigned int new_l2 = 0, new_l3 = 0, i; /* Cache sizes from cpuid(4) */ -- unsigned int l2_id = 0, l3_id = 0, num_threads_sharing, index_msb; - #ifdef CONFIG_X86_HT -+ unsigned int l2_id = 0, l3_id = 0, num_threads_sharing, index_msb; - unsigned int cpu = c->cpu_index; ++#ifndef CONFIG_XEN ++static inline void load_gdt(const struct desc_ptr *ptr) ++{ ++ asm volatile("lgdt %w0"::"m" (*ptr)); ++} ++ ++static inline void store_gdt(struct desc_ptr *ptr) ++{ ++ asm("sgdt %w0":"=m" (*ptr)); ++} ++#endif ++ + static inline void _set_gate(void *adr, unsigned type, unsigned long func, unsigned dpl, unsigned ist) + { + struct gate_struct s; +@@ -87,6 +111,16 @@ static inline void set_system_gate_ist(i + { + _set_gate(&idt_table[nr], GATE_INTERRUPT, (unsigned long) func, 3, ist); + } ++ ++static inline void load_idt(const struct desc_ptr *ptr) ++{ ++ asm volatile("lidt %w0"::"m" (*ptr)); ++} ++ ++static inline void store_idt(struct desc_ptr *dtr) ++{ ++ asm("sidt %w0":"=m" (*dtr)); ++} #endif -@@ -634,16 +635,20 @@ unsigned int __cpuinit init_intel_cachei - break; - case 2: - new_l2 = this_leaf.size/1024; -+#ifdef CONFIG_X86_HT - num_threads_sharing = 1 + this_leaf.eax.split.num_threads_sharing; - index_msb = get_count_order(num_threads_sharing); - l2_id = c->apicid & ~((1 << index_msb) - 1); + static inline void set_tssldt_descriptor(void *ptr, unsigned long tss, unsigned type, +--- /dev/null ++++ b/arch/x86/include/mach-xen/asm/dma-mapping.h +@@ -0,0 +1,5 @@ ++#ifdef CONFIG_X86_32 ++# include "dma-mapping_32.h" ++#else ++# include "dma-mapping_64.h" +#endif - break; - case 3: - new_l3 = this_leaf.size/1024; -+#ifdef CONFIG_X86_HT - num_threads_sharing = 1 + this_leaf.eax.split.num_threads_sharing; - index_msb = get_count_order( - num_threads_sharing); - l3_id = c->apicid & ~((1 << index_msb) - 1); +--- /dev/null ++++ b/arch/x86/include/mach-xen/asm/fixmap.h +@@ -0,0 +1,5 @@ ++#ifdef CONFIG_X86_32 ++# include "fixmap_32.h" ++#else ++# include "fixmap_64.h" +#endif - break; - default: - break; ---- head.orig/arch/x86/kernel/cpu/mcheck/mce_dom0.c 2011-08-15 10:44:20.000000000 +0200 -+++ head/arch/x86/kernel/cpu/mcheck/mce_dom0.c 2011-08-15 10:44:51.000000000 +0200 -@@ -17,7 +17,7 @@ static int convert_log(struct mc_info *m - x86_mcinfo_lookup(mic, mi, MC_TYPE_GLOBAL); - if (mic == NULL) - { -- printk(KERN_ERR "DOM0_MCE_LOG: global data is NULL\n"); -+ pr_err("DOM0_MCE_LOG: global data is NULL\n"); - return -1; - } - -@@ -74,7 +74,7 @@ urgent: - { - result = convert_log(g_mi); - if (result) { -- printk(KERN_ERR "MCE_DOM0_LOG: Log conversion failed\n"); -+ pr_err("MCE_DOM0_LOG: Log conversion failed\n"); - goto end; - } - /* After fetching the telem from DOM0, we need to dec the telem's -@@ -99,7 +99,7 @@ nonurgent: - { - result = convert_log(g_mi); - if (result) { -- printk(KERN_ERR "MCE_DOM0_LOG: Log conversion failed\n"); -+ pr_err("MCE_DOM0_LOG: Log conversion failed\n"); - goto end; - } - /* After fetching the telem from DOM0, we need to dec the telem's -@@ -124,7 +124,7 @@ void bind_virq_for_mce(void) - - g_mi = kmalloc(sizeof(struct mc_info), GFP_KERNEL); - if (ret < 0) -- printk(KERN_ERR "MCE_DOM0_LOG: bind_virq for DOM0 failed\n"); -+ pr_err("MCE_DOM0_LOG: bind_virq for DOM0 failed\n"); - - /* Log the machine checks left over from the previous reset. */ - mce_dom0_interrupt(VIRQ_MCA, NULL); ---- head.orig/arch/x86/kernel/e820-xen.c 2011-01-31 17:49:31.000000000 +0100 -+++ head/arch/x86/kernel/e820-xen.c 2011-01-31 17:56:27.000000000 +0100 -@@ -24,7 +24,7 @@ - #include - #include - #include --#include -+#include - #include - #include - -@@ -53,7 +53,7 @@ unsigned long end_pfn_map; - */ - static unsigned long __initdata end_user_pfn = MAXMEM>>PAGE_SHIFT; - --extern struct resource code_resource, data_resource; -+extern struct resource code_resource, data_resource, bss_resource; - - /* Check for some hardcoded bad areas that early boot is not allowed to touch */ - static inline int bad_addr(unsigned long *addrp, unsigned long size) -@@ -75,10 +75,15 @@ static inline int bad_addr(unsigned long - - /* initrd */ - #ifdef CONFIG_BLK_DEV_INITRD -- if (LOADER_TYPE && INITRD_START && last >= INITRD_START && -- addr < INITRD_START+INITRD_SIZE) { -- *addrp = PAGE_ALIGN(INITRD_START + INITRD_SIZE); -- return 1; -+ if (boot_params.hdr.type_of_loader && boot_params.hdr.ramdisk_image) { -+ unsigned long ramdisk_image = boot_params.hdr.ramdisk_image; -+ unsigned long ramdisk_size = boot_params.hdr.ramdisk_size; -+ unsigned long ramdisk_end = ramdisk_image+ramdisk_size; +--- /dev/null ++++ b/arch/x86/include/mach-xen/asm/hypercall.h +@@ -0,0 +1,424 @@ ++/****************************************************************************** ++ * hypercall.h ++ * ++ * Linux-specific hypervisor handling. ++ * ++ * Copyright (c) 2002-2004, K A Fraser ++ * ++ * 64-bit updates: ++ * Benjamin Liu ++ * Jun Nakajima ++ * ++ * This program is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU General Public License version 2 ++ * as published by the Free Software Foundation; or, when distributed ++ * separately from the Linux kernel or incorporated into other ++ * software packages, subject to the following license: ++ * ++ * Permission is hereby granted, free of charge, to any person obtaining a copy ++ * of this source file (the "Software"), to deal in the Software without ++ * restriction, including without limitation the rights to use, copy, modify, ++ * merge, publish, distribute, sublicense, and/or sell copies of the Software, ++ * and to permit persons to whom the Software is furnished to do so, subject to ++ * the following conditions: ++ * ++ * The above copyright notice and this permission notice shall be included in ++ * all copies or substantial portions of the Software. ++ * ++ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR ++ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, ++ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE ++ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER ++ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING ++ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS ++ * IN THE SOFTWARE. ++ */ + -+ if (last >= ramdisk_image && addr < ramdisk_end) { -+ *addrp = PAGE_ALIGN(ramdisk_end); -+ return 1; -+ } - } - #endif - /* kernel code */ -@@ -251,6 +256,7 @@ void __init e820_reserve_resources(struc - #ifndef CONFIG_XEN - request_resource(res, &code_resource); - request_resource(res, &data_resource); -+ request_resource(res, &bss_resource); - #endif - #ifdef CONFIG_KEXEC - if (crashk_res.start != crashk_res.end) -@@ -661,8 +667,8 @@ void __init setup_memory_region(void) - * Otherwise fake a memory map; one section from 0k->640k, - * the next section from 1mb->appropriate_mem_k - */ -- sanitize_e820_map(E820_MAP, &E820_MAP_NR); -- if (copy_e820_map(E820_MAP, E820_MAP_NR) < 0) -+ sanitize_e820_map(boot_params.e820_map, &boot_params.e820_entries); -+ if (copy_e820_map(boot_params.e820_map, boot_params.e820_entries) < 0) - early_panic("Cannot find a valid memory map"); - printk(KERN_INFO "BIOS-provided physical RAM map:\n"); - e820_print_map("BIOS-e820"); -@@ -847,3 +853,22 @@ __init void e820_setup_gap(struct e820en - printk(KERN_INFO "Allocating PCI resources starting at %lx (gap: %lx:%lx)\n", - pci_mem_start, gapstart, gapsize); - } ++#ifndef __HYPERCALL_H__ ++#define __HYPERCALL_H__ + -+int __init arch_get_ram_range(int slot, u64 *addr, u64 *size) -+{ -+ int i; ++#ifndef __HYPERVISOR_H__ ++# error "please don't include this file directly" ++#endif + -+ if (slot < 0 || slot >= e820.nr_map) -+ return -1; -+ for (i = slot; i < e820.nr_map; i++) { -+ if (e820.map[i].type != E820_RAM) -+ continue; -+ break; -+ } -+ if (i == e820.nr_map || e820.map[i].addr > (max_pfn << PAGE_SHIFT)) -+ return -1; -+ *addr = e820.map[i].addr; -+ *size = min_t(u64, e820.map[i].size + e820.map[i].addr, -+ max_pfn << PAGE_SHIFT) - *addr; -+ return i + 1; -+} ---- head.orig/arch/x86/kernel/early_printk-xen.c 2011-01-31 17:49:31.000000000 +0100 -+++ head/arch/x86/kernel/early_printk-xen.c 2011-01-31 17:56:27.000000000 +0100 -@@ -6,15 +6,10 @@ - #include - #include - #include -- --/* Simple VGA output */ -- --#ifdef __i386__ - #include --#else --#include --#endif ++#ifdef CONFIG_XEN_PRIVILEGED_GUEST ++# include ++# include ++#endif + - #ifndef CONFIG_XEN -+/* Simple VGA output */ - #define VGABASE (__ISA_IO_base + 0xb8000) - - static int max_ypos = 25, max_xpos = 80; -@@ -264,10 +259,10 @@ static int __init setup_early_printk(cha - early_console = &early_serial_console; - } else if (!strncmp(buf, "vga", 3)) { - #ifndef CONFIG_XEN -- && SCREEN_INFO.orig_video_isVGA == 1) { -- max_xpos = SCREEN_INFO.orig_video_cols; -- max_ypos = SCREEN_INFO.orig_video_lines; -- current_ypos = SCREEN_INFO.orig_y; -+ && boot_params.screen_info.orig_video_isVGA == 1) { -+ max_xpos = boot_params.screen_info.orig_video_cols; -+ max_ypos = boot_params.screen_info.orig_video_lines; -+ current_ypos = boot_params.screen_info.orig_y; - #endif - early_console = &early_vga_console; - } else if (!strncmp(buf, "simnow", 6)) { ---- head.orig/arch/x86/kernel/entry_32-xen.S 2013-01-30 10:36:16.000000000 +0100 -+++ head/arch/x86/kernel/entry_32-xen.S 2013-01-30 10:36:44.000000000 +0100 -@@ -254,6 +254,7 @@ check_userspace: - jb resume_kernel # not returning to v8086 or userspace - - ENTRY(resume_userspace) -+ LOCKDEP_SYS_EXIT - DISABLE_INTERRUPTS(CLBR_ANY) # make sure we don't miss an interrupt - # setting need_resched or sigpending - # between sampling and the iret -@@ -341,6 +342,7 @@ sysenter_past_esp: - jae syscall_badsys - call *sys_call_table(,%eax,4) - movl %eax,PT_EAX(%esp) -+ LOCKDEP_SYS_EXIT - DISABLE_INTERRUPTS(CLBR_ANY) - TRACE_IRQS_OFF - movl TI_flags(%ebp), %ecx -@@ -406,6 +408,7 @@ syscall_call: - call *sys_call_table(,%eax,4) - movl %eax,PT_EAX(%esp) # store the return value - syscall_exit: -+ LOCKDEP_SYS_EXIT - DISABLE_INTERRUPTS(CLBR_ANY) # make sure we don't miss an interrupt - # setting need_resched or sigpending - # between sampling and the iret -@@ -478,7 +481,7 @@ ldt_ss: - * is still available to implement the setting of the high - * 16-bits in the INTERRUPT_RETURN paravirt-op. - */ -- cmpl $0, paravirt_ops+PARAVIRT_enabled -+ cmpl $0, pv_info+PARAVIRT_enabled - jne restore_nocheck - #endif - -@@ -540,6 +543,7 @@ work_pending: - jz work_notifysig - work_resched: - call schedule -+ LOCKDEP_SYS_EXIT - DISABLE_INTERRUPTS(CLBR_ANY) # make sure we don't miss an interrupt - # setting need_resched or sigpending - # between sampling and the iret -@@ -1268,6 +1272,6 @@ ENTRY(kernel_thread_helper) - ENDPROC(kernel_thread_helper) - - .section .rodata,"a" --#include "syscall_table.S" -+#include "syscall_table_32.S" - - syscall_table_size=(.-sys_call_table) ---- head.orig/arch/x86/kernel/entry_64-xen.S 2011-10-07 11:21:43.000000000 +0200 -+++ head/arch/x86/kernel/entry_64-xen.S 2011-10-07 11:28:06.000000000 +0200 -@@ -57,7 +57,7 @@ - #include - #include - --#include "xen_entry.S" -+#include "xen_entry_64.S" - - .code64 - -@@ -277,6 +277,7 @@ ret_from_sys_call: - movl $_TIF_ALLWORK_MASK,%edi - /* edi: flagmask */ - sysret_check: -+ LOCKDEP_SYS_EXIT - GET_THREAD_INFO(%rcx) - XEN_BLOCK_EVENTS(%rsi) - TRACE_IRQS_OFF -@@ -368,6 +369,7 @@ int_ret_from_sys_call: - movl $_TIF_ALLWORK_MASK,%edi - /* edi: mask to check */ - int_with_check: -+ LOCKDEP_SYS_EXIT_IRQ - GET_THREAD_INFO(%rcx) - movl threadinfo_flags(%rcx),%edx - andl %edi,%edx -@@ -519,11 +521,12 @@ END(stub_rt_sigreturn) - - retint_check: - CFI_DEFAULT_STACK adj=1 -+ LOCKDEP_SYS_EXIT_IRQ - movl threadinfo_flags(%rcx),%edx - andl %edi,%edx - CFI_REMEMBER_STATE - jnz retint_careful --retint_restore_args: -+retint_restore_args: /* return to kernel space */ - movl EFLAGS-REST_SKIP(%rsp), %eax - shr $9, %eax # EAX[0] == IRET_EFLAGS.IF - XEN_GET_VCPU_INFO(%rsi) -@@ -844,7 +847,7 @@ error_call_handler: - movq ORIG_RAX(%rsp),%rsi # get error code - movq $-1,ORIG_RAX(%rsp) - call *%rax --error_exit: -+error_exit: - RESTORE_REST - /* cli */ - XEN_BLOCK_EVENTS(%rsi) -@@ -852,14 +855,11 @@ error_exit: - GET_THREAD_INFO(%rcx) - testb $3,CS-ARGOFFSET(%rsp) - jz retint_kernel -+ LOCKDEP_SYS_EXIT_IRQ - movl threadinfo_flags(%rcx),%edx - movl $_TIF_WORK_MASK,%edi - andl %edi,%edx - jnz retint_careful -- /* -- * The iret might restore flags: -- */ -- TRACE_IRQS_IRETQ - jmp retint_restore_args - - #if 0 -@@ -1074,7 +1074,7 @@ child_rip: - movq %rsi, %rdi - call *%rax - # exit -- xorl %edi, %edi -+ mov %eax, %edi - call do_exit - CFI_ENDPROC - ENDPROC(child_rip) ---- head.orig/arch/x86/kernel/fixup.c 2008-01-28 12:24:18.000000000 +0100 -+++ head/arch/x86/kernel/fixup.c 2011-01-31 17:56:27.000000000 +0100 -@@ -34,7 +34,7 @@ - #include - #include - --#define DP(_f, _args...) printk(KERN_ALERT " " _f "\n" , ## _args ) -+#define DP(_f, _args...) pr_alert(" " _f "\n" , ## _args ) - - fastcall void do_fixup_4gb_segment(struct pt_regs *regs, long error_code) - { ---- head.orig/arch/x86/kernel/head64-xen.c 2011-08-09 10:41:42.000000000 +0200 -+++ head/arch/x86/kernel/head64-xen.c 2011-08-09 10:44:02.000000000 +0200 -@@ -1,5 +1,5 @@ - /* -- * linux/arch/x86_64/kernel/head64.c -- prepare to run common code -+ * prepare to run common code - * - * Copyright (C) 2000 Andrea Arcangeli SuSE - * -@@ -21,7 +21,6 @@ - #include - #include - #include --#include - #include - #include - #include -@@ -47,27 +46,16 @@ static void __init clear_bss(void) - } - #endif - --#define NEW_CL_POINTER 0x228 /* Relative to real mode data */ --#define OLD_CL_MAGIC_ADDR 0x20 --#define OLD_CL_MAGIC 0xA33F --#define OLD_CL_OFFSET 0x22 -- - static void __init copy_bootdata(char *real_mode_data) - { - #ifndef CONFIG_XEN -- unsigned long new_data; - char * command_line; - -- memcpy(x86_boot_params, real_mode_data, BOOT_PARAM_SIZE); -- new_data = *(u32 *) (x86_boot_params + NEW_CL_POINTER); -- if (!new_data) { -- if (OLD_CL_MAGIC != *(u16 *)(real_mode_data + OLD_CL_MAGIC_ADDR)) { -- return; -- } -- new_data = __pa(real_mode_data) + *(u16 *)(real_mode_data + OLD_CL_OFFSET); -+ memcpy(&boot_params, real_mode_data, sizeof boot_params); -+ if (boot_params.hdr.cmd_line_ptr) { -+ command_line = __va(boot_params.hdr.cmd_line_ptr); -+ memcpy(boot_command_line, command_line, COMMAND_LINE_SIZE); - } -- command_line = __va(new_data); -- memcpy(boot_command_line, command_line, COMMAND_LINE_SIZE); - #else - int max_cmdline; - -@@ -114,7 +102,7 @@ void __init x86_64_start_kernel(char * r - - for (i = 0; i < IDT_ENTRIES; i++) - set_intr_gate(i, early_idt_handler); -- asm volatile("lidt %0" :: "m" (idt_descr)); -+ load_idt((const struct desc_ptr *)&idt_descr); - #endif - - early_printk("Kernel alive\n"); ---- head.orig/arch/x86/kernel/apic/io_apic-xen.c 2011-01-31 17:49:31.000000000 +0100 -+++ head/arch/x86/kernel/apic/io_apic-xen.c 2011-01-31 17:56:27.000000000 +0100 -@@ -31,6 +31,7 @@ - #include - #include - #include -+#include - #ifdef CONFIG_ACPI - #include - #endif -@@ -584,7 +585,7 @@ int IO_APIC_get_PCI_irq_vector(int bus, - #define default_PCI_trigger(idx) (1) - #define default_PCI_polarity(idx) (1) - --static int __init MPBIOS_polarity(int idx) -+static int MPBIOS_polarity(int idx) - { - int bus = mp_irqs[idx].mpc_srcbus; - int polarity; -@@ -871,6 +872,10 @@ static void __init setup_IO_APIC_irqs(vo - apic_printk(APIC_VERBOSE, ", %d-%d", mp_ioapics[apic].mpc_apicid, pin); - continue; - } -+ if (!first_notcon) { -+ apic_printk(APIC_VERBOSE, " not connected.\n"); -+ first_notcon = 1; -+ } - - irq = pin_2_irq(idx, apic, pin); - add_pin_to_irq(irq, apic, pin); -@@ -881,7 +886,7 @@ static void __init setup_IO_APIC_irqs(vo - } - - if (!first_notcon) -- apic_printk(APIC_VERBOSE," not connected.\n"); -+ apic_printk(APIC_VERBOSE, " not connected.\n"); - } - - #ifndef CONFIG_XEN -@@ -1277,10 +1282,13 @@ void disable_IO_APIC(void) - static int __init timer_irq_works(void) - { - unsigned long t1 = jiffies; -+ unsigned long flags; - -+ local_save_flags(flags); - local_irq_enable(); - /* Let ten ticks pass... */ - mdelay((10 * 1000) / HZ); -+ local_irq_restore(flags); - - /* - * Expect a few ticks at least, to be sure some possible -@@ -1655,6 +1663,9 @@ static inline void check_timer(void) - { - struct irq_cfg *cfg = irq_cfg + 0; - int apic1, pin1, apic2, pin2; -+ unsigned long flags; ++#ifdef CONFIG_XEN ++#define HYPERCALL_ASM_OPERAND "%c" ++#define HYPERCALL_LOCATION(op) (hypercall_page + (op) * 32) ++#define HYPERCALL_C_OPERAND(name) "i" (HYPERCALL_LOCATION(__HYPERVISOR_##name)) ++#else ++#define HYPERCALL_ASM_OPERAND "*%" ++#define HYPERCALL_LOCATION(op) (hypercall_stubs + (op) * 32) ++#define HYPERCALL_C_OPERAND(name) "g" (HYPERCALL_LOCATION(__HYPERVISOR_##name)) ++#endif + -+ local_irq_save(flags); - - /* - * get/set the timer IRQ vector: -@@ -1696,7 +1707,7 @@ static inline void check_timer(void) - } - if (disable_timer_pin_1 > 0) - clear_IO_APIC_pin(0, pin1); -- return; -+ goto out; - } - clear_IO_APIC_pin(apic1, pin1); - apic_printk(APIC_QUIET,KERN_ERR "..MP-BIOS bug: 8254 timer not " -@@ -1718,7 +1729,7 @@ static inline void check_timer(void) - if (nmi_watchdog == NMI_IO_APIC) { - setup_nmi(); - } -- return; -+ goto out; - } - /* - * Cleanup, just in case ... -@@ -1741,7 +1752,7 @@ static inline void check_timer(void) - - if (timer_irq_works()) { - apic_printk(APIC_VERBOSE," works.\n"); -- return; -+ goto out; - } - apic_write(APIC_LVT0, APIC_LVT_MASKED | APIC_DM_FIXED | cfg->vector); - apic_printk(APIC_VERBOSE," failed.\n"); -@@ -1756,10 +1767,12 @@ static inline void check_timer(void) - - if (timer_irq_works()) { - apic_printk(APIC_VERBOSE," works.\n"); -- return; -+ goto out; - } - apic_printk(APIC_VERBOSE," failed :(.\n"); - panic("IO-APIC + timer doesn't work! Try using the 'noapic' kernel parameter\n"); -+out: -+ local_irq_restore(flags); - } - #else - #define check_timer() ((void)0) -@@ -1775,7 +1788,7 @@ __setup("no_timer_check", notimercheck); - - /* - * -- * IRQ's that are handled by the PIC in the MPS IOAPIC case. -+ * IRQs that are handled by the PIC in the MPS IOAPIC case. - * - IRQ2 is the cascade IRQ, and cannot be a io-apic IRQ. - * Linux doesn't really care, as it's not actually used - * for any interrupt handling anyway. -@@ -1858,7 +1871,7 @@ static struct sysdev_class ioapic_sysdev - static int __init ioapic_init_sysfs(void) - { - struct sys_device * dev; -- int i, size, error = 0; -+ int i, size, error; - - error = sysdev_class_register(&ioapic_sysdev_class); - if (error) -@@ -1867,12 +1880,11 @@ static int __init ioapic_init_sysfs(void - for (i = 0; i < nr_ioapics; i++ ) { - size = sizeof(struct sys_device) + nr_ioapic_registers[i] - * sizeof(struct IO_APIC_route_entry); -- mp_ioapic_data[i] = kmalloc(size, GFP_KERNEL); -+ mp_ioapic_data[i] = kzalloc(size, GFP_KERNEL); - if (!mp_ioapic_data[i]) { - printk(KERN_ERR "Can't suspend/resume IOAPIC %d\n", i); - continue; - } -- memset(mp_ioapic_data[i], 0, size); - dev = &mp_ioapic_data[i]->dev; - dev->id = i; - dev->cls = &ioapic_sysdev_class; -@@ -1933,7 +1945,7 @@ void destroy_irq(unsigned int irq) - #endif /* CONFIG_XEN */ - - /* -- * MSI mesage composition -+ * MSI message composition - */ - #if defined(CONFIG_PCI_MSI) && !defined(CONFIG_XEN) - static int msi_compose_msg(struct pci_dev *pdev, unsigned int irq, struct msi_msg *msg) -@@ -2043,8 +2055,64 @@ void arch_teardown_msi_irq(unsigned int - destroy_irq(irq); - } - --#endif /* CONFIG_PCI_MSI */ -+#ifdef CONFIG_DMAR -+#ifdef CONFIG_SMP -+static void dmar_msi_set_affinity(unsigned int irq, cpumask_t mask) -+{ -+ struct irq_cfg *cfg = irq_cfg + irq; -+ struct msi_msg msg; -+ unsigned int dest; -+ cpumask_t tmp; ++#define HYPERCALL_ARG(arg, n) \ ++ register typeof((arg)+0) __arg##n asm(HYPERCALL_arg##n) = (arg) + -+ cpus_and(tmp, mask, cpu_online_map); -+ if (cpus_empty(tmp)) -+ return; ++#define _hypercall0(type, name) \ ++({ \ ++ type __res; \ ++ asm volatile ( \ ++ "call " HYPERCALL_ASM_OPERAND "1" \ ++ : "=a" (__res) \ ++ : HYPERCALL_C_OPERAND(name) \ ++ : "memory" ); \ ++ __res; \ ++}) + -+ if (assign_irq_vector(irq, mask)) -+ return; ++#define _hypercall1(type, name, arg) \ ++({ \ ++ type __res; \ ++ HYPERCALL_ARG(arg, 1); \ ++ asm volatile ( \ ++ "call " HYPERCALL_ASM_OPERAND "2" \ ++ : "=a" (__res), "+r" (__arg1) \ ++ : HYPERCALL_C_OPERAND(name) \ ++ : "memory" ); \ ++ __res; \ ++}) + -+ cpus_and(tmp, cfg->domain, mask); -+ dest = cpu_mask_to_apicid(tmp); ++#define _hypercall2(type, name, a1, a2) \ ++({ \ ++ type __res; \ ++ HYPERCALL_ARG(a1, 1); \ ++ HYPERCALL_ARG(a2, 2); \ ++ asm volatile ( \ ++ "call " HYPERCALL_ASM_OPERAND "3" \ ++ : "=a" (__res), "+r" (__arg1), "+r" (__arg2) \ ++ : HYPERCALL_C_OPERAND(name) \ ++ : "memory" ); \ ++ __res; \ ++}) + -+ dmar_msi_read(irq, &msg); ++#define _hypercall3(type, name, a1, a2, a3) \ ++({ \ ++ type __res; \ ++ HYPERCALL_ARG(a1, 1); \ ++ HYPERCALL_ARG(a2, 2); \ ++ HYPERCALL_ARG(a3, 3); \ ++ asm volatile ( \ ++ "call " HYPERCALL_ASM_OPERAND "4" \ ++ : "=a" (__res), "+r" (__arg1), \ ++ "+r" (__arg2), "+r" (__arg3) \ ++ : HYPERCALL_C_OPERAND(name) \ ++ : "memory" ); \ ++ __res; \ ++}) + -+ msg.data &= ~MSI_DATA_VECTOR_MASK; -+ msg.data |= MSI_DATA_VECTOR(cfg->vector); -+ msg.address_lo &= ~MSI_ADDR_DEST_ID_MASK; -+ msg.address_lo |= MSI_ADDR_DEST_ID(dest); ++#define _hypercall4(type, name, a1, a2, a3, a4) \ ++({ \ ++ type __res; \ ++ HYPERCALL_ARG(a1, 1); \ ++ HYPERCALL_ARG(a2, 2); \ ++ HYPERCALL_ARG(a3, 3); \ ++ HYPERCALL_ARG(a4, 4); \ ++ asm volatile ( \ ++ "call " HYPERCALL_ASM_OPERAND "5" \ ++ : "=a" (__res), "+r" (__arg1), "+r" (__arg2), \ ++ "+r" (__arg3), "+r" (__arg4) \ ++ : HYPERCALL_C_OPERAND(name) \ ++ : "memory" ); \ ++ __res; \ ++}) + -+ dmar_msi_write(irq, &msg); -+ irq_desc[irq].affinity = mask; -+} -+#endif /* CONFIG_SMP */ ++#define _hypercall5(type, name, a1, a2, a3, a4, a5) \ ++({ \ ++ type __res; \ ++ HYPERCALL_ARG(a1, 1); \ ++ HYPERCALL_ARG(a2, 2); \ ++ HYPERCALL_ARG(a3, 3); \ ++ HYPERCALL_ARG(a4, 4); \ ++ HYPERCALL_ARG(a5, 5); \ ++ asm volatile ( \ ++ "call " HYPERCALL_ASM_OPERAND "6" \ ++ : "=a" (__res), "+r" (__arg1), "+r" (__arg2), \ ++ "+r" (__arg3), "+r" (__arg4), "+r" (__arg5) \ ++ : HYPERCALL_C_OPERAND(name) \ ++ : "memory" ); \ ++ __res; \ ++}) + -+struct irq_chip dmar_msi_type = { -+ .name = "DMAR_MSI", -+ .unmask = dmar_msi_unmask, -+ .mask = dmar_msi_mask, -+ .ack = ack_apic_edge, -+#ifdef CONFIG_SMP -+ .set_affinity = dmar_msi_set_affinity, ++#define _hypercall(type, op, a1, a2, a3, a4, a5) \ ++({ \ ++ type __res; \ ++ HYPERCALL_ARG(a1, 1); \ ++ HYPERCALL_ARG(a2, 2); \ ++ HYPERCALL_ARG(a3, 3); \ ++ HYPERCALL_ARG(a4, 4); \ ++ HYPERCALL_ARG(a5, 5); \ ++ asm volatile ( \ ++ "call *%6" \ ++ : "=a" (__res), "+r" (__arg1), "+r" (__arg2), \ ++ "+r" (__arg3), "+r" (__arg4), "+r" (__arg5) \ ++ : "g" (HYPERCALL_LOCATION(op)) \ ++ : "memory" ); \ ++ __res; \ ++}) ++ ++#ifdef CONFIG_X86_32 ++# include "hypercall_32.h" ++#else ++# include "hypercall_64.h" +#endif -+ .retrigger = ioapic_retrigger_irq, -+}; + -+int arch_setup_dmar_msi(unsigned int irq) ++static inline int __must_check ++HYPERVISOR_set_trap_table( ++ const trap_info_t *table) +{ -+ int ret; -+ struct msi_msg msg; ++ return _hypercall1(int, set_trap_table, table); ++} + -+ ret = msi_compose_msg(NULL, irq, &msg); -+ if (ret < 0) -+ return ret; -+ dmar_msi_write(irq, &msg); -+ set_irq_chip_and_handler_name(irq, &dmar_msi_type, handle_edge_irq, -+ "edge"); -+ return 0; ++static inline int __must_check ++HYPERVISOR_mmu_update( ++ mmu_update_t *req, unsigned int count, unsigned int *success_count, ++ domid_t domid) ++{ ++ if (arch_use_lazy_mmu_mode()) ++ return xen_multi_mmu_update(req, count, success_count, domid); ++ return _hypercall4(int, mmu_update, req, count, success_count, domid); +} -+#endif - -+#endif /* CONFIG_PCI_MSI */ - /* - * Hypertransport interrupt support - */ -@@ -2177,8 +2245,27 @@ int io_apic_set_pci_routing (int ioapic, - return 0; - } - --#endif /* CONFIG_ACPI */ - -+int acpi_get_override_irq(int bus_irq, int *trigger, int *polarity) ++ ++static inline int __must_check ++HYPERVISOR_mmuext_op( ++ struct mmuext_op *op, unsigned int count, unsigned int *success_count, ++ domid_t domid) +{ -+ int i; ++ if (arch_use_lazy_mmu_mode()) ++ return xen_multi_mmuext_op(op, count, success_count, domid); ++ return _hypercall4(int, mmuext_op, op, count, success_count, domid); ++} + -+ if (skip_ioapic_setup) -+ return -1; ++static inline int __must_check ++HYPERVISOR_set_gdt( ++ unsigned long *frame_list, unsigned int entries) ++{ ++ return _hypercall2(int, set_gdt, frame_list, entries); ++} + -+ for (i = 0; i < mp_irq_entries; i++) -+ if (mp_irqs[i].mpc_irqtype == mp_INT && -+ mp_irqs[i].mpc_srcbusirq == bus_irq) -+ break; -+ if (i >= mp_irq_entries) -+ return -1; ++static inline int __must_check ++HYPERVISOR_stack_switch( ++ unsigned long ss, unsigned long esp) ++{ ++ return _hypercall2(int, stack_switch, ss, esp); ++} + -+ *trigger = irq_trigger(i); -+ *polarity = irq_polarity(i); -+ return 0; ++static inline int ++HYPERVISOR_fpu_taskswitch( ++ int set) ++{ ++ return _hypercall1(int, fpu_taskswitch, set); +} + -+#endif /* CONFIG_ACPI */ - - #ifndef CONFIG_XEN - /* -@@ -2217,3 +2304,4 @@ void __init setup_ioapic_dest(void) - } - #endif - #endif /* !CONFIG_XEN */ ++#if CONFIG_XEN_COMPAT <= 0x030002 ++static inline int __must_check ++HYPERVISOR_sched_op_compat( ++ int cmd, unsigned long arg) ++{ ++ return _hypercall2(int, sched_op_compat, cmd, arg); ++} ++#endif + ---- head.orig/arch/x86/kernel/ioport-xen.c 2011-01-31 17:32:29.000000000 +0100 -+++ head/arch/x86/kernel/ioport-xen.c 2011-01-31 17:56:27.000000000 +0100 -@@ -1,6 +1,4 @@ - /* -- * linux/arch/x86_64/kernel/ioport.c -- * - * This contains the io-permission bitmap code - written by obz, with changes - * by Linus. - */ ---- head.orig/arch/x86/kernel/ldt-xen.c 2011-01-31 17:49:31.000000000 +0100 -+++ head/arch/x86/kernel/ldt-xen.c 2011-01-31 17:56:27.000000000 +0100 -@@ -1,6 +1,4 @@ - /* -- * linux/arch/x86_64/kernel/ldt.c -- * - * Copyright (C) 1992 Krishna Balasubramanian and Linus Torvalds - * Copyright (C) 1999 Ingo Molnar - * Copyright (C) 2002 Andi Kleen -@@ -112,19 +110,14 @@ int init_new_context(struct task_struct - int retval = 0; - - memset(&mm->context, 0, sizeof(mm->context)); -- init_MUTEX(&mm->context.sem); -+ mutex_init(&mm->context.lock); - old_mm = current->mm; - if (old_mm) - mm->context.vdso = old_mm->context.vdso; - if (old_mm && old_mm->context.size > 0) { -- down(&old_mm->context.sem); -+ mutex_lock(&old_mm->context.lock); - retval = copy_ldt(&mm->context, &old_mm->context); -- up(&old_mm->context.sem); -- } -- if (retval == 0) { -- spin_lock(&mm_unpinned_lock); -- list_add(&mm->context.unpinned, &mm_unpinned); -- spin_unlock(&mm_unpinned_lock); -+ mutex_unlock(&old_mm->context.lock); - } - return retval; - } -@@ -148,11 +141,6 @@ void destroy_context(struct mm_struct *m - kfree(mm->context.ldt); - mm->context.size = 0; - } -- if (!PagePinned(virt_to_page(mm->pgd))) { -- spin_lock(&mm_unpinned_lock); -- list_del(&mm->context.unpinned); -- spin_unlock(&mm_unpinned_lock); -- } - } - - static int read_ldt(void __user * ptr, unsigned long bytecount) -@@ -166,7 +154,7 @@ static int read_ldt(void __user * ptr, u - if (bytecount > LDT_ENTRY_SIZE*LDT_ENTRIES) - bytecount = LDT_ENTRY_SIZE*LDT_ENTRIES; - -- down(&mm->context.sem); -+ mutex_lock(&mm->context.lock); - size = mm->context.size*LDT_ENTRY_SIZE; - if (size > bytecount) - size = bytecount; -@@ -174,7 +162,7 @@ static int read_ldt(void __user * ptr, u - err = 0; - if (copy_to_user(ptr, mm->context.ldt, size)) - err = -EFAULT; -- up(&mm->context.sem); -+ mutex_unlock(&mm->context.lock); - if (err < 0) - goto error_return; - if (size != bytecount) { -@@ -227,7 +215,7 @@ static int write_ldt(void __user * ptr, - goto out; - } - -- down(&mm->context.sem); -+ mutex_lock(&mm->context.lock); - if (ldt_info.entry_number >= (unsigned)mm->context.size) { - error = alloc_ldt(¤t->mm->context, ldt_info.entry_number+1, 1); - if (error < 0) -@@ -256,7 +244,7 @@ install: - error = HYPERVISOR_update_descriptor(mach_lp, (unsigned long)((entry_1 | (unsigned long) entry_2 << 32))); - - out_unlock: -- up(&mm->context.sem); -+ mutex_unlock(&mm->context.lock); - out: - return error; - } ---- head.orig/arch/x86/kernel/mpparse-xen.c 2011-01-31 17:32:29.000000000 +0100 -+++ head/arch/x86/kernel/mpparse-xen.c 2011-01-31 17:56:27.000000000 +0100 -@@ -65,8 +65,10 @@ unsigned long mp_lapic_addr; - - unsigned int def_to_bigsmp = 0; - -+#ifndef CONFIG_XEN - /* Processor that is doing the boot up */ - unsigned int boot_cpu_physical_apicid = -1U; -+#endif - /* Internal processor count */ - unsigned int __cpuinitdata num_processors; - -@@ -842,6 +844,7 @@ void __init mp_register_lapic_address(u6 - void __cpuinit mp_register_lapic (u8 id, u8 enabled) - { - struct mpc_config_processor processor; -+#ifndef CONFIG_XEN - int boot_cpu = 0; - - if (MAX_APICS - id <= 0) { -@@ -853,7 +856,6 @@ void __cpuinit mp_register_lapic (u8 id, - if (id == boot_cpu_physical_apicid) - boot_cpu = 1; - --#ifndef CONFIG_XEN - processor.mpc_type = MP_PROCESSOR; - processor.mpc_apicid = id; - processor.mpc_apicver = GET_APIC_VERSION(apic_read(APIC_LVR)); -@@ -921,11 +923,11 @@ void __init mp_register_ioapic(u8 id, u3 - - #ifndef CONFIG_XEN - set_fixmap_nocache(FIX_IO_APIC_BASE_0 + idx, address); --#endif - if ((boot_cpu_data.x86_vendor == X86_VENDOR_INTEL) - && !APIC_XAPIC(apic_version[boot_cpu_physical_apicid])) - tmpid = io_apic_get_unique_id(idx, id); - else -+#endif - tmpid = id; - if (tmpid == -1) { - nr_ioapics--; -@@ -1023,7 +1025,7 @@ void __init mp_config_acpi_legacy_irqs ( - - /* - * Use the default configuration for the IRQs 0-15. Unless -- * overriden by (MADT) interrupt source override entries. -+ * overridden by (MADT) interrupt source override entries. - */ - for (i = 0; i < 16; i++) { - int idx; ---- head.orig/arch/x86/kernel/pci-dma-xen.c 2011-01-31 17:49:31.000000000 +0100 -+++ head/arch/x86/kernel/pci-dma-xen.c 2012-11-14 12:41:31.000000000 +0100 -@@ -13,14 +13,13 @@ - #include - #include - #include --#include - #include - #include - #include - #include - #include --#include --#include -+#include -+#include - #include - - #ifdef __x86_64__ -@@ -106,27 +105,29 @@ int range_straddles_page_boundary(paddr_ - } - - int --dma_map_sg(struct device *hwdev, struct scatterlist *sg, int nents, -+dma_map_sg(struct device *hwdev, struct scatterlist *sgl, int nents, - enum dma_data_direction direction) - { - int i, rc; - - BUG_ON(!valid_dma_direction(direction)); -- WARN_ON(nents == 0 || sg[0].length == 0); -+ WARN_ON(nents == 0 || sgl->length == 0); - - if (swiotlb) { -- rc = swiotlb_map_sg(hwdev, sg, nents, direction); -+ rc = swiotlb_map_sg(hwdev, sgl, nents, direction); - } else { -- for (i = 0; i < nents; i++ ) { -- BUG_ON(!sg[i].page); -- sg[i].dma_address = -- gnttab_dma_map_page(sg[i].page, sg[i].offset); -- sg[i].dma_length = sg[i].length; -+ struct scatterlist *sg; -+ -+ for_each_sg(sgl, sg, nents, i) { -+ BUG_ON(!sg_page(sg)); -+ sg->dma_address = -+ gnttab_dma_map_page(sg_page(sg), sg->offset); -+ sg->dma_length = sg->length; - IOMMU_BUG_ON(address_needs_mapping( -- hwdev, sg[i].dma_address)); -+ hwdev, sg->dma_address)); - IOMMU_BUG_ON(range_straddles_page_boundary( -- page_to_pseudophys(sg[i].page) + sg[i].offset, -- sg[i].length)); -+ page_to_pseudophys(sg_page(sg)) + sg->offset, -+ sg->length)); - } - rc = nents; - } -@@ -137,17 +138,19 @@ dma_map_sg(struct device *hwdev, struct - EXPORT_SYMBOL(dma_map_sg); - - void --dma_unmap_sg(struct device *hwdev, struct scatterlist *sg, int nents, -+dma_unmap_sg(struct device *hwdev, struct scatterlist *sgl, int nents, - enum dma_data_direction direction) - { - int i; - - BUG_ON(!valid_dma_direction(direction)); - if (swiotlb) -- swiotlb_unmap_sg(hwdev, sg, nents, direction); -+ swiotlb_unmap_sg(hwdev, sgl, nents, direction); - else { -- for (i = 0; i < nents; i++ ) -- gnttab_dma_unmap_page(sg[i].dma_address); -+ struct scatterlist *sg; ++static inline int __must_check ++HYPERVISOR_sched_op( ++ int cmd, void *arg) ++{ ++ return _hypercall2(int, sched_op, cmd, arg); ++} + -+ for_each_sg(sgl, sg, nents, i) -+ gnttab_dma_unmap_page(sg->dma_address); - } - } - EXPORT_SYMBOL(dma_unmap_sg); -@@ -258,7 +261,8 @@ void dma_free_coherent(struct device *de - { - struct dma_coherent_mem *mem = dev ? dev->dma_mem : NULL; - int order = get_order(size); -- ++#ifdef CONFIG_XEN_PRIVILEGED_GUEST ++static inline int __must_check ++HYPERVISOR_platform_op( ++ struct xen_platform_op *platform_op) ++{ ++ platform_op->interface_version = XENPF_INTERFACE_VERSION; ++ return _hypercall1(int, platform_op, platform_op); ++} + -+ WARN_ON(irqs_disabled()); /* for portability */ - if (mem && vaddr >= mem->virt_base && vaddr < (mem->virt_base + (mem->size << PAGE_SHIFT))) { - int page = (vaddr - mem->virt_base) >> PAGE_SHIFT; - ---- head.orig/arch/x86/kernel/process_32-xen.c 2012-07-05 10:49:33.000000000 +0200 -+++ head/arch/x86/kernel/process_32-xen.c 2011-01-31 17:56:27.000000000 +0100 -@@ -1,6 +1,4 @@ - /* -- * linux/arch/i386/kernel/process.c -- * - * Copyright (C) 1995 Linus Torvalds - * - * Pentium III FXSR, SSE support -@@ -190,6 +188,10 @@ void cpu_idle(void) - } - } - -+static void do_nothing(void *unused) ++static inline int __must_check ++HYPERVISOR_mca( ++ struct xen_mc *mc_op) +{ ++ mc_op->interface_version = XEN_MCA_INTERFACE_VERSION; ++ return _hypercall1(int, mca, mc_op); +} ++#endif + - void cpu_idle_wait(void) - { - unsigned int cpu, this_cpu = get_cpu(); -@@ -214,13 +216,20 @@ void cpu_idle_wait(void) - cpu_clear(cpu, map); - } - cpus_and(map, map, cpu_online_map); -+ /* -+ * We waited 1 sec, if a CPU still did not call idle -+ * it may be because it is in idle and not waking up -+ * because it has nothing to do. -+ * Give all the remaining CPUS a kick. -+ */ -+ smp_call_function_mask(map, do_nothing, 0, 0); - } while (!cpus_empty(map)); - - set_cpus_allowed(current, tmp); - } - EXPORT_SYMBOL_GPL(cpu_idle_wait); - --void __devinit select_idle_routine(const struct cpuinfo_x86 *c) -+void __cpuinit select_idle_routine(const struct cpuinfo_x86 *c) - { - } - -@@ -238,34 +247,52 @@ static int __init idle_setup(char *str) - } - early_param("idle", idle_setup); - --void show_regs(struct pt_regs * regs) -+void __show_registers(struct pt_regs *regs, int all) - { - unsigned long cr0 = 0L, cr2 = 0L, cr3 = 0L, cr4 = 0L; - unsigned long d0, d1, d2, d3, d6, d7; -+ unsigned long esp; -+ unsigned short ss, gs; ++static inline int __must_check ++HYPERVISOR_set_debugreg( ++ unsigned int reg, unsigned long value) ++{ ++ return _hypercall2(int, set_debugreg, reg, value); ++} + -+ if (user_mode_vm(regs)) { -+ esp = regs->esp; -+ ss = regs->xss & 0xffff; -+ savesegment(gs, gs); -+ } else { -+ esp = (unsigned long) (®s->esp); -+ savesegment(ss, ss); -+ savesegment(gs, gs); -+ } - - printk("\n"); -- printk("Pid: %d, comm: %20s\n", current->pid, current->comm); -- printk("EIP: %04x:[<%08lx>] CPU: %d\n",0xffff & regs->xcs,regs->eip, smp_processor_id()); -+ printk("Pid: %d, comm: %s %s (%s %.*s)\n", -+ task_pid_nr(current), current->comm, -+ print_tainted(), init_utsname()->release, -+ (int)strcspn(init_utsname()->version, " "), -+ init_utsname()->version); ++static inline unsigned long __must_check ++HYPERVISOR_get_debugreg( ++ unsigned int reg) ++{ ++ return _hypercall1(unsigned long, get_debugreg, reg); ++} + -+ printk("EIP: %04x:[<%08lx>] EFLAGS: %08lx CPU: %d\n", -+ 0xffff & regs->xcs, regs->eip, regs->eflags, -+ smp_processor_id()); - print_symbol("EIP is at %s\n", regs->eip); - -- if (user_mode_vm(regs)) -- printk(" ESP: %04x:%08lx",0xffff & regs->xss,regs->esp); -- printk(" EFLAGS: %08lx %s (%s %.*s)\n", -- regs->eflags, print_tainted(), init_utsname()->release, -- (int)strcspn(init_utsname()->version, " "), -- init_utsname()->version); - printk("EAX: %08lx EBX: %08lx ECX: %08lx EDX: %08lx\n", -- regs->eax,regs->ebx,regs->ecx,regs->edx); -- printk("ESI: %08lx EDI: %08lx EBP: %08lx", -- regs->esi, regs->edi, regs->ebp); -- printk(" DS: %04x ES: %04x FS: %04x\n", -- 0xffff & regs->xds,0xffff & regs->xes, 0xffff & regs->xfs); -+ regs->eax, regs->ebx, regs->ecx, regs->edx); -+ printk("ESI: %08lx EDI: %08lx EBP: %08lx ESP: %08lx\n", -+ regs->esi, regs->edi, regs->ebp, esp); -+ printk(" DS: %04x ES: %04x FS: %04x GS: %04x SS: %04x\n", -+ regs->xds & 0xffff, regs->xes & 0xffff, -+ regs->xfs & 0xffff, gs, ss); ++static inline int __must_check ++HYPERVISOR_memory_op( ++ unsigned int cmd, void *arg) ++{ ++ if (arch_use_lazy_mmu_mode()) ++ xen_multicall_flush(false); ++ return _hypercall2(int, memory_op, cmd, arg); ++} + -+ if (!all) -+ return; - - cr0 = read_cr0(); - cr2 = read_cr2(); - cr3 = read_cr3(); - cr4 = read_cr4_safe(); -- printk("CR0: %08lx CR2: %08lx CR3: %08lx CR4: %08lx\n", cr0, cr2, cr3, cr4); -+ printk("CR0: %08lx CR2: %08lx CR3: %08lx CR4: %08lx\n", -+ cr0, cr2, cr3, cr4); - - get_debugreg(d0, 0); - get_debugreg(d1, 1); -@@ -273,10 +300,16 @@ void show_regs(struct pt_regs * regs) - get_debugreg(d3, 3); - printk("DR0: %08lx DR1: %08lx DR2: %08lx DR3: %08lx\n", - d0, d1, d2, d3); ++static inline int __must_check ++HYPERVISOR_multicall( ++ multicall_entry_t *call_list, unsigned int nr_calls) ++{ ++ return _hypercall2(int, multicall, call_list, nr_calls); ++} + - get_debugreg(d6, 6); - get_debugreg(d7, 7); -- printk("DR6: %08lx DR7: %08lx\n", d6, d7); -+ printk("DR6: %08lx DR7: %08lx\n", -+ d6, d7); ++static inline int __must_check ++HYPERVISOR_event_channel_op( ++ int cmd, void *arg) ++{ ++ int rc = _hypercall2(int, event_channel_op, cmd, arg); ++ ++#if CONFIG_XEN_COMPAT <= 0x030002 ++ if (unlikely(rc == -ENOSYS)) { ++ struct evtchn_op op; ++ op.cmd = cmd; ++ memcpy(&op.u, arg, sizeof(op.u)); ++ rc = _hypercall1(int, event_channel_op_compat, &op); ++ memcpy(arg, &op.u, sizeof(op.u)); ++ } ++#endif ++ ++ return rc; +} - -+void show_regs(struct pt_regs *regs) ++ ++static inline int __must_check ++HYPERVISOR_xen_version( ++ int cmd, void *arg) +{ -+ __show_registers(regs, 1); - show_trace(NULL, regs, ®s->esp); - } - ---- head.orig/arch/x86/kernel/process_64-xen.c 2011-02-02 08:31:50.000000000 +0100 -+++ head/arch/x86/kernel/process_64-xen.c 2011-02-02 08:32:00.000000000 +0100 -@@ -1,6 +1,4 @@ - /* -- * linux/arch/x86-64/kernel/process.c -- * - * Copyright (C) 1995 Linus Torvalds - * - * Pentium III FXSR, SSE support -@@ -41,6 +39,7 @@ - #include - #include - #include -+#include - - #include - #include -@@ -171,6 +170,9 @@ void cpu_idle (void) - - if (__get_cpu_var(cpu_idle_state)) - __get_cpu_var(cpu_idle_state) = 0; ++ return _hypercall2(int, xen_version, cmd, arg); ++} + -+ tick_nohz_stop_sched_tick(); ++static inline int __must_check ++HYPERVISOR_console_io( ++ int cmd, unsigned int count, char *str) ++{ ++ return _hypercall3(int, console_io, cmd, count, str); ++} + - rmb(); - idle = xen_idle; /* no alternatives */ - if (cpu_is_offline(smp_processor_id())) -@@ -189,12 +191,17 @@ void cpu_idle (void) - __exit_idle(); - } - -+ tick_nohz_restart_sched_tick(); - preempt_enable_no_resched(); - schedule(); - preempt_disable(); - } - } - -+static void do_nothing(void *unused) ++static inline int __must_check ++HYPERVISOR_physdev_op( ++ int cmd, void *arg) +{ ++ int rc = _hypercall2(int, physdev_op, cmd, arg); ++ ++#if CONFIG_XEN_COMPAT <= 0x030002 ++ if (unlikely(rc == -ENOSYS)) { ++ struct physdev_op op; ++ op.cmd = cmd; ++ memcpy(&op.u, arg, sizeof(op.u)); ++ rc = _hypercall1(int, physdev_op_compat, &op); ++ memcpy(arg, &op.u, sizeof(op.u)); ++ } ++#endif ++ ++ return rc; +} + - void cpu_idle_wait(void) - { - unsigned int cpu, this_cpu = get_cpu(); -@@ -220,6 +227,13 @@ void cpu_idle_wait(void) - cpu_clear(cpu, map); - } - cpus_and(map, map, cpu_online_map); -+ /* -+ * We waited 1 sec, if a CPU still did not call idle -+ * it may be because it is in idle and not waking up -+ * because it has nothing to do. -+ * Give all the remaining CPUS a kick. -+ */ -+ smp_call_function_mask(map, do_nothing, 0, 0); - } while (!cpus_empty(map)); - - set_cpus_allowed(current, tmp); -@@ -527,7 +541,7 @@ static inline void __switch_to_xtra(stru - * - * Kprobes not supported here. Set the probe on schedule instead. - */ --__kprobes struct task_struct * -+struct task_struct * - __switch_to(struct task_struct *prev_p, struct task_struct *next_p) - { - struct thread_struct *prev = &prev_p->thread, ---- head.orig/arch/x86/kernel/quirks.c 2013-01-14 13:48:49.000000000 +0100 -+++ head/arch/x86/kernel/quirks.c 2013-01-14 13:49:46.000000000 +0100 -@@ -4,8 +4,6 @@ - #include - #include - --#include -- - #if defined(CONFIG_X86_IO_APIC) && (defined(CONFIG_SMP) || defined(CONFIG_XEN)) && defined(CONFIG_PCI) - - static void quirk_intel_irqbalance(struct pci_dev *dev) -@@ -64,6 +62,8 @@ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_IN - #endif - - #if defined(CONFIG_HPET_TIMER) -+#include ++static inline int __must_check ++HYPERVISOR_grant_table_op( ++ unsigned int cmd, void *uop, unsigned int count) ++{ ++ if (arch_use_lazy_mmu_mode()) ++ xen_multicall_flush(false); ++ return _hypercall3(int, grant_table_op, cmd, uop, count); ++} + - unsigned long force_hpet_address; - - static enum { ---- head.orig/arch/x86/kernel/setup_32-xen.c 2012-06-06 13:52:42.000000000 +0200 -+++ head/arch/x86/kernel/setup_32-xen.c 2012-06-06 13:55:18.000000000 +0200 -@@ -1,6 +1,4 @@ - /* -- * linux/arch/i386/kernel/setup.c -- * - * Copyright (C) 1995 Linus Torvalds - * - * Support of BIGMEM added by Gerhard Wichert, Siemens AG, July 1999 -@@ -70,6 +68,7 @@ - #include - #include - #include -+#include - - #ifdef CONFIG_XEN - #include -@@ -80,13 +79,14 @@ static struct notifier_block xen_panic_b - xen_panic_event, NULL, 0 /* try to go last */ - }; - --int disable_pse __devinitdata = 0; -+int disable_pse __cpuinitdata = 0; - - /* - * Machine setup.. - */ - extern struct resource code_resource; - extern struct resource data_resource; -+extern struct resource bss_resource; - - /* cpu data as detected by the assembly code in head.S */ - struct cpuinfo_x86 new_cpu_data __cpuinitdata = { 0, 0, 0, 0, -1, 1, 0, 0, -1 }; -@@ -98,9 +98,6 @@ unsigned long mmu_cr4_features; - - /* for MCA, but anyone else can use it if they want */ - unsigned int machine_id; --#ifdef CONFIG_MCA --EXPORT_SYMBOL(machine_id); --#endif - unsigned int machine_submodel_id; - unsigned int BIOS_revision; - unsigned int mca_pentium_flag; -@@ -121,7 +118,7 @@ EXPORT_SYMBOL(apm_info); - struct edid_info edid_info; - EXPORT_SYMBOL_GPL(edid_info); - #ifndef CONFIG_XEN --#define copy_edid() (edid_info = EDID_INFO) -+#define copy_edid() (edid_info = boot_params.edid_info) - #endif - struct ist_info ist_info; - #if defined(CONFIG_X86_SPEEDSTEP_SMI) || \ -@@ -170,10 +167,11 @@ EXPORT_SYMBOL(edd); - */ - static inline void copy_edd(void) - { -- memcpy(edd.mbr_signature, EDD_MBR_SIGNATURE, sizeof(edd.mbr_signature)); -- memcpy(edd.edd_info, EDD_BUF, sizeof(edd.edd_info)); -- edd.mbr_signature_nr = EDD_MBR_SIG_NR; -- edd.edd_info_nr = EDD_NR; -+ memcpy(edd.mbr_signature, boot_params.edd_mbr_sig_buffer, -+ sizeof(edd.mbr_signature)); -+ memcpy(edd.edd_info, boot_params.eddbuf, sizeof(edd.edd_info)); -+ edd.mbr_signature_nr = boot_params.edd_mbr_sig_buf_entries; -+ edd.edd_info_nr = boot_params.eddbuf_entries; - } - #endif - #else -@@ -418,6 +416,53 @@ extern unsigned long __init setup_memory - extern void zone_sizes_init(void); - #endif /* !CONFIG_NEED_MULTIPLE_NODES */ - -+static inline unsigned long long get_total_mem(void) ++static inline int __must_check ++HYPERVISOR_vm_assist( ++ unsigned int cmd, unsigned int type) +{ -+ unsigned long long total; ++ return _hypercall2(int, vm_assist, cmd, type); ++} + -+ total = max_low_pfn - min_low_pfn; -+#ifdef CONFIG_HIGHMEM -+ total += highend_pfn - highstart_pfn; ++static inline int __must_check ++HYPERVISOR_vcpu_op( ++ int cmd, unsigned int vcpuid, void *extra_args) ++{ ++ return _hypercall3(int, vcpu_op, cmd, vcpuid, extra_args); ++} ++ ++static inline int __must_check ++HYPERVISOR_suspend( ++ unsigned long srec) ++{ ++ struct sched_shutdown sched_shutdown = { ++ .reason = SHUTDOWN_suspend ++ }; ++ ++ int rc = _hypercall3(int, sched_op, SCHEDOP_shutdown, ++ &sched_shutdown, srec); ++ ++#if CONFIG_XEN_COMPAT <= 0x030002 ++ if (rc == -ENOSYS) ++ rc = _hypercall3(int, sched_op_compat, SCHEDOP_shutdown, ++ SHUTDOWN_suspend, srec); +#endif + -+ return total << PAGE_SHIFT; ++ return rc; +} + -+#ifdef CONFIG_KEXEC ++#if CONFIG_XEN_COMPAT <= 0x030002 ++static inline int ++HYPERVISOR_nmi_op( ++ unsigned long op, void *arg) ++{ ++ return _hypercall2(int, nmi_op, op, arg); ++} ++#endif ++ +#ifndef CONFIG_XEN -+static void __init reserve_crashkernel(void) ++static inline unsigned long __must_check ++HYPERVISOR_hvm_op( ++ int op, void *arg) +{ -+ unsigned long long total_mem; -+ unsigned long long crash_size, crash_base; -+ int ret; ++ return _hypercall2(unsigned long, hvm_op, op, arg); ++} ++#endif + -+ total_mem = get_total_mem(); ++static inline int __must_check ++HYPERVISOR_callback_op( ++ int cmd, const void *arg) ++{ ++ return _hypercall2(int, callback_op, cmd, arg); ++} + -+ ret = parse_crashkernel(boot_command_line, total_mem, -+ &crash_size, &crash_base); -+ if (ret == 0 && crash_size > 0) { -+ if (crash_base > 0) { -+ printk(KERN_INFO "Reserving %ldMB of memory at %ldMB " -+ "for crashkernel (System RAM: %ldMB)\n", -+ (unsigned long)(crash_size >> 20), -+ (unsigned long)(crash_base >> 20), -+ (unsigned long)(total_mem >> 20)); -+ crashk_res.start = crash_base; -+ crashk_res.end = crash_base + crash_size - 1; -+ reserve_bootmem(crash_base, crash_size); -+ } else -+ printk(KERN_INFO "crashkernel reservation failed - " -+ "you have to specify a base address\n"); -+ } ++static inline int __must_check ++HYPERVISOR_xenoprof_op( ++ int op, void *arg) ++{ ++ return _hypercall2(int, xenoprof_op, op, arg); +} -+#else -+#define reserve_crashkernel xen_machine_kexec_setup_resources -+#endif -+#else -+static inline void __init reserve_crashkernel(void) -+{} -+#endif + - void __init setup_bootmem_allocator(void) - { - unsigned long bootmap_size; -@@ -473,30 +518,25 @@ void __init setup_bootmem_allocator(void - - #ifdef CONFIG_BLK_DEV_INITRD - if (xen_start_info->mod_start) { -- if (INITRD_START + INITRD_SIZE <= (max_low_pfn << PAGE_SHIFT)) { -- /*reserve_bootmem(INITRD_START, INITRD_SIZE);*/ -- initrd_start = INITRD_START + PAGE_OFFSET; -- initrd_end = initrd_start+INITRD_SIZE; -+ unsigned long ramdisk_image = __pa(xen_start_info->mod_start); -+ unsigned long ramdisk_size = xen_start_info->mod_len; -+ unsigned long ramdisk_end = ramdisk_image + ramdisk_size; -+ unsigned long end_of_lowmem = max_low_pfn << PAGE_SHIFT; ++static inline int __must_check ++HYPERVISOR_kexec_op( ++ unsigned long op, void *args) ++{ ++ return _hypercall2(int, kexec_op, op, args); ++} + -+ if (ramdisk_end <= end_of_lowmem) { -+ /*reserve_bootmem(ramdisk_image, ramdisk_size);*/ -+ initrd_start = ramdisk_image + PAGE_OFFSET; -+ initrd_end = initrd_start+ramdisk_size; - initrd_below_start_ok = 1; -- } -- else { -+ } else { - printk(KERN_ERR "initrd extends beyond end of memory " -- "(0x%08lx > 0x%08lx)\ndisabling initrd\n", -- INITRD_START + INITRD_SIZE, -- max_low_pfn << PAGE_SHIFT); -+ "(0x%08lx > 0x%08lx)\ndisabling initrd\n", -+ ramdisk_end, end_of_lowmem); - initrd_start = 0; - } - } - #endif --#ifdef CONFIG_KEXEC ++struct tmem_op; ++ ++static inline int __must_check ++HYPERVISOR_tmem_op( ++ struct tmem_op *op) ++{ ++ return _hypercall1(int, tmem_op, (void *)op); ++} ++ ++#endif /* __HYPERCALL_H__ */ +--- a/arch/x86/include/mach-xen/asm/hypercall_32.h ++++ b/arch/x86/include/mach-xen/asm/hypercall_32.h +@@ -1,195 +1,10 @@ +-/****************************************************************************** +- * hypercall.h +- * +- * Linux-specific hypervisor handling. +- * +- * Copyright (c) 2002-2004, K A Fraser +- * +- * This program is free software; you can redistribute it and/or +- * modify it under the terms of the GNU General Public License version 2 +- * as published by the Free Software Foundation; or, when distributed +- * separately from the Linux kernel or incorporated into other +- * software packages, subject to the following license: +- * +- * Permission is hereby granted, free of charge, to any person obtaining a copy +- * of this source file (the "Software"), to deal in the Software without +- * restriction, including without limitation the rights to use, copy, modify, +- * merge, publish, distribute, sublicense, and/or sell copies of the Software, +- * and to permit persons to whom the Software is furnished to do so, subject to +- * the following conditions: +- * +- * The above copyright notice and this permission notice shall be included in +- * all copies or substantial portions of the Software. +- * +- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +- * IN THE SOFTWARE. +- */ +- +-#ifndef __HYPERCALL_H__ +-#define __HYPERCALL_H__ +- +-#include +- +-#ifndef __HYPERVISOR_H__ +-# error "please don't include this file directly" +-#endif +- -#ifdef CONFIG_XEN -- xen_machine_kexec_setup_resources(); +-#define HYPERCALL_STR(name) \ +- "call hypercall_page + ("__stringify(__HYPERVISOR_##name)" * 32)" -#else -- if (crashk_res.start != crashk_res.end) -- reserve_bootmem(crashk_res.start, -- crashk_res.end - crashk_res.start + 1); +-#define HYPERCALL_STR(name) \ +- "mov hypercall_stubs,%%eax; " \ +- "add $("__stringify(__HYPERVISOR_##name)" * 32),%%eax; "\ +- "call *%%eax" -#endif +- +-#define _hypercall0(type, name) \ +-({ \ +- type __res; \ +- asm volatile ( \ +- HYPERCALL_STR(name) \ +- : "=a" (__res) \ +- : \ +- : "memory" ); \ +- __res; \ +-}) +- +-#define _hypercall1(type, name, a1) \ +-({ \ +- type __res; \ +- long __ign1; \ +- asm volatile ( \ +- HYPERCALL_STR(name) \ +- : "=a" (__res), "=b" (__ign1) \ +- : "1" ((long)(a1)) \ +- : "memory" ); \ +- __res; \ +-}) +- +-#define _hypercall2(type, name, a1, a2) \ +-({ \ +- type __res; \ +- long __ign1, __ign2; \ +- asm volatile ( \ +- HYPERCALL_STR(name) \ +- : "=a" (__res), "=b" (__ign1), "=c" (__ign2) \ +- : "1" ((long)(a1)), "2" ((long)(a2)) \ +- : "memory" ); \ +- __res; \ +-}) +- +-#define _hypercall3(type, name, a1, a2, a3) \ +-({ \ +- type __res; \ +- long __ign1, __ign2, __ign3; \ +- asm volatile ( \ +- HYPERCALL_STR(name) \ +- : "=a" (__res), "=b" (__ign1), "=c" (__ign2), \ +- "=d" (__ign3) \ +- : "1" ((long)(a1)), "2" ((long)(a2)), \ +- "3" ((long)(a3)) \ +- : "memory" ); \ +- __res; \ +-}) +- +-#define _hypercall4(type, name, a1, a2, a3, a4) \ +-({ \ +- type __res; \ +- long __ign1, __ign2, __ign3, __ign4; \ +- asm volatile ( \ +- HYPERCALL_STR(name) \ +- : "=a" (__res), "=b" (__ign1), "=c" (__ign2), \ +- "=d" (__ign3), "=S" (__ign4) \ +- : "1" ((long)(a1)), "2" ((long)(a2)), \ +- "3" ((long)(a3)), "4" ((long)(a4)) \ +- : "memory" ); \ +- __res; \ +-}) +- +-#define _hypercall5(type, name, a1, a2, a3, a4, a5) \ +-({ \ +- type __res; \ +- long __ign1, __ign2, __ign3, __ign4, __ign5; \ +- asm volatile ( \ +- HYPERCALL_STR(name) \ +- : "=a" (__res), "=b" (__ign1), "=c" (__ign2), \ +- "=d" (__ign3), "=S" (__ign4), "=D" (__ign5) \ +- : "1" ((long)(a1)), "2" ((long)(a2)), \ +- "3" ((long)(a3)), "4" ((long)(a4)), \ +- "5" ((long)(a5)) \ +- : "memory" ); \ +- __res; \ +-}) +- +-#define _hypercall(type, op, a1, a2, a3, a4, a5) \ +-({ \ +- type __res; \ +- register typeof((a1)+0) __arg1 asm("ebx") = (a1); \ +- register typeof((a2)+0) __arg2 asm("ecx") = (a2); \ +- register typeof((a3)+0) __arg3 asm("edx") = (a3); \ +- register typeof((a4)+0) __arg4 asm("esi") = (a4); \ +- register typeof((a5)+0) __arg5 asm("edi") = (a5); \ +- asm volatile ( \ +- "call *%6" \ +- : "=a" (__res), "+r" (__arg1), "+r" (__arg2), \ +- "+r" (__arg3), "+r" (__arg4), "+r" (__arg5) \ +- : "0" (hypercall_page + (op) * 32) \ +- : "memory" ); \ +- __res; \ +-}) ++#define HYPERCALL_arg1 "ebx" ++#define HYPERCALL_arg2 "ecx" ++#define HYPERCALL_arg3 "edx" ++#define HYPERCALL_arg4 "esi" ++#define HYPERCALL_arg5 "edi" + + #if CONFIG_XEN_COMPAT <= 0x030002 +-int __must_check HYPERVISOR_event_channel_op_compat(int, void *); +-int __must_check HYPERVISOR_physdev_op_compat(int, void *); -#endif -+ reserve_crashkernel(); +- +-static inline int __must_check +-HYPERVISOR_set_trap_table( +- const trap_info_t *table) +-{ +- return _hypercall1(int, set_trap_table, table); +-} +- +-static inline int __must_check +-HYPERVISOR_mmu_update( +- mmu_update_t *req, unsigned int count, unsigned int *success_count, +- domid_t domid) +-{ +- if (arch_use_lazy_mmu_mode()) +- return xen_multi_mmu_update(req, count, success_count, domid); +- return _hypercall4(int, mmu_update, req, count, success_count, domid); +-} +- +-static inline int __must_check +-HYPERVISOR_mmuext_op( +- struct mmuext_op *op, unsigned int count, unsigned int *success_count, +- domid_t domid) +-{ +- if (arch_use_lazy_mmu_mode()) +- return xen_multi_mmuext_op(op, count, success_count, domid); +- return _hypercall4(int, mmuext_op, op, count, success_count, domid); +-} +- +-static inline int __must_check +-HYPERVISOR_set_gdt( +- unsigned long *frame_list, unsigned int entries) +-{ +- return _hypercall2(int, set_gdt, frame_list, entries); +-} +- +-static inline int __must_check +-HYPERVISOR_stack_switch( +- unsigned long ss, unsigned long esp) +-{ +- return _hypercall2(int, stack_switch, ss, esp); +-} +- + static inline int __must_check + HYPERVISOR_set_callbacks( + unsigned long event_selector, unsigned long event_address, +@@ -199,80 +14,24 @@ HYPERVISOR_set_callbacks( + event_selector, event_address, + failsafe_selector, failsafe_address); } +- +-static inline int +-HYPERVISOR_fpu_taskswitch( +- int set) +-{ +- return _hypercall1(int, fpu_taskswitch, set); +-} +- +-static inline int __must_check +-HYPERVISOR_sched_op_compat( +- int cmd, unsigned long arg) +-{ +- return _hypercall2(int, sched_op_compat, cmd, arg); +-} +- +-static inline int __must_check +-HYPERVISOR_sched_op( +- int cmd, void *arg) +-{ +- return _hypercall2(int, sched_op, cmd, arg); +-} ++#endif - /* -@@ -574,7 +614,8 @@ void __init setup_arch(char **cmdline_p) - * the system table is valid. If not, then initialize normally. - */ - #ifdef CONFIG_EFI -- if ((LOADER_TYPE == 0x50) && EFI_SYSTAB) -+ if ((boot_params.hdr.type_of_loader == 0x50) && -+ boot_params.efi_info.efi_systab) - efi_enabled = 1; - #endif - -@@ -582,18 +623,18 @@ void __init setup_arch(char **cmdline_p) - properly. Setting ROOT_DEV to default to /dev/ram0 breaks initrd. - */ - ROOT_DEV = MKDEV(UNNAMED_MAJOR,0); -- screen_info = SCREEN_INFO; -+ screen_info = boot_params.screen_info; - copy_edid(); -- apm_info.bios = APM_BIOS_INFO; -- ist_info = IST_INFO; -- saved_videomode = VIDEO_MODE; -- if( SYS_DESC_TABLE.length != 0 ) { -- set_mca_bus(SYS_DESC_TABLE.table[3] & 0x2); -- machine_id = SYS_DESC_TABLE.table[0]; -- machine_submodel_id = SYS_DESC_TABLE.table[1]; -- BIOS_revision = SYS_DESC_TABLE.table[2]; -+ apm_info.bios = boot_params.apm_bios_info; -+ ist_info = boot_params.ist_info; -+ saved_videomode = boot_params.hdr.vid_mode; -+ if( boot_params.sys_desc_table.length != 0 ) { -+ set_mca_bus(boot_params.sys_desc_table.table[3] & 0x2); -+ machine_id = boot_params.sys_desc_table.table[0]; -+ machine_submodel_id = boot_params.sys_desc_table.table[1]; -+ BIOS_revision = boot_params.sys_desc_table.table[2]; - } -- bootloader_type = LOADER_TYPE; -+ bootloader_type = boot_params.hdr.type_of_loader; + static inline long __must_check + HYPERVISOR_set_timer_op( + u64 timeout) + { +- unsigned long timeout_hi = (unsigned long)(timeout>>32); +- unsigned long timeout_lo = (unsigned long)timeout; +- return _hypercall2(long, set_timer_op, timeout_lo, timeout_hi); +-} +- +-static inline int __must_check +-HYPERVISOR_platform_op( +- struct xen_platform_op *platform_op) +-{ +- platform_op->interface_version = XENPF_INTERFACE_VERSION; +- return _hypercall1(int, platform_op, platform_op); +-} +- +-static inline int __must_check +-HYPERVISOR_set_debugreg( +- unsigned int reg, unsigned long value) +-{ +- return _hypercall2(int, set_debugreg, reg, value); +-} +- +-static inline unsigned long __must_check +-HYPERVISOR_get_debugreg( +- unsigned int reg) +-{ +- return _hypercall1(unsigned long, get_debugreg, reg); ++ return _hypercall2(long, set_timer_op, ++ (unsigned long)timeout, ++ (unsigned long)(timeout>>32)); + } - if (is_initial_xendomain()) { - const struct dom0_vga_console_info *info = -@@ -608,9 +649,9 @@ void __init setup_arch(char **cmdline_p) - screen_info.orig_video_isVGA = 0; - - #ifdef CONFIG_BLK_DEV_RAM -- rd_image_start = RAMDISK_FLAGS & RAMDISK_IMAGE_START_MASK; -- rd_prompt = ((RAMDISK_FLAGS & RAMDISK_PROMPT_FLAG) != 0); -- rd_doload = ((RAMDISK_FLAGS & RAMDISK_LOAD_FLAG) != 0); -+ rd_image_start = boot_params.hdr.ram_size & RAMDISK_IMAGE_START_MASK; -+ rd_prompt = ((boot_params.hdr.ram_size & RAMDISK_PROMPT_FLAG) != 0); -+ rd_doload = ((boot_params.hdr.ram_size & RAMDISK_LOAD_FLAG) != 0); - #endif - - ARCH_SETUP -@@ -623,7 +664,7 @@ void __init setup_arch(char **cmdline_p) - - copy_edd(); - -- if (!MOUNT_ROOT_RDONLY) -+ if (!boot_params.hdr.root_flags) - root_mountflags &= ~MS_RDONLY; - init_mm.start_code = (unsigned long) _text; - init_mm.end_code = (unsigned long) _etext; -@@ -635,6 +676,8 @@ void __init setup_arch(char **cmdline_p) - code_resource.end = virt_to_phys(_etext)-1; - data_resource.start = virt_to_phys(_etext); - data_resource.end = virt_to_phys(_edata)-1; -+ bss_resource.start = virt_to_phys(&__bss_start); -+ bss_resource.end = virt_to_phys(&__bss_stop)-1; + static inline int __must_check + HYPERVISOR_update_descriptor( + u64 ma, u64 desc) + { +- return _hypercall4(int, update_descriptor, ma, ma>>32, desc, desc>>32); +-} +- +-static inline int __must_check +-HYPERVISOR_memory_op( +- unsigned int cmd, void *arg) +-{ +- if (arch_use_lazy_mmu_mode()) +- xen_multicall_flush(false); +- return _hypercall2(int, memory_op, cmd, arg); +-} +- +-static inline int __must_check +-HYPERVISOR_multicall( +- multicall_entry_t *call_list, unsigned int nr_calls) +-{ +- return _hypercall2(int, multicall, call_list, nr_calls); ++ return _hypercall4(int, update_descriptor, ++ (unsigned long)ma, (unsigned long)(ma>>32), ++ (unsigned long)desc, (unsigned long)(desc>>32)); + } - if ((i = MAX_GUEST_CMDLINE) > COMMAND_LINE_SIZE) - i = COMMAND_LINE_SIZE; -@@ -663,7 +706,7 @@ void __init setup_arch(char **cmdline_p) - /* - * NOTE: before this point _nobody_ is allowed to allocate - * any memory using the bootmem allocator. Although the -- * alloctor is now initialised only the first 8Mb of the kernel -+ * allocator is now initialised only the first 8Mb of the kernel - * virtual address space has been mapped. All allocations before - * paging_init() has completed must use the alloc_bootmem_low_pages() - * variant (which allocates DMA'able memory) and care must be taken -@@ -784,10 +827,8 @@ void __init setup_arch(char **cmdline_p) - acpi_boot_table_init(); - #endif + static inline int __must_check +@@ -291,57 +50,6 @@ HYPERVISOR_update_va_mapping( + } --#ifdef CONFIG_PCI --#ifdef CONFIG_X86_IO_APIC -- check_acpi_pci(); /* Checks more than just ACPI actually */ + static inline int __must_check +-HYPERVISOR_event_channel_op( +- int cmd, void *arg) +-{ +- int rc = _hypercall2(int, event_channel_op, cmd, arg); +- +-#if CONFIG_XEN_COMPAT <= 0x030002 +- if (unlikely(rc == -ENOSYS)) +- rc = HYPERVISOR_event_channel_op_compat(cmd, arg); -#endif -+#if defined(CONFIG_PCI) && !defined(CONFIG_XEN) -+ early_quirks(); - #endif - - #ifdef CONFIG_ACPI ---- head.orig/arch/x86/kernel/setup_64-xen.c 2012-06-06 13:52:43.000000000 +0200 -+++ head/arch/x86/kernel/setup_64-xen.c 2012-06-06 13:55:19.000000000 +0200 -@@ -1,10 +1,5 @@ - /* -- * linux/arch/x86-64/kernel/setup.c -- * - * Copyright (C) 1995 Linus Torvalds -- * -- * Nov 2001 Dave Jones -- * Forked from i386 setup code. - */ - - /* -@@ -57,13 +52,13 @@ - #include - #include - #include --#include - #include - #include - #include - #include - #include - #include -+#include - #ifdef CONFIG_XEN - #include - #include -@@ -180,6 +175,12 @@ struct resource code_resource = { - .end = 0, - .flags = IORESOURCE_RAM, - }; -+struct resource bss_resource = { -+ .name = "Kernel bss", -+ .start = 0, -+ .end = 0, -+ .flags = IORESOURCE_RAM, -+}; - - #ifdef CONFIG_PROC_VMCORE - /* elfcorehdr= specifies the location of elf core header -@@ -232,10 +233,11 @@ EXPORT_SYMBOL(edd); - */ - static inline void copy_edd(void) +- +- return rc; +-} +- +-static inline int __must_check +-HYPERVISOR_xen_version( +- int cmd, void *arg) +-{ +- return _hypercall2(int, xen_version, cmd, arg); +-} +- +-static inline int __must_check +-HYPERVISOR_console_io( +- int cmd, unsigned int count, char *str) +-{ +- return _hypercall3(int, console_io, cmd, count, str); +-} +- +-static inline int __must_check +-HYPERVISOR_physdev_op( +- int cmd, void *arg) +-{ +- int rc = _hypercall2(int, physdev_op, cmd, arg); +- +-#if CONFIG_XEN_COMPAT <= 0x030002 +- if (unlikely(rc == -ENOSYS)) +- rc = HYPERVISOR_physdev_op_compat(cmd, arg); +-#endif +- +- return rc; +-} +- +-static inline int __must_check +-HYPERVISOR_grant_table_op( +- unsigned int cmd, void *uop, unsigned int count) +-{ +- if (arch_use_lazy_mmu_mode()) +- xen_multicall_flush(false); +- return _hypercall3(int, grant_table_op, cmd, uop, count); +-} +- +-static inline int __must_check + HYPERVISOR_update_va_mapping_otherdomain( + unsigned long va, pte_t new_val, unsigned long flags, domid_t domid) { -- memcpy(edd.mbr_signature, EDD_MBR_SIGNATURE, sizeof(edd.mbr_signature)); -- memcpy(edd.edd_info, EDD_BUF, sizeof(edd.edd_info)); -- edd.mbr_signature_nr = EDD_MBR_SIG_NR; -- edd.edd_info_nr = EDD_NR; -+ memcpy(edd.mbr_signature, boot_params.edd_mbr_sig_buffer, -+ sizeof(edd.mbr_signature)); -+ memcpy(edd.edd_info, boot_params.eddbuf, sizeof(edd.edd_info)); -+ edd.mbr_signature_nr = boot_params.edd_mbr_sig_buf_entries; -+ edd.edd_info_nr = boot_params.eddbuf_entries; - } - #endif - #else -@@ -244,6 +246,41 @@ static inline void copy_edd(void) +@@ -352,86 +60,3 @@ HYPERVISOR_update_va_mapping_otherdomain + return _hypercall5(int, update_va_mapping_otherdomain, va, + new_val.pte_low, pte_hi, flags, domid); } - #endif - -+#ifdef CONFIG_KEXEC -+#ifndef CONFIG_XEN -+static void __init reserve_crashkernel(void) -+{ -+ unsigned long long free_mem; -+ unsigned long long crash_size, crash_base; -+ int ret; -+ -+ free_mem = ((unsigned long long)max_low_pfn - min_low_pfn) << PAGE_SHIFT; -+ -+ ret = parse_crashkernel(boot_command_line, free_mem, -+ &crash_size, &crash_base); -+ if (ret == 0 && crash_size) { -+ if (crash_base > 0) { -+ printk(KERN_INFO "Reserving %ldMB of memory at %ldMB " -+ "for crashkernel (System RAM: %ldMB)\n", -+ (unsigned long)(crash_size >> 20), -+ (unsigned long)(crash_base >> 20), -+ (unsigned long)(free_mem >> 20)); -+ crashk_res.start = crash_base; -+ crashk_res.end = crash_base + crash_size - 1; -+ reserve_bootmem(crash_base, crash_size); -+ } else -+ printk(KERN_INFO "crashkernel reservation failed - " -+ "you have to specify a base address\n"); -+ } -+} -+#else -+#define reserve_crashkernel xen_machine_kexec_setup_resources -+#endif -+#else -+static inline void __init reserve_crashkernel(void) -+{} -+#endif -+ - #ifndef CONFIG_XEN - #define EBDA_ADDR_POINTER 0x40E - -@@ -284,7 +321,7 @@ void __init setup_arch(char **cmdline_p) - atomic_notifier_chain_register(&panic_notifier_list, &xen_panic_block); - - ROOT_DEV = MKDEV(RAMDISK_MAJOR,0); -- screen_info = SCREEN_INFO; -+ screen_info = boot_params.screen_info; - - if (is_initial_xendomain()) { - const struct dom0_vga_console_info *info = -@@ -307,22 +344,22 @@ void __init setup_arch(char **cmdline_p) - #else - printk(KERN_INFO "Command line: %s\n", boot_command_line); - -- ROOT_DEV = old_decode_dev(ORIG_ROOT_DEV); -- screen_info = SCREEN_INFO; -- edid_info = EDID_INFO; -+ ROOT_DEV = old_decode_dev(boot_params.hdr.root_dev); -+ screen_info = boot_params.screen_info; -+ edid_info = boot_params.edid_info; - #endif /* !CONFIG_XEN */ -- saved_video_mode = SAVED_VIDEO_MODE; -- bootloader_type = LOADER_TYPE; -+ saved_video_mode = boot_params.hdr.vid_mode; -+ bootloader_type = boot_params.hdr.type_of_loader; - - #ifdef CONFIG_BLK_DEV_RAM -- rd_image_start = RAMDISK_FLAGS & RAMDISK_IMAGE_START_MASK; -- rd_prompt = ((RAMDISK_FLAGS & RAMDISK_PROMPT_FLAG) != 0); -- rd_doload = ((RAMDISK_FLAGS & RAMDISK_LOAD_FLAG) != 0); -+ rd_image_start = boot_params.hdr.ram_size & RAMDISK_IMAGE_START_MASK; -+ rd_prompt = ((boot_params.hdr.ram_size & RAMDISK_PROMPT_FLAG) != 0); -+ rd_doload = ((boot_params.hdr.ram_size & RAMDISK_LOAD_FLAG) != 0); - #endif - setup_memory_region(); - copy_edd(); - -- if (!MOUNT_ROOT_RDONLY) -+ if (!boot_params.hdr.root_flags) - root_mountflags &= ~MS_RDONLY; - init_mm.start_code = (unsigned long) &_text; - init_mm.end_code = (unsigned long) &_etext; -@@ -333,6 +370,8 @@ void __init setup_arch(char **cmdline_p) - code_resource.end = virt_to_phys(&_etext)-1; - data_resource.start = virt_to_phys(&_etext); - data_resource.end = virt_to_phys(&_edata)-1; -+ bss_resource.start = virt_to_phys(&__bss_start); -+ bss_resource.end = virt_to_phys(&__bss_stop)-1; - - early_identify_cpu(&boot_cpu_data); - -@@ -360,6 +399,11 @@ void __init setup_arch(char **cmdline_p) - if (is_initial_xendomain()) - dmi_scan_machine(); - -+#if defined(CONFIG_SMP) && !defined(CONFIG_XEN) -+ /* setup to use the static apicid table during kernel startup */ -+ x86_cpu_to_apicid_ptr = (void *)&x86_cpu_to_apicid_init; -+#endif -+ - /* How many end-of-memory variables you have, grandma! */ - max_low_pfn = end_pfn; - max_pfn = end_pfn; -@@ -424,52 +468,37 @@ void __init setup_arch(char **cmdline_p) - */ - acpi_reserve_bootmem(); - #endif --#ifdef CONFIG_XEN - #ifdef CONFIG_BLK_DEV_INITRD -+#ifdef CONFIG_XEN - if (xen_start_info->mod_start) { -- if (INITRD_START + INITRD_SIZE <= (end_pfn << PAGE_SHIFT)) { -- /*reserve_bootmem_generic(INITRD_START, INITRD_SIZE);*/ -- initrd_start = INITRD_START + PAGE_OFFSET; -- initrd_end = initrd_start+INITRD_SIZE; -+ unsigned long ramdisk_image = __pa(xen_start_info->mod_start); -+ unsigned long ramdisk_size = xen_start_info->mod_len; -+#else -+ if (boot_params.hdr.type_of_loader && boot_params.hdr.ramdisk_image) { -+ unsigned long ramdisk_image = boot_params.hdr.ramdisk_image; -+ unsigned long ramdisk_size = boot_params.hdr.ramdisk_size; -+#endif -+ unsigned long ramdisk_end = ramdisk_image + ramdisk_size; -+ unsigned long end_of_mem = end_pfn << PAGE_SHIFT; -+ -+ if (ramdisk_end <= end_of_mem) { -+#ifndef CONFIG_XEN -+ reserve_bootmem_generic(ramdisk_image, ramdisk_size); -+#endif -+ initrd_start = ramdisk_image + PAGE_OFFSET; -+ initrd_end = initrd_start+ramdisk_size; -+#ifdef CONFIG_XEN - initrd_below_start_ok = 1; -- } else { -- printk(KERN_ERR "initrd extends beyond end of memory " -- "(0x%08lx > 0x%08lx)\ndisabling initrd\n", -- (unsigned long)(INITRD_START + INITRD_SIZE), -- (unsigned long)(end_pfn << PAGE_SHIFT)); -- initrd_start = 0; -- } -- } - #endif --#else /* CONFIG_XEN */ --#ifdef CONFIG_BLK_DEV_INITRD -- if (LOADER_TYPE && INITRD_START) { -- if (INITRD_START + INITRD_SIZE <= (end_pfn << PAGE_SHIFT)) { -- reserve_bootmem_generic(INITRD_START, INITRD_SIZE); -- initrd_start = INITRD_START + PAGE_OFFSET; -- initrd_end = initrd_start+INITRD_SIZE; -- } -- else { -+ } else { - printk(KERN_ERR "initrd extends beyond end of memory " -- "(0x%08lx > 0x%08lx)\ndisabling initrd\n", -- (unsigned long)(INITRD_START + INITRD_SIZE), -- (unsigned long)(end_pfn << PAGE_SHIFT)); -+ "(0x%08lx > 0x%08lx)\ndisabling initrd\n", -+ ramdisk_end, end_of_mem); - initrd_start = 0; - } - } - #endif --#endif /* !CONFIG_XEN */ --#ifdef CONFIG_KEXEC +- +-static inline int __must_check +-HYPERVISOR_vm_assist( +- unsigned int cmd, unsigned int type) +-{ +- return _hypercall2(int, vm_assist, cmd, type); +-} +- +-static inline int __must_check +-HYPERVISOR_vcpu_op( +- int cmd, unsigned int vcpuid, void *extra_args) +-{ +- return _hypercall3(int, vcpu_op, cmd, vcpuid, extra_args); +-} +- +-static inline int __must_check +-HYPERVISOR_suspend( +- unsigned long srec) +-{ +- struct sched_shutdown sched_shutdown = { +- .reason = SHUTDOWN_suspend +- }; +- +- int rc = _hypercall3(int, sched_op, SCHEDOP_shutdown, +- &sched_shutdown, srec); +- +-#if CONFIG_XEN_COMPAT <= 0x030002 +- if (rc == -ENOSYS) +- rc = _hypercall3(int, sched_op_compat, SCHEDOP_shutdown, +- SHUTDOWN_suspend, srec); +-#endif +- +- return rc; +-} +- +-#if CONFIG_XEN_COMPAT <= 0x030002 +-static inline int +-HYPERVISOR_nmi_op( +- unsigned long op, void *arg) +-{ +- return _hypercall2(int, nmi_op, op, arg); +-} +-#endif +- +-#ifndef CONFIG_XEN +-static inline unsigned long __must_check +-HYPERVISOR_hvm_op( +- int op, void *arg) +-{ +- return _hypercall2(unsigned long, hvm_op, op, arg); +-} +-#endif +- +-static inline int __must_check +-HYPERVISOR_callback_op( +- int cmd, const void *arg) +-{ +- return _hypercall2(int, callback_op, cmd, arg); +-} +- +-static inline int __must_check +-HYPERVISOR_xenoprof_op( +- int op, void *arg) +-{ +- return _hypercall2(int, xenoprof_op, op, arg); +-} +- +-static inline int __must_check +-HYPERVISOR_kexec_op( +- unsigned long op, void *args) +-{ +- return _hypercall2(int, kexec_op, op, args); +-} +- +-static inline int __must_check +-HYPERVISOR_tmem_op( +- struct tmem_op *op) +-{ +- return _hypercall1(int, tmem_op, op); +-} +- +- +-#endif /* __HYPERCALL_H__ */ +--- a/arch/x86/include/mach-xen/asm/hypercall_64.h ++++ b/arch/x86/include/mach-xen/asm/hypercall_64.h +@@ -1,202 +1,10 @@ +-/****************************************************************************** +- * hypercall.h +- * +- * Linux-specific hypervisor handling. +- * +- * Copyright (c) 2002-2004, K A Fraser +- * +- * 64-bit updates: +- * Benjamin Liu +- * Jun Nakajima +- * +- * This program is free software; you can redistribute it and/or +- * modify it under the terms of the GNU General Public License version 2 +- * as published by the Free Software Foundation; or, when distributed +- * separately from the Linux kernel or incorporated into other +- * software packages, subject to the following license: +- * +- * Permission is hereby granted, free of charge, to any person obtaining a copy +- * of this source file (the "Software"), to deal in the Software without +- * restriction, including without limitation the rights to use, copy, modify, +- * merge, publish, distribute, sublicense, and/or sell copies of the Software, +- * and to permit persons to whom the Software is furnished to do so, subject to +- * the following conditions: +- * +- * The above copyright notice and this permission notice shall be included in +- * all copies or substantial portions of the Software. +- * +- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +- * IN THE SOFTWARE. +- */ +- +-#ifndef __HYPERCALL_H__ +-#define __HYPERCALL_H__ +- +-#include +-#include +- +-#ifndef __HYPERVISOR_H__ +-# error "please don't include this file directly" +-#endif +- -#ifdef CONFIG_XEN -- xen_machine_kexec_setup_resources(); +-#define HYPERCALL_STR(name) \ +- "call hypercall_page + ("__stringify(__HYPERVISOR_##name)" * 32)" -#else -- if (crashk_res.start != crashk_res.end) { -- reserve_bootmem_generic(crashk_res.start, -- crashk_res.end - crashk_res.start + 1); -- } --#endif +-#define HYPERCALL_STR(name) \ +- "mov $("__stringify(__HYPERVISOR_##name)" * 32),%%eax; "\ +- "add hypercall_stubs(%%rip),%%rax; " \ +- "call *%%rax" -#endif - -+ reserve_crashkernel(); - paging_init(); - #ifdef CONFIG_X86_LOCAL_APIC - /* -@@ -782,7 +811,7 @@ static void __init amd_detect_cmp(struct - but in the same order as the HT nodeids. - If that doesn't result in a usable node fall back to the - path for the previous case. */ -- int ht_nodeid = apicid - (cpu_data[0].phys_proc_id << bits); -+ int ht_nodeid = apicid - (cpu_data(0).phys_proc_id << bits); - if (ht_nodeid >= 0 && - apicid_to_node[ht_nodeid] != NUMA_NO_NODE) - node = apicid_to_node[ht_nodeid]; -@@ -797,6 +826,39 @@ static void __init amd_detect_cmp(struct - #endif - } - -+#define ENABLE_C1E_MASK 0x18000000 -+#define CPUID_PROCESSOR_SIGNATURE 1 -+#define CPUID_XFAM 0x0ff00000 -+#define CPUID_XFAM_K8 0x00000000 -+#define CPUID_XFAM_10H 0x00100000 -+#define CPUID_XFAM_11H 0x00200000 -+#define CPUID_XMOD 0x000f0000 -+#define CPUID_XMOD_REV_F 0x00040000 -+ -+#ifndef CONFIG_XEN -+/* AMD systems with C1E don't have a working lAPIC timer. Check for that. */ -+static __cpuinit int amd_apic_timer_broken(void) -+{ -+ u32 lo, hi; -+ u32 eax = cpuid_eax(CPUID_PROCESSOR_SIGNATURE); -+ switch (eax & CPUID_XFAM) { -+ case CPUID_XFAM_K8: -+ if ((eax & CPUID_XMOD) < CPUID_XMOD_REV_F) -+ break; -+ case CPUID_XFAM_10H: -+ case CPUID_XFAM_11H: -+ rdmsr(MSR_K8_ENABLE_C1E, lo, hi); -+ if (lo & ENABLE_C1E_MASK) -+ return 1; -+ break; -+ default: -+ /* err on the side of caution */ -+ return 1; -+ } -+ return 0; -+} -+#endif -+ - static void __cpuinit init_amd(struct cpuinfo_x86 *c) - { - unsigned level; -@@ -826,7 +888,7 @@ static void __cpuinit init_amd(struct cp - level = cpuid_eax(1); - if (c->x86 == 15 && ((level >= 0x0f48 && level < 0x0f50) || level >= 0x0f58)) - set_bit(X86_FEATURE_REP_GOOD, &c->x86_capability); -- if (c->x86 == 0x10) -+ if (c->x86 == 0x10 || c->x86 == 0x11) - set_bit(X86_FEATURE_REP_GOOD, &c->x86_capability); - - /* Enable workaround for FXSAVE leak */ -@@ -868,6 +930,11 @@ static void __cpuinit init_amd(struct cp - /* Family 10 doesn't support C states in MWAIT so don't use it */ - if (c->x86 == 0x10 && !force_mwait) - clear_bit(X86_FEATURE_MWAIT, &c->x86_capability); -+ -+#ifndef CONFIG_XEN -+ if (amd_apic_timer_broken()) -+ disable_apic_timer = 1; -+#endif - } - - static void __cpuinit detect_ht(struct cpuinfo_x86 *c) -@@ -917,6 +984,7 @@ out: - #endif - } +-#define _hypercall0(type, name) \ +-({ \ +- type __res; \ +- asm volatile ( \ +- HYPERCALL_STR(name) \ +- : "=a" (__res) \ +- : \ +- : "memory" ); \ +- __res; \ +-}) +- +-#define _hypercall1(type, name, a1) \ +-({ \ +- type __res; \ +- long __ign1; \ +- asm volatile ( \ +- HYPERCALL_STR(name) \ +- : "=a" (__res), "=D" (__ign1) \ +- : "1" ((long)(a1)) \ +- : "memory" ); \ +- __res; \ +-}) +- +-#define _hypercall2(type, name, a1, a2) \ +-({ \ +- type __res; \ +- long __ign1, __ign2; \ +- asm volatile ( \ +- HYPERCALL_STR(name) \ +- : "=a" (__res), "=D" (__ign1), "=S" (__ign2) \ +- : "1" ((long)(a1)), "2" ((long)(a2)) \ +- : "memory" ); \ +- __res; \ +-}) +- +-#define _hypercall3(type, name, a1, a2, a3) \ +-({ \ +- type __res; \ +- long __ign1, __ign2, __ign3; \ +- asm volatile ( \ +- HYPERCALL_STR(name) \ +- : "=a" (__res), "=D" (__ign1), "=S" (__ign2), \ +- "=d" (__ign3) \ +- : "1" ((long)(a1)), "2" ((long)(a2)), \ +- "3" ((long)(a3)) \ +- : "memory" ); \ +- __res; \ +-}) +- +-#define _hypercall4(type, name, a1, a2, a3, a4) \ +-({ \ +- type __res; \ +- long __ign1, __ign2, __ign3; \ +- register long __arg4 asm("r10") = (long)(a4); \ +- asm volatile ( \ +- HYPERCALL_STR(name) \ +- : "=a" (__res), "=D" (__ign1), "=S" (__ign2), \ +- "=d" (__ign3), "+r" (__arg4) \ +- : "1" ((long)(a1)), "2" ((long)(a2)), \ +- "3" ((long)(a3)) \ +- : "memory" ); \ +- __res; \ +-}) +- +-#define _hypercall5(type, name, a1, a2, a3, a4, a5) \ +-({ \ +- type __res; \ +- long __ign1, __ign2, __ign3; \ +- register long __arg4 asm("r10") = (long)(a4); \ +- register long __arg5 asm("r8") = (long)(a5); \ +- asm volatile ( \ +- HYPERCALL_STR(name) \ +- : "=a" (__res), "=D" (__ign1), "=S" (__ign2), \ +- "=d" (__ign3), "+r" (__arg4), "+r" (__arg5) \ +- : "1" ((long)(a1)), "2" ((long)(a2)), \ +- "3" ((long)(a3)) \ +- : "memory" ); \ +- __res; \ +-}) +- +-#define _hypercall(type, op, a1, a2, a3, a4, a5) \ +-({ \ +- type __res; \ +- register typeof((a1)+0) __arg1 asm("rdi") = (a1); \ +- register typeof((a2)+0) __arg2 asm("rsi") = (a2); \ +- register typeof((a3)+0) __arg3 asm("rdx") = (a3); \ +- register typeof((a4)+0) __arg4 asm("r10") = (a4); \ +- register typeof((a5)+0) __arg5 asm("r8") = (a5); \ +- asm volatile ( \ +- "call *%6" \ +- : "=a" (__res), "+r" (__arg1), "+r" (__arg2), \ +- "+r" (__arg3), "+r" (__arg4), "+r" (__arg5) \ +- : "0" (hypercall_page + (op) * 32) \ +- : "memory" ); \ +- __res; \ +-}) ++#define HYPERCALL_arg1 "rdi" ++#define HYPERCALL_arg2 "rsi" ++#define HYPERCALL_arg3 "rdx" ++#define HYPERCALL_arg4 "r10" ++#define HYPERCALL_arg5 "r8" -+#ifndef CONFIG_XEN - /* - * find out the number of processor cores on the die - */ -@@ -934,6 +1002,7 @@ static int __cpuinit intel_num_cpu_cores - else - return 1; + #if CONFIG_XEN_COMPAT <= 0x030002 +-int __must_check HYPERVISOR_event_channel_op_compat(int, void *); +-int __must_check HYPERVISOR_physdev_op_compat(int, void *); +-#endif +- +-static inline int __must_check +-HYPERVISOR_set_trap_table( +- const trap_info_t *table) +-{ +- return _hypercall1(int, set_trap_table, table); +-} +- +-static inline int __must_check +-HYPERVISOR_mmu_update( +- mmu_update_t *req, unsigned int count, unsigned int *success_count, +- domid_t domid) +-{ +- if (arch_use_lazy_mmu_mode()) +- return xen_multi_mmu_update(req, count, success_count, domid); +- return _hypercall4(int, mmu_update, req, count, success_count, domid); +-} +- +-static inline int __must_check +-HYPERVISOR_mmuext_op( +- struct mmuext_op *op, unsigned int count, unsigned int *success_count, +- domid_t domid) +-{ +- if (arch_use_lazy_mmu_mode()) +- return xen_multi_mmuext_op(op, count, success_count, domid); +- return _hypercall4(int, mmuext_op, op, count, success_count, domid); +-} +- +-static inline int __must_check +-HYPERVISOR_set_gdt( +- unsigned long *frame_list, unsigned int entries) +-{ +- return _hypercall2(int, set_gdt, frame_list, entries); +-} +- +-static inline int __must_check +-HYPERVISOR_stack_switch( +- unsigned long ss, unsigned long esp) +-{ +- return _hypercall2(int, stack_switch, ss, esp); +-} +- + static inline int __must_check + HYPERVISOR_set_callbacks( + unsigned long event_address, unsigned long failsafe_address, +@@ -205,27 +13,7 @@ HYPERVISOR_set_callbacks( + return _hypercall3(int, set_callbacks, + event_address, failsafe_address, syscall_address); } +- +-static inline int +-HYPERVISOR_fpu_taskswitch( +- int set) +-{ +- return _hypercall1(int, fpu_taskswitch, set); +-} +- +-static inline int __must_check +-HYPERVISOR_sched_op_compat( +- int cmd, unsigned long arg) +-{ +- return _hypercall2(int, sched_op_compat, cmd, arg); +-} +- +-static inline int __must_check +-HYPERVISOR_sched_op( +- int cmd, void *arg) +-{ +- return _hypercall2(int, sched_op, cmd, arg); +-} +#endif - static void srat_detect_node(void) - { -@@ -998,7 +1067,9 @@ static void __cpuinit init_intel(struct - set_bit(X86_FEATURE_SYNC_RDTSC, &c->x86_capability); - else - clear_bit(X86_FEATURE_SYNC_RDTSC, &c->x86_capability); -+#ifndef CONFIG_XEN - c->x86_max_cores = intel_num_cpu_cores(c); -+#endif - - srat_detect_node(); + static inline long __must_check + HYPERVISOR_set_timer_op( +@@ -235,34 +23,6 @@ HYPERVISOR_set_timer_op( } -@@ -1036,7 +1107,9 @@ void __cpuinit early_identify_cpu(struct - c->x86_model_id[0] = '\0'; /* Unset */ - c->x86_clflush_size = 64; - c->x86_cache_alignment = c->x86_clflush_size; -+#ifndef CONFIG_XEN - c->x86_max_cores = 1; -+#endif - c->extended_cpuid_level = 0; - memset(&c->x86_capability, 0, sizeof c->x86_capability); - -@@ -1180,6 +1253,7 @@ void __cpuinit print_cpu_info(struct cpu - static int show_cpuinfo(struct seq_file *m, void *v) - { - struct cpuinfo_x86 *c = v; -+ int cpu = 0; - - /* - * These flag bits must match the definitions in . -@@ -1189,7 +1263,7 @@ static int show_cpuinfo(struct seq_file - * applications want to get the raw CPUID data, they should access - * /dev/cpu//cpuid instead. - */ -- static char *x86_cap_flags[] = { -+ static const char *const x86_cap_flags[] = { - /* Intel-defined */ - "fpu", "vme", "de", "pse", "tsc", "msr", "pae", "mce", - "cx8", "apic", NULL, "sep", "mtrr", "pge", "mca", "cmov", -@@ -1220,7 +1294,7 @@ static int show_cpuinfo(struct seq_file - /* Intel-defined (#2) */ - "pni", NULL, NULL, "monitor", "ds_cpl", "vmx", "smx", "est", - "tm2", "ssse3", "cid", NULL, NULL, "cx16", "xtpr", NULL, -- NULL, NULL, "dca", NULL, NULL, NULL, NULL, "popcnt", -+ NULL, NULL, "dca", "sse4_1", "sse4_2", NULL, NULL, "popcnt", - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, - - /* VIA/Cyrix/Centaur-defined */ -@@ -1230,10 +1304,10 @@ static int show_cpuinfo(struct seq_file - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, - - /* AMD-defined (#2) */ -- "lahf_lm", "cmp_legacy", "svm", "extapic", "cr8_legacy", -- "altmovcr8", "abm", "sse4a", -- "misalignsse", "3dnowprefetch", -- "osvw", "ibs", NULL, NULL, NULL, NULL, -+ "lahf_lm", "cmp_legacy", "svm", "extapic", -+ "cr8_legacy", "abm", "sse4a", "misalignsse", -+ "3dnowprefetch", "osvw", "ibs", "sse5", -+ "skinit", "wdt", NULL, NULL, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, - -@@ -1243,7 +1317,7 @@ static int show_cpuinfo(struct seq_file - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, - }; -- static char *x86_power_flags[] = { -+ static const char *const x86_power_flags[] = { - "ts", /* temperature sensor */ - "fid", /* frequency id control */ - "vid", /* voltage id control */ -@@ -1258,8 +1332,7 @@ static int show_cpuinfo(struct seq_file - - - #ifdef CONFIG_SMP -- if (!cpu_online(c-cpu_data)) -- return 0; -+ cpu = c->cpu_index; - #endif - - seq_printf(m,"processor\t: %u\n" -@@ -1267,7 +1340,7 @@ static int show_cpuinfo(struct seq_file - "cpu family\t: %d\n" - "model\t\t: %d\n" - "model name\t: %s\n", -- (unsigned)(c-cpu_data), -+ (unsigned)cpu, - c->x86_vendor_id[0] ? c->x86_vendor_id : "unknown", - c->x86, - (int)c->x86_model, -@@ -1279,7 +1352,7 @@ static int show_cpuinfo(struct seq_file - seq_printf(m, "stepping\t: unknown\n"); - - if (cpu_has(c,X86_FEATURE_TSC)) { -- unsigned int freq = cpufreq_quick_get((unsigned)(c-cpu_data)); -+ unsigned int freq = cpufreq_quick_get((unsigned)cpu); - if (!freq) - freq = cpu_khz; - seq_printf(m, "cpu MHz\t\t: %u.%03u\n", -@@ -1292,9 +1365,9 @@ static int show_cpuinfo(struct seq_file - - #if defined(CONFIG_SMP) && !defined(CONFIG_XEN) - if (smp_num_siblings * c->x86_max_cores > 1) { -- int cpu = c - cpu_data; - seq_printf(m, "physical id\t: %d\n", c->phys_proc_id); -- seq_printf(m, "siblings\t: %d\n", cpus_weight(cpu_core_map[cpu])); -+ seq_printf(m, "siblings\t: %d\n", -+ cpus_weight(per_cpu(cpu_core_map, cpu))); - seq_printf(m, "core id\t\t: %d\n", c->cpu_core_id); - seq_printf(m, "cpu cores\t: %d\n", c->booted_cores); - } -@@ -1349,12 +1422,16 @@ static int show_cpuinfo(struct seq_file - static void *c_start(struct seq_file *m, loff_t *pos) + static inline int __must_check +-HYPERVISOR_platform_op( +- struct xen_platform_op *platform_op) +-{ +- platform_op->interface_version = XENPF_INTERFACE_VERSION; +- return _hypercall1(int, platform_op, platform_op); +-} +-static inline int __must_check +-HYPERVISOR_mca( +- struct xen_mc *mc_op) +-{ +- mc_op->interface_version = XEN_MCA_INTERFACE_VERSION; +- return _hypercall1(int, mca, mc_op); +-} +-static inline int __must_check +-HYPERVISOR_set_debugreg( +- unsigned int reg, unsigned long value) +-{ +- return _hypercall2(int, set_debugreg, reg, value); +-} +- +-static inline unsigned long __must_check +-HYPERVISOR_get_debugreg( +- unsigned int reg) +-{ +- return _hypercall1(unsigned long, get_debugreg, reg); +-} +- +-static inline int __must_check + HYPERVISOR_update_descriptor( + unsigned long ma, unsigned long word) { -- return *pos < NR_CPUS ? cpu_data + *pos : NULL; -+ if (*pos == 0) /* just in case, cpu 0 is not the first */ -+ *pos = first_cpu(cpu_online_map); -+ if ((*pos) < NR_CPUS && cpu_online(*pos)) -+ return &cpu_data(*pos); -+ return NULL; +@@ -270,22 +30,6 @@ HYPERVISOR_update_descriptor( } - static void *c_next(struct seq_file *m, void *v, loff_t *pos) + static inline int __must_check +-HYPERVISOR_memory_op( +- unsigned int cmd, void *arg) +-{ +- if (arch_use_lazy_mmu_mode()) +- xen_multicall_flush(false); +- return _hypercall2(int, memory_op, cmd, arg); +-} +- +-static inline int __must_check +-HYPERVISOR_multicall( +- multicall_entry_t *call_list, unsigned int nr_calls) +-{ +- return _hypercall2(int, multicall, call_list, nr_calls); +-} +- +-static inline int __must_check + HYPERVISOR_update_va_mapping( + unsigned long va, pte_t new_val, unsigned long flags) { -- ++*pos; -+ *pos = next_cpu(*pos, cpu_online_map); - return c_start(m, pos); +@@ -295,57 +39,6 @@ HYPERVISOR_update_va_mapping( } ---- head.orig/arch/x86/kernel/smp_32-xen.c 2011-01-31 17:49:31.000000000 +0100 -+++ head/arch/x86/kernel/smp_32-xen.c 2011-01-31 17:56:27.000000000 +0100 -@@ -72,7 +72,7 @@ - * - * B stepping CPUs may hang. There are hardware work arounds - * for this. We warn about it in case your board doesn't have the work -- * arounds. Basically thats so I can tell anyone with a B stepping -+ * arounds. Basically that's so I can tell anyone with a B stepping - * CPU and SMP problems "tough". - * - * Specific items [From Pentium Processor Specification Update] -@@ -241,7 +241,7 @@ void leave_mm(unsigned long cpu) - * 1a1) cpu_clear(cpu, old_mm->cpu_vm_mask); - * Stop ipi delivery for the old mm. This is not synchronized with - * the other cpus, but smp_invalidate_interrupt ignore flush ipis -- * for the wrong mm, and in the worst case we perform a superflous -+ * for the wrong mm, and in the worst case we perform a superfluous - * tlb flush. - * 1a2) set cpu_tlbstate to TLBSTATE_OK - * Now the smp_invalidate_interrupt won't call leave_mm if cpu0 -@@ -309,6 +309,7 @@ irqreturn_t smp_invalidate_interrupt(int - smp_mb__after_clear_bit(); - out: - put_cpu_no_resched(); -+ __get_cpu_var(irq_stat).irq_tlb_count++; - - return IRQ_HANDLED; - } -@@ -580,7 +581,7 @@ static void stop_this_cpu (void * dummy) - */ - cpu_clear(smp_processor_id(), cpu_online_map); - disable_all_local_evtchn(); -- if (cpu_data[smp_processor_id()].hlt_works_ok) -+ if (cpu_data(smp_processor_id()).hlt_works_ok) - for(;;) halt(); - for (;;); - } -@@ -610,6 +611,7 @@ void xen_smp_send_stop(void) - */ - irqreturn_t smp_reschedule_interrupt(int irq, void *dev_id) + static inline int __must_check +-HYPERVISOR_event_channel_op( +- int cmd, void *arg) +-{ +- int rc = _hypercall2(int, event_channel_op, cmd, arg); +- +-#if CONFIG_XEN_COMPAT <= 0x030002 +- if (unlikely(rc == -ENOSYS)) +- rc = HYPERVISOR_event_channel_op_compat(cmd, arg); +-#endif +- +- return rc; +-} +- +-static inline int __must_check +-HYPERVISOR_xen_version( +- int cmd, void *arg) +-{ +- return _hypercall2(int, xen_version, cmd, arg); +-} +- +-static inline int __must_check +-HYPERVISOR_console_io( +- int cmd, unsigned int count, char *str) +-{ +- return _hypercall3(int, console_io, cmd, count, str); +-} +- +-static inline int __must_check +-HYPERVISOR_physdev_op( +- int cmd, void *arg) +-{ +- int rc = _hypercall2(int, physdev_op, cmd, arg); +- +-#if CONFIG_XEN_COMPAT <= 0x030002 +- if (unlikely(rc == -ENOSYS)) +- rc = HYPERVISOR_physdev_op_compat(cmd, arg); +-#endif +- +- return rc; +-} +- +-static inline int __must_check +-HYPERVISOR_grant_table_op( +- unsigned int cmd, void *uop, unsigned int count) +-{ +- if (arch_use_lazy_mmu_mode()) +- xen_multicall_flush(false); +- return _hypercall3(int, grant_table_op, cmd, uop, count); +-} +- +-static inline int __must_check + HYPERVISOR_update_va_mapping_otherdomain( + unsigned long va, pte_t new_val, unsigned long flags, domid_t domid) { -+ __get_cpu_var(irq_stat).irq_resched_count++; - - return IRQ_HANDLED; +@@ -354,90 +47,8 @@ HYPERVISOR_update_va_mapping_otherdomain } -@@ -632,6 +634,7 @@ irqreturn_t smp_call_function_interrupt( - */ - irq_enter(); - (*func)(info); -+ __get_cpu_var(irq_stat).irq_call_count++; - irq_exit(); - if (wait) { ---- head.orig/arch/x86/kernel/smp_64-xen.c 2011-01-31 17:49:31.000000000 +0100 -+++ head/arch/x86/kernel/smp_64-xen.c 2011-01-31 17:56:27.000000000 +0100 -@@ -167,6 +167,7 @@ asmlinkage void smp_invalidate_interrupt - out: - ack_APIC_irq(); - cpu_clear(cpu, f->flush_cpumask); -+ add_pda(irq_tlb_count, 1); - } - - static void flush_tlb_others(cpumask_t cpumask, struct mm_struct *mm, -@@ -326,17 +327,27 @@ void unlock_ipi_call_lock(void) + static inline int __must_check +-HYPERVISOR_vm_assist( +- unsigned int cmd, unsigned int type) +-{ +- return _hypercall2(int, vm_assist, cmd, type); +-} +- +-static inline int __must_check +-HYPERVISOR_vcpu_op( +- int cmd, unsigned int vcpuid, void *extra_args) +-{ +- return _hypercall3(int, vcpu_op, cmd, vcpuid, extra_args); +-} +- +-static inline int __must_check + HYPERVISOR_set_segment_base( + int reg, unsigned long value) + { + return _hypercall2(int, set_segment_base, reg, value); } +- +-static inline int __must_check +-HYPERVISOR_suspend( +- unsigned long srec) +-{ +- struct sched_shutdown sched_shutdown = { +- .reason = SHUTDOWN_suspend +- }; +- +- int rc = _hypercall3(int, sched_op, SCHEDOP_shutdown, +- &sched_shutdown, srec); +- +-#if CONFIG_XEN_COMPAT <= 0x030002 +- if (rc == -ENOSYS) +- rc = _hypercall3(int, sched_op_compat, SCHEDOP_shutdown, +- SHUTDOWN_suspend, srec); +-#endif +- +- return rc; +-} +- +-#if CONFIG_XEN_COMPAT <= 0x030002 +-static inline int +-HYPERVISOR_nmi_op( +- unsigned long op, void *arg) +-{ +- return _hypercall2(int, nmi_op, op, arg); +-} +-#endif +- +-#ifndef CONFIG_XEN +-static inline unsigned long __must_check +-HYPERVISOR_hvm_op( +- int op, void *arg) +-{ +- return _hypercall2(unsigned long, hvm_op, op, arg); +-} +-#endif +- +-static inline int __must_check +-HYPERVISOR_callback_op( +- int cmd, const void *arg) +-{ +- return _hypercall2(int, callback_op, cmd, arg); +-} +- +-static inline int __must_check +-HYPERVISOR_xenoprof_op( +- int op, void *arg) +-{ +- return _hypercall2(int, xenoprof_op, op, arg); +-} +- +-static inline int __must_check +-HYPERVISOR_kexec_op( +- unsigned long op, void *args) +-{ +- return _hypercall2(int, kexec_op, op, args); +-} +- +-static inline int __must_check +-HYPERVISOR_tmem_op( +- struct tmem_op *op) +-{ +- return _hypercall1(int, tmem_op, op); +-} +- +-#endif /* __HYPERCALL_H__ */ +--- a/arch/x86/include/mach-xen/asm/hypervisor.h ++++ b/arch/x86/include/mach-xen/asm/hypervisor.h +@@ -38,10 +38,7 @@ + #include + #include + #include +-#include + #include +-#include +-#include + #include + #include + #include +@@ -198,7 +195,6 @@ static inline void xen_multicall_flush(b + extern char hypercall_page[PAGE_SIZE]; + #else + extern char *hypercall_stubs; +-#define hypercall_page hypercall_stubs + #define is_running_on_xen() (!!hypercall_stubs) + #endif - /* -- * this function sends a 'generic call function' IPI to one other CPU -- * in the system. -- * -- * cpu is a standard Linux logical CPU number. -+ * this function sends a 'generic call function' IPI to all other CPU -+ * of the system defined in the mask. - */ --static void --__smp_call_function_single(int cpu, void (*func) (void *info), void *info, -- int nonatomic, int wait) -+ -+static int -+__smp_call_function_mask(cpumask_t mask, -+ void (*func)(void *), void *info, -+ int wait) - { - struct call_data_struct data; -- int cpus = 1; -+ cpumask_t allbutself; -+ int cpus; -+ -+ allbutself = cpu_online_map; -+ cpu_clear(smp_processor_id(), allbutself); +--- /dev/null ++++ b/arch/x86/include/mach-xen/asm/io.h +@@ -0,0 +1,5 @@ ++#ifdef CONFIG_X86_32 ++# include "io_32.h" ++#else ++# include "io_64.h" ++#endif +--- /dev/null ++++ b/arch/x86/include/mach-xen/asm/irqflags.h +@@ -0,0 +1,5 @@ ++#ifdef CONFIG_X86_32 ++# include "irqflags_32.h" ++#else ++# include "irqflags_64.h" ++#endif +--- a/arch/x86/include/mach-xen/asm/irqflags_32.h ++++ b/arch/x86/include/mach-xen/asm/irqflags_32.h +@@ -150,6 +150,23 @@ static inline int raw_irqs_disabled_flag + \ + raw_irqs_disabled_flags(flags); \ + }) + -+ cpus_and(mask, mask, allbutself); -+ cpus = cpus_weight(mask); ++/* ++ * makes the traced hardirq state match with the machine state ++ * ++ * should be a rarely used function, only in places where its ++ * otherwise impossible to know the irq state, like in traps. ++ */ ++static inline void trace_hardirqs_fixup_flags(unsigned long flags) ++{ ++ if (raw_irqs_disabled_flags(flags)) ++ trace_hardirqs_off(); ++ else ++ trace_hardirqs_on(); ++} + -+ if (!cpus) -+ return 0; ++#define trace_hardirqs_fixup() \ ++ trace_hardirqs_fixup_flags(__raw_local_save_flags()) + #endif /* __ASSEMBLY__ */ - data.func = func; - data.info = info; -@@ -347,19 +358,55 @@ __smp_call_function_single(int cpu, void + /* +@@ -181,4 +198,17 @@ static inline int raw_irqs_disabled_flag + # define TRACE_IRQS_OFF + #endif - call_data = &data; - wmb(); -- /* Send a message to all other CPUs and wait for them to respond */ -- send_IPI_mask(cpumask_of_cpu(cpu), CALL_FUNCTION_VECTOR); ++#ifdef CONFIG_DEBUG_LOCK_ALLOC ++# define LOCKDEP_SYS_EXIT \ ++ pushl %eax; \ ++ pushl %ecx; \ ++ pushl %edx; \ ++ call lockdep_sys_exit; \ ++ popl %edx; \ ++ popl %ecx; \ ++ popl %eax; ++#else ++# define LOCKDEP_SYS_EXIT ++#endif + -+ /* Send a message to other CPUs */ -+ if (cpus_equal(mask, allbutself)) -+ send_IPI_allbutself(CALL_FUNCTION_VECTOR); -+ else -+ send_IPI_mask(mask, CALL_FUNCTION_VECTOR); - - /* Wait for response */ - while (atomic_read(&data.started) != cpus) - cpu_relax(); - - if (!wait) -- return; -+ return 0; + #endif +--- a/arch/x86/include/mach-xen/asm/irqflags_64.h ++++ b/arch/x86/include/mach-xen/asm/irqflags_64.h +@@ -116,6 +116,22 @@ static inline int raw_irqs_disabled_flag + }) - while (atomic_read(&data.finished) != cpus) - cpu_relax(); -+ -+ return 0; -+} -+/** -+ * smp_call_function_mask(): Run a function on a set of other CPUs. -+ * @mask: The set of cpus to run on. Must not include the current cpu. -+ * @func: The function to run. This must be fast and non-blocking. -+ * @info: An arbitrary pointer to pass to the function. -+ * @wait: If true, wait (atomically) until function has completed on other CPUs. -+ * -+ * Returns 0 on success, else a negative status code. -+ * -+ * If @wait is true, then returns once @func has returned; otherwise -+ * it returns just before the target cpu calls @func. + /* ++ * makes the traced hardirq state match with the machine state + * -+ * You must not call this function with disabled interrupts or from a -+ * hardware interrupt handler or from a bottom half handler. ++ * should be a rarely used function, only in places where its ++ * otherwise impossible to know the irq state, like in traps. + */ -+int smp_call_function_mask(cpumask_t mask, -+ void (*func)(void *), void *info, -+ int wait) ++static inline void trace_hardirqs_fixup_flags(unsigned long flags) +{ -+ int ret; -+ -+ /* Can deadlock when called with interrupts disabled */ -+ WARN_ON(irqs_disabled()); ++ if (raw_irqs_disabled_flags(flags)) ++ trace_hardirqs_off(); ++ else ++ trace_hardirqs_on(); ++} + -+ spin_lock(&call_lock); -+ ret = __smp_call_function_mask(mask, func, info, wait); -+ spin_unlock(&call_lock); -+ return ret; - } -+EXPORT_SYMBOL(smp_call_function_mask); - - /* - * smp_call_function_single - Run a function on a specific CPU -@@ -378,6 +425,7 @@ int smp_call_function_single (int cpu, v - int nonatomic, int wait) - { - /* prevent preemption and reschedule on another processor */ -+ int ret; - int me = get_cpu(); - - /* Can deadlock when called with interrupts disabled */ -@@ -391,51 +439,14 @@ int smp_call_function_single (int cpu, v - return 0; - } ++#define trace_hardirqs_fixup() \ ++ trace_hardirqs_fixup_flags(__raw_local_save_flags()) ++/* + * Used in the idle loop; sti takes one instruction cycle + * to complete: + */ +@@ -143,6 +159,20 @@ static inline void halt(void) + # define TRACE_IRQS_ON + # define TRACE_IRQS_OFF + # endif ++# ifdef CONFIG_DEBUG_LOCK_ALLOC ++# define LOCKDEP_SYS_EXIT call lockdep_sys_exit_thunk ++# define LOCKDEP_SYS_EXIT_IRQ \ ++ TRACE_IRQS_ON; \ ++ sti; \ ++ SAVE_REST; \ ++ LOCKDEP_SYS_EXIT; \ ++ RESTORE_REST; \ ++ cli; \ ++ TRACE_IRQS_OFF; ++# else ++# define LOCKDEP_SYS_EXIT ++# define LOCKDEP_SYS_EXIT_IRQ ++# endif + #endif -- spin_lock(&call_lock); -- __smp_call_function_single(cpu, func, info, nonatomic, wait); -- spin_unlock(&call_lock); -+ ret = smp_call_function_mask(cpumask_of_cpu(cpu), func, info, wait); + #endif +--- /dev/null ++++ b/arch/x86/include/mach-xen/asm/maddr.h +@@ -0,0 +1,5 @@ ++#ifdef CONFIG_X86_32 ++# include "maddr_32.h" ++#else ++# include "maddr_64.h" ++#endif +--- /dev/null ++++ b/arch/x86/include/mach-xen/asm/mmu_context.h +@@ -0,0 +1,5 @@ ++#ifdef CONFIG_X86_32 ++# include "mmu_context_32.h" ++#else ++# include "mmu_context_64.h" ++#endif +--- /dev/null ++++ b/arch/x86/include/mach-xen/asm/pci.h +@@ -0,0 +1,100 @@ ++#ifndef __x86_PCI_H ++#define __x86_PCI_H + - put_cpu(); -- return 0; -+ return ret; ++#include /* for struct page */ ++#include ++#include ++#include ++#include ++#include ++ ++ ++#ifdef __KERNEL__ ++ ++struct pci_sysdata { ++ int domain; /* PCI domain */ ++ int node; /* NUMA node */ ++#ifdef CONFIG_X86_64 ++ void* iommu; /* IOMMU private data */ ++#endif ++#ifdef CONFIG_XEN_PCIDEV_FRONTEND ++ struct pcifront_device *pdev; ++#endif ++}; ++ ++/* scan a bus after allocating a pci_sysdata for it */ ++extern struct pci_bus *pci_scan_bus_with_sysdata(int busno); ++ ++static inline int pci_domain_nr(struct pci_bus *bus) ++{ ++ struct pci_sysdata *sd = bus->sysdata; ++ return sd->domain; ++} ++ ++static inline int pci_proc_domain(struct pci_bus *bus) ++{ ++ return pci_domain_nr(bus); ++} ++ ++ ++/* Can be used to override the logic in pci_scan_bus for skipping ++ already-configured bus numbers - to be used for buggy BIOSes ++ or architectures with incomplete PCI setup by the loader */ ++ ++#ifdef CONFIG_PCI ++extern unsigned int pcibios_assign_all_busses(void); ++#else ++#define pcibios_assign_all_busses() 0 ++#endif ++ ++#include ++#define pcibios_scan_all_fns(a, b) (!is_initial_xendomain()) ++ ++extern unsigned long pci_mem_start; ++#define PCIBIOS_MIN_IO 0x1000 ++#define PCIBIOS_MIN_MEM (pci_mem_start) ++ ++#define PCIBIOS_MIN_CARDBUS_IO 0x4000 ++ ++void pcibios_config_init(void); ++struct pci_bus * pcibios_scan_root(int bus); ++ ++void pcibios_set_master(struct pci_dev *dev); ++void pcibios_penalize_isa_irq(int irq, int active); ++struct irq_routing_table *pcibios_get_irq_routing_table(void); ++int pcibios_set_irq_routing(struct pci_dev *dev, int pin, int irq); ++ ++ ++#define HAVE_PCI_MMAP ++extern int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma, ++ enum pci_mmap_state mmap_state, int write_combine); ++ ++ ++#ifdef CONFIG_PCI ++static inline void pci_dma_burst_advice(struct pci_dev *pdev, ++ enum pci_dma_burst_strategy *strat, ++ unsigned long *strategy_parameter) ++{ ++ *strat = PCI_DMA_BURST_INFINITY; ++ *strategy_parameter = ~0UL; ++} ++#endif ++ ++ ++#endif /* __KERNEL__ */ ++ ++#ifdef CONFIG_X86_32 ++# include "pci_32.h" ++#else ++# include "pci_64.h" ++#endif ++ ++/* implement the pci_ DMA API in terms of the generic device dma_ one */ ++#include ++ ++/* generic pci stuff */ ++#include ++ ++ ++ ++#endif +--- /dev/null ++++ b/arch/x86/include/mach-xen/asm/pgalloc.h +@@ -0,0 +1,5 @@ ++#ifdef CONFIG_X86_32 ++# include "pgalloc_32.h" ++#else ++# include "pgalloc_64.h" ++#endif +--- a/arch/x86/include/mach-xen/asm/pgalloc_64.h ++++ b/arch/x86/include/mach-xen/asm/pgalloc_64.h +@@ -115,6 +115,8 @@ static inline void pgd_list_del(pgd_t *p + spin_unlock(&pgd_lock); } - EXPORT_SYMBOL(smp_call_function_single); - /* -- * this function sends a 'generic call function' IPI to all other CPUs -- * in the system. -- */ --static void __smp_call_function (void (*func) (void *info), void *info, -- int nonatomic, int wait) --{ -- struct call_data_struct data; -- int cpus = num_online_cpus()-1; -- -- if (!cpus) -- return; -- -- data.func = func; -- data.info = info; -- atomic_set(&data.started, 0); -- data.wait = wait; -- if (wait) -- atomic_set(&data.finished, 0); ++extern void pgd_test_and_unpin(pgd_t *); ++ + static inline pgd_t *pgd_alloc(struct mm_struct *mm) + { + /* +@@ -126,6 +128,7 @@ static inline pgd_t *pgd_alloc(struct mm + pgd = (pgd_t *)__get_free_pages(GFP_KERNEL|__GFP_REPEAT|__GFP_ZERO, 1); + if (!pgd) + return NULL; ++ pgd_test_and_unpin(pgd); + pgd_list_add(pgd, mm); + /* + * Copy kernel pointers in from init. +@@ -147,29 +150,8 @@ static inline pgd_t *pgd_alloc(struct mm + + static inline void pgd_free(pgd_t *pgd) + { +- pte_t *ptep = virt_to_ptep(pgd); - -- call_data = &data; -- wmb(); -- /* Send a message to all other CPUs and wait for them to respond */ -- send_IPI_allbutself(CALL_FUNCTION_VECTOR); + pgd_list_del(pgd); - -- /* Wait for response */ -- while (atomic_read(&data.started) != cpus) -- cpu_relax(); +- if (!pte_write(*ptep)) { +- xen_pgd_unpin(__pa(pgd)); +- BUG_ON(HYPERVISOR_update_va_mapping( +- (unsigned long)pgd, +- pfn_pte(virt_to_phys(pgd)>>PAGE_SHIFT, PAGE_KERNEL), +- 0)); +- } - -- if (!wait) -- return; +- ptep = virt_to_ptep(__user_pgd(pgd)); - -- while (atomic_read(&data.finished) != cpus) -- cpu_relax(); --} +- if (!pte_write(*ptep)) { +- xen_pgd_unpin(__pa(__user_pgd(pgd))); +- BUG_ON(HYPERVISOR_update_va_mapping( +- (unsigned long)__user_pgd(pgd), +- pfn_pte(virt_to_phys(__user_pgd(pgd))>>PAGE_SHIFT, +- PAGE_KERNEL), +- 0)); +- } - --/* - * smp_call_function - run a function on all other CPUs. - * @func: The function to run. This must be fast and non-blocking. - * @info: An arbitrary pointer to pass to the function. -@@ -453,10 +464,7 @@ static void __smp_call_function (void (* - int smp_call_function (void (*func) (void *info), void *info, int nonatomic, - int wait) - { -- spin_lock(&call_lock); -- __smp_call_function(func,info,nonatomic,wait); -- spin_unlock(&call_lock); -- return 0; -+ return smp_call_function_mask(cpu_online_map, func, info, wait); ++ pgd_test_and_unpin(pgd); + free_pages((unsigned long)pgd, 1); } - EXPORT_SYMBOL(smp_call_function); -@@ -485,7 +493,7 @@ void smp_send_stop(void) - /* Don't deadlock on the call lock in panic */ - nolock = !spin_trylock(&call_lock); - local_irq_save(flags); -- __smp_call_function(stop_this_cpu, NULL, 0, 0); -+ __smp_call_function_mask(cpu_online_map, stop_this_cpu, NULL, 0); - if (!nolock) - spin_unlock(&call_lock); - disable_all_local_evtchn(); -@@ -505,7 +513,9 @@ asmlinkage irqreturn_t smp_reschedule_in - { - #ifndef CONFIG_XEN - ack_APIC_irq(); --#else +--- /dev/null ++++ b/arch/x86/include/mach-xen/asm/pgtable.h +@@ -0,0 +1,5 @@ ++#ifdef CONFIG_X86_32 ++# include "pgtable_32.h" ++#else ++# include "pgtable_64.h" +#endif -+ add_pda(irq_resched_count, 1); -+#ifdef CONFIG_XEN - return IRQ_HANDLED; - #endif - } -@@ -535,6 +545,7 @@ asmlinkage irqreturn_t smp_call_function - exit_idle(); - irq_enter(); - (*func)(info); -+ add_pda(irq_call_count, 1); - irq_exit(); - if (wait) { - mb(); ---- head.orig/arch/x86/kernel/time-xen.c 2012-02-10 13:26:46.000000000 +0100 -+++ head/arch/x86/kernel/time-xen.c 2012-02-10 13:26:53.000000000 +0100 -@@ -1,6 +1,4 @@ - /* -- * linux/arch/i386/kernel/time.c -- * - * Copyright (C) 1991, 1992, 1995 Linus Torvalds - * - * This file contains the PC-specific time handling details: -@@ -72,6 +70,7 @@ - #include - - #include -+#include - #include - - #include -@@ -369,7 +368,6 @@ int xen_update_wallclock(const struct ti +--- a/arch/x86/include/mach-xen/asm/pgtable_32.h ++++ b/arch/x86/include/mach-xen/asm/pgtable_32.h +@@ -17,10 +17,7 @@ + #include + #include - return 0; - } +-#ifndef _I386_BITOPS_H +-#include -#endif +- ++#include + #include + #include + #include +@@ -40,7 +37,7 @@ extern spinlock_t pgd_lock; + extern struct page *pgd_list; + void check_pgt_cache(void); - static void sync_xen_wallclock(unsigned long dummy); - static DEFINE_TIMER(sync_xen_wallclock_timer, sync_xen_wallclock, 0, 0); -@@ -418,6 +416,7 @@ static int set_rtc_mmss(unsigned long no - - return retval; - } -+#endif /* CONFIG_XEN_PRIVILEGED_GUEST */ - - static unsigned long long local_clock(void) - { -@@ -547,6 +546,13 @@ irqreturn_t timer_interrupt(int irq, voi - struct shadow_time_info *shadow = &per_cpu(shadow_time, cpu); - struct vcpu_runstate_info runstate; +-void pmd_ctor(void *, struct kmem_cache *, unsigned long); ++void pmd_ctor(struct kmem_cache *, void *); + void pgtable_cache_init(void); + void paging_init(void); -+ /* Keep nmi watchdog up to date */ -+#ifdef __i386__ -+ per_cpu(irq_stat, smp_processor_id()).irq0_irqs++; +--- a/arch/x86/include/mach-xen/asm/pgtable_64.h ++++ b/arch/x86/include/mach-xen/asm/pgtable_64.h +@@ -9,7 +9,7 @@ + * the x86-64 page table tree. + */ + #include +-#include ++#include + #include + #include + #include +@@ -139,6 +139,7 @@ static inline void pgd_clear (pgd_t * pg + #define MAXMEM _AC(0x6fffffffff, UL) + #define VMALLOC_START _AC(0xffffc20000000000, UL) + #define VMALLOC_END _AC(0xffffe1ffffffffff, UL) ++#define VMEMMAP_START _AC(0xffffe20000000000, UL) + #define MODULES_VADDR _AC(0xffffffff88000000, UL) + #define MODULES_END _AC(0xffffffffff000000, UL) + #define MODULES_LEN (MODULES_END - MODULES_VADDR) +--- /dev/null ++++ b/arch/x86/include/mach-xen/asm/processor.h +@@ -0,0 +1,5 @@ ++#ifdef CONFIG_X86_32 ++# include "processor_32.h" +#else -+ add_pda(irq0_irqs, 1); ++# include "processor_64.h" +#endif -+ - /* - * Here we are in the timer irq handler. We just have irqs locally - * disabled but we don't know if the timer_bh is running on the other -@@ -775,8 +781,12 @@ unsigned long read_persistent_clock(void - - int update_persistent_clock(struct timespec now) - { -+#ifdef CONFIG_XEN_PRIVILEGED_GUEST - mod_timer(&sync_xen_wallclock_timer, jiffies + 1); - return set_rtc_mmss(now.tv_sec); -+#else -+ return 0; +--- a/arch/x86/include/mach-xen/asm/processor_32.h ++++ b/arch/x86/include/mach-xen/asm/processor_32.h +@@ -70,17 +70,22 @@ struct cpuinfo_x86 { + char pad0; + int x86_power; + unsigned long loops_per_jiffy; ++#ifndef CONFIG_XEN + #ifdef CONFIG_SMP + cpumask_t llc_shared_map; /* cpus sharing the last level cache */ + #endif + unsigned char x86_max_cores; /* cpuid returned max cores value */ + unsigned char apicid; +#endif - } - - extern void (*late_time_init)(void); -@@ -1023,7 +1033,7 @@ static int time_cpufreq_notifier(struct - struct cpufreq_freqs *freq = data; - struct xen_platform_op op; - -- if (cpu_has(&cpu_data[freq->cpu], X86_FEATURE_CONSTANT_TSC)) -+ if (cpu_has(&cpu_data(freq->cpu), X86_FEATURE_CONSTANT_TSC)) - return 0; - - if (val == CPUFREQ_PRECHANGE) -@@ -1061,30 +1071,33 @@ core_initcall(cpufreq_time_setup); - */ - static ctl_table xen_subtable[] = { - { -- .ctl_name = 1, -+ .ctl_name = CTL_XEN_INDEPENDENT_WALLCLOCK, - .procname = "independent_wallclock", - .data = &independent_wallclock, - .maxlen = sizeof(independent_wallclock), - .mode = 0644, -+ .strategy = sysctl_data, - .proc_handler = proc_dointvec - }, - { -- .ctl_name = 2, -+ .ctl_name = CTL_XEN_PERMITTED_CLOCK_JITTER, - .procname = "permitted_clock_jitter", - .data = &permitted_clock_jitter, - .maxlen = sizeof(permitted_clock_jitter), - .mode = 0644, -+ .strategy = sysctl_data, - .proc_handler = proc_doulongvec_minmax - }, -- { 0 } -+ { } - }; - static ctl_table xen_table[] = { - { -- .ctl_name = 123, -+ .ctl_name = CTL_XEN, - .procname = "xen", - .mode = 0555, -- .child = xen_subtable}, -- { 0 } -+ .child = xen_subtable -+ }, -+ { } - }; - static int __init xen_sysctl_init(void) - { ---- head.orig/arch/x86/kernel/traps_32-xen.c 2012-06-18 09:23:11.000000000 +0200 -+++ head/arch/x86/kernel/traps_32-xen.c 2012-07-05 10:50:00.000000000 +0200 -@@ -1,6 +1,4 @@ - /* -- * linux/arch/i386/traps.c -- * - * Copyright (C) 1991, 1992 Linus Torvalds - * - * Pentium III FXSR, SSE support -@@ -65,6 +63,11 @@ + unsigned short x86_clflush_size; +-#ifdef CONFIG_SMP ++#ifdef CONFIG_X86_HT + unsigned char booted_cores; /* number of cores as seen by OS */ + __u8 phys_proc_id; /* Physical processor id. */ + __u8 cpu_core_id; /* Core id */ + #endif ++#ifdef CONFIG_SMP ++ __u8 cpu_index; /* index into per_cpu list */ ++#endif + } __attribute__((__aligned__(SMP_CACHE_BYTES))); - int panic_on_unrecovered_nmi; + #define X86_VENDOR_INTEL 0 +@@ -106,14 +111,19 @@ DECLARE_PER_CPU(struct tss_struct, init_ + #endif -+#ifndef CONFIG_XEN -+DECLARE_BITMAP(used_vectors, NR_VECTORS); -+EXPORT_SYMBOL_GPL(used_vectors); -+#endif -+ - asmlinkage int system_call(void); + #ifdef CONFIG_SMP +-extern struct cpuinfo_x86 cpu_data[]; +-#define current_cpu_data cpu_data[smp_processor_id()] ++DECLARE_PER_CPU(struct cpuinfo_x86, cpu_info); ++#define cpu_data(cpu) per_cpu(cpu_info, cpu) ++#define current_cpu_data cpu_data(smp_processor_id()) + #else +-#define cpu_data (&boot_cpu_data) +-#define current_cpu_data boot_cpu_data ++#define cpu_data(cpu) boot_cpu_data ++#define current_cpu_data boot_cpu_data + #endif - /* Do we ignore FPU interrupts ? */ -@@ -120,7 +123,7 @@ struct stack_frame { +-extern int cpu_llc_id[NR_CPUS]; ++/* ++ * the following now lives in the per cpu area: ++ * extern int cpu_llc_id[NR_CPUS]; ++ */ ++DECLARE_PER_CPU(u8, cpu_llc_id); + extern char ignore_fpu_irq; - static inline unsigned long print_context_stack(struct thread_info *tinfo, - unsigned long *stack, unsigned long ebp, -- struct stacktrace_ops *ops, void *data) -+ const struct stacktrace_ops *ops, void *data) + void __init cpu_detect(struct cpuinfo_x86 *c); +@@ -560,7 +570,9 @@ static inline void xen_set_iopl_mask(uns + * clear %ecx since some cpus (Cyrix MII) do not set or clear %ecx + * resulting in stale register contents being returned. + */ +-static inline void cpuid(unsigned int op, unsigned int *eax, unsigned int *ebx, unsigned int *ecx, unsigned int *edx) ++static inline void cpuid(unsigned int op, ++ unsigned int *eax, unsigned int *ebx, ++ unsigned int *ecx, unsigned int *edx) { - #ifdef CONFIG_FRAME_POINTER - struct stack_frame *frame = (struct stack_frame *)ebp; -@@ -157,7 +160,7 @@ static inline unsigned long print_contex + *eax = op; + *ecx = 0; +@@ -568,8 +580,9 @@ static inline void cpuid(unsigned int op + } - void dump_trace(struct task_struct *task, struct pt_regs *regs, - unsigned long *stack, -- struct stacktrace_ops *ops, void *data) -+ const struct stacktrace_ops *ops, void *data) + /* Some CPUID calls want 'count' to be placed in ecx */ +-static inline void cpuid_count(int op, int count, int *eax, int *ebx, int *ecx, +- int *edx) ++static inline void cpuid_count(unsigned int op, int count, ++ unsigned int *eax, unsigned int *ebx, ++ unsigned int *ecx, unsigned int *edx) { - unsigned long ebp = 0; + *eax = op; + *ecx = count; +@@ -639,6 +652,17 @@ static inline unsigned int cpuid_edx(uns + #define K7_NOP7 ".byte 0x8D,0x04,0x05,0,0,0,0\n" + #define K7_NOP8 K7_NOP7 ASM_NOP1 -@@ -229,7 +232,7 @@ static void print_trace_address(void *da - touch_nmi_watchdog(); - } ++/* P6 nops */ ++/* uses eax dependencies (Intel-recommended choice) */ ++#define P6_NOP1 GENERIC_NOP1 ++#define P6_NOP2 ".byte 0x66,0x90\n" ++#define P6_NOP3 ".byte 0x0f,0x1f,0x00\n" ++#define P6_NOP4 ".byte 0x0f,0x1f,0x40,0\n" ++#define P6_NOP5 ".byte 0x0f,0x1f,0x44,0x00,0\n" ++#define P6_NOP6 ".byte 0x66,0x0f,0x1f,0x44,0x00,0\n" ++#define P6_NOP7 ".byte 0x0f,0x1f,0x80,0,0,0,0\n" ++#define P6_NOP8 ".byte 0x0f,0x1f,0x84,0x00,0,0,0,0\n" ++ + #ifdef CONFIG_MK8 + #define ASM_NOP1 K8_NOP1 + #define ASM_NOP2 K8_NOP2 +@@ -657,6 +681,17 @@ static inline unsigned int cpuid_edx(uns + #define ASM_NOP6 K7_NOP6 + #define ASM_NOP7 K7_NOP7 + #define ASM_NOP8 K7_NOP8 ++#elif defined(CONFIG_M686) || defined(CONFIG_MPENTIUMII) || \ ++ defined(CONFIG_MPENTIUMIII) || defined(CONFIG_MPENTIUMM) || \ ++ defined(CONFIG_MCORE2) || defined(CONFIG_PENTIUM4) ++#define ASM_NOP1 P6_NOP1 ++#define ASM_NOP2 P6_NOP2 ++#define ASM_NOP3 P6_NOP3 ++#define ASM_NOP4 P6_NOP4 ++#define ASM_NOP5 P6_NOP5 ++#define ASM_NOP6 P6_NOP6 ++#define ASM_NOP7 P6_NOP7 ++#define ASM_NOP8 P6_NOP8 + #else + #define ASM_NOP1 GENERIC_NOP1 + #define ASM_NOP2 GENERIC_NOP2 +--- a/arch/x86/include/mach-xen/asm/processor_64.h ++++ b/arch/x86/include/mach-xen/asm/processor_64.h +@@ -62,19 +62,26 @@ struct cpuinfo_x86 { + int x86_cache_alignment; + int x86_tlbsize; /* number of 4K pages in DTLB/ITLB combined(in pages)*/ + __u8 x86_virt_bits, x86_phys_bits; ++#ifndef CONFIG_XEN + __u8 x86_max_cores; /* cpuid returned max cores value */ ++#endif + __u32 x86_power; + __u32 extended_cpuid_level; /* Max extended CPUID function supported */ + unsigned long loops_per_jiffy; +-#ifdef CONFIG_SMP ++#if defined(CONFIG_SMP) && !defined(CONFIG_XEN) + cpumask_t llc_shared_map; /* cpus sharing the last level cache */ + #endif ++#ifndef CONFIG_XEN + __u8 apicid; +-#ifdef CONFIG_SMP ++#endif ++#ifdef CONFIG_X86_HT + __u8 booted_cores; /* number of cores as seen by OS */ + __u8 phys_proc_id; /* Physical Processor id. */ + __u8 cpu_core_id; /* Core id. */ + #endif ++#ifdef CONFIG_SMP ++ __u8 cpu_index; /* index into per_cpu list */ ++#endif + } ____cacheline_aligned; --static struct stacktrace_ops print_trace_ops = { -+static const struct stacktrace_ops print_trace_ops = { - .warning = print_trace_warning, - .warning_symbol = print_trace_warning_symbol, - .stack = print_trace_stack, -@@ -288,6 +291,11 @@ void dump_stack(void) - { - unsigned long stack; + #define X86_VENDOR_INTEL 0 +@@ -88,11 +95,12 @@ struct cpuinfo_x86 { + #define X86_VENDOR_UNKNOWN 0xff -+ printk("Pid: %d, comm: %.20s %s %s %.*s\n", -+ current->pid, current->comm, print_tainted(), -+ init_utsname()->release, -+ (int)strcspn(init_utsname()->version, " "), -+ init_utsname()->version); - show_trace(current, NULL, &stack); - } + #ifdef CONFIG_SMP +-extern struct cpuinfo_x86 cpu_data[]; +-#define current_cpu_data cpu_data[smp_processor_id()] ++DECLARE_PER_CPU(struct cpuinfo_x86, cpu_info); ++#define cpu_data(cpu) per_cpu(cpu_info, cpu) ++#define current_cpu_data cpu_data(smp_processor_id()) + #else +-#define cpu_data (&boot_cpu_data) +-#define current_cpu_data boot_cpu_data ++#define cpu_data(cpu) boot_cpu_data ++#define current_cpu_data boot_cpu_data + #endif -@@ -296,48 +304,24 @@ EXPORT_SYMBOL(dump_stack); - void show_registers(struct pt_regs *regs) - { - int i; -- int in_kernel = 1; -- unsigned long esp; -- unsigned short ss, gs; -- -- esp = (unsigned long) (®s->esp); -- savesegment(ss, ss); -- savesegment(gs, gs); -- if (user_mode_vm(regs)) { -- in_kernel = 0; -- esp = regs->esp; -- ss = regs->xss & 0xffff; -- } -+ - print_modules(); -- printk(KERN_EMERG "CPU: %d\n" -- KERN_EMERG "EIP: %04x:[<%08lx>] %s VLI\n" -- KERN_EMERG "EFLAGS: %08lx (%s %.*s)\n", -- smp_processor_id(), 0xffff & regs->xcs, regs->eip, -- print_tainted(), regs->eflags, init_utsname()->release, -- (int)strcspn(init_utsname()->version, " "), -- init_utsname()->version); -- print_symbol(KERN_EMERG "EIP is at %s\n", regs->eip); -- printk(KERN_EMERG "eax: %08lx ebx: %08lx ecx: %08lx edx: %08lx\n", -- regs->eax, regs->ebx, regs->ecx, regs->edx); -- printk(KERN_EMERG "esi: %08lx edi: %08lx ebp: %08lx esp: %08lx\n", -- regs->esi, regs->edi, regs->ebp, esp); -- printk(KERN_EMERG "ds: %04x es: %04x fs: %04x gs: %04x ss: %04x\n", -- regs->xds & 0xffff, regs->xes & 0xffff, regs->xfs & 0xffff, gs, ss); -+ __show_registers(regs, 0); - printk(KERN_EMERG "Process %.*s (pid: %d, ti=%p task=%p task.ti=%p)", -- TASK_COMM_LEN, current->comm, current->pid, -+ TASK_COMM_LEN, current->comm, task_pid_nr(current), - current_thread_info(), current, task_thread_info(current)); - /* - * When in-kernel, we also print out the stack and code at the - * time of the fault.. - */ -- if (in_kernel) { -+ if (!user_mode_vm(regs)) { - u8 *eip; - unsigned int code_prologue = code_bytes * 43 / 64; - unsigned int code_len = code_bytes; - unsigned char c; + extern char ignore_irq13; +@@ -343,6 +351,16 @@ struct extended_sigtable { + }; - printk("\n" KERN_EMERG "Stack: "); -- show_stack_log_lvl(NULL, regs, (unsigned long *)esp, KERN_EMERG); -+ show_stack_log_lvl(NULL, regs, ®s->esp, KERN_EMERG); - printk(KERN_EMERG "Code: "); ++#if defined(CONFIG_MPSC) || defined(CONFIG_MCORE2) ++#define ASM_NOP1 P6_NOP1 ++#define ASM_NOP2 P6_NOP2 ++#define ASM_NOP3 P6_NOP3 ++#define ASM_NOP4 P6_NOP4 ++#define ASM_NOP5 P6_NOP5 ++#define ASM_NOP6 P6_NOP6 ++#define ASM_NOP7 P6_NOP7 ++#define ASM_NOP8 P6_NOP8 ++#else + #define ASM_NOP1 K8_NOP1 + #define ASM_NOP2 K8_NOP2 + #define ASM_NOP3 K8_NOP3 +@@ -351,6 +369,7 @@ struct extended_sigtable { + #define ASM_NOP6 K8_NOP6 + #define ASM_NOP7 K8_NOP7 + #define ASM_NOP8 K8_NOP8 ++#endif -@@ -382,11 +366,11 @@ int is_valid_bugaddr(unsigned long eip) - void die(const char * str, struct pt_regs * regs, long err) - { - static struct { -- spinlock_t lock; -+ raw_spinlock_t lock; - u32 lock_owner; - int lock_owner_depth; - } die = { -- .lock = __SPIN_LOCK_UNLOCKED(die.lock), -+ .lock = __RAW_SPIN_LOCK_UNLOCKED, - .lock_owner = -1, - .lock_owner_depth = 0 - }; -@@ -397,40 +381,33 @@ void die(const char * str, struct pt_reg + /* Opteron nops */ + #define K8_NOP1 ".byte 0x90\n" +@@ -362,6 +381,17 @@ struct extended_sigtable { + #define K8_NOP7 K8_NOP4 K8_NOP3 + #define K8_NOP8 K8_NOP4 K8_NOP4 - if (die.lock_owner != raw_smp_processor_id()) { - console_verbose(); -- spin_lock_irqsave(&die.lock, flags); -+ raw_local_irq_save(flags); -+ __raw_spin_lock(&die.lock); - die.lock_owner = smp_processor_id(); - die.lock_owner_depth = 0; - bust_spinlocks(1); -- } -- else -- local_save_flags(flags); -+ } else -+ raw_local_irq_save(flags); ++/* P6 nops */ ++/* uses eax dependencies (Intel-recommended choice) */ ++#define P6_NOP1 ".byte 0x90\n" ++#define P6_NOP2 ".byte 0x66,0x90\n" ++#define P6_NOP3 ".byte 0x0f,0x1f,0x00\n" ++#define P6_NOP4 ".byte 0x0f,0x1f,0x40,0\n" ++#define P6_NOP5 ".byte 0x0f,0x1f,0x44,0x00,0\n" ++#define P6_NOP6 ".byte 0x66,0x0f,0x1f,0x44,0x00,0\n" ++#define P6_NOP7 ".byte 0x0f,0x1f,0x80,0,0,0,0\n" ++#define P6_NOP8 ".byte 0x0f,0x1f,0x84,0x00,0,0,0,0\n" ++ + #define ASM_NOP_MAX 8 - if (++die.lock_owner_depth < 3) { -- int nl = 0; - unsigned long esp; - unsigned short ss; + /* REP NOP (PAUSE) is a good thing to insert into busy-wait loops. */ +@@ -377,12 +407,6 @@ static inline void sync_core(void) + asm volatile("cpuid" : "=a" (tmp) : "0" (1) : "ebx","ecx","edx","memory"); + } - report_bug(regs->eip, regs); +-#define ARCH_HAS_PREFETCH +-static inline void prefetch(void *x) +-{ +- asm volatile("prefetcht0 (%0)" :: "r" (x)); +-} +- + #define ARCH_HAS_PREFETCHW 1 + static inline void prefetchw(void *x) + { +@@ -398,11 +422,6 @@ static inline void prefetchw(void *x) -- printk(KERN_EMERG "%s: %04lx [#%d]\n", str, err & 0xffff, ++die_counter); -+ printk(KERN_EMERG "%s: %04lx [#%d] ", str, err & 0xffff, -+ ++die_counter); - #ifdef CONFIG_PREEMPT -- printk(KERN_EMERG "PREEMPT "); -- nl = 1; -+ printk("PREEMPT "); - #endif - #ifdef CONFIG_SMP -- if (!nl) -- printk(KERN_EMERG); - printk("SMP "); -- nl = 1; + #define cpu_relax() rep_nop() + +-static inline void serialize_cpu(void) +-{ +- __asm__ __volatile__ ("cpuid" : : : "ax", "bx", "cx", "dx"); +-} +- + static inline void __monitor(const void *eax, unsigned long ecx, + unsigned long edx) + { +--- /dev/null ++++ b/arch/x86/include/mach-xen/asm/smp.h +@@ -0,0 +1,5 @@ ++#ifdef CONFIG_X86_32 ++# include "smp_32.h" ++#else ++# include "smp_64.h" ++#endif +--- a/arch/x86/include/mach-xen/asm/smp_32.h ++++ b/arch/x86/include/mach-xen/asm/smp_32.h +@@ -11,7 +11,7 @@ #endif - #ifdef CONFIG_DEBUG_PAGEALLOC -- if (!nl) -- printk(KERN_EMERG); - printk("DEBUG_PAGEALLOC"); -- nl = 1; - #endif -- if (nl) -- printk("\n"); -+ printk("\n"); -+ - if (notify_die(DIE_OOPS, str, regs, err, - current->thread.trap_no, SIGSEGV) != - NOTIFY_STOP) { -@@ -454,7 +431,8 @@ void die(const char * str, struct pt_reg - bust_spinlocks(0); - die.lock_owner = -1; - add_taint(TAINT_DIE); -- spin_unlock_irqrestore(&die.lock, flags); -+ __raw_spin_unlock(&die.lock); -+ raw_local_irq_restore(flags); - if (!regs) - return; -@@ -571,6 +549,7 @@ fastcall void do_##name(struct pt_regs * - info.si_errno = 0; \ - info.si_code = sicode; \ - info.si_addr = (void __user *)siaddr; \ -+ trace_hardirqs_fixup(); \ - if (notify_die(DIE_TRAP, str, regs, error_code, trapnr, signr) \ - == NOTIFY_STOP) \ - return; \ -@@ -606,7 +585,7 @@ fastcall void __kprobes do_general_prote - printk_ratelimit()) - printk(KERN_INFO - "%s[%d] general protection eip:%lx esp:%lx error:%lx\n", -- current->comm, current->pid, -+ current->comm, task_pid_nr(current), - regs->eip, regs->esp, error_code); + #if defined(CONFIG_X86_LOCAL_APIC) && !defined(__ASSEMBLY__) +-#include ++#include + #include + #include + #ifdef CONFIG_X86_IO_APIC +@@ -29,19 +29,20 @@ + + extern void smp_alloc_memory(void); + extern int pic_mode; +-extern int smp_num_siblings; +-extern cpumask_t cpu_sibling_map[]; +-extern cpumask_t cpu_core_map[]; - force_sig(SIGSEGV, current); -@@ -785,6 +764,8 @@ void restart_nmi(void) - #ifdef CONFIG_KPROBES - fastcall void __kprobes do_int3(struct pt_regs *regs, long error_code) - { -+ trace_hardirqs_fixup(); -+ - if (notify_die(DIE_INT3, "int3", regs, error_code, 3, SIGTRAP) - == NOTIFY_STOP) - return; -@@ -822,6 +803,8 @@ fastcall void __kprobes do_debug(struct - unsigned int condition; - struct task_struct *tsk = current; + extern void (*mtrr_hook) (void); + extern void zap_low_mappings (void); + extern void lock_ipi_call_lock(void); + extern void unlock_ipi_call_lock(void); -+ trace_hardirqs_fixup(); -+ - get_debugreg(condition, 6); ++#ifndef CONFIG_XEN + #define MAX_APICID 256 +-extern u8 x86_cpu_to_apicid[]; ++extern u8 __initdata x86_cpu_to_apicid_init[]; ++extern void *x86_cpu_to_apicid_ptr; ++DECLARE_PER_CPU(u8, x86_cpu_to_apicid); ++#endif - if (notify_die(DIE_DEBUG, "debug", regs, condition, error_code, -@@ -1084,20 +1067,6 @@ asmlinkage void math_emulate(long arg) +-#define cpu_physical_id(cpu) x86_cpu_to_apicid[cpu] ++#define cpu_physical_id(cpu) (cpu) - #endif /* CONFIG_MATH_EMULATION */ + #ifdef CONFIG_HOTPLUG_CPU + extern void cpu_exit_clear(void); +@@ -148,7 +149,7 @@ extern unsigned int num_processors; + #else /* CONFIG_SMP */ --#ifdef CONFIG_X86_F00F_BUG --void __init trap_init_f00f_bug(void) --{ -- __set_fixmap(FIX_F00F_IDT, __pa(&idt_table), PAGE_KERNEL_RO); -- -- /* -- * Update the IDT descriptor and reload the IDT so that -- * it uses the read-only mapped virtual address. -- */ -- idt_descr.address = fix_to_virt(FIX_F00F_IDT); -- load_idt(&idt_descr); --} --#endif -- + #define safe_smp_processor_id() 0 +-#define cpu_physical_id(cpu) boot_cpu_physical_apicid ++#define cpu_physical_id(cpu) 0 - /* - * NB. All these are "trap gates" (i.e. events_mask isn't set) except ---- head.orig/arch/x86/kernel/traps_64-xen.c 2011-01-31 17:49:31.000000000 +0100 -+++ head/arch/x86/kernel/traps_64-xen.c 2011-01-31 17:56:27.000000000 +0100 -@@ -1,6 +1,4 @@ - /* -- * linux/arch/x86-64/traps.c -- * - * Copyright (C) 1991, 1992 Linus Torvalds - * Copyright (C) 2000, 2001, 2002 Andi Kleen, SuSE Labs - * -@@ -33,6 +31,7 @@ - #include - #include - #include -+#include + #define NO_PROC_ID 0xFF /* No processor magic marker */ - #if defined(CONFIG_EDAC) - #include -@@ -205,7 +204,7 @@ static unsigned long *in_exception_stack - #define MSG(txt) ops->warning(data, txt) +--- a/arch/x86/include/mach-xen/asm/smp_64.h ++++ b/arch/x86/include/mach-xen/asm/smp_64.h +@@ -38,12 +38,11 @@ extern void smp_alloc_memory(void); + extern volatile unsigned long smp_invalidate_needed; + extern void lock_ipi_call_lock(void); + extern void unlock_ipi_call_lock(void); +-extern int smp_num_siblings; + extern void smp_send_reschedule(int cpu); ++extern int smp_call_function_mask(cpumask_t mask, void (*func)(void *), ++ void *info, int wait); - /* -- * x86-64 can have upto three kernel stacks: -+ * x86-64 can have up to three kernel stacks: - * process stack - * interrupt stack - * severe exception (double fault, nmi, stack fault, debug, mce) hardware stack -@@ -219,7 +218,7 @@ static inline int valid_stack_ptr(struct +-extern cpumask_t cpu_sibling_map[NR_CPUS]; +-extern cpumask_t cpu_core_map[NR_CPUS]; +-extern u8 cpu_llc_id[NR_CPUS]; ++DECLARE_PER_CPU(u8, cpu_llc_id); - void dump_trace(struct task_struct *tsk, struct pt_regs *regs, - unsigned long *stack, -- struct stacktrace_ops *ops, void *data) -+ const struct stacktrace_ops *ops, void *data) - { - const unsigned cpu = get_cpu(); - unsigned long *irqstack_end = (unsigned long*)cpu_pda(cpu)->irqstackptr; -@@ -340,7 +339,7 @@ static void print_trace_address(void *da - printk_address(addr); - } + #define SMP_TRAMPOLINE_BASE 0x6000 --static struct stacktrace_ops print_trace_ops = { -+static const struct stacktrace_ops print_trace_ops = { - .warning = print_trace_warning, - .warning_symbol = print_trace_warning_symbol, - .stack = print_trace_stack, -@@ -404,6 +403,12 @@ void show_stack(struct task_struct *tsk, - void dump_stack(void) - { - unsigned long dummy; +@@ -70,6 +69,9 @@ extern unsigned __cpuinitdata disabled_c + + #endif /* CONFIG_SMP */ + ++#define safe_smp_processor_id() smp_processor_id() + -+ printk("Pid: %d, comm: %.20s %s %s %.*s\n", -+ current->pid, current->comm, print_tainted(), -+ init_utsname()->release, -+ (int)strcspn(init_utsname()->version, " "), -+ init_utsname()->version); - show_trace(NULL, NULL, &dummy); ++#ifndef CONFIG_XEN + #ifdef CONFIG_X86_LOCAL_APIC + static inline int hard_smp_processor_id(void) + { +@@ -82,8 +84,9 @@ static inline int hard_smp_processor_id( + * Some lowlevel functions might want to know about + * the real APIC ID <-> CPU # mapping. + */ +-extern u8 x86_cpu_to_apicid[NR_CPUS]; /* physical ID */ +-extern u8 x86_cpu_to_log_apicid[NR_CPUS]; ++extern u8 __initdata x86_cpu_to_apicid_init[]; ++extern void *x86_cpu_to_apicid_ptr; ++DECLARE_PER_CPU(u8, x86_cpu_to_apicid); /* physical ID */ + extern u8 bios_cpu_apicid[]; + + #ifdef CONFIG_X86_LOCAL_APIC +@@ -95,6 +98,7 @@ static inline int cpu_present_to_apicid( + return BAD_APICID; } + #endif ++#endif /* CONFIG_XEN */ -@@ -466,7 +471,7 @@ void out_of_line_bug(void) - EXPORT_SYMBOL(out_of_line_bug); + #ifndef CONFIG_SMP + #define stack_smp_processor_id() 0 +@@ -118,9 +122,9 @@ static __inline int logical_smp_processo #endif --static DEFINE_SPINLOCK(die_lock); -+static raw_spinlock_t die_lock = __RAW_SPIN_LOCK_UNLOCKED; - static int die_owner = -1; - static unsigned int die_nest_count; + #ifdef CONFIG_SMP +-#define cpu_physical_id(cpu) x86_cpu_to_apicid[cpu] ++#define cpu_physical_id(cpu) (cpu) + #else +-#define cpu_physical_id(cpu) boot_cpu_id ++#define cpu_physical_id(cpu) 0 + #endif /* !CONFIG_SMP */ + #endif -@@ -478,13 +483,13 @@ unsigned __kprobes long oops_begin(void) - oops_enter(); +--- /dev/null ++++ b/arch/x86/include/mach-xen/asm/swiotlb.h +@@ -0,0 +1,5 @@ ++#ifdef CONFIG_X86_32 ++# include "swiotlb_32.h" ++#else ++# include_next ++#endif +--- /dev/null ++++ b/arch/x86/include/mach-xen/asm/tlbflush.h +@@ -0,0 +1,5 @@ ++#ifdef CONFIG_X86_32 ++# include "tlbflush_32.h" ++#else ++# include "tlbflush_64.h" ++#endif +--- a/arch/x86/include/mach-xen/asm/tlbflush_32.h ++++ b/arch/x86/include/mach-xen/asm/tlbflush_32.h +@@ -23,7 +23,6 @@ + * - flush_tlb_page(vma, vmaddr) flushes one page + * - flush_tlb_range(vma, start, end) flushes a range of pages + * - flush_tlb_kernel_range(start, end) flushes a range of kernel pages +- * - flush_tlb_pgtables(mm, start, end) flushes a range of page tables + * + * ..but the i386 has somewhat limited tlb flushing capabilities, + * and page-granular flushes are available only on i486 and up. +@@ -97,10 +96,4 @@ static inline void flush_tlb_kernel_rang + flush_tlb_all(); + } - /* racy, but better than risking deadlock. */ -- local_irq_save(flags); -+ raw_local_irq_save(flags); - cpu = smp_processor_id(); -- if (!spin_trylock(&die_lock)) { -+ if (!__raw_spin_trylock(&die_lock)) { - if (cpu == die_owner) - /* nested oops. should stop eventually */; - else -- spin_lock(&die_lock); -+ __raw_spin_lock(&die_lock); - } - die_nest_count++; - die_owner = cpu; -@@ -498,12 +503,10 @@ void __kprobes oops_end(unsigned long fl - die_owner = -1; - bust_spinlocks(0); - die_nest_count--; -- if (die_nest_count) -- /* We still own the lock */ -- local_irq_restore(flags); -- else -+ if (!die_nest_count) - /* Nest count reaches zero, release the lock. */ -- spin_unlock_irqrestore(&die_lock, flags); -+ __raw_spin_unlock(&die_lock); -+ raw_local_irq_restore(flags); - if (panic_on_oops) - panic("Fatal exception"); - oops_exit(); -@@ -636,6 +639,7 @@ asmlinkage void do_##name(struct pt_regs - info.si_errno = 0; \ - info.si_code = sicode; \ - info.si_addr = (void __user *)siaddr; \ -+ trace_hardirqs_fixup(); \ - if (notify_die(DIE_TRAP, str, regs, error_code, trapnr, signr) \ - == NOTIFY_STOP) \ - return; \ -@@ -741,11 +745,8 @@ mem_parity_error(unsigned char reason, s - - printk(KERN_EMERG "Dazed and confused, but trying to continue\n"); - --#if 0 /* XEN */ - /* Clear and disable the memory parity error line. */ -- reason = (reason & 0xf) | 4; -- outb(reason, 0x61); --#endif /* XEN */ -+ clear_mem_error(reason); - } - - static __kprobes void -@@ -754,14 +755,8 @@ io_check_error(unsigned char reason, str - printk("NMI: IOCK error (debug interrupt?)\n"); - show_registers(regs); - --#if 0 /* XEN */ - /* Re-enable the IOCK line, wait for a few seconds */ -- reason = (reason & 0xf) | 8; -- outb(reason, 0x61); -- mdelay(2000); -- reason &= ~8; -- outb(reason, 0x61); --#endif /* XEN */ -+ clear_io_check_error(reason); +-static inline void flush_tlb_pgtables(struct mm_struct *mm, +- unsigned long start, unsigned long end) +-{ +- /* i386 does not keep any page table caches in TLB */ +-} +- + #endif /* _I386_TLBFLUSH_H */ +--- a/arch/x86/include/mach-xen/asm/tlbflush_64.h ++++ b/arch/x86/include/mach-xen/asm/tlbflush_64.h +@@ -28,7 +28,6 @@ + * - flush_tlb_page(vma, vmaddr) flushes one page + * - flush_tlb_range(vma, start, end) flushes a range of pages + * - flush_tlb_kernel_range(start, end) flushes a range of kernel pages +- * - flush_tlb_pgtables(mm, start, end) flushes a range of page tables + * + * x86-64 can only flush individual pages or full VMs. For a range flush + * we always do the full VM. Might be worth trying if for a small +@@ -95,12 +94,4 @@ static inline void flush_tlb_kernel_rang + flush_tlb_all(); } - static __kprobes void -@@ -821,6 +816,8 @@ asmlinkage __kprobes void default_do_nmi - /* runs on IST stack. */ - asmlinkage void __kprobes do_int3(struct pt_regs * regs, long error_code) - { -+ trace_hardirqs_fixup(); +-static inline void flush_tlb_pgtables(struct mm_struct *mm, +- unsigned long start, unsigned long end) +-{ +- /* x86_64 does not keep any page table caches in a software TLB. +- The CPUs do in their hardware TLBs, but they are handled +- by the normal TLB flushing algorithms. */ +-} +- + #endif /* _X8664_TLBFLUSH_H */ +--- /dev/null ++++ b/arch/x86/include/mach-xen/asm/xor.h +@@ -0,0 +1,21 @@ ++#include_next + - if (notify_die(DIE_INT3, "int3", regs, error_code, 3, SIGTRAP) == NOTIFY_STOP) { - return; - } -@@ -858,6 +855,8 @@ asmlinkage void __kprobes do_debug(struc - struct task_struct *tsk = current; - siginfo_t info; - -+ trace_hardirqs_fixup(); ++#undef XOR_SELECT_TEMPLATE + - get_debugreg(condition, 6); - - if (notify_die(DIE_DEBUG, "debug", regs, condition, error_code, ---- head.orig/arch/x86/kernel/vsyscall_64-xen.c 2011-01-31 17:49:31.000000000 +0100 -+++ head/arch/x86/kernel/vsyscall_64-xen.c 2011-01-31 17:56:27.000000000 +0100 -@@ -1,6 +1,4 @@ - /* -- * linux/arch/x86_64/kernel/vsyscall.c -- * - * Copyright (C) 2001 Andrea Arcangeli SuSE - * Copyright 2003 Andi Kleen, SuSE Labs. - * -@@ -50,12 +48,12 @@ - ({unsigned long v; \ - extern char __vsyscall_0; \ - asm("" : "=r" (v) : "0" (x)); \ -- ((v - VSYSCALL_FIRST_PAGE) + __pa_symbol(&__vsyscall_0)); }) -+ ((v - VSYSCALL_START) + __pa_symbol(&__vsyscall_0)); }) - - /* - * vsyscall_gtod_data contains data that is : - * - readonly from vsyscalls -- * - writen by timer interrupt or systcl (/proc/sys/kernel/vsyscall64) -+ * - written by timer interrupt or systcl (/proc/sys/kernel/vsyscall64) - * Try to keep this structure as small as possible to avoid cache line ping pongs - */ - int __vgetcpu_mode __section_vgetcpu_mode; -@@ -66,6 +64,16 @@ struct vsyscall_gtod_data __vsyscall_gto - .sysctl_enabled = 1, - }; - -+void update_vsyscall_tz(void) -+{ -+ unsigned long flags; ++#ifdef CONFIG_X86_64 + -+ write_seqlock_irqsave(&vsyscall_gtod_data.lock, flags); -+ /* sys_tz has changed */ -+ vsyscall_gtod_data.sys_tz = sys_tz; -+ write_sequnlock_irqrestore(&vsyscall_gtod_data.lock, flags); -+} ++/* Also try the generic routines. */ ++#undef XOR_TRY_TEMPLATES ++#include + - void update_vsyscall(struct timespec *wall_time, struct clocksource *clock) - { - unsigned long flags; -@@ -79,8 +87,6 @@ void update_vsyscall(struct timespec *wa - vsyscall_gtod_data.clock.shift = clock->shift; - vsyscall_gtod_data.wall_time_sec = wall_time->tv_sec; - vsyscall_gtod_data.wall_time_nsec = wall_time->tv_nsec; -- vsyscall_gtod_data.sys_tz = sys_tz; -- vsyscall_gtod_data.wall_time_nsec = wall_time->tv_nsec; - vsyscall_gtod_data.wall_to_monotonic = wall_to_monotonic; - write_sequnlock_irqrestore(&vsyscall_gtod_data.lock, flags); - } -@@ -166,7 +172,7 @@ time_t __vsyscall(1) vtime(time_t *t) - if (unlikely(!__vsyscall_gtod_data.sysctl_enabled)) - return time_syscall(t); ++#undef XOR_TRY_TEMPLATES ++#define XOR_TRY_TEMPLATES \ ++do { \ ++ xor_speed(&xor_block_8regs); \ ++ xor_speed(&xor_block_8regs_p); \ ++ xor_speed(&xor_block_32regs); \ ++ xor_speed(&xor_block_32regs_p); \ ++ xor_speed(&xor_block_sse); \ ++} while (0) ++ ++#endif +--- a/arch/x86/kernel/Makefile ++++ b/arch/x86/kernel/Makefile +@@ -124,4 +124,4 @@ endif + disabled-obj-$(CONFIG_XEN) := early-quirks.o hpet.o i8237.o i8253.o i8259_$(BITS).o \ + reboot.o smpboot_$(BITS).o tsc_$(BITS).o tsc_sync.o + disabled-obj-$(CONFIG_XEN_UNPRIVILEGED_GUEST) += mpparse_64.o +-%/head_64.o %/head_64.s: $(if $(CONFIG_XEN),EXTRA_AFLAGS,dummy) := ++%/head_64.o %/head_64.s: asflags-$(CONFIG_XEN) := +--- a/arch/x86/kernel/acpi/processor_extcntl_xen.c ++++ b/arch/x86/kernel/acpi/processor_extcntl_xen.c +@@ -68,7 +68,7 @@ static int xen_cx_notifier(struct acpi_p -- vgettimeofday(&tv, 0); -+ vgettimeofday(&tv, NULL); - result = tv.tv_sec; - if (t) - *t = result; -@@ -260,18 +266,10 @@ out: - return ret; - } + /* Get dependency relationships */ + if (cx->csd_count) { +- printk("Wow! _CSD is found. Not support for now!\n"); ++ pr_warning("_CSD found: Not supported for now!\n"); + kfree(buf); + return -EINVAL; + } else { +@@ -81,7 +81,7 @@ static int xen_cx_notifier(struct acpi_p + } --static int vsyscall_sysctl_nostrat(ctl_table *t, int __user *name, int nlen, -- void __user *oldval, size_t __user *oldlenp, -- void __user *newval, size_t newlen) --{ -- return -ENOSYS; --} -- - static ctl_table kernel_table2[] = { -- { .ctl_name = 99, .procname = "vsyscall64", -+ { .procname = "vsyscall64", - .data = &vsyscall_gtod_data.sysctl_enabled, .maxlen = sizeof(int), - .mode = 0644, -- .strategy = vsyscall_sysctl_nostrat, - .proc_handler = vsyscall_sysctl_change }, - {} - }; -@@ -291,9 +289,9 @@ static void __cpuinit vsyscall_set_cpu(i - unsigned long d; - unsigned long node = 0; - #ifdef CONFIG_NUMA -- node = cpu_to_node[cpu]; -+ node = cpu_to_node(cpu); + if (!count) { +- printk("No available Cx info for cpu %d\n", pr->acpi_id); ++ pr_info("No available Cx info for cpu %d\n", pr->acpi_id); + kfree(buf); + return -EINVAL; + } +--- a/arch/x86/kernel/apic/io_apic-xen.c ++++ b/arch/x86/kernel/apic/io_apic-xen.c +@@ -31,6 +31,7 @@ + #include + #include + #include ++#include + #ifdef CONFIG_ACPI + #include #endif -- if (cpu_has(&cpu_data[cpu], X86_FEATURE_RDTSCP)) -+ if (cpu_has(&cpu_data(cpu), X86_FEATURE_RDTSCP)) - write_rdtscp_aux((node << 12) | cpu); +@@ -584,7 +585,7 @@ int IO_APIC_get_PCI_irq_vector(int bus, + #define default_PCI_trigger(idx) (1) + #define default_PCI_polarity(idx) (1) - /* Store cpu number in limit so that it can be loaded quickly ---- head.orig/arch/x86/mm/fault_32-xen.c 2011-01-31 17:49:31.000000000 +0100 -+++ head/arch/x86/mm/fault_32-xen.c 2011-01-31 17:56:27.000000000 +0100 -@@ -25,6 +25,7 @@ - #include - #include - #include -+#include +-static int __init MPBIOS_polarity(int idx) ++static int MPBIOS_polarity(int idx) + { + int bus = mp_irqs[idx].mpc_srcbus; + int polarity; +@@ -871,6 +872,10 @@ static void __init setup_IO_APIC_irqs(vo + apic_printk(APIC_VERBOSE, ", %d-%d", mp_ioapics[apic].mpc_apicid, pin); + continue; + } ++ if (!first_notcon) { ++ apic_printk(APIC_VERBOSE, " not connected.\n"); ++ first_notcon = 1; ++ } - #include - #include -@@ -32,33 +33,27 @@ + irq = pin_2_irq(idx, apic, pin); + add_pin_to_irq(irq, apic, pin); +@@ -881,7 +886,7 @@ static void __init setup_IO_APIC_irqs(vo + } - extern void die(const char *,struct pt_regs *,long); + if (!first_notcon) +- apic_printk(APIC_VERBOSE," not connected.\n"); ++ apic_printk(APIC_VERBOSE, " not connected.\n"); + } --static ATOMIC_NOTIFIER_HEAD(notify_page_fault_chain); -- --int register_page_fault_notifier(struct notifier_block *nb) -+#ifdef CONFIG_KPROBES -+static inline int notify_page_fault(struct pt_regs *regs) + #ifndef CONFIG_XEN +@@ -1277,10 +1282,13 @@ void disable_IO_APIC(void) + static int __init timer_irq_works(void) { -- vmalloc_sync_all(); -- return atomic_notifier_chain_register(¬ify_page_fault_chain, nb); --} --EXPORT_SYMBOL_GPL(register_page_fault_notifier); -+ int ret = 0; + unsigned long t1 = jiffies; ++ unsigned long flags; --int unregister_page_fault_notifier(struct notifier_block *nb) --{ -- return atomic_notifier_chain_unregister(¬ify_page_fault_chain, nb); --} --EXPORT_SYMBOL_GPL(unregister_page_fault_notifier); -+ /* kprobe_running() needs smp_processor_id() */ -+ if (!user_mode_vm(regs)) { -+ preempt_disable(); -+ if (kprobe_running() && kprobe_fault_handler(regs, 14)) -+ ret = 1; -+ preempt_enable(); -+ } ++ local_save_flags(flags); + local_irq_enable(); + /* Let ten ticks pass... */ + mdelay((10 * 1000) / HZ); ++ local_irq_restore(flags); --static inline int notify_page_fault(struct pt_regs *regs, long err) -+ return ret; -+} -+#else -+static inline int notify_page_fault(struct pt_regs *regs) + /* + * Expect a few ticks at least, to be sure some possible +@@ -1655,6 +1663,9 @@ static inline void check_timer(void) { -- struct die_args args = { -- .regs = regs, -- .str = "page fault", -- .err = err, -- .trapnr = 14, -- .signr = SIGSEGV -- }; -- return atomic_notifier_call_chain(¬ify_page_fault_chain, -- DIE_PAGE_FAULT, &args); -+ return 0; + struct irq_cfg *cfg = irq_cfg + 0; + int apic1, pin1, apic2, pin2; ++ unsigned long flags; ++ ++ local_irq_save(flags); + + /* + * get/set the timer IRQ vector: +@@ -1696,7 +1707,7 @@ static inline void check_timer(void) + } + if (disable_timer_pin_1 > 0) + clear_IO_APIC_pin(0, pin1); +- return; ++ goto out; + } + clear_IO_APIC_pin(apic1, pin1); + apic_printk(APIC_QUIET,KERN_ERR "..MP-BIOS bug: 8254 timer not " +@@ -1718,7 +1729,7 @@ static inline void check_timer(void) + if (nmi_watchdog == NMI_IO_APIC) { + setup_nmi(); + } +- return; ++ goto out; + } + /* + * Cleanup, just in case ... +@@ -1741,7 +1752,7 @@ static inline void check_timer(void) + + if (timer_irq_works()) { + apic_printk(APIC_VERBOSE," works.\n"); +- return; ++ goto out; + } + apic_write(APIC_LVT0, APIC_LVT_MASKED | APIC_DM_FIXED | cfg->vector); + apic_printk(APIC_VERBOSE," failed.\n"); +@@ -1756,10 +1767,12 @@ static inline void check_timer(void) + + if (timer_irq_works()) { + apic_printk(APIC_VERBOSE," works.\n"); +- return; ++ goto out; + } + apic_printk(APIC_VERBOSE," failed :(.\n"); + panic("IO-APIC + timer doesn't work! Try using the 'noapic' kernel parameter\n"); ++out: ++ local_irq_restore(flags); } -+#endif + #else + #define check_timer() ((void)0) +@@ -1775,7 +1788,7 @@ __setup("no_timer_check", notimercheck); /* - * Return EIP plus the CS segment base. The segment limit is also -@@ -110,7 +105,7 @@ static inline unsigned long get_segment_ - LDT and other horrors are only used in user space. */ - if (seg & (1<<2)) { - /* Must lock the LDT while reading it. */ -- down(¤t->mm->context.sem); -+ mutex_lock(¤t->mm->context.lock); - desc = current->mm->context.ldt; - desc = (void *)desc + (seg & ~7); - } else { -@@ -123,7 +118,7 @@ static inline unsigned long get_segment_ - base = get_desc_base((unsigned long *)desc); + * +- * IRQ's that are handled by the PIC in the MPS IOAPIC case. ++ * IRQs that are handled by the PIC in the MPS IOAPIC case. + * - IRQ2 is the cascade IRQ, and cannot be a io-apic IRQ. + * Linux doesn't really care, as it's not actually used + * for any interrupt handling anyway. +@@ -1858,7 +1871,7 @@ static struct sysdev_class ioapic_sysdev + static int __init ioapic_init_sysfs(void) + { + struct sys_device * dev; +- int i, size, error = 0; ++ int i, size, error; - if (seg & (1<<2)) { -- up(¤t->mm->context.sem); -+ mutex_unlock(¤t->mm->context.lock); - } else - put_cpu(); + error = sysdev_class_register(&ioapic_sysdev_class); + if (error) +@@ -1867,12 +1880,11 @@ static int __init ioapic_init_sysfs(void + for (i = 0; i < nr_ioapics; i++ ) { + size = sizeof(struct sys_device) + nr_ioapic_registers[i] + * sizeof(struct IO_APIC_route_entry); +- mp_ioapic_data[i] = kmalloc(size, GFP_KERNEL); ++ mp_ioapic_data[i] = kzalloc(size, GFP_KERNEL); + if (!mp_ioapic_data[i]) { + printk(KERN_ERR "Can't suspend/resume IOAPIC %d\n", i); + continue; + } +- memset(mp_ioapic_data[i], 0, size); + dev = &mp_ioapic_data[i]->dev; + dev->id = i; + dev->cls = &ioapic_sysdev_class; +@@ -1933,7 +1945,7 @@ void destroy_irq(unsigned int irq) + #endif /* CONFIG_XEN */ -@@ -244,7 +239,7 @@ static void dump_fault_path(unsigned lon - if (mfn_to_pfn(mfn) >= highstart_pfn) - return; - #endif -- if (p[0] & _PAGE_PRESENT) { -+ if ((p[0] & _PAGE_PRESENT) && !(p[0] & _PAGE_PSE)) { - page = mfn_to_pfn(mfn) << PAGE_SHIFT; - p = (unsigned long *) __va(page); - address &= 0x001fffff; -@@ -270,7 +265,8 @@ static void dump_fault_path(unsigned lon - * it's allocated already. - */ - if ((machine_to_phys(page) >> PAGE_SHIFT) < max_low_pfn -- && (page & _PAGE_PRESENT)) { -+ && (page & _PAGE_PRESENT) -+ && !(page & _PAGE_PSE)) { - page = machine_to_phys(page & PAGE_MASK); - page = ((unsigned long *) __va(page))[(address >> PAGE_SHIFT) - & (PTRS_PER_PTE - 1)]; -@@ -416,6 +412,11 @@ fastcall void __kprobes do_page_fault(st - int write, si_code; - int fault; + /* +- * MSI mesage composition ++ * MSI message composition + */ + #if defined(CONFIG_PCI_MSI) && !defined(CONFIG_XEN) + static int msi_compose_msg(struct pci_dev *pdev, unsigned int irq, struct msi_msg *msg) +@@ -2043,8 +2055,64 @@ void arch_teardown_msi_irq(unsigned int + destroy_irq(irq); + } -+ /* -+ * We can fault from pretty much anywhere, with unknown IRQ state. -+ */ -+ trace_hardirqs_fixup(); +-#endif /* CONFIG_PCI_MSI */ ++#ifdef CONFIG_DMAR ++#ifdef CONFIG_SMP ++static void dmar_msi_set_affinity(unsigned int irq, cpumask_t mask) ++{ ++ struct irq_cfg *cfg = irq_cfg + irq; ++ struct msi_msg msg; ++ unsigned int dest; ++ cpumask_t tmp; + - /* get the address */ - address = read_cr2(); - -@@ -453,7 +454,7 @@ fastcall void __kprobes do_page_fault(st - /* Can take a spurious fault if mapping changes R/O -> R/W. */ - if (spurious_fault(regs, address, error_code)) - return; -- if (notify_page_fault(regs, error_code) == NOTIFY_STOP) -+ if (notify_page_fault(regs)) - return; - /* - * Don't take the mm semaphore here. If we fixup a prefetch -@@ -462,7 +463,7 @@ fastcall void __kprobes do_page_fault(st - goto bad_area_nosemaphore; - } ++ cpus_and(tmp, mask, cpu_online_map); ++ if (cpus_empty(tmp)) ++ return; ++ ++ if (assign_irq_vector(irq, mask)) ++ return; ++ ++ cpus_and(tmp, cfg->domain, mask); ++ dest = cpu_mask_to_apicid(tmp); ++ ++ dmar_msi_read(irq, &msg); ++ ++ msg.data &= ~MSI_DATA_VECTOR_MASK; ++ msg.data |= MSI_DATA_VECTOR(cfg->vector); ++ msg.address_lo &= ~MSI_ADDR_DEST_ID_MASK; ++ msg.address_lo |= MSI_ADDR_DEST_ID(dest); ++ ++ dmar_msi_write(irq, &msg); ++ irq_desc[irq].affinity = mask; ++} ++#endif /* CONFIG_SMP */ ++ ++struct irq_chip dmar_msi_type = { ++ .name = "DMAR_MSI", ++ .unmask = dmar_msi_unmask, ++ .mask = dmar_msi_mask, ++ .ack = ack_apic_edge, ++#ifdef CONFIG_SMP ++ .set_affinity = dmar_msi_set_affinity, ++#endif ++ .retrigger = ioapic_retrigger_irq, ++}; ++ ++int arch_setup_dmar_msi(unsigned int irq) ++{ ++ int ret; ++ struct msi_msg msg; ++ ++ ret = msi_compose_msg(NULL, irq, &msg); ++ if (ret < 0) ++ return ret; ++ dmar_msi_write(irq, &msg); ++ set_irq_chip_and_handler_name(irq, &dmar_msi_type, handle_edge_irq, ++ "edge"); ++ return 0; ++} ++#endif -- if (notify_page_fault(regs, error_code) == NOTIFY_STOP) -+ if (notify_page_fault(regs)) - return; ++#endif /* CONFIG_PCI_MSI */ + /* + * Hypertransport interrupt support + */ +@@ -2177,8 +2245,27 @@ int io_apic_set_pci_routing (int ioapic, + return 0; + } - /* It's safe to allow irq's after cr2 has been saved and the vmalloc -@@ -481,7 +482,7 @@ fastcall void __kprobes do_page_fault(st +-#endif /* CONFIG_ACPI */ - /* When running in the kernel we expect faults to occur only to - * addresses in user space. All other faults represent errors in the -- * kernel and should generate an OOPS. Unfortunatly, in the case of an -+ * kernel and should generate an OOPS. Unfortunately, in the case of an - * erroneous fault occurring in a code path which already holds mmap_sem - * we will deadlock attempting to validate the fault against the - * address space. Luckily the kernel only validly references user -@@ -489,7 +490,7 @@ fastcall void __kprobes do_page_fault(st - * exceptions table. - * - * As the vast majority of faults will be valid we will only perform -- * the source reference check when there is a possibilty of a deadlock. -+ * the source reference check when there is a possibility of a deadlock. - * Attempt to lock the address space, if we cannot we then validate the - * source. If this is invalid we can skip the address space check, - * thus avoiding the deadlock. -@@ -598,8 +599,8 @@ bad_area_nosemaphore: - printk_ratelimit()) { - printk("%s%s[%d]: segfault at %08lx eip %08lx " - "esp %08lx error %lx\n", -- tsk->pid > 1 ? KERN_INFO : KERN_EMERG, -- tsk->comm, tsk->pid, address, regs->eip, -+ task_pid_nr(tsk) > 1 ? KERN_INFO : KERN_EMERG, -+ tsk->comm, task_pid_nr(tsk), address, regs->eip, - regs->esp, error_code); - } - tsk->thread.cr2 = address; -@@ -664,8 +665,7 @@ no_context: - printk(KERN_ALERT "BUG: unable to handle kernel paging" - " request"); - printk(" at virtual address %08lx\n",address); -- printk(KERN_ALERT " printing eip:\n"); -- printk("%08lx\n", regs->eip); -+ printk(KERN_ALERT "printing eip: %08lx\n", regs->eip); - dump_fault_path(address); - } - tsk->thread.cr2 = address; -@@ -681,14 +681,14 @@ no_context: - */ - out_of_memory: - up_read(&mm->mmap_sem); -- if (is_init(tsk)) { -+ if (is_global_init(tsk)) { - yield(); - down_read(&mm->mmap_sem); - goto survive; - } - printk("VM: killing process %s\n", tsk->comm); - if (error_code & 4) -- do_exit(SIGKILL); -+ do_group_exit(SIGKILL); - goto no_context; ++int acpi_get_override_irq(int bus_irq, int *trigger, int *polarity) ++{ ++ int i; ++ ++ if (skip_ioapic_setup) ++ return -1; ++ ++ for (i = 0; i < mp_irq_entries; i++) ++ if (mp_irqs[i].mpc_irqtype == mp_INT && ++ mp_irqs[i].mpc_srcbusirq == bus_irq) ++ break; ++ if (i >= mp_irq_entries) ++ return -1; ++ ++ *trigger = irq_trigger(i); ++ *polarity = irq_polarity(i); ++ return 0; ++} ++ ++#endif /* CONFIG_ACPI */ - do_sigbus: ---- head.orig/arch/x86/mm/fault_64-xen.c 2011-08-15 10:44:41.000000000 +0200 -+++ head/arch/x86/mm/fault_64-xen.c 2011-07-26 09:28:01.000000000 +0200 -@@ -25,6 +25,7 @@ - #include - #include - #include -+#include + #ifndef CONFIG_XEN + /* +@@ -2217,3 +2304,4 @@ void __init setup_ioapic_dest(void) + } + #endif + #endif /* !CONFIG_XEN */ ++ +--- a/arch/x86/kernel/cpu/Makefile ++++ b/arch/x86/kernel/cpu/Makefile +@@ -42,6 +42,8 @@ obj-$(CONFIG_MTRR) += mtrr/ - #include - #include -@@ -40,34 +41,27 @@ - #define PF_RSVD (1<<3) - #define PF_INSTR (1<<4) + obj-$(CONFIG_X86_LOCAL_APIC) += perfctr-watchdog.o perf_event_amd_ibs.o --static ATOMIC_NOTIFIER_HEAD(notify_page_fault_chain); -- --/* Hook to register for page fault notifications */ --int register_page_fault_notifier(struct notifier_block *nb) -+#ifdef CONFIG_KPROBES -+static inline int notify_page_fault(struct pt_regs *regs) - { -- vmalloc_sync_all(); -- return atomic_notifier_chain_register(¬ify_page_fault_chain, nb); --} --EXPORT_SYMBOL_GPL(register_page_fault_notifier); -+ int ret = 0; ++disabled-obj-$(CONFIG_XEN) := perfctr-watchdog.o ++ + quiet_cmd_mkcapflags = MKCAP $@ + cmd_mkcapflags = $(PERL) $(srctree)/$(src)/mkcapflags.pl $< $@ --int unregister_page_fault_notifier(struct notifier_block *nb) --{ -- return atomic_notifier_chain_unregister(¬ify_page_fault_chain, nb); --} --EXPORT_SYMBOL_GPL(unregister_page_fault_notifier); -+ /* kprobe_running() needs smp_processor_id() */ -+ if (!user_mode(regs)) { -+ preempt_disable(); -+ if (kprobe_running() && kprobe_fault_handler(regs, 14)) -+ ret = 1; -+ preempt_enable(); -+ } +--- a/arch/x86/kernel/cpu/common-xen.c ++++ b/arch/x86/kernel/cpu/common-xen.c +@@ -221,7 +221,7 @@ static void __cpuinit get_cpu_vendor(str --static inline int notify_page_fault(struct pt_regs *regs, long err) -+ return ret; -+} -+#else -+static inline int notify_page_fault(struct pt_regs *regs) + static int __init x86_fxsr_setup(char * s) { -- struct die_args args = { -- .regs = regs, -- .str = "page fault", -- .err = err, -- .trapnr = 14, -- .signr = SIGSEGV -- }; -- return atomic_notifier_call_chain(¬ify_page_fault_chain, -- DIE_PAGE_FAULT, &args); -+ return 0; - } -+#endif +- /* Tell all the other CPU's to not use it... */ ++ /* Tell all the other CPUs to not use it... */ + disable_x86_fxsr = 1; - /* Sometimes the CPU reports invalid exceptions on prefetch. - Check that here and ignore. -@@ -176,7 +170,7 @@ void dump_pagetable(unsigned long addres - pmd = pmd_offset(pud, address); - if (bad_address(pmd)) goto bad; - printk("PMD %lx ", pmd_val(*pmd)); -- if (!pmd_present(*pmd)) goto ret; -+ if (!pmd_present(*pmd) || pmd_large(*pmd)) goto ret; + /* +@@ -419,7 +419,9 @@ static void __cpuinit identify_cpu(struc + c->x86_model = c->x86_mask = 0; /* So far unknown... */ + c->x86_vendor_id[0] = '\0'; /* Unset */ + c->x86_model_id[0] = '\0'; /* Unset */ ++#ifndef CONFIG_XEN + c->x86_max_cores = 1; ++#endif + c->x86_clflush_size = 32; + memset(&c->x86_capability, 0, sizeof c->x86_capability); - pte = pte_offset_kernel(pmd, address); - if (bad_address(pte)) goto bad; -@@ -295,7 +289,6 @@ static int vmalloc_fault(unsigned long a - return 0; +--- a/arch/x86/kernel/cpu/intel.c ++++ b/arch/x86/kernel/cpu/intel.c +@@ -301,6 +301,7 @@ static void __cpuinit srat_detect_node(s + #endif } --static int page_fault_trace; - int show_unhandled_signals = 1; - ++#ifndef CONFIG_XEN + /* + * find out the number of processor cores on the die + */ +@@ -318,6 +319,7 @@ static int __cpuinit intel_num_cpu_cores + else + return 1; + } ++#endif -@@ -372,6 +365,11 @@ asmlinkage void __kprobes do_page_fault( - if (!user_mode(regs)) - error_code &= ~PF_USER; /* means kernel */ + static void __cpuinit detect_vmx_virtcap(struct cpuinfo_x86 *c) + { +@@ -439,6 +441,7 @@ static void __cpuinit init_intel(struct + set_cpu_cap(c, X86_FEATURE_P3); + #endif -+ /* -+ * We can fault from pretty much anywhere, with unknown IRQ state. -+ */ -+ trace_hardirqs_fixup(); -+ - tsk = current; - mm = tsk->mm; - prefetchw(&mm->mmap_sem); -@@ -409,7 +407,7 @@ asmlinkage void __kprobes do_page_fault( - /* Can take a spurious fault if mapping changes R/O -> R/W. */ - if (spurious_fault(regs, address, error_code)) - return; -- if (notify_page_fault(regs, error_code) == NOTIFY_STOP) -+ if (notify_page_fault(regs)) - return; ++#ifndef CONFIG_XEN + if (!cpu_has(c, X86_FEATURE_XTOPOLOGY)) { /* - * Don't take the mm semaphore here. If we fixup a prefetch -@@ -418,16 +416,12 @@ asmlinkage void __kprobes do_page_fault( - goto bad_area_nosemaphore; + * let's use the legacy cpuid vector 0x1 and 0x4 for topology +@@ -449,6 +452,7 @@ static void __cpuinit init_intel(struct + detect_ht(c); + #endif } ++#endif -- if (notify_page_fault(regs, error_code) == NOTIFY_STOP) -+ if (notify_page_fault(regs)) - return; - - if (likely(regs->eflags & X86_EFLAGS_IF)) - local_irq_enable(); - -- if (unlikely(page_fault_trace)) -- printk("pagefault rip:%lx rsp:%lx cs:%lu ss:%lu address %lx error %lx\n", -- regs->rip,regs->rsp,regs->cs,regs->ss,address,error_code); + /* Work around errata */ + srat_detect_node(c); +--- a/arch/x86/kernel/cpu/intel_cacheinfo.c ++++ b/arch/x86/kernel/cpu/intel_cacheinfo.c +@@ -279,8 +279,9 @@ amd_cpuid4(int leaf, union _cpuid4_leaf_ + eax->split.type = types[leaf]; + eax->split.level = levels[leaf]; + eax->split.num_threads_sharing = 0; ++#ifndef CONFIG_XEN + eax->split.num_cores_on_die = __this_cpu_read(cpu_info.x86_max_cores) - 1; - - if (unlikely(error_code & PF_RSVD)) - pgtable_bad(address, regs, error_code); ++#endif -@@ -448,7 +442,7 @@ asmlinkage void __kprobes do_page_fault( - again: - /* When running in the kernel we expect faults to occur only to - * addresses in user space. All other faults represent errors in the -- * kernel and should generate an OOPS. Unfortunatly, in the case of an -+ * kernel and should generate an OOPS. Unfortunately, in the case of an - * erroneous fault occurring in a code path which already holds mmap_sem - * we will deadlock attempting to validate the fault against the - * address space. Luckily the kernel only validly references user -@@ -456,7 +450,7 @@ asmlinkage void __kprobes do_page_fault( - * exceptions table. - * - * As the vast majority of faults will be valid we will only perform -- * the source reference check when there is a possibilty of a deadlock. -+ * the source reference check when there is a possibility of a deadlock. - * Attempt to lock the address space, if we cannot we then validate the - * source. If this is invalid we can skip the address space check, - * thus avoiding the deadlock. -@@ -558,7 +552,7 @@ bad_area_nosemaphore: - if (show_unhandled_signals && unhandled_signal(tsk, SIGSEGV) && - printk_ratelimit()) { - printk( -- "%s%s[%d]: segfault at %016lx rip %016lx rsp %016lx error %lx\n", -+ "%s%s[%d]: segfault at %lx rip %lx rsp %lx error %lx\n", - tsk->pid > 1 ? KERN_INFO : KERN_EMERG, - tsk->comm, tsk->pid, address, regs->rip, - regs->rsp, error_code); -@@ -624,7 +618,7 @@ no_context: - */ - out_of_memory: - up_read(&mm->mmap_sem); -- if (is_init(current)) { -+ if (is_global_init(current)) { - yield(); - goto again; - } -@@ -697,10 +691,3 @@ void vmalloc_sync_all(void) - BUILD_BUG_ON(!(((MODULES_END - 1) & PGDIR_MASK) == - (__START_KERNEL & PGDIR_MASK))); - } -- --static int __init enable_pagefaulttrace(char *str) --{ -- page_fault_trace = 1; -- return 1; --} --__setup("pagefaulttrace", enable_pagefaulttrace); ---- head.orig/arch/x86/mm/hypervisor.c 2012-05-31 14:43:34.000000000 +0200 -+++ head/arch/x86/mm/hypervisor.c 2012-05-31 14:43:47.000000000 +0200 -@@ -71,8 +71,8 @@ static inline bool use_lazy_mmu_mode(voi - - static void multicall_failed(const multicall_entry_t *mc, int rc) - { -- printk(KERN_EMERG "hypercall#%lu(%lx, %lx, %lx, %lx)" -- " failed: %d (caller %lx)\n", -+ pr_emerg("hypercall#%lu(%lx, %lx, %lx, %lx) failed: %d" -+ " (caller %lx)\n", - mc->op, mc->args[0], mc->args[1], mc->args[2], mc->args[3], - rc, mc->args[5]); - BUG(); -@@ -532,9 +532,8 @@ static int check_contig_order(unsigned i - } - balloon_unlock(flags); - vfree(df); -- printk(KERN_INFO -- "Adjusted maximum contiguous region order to %u\n", -- order); -+ pr_info("Adjusted maximum contiguous region order to %u\n", -+ order); - } - - return 0; -@@ -547,6 +546,9 @@ int xen_create_contiguous_region( - unsigned long *in_frames, out_frame, frame, flags; - unsigned int i; - int rc, success; -+#ifdef CONFIG_64BIT -+ pte_t *ptep = NULL; -+#endif - struct xen_memory_exchange exchange = { - .in = { - .nr_extents = 1UL << order, -@@ -573,6 +575,28 @@ int xen_create_contiguous_region( - if (unlikely(rc)) - return rc; + if (assoc == 0xffff) + eax->split.is_fully_associative = 1; +@@ -599,8 +600,8 @@ unsigned int __cpuinit init_intel_cachei + unsigned int trace = 0, l1i = 0, l1d = 0, l2 = 0, l3 = 0; + unsigned int new_l1d = 0, new_l1i = 0; /* Cache sizes from cpuid(4) */ + unsigned int new_l2 = 0, new_l3 = 0, i; /* Cache sizes from cpuid(4) */ +- unsigned int l2_id = 0, l3_id = 0, num_threads_sharing, index_msb; + #ifdef CONFIG_X86_HT ++ unsigned int l2_id = 0, l3_id = 0, num_threads_sharing, index_msb; + unsigned int cpu = c->cpu_index; + #endif -+#ifdef CONFIG_64BIT -+ if (unlikely(vstart > PAGE_OFFSET + MAXMEM)) { -+ unsigned int level; -+ -+ if (vstart < __START_KERNEL_map -+ || vstart + (PAGE_SIZE << order) > (unsigned long)_end) -+ return -EINVAL; -+ ptep = lookup_address((unsigned long)__va(__pa(vstart)), -+ &level); -+ if (ptep && pte_none(*ptep)) -+ ptep = NULL; -+ if (vstart < __START_KERNEL && ptep) -+ return -EINVAL; -+ rc = check_contig_order(order + 1); -+ if (unlikely(rc)) -+ return rc; -+ } -+#else -+ if (unlikely(vstart + (PAGE_SIZE << order) > (unsigned long)high_memory)) -+ return -EINVAL; +@@ -634,16 +635,20 @@ unsigned int __cpuinit init_intel_cachei + break; + case 2: + new_l2 = this_leaf.size/1024; ++#ifdef CONFIG_X86_HT + num_threads_sharing = 1 + this_leaf.eax.split.num_threads_sharing; + index_msb = get_count_order(num_threads_sharing); + l2_id = c->apicid & ~((1 << index_msb) - 1); +#endif -+ - set_xen_guest_handle(exchange.out.extent_start, &out_frame); - - scrub_pages((void *)vstart, 1 << order); -@@ -587,9 +611,19 @@ int xen_create_contiguous_region( - in_frames[i] = pfn_to_mfn((__pa(vstart) >> PAGE_SHIFT) + i); - MULTI_update_va_mapping(cr_mcl + i, vstart + (i*PAGE_SIZE), - __pte_ma(0), 0); -+#ifdef CONFIG_64BIT -+ if (ptep) -+ MULTI_update_va_mapping(cr_mcl + i + (1U << order), -+ (unsigned long)__va(__pa(vstart)) + (i*PAGE_SIZE), -+ __pte_ma(0), 0); + break; + case 3: + new_l3 = this_leaf.size/1024; ++#ifdef CONFIG_X86_HT + num_threads_sharing = 1 + this_leaf.eax.split.num_threads_sharing; + index_msb = get_count_order( + num_threads_sharing); + l3_id = c->apicid & ~((1 << index_msb) - 1); +#endif - set_phys_to_machine((__pa(vstart)>>PAGE_SHIFT)+i, - INVALID_P2M_ENTRY); + break; + default: + break; +--- a/arch/x86/kernel/cpu/mcheck/mce_dom0.c ++++ b/arch/x86/kernel/cpu/mcheck/mce_dom0.c +@@ -17,7 +17,7 @@ static int convert_log(struct mc_info *m + x86_mcinfo_lookup(mic, mi, MC_TYPE_GLOBAL); + if (mic == NULL) + { +- printk(KERN_ERR "DOM0_MCE_LOG: global data is NULL\n"); ++ pr_err("DOM0_MCE_LOG: global data is NULL\n"); + return -1; } -+#ifdef CONFIG_64BIT -+ if (ptep) -+ i += i; -+#endif - if (HYPERVISOR_multicall_check(cr_mcl, i, NULL)) - BUG(); -@@ -623,9 +657,18 @@ int xen_create_contiguous_region( - frame = success ? (out_frame + i) : in_frames[i]; - MULTI_update_va_mapping(cr_mcl + i, vstart + (i*PAGE_SIZE), - pfn_pte_ma(frame, PAGE_KERNEL), 0); -+#ifdef CONFIG_64BIT -+ if (ptep) -+ MULTI_update_va_mapping(cr_mcl + i + (1U << order), -+ (unsigned long)__va(__pa(vstart)) + (i*PAGE_SIZE), -+ pfn_pte_ma(frame, PAGE_KERNEL_RO), 0); -+#endif - set_phys_to_machine((__pa(vstart)>>PAGE_SHIFT)+i, frame); - } -- -+#ifdef CONFIG_64BIT -+ if (ptep) -+ i += i; -+#endif - cr_mcl[i - 1].args[MULTI_UVMFLAGS_INDEX] = order - ? UVMF_TLB_FLUSH|UVMF_ALL - : UVMF_INVLPG|UVMF_ALL; ---- head.orig/arch/x86/mm/init_32-xen.c 2011-01-31 17:49:31.000000000 +0100 -+++ head/arch/x86/mm/init_32-xen.c 2011-01-31 17:56:27.000000000 +0100 -@@ -94,7 +94,14 @@ static pte_t * __init one_page_table_ini - #else - if (!(__pmd_val(*pmd) & _PAGE_PRESENT)) { - #endif -- pte_t *page_table = (pte_t *) alloc_bootmem_low_pages(PAGE_SIZE); -+ pte_t *page_table = NULL; -+ -+#ifdef CONFIG_DEBUG_PAGEALLOC -+ page_table = (pte_t *) alloc_bootmem_pages(PAGE_SIZE); -+#endif -+ if (!page_table) -+ page_table = -+ (pte_t *)alloc_bootmem_low_pages(PAGE_SIZE); +@@ -74,7 +74,7 @@ urgent: + { + result = convert_log(g_mi); + if (result) { +- printk(KERN_ERR "MCE_DOM0_LOG: Log conversion failed\n"); ++ pr_err("MCE_DOM0_LOG: Log conversion failed\n"); + goto end; + } + /* After fetching the telem from DOM0, we need to dec the telem's +@@ -99,7 +99,7 @@ nonurgent: + { + result = convert_log(g_mi); + if (result) { +- printk(KERN_ERR "MCE_DOM0_LOG: Log conversion failed\n"); ++ pr_err("MCE_DOM0_LOG: Log conversion failed\n"); + goto end; + } + /* After fetching the telem from DOM0, we need to dec the telem's +@@ -124,7 +124,7 @@ void bind_virq_for_mce(void) - paravirt_alloc_pt(&init_mm, __pa(page_table) >> PAGE_SHIFT); - make_lowmem_page_readonly(page_table, -@@ -102,7 +109,7 @@ static pte_t * __init one_page_table_ini - set_pmd(pmd, __pmd(__pa(page_table) | _PAGE_TABLE)); - BUG_ON(page_table != pte_offset_kernel(pmd, 0)); - } -- -+ - return pte_offset_kernel(pmd, 0); - } + g_mi = kmalloc(sizeof(struct mc_info), GFP_KERNEL); + if (ret < 0) +- printk(KERN_ERR "MCE_DOM0_LOG: bind_virq for DOM0 failed\n"); ++ pr_err("MCE_DOM0_LOG: bind_virq for DOM0 failed\n"); -@@ -360,8 +367,13 @@ static void __init set_highmem_pages_ini - { - int pfn; - for (pfn = highstart_pfn; pfn < highend_pfn -- && pfn < xen_start_info->nr_pages; pfn++) -- add_one_highpage_init(pfn_to_page(pfn), pfn, bad_ppro); -+ && pfn < xen_start_info->nr_pages; pfn++) { -+ /* -+ * Holes under sparsemem might not have no mem_map[]: -+ */ -+ if (pfn_valid(pfn)) -+ add_one_highpage_init(pfn_to_page(pfn), pfn, bad_ppro); -+ } + /* Log the machine checks left over from the previous reset. */ + mce_dom0_interrupt(VIRQ_MCA, NULL); +--- a/arch/x86/kernel/e820-xen.c ++++ b/arch/x86/kernel/e820-xen.c +@@ -24,7 +24,7 @@ + #include + #include + #include +-#include ++#include + #include + #include - /* XEN: init high-mem pages outside initial allocation. */ - for (; pfn < highend_pfn; pfn++) { -@@ -785,35 +797,18 @@ int arch_add_memory(int nid, u64 start, - return __add_pages(zone, start_pfn, nr_pages); - } +@@ -53,7 +53,7 @@ unsigned long end_pfn_map; + */ + static unsigned long __initdata end_user_pfn = MAXMEM>>PAGE_SHIFT; --int remove_memory(u64 start, u64 size) --{ -- return -EINVAL; --} --EXPORT_SYMBOL_GPL(remove_memory); - #endif +-extern struct resource code_resource, data_resource; ++extern struct resource code_resource, data_resource, bss_resource; - struct kmem_cache *pmd_cache; + /* Check for some hardcoded bad areas that early boot is not allowed to touch */ + static inline int bad_addr(unsigned long *addrp, unsigned long size) +@@ -75,10 +75,15 @@ static inline int bad_addr(unsigned long - void __init pgtable_cache_init(void) - { -- size_t pgd_size = PTRS_PER_PGD*sizeof(pgd_t); -- -- if (PTRS_PER_PMD > 1) { -+ if (PTRS_PER_PMD > 1) - pmd_cache = kmem_cache_create("pmd", -- PTRS_PER_PMD*sizeof(pmd_t), -- PTRS_PER_PMD*sizeof(pmd_t), -- SLAB_PANIC, -- pmd_ctor); -- if (!SHARED_KERNEL_PMD) { -- /* If we're in PAE mode and have a non-shared -- kernel pmd, then the pgd size must be a -- page size. This is because the pgd_list -- links through the page structure, so there -- can only be one pgd per page for this to -- work. */ -- pgd_size = PAGE_SIZE; -- } -- } -+ PTRS_PER_PMD*sizeof(pmd_t), -+ PTRS_PER_PMD*sizeof(pmd_t), -+ SLAB_PANIC, -+ pmd_ctor); - } - - /* ---- head.orig/arch/x86/mm/init_64-xen.c 2011-01-31 17:49:31.000000000 +0100 -+++ head/arch/x86/mm/init_64-xen.c 2011-01-31 17:56:27.000000000 +0100 -@@ -798,7 +798,7 @@ static void xen_finish_init_mapping(void - /* Setup the direct mapping of the physical memory at PAGE_OFFSET. - This runs before bootmem is initialized and gets pages directly from the - physical memory. To access them they are temporarily mapped. */ --void __meminit init_memory_mapping(unsigned long start, unsigned long end) -+void __init_refok init_memory_mapping(unsigned long start, unsigned long end) - { - unsigned long next; - -@@ -932,12 +932,6 @@ error: - } - EXPORT_SYMBOL_GPL(arch_add_memory); - --int remove_memory(u64 start, u64 size) --{ -- return -EINVAL; --} --EXPORT_SYMBOL_GPL(remove_memory); -- - #if !defined(CONFIG_ACPI_NUMA) && defined(CONFIG_NUMA) - int memory_add_physaddr_to_nid(u64 start) - { -@@ -1216,14 +1210,6 @@ int in_gate_area_no_task(unsigned long a - return (addr >= VSYSCALL_START) && (addr < VSYSCALL_END); - } - --#ifndef CONFIG_XEN --void * __init alloc_bootmem_high_node(pg_data_t *pgdat, unsigned long size) --{ -- return __alloc_bootmem_core(pgdat->bdata, size, -- SMP_CACHE_BYTES, (4UL*1024*1024*1024), 0); --} --#endif -- - const char *arch_vma_name(struct vm_area_struct *vma) - { - if (vma->vm_mm && vma->vm_start == (long)vma->vm_mm->context.vdso) -@@ -1232,3 +1218,48 @@ const char *arch_vma_name(struct vm_area - return "[vsyscall]"; - return NULL; + /* initrd */ + #ifdef CONFIG_BLK_DEV_INITRD +- if (LOADER_TYPE && INITRD_START && last >= INITRD_START && +- addr < INITRD_START+INITRD_SIZE) { +- *addrp = PAGE_ALIGN(INITRD_START + INITRD_SIZE); +- return 1; ++ if (boot_params.hdr.type_of_loader && boot_params.hdr.ramdisk_image) { ++ unsigned long ramdisk_image = boot_params.hdr.ramdisk_image; ++ unsigned long ramdisk_size = boot_params.hdr.ramdisk_size; ++ unsigned long ramdisk_end = ramdisk_image+ramdisk_size; ++ ++ if (last >= ramdisk_image && addr < ramdisk_end) { ++ *addrp = PAGE_ALIGN(ramdisk_end); ++ return 1; ++ } + } + #endif + /* kernel code */ +@@ -251,6 +256,7 @@ void __init e820_reserve_resources(struc + #ifndef CONFIG_XEN + request_resource(res, &code_resource); + request_resource(res, &data_resource); ++ request_resource(res, &bss_resource); + #endif + #ifdef CONFIG_KEXEC + if (crashk_res.start != crashk_res.end) +@@ -661,8 +667,8 @@ void __init setup_memory_region(void) + * Otherwise fake a memory map; one section from 0k->640k, + * the next section from 1mb->appropriate_mem_k + */ +- sanitize_e820_map(E820_MAP, &E820_MAP_NR); +- if (copy_e820_map(E820_MAP, E820_MAP_NR) < 0) ++ sanitize_e820_map(boot_params.e820_map, &boot_params.e820_entries); ++ if (copy_e820_map(boot_params.e820_map, boot_params.e820_entries) < 0) + early_panic("Cannot find a valid memory map"); + printk(KERN_INFO "BIOS-provided physical RAM map:\n"); + e820_print_map("BIOS-e820"); +@@ -847,3 +853,22 @@ __init void e820_setup_gap(struct e820en + printk(KERN_INFO "Allocating PCI resources starting at %lx (gap: %lx:%lx)\n", + pci_mem_start, gapstart, gapsize); } + -+#ifdef CONFIG_SPARSEMEM_VMEMMAP -+/* -+ * Initialise the sparsemem vmemmap using huge-pages at the PMD level. -+ */ -+int __meminit vmemmap_populate(struct page *start_page, -+ unsigned long size, int node) ++int __init arch_get_ram_range(int slot, u64 *addr, u64 *size) +{ -+ unsigned long addr = (unsigned long)start_page; -+ unsigned long end = (unsigned long)(start_page + size); -+ unsigned long next; -+ pgd_t *pgd; -+ pud_t *pud; -+ pmd_t *pmd; -+ -+ for (; addr < end; addr = next) { -+ next = pmd_addr_end(addr, end); -+ -+ pgd = vmemmap_pgd_populate(addr, node); -+ if (!pgd) -+ return -ENOMEM; -+ pud = vmemmap_pud_populate(pgd, addr, node); -+ if (!pud) -+ return -ENOMEM; -+ -+ pmd = pmd_offset(pud, addr); -+ if (pmd_none(*pmd)) { -+ pte_t entry; -+ void *p = vmemmap_alloc_block(PMD_SIZE, node); -+ if (!p) -+ return -ENOMEM; -+ -+ entry = pfn_pte(__pa(p) >> PAGE_SHIFT, PAGE_KERNEL); -+ mk_pte_huge(entry); -+ set_pmd(pmd, __pmd(pte_val(entry))); ++ int i; + -+ printk(KERN_DEBUG " [%lx-%lx] PMD ->%p on node %d\n", -+ addr, addr + PMD_SIZE - 1, p, node); -+ } else -+ vmemmap_verify((pte_t *)pmd, node, addr, next); ++ if (slot < 0 || slot >= e820.nr_map) ++ return -1; ++ for (i = slot; i < e820.nr_map; i++) { ++ if (e820.map[i].type != E820_RAM) ++ continue; ++ break; + } -+ -+ return 0; ++ if (i == e820.nr_map || e820.map[i].addr > (max_pfn << PAGE_SHIFT)) ++ return -1; ++ *addr = e820.map[i].addr; ++ *size = min_t(u64, e820.map[i].size + e820.map[i].addr, ++ max_pfn << PAGE_SHIFT) - *addr; ++ return i + 1; +} -+#endif ---- head.orig/arch/x86/mm/pageattr_64-xen.c 2011-01-31 17:49:31.000000000 +0100 -+++ head/arch/x86/mm/pageattr_64-xen.c 2011-01-31 17:56:27.000000000 +0100 -@@ -17,9 +17,6 @@ - #include - #include - --LIST_HEAD(mm_unpinned); --DEFINE_SPINLOCK(mm_unpinned_lock); +--- a/arch/x86/kernel/early_printk-xen.c ++++ b/arch/x86/kernel/early_printk-xen.c +@@ -6,15 +6,10 @@ + #include + #include + #include - - static void _pin_lock(struct mm_struct *mm, int lock) { - if (lock) - spin_lock(&mm->page_table_lock); -@@ -81,8 +78,8 @@ static void _pin_lock(struct mm_struct * - #define PIN_BATCH 8 - static DEFINE_PER_CPU(multicall_entry_t[PIN_BATCH], pb_mcl); +-/* Simple VGA output */ +- +-#ifdef __i386__ + #include +-#else +-#include +-#endif ++ + #ifndef CONFIG_XEN ++/* Simple VGA output */ + #define VGABASE (__ISA_IO_base + 0xb8000) --static inline unsigned int mm_walk_set_prot(void *pt, pgprot_t flags, -- unsigned int cpu, unsigned int seq) -+static inline unsigned int pgd_walk_set_prot(void *pt, pgprot_t flags, -+ unsigned int cpu, unsigned int seq) - { - struct page *page = virt_to_page(pt); - unsigned long pfn = page_to_pfn(page); -@@ -100,9 +97,9 @@ static inline unsigned int mm_walk_set_p - return seq; - } + static int max_ypos = 25, max_xpos = 80; +@@ -264,10 +259,10 @@ static int __init setup_early_printk(cha + early_console = &early_serial_console; + } else if (!strncmp(buf, "vga", 3)) { + #ifndef CONFIG_XEN +- && SCREEN_INFO.orig_video_isVGA == 1) { +- max_xpos = SCREEN_INFO.orig_video_cols; +- max_ypos = SCREEN_INFO.orig_video_lines; +- current_ypos = SCREEN_INFO.orig_y; ++ && boot_params.screen_info.orig_video_isVGA == 1) { ++ max_xpos = boot_params.screen_info.orig_video_cols; ++ max_ypos = boot_params.screen_info.orig_video_lines; ++ current_ypos = boot_params.screen_info.orig_y; + #endif + early_console = &early_vga_console; + } else if (!strncmp(buf, "simnow", 6)) { +--- a/arch/x86/kernel/entry_32-xen.S ++++ b/arch/x86/kernel/entry_32-xen.S +@@ -254,6 +254,7 @@ check_userspace: + jb resume_kernel # not returning to v8086 or userspace --static void mm_walk(struct mm_struct *mm, pgprot_t flags) -+static void pgd_walk(pgd_t *pgd_base, pgprot_t flags) - { -- pgd_t *pgd; -+ pgd_t *pgd = pgd_base; - pud_t *pud; - pmd_t *pmd; - pte_t *pte; -@@ -110,7 +107,6 @@ static void mm_walk(struct mm_struct *mm - unsigned int cpu, seq; - multicall_entry_t *mcl; + ENTRY(resume_userspace) ++ LOCKDEP_SYS_EXIT + DISABLE_INTERRUPTS(CLBR_ANY) # make sure we don't miss an interrupt + # setting need_resched or sigpending + # between sampling and the iret +@@ -341,6 +342,7 @@ sysenter_past_esp: + jae syscall_badsys + call *sys_call_table(,%eax,4) + movl %eax,PT_EAX(%esp) ++ LOCKDEP_SYS_EXIT + DISABLE_INTERRUPTS(CLBR_ANY) + TRACE_IRQS_OFF + movl TI_flags(%ebp), %ecx +@@ -406,6 +408,7 @@ syscall_call: + call *sys_call_table(,%eax,4) + movl %eax,PT_EAX(%esp) # store the return value + syscall_exit: ++ LOCKDEP_SYS_EXIT + DISABLE_INTERRUPTS(CLBR_ANY) # make sure we don't miss an interrupt + # setting need_resched or sigpending + # between sampling and the iret +@@ -478,7 +481,7 @@ ldt_ss: + * is still available to implement the setting of the high + * 16-bits in the INTERRUPT_RETURN paravirt-op. + */ +- cmpl $0, paravirt_ops+PARAVIRT_enabled ++ cmpl $0, pv_info+PARAVIRT_enabled + jne restore_nocheck + #endif -- pgd = mm->pgd; - cpu = get_cpu(); +@@ -540,6 +543,7 @@ work_pending: + jz work_notifysig + work_resched: + call schedule ++ LOCKDEP_SYS_EXIT + DISABLE_INTERRUPTS(CLBR_ANY) # make sure we don't miss an interrupt + # setting need_resched or sigpending + # between sampling and the iret +@@ -1268,6 +1272,6 @@ ENTRY(kernel_thread_helper) + ENDPROC(kernel_thread_helper) - /* -@@ -125,18 +121,18 @@ static void mm_walk(struct mm_struct *mm - continue; - pud = pud_offset(pgd, 0); - if (PTRS_PER_PUD > 1) /* not folded */ -- seq = mm_walk_set_prot(pud,flags,cpu,seq); -+ seq = pgd_walk_set_prot(pud,flags,cpu,seq); - for (u = 0; u < PTRS_PER_PUD; u++, pud++) { - if (pud_none(*pud)) - continue; - pmd = pmd_offset(pud, 0); - if (PTRS_PER_PMD > 1) /* not folded */ -- seq = mm_walk_set_prot(pmd,flags,cpu,seq); -+ seq = pgd_walk_set_prot(pmd,flags,cpu,seq); - for (m = 0; m < PTRS_PER_PMD; m++, pmd++) { - if (pmd_none(*pmd)) - continue; - pte = pte_offset_kernel(pmd,0); -- seq = mm_walk_set_prot(pte,flags,cpu,seq); -+ seq = pgd_walk_set_prot(pte,flags,cpu,seq); - } - } - } -@@ -148,12 +144,12 @@ static void mm_walk(struct mm_struct *mm - seq = 0; - } - MULTI_update_va_mapping(mcl + seq, -- (unsigned long)__user_pgd(mm->pgd), -- pfn_pte(virt_to_phys(__user_pgd(mm->pgd))>>PAGE_SHIFT, flags), -+ (unsigned long)__user_pgd(pgd_base), -+ pfn_pte(virt_to_phys(__user_pgd(pgd_base))>>PAGE_SHIFT, flags), - 0); - MULTI_update_va_mapping(mcl + seq + 1, -- (unsigned long)mm->pgd, -- pfn_pte(virt_to_phys(mm->pgd)>>PAGE_SHIFT, flags), -+ (unsigned long)pgd_base, -+ pfn_pte(virt_to_phys(pgd_base)>>PAGE_SHIFT, flags), - UVMF_TLB_FLUSH); - if (unlikely(HYPERVISOR_multicall_check(mcl, seq + 2, NULL))) - BUG(); -@@ -161,21 +157,35 @@ static void mm_walk(struct mm_struct *mm - put_cpu(); - } - -+static void __pgd_pin(pgd_t *pgd) -+{ -+ pgd_walk(pgd, PAGE_KERNEL_RO); -+ xen_pgd_pin(__pa(pgd)); /* kernel */ -+ xen_pgd_pin(__pa(__user_pgd(pgd))); /* user */ -+ SetPagePinned(virt_to_page(pgd)); -+} -+ -+static void __pgd_unpin(pgd_t *pgd) -+{ -+ xen_pgd_unpin(__pa(pgd)); -+ xen_pgd_unpin(__pa(__user_pgd(pgd))); -+ pgd_walk(pgd, PAGE_KERNEL); -+ ClearPagePinned(virt_to_page(pgd)); -+} -+ -+void pgd_test_and_unpin(pgd_t *pgd) -+{ -+ if (PagePinned(virt_to_page(pgd))) -+ __pgd_unpin(pgd); -+} -+ - void mm_pin(struct mm_struct *mm) - { - if (xen_feature(XENFEAT_writable_page_tables)) - return; + .section .rodata,"a" +-#include "syscall_table.S" ++#include "syscall_table_32.S" - pin_lock(mm); -- -- mm_walk(mm, PAGE_KERNEL_RO); -- xen_pgd_pin(__pa(mm->pgd)); /* kernel */ -- xen_pgd_pin(__pa(__user_pgd(mm->pgd))); /* user */ -- SetPagePinned(virt_to_page(mm->pgd)); -- spin_lock(&mm_unpinned_lock); -- list_del(&mm->context.unpinned); -- spin_unlock(&mm_unpinned_lock); -- -+ __pgd_pin(mm->pgd); - pin_unlock(mm); - } + syscall_table_size=(.-sys_call_table) +--- a/arch/x86/kernel/entry_64-xen.S ++++ b/arch/x86/kernel/entry_64-xen.S +@@ -57,7 +57,7 @@ + #include + #include -@@ -185,34 +195,30 @@ void mm_unpin(struct mm_struct *mm) - return; +-#include "xen_entry.S" ++#include "xen_entry_64.S" + + .code64 - pin_lock(mm); -- -- xen_pgd_unpin(__pa(mm->pgd)); -- xen_pgd_unpin(__pa(__user_pgd(mm->pgd))); -- mm_walk(mm, PAGE_KERNEL); -- ClearPagePinned(virt_to_page(mm->pgd)); -- spin_lock(&mm_unpinned_lock); -- list_add(&mm->context.unpinned, &mm_unpinned); -- spin_unlock(&mm_unpinned_lock); -- -+ __pgd_unpin(mm->pgd); - pin_unlock(mm); - } +@@ -277,6 +277,7 @@ ret_from_sys_call: + movl $_TIF_ALLWORK_MASK,%edi + /* edi: flagmask */ + sysret_check: ++ LOCKDEP_SYS_EXIT + GET_THREAD_INFO(%rcx) + XEN_BLOCK_EVENTS(%rsi) + TRACE_IRQS_OFF +@@ -368,6 +369,7 @@ int_ret_from_sys_call: + movl $_TIF_ALLWORK_MASK,%edi + /* edi: mask to check */ + int_with_check: ++ LOCKDEP_SYS_EXIT_IRQ + GET_THREAD_INFO(%rcx) + movl threadinfo_flags(%rcx),%edx + andl %edi,%edx +@@ -519,11 +521,12 @@ END(stub_rt_sigreturn) - void mm_pin_all(void) - { -+ struct page *page; -+ unsigned long flags; -+ - if (xen_feature(XENFEAT_writable_page_tables)) - return; + retint_check: + CFI_DEFAULT_STACK adj=1 ++ LOCKDEP_SYS_EXIT_IRQ + movl threadinfo_flags(%rcx),%edx + andl %edi,%edx + CFI_REMEMBER_STATE + jnz retint_careful +-retint_restore_args: ++retint_restore_args: /* return to kernel space */ + movl EFLAGS-REST_SKIP(%rsp), %eax + shr $9, %eax # EAX[0] == IRET_EFLAGS.IF + XEN_GET_VCPU_INFO(%rsi) +@@ -844,7 +847,7 @@ error_call_handler: + movq ORIG_RAX(%rsp),%rsi # get error code + movq $-1,ORIG_RAX(%rsp) + call *%rax +-error_exit: ++error_exit: + RESTORE_REST + /* cli */ + XEN_BLOCK_EVENTS(%rsi) +@@ -852,14 +855,11 @@ error_exit: + GET_THREAD_INFO(%rcx) + testb $3,CS-ARGOFFSET(%rsp) + jz retint_kernel ++ LOCKDEP_SYS_EXIT_IRQ + movl threadinfo_flags(%rcx),%edx + movl $_TIF_WORK_MASK,%edi + andl %edi,%edx + jnz retint_careful +- /* +- * The iret might restore flags: +- */ +- TRACE_IRQS_IRETQ + jmp retint_restore_args - /* -- * Allow uninterrupted access to the mm_unpinned list. We don't -- * actually take the mm_unpinned_lock as it is taken inside mm_pin(). -+ * Allow uninterrupted access to the pgd_list. Also protects -+ * __pgd_pin() by disabling preemption. - * All other CPUs must be at a safe point (e.g., in stop_machine - * or offlined entirely). - */ -- preempt_disable(); -- while (!list_empty(&mm_unpinned)) -- mm_pin(list_entry(mm_unpinned.next, struct mm_struct, -- context.unpinned)); -- preempt_enable(); -+ spin_lock_irqsave(&pgd_lock, flags); -+ list_for_each_entry(page, &pgd_list, lru) { -+ if (!PagePinned(page)) -+ __pgd_pin((pgd_t *)page_address(page)); -+ } -+ spin_unlock_irqrestore(&pgd_lock, flags); - } + #if 0 +@@ -1074,7 +1074,7 @@ child_rip: + movq %rsi, %rdi + call *%rax + # exit +- xorl %edi, %edi ++ mov %eax, %edi + call do_exit + CFI_ENDPROC + ENDPROC(child_rip) +--- a/arch/x86/kernel/fixup.c ++++ b/arch/x86/kernel/fixup.c +@@ -34,7 +34,7 @@ + #include + #include - void arch_dup_mmap(struct mm_struct *oldmm, struct mm_struct *mm) -@@ -331,11 +337,11 @@ static struct page *split_large_page(uns - return base; - } +-#define DP(_f, _args...) printk(KERN_ALERT " " _f "\n" , ## _args ) ++#define DP(_f, _args...) pr_alert(" " _f "\n" , ## _args ) --static void cache_flush_page(void *adr) -+void clflush_cache_range(void *adr, int size) + fastcall void do_fixup_4gb_segment(struct pt_regs *regs, long error_code) { - int i; -- for (i = 0; i < PAGE_SIZE; i += boot_cpu_data.x86_clflush_size) -- asm volatile("clflush (%0)" :: "r" (adr + i)); -+ for (i = 0; i < size; i += boot_cpu_data.x86_clflush_size) -+ clflush(adr+i); - } - - static void flush_kernel_map(void *arg) -@@ -350,7 +356,7 @@ static void flush_kernel_map(void *arg) - asm volatile("wbinvd" ::: "memory"); - else list_for_each_entry(pg, l, lru) { - void *adr = page_address(pg); -- cache_flush_page(adr); -+ clflush_cache_range(adr, PAGE_SIZE); - } - __flush_tlb_all(); +--- a/arch/x86/kernel/head64-xen.c ++++ b/arch/x86/kernel/head64-xen.c +@@ -1,5 +1,5 @@ + /* +- * linux/arch/x86_64/kernel/head64.c -- prepare to run common code ++ * prepare to run common code + * + * Copyright (C) 2000 Andrea Arcangeli SuSE + * +@@ -21,7 +21,6 @@ + #include + #include + #include +-#include + #include + #include + #include +@@ -47,27 +46,16 @@ static void __init clear_bss(void) } -@@ -418,6 +424,7 @@ __change_page_attr(unsigned long address - split = split_large_page(address, prot, ref_prot2); - if (!split) - return -ENOMEM; -+ pgprot_val(ref_prot2) &= ~_PAGE_NX; - set_pte(kpte, mk_pte(split, ref_prot2)); - kpte_page = split; - } -@@ -510,9 +517,14 @@ void global_flush_tlb(void) - struct page *pg, *next; - struct list_head l; + #endif -- down_read(&init_mm.mmap_sem); -+ /* -+ * Write-protect the semaphore, to exclude two contexts -+ * doing a list_replace_init() call in parallel and to -+ * exclude new additions to the deferred_pages list: -+ */ -+ down_write(&init_mm.mmap_sem); - list_replace_init(&deferred_pages, &l); -- up_read(&init_mm.mmap_sem); -+ up_write(&init_mm.mmap_sem); +-#define NEW_CL_POINTER 0x228 /* Relative to real mode data */ +-#define OLD_CL_MAGIC_ADDR 0x20 +-#define OLD_CL_MAGIC 0xA33F +-#define OLD_CL_OFFSET 0x22 +- + static void __init copy_bootdata(char *real_mode_data) + { + #ifndef CONFIG_XEN +- unsigned long new_data; + char * command_line; - flush_map(&l); +- memcpy(x86_boot_params, real_mode_data, BOOT_PARAM_SIZE); +- new_data = *(u32 *) (x86_boot_params + NEW_CL_POINTER); +- if (!new_data) { +- if (OLD_CL_MAGIC != *(u16 *)(real_mode_data + OLD_CL_MAGIC_ADDR)) { +- return; +- } +- new_data = __pa(real_mode_data) + *(u16 *)(real_mode_data + OLD_CL_OFFSET); ++ memcpy(&boot_params, real_mode_data, sizeof boot_params); ++ if (boot_params.hdr.cmd_line_ptr) { ++ command_line = __va(boot_params.hdr.cmd_line_ptr); ++ memcpy(boot_command_line, command_line, COMMAND_LINE_SIZE); + } +- command_line = __va(new_data); +- memcpy(boot_command_line, command_line, COMMAND_LINE_SIZE); + #else + int max_cmdline; + +@@ -114,7 +102,7 @@ void __init x86_64_start_kernel(char * r ---- head.orig/arch/x86/mm/pgtable_32-xen.c 2011-01-31 17:49:31.000000000 +0100 -+++ head/arch/x86/mm/pgtable_32-xen.c 2011-01-31 17:56:27.000000000 +0100 -@@ -6,6 +6,7 @@ - #include - #include - #include -+#include - #include - #include - #include -@@ -46,6 +47,8 @@ void show_mem(void) - for_each_online_pgdat(pgdat) { - pgdat_resize_lock(pgdat, &flags); - for (i = 0; i < pgdat->node_spanned_pages; ++i) { -+ if (unlikely(i % MAX_ORDER_NR_PAGES == 0)) -+ touch_nmi_watchdog(); - page = pgdat_page_nr(pgdat, i); - total++; - if (PageHighMem(page)) -@@ -206,7 +209,7 @@ void pte_free(struct page *pte) - __free_page(pte); - } + for (i = 0; i < IDT_ENTRIES; i++) + set_intr_gate(i, early_idt_handler); +- asm volatile("lidt %0" :: "m" (idt_descr)); ++ load_idt((const struct desc_ptr *)&idt_descr); + #endif --void pmd_ctor(void *pmd, struct kmem_cache *cache, unsigned long flags) -+void pmd_ctor(struct kmem_cache *cache, void *pmd) - { - memset(pmd, 0, PTRS_PER_PMD*sizeof(pmd_t)); + early_printk("Kernel alive\n"); +--- a/arch/x86/kernel/ioport-xen.c ++++ b/arch/x86/kernel/ioport-xen.c +@@ -1,6 +1,4 @@ + /* +- * linux/arch/x86_64/kernel/ioport.c +- * + * This contains the io-permission bitmap code - written by obz, with changes + * by Linus. + */ +--- a/arch/x86/kernel/ldt-xen.c ++++ b/arch/x86/kernel/ldt-xen.c +@@ -1,6 +1,4 @@ + /* +- * linux/arch/x86_64/kernel/ldt.c +- * + * Copyright (C) 1992 Krishna Balasubramanian and Linus Torvalds + * Copyright (C) 1999 Ingo Molnar + * Copyright (C) 2002 Andi Kleen +@@ -112,19 +110,14 @@ int init_new_context(struct task_struct + int retval = 0; + + memset(&mm->context, 0, sizeof(mm->context)); +- init_MUTEX(&mm->context.sem); ++ mutex_init(&mm->context.lock); + old_mm = current->mm; + if (old_mm) + mm->context.vdso = old_mm->context.vdso; + if (old_mm && old_mm->context.size > 0) { +- down(&old_mm->context.sem); ++ mutex_lock(&old_mm->context.lock); + retval = copy_ldt(&mm->context, &old_mm->context); +- up(&old_mm->context.sem); +- } +- if (retval == 0) { +- spin_lock(&mm_unpinned_lock); +- list_add(&mm->context.unpinned, &mm_unpinned); +- spin_unlock(&mm_unpinned_lock); ++ mutex_unlock(&old_mm->context.lock); + } + return retval; + } +@@ -148,11 +141,6 @@ void destroy_context(struct mm_struct *m + kfree(mm->context.ldt); + mm->context.size = 0; + } +- if (!PagePinned(virt_to_page(mm->pgd))) { +- spin_lock(&mm_unpinned_lock); +- list_del(&mm->context.unpinned); +- spin_unlock(&mm_unpinned_lock); +- } } ---- head.orig/arch/x86/pci/pcifront.c 2009-03-18 10:39:31.000000000 +0100 -+++ head/arch/x86/pci/pcifront.c 2011-01-31 17:56:27.000000000 +0100 -@@ -31,7 +31,7 @@ static int __init pcifront_x86_stub_init - if (raw_pci_ops) - return 0; -- printk(KERN_INFO "PCI: setting up Xen PCI frontend stub\n"); -+ pr_info("PCI: setting up Xen PCI frontend stub\n"); + static int read_ldt(void __user * ptr, unsigned long bytecount) +@@ -166,7 +154,7 @@ static int read_ldt(void __user * ptr, u + if (bytecount > LDT_ENTRY_SIZE*LDT_ENTRIES) + bytecount = LDT_ENTRY_SIZE*LDT_ENTRIES; - /* Copied from arch/i386/pci/common.c */ - pci_cache_line_size = 32 >> 2; ---- head.orig/drivers/acpi/processor_core.c 2013-03-21 11:14:45.000000000 +0100 -+++ head/drivers/acpi/processor_core.c 2013-03-21 14:20:28.000000000 +0100 -@@ -200,11 +200,21 @@ int acpi_get_cpuid(acpi_handle handle, i +- down(&mm->context.sem); ++ mutex_lock(&mm->context.lock); + size = mm->context.size*LDT_ENTRY_SIZE; + if (size > bytecount) + size = bytecount; +@@ -174,7 +162,7 @@ static int read_ldt(void __user * ptr, u + err = 0; + if (copy_to_user(ptr, mm->context.ldt, size)) + err = -EFAULT; +- up(&mm->context.sem); ++ mutex_unlock(&mm->context.lock); + if (err < 0) + goto error_return; + if (size != bytecount) { +@@ -227,7 +215,7 @@ static int write_ldt(void __user * ptr, + goto out; } - #ifdef CONFIG_SMP -+#ifndef CONFIG_PROCESSOR_EXTERNAL_CONTROL - for_each_possible_cpu(i) { - if (cpu_physical_id(i) == apic_id) - return i; - } - #else -+ /* -+ * Use of cpu_physical_id() is bogus here. Rather than defining a -+ * stub enforcing a 1:1 mapping, we keep it undefined to catch bad -+ * uses. Return as if there was a 1:1 mapping. -+ */ -+ if (apic_id < NR_CPUS && cpu_possible(apic_id)) -+ return apic_id; -+#endif -+#else - /* In UP kernel, only processor 0 is valid */ - if (apic_id == 0) - return apic_id; ---- head.orig/drivers/acpi/processor_extcntl.c 2011-01-31 17:32:22.000000000 +0100 -+++ head/drivers/acpi/processor_extcntl.c 2011-01-31 17:56:27.000000000 +0100 -@@ -95,7 +95,7 @@ int processor_notify_external(struct acp - ret = processor_extcntl_ops->hotplug(pr, type); - break; - default: -- printk(KERN_ERR "Unsupport processor events %d.\n", event); -+ pr_err("Unsupported processor event %d.\n", event); - break; - } +- down(&mm->context.sem); ++ mutex_lock(&mm->context.lock); + if (ldt_info.entry_number >= (unsigned)mm->context.size) { + error = alloc_ldt(¤t->mm->context, ldt_info.entry_number+1, 1); + if (error < 0) +@@ -256,7 +244,7 @@ install: + error = HYPERVISOR_update_descriptor(mach_lp, (unsigned long)((entry_1 | (unsigned long) entry_2 << 32))); ---- head.orig/drivers/acpi/processor_idle.c 2013-03-21 12:21:53.000000000 +0100 -+++ head/drivers/acpi/processor_idle.c 2013-03-21 14:20:32.000000000 +0100 -@@ -1086,6 +1086,14 @@ int acpi_processor_hotplug(struct acpi_p - if (!pr->flags.power_setup_done) - return -ENODEV; + out_unlock: +- up(&mm->context.sem); ++ mutex_unlock(&mm->context.lock); + out: + return error; + } +--- a/arch/x86/kernel/mpparse-xen.c ++++ b/arch/x86/kernel/mpparse-xen.c +@@ -65,8 +65,10 @@ unsigned long mp_lapic_addr; -+ if (processor_pm_external()) { -+ pr->flags.power = 0; -+ ret = acpi_processor_get_power_info(pr); -+ processor_notify_external(pr, -+ PROCESSOR_PM_CHANGE, PM_TYPE_IDLE); -+ return ret; -+ } -+ - dev = per_cpu(acpi_cpuidle_device, pr->id); - cpuidle_pause_and_lock(); - cpuidle_disable_device(dev); ---- head.orig/drivers/char/tpm/tpm_xen.c 2012-03-12 13:33:35.000000000 +0100 -+++ head/drivers/char/tpm/tpm_xen.c 2012-03-12 13:40:20.000000000 +0100 -@@ -104,9 +104,9 @@ void __exit tpmif_exit(void); - #define DPRINTK(fmt, args...) \ - pr_debug("xen_tpm_fr (%s:%d) " fmt, __FUNCTION__, __LINE__, ##args) - #define IPRINTK(fmt, args...) \ -- printk(KERN_INFO "xen_tpm_fr: " fmt, ##args) -+ pr_info("xen_tpm_fr: " fmt, ##args) - #define WPRINTK(fmt, args...) \ -- printk(KERN_WARNING "xen_tpm_fr: " fmt, ##args) -+ pr_warning("xen_tpm_fr: " fmt, ##args) + unsigned int def_to_bigsmp = 0; ++#ifndef CONFIG_XEN + /* Processor that is doing the boot up */ + unsigned int boot_cpu_physical_apicid = -1U; ++#endif + /* Internal processor count */ + unsigned int __cpuinitdata num_processors; - static inline int ---- head.orig/drivers/cpuidle/Kconfig 2013-03-21 11:14:46.000000000 +0100 -+++ head/drivers/cpuidle/Kconfig 2012-02-29 10:35:17.000000000 +0100 -@@ -1,6 +1,7 @@ +@@ -842,6 +844,7 @@ void __init mp_register_lapic_address(u6 + void __cpuinit mp_register_lapic (u8 id, u8 enabled) + { + struct mpc_config_processor processor; ++#ifndef CONFIG_XEN + int boot_cpu = 0; + + if (MAX_APICS - id <= 0) { +@@ -853,7 +856,6 @@ void __cpuinit mp_register_lapic (u8 id, + if (id == boot_cpu_physical_apicid) + boot_cpu = 1; - config CPU_IDLE - bool "CPU idle PM support" -+ depends on !PROCESSOR_EXTERNAL_CONTROL - default y if ACPI || PPC_PSERIES - help - CPU idle is a generic framework for supporting software-controlled ---- head.orig/drivers/dma/Kconfig 2013-03-21 11:14:46.000000000 +0100 -+++ head/drivers/dma/Kconfig 2012-08-20 10:38:08.000000000 +0200 -@@ -62,7 +62,7 @@ config INTEL_IOATDMA - tristate "Intel I/OAT DMA support" - depends on PCI && X86 - select DMA_ENGINE -- select DCA -+ select DCA if !XEN - select ASYNC_TX_DISABLE_PQ_VAL_DMA - select ASYNC_TX_DISABLE_XOR_VAL_DMA - help ---- head.orig/drivers/dma/ioat/Makefile 2011-01-05 01:50:19.000000000 +0100 -+++ head/drivers/dma/ioat/Makefile 2011-01-31 17:56:27.000000000 +0100 -@@ -1,2 +1,3 @@ - obj-$(CONFIG_INTEL_IOATDMA) += ioatdma.o --ioatdma-y := pci.o dma.o dma_v2.o dma_v3.o dca.o -+dca-$(CONFIG_DCA) := dca.o -+ioatdma-y := pci.o dma.o dma_v2.o dma_v3.o $(dca-y) $(dca-m) ---- head.orig/drivers/dma/ioat/dca.c 2013-02-19 00:58:34.000000000 +0100 -+++ head/drivers/dma/ioat/dca.c 2013-01-14 13:50:00.000000000 +0100 -@@ -702,3 +702,15 @@ struct dca_provider *ioat3_dca_init(stru +-#ifndef CONFIG_XEN + processor.mpc_type = MP_PROCESSOR; + processor.mpc_apicid = id; + processor.mpc_apicver = GET_APIC_VERSION(apic_read(APIC_LVR)); +@@ -921,11 +923,11 @@ void __init mp_register_ioapic(u8 id, u3 - return dca; - } -+ -+void ioat_remove_dca_provider(struct pci_dev *pdev) -+{ -+ struct ioatdma_device *device = pci_get_drvdata(pdev); -+ -+ if (!device->dca) -+ return; -+ -+ unregister_dca_provider(device->dca, &pdev->dev); -+ free_dca_provider(device->dca); -+ device->dca = NULL; -+} ---- head.orig/drivers/dma/ioat/dma.h 2013-03-21 11:14:47.000000000 +0100 -+++ head/drivers/dma/ioat/dma.h 2013-03-21 14:20:41.000000000 +0100 -@@ -324,4 +324,22 @@ void ioat_kobject_del(struct ioatdma_dev - extern const struct sysfs_ops ioat_sysfs_ops; - extern struct ioat_sysfs_entry ioat_version_attr; - extern struct ioat_sysfs_entry ioat_cap_attr; -+ -+#ifndef CONFIG_XEN -+void ioat_remove_dca_provider(struct pci_dev *); -+#else -+static inline void ioat_remove_dca_provider(struct pci_dev *pdev) -+{ -+ struct ioatdma_device *device = pci_get_drvdata(pdev); -+ BUG_ON(device->dca); -+} -+static inline struct dca_provider *__devinit -+__ioat_dca_init(struct pci_dev *pdev, void __iomem *iobase) -+{ -+ return NULL; -+} -+#define ioat_dca_init __ioat_dca_init -+#define ioat2_dca_init __ioat_dca_init + #ifndef CONFIG_XEN + set_fixmap_nocache(FIX_IO_APIC_BASE_0 + idx, address); +-#endif + if ((boot_cpu_data.x86_vendor == X86_VENDOR_INTEL) + && !APIC_XAPIC(apic_version[boot_cpu_physical_apicid])) + tmpid = io_apic_get_unique_id(idx, id); + else +#endif -+ - #endif /* IOATDMA_H */ ---- head.orig/drivers/dma/ioat/pci.c 2013-03-21 11:14:47.000000000 +0100 -+++ head/drivers/dma/ioat/pci.c 2013-03-21 14:20:42.000000000 +0100 -@@ -29,7 +29,6 @@ - #include + tmpid = id; + if (tmpid == -1) { + nr_ioapics--; +@@ -1023,7 +1025,7 @@ void __init mp_config_acpi_legacy_irqs ( + + /* + * Use the default configuration for the IRQs 0-15. Unless +- * overriden by (MADT) interrupt source override entries. ++ * overridden by (MADT) interrupt source override entries. + */ + for (i = 0; i < 16; i++) { + int idx; +--- a/arch/x86/kernel/pci-dma-xen.c ++++ b/arch/x86/kernel/pci-dma-xen.c +@@ -13,14 +13,13 @@ #include - #include --#include - #include - #include "dma.h" - #include "dma_v2.h" -@@ -191,11 +190,7 @@ static void ioat_remove(struct pci_dev * - return; + #include + #include +-#include + #include + #include + #include + #include + #include +-#include +-#include ++#include ++#include + #include - dev_err(&pdev->dev, "Removing dma and dca services\n"); -- if (device->dca) { -- unregister_dca_provider(device->dca, &pdev->dev); -- free_dca_provider(device->dca); -- device->dca = NULL; -- } -+ ioat_remove_dca_provider(pdev); - ioat_dma_remove(device); + #ifdef __x86_64__ +@@ -106,27 +105,29 @@ int range_straddles_page_boundary(paddr_ } ---- head.orig/drivers/firmware/dell_rbu.c 2011-04-13 11:25:29.000000000 +0200 -+++ head/drivers/firmware/dell_rbu.c 2011-01-31 17:56:27.000000000 +0100 -@@ -175,9 +175,8 @@ static int create_packet(void *data, siz - (unsigned long)packet_data_temp_buf, ordernum, 0)) { - free_pages((unsigned long)packet_data_temp_buf, - ordernum); -- printk(KERN_WARNING -- "dell_rbu:%s: failed to adjust new " -- "packet\n", __func__); -+ pr_warning("dell_rbu:%s: failed to adjust new " -+ "packet\n", __func__); - retval = -ENOMEM; - spin_lock(&rbu_data.lock); - goto out_alloc_packet_array; ---- head.orig/drivers/hwmon/coretemp-xen.c 2011-01-31 17:32:29.000000000 +0100 -+++ head/drivers/hwmon/coretemp-xen.c 2011-01-31 17:56:27.000000000 +0100 -@@ -49,7 +49,7 @@ static struct coretemp_data *coretemp_up - struct pdev_entry { - struct list_head list; - struct platform_device *pdev; -- struct class_device *class_dev; -+ struct device *hwmon_dev; - struct mutex update_lock; - const char *name; - u8 x86_model, x86_mask; -@@ -61,8 +61,6 @@ struct pdev_entry { - u8 alarm; - }; - --static struct coretemp_data *coretemp_update_device(struct device *dev); -- - /* - * Sysfs stuff - */ -@@ -224,9 +222,9 @@ static int coretemp_probe(struct platfor - if ((err = sysfs_create_group(&pdev->dev.kobj, &coretemp_group))) - return err; - -- data->class_dev = hwmon_device_register(&pdev->dev); -- if (IS_ERR(data->class_dev)) { -- err = PTR_ERR(data->class_dev); -+ data->hwmon_dev = hwmon_device_register(&pdev->dev); -+ if (IS_ERR(data->hwmon_dev)) { -+ err = PTR_ERR(data->hwmon_dev); - dev_err(&pdev->dev, "Class registration failed (%d)\n", - err); - goto exit_class; -@@ -243,7 +241,7 @@ static int coretemp_remove(struct platfo + int +-dma_map_sg(struct device *hwdev, struct scatterlist *sg, int nents, ++dma_map_sg(struct device *hwdev, struct scatterlist *sgl, int nents, + enum dma_data_direction direction) { - struct coretemp_data *data = platform_get_drvdata(pdev); + int i, rc; -- hwmon_device_unregister(data->class_dev); -+ hwmon_device_unregister(data->hwmon_dev); - sysfs_remove_group(&pdev->dev.kobj, &coretemp_group); - return 0; - } -@@ -315,9 +313,10 @@ static int coretemp_device_add(unsigned - if (err) - goto exit_entry_free; + BUG_ON(!valid_dma_direction(direction)); +- WARN_ON(nents == 0 || sg[0].length == 0); ++ WARN_ON(nents == 0 || sgl->length == 0); -- /* check if family 6, models e, f */ -+ /* check if family 6, models e, f, 16 */ - if (info.x86 != 0x6 || -- !((pdev_entry->x86_model == 0xe) || (pdev_entry->x86_model == 0xf))) { -+ !((pdev_entry->x86_model == 0xe) || (pdev_entry->x86_model == 0xf) || -+ (pdev_entry->x86_model == 0x16))) { + if (swiotlb) { +- rc = swiotlb_map_sg(hwdev, sg, nents, direction); ++ rc = swiotlb_map_sg(hwdev, sgl, nents, direction); + } else { +- for (i = 0; i < nents; i++ ) { +- BUG_ON(!sg[i].page); +- sg[i].dma_address = +- gnttab_dma_map_page(sg[i].page, sg[i].offset); +- sg[i].dma_length = sg[i].length; ++ struct scatterlist *sg; ++ ++ for_each_sg(sgl, sg, nents, i) { ++ BUG_ON(!sg_page(sg)); ++ sg->dma_address = ++ gnttab_dma_map_page(sg_page(sg), sg->offset); ++ sg->dma_length = sg->length; + IOMMU_BUG_ON(address_needs_mapping( +- hwdev, sg[i].dma_address)); ++ hwdev, sg->dma_address)); + IOMMU_BUG_ON(range_straddles_page_boundary( +- page_to_pseudophys(sg[i].page) + sg[i].offset, +- sg[i].length)); ++ page_to_pseudophys(sg_page(sg)) + sg->offset, ++ sg->length)); + } + rc = nents; + } +@@ -137,17 +138,19 @@ dma_map_sg(struct device *hwdev, struct + EXPORT_SYMBOL(dma_map_sg); - /* supported CPU not found, but report the unknown - family 6 CPU */ ---- head.orig/drivers/oprofile/cpu_buffer.c 2011-04-13 12:22:07.000000000 +0200 -+++ head/drivers/oprofile/cpu_buffer.c 2011-04-13 12:44:01.000000000 +0200 -@@ -425,6 +425,39 @@ void oprofile_add_pc(unsigned long pc, i - log_sample(cpu_buf, pc, 0, is_kernel, event, NULL); - } + void +-dma_unmap_sg(struct device *hwdev, struct scatterlist *sg, int nents, ++dma_unmap_sg(struct device *hwdev, struct scatterlist *sgl, int nents, + enum dma_data_direction direction) + { + int i; -+#ifdef CONFIG_XEN -+/* -+ * This is basically log_sample(b, ESCAPE_CODE, cpu_mode, CPU_TRACE_BEGIN), -+ * as was previously accessible through oprofile_add_pc(). -+ */ -+void oprofile_add_mode(int cpu_mode) -+{ -+ struct oprofile_cpu_buffer *cpu_buf = &__get_cpu_var(cpu_buffer); -+ struct task_struct *task; -+ -+ if (nr_available_slots(cpu_buf) < 3) { -+ cpu_buf->sample_lost_overflow++; -+ return; -+ } -+ -+ task = current; -+ -+ /* notice a switch from user->kernel or vice versa */ -+ if (cpu_buf->last_cpu_mode != cpu_mode) { -+ cpu_buf->last_cpu_mode = cpu_mode; -+ add_code(cpu_buf, cpu_mode); -+ } -+ -+ /* notice a task switch */ -+ if (cpu_buf->last_task != task) { -+ cpu_buf->last_task = task; -+ add_code(cpu_buf, (unsigned long)task); -+ } -+ -+ add_code(cpu_buf, CPU_TRACE_BEGIN); -+} -+#endif + BUG_ON(!valid_dma_direction(direction)); + if (swiotlb) +- swiotlb_unmap_sg(hwdev, sg, nents, direction); ++ swiotlb_unmap_sg(hwdev, sgl, nents, direction); + else { +- for (i = 0; i < nents; i++ ) +- gnttab_dma_unmap_page(sg[i].dma_address); ++ struct scatterlist *sg; + - void oprofile_add_trace(unsigned long pc) ++ for_each_sg(sgl, sg, nents, i) ++ gnttab_dma_unmap_page(sg->dma_address); + } + } + EXPORT_SYMBOL(dma_unmap_sg); +@@ -258,7 +261,8 @@ void dma_free_coherent(struct device *de { - struct oprofile_cpu_buffer *cpu_buf = &__get_cpu_var(op_cpu_buffer); ---- head.orig/drivers/pci/msi-xen.c 2012-10-31 11:01:55.000000000 +0100 -+++ head/drivers/pci/msi-xen.c 2012-10-31 11:11:33.000000000 +0100 -@@ -277,6 +277,12 @@ static int msi_map_vector(struct pci_dev - map_irq.pirq : evtchn_map_pirq(-1, map_irq.pirq)); + struct dma_coherent_mem *mem = dev ? dev->dma_mem : NULL; + int order = get_order(size); +- ++ ++ WARN_ON(irqs_disabled()); /* for portability */ + if (mem && vaddr >= mem->virt_base && vaddr < (mem->virt_base + (mem->size << PAGE_SHIFT))) { + int page = (vaddr - mem->virt_base) >> PAGE_SHIFT; + +--- a/arch/x86/kernel/process_32-xen.c ++++ b/arch/x86/kernel/process_32-xen.c +@@ -1,6 +1,4 @@ + /* +- * linux/arch/i386/kernel/process.c +- * + * Copyright (C) 1995 Linus Torvalds + * + * Pentium III FXSR, SSE support +@@ -190,6 +188,10 @@ void cpu_idle(void) + } } -+static void pci_intx_for_msi(struct pci_dev *dev, int enable) ++static void do_nothing(void *unused) +{ -+ if (!(dev->dev_flags & PCI_DEV_FLAGS_MSI_INTX_DISABLE_BUG)) -+ pci_intx(dev, enable); +} + - #ifdef CONFIG_PM - void pci_restore_msi_state(struct pci_dev *dev) + void cpu_idle_wait(void) { -@@ -285,7 +291,7 @@ void pci_restore_msi_state(struct pci_de - if (!dev->msi_enabled && !dev->msix_enabled) - return; + unsigned int cpu, this_cpu = get_cpu(); +@@ -214,13 +216,20 @@ void cpu_idle_wait(void) + cpu_clear(cpu, map); + } + cpus_and(map, map, cpu_online_map); ++ /* ++ * We waited 1 sec, if a CPU still did not call idle ++ * it may be because it is in idle and not waking up ++ * because it has nothing to do. ++ * Give all the remaining CPUS a kick. ++ */ ++ smp_call_function_mask(map, do_nothing, 0, 0); + } while (!cpus_empty(map)); -- pci_intx(dev, 0); /* disable intx */ -+ pci_intx_for_msi(dev, 0); - if (dev->msi_enabled) - msi_set_enable(dev, 0); - if (dev->msix_enabled) -@@ -340,7 +346,7 @@ static int msi_capability_init(struct pc - return -EBUSY; + set_cpus_allowed(current, tmp); + } + EXPORT_SYMBOL_GPL(cpu_idle_wait); - /* Set MSI enabled bits */ -- pci_intx(dev, 0); /* disable intx */ -+ pci_intx_for_msi(dev, 0); - msi_set_enable(dev, 1); - dev->msi_enabled = 1; +-void __devinit select_idle_routine(const struct cpuinfo_x86 *c) ++void __cpuinit select_idle_routine(const struct cpuinfo_x86 *c) + { + } -@@ -414,7 +420,7 @@ static int msix_capability_init(struct p - return avail; - } +@@ -238,34 +247,52 @@ static int __init idle_setup(char *str) + } + early_param("idle", idle_setup); -- pci_intx(dev, 0); /* disable intx */ -+ pci_intx_for_msi(dev, 0); - msix_set_enable(dev, 1); - dev->msix_enabled = 1; +-void show_regs(struct pt_regs * regs) ++void __show_registers(struct pt_regs *regs, int all) + { + unsigned long cr0 = 0L, cr2 = 0L, cr3 = 0L, cr4 = 0L; + unsigned long d0, d1, d2, d3, d6, d7; ++ unsigned long esp; ++ unsigned short ss, gs; ++ ++ if (user_mode_vm(regs)) { ++ esp = regs->esp; ++ ss = regs->xss & 0xffff; ++ savesegment(gs, gs); ++ } else { ++ esp = (unsigned long) (®s->esp); ++ savesegment(ss, ss); ++ savesegment(gs, gs); ++ } -@@ -551,7 +557,7 @@ void pci_disable_msi(struct pci_dev* dev + printk("\n"); +- printk("Pid: %d, comm: %20s\n", current->pid, current->comm); +- printk("EIP: %04x:[<%08lx>] CPU: %d\n",0xffff & regs->xcs,regs->eip, smp_processor_id()); ++ printk("Pid: %d, comm: %s %s (%s %.*s)\n", ++ task_pid_nr(current), current->comm, ++ print_tainted(), init_utsname()->release, ++ (int)strcspn(init_utsname()->version, " "), ++ init_utsname()->version); ++ ++ printk("EIP: %04x:[<%08lx>] EFLAGS: %08lx CPU: %d\n", ++ 0xffff & regs->xcs, regs->eip, regs->eflags, ++ smp_processor_id()); + print_symbol("EIP is at %s\n", regs->eip); - /* Disable MSI mode */ - msi_set_enable(dev, 0); -- pci_intx(dev, 1); /* enable intx */ -+ pci_intx_for_msi(dev, 1); - dev->msi_enabled = 0; - } - EXPORT_SYMBOL(pci_disable_msi); -@@ -677,7 +683,7 @@ void pci_disable_msix(struct pci_dev* de - /* Disable MSI mode */ - if (is_initial_xendomain()) { - msix_set_enable(dev, 0); -- pci_intx(dev, 1); /* enable intx */ -+ pci_intx_for_msi(dev, 1); - } - dev->msix_enabled = 0; - } ---- head.orig/drivers/xen/balloon/balloon.c 2012-06-06 13:52:53.000000000 +0200 -+++ head/drivers/xen/balloon/balloon.c 2012-06-06 13:55:27.000000000 +0200 -@@ -118,10 +118,8 @@ static DECLARE_WORK(balloon_worker, ball - PAGE_TO_LIST(p)->prev = NULL; \ - } while(0) +- if (user_mode_vm(regs)) +- printk(" ESP: %04x:%08lx",0xffff & regs->xss,regs->esp); +- printk(" EFLAGS: %08lx %s (%s %.*s)\n", +- regs->eflags, print_tainted(), init_utsname()->release, +- (int)strcspn(init_utsname()->version, " "), +- init_utsname()->version); + printk("EAX: %08lx EBX: %08lx ECX: %08lx EDX: %08lx\n", +- regs->eax,regs->ebx,regs->ecx,regs->edx); +- printk("ESI: %08lx EDI: %08lx EBP: %08lx", +- regs->esi, regs->edi, regs->ebp); +- printk(" DS: %04x ES: %04x FS: %04x\n", +- 0xffff & regs->xds,0xffff & regs->xes, 0xffff & regs->xfs); ++ regs->eax, regs->ebx, regs->ecx, regs->edx); ++ printk("ESI: %08lx EDI: %08lx EBP: %08lx ESP: %08lx\n", ++ regs->esi, regs->edi, regs->ebp, esp); ++ printk(" DS: %04x ES: %04x FS: %04x GS: %04x SS: %04x\n", ++ regs->xds & 0xffff, regs->xes & 0xffff, ++ regs->xfs & 0xffff, gs, ss); ++ ++ if (!all) ++ return; --#define IPRINTK(fmt, args...) \ -- printk(KERN_INFO "xen_mem: " fmt, ##args) --#define WPRINTK(fmt, args...) \ -- printk(KERN_WARNING "xen_mem: " fmt, ##args) -+#define IPRINTK(fmt, args...) pr_info("xen_mem: " fmt, ##args) -+#define WPRINTK(fmt, args...) pr_warning("xen_mem: " fmt, ##args) + cr0 = read_cr0(); + cr2 = read_cr2(); + cr3 = read_cr3(); + cr4 = read_cr4_safe(); +- printk("CR0: %08lx CR2: %08lx CR3: %08lx CR4: %08lx\n", cr0, cr2, cr3, cr4); ++ printk("CR0: %08lx CR2: %08lx CR3: %08lx CR4: %08lx\n", ++ cr0, cr2, cr3, cr4); - /* balloon_append: add the given page to the balloon. */ - static void balloon_append(struct page *page, int account) -@@ -317,6 +315,8 @@ static int increase_reservation(unsigned + get_debugreg(d0, 0); + get_debugreg(d1, 1); +@@ -273,10 +300,16 @@ void show_regs(struct pt_regs * regs) + get_debugreg(d3, 3); + printk("DR0: %08lx DR1: %08lx DR2: %08lx DR3: %08lx\n", + d0, d1, d2, d3); ++ + get_debugreg(d6, 6); + get_debugreg(d7, 7); +- printk("DR6: %08lx DR7: %08lx\n", d6, d7); ++ printk("DR6: %08lx DR7: %08lx\n", ++ d6, d7); ++} - #ifndef MODULE - setup_per_zone_pages_min(); -+ if (rc > 0) -+ kswapd_run(0); - if (need_zonelists_rebuild) - build_all_zonelists(); - else -@@ -468,7 +468,7 @@ static int balloon_init_watcher(struct n ++void show_regs(struct pt_regs *regs) ++{ ++ __show_registers(regs, 1); + show_trace(NULL, regs, ®s->esp); + } - err = register_xenbus_watch(&target_watch); - if (err) -- printk(KERN_ERR "Failed to set balloon watcher\n"); -+ pr_err("Failed to set balloon watcher\n"); +--- a/arch/x86/kernel/process_64-xen.c ++++ b/arch/x86/kernel/process_64-xen.c +@@ -1,6 +1,4 @@ + /* +- * linux/arch/x86-64/kernel/process.c +- * + * Copyright (C) 1995 Linus Torvalds + * + * Pentium III FXSR, SSE support +@@ -41,6 +39,7 @@ + #include + #include + #include ++#include - return NOTIFY_DONE; - } ---- head.orig/drivers/xen/blkback/blkback.c 2012-03-26 12:21:55.000000000 +0200 -+++ head/drivers/xen/blkback/blkback.c 2013-03-05 12:31:21.000000000 +0100 -@@ -278,13 +278,10 @@ static void __end_block_io_op(pending_re + #include + #include +@@ -171,6 +170,9 @@ void cpu_idle (void) + + if (__get_cpu_var(cpu_idle_state)) + __get_cpu_var(cpu_idle_state) = 0; ++ ++ tick_nohz_stop_sched_tick(); ++ + rmb(); + idle = xen_idle; /* no alternatives */ + if (cpu_is_offline(smp_processor_id())) +@@ -189,12 +191,17 @@ void cpu_idle (void) + __exit_idle(); + } + ++ tick_nohz_restart_sched_tick(); + preempt_enable_no_resched(); + schedule(); + preempt_disable(); } } --static int end_block_io_op(struct bio *bio, unsigned int done, int error) -+static void end_block_io_op(struct bio *bio, int error) ++static void do_nothing(void *unused) ++{ ++} ++ + void cpu_idle_wait(void) { -- if (bio->bi_size != 0) -- return 1; - __end_block_io_op(bio->bi_private, error); - bio_put(bio); -- return error; - } + unsigned int cpu, this_cpu = get_cpu(); +@@ -220,6 +227,13 @@ void cpu_idle_wait(void) + cpu_clear(cpu, map); + } + cpus_and(map, map, cpu_online_map); ++ /* ++ * We waited 1 sec, if a CPU still did not call idle ++ * it may be because it is in idle and not waking up ++ * because it has nothing to do. ++ * Give all the remaining CPUS a kick. ++ */ ++ smp_call_function_mask(map, do_nothing, 0, 0); + } while (!cpus_empty(map)); + set_cpus_allowed(current, tmp); +@@ -527,7 +541,7 @@ static inline void __switch_to_xtra(stru + * + * Kprobes not supported here. Set the probe on schedule instead. + */ +-__kprobes struct task_struct * ++struct task_struct * + __switch_to(struct task_struct *prev_p, struct task_struct *next_p) + { + struct thread_struct *prev = &prev_p->thread, +--- a/arch/x86/kernel/quirks.c ++++ b/arch/x86/kernel/quirks.c +@@ -4,8 +4,6 @@ + #include + #include -@@ -664,7 +661,7 @@ static int __init blkif_init(void) - kfree(pending_reqs); - kfree(pending_grant_handles); - free_empty_pages_and_pagevec(pending_pages, mmap_pages); -- printk("%s: out of memory\n", __FUNCTION__); -+ pr_warning("%s: out of memory\n", __FUNCTION__); - return -ENOMEM; - } +-#include +- + #if defined(CONFIG_X86_IO_APIC) && (defined(CONFIG_SMP) || defined(CONFIG_XEN)) && defined(CONFIG_PCI) ---- head.orig/drivers/xen/blkback/blkback-pagemap.c 2009-06-09 15:01:37.000000000 +0200 -+++ head/drivers/xen/blkback/blkback-pagemap.c 2011-01-31 17:56:27.000000000 +0100 -@@ -38,8 +38,8 @@ blkback_pagemap_set(int idx, struct page + static void quirk_intel_irqbalance(struct pci_dev *dev) +@@ -64,6 +62,8 @@ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_IN + #endif - entry = blkback_pagemap + idx; - if (!blkback_pagemap_entry_clear(entry)) { -- printk("overwriting pagemap %d: d %u b %u g %u\n", -- idx, entry->domid, entry->busid, entry->gref); -+ pr_emerg("overwriting pagemap %d: d %u b %u g %u\n", -+ idx, entry->domid, entry->busid, entry->gref); - BUG(); - } - -@@ -63,7 +63,7 @@ blkback_pagemap_clear(struct page *page) + #if defined(CONFIG_HPET_TIMER) ++#include ++ + unsigned long force_hpet_address; - entry = blkback_pagemap + idx; - if (blkback_pagemap_entry_clear(entry)) { -- printk("clearing empty pagemap %d\n", idx); -+ pr_emerg("clearing empty pagemap %d\n", idx); - BUG(); - } + static enum { +--- a/arch/x86/kernel/setup_32-xen.c ++++ b/arch/x86/kernel/setup_32-xen.c +@@ -1,6 +1,4 @@ + /* +- * linux/arch/i386/kernel/setup.c +- * + * Copyright (C) 1995 Linus Torvalds + * + * Support of BIGMEM added by Gerhard Wichert, Siemens AG, July 1999 +@@ -70,6 +68,7 @@ + #include + #include + #include ++#include -@@ -85,7 +85,7 @@ blkback_pagemap_read(struct page *page) + #ifdef CONFIG_XEN + #include +@@ -80,13 +79,14 @@ static struct notifier_block xen_panic_b + xen_panic_event, NULL, 0 /* try to go last */ + }; - entry = blkback_pagemap + idx; - if (blkback_pagemap_entry_clear(entry)) { -- printk("reading empty pagemap %d\n", idx); -+ pr_emerg("reading empty pagemap %d\n", idx); - BUG(); - } +-int disable_pse __devinitdata = 0; ++int disable_pse __cpuinitdata = 0; ---- head.orig/drivers/xen/blkback/vbd.c 2011-06-30 15:37:44.000000000 +0200 -+++ head/drivers/xen/blkback/vbd.c 2011-06-30 16:32:27.000000000 +0200 -@@ -133,18 +133,18 @@ void vbd_resize(blkif_t *blkif) - struct xenbus_device *dev = blkif->be->dev; - unsigned long long new_size = vbd_size(vbd); + /* + * Machine setup.. + */ + extern struct resource code_resource; + extern struct resource data_resource; ++extern struct resource bss_resource; -- printk(KERN_INFO "VBD Resize: new size %Lu\n", new_size); -+ pr_info("VBD Resize: new size %Lu\n", new_size); - vbd->size = new_size; - again: - err = xenbus_transaction_start(&xbt); - if (err) { -- printk(KERN_WARNING "Error starting transaction"); -+ pr_warning("Error %d starting transaction", err); - return; - } - err = xenbus_printf(xbt, dev->nodename, "sectors", "%Lu", - vbd_size(vbd)); - if (err) { -- printk(KERN_WARNING "Error writing new size"); -+ pr_warning("Error %d writing new size", err); - goto abort; - } - /* -@@ -154,7 +154,7 @@ again: - */ - err = xenbus_printf(xbt, dev->nodename, "state", "%d", dev->state); - if (err) { -- printk(KERN_WARNING "Error writing the state"); -+ pr_warning("Error %d writing the state", err); - goto abort; - } + /* cpu data as detected by the assembly code in head.S */ + struct cpuinfo_x86 new_cpu_data __cpuinitdata = { 0, 0, 0, 0, -1, 1, 0, 0, -1 }; +@@ -98,9 +98,6 @@ unsigned long mmu_cr4_features; -@@ -162,7 +162,7 @@ again: - if (err == -EAGAIN) - goto again; - if (err) -- printk(KERN_WARNING "Error ending transaction"); -+ pr_warning("Error %d ending transaction", err); - return; - abort: - xenbus_transaction_end(xbt, 1); ---- head.orig/drivers/xen/blkback/xenbus.c 2012-12-18 11:59:09.000000000 +0100 -+++ head/drivers/xen/blkback/xenbus.c 2012-12-18 12:04:14.000000000 +0100 -@@ -293,10 +293,9 @@ static void backend_changed(struct xenbu + /* for MCA, but anyone else can use it if they want */ + unsigned int machine_id; +-#ifdef CONFIG_MCA +-EXPORT_SYMBOL(machine_id); +-#endif + unsigned int machine_submodel_id; + unsigned int BIOS_revision; + unsigned int mca_pentium_flag; +@@ -121,7 +118,7 @@ EXPORT_SYMBOL(apm_info); + struct edid_info edid_info; + EXPORT_SYMBOL_GPL(edid_info); + #ifndef CONFIG_XEN +-#define copy_edid() (edid_info = EDID_INFO) ++#define copy_edid() (edid_info = boot_params.edid_info) + #endif + struct ist_info ist_info; + #if defined(CONFIG_X86_SPEEDSTEP_SMI) || \ +@@ -170,10 +167,11 @@ EXPORT_SYMBOL(edd); + */ + static inline void copy_edd(void) + { +- memcpy(edd.mbr_signature, EDD_MBR_SIGNATURE, sizeof(edd.mbr_signature)); +- memcpy(edd.edd_info, EDD_BUF, sizeof(edd.edd_info)); +- edd.mbr_signature_nr = EDD_MBR_SIG_NR; +- edd.edd_info_nr = EDD_NR; ++ memcpy(edd.mbr_signature, boot_params.edd_mbr_sig_buffer, ++ sizeof(edd.mbr_signature)); ++ memcpy(edd.edd_info, boot_params.eddbuf, sizeof(edd.edd_info)); ++ edd.mbr_signature_nr = boot_params.edd_mbr_sig_buf_entries; ++ edd.edd_info_nr = boot_params.eddbuf_entries; + } + #endif + #else +@@ -418,6 +416,53 @@ extern unsigned long __init setup_memory + extern void zone_sizes_init(void); + #endif /* !CONFIG_NEED_MULTIPLE_NODES */ - if (be->major | be->minor) { - if (be->major != major || be->minor != minor) -- printk(KERN_WARNING "blkback: " -- "changing physical device (from %x:%x to " -- "%x:%x) not supported.\n", -- be->major, be->minor, major, minor); -+ pr_warning("blkback: changing physical device" -+ " (from %x:%x to %x:%x) not supported\n", -+ be->major, be->minor, major, minor); - return; - } ++static inline unsigned long long get_total_mem(void) ++{ ++ unsigned long long total; ++ ++ total = max_low_pfn - min_low_pfn; ++#ifdef CONFIG_HIGHMEM ++ total += highend_pfn - highstart_pfn; ++#endif ++ ++ return total << PAGE_SHIFT; ++} ++ ++#ifdef CONFIG_KEXEC ++#ifndef CONFIG_XEN ++static void __init reserve_crashkernel(void) ++{ ++ unsigned long long total_mem; ++ unsigned long long crash_size, crash_base; ++ int ret; ++ ++ total_mem = get_total_mem(); ++ ++ ret = parse_crashkernel(boot_command_line, total_mem, ++ &crash_size, &crash_base); ++ if (ret == 0 && crash_size > 0) { ++ if (crash_base > 0) { ++ printk(KERN_INFO "Reserving %ldMB of memory at %ldMB " ++ "for crashkernel (System RAM: %ldMB)\n", ++ (unsigned long)(crash_size >> 20), ++ (unsigned long)(crash_base >> 20), ++ (unsigned long)(total_mem >> 20)); ++ crashk_res.start = crash_base; ++ crashk_res.end = crash_base + crash_size - 1; ++ reserve_bootmem(crash_base, crash_size); ++ } else ++ printk(KERN_INFO "crashkernel reservation failed - " ++ "you have to specify a base address\n"); ++ } ++} ++#else ++#define reserve_crashkernel xen_machine_kexec_setup_resources ++#endif ++#else ++static inline void __init reserve_crashkernel(void) ++{} ++#endif ++ + void __init setup_bootmem_allocator(void) + { + unsigned long bootmap_size; +@@ -473,30 +518,25 @@ void __init setup_bootmem_allocator(void -@@ -358,8 +357,8 @@ static void frontend_changed(struct xenb - switch (frontend_state) { - case XenbusStateInitialising: - if (dev->state == XenbusStateClosed) { -- printk(KERN_INFO "%s: %s: prepare for reconnect\n", -- __FUNCTION__, dev->nodename); -+ pr_info("%s: %s: prepare for reconnect\n", -+ __FUNCTION__, dev->nodename); - xenbus_switch_state(dev, XenbusStateInitWait); + #ifdef CONFIG_BLK_DEV_INITRD + if (xen_start_info->mod_start) { +- if (INITRD_START + INITRD_SIZE <= (max_low_pfn << PAGE_SHIFT)) { +- /*reserve_bootmem(INITRD_START, INITRD_SIZE);*/ +- initrd_start = INITRD_START + PAGE_OFFSET; +- initrd_end = initrd_start+INITRD_SIZE; ++ unsigned long ramdisk_image = __pa(xen_start_info->mod_start); ++ unsigned long ramdisk_size = xen_start_info->mod_len; ++ unsigned long ramdisk_end = ramdisk_image + ramdisk_size; ++ unsigned long end_of_lowmem = max_low_pfn << PAGE_SHIFT; ++ ++ if (ramdisk_end <= end_of_lowmem) { ++ /*reserve_bootmem(ramdisk_image, ramdisk_size);*/ ++ initrd_start = ramdisk_image + PAGE_OFFSET; ++ initrd_end = initrd_start+ramdisk_size; + initrd_below_start_ok = 1; +- } +- else { ++ } else { + printk(KERN_ERR "initrd extends beyond end of memory " +- "(0x%08lx > 0x%08lx)\ndisabling initrd\n", +- INITRD_START + INITRD_SIZE, +- max_low_pfn << PAGE_SHIFT); ++ "(0x%08lx > 0x%08lx)\ndisabling initrd\n", ++ ramdisk_end, end_of_lowmem); + initrd_start = 0; } - break; -@@ -505,10 +504,9 @@ static int connect_ring(struct backend_i - kfree(protocol); - return -1; } -- printk(KERN_INFO -- "blkback: ring-ref %u, event-channel %u, protocol %d (%s)\n", -- ring_ref, evtchn, be->blkif->blk_protocol, -- protocol ?: "unspecified, assuming native"); -+ pr_info("blkback: ring-ref %u, event-channel %u, protocol %d (%s)\n", -+ ring_ref, evtchn, be->blkif->blk_protocol, -+ protocol ?: "unspecified, assuming native"); - kfree(protocol); - - /* Map the shared frame, irq etc. */ ---- head.orig/drivers/xen/blkfront/blkfront.c 2012-10-04 11:53:51.000000000 +0200 -+++ head/drivers/xen/blkfront/blkfront.c 2012-10-04 11:54:11.000000000 +0200 -@@ -233,7 +233,7 @@ static int setup_blkring(struct xenbus_d - SHARED_RING_INIT(sring); - FRONT_RING_INIT(&info->ring, sring, PAGE_SIZE); - -- memset(info->sg, 0, sizeof(info->sg)); -+ sg_init_table(info->sg, BLKIF_MAX_SEGMENTS_PER_REQUEST); + #endif +-#ifdef CONFIG_KEXEC +-#ifdef CONFIG_XEN +- xen_machine_kexec_setup_resources(); +-#else +- if (crashk_res.start != crashk_res.end) +- reserve_bootmem(crashk_res.start, +- crashk_res.end - crashk_res.start + 1); +-#endif +-#endif ++ reserve_crashkernel(); + } - err = xenbus_grant_ring(dev, virt_to_mfn(info->ring.sring)); - if (err < 0) { -@@ -339,8 +339,7 @@ static void connect(struct blkfront_info - "sectors", "%Lu", §ors); - if (err != 1) - return; -- printk(KERN_INFO "Setting capacity to %Lu\n", -- sectors); -+ pr_info("Setting capacity to %Lu\n", sectors); - set_capacity(info->gd, sectors); - - /* fall through */ -@@ -620,8 +619,6 @@ int blkif_ioctl(struct inode *inode, str - } - } + /* +@@ -574,7 +614,8 @@ void __init setup_arch(char **cmdline_p) + * the system table is valid. If not, then initialize normally. + */ + #ifdef CONFIG_EFI +- if ((LOADER_TYPE == 0x50) && EFI_SYSTAB) ++ if ((boot_params.hdr.type_of_loader == 0x50) && ++ boot_params.efi_info.efi_systab) + efi_enabled = 1; + #endif -- /*printk(KERN_ALERT "ioctl %08x not supported by Xen blkdev\n", -- command);*/ - return -EINVAL; /* same return as native Linux */ +@@ -582,18 +623,18 @@ void __init setup_arch(char **cmdline_p) + properly. Setting ROOT_DEV to default to /dev/ram0 breaks initrd. + */ + ROOT_DEV = MKDEV(UNNAMED_MAJOR,0); +- screen_info = SCREEN_INFO; ++ screen_info = boot_params.screen_info; + copy_edid(); +- apm_info.bios = APM_BIOS_INFO; +- ist_info = IST_INFO; +- saved_videomode = VIDEO_MODE; +- if( SYS_DESC_TABLE.length != 0 ) { +- set_mca_bus(SYS_DESC_TABLE.table[3] & 0x2); +- machine_id = SYS_DESC_TABLE.table[0]; +- machine_submodel_id = SYS_DESC_TABLE.table[1]; +- BIOS_revision = SYS_DESC_TABLE.table[2]; ++ apm_info.bios = boot_params.apm_bios_info; ++ ist_info = boot_params.ist_info; ++ saved_videomode = boot_params.hdr.vid_mode; ++ if( boot_params.sys_desc_table.length != 0 ) { ++ set_mca_bus(boot_params.sys_desc_table.table[3] & 0x2); ++ machine_id = boot_params.sys_desc_table.table[0]; ++ machine_submodel_id = boot_params.sys_desc_table.table[1]; ++ BIOS_revision = boot_params.sys_desc_table.table[2]; } +- bootloader_type = LOADER_TYPE; ++ bootloader_type = boot_params.hdr.type_of_loader; -@@ -696,9 +693,8 @@ static int blkif_queue_request(struct re - - ring_req->nr_segments = blk_rq_map_sg(req->q, req, info->sg); - BUG_ON(ring_req->nr_segments > BLKIF_MAX_SEGMENTS_PER_REQUEST); -- for (i = 0; i < ring_req->nr_segments; ++i) { -- sg = info->sg + i; -- buffer_mfn = page_to_phys(sg->page) >> PAGE_SHIFT; -+ for_each_sg(info->sg, sg, ring_req->nr_segments, i) { -+ buffer_mfn = page_to_phys(sg_page(sg)) >> PAGE_SHIFT; - fsect = sg->offset >> 9; - lsect = fsect + (sg->length >> 9) - 1; - /* install a grant reference. */ -@@ -815,10 +811,10 @@ static irqreturn_t blkif_int(int irq, vo - * we would never have given to it (we stamp it up to - * BLK_RING_SIZE - see GET_ID_FROM_FREELIST()). - */ -- printk(KERN_WARNING -- "%s: response to %s has incorrect id (%#Lx)\n", -- info->gd->disk_name, op_name(bret->operation), -- (unsigned long long)bret->id); -+ pr_warning("%s: response to %s has incorrect id (%#Lx)\n", -+ info->gd->disk_name, -+ op_name(bret->operation), -+ (unsigned long long)bret->id); - continue; - } - id = bret->id; -@@ -828,10 +824,9 @@ static irqreturn_t blkif_int(int irq, vo - - ret = ADD_ID_TO_FREELIST(info, id); - if (unlikely(ret)) { -- printk(KERN_WARNING -- "%s: id %#lx (response to %s) couldn't be recycled (%d)!\n", -- info->gd->disk_name, id, -- op_name(bret->operation), ret); -+ pr_warning("%s: id %#lx (response to %s) couldn't be recycled (%d)!\n", -+ info->gd->disk_name, id, -+ op_name(bret->operation), ret); - continue; - } - -@@ -839,10 +834,9 @@ static irqreturn_t blkif_int(int irq, vo - switch (bret->operation) { - case BLKIF_OP_WRITE_BARRIER: - if (unlikely(bret->status == BLKIF_RSP_EOPNOTSUPP)) { -- printk(KERN_WARNING -- "blkfront: %s: %s op failed\n", -- info->gd->disk_name, -- op_name(bret->operation)); -+ pr_warning("blkfront: %s: %s op failed\n", -+ info->gd->disk_name, -+ op_name(bret->operation)); - uptodate = -EOPNOTSUPP; - info->feature_barrier = 0; - xlvbd_barrier(info); ---- head.orig/drivers/xen/blkfront/block.h 2012-06-06 13:53:02.000000000 +0200 -+++ head/drivers/xen/blkfront/block.h 2012-06-06 13:55:33.000000000 +0200 -@@ -60,7 +60,7 @@ - #define DPRINTK(_f, _a...) pr_debug(_f, ## _a) + if (is_initial_xendomain()) { + const struct dom0_vga_console_info *info = +@@ -608,9 +649,9 @@ void __init setup_arch(char **cmdline_p) + screen_info.orig_video_isVGA = 0; - #if 0 --#define DPRINTK_IOCTL(_f, _a...) printk(KERN_ALERT _f, ## _a) -+#define DPRINTK_IOCTL(_f, _a...) pr_alert(_f, ## _a) - #else - #define DPRINTK_IOCTL(_f, _a...) ((void)0) + #ifdef CONFIG_BLK_DEV_RAM +- rd_image_start = RAMDISK_FLAGS & RAMDISK_IMAGE_START_MASK; +- rd_prompt = ((RAMDISK_FLAGS & RAMDISK_PROMPT_FLAG) != 0); +- rd_doload = ((RAMDISK_FLAGS & RAMDISK_LOAD_FLAG) != 0); ++ rd_image_start = boot_params.hdr.ram_size & RAMDISK_IMAGE_START_MASK; ++ rd_prompt = ((boot_params.hdr.ram_size & RAMDISK_PROMPT_FLAG) != 0); ++ rd_doload = ((boot_params.hdr.ram_size & RAMDISK_LOAD_FLAG) != 0); #endif ---- head.orig/drivers/xen/blkfront/vbd.c 2012-03-12 13:38:18.000000000 +0100 -+++ head/drivers/xen/blkfront/vbd.c 2012-03-12 15:33:32.000000000 +0100 -@@ -208,7 +208,8 @@ xlbd_alloc_major_info(int major, int min - return NULL; - } -- printk("xen-vbd: registered block device major %i\n", ptr->major); -+ pr_info("xen-vbd: registered block device major %i\n", -+ ptr->major); - } + ARCH_SETUP +@@ -623,7 +664,7 @@ void __init setup_arch(char **cmdline_p) - ptr->minors = minors; -@@ -276,9 +277,8 @@ xlbd_release_major_info(void) - if (!mi) - continue; - if (mi->usage) -- printk(KERN_WARNING -- "vbd: major %u still in use (%u times)\n", -- mi->major, mi->usage); -+ pr_warning("vbd: major %u still in use (%u times)\n", -+ mi->major, mi->usage); - if (mi->major != XENVBD_MAJOR || !vbd_done) { - unregister_blkdev(mi->major, mi->type->devname); - kfree(mi->minors->bitmap); -@@ -483,7 +483,8 @@ xlvbd_add(blkif_sector_t capacity, int v + copy_edd(); - if ((vdevice>>EXT_SHIFT) > 1) { - /* this is above the extended range; something is wrong */ -- printk(KERN_WARNING "blkfront: vdevice 0x%x is above the extended range; ignoring\n", vdevice); -+ pr_warning("blkfront: vdevice %#x is above the extended" -+ " range; ignoring\n", vdevice); - return -ENODEV; - } +- if (!MOUNT_ROOT_RDONLY) ++ if (!boot_params.hdr.root_flags) + root_mountflags &= ~MS_RDONLY; + init_mm.start_code = (unsigned long) _text; + init_mm.end_code = (unsigned long) _etext; +@@ -635,6 +676,8 @@ void __init setup_arch(char **cmdline_p) + code_resource.end = virt_to_phys(_etext)-1; + data_resource.start = virt_to_phys(_etext); + data_resource.end = virt_to_phys(_edata)-1; ++ bss_resource.start = virt_to_phys(&__bss_start); ++ bss_resource.end = virt_to_phys(&__bss_stop)-1; -@@ -495,8 +496,8 @@ xlvbd_add(blkif_sector_t capacity, int v - major = XENVBD_MAJOR; - minor = BLKIF_MINOR_EXT(vdevice); - if (minor >> MINORBITS) { -- printk(KERN_WARNING "blkfront: %#x's minor (%#x)" -- " out of range; ignoring\n", vdevice, minor); -+ pr_warning("blkfront: %#x's minor (%#x) out of range;" -+ " ignoring\n", vdevice, minor); - return -ENODEV; - } - } -@@ -547,15 +548,16 @@ xlvbd_barrier(struct blkfront_info *info - info->feature_barrier ? QUEUE_ORDERED_DRAIN : QUEUE_ORDERED_NONE, NULL); - if (err) - return err; -- printk(KERN_INFO "blkfront: %s: barriers %s\n", -- info->gd->disk_name, info->feature_barrier ? "enabled" : "disabled"); -+ pr_info("blkfront: %s: barriers %s\n", -+ info->gd->disk_name, -+ info->feature_barrier ? "enabled" : "disabled"); - return 0; - } - #else - int - xlvbd_barrier(struct blkfront_info *info) - { -- printk(KERN_INFO "blkfront: %s: barriers disabled\n", info->gd->disk_name); -+ pr_info("blkfront: %s: barriers disabled\n", info->gd->disk_name); - return -ENOSYS; - } + if ((i = MAX_GUEST_CMDLINE) > COMMAND_LINE_SIZE) + i = COMMAND_LINE_SIZE; +@@ -663,7 +706,7 @@ void __init setup_arch(char **cmdline_p) + /* + * NOTE: before this point _nobody_ is allowed to allocate + * any memory using the bootmem allocator. Although the +- * alloctor is now initialised only the first 8Mb of the kernel ++ * allocator is now initialised only the first 8Mb of the kernel + * virtual address space has been mapped. All allocations before + * paging_init() has completed must use the alloc_bootmem_low_pages() + * variant (which allocates DMA'able memory) and care must be taken +@@ -784,10 +827,8 @@ void __init setup_arch(char **cmdline_p) + acpi_boot_table_init(); #endif ---- head.orig/drivers/xen/blktap/blktap.c 2011-01-31 17:32:16.000000000 +0100 -+++ head/drivers/xen/blktap/blktap.c 2012-01-06 10:44:12.000000000 +0100 -@@ -794,8 +794,8 @@ static int blktap_ioctl(struct inode *in - case BLKTAP_IOCTL_PRINT_IDXS: - { - if (info) { -- printk("User Rings: \n-----------\n"); -- printk("UF: rsp_cons: %2d, req_prod_prv: %2d " -+ pr_info("User Rings: \n-----------\n"); -+ pr_info("UF: rsp_cons: %2d, req_prod_prv: %2d " - "| req_prod: %2d, rsp_prod: %2d\n", - info->ufe_ring.rsp_cons, - info->ufe_ring.req_prod_pvt, ---- head.orig/drivers/xen/blktap/common.h 2013-02-06 14:52:29.000000000 +0100 -+++ head/drivers/xen/blktap/common.h 2013-02-05 10:51:47.000000000 +0100 -@@ -41,8 +41,7 @@ - __FILE__ , __LINE__ , ## _a ) - #define WPRINTK(fmt, args...) \ -- ((void)(printk_ratelimit() && \ -- printk(KERN_WARNING "blktap: " fmt, ##args))) -+ ((void)(printk_ratelimit() && pr_warning("blktap: " fmt, ##args))) +-#ifdef CONFIG_PCI +-#ifdef CONFIG_X86_IO_APIC +- check_acpi_pci(); /* Checks more than just ACPI actually */ +-#endif ++#if defined(CONFIG_PCI) && !defined(CONFIG_XEN) ++ early_quirks(); + #endif - struct backend_info; + #ifdef CONFIG_ACPI +--- a/arch/x86/kernel/setup_64-xen.c ++++ b/arch/x86/kernel/setup_64-xen.c +@@ -1,10 +1,5 @@ + /* +- * linux/arch/x86-64/kernel/setup.c +- * + * Copyright (C) 1995 Linus Torvalds +- * +- * Nov 2001 Dave Jones +- * Forked from i386 setup code. + */ ---- head.orig/drivers/xen/blktap/xenbus.c 2012-02-16 12:30:42.000000000 +0100 -+++ head/drivers/xen/blktap/xenbus.c 2012-04-04 10:19:53.000000000 +0200 -@@ -354,8 +354,8 @@ static void tap_frontend_changed(struct - switch (frontend_state) { - case XenbusStateInitialising: - if (dev->state == XenbusStateClosed) { -- printk(KERN_INFO "%s: %s: prepare for reconnect\n", -- __FUNCTION__, dev->nodename); -+ pr_info("%s: %s: prepare for reconnect\n", -+ __FUNCTION__, dev->nodename); - xenbus_switch_state(dev, XenbusStateInitWait); - } - break; -@@ -457,10 +457,9 @@ static int connect_ring(struct backend_i - kfree(protocol); - return -1; - } -- printk(KERN_INFO -- "blktap: ring-ref %u, event-channel %u, protocol %d (%s)\n", -- ring_ref, evtchn, be->blkif->blk_protocol, -- protocol ?: "unspecified, assuming native"); -+ pr_info("blktap: ring-ref %u, event-channel %u, protocol %d (%s)\n", -+ ring_ref, evtchn, be->blkif->blk_protocol, -+ protocol ?: "unspecified, assuming native"); - kfree(protocol); - - /* Map the shared frame, irq etc. */ ---- head.orig/drivers/xen/blktap2/control.c 2011-01-31 17:49:31.000000000 +0100 -+++ head/drivers/xen/blktap2/control.c 2011-01-31 17:56:27.000000000 +0100 -@@ -18,6 +18,7 @@ blktap_control_initialize_tap(struct blk - memset(tap, 0, sizeof(*tap)); - set_bit(BLKTAP_CONTROL, &tap->dev_inuse); - init_rwsem(&tap->tap_sem); -+ sg_init_table(tap->sg, BLKIF_MAX_SEGMENTS_PER_REQUEST); - init_waitqueue_head(&tap->wq); - atomic_set(&tap->refcnt, 0); - ---- head.orig/drivers/xen/blktap2/device.c 2012-02-16 12:30:32.000000000 +0100 -+++ head/drivers/xen/blktap2/device.c 2012-02-16 12:31:22.000000000 +0100 -@@ -17,7 +17,7 @@ - #include "../blkback/blkback-pagemap.h" + /* +@@ -57,13 +52,13 @@ + #include + #include + #include +-#include + #include + #include + #include + #include + #include + #include ++#include + #ifdef CONFIG_XEN + #include + #include +@@ -180,6 +175,12 @@ struct resource code_resource = { + .end = 0, + .flags = IORESOURCE_RAM, + }; ++struct resource bss_resource = { ++ .name = "Kernel bss", ++ .start = 0, ++ .end = 0, ++ .flags = IORESOURCE_RAM, ++}; - #if 0 --#define DPRINTK_IOCTL(_f, _a...) printk(KERN_ALERT _f, ## _a) -+#define DPRINTK_IOCTL(_f, _a...) pr_alert(_f, ## _a) + #ifdef CONFIG_PROC_VMCORE + /* elfcorehdr= specifies the location of elf core header +@@ -232,10 +233,11 @@ EXPORT_SYMBOL(edd); + */ + static inline void copy_edd(void) + { +- memcpy(edd.mbr_signature, EDD_MBR_SIGNATURE, sizeof(edd.mbr_signature)); +- memcpy(edd.edd_info, EDD_BUF, sizeof(edd.edd_info)); +- edd.mbr_signature_nr = EDD_MBR_SIG_NR; +- edd.edd_info_nr = EDD_NR; ++ memcpy(edd.mbr_signature, boot_params.edd_mbr_sig_buffer, ++ sizeof(edd.mbr_signature)); ++ memcpy(edd.edd_info, boot_params.eddbuf, sizeof(edd.edd_info)); ++ edd.mbr_signature_nr = boot_params.edd_mbr_sig_buf_entries; ++ edd.edd_info_nr = boot_params.eddbuf_entries; + } + #endif #else - #define DPRINTK_IOCTL(_f, _a...) ((void)0) +@@ -244,6 +246,41 @@ static inline void copy_edd(void) + } #endif -@@ -113,8 +113,6 @@ blktap_device_ioctl(struct inode *inode, - return 0; - default: -- /*printk(KERN_ALERT "ioctl %08x not supported by Xen blkdev\n", -- command);*/ - return -EINVAL; /* same return as native Linux */ - } ++#ifdef CONFIG_KEXEC ++#ifndef CONFIG_XEN ++static void __init reserve_crashkernel(void) ++{ ++ unsigned long long free_mem; ++ unsigned long long crash_size, crash_base; ++ int ret; ++ ++ free_mem = ((unsigned long long)max_low_pfn - min_low_pfn) << PAGE_SHIFT; ++ ++ ret = parse_crashkernel(boot_command_line, free_mem, ++ &crash_size, &crash_base); ++ if (ret == 0 && crash_size) { ++ if (crash_base > 0) { ++ printk(KERN_INFO "Reserving %ldMB of memory at %ldMB " ++ "for crashkernel (System RAM: %ldMB)\n", ++ (unsigned long)(crash_size >> 20), ++ (unsigned long)(crash_base >> 20), ++ (unsigned long)(free_mem >> 20)); ++ crashk_res.start = crash_base; ++ crashk_res.end = crash_base + crash_size - 1; ++ reserve_bootmem(crash_base, crash_size); ++ } else ++ printk(KERN_INFO "crashkernel reservation failed - " ++ "you have to specify a base address\n"); ++ } ++} ++#else ++#define reserve_crashkernel xen_machine_kexec_setup_resources ++#endif ++#else ++static inline void __init reserve_crashkernel(void) ++{} ++#endif ++ + #ifndef CONFIG_XEN + #define EBDA_ADDR_POINTER 0x40E -@@ -640,8 +638,7 @@ blktap_device_process_request(struct blk - request->nr_pages = 0; - blkif_req.nr_segments = blk_rq_map_sg(req->q, req, tap->sg); - BUG_ON(blkif_req.nr_segments > BLKIF_MAX_SEGMENTS_PER_REQUEST); -- for (i = 0; i < blkif_req.nr_segments; ++i) { -- sg = tap->sg + i; -+ for_each_sg(tap->sg, sg, blkif_req.nr_segments, i) { - fsect = sg->offset >> 9; - lsect = fsect + (sg->length >> 9) - 1; - nr_sects += sg->length >> 9; -@@ -652,13 +649,13 @@ blktap_device_process_request(struct blk - .first_sect = fsect, - .last_sect = lsect }; +@@ -284,7 +321,7 @@ void __init setup_arch(char **cmdline_p) + atomic_notifier_chain_register(&panic_notifier_list, &xen_panic_block); -- if (PageBlkback(sg->page)) { -+ if (PageBlkback(sg_page(sg))) { - /* foreign page -- use xen */ - if (blktap_prep_foreign(tap, - request, - &blkif_req, - i, -- sg->page, -+ sg_page(sg), - &table)) - goto out; - } else { -@@ -666,7 +663,7 @@ blktap_device_process_request(struct blk - if (blktap_map(tap, - request, - i, -- sg->page)) -+ sg_page(sg))) - goto out; - } + ROOT_DEV = MKDEV(RAMDISK_MAJOR,0); +- screen_info = SCREEN_INFO; ++ screen_info = boot_params.screen_info; ---- head.orig/drivers/xen/console/console.c 2013-01-29 14:48:00.000000000 +0100 -+++ head/drivers/xen/console/console.c 2013-01-29 14:48:23.000000000 +0100 -@@ -704,10 +704,10 @@ static int __init xencons_init(void) - tty_set_operations(xencons_driver, &xencons_ops); + if (is_initial_xendomain()) { + const struct dom0_vga_console_info *info = +@@ -307,22 +344,22 @@ void __init setup_arch(char **cmdline_p) + #else + printk(KERN_INFO "Command line: %s\n", boot_command_line); - if ((rc = tty_register_driver(DRV(xencons_driver))) != 0) { -- printk("WARNING: Failed to register Xen virtual " -- "console driver as '%s%d'\n", -- DRV(xencons_driver)->name, -- DRV(xencons_driver)->name_base); -+ pr_warning("WARNING: Failed to register Xen virtual " -+ "console driver as '%s%d'\n", -+ DRV(xencons_driver)->name, -+ DRV(xencons_driver)->name_base); - put_tty_driver(xencons_driver); - xencons_driver = NULL; - return rc; -@@ -724,8 +724,8 @@ static int __init xencons_init(void) - BUG_ON(xencons_priv_irq < 0); - } +- ROOT_DEV = old_decode_dev(ORIG_ROOT_DEV); +- screen_info = SCREEN_INFO; +- edid_info = EDID_INFO; ++ ROOT_DEV = old_decode_dev(boot_params.hdr.root_dev); ++ screen_info = boot_params.screen_info; ++ edid_info = boot_params.edid_info; + #endif /* !CONFIG_XEN */ +- saved_video_mode = SAVED_VIDEO_MODE; +- bootloader_type = LOADER_TYPE; ++ saved_video_mode = boot_params.hdr.vid_mode; ++ bootloader_type = boot_params.hdr.type_of_loader; -- printk("Xen virtual console successfully installed as %s%d\n", -- DRV(xencons_driver)->name, xc_num); -+ pr_info("Xen virtual console successfully installed as %s%d\n", -+ DRV(xencons_driver)->name, xc_num); + #ifdef CONFIG_BLK_DEV_RAM +- rd_image_start = RAMDISK_FLAGS & RAMDISK_IMAGE_START_MASK; +- rd_prompt = ((RAMDISK_FLAGS & RAMDISK_PROMPT_FLAG) != 0); +- rd_doload = ((RAMDISK_FLAGS & RAMDISK_LOAD_FLAG) != 0); ++ rd_image_start = boot_params.hdr.ram_size & RAMDISK_IMAGE_START_MASK; ++ rd_prompt = ((boot_params.hdr.ram_size & RAMDISK_PROMPT_FLAG) != 0); ++ rd_doload = ((boot_params.hdr.ram_size & RAMDISK_LOAD_FLAG) != 0); + #endif + setup_memory_region(); + copy_edd(); - return 0; - } ---- head.orig/drivers/xen/console/xencons_ring.c 2012-03-22 13:43:28.000000000 +0100 -+++ head/drivers/xen/console/xencons_ring.c 2012-03-22 13:44:19.000000000 +0100 -@@ -100,7 +100,7 @@ int xencons_ring_init(void) - xen_start_info->console.domU.evtchn, - handle_input, 0, "xencons", NULL); - if (irq < 0) { -- printk(KERN_ERR "XEN console request irq failed %i\n", irq); -+ pr_err("XEN console request irq failed %i\n", irq); - return irq; - } +- if (!MOUNT_ROOT_RDONLY) ++ if (!boot_params.hdr.root_flags) + root_mountflags &= ~MS_RDONLY; + init_mm.start_code = (unsigned long) &_text; + init_mm.end_code = (unsigned long) &_etext; +@@ -333,6 +370,8 @@ void __init setup_arch(char **cmdline_p) + code_resource.end = virt_to_phys(&_etext)-1; + data_resource.start = virt_to_phys(&_etext); + data_resource.end = virt_to_phys(&_edata)-1; ++ bss_resource.start = virt_to_phys(&__bss_start); ++ bss_resource.end = virt_to_phys(&__bss_stop)-1; ---- head.orig/drivers/xen/core/cpu_hotplug.c 2013-01-30 10:25:34.000000000 +0100 -+++ head/drivers/xen/core/cpu_hotplug.c 2013-01-30 10:36:33.000000000 +0100 -@@ -36,7 +36,7 @@ static void vcpu_hotplug(unsigned int cp - sprintf(dir, "cpu/%u", cpu); - err = xenbus_scanf(XBT_NIL, dir, "availability", "%15s", state); - if (err != 1) { -- printk(KERN_ERR "XENBUS: Unable to read cpu state\n"); -+ pr_err("XENBUS: Unable to read cpu state\n"); - return; - } + early_identify_cpu(&boot_cpu_data); -@@ -49,7 +49,7 @@ static void vcpu_hotplug(unsigned int cp - if (!cpu_down(cpu) && dev) - kobject_uevent(&dev->kobj, KOBJ_OFFLINE); - } else { -- printk(KERN_ERR "XENBUS: unknown state(%s) on CPU%d\n", -+ pr_err("XENBUS: unknown state(%s) on CPU%d\n", - state, cpu); - } - } -@@ -97,8 +97,7 @@ static int setup_cpu_watcher(struct noti - if (!is_initial_xendomain()) { - for_each_possible_cpu(i) - vcpu_hotplug(i, get_cpu_sysdev(i)); -- printk(KERN_INFO "Brought up %ld CPUs\n", -- (long)num_online_cpus()); -+ pr_info("Brought up %ld CPUs\n", (long)num_online_cpus()); - } +@@ -360,6 +399,11 @@ void __init setup_arch(char **cmdline_p) + if (is_initial_xendomain()) + dmi_scan_machine(); - return NOTIFY_DONE; -@@ -132,8 +131,7 @@ int smp_suspend(void) - continue; - err = cpu_down(cpu); - if (err) { -- printk(KERN_CRIT "Failed to take all CPUs " -- "down: %d.\n", err); -+ pr_crit("Failed to take all CPUs down: %d\n", err); - for_each_possible_cpu(cpu) - vcpu_hotplug(cpu, NULL); - return err; -@@ -161,8 +159,8 @@ int cpu_up_check(unsigned int cpu) - if (local_cpu_hotplug_request()) { - cpu_set(cpu, local_allowed_cpumask); - if (!cpu_isset(cpu, xenbus_allowed_cpumask)) { -- printk("%s: attempt to bring up CPU %u disallowed by " -- "remote admin.\n", __FUNCTION__, cpu); -+ pr_warning("%s: attempt to bring up CPU %u disallowed " -+ "by remote admin.\n", __FUNCTION__, cpu); - rc = -EBUSY; - } - } else if (!cpu_isset(cpu, local_allowed_cpumask) || ---- head.orig/drivers/xen/core/evtchn.c 2012-10-04 11:53:07.000000000 +0200 -+++ head/drivers/xen/core/evtchn.c 2012-10-04 11:54:16.000000000 +0200 -@@ -361,8 +361,8 @@ static int find_unbound_irq(void) - - if (!warned) { - warned = 1; -- printk(KERN_WARNING "No available IRQ to bind to: " -- "increase NR_DYNIRQS.\n"); -+ pr_warning("No available IRQ to bind to: " -+ "increase NR_DYNIRQS.\n"); - } - - return -ENOSPC; -@@ -850,8 +850,7 @@ static void enable_pirq(unsigned int irq - bind_pirq.flags = probing_irq(irq) ? 0 : BIND_PIRQ__WILL_SHARE; - if (HYPERVISOR_event_channel_op(EVTCHNOP_bind_pirq, &bind_pirq) != 0) { - if (!probing_irq(irq)) -- printk(KERN_INFO "Failed to obtain physical IRQ %d\n", -- irq); -+ pr_info("Failed to obtain physical IRQ %d\n", irq); - return; - } - evtchn = bind_pirq.port; -@@ -1150,8 +1149,8 @@ int evtchn_map_pirq(int irq, int xen_pir - return 0; - } else if (type_from_irq(irq) != IRQT_PIRQ - || index_from_irq(irq) != xen_pirq) { -- printk(KERN_ERR "IRQ#%d is already mapped to %d:%u - " -- "cannot map to PIRQ#%u\n", -+ pr_err("IRQ#%d is already mapped to %d:%u - " -+ "cannot map to PIRQ#%u\n", - irq, type_from_irq(irq), index_from_irq(irq), xen_pirq); - return -EINVAL; - } ---- head.orig/drivers/xen/core/firmware.c 2012-06-12 15:05:58.000000000 +0200 -+++ head/drivers/xen/core/firmware.c 2012-06-12 15:13:59.000000000 +0200 -@@ -1,4 +1,5 @@ - #include -+#include - #include - #include - #include ---- head.orig/drivers/xen/core/gnttab.c 2012-03-12 13:38:38.000000000 +0100 -+++ head/drivers/xen/core/gnttab.c 2012-11-14 12:41:51.000000000 +0100 -@@ -246,8 +246,8 @@ static void gnttab_handle_deferred(unsig - entry = NULL; - } else { - if (!--entry->warn_delay) -- printk(KERN_INFO "g.e. %#x still pending\n", -- entry->ref); -+ pr_info("g.e. %#x still pending\n", -+ entry->ref); - if (!first) - first = entry; - } -@@ -778,7 +778,7 @@ int gnttab_resume(void) - resume_frames = alloc_xen_mmio(PAGE_SIZE * max_nr_gframes); - shared = ioremap(resume_frames, PAGE_SIZE * max_nr_gframes); - if (shared == NULL) { -- printk("error to ioremap gnttab share frames\n"); -+ pr_warning("error to ioremap gnttab share frames\n"); - return -1; - } - } ---- head.orig/drivers/xen/core/machine_kexec.c 2012-02-17 09:55:35.000000000 +0100 -+++ head/drivers/xen/core/machine_kexec.c 2012-02-17 09:56:45.000000000 +0100 -@@ -31,6 +31,10 @@ void __init xen_machine_kexec_setup_reso - unsigned int k = 0, nr = 0; - int rc; - -+ if (strstr(boot_command_line, "crashkernel=")) -+ pr_warning("Ignoring crashkernel command line, " -+ "parameter will be supplied by xen\n"); ++#if defined(CONFIG_SMP) && !defined(CONFIG_XEN) ++ /* setup to use the static apicid table during kernel startup */ ++ x86_cpu_to_apicid_ptr = (void *)&x86_cpu_to_apicid_init; ++#endif + - if (!is_initial_xendomain()) - return; - -@@ -147,6 +151,13 @@ void __init xen_machine_kexec_setup_reso - - xen_max_nr_phys_cpus = nr; - -+#ifdef CONFIG_X86 -+ if (xen_create_contiguous_region((unsigned long)&vmcoreinfo_note, -+ get_order(sizeof(vmcoreinfo_note)), -+ BITS_PER_LONG)) -+ goto err; + /* How many end-of-memory variables you have, grandma! */ + max_low_pfn = end_pfn; + max_pfn = end_pfn; +@@ -424,52 +468,37 @@ void __init setup_arch(char **cmdline_p) + */ + acpi_reserve_bootmem(); + #endif +-#ifdef CONFIG_XEN + #ifdef CONFIG_BLK_DEV_INITRD ++#ifdef CONFIG_XEN + if (xen_start_info->mod_start) { +- if (INITRD_START + INITRD_SIZE <= (end_pfn << PAGE_SHIFT)) { +- /*reserve_bootmem_generic(INITRD_START, INITRD_SIZE);*/ +- initrd_start = INITRD_START + PAGE_OFFSET; +- initrd_end = initrd_start+INITRD_SIZE; ++ unsigned long ramdisk_image = __pa(xen_start_info->mod_start); ++ unsigned long ramdisk_size = xen_start_info->mod_len; ++#else ++ if (boot_params.hdr.type_of_loader && boot_params.hdr.ramdisk_image) { ++ unsigned long ramdisk_image = boot_params.hdr.ramdisk_image; ++ unsigned long ramdisk_size = boot_params.hdr.ramdisk_size; +#endif ++ unsigned long ramdisk_end = ramdisk_image + ramdisk_size; ++ unsigned long end_of_mem = end_pfn << PAGE_SHIFT; + - return; - - free: -@@ -227,6 +238,13 @@ void __noreturn machine_kexec(struct kim - panic("KEXEC_CMD_kexec hypercall should not return\n"); ++ if (ramdisk_end <= end_of_mem) { ++#ifndef CONFIG_XEN ++ reserve_bootmem_generic(ramdisk_image, ramdisk_size); ++#endif ++ initrd_start = ramdisk_image + PAGE_OFFSET; ++ initrd_end = initrd_start+ramdisk_size; ++#ifdef CONFIG_XEN + initrd_below_start_ok = 1; +- } else { +- printk(KERN_ERR "initrd extends beyond end of memory " +- "(0x%08lx > 0x%08lx)\ndisabling initrd\n", +- (unsigned long)(INITRD_START + INITRD_SIZE), +- (unsigned long)(end_pfn << PAGE_SHIFT)); +- initrd_start = 0; +- } +- } + #endif +-#else /* CONFIG_XEN */ +-#ifdef CONFIG_BLK_DEV_INITRD +- if (LOADER_TYPE && INITRD_START) { +- if (INITRD_START + INITRD_SIZE <= (end_pfn << PAGE_SHIFT)) { +- reserve_bootmem_generic(INITRD_START, INITRD_SIZE); +- initrd_start = INITRD_START + PAGE_OFFSET; +- initrd_end = initrd_start+INITRD_SIZE; +- } +- else { ++ } else { + printk(KERN_ERR "initrd extends beyond end of memory " +- "(0x%08lx > 0x%08lx)\ndisabling initrd\n", +- (unsigned long)(INITRD_START + INITRD_SIZE), +- (unsigned long)(end_pfn << PAGE_SHIFT)); ++ "(0x%08lx > 0x%08lx)\ndisabling initrd\n", ++ ramdisk_end, end_of_mem); + initrd_start = 0; + } + } + #endif +-#endif /* !CONFIG_XEN */ +-#ifdef CONFIG_KEXEC +-#ifdef CONFIG_XEN +- xen_machine_kexec_setup_resources(); +-#else +- if (crashk_res.start != crashk_res.end) { +- reserve_bootmem_generic(crashk_res.start, +- crashk_res.end - crashk_res.start + 1); +- } +-#endif +-#endif +- ++ reserve_crashkernel(); + paging_init(); + #ifdef CONFIG_X86_LOCAL_APIC + /* +@@ -782,7 +811,7 @@ static void __init amd_detect_cmp(struct + but in the same order as the HT nodeids. + If that doesn't result in a usable node fall back to the + path for the previous case. */ +- int ht_nodeid = apicid - (cpu_data[0].phys_proc_id << bits); ++ int ht_nodeid = apicid - (cpu_data(0).phys_proc_id << bits); + if (ht_nodeid >= 0 && + apicid_to_node[ht_nodeid] != NUMA_NO_NODE) + node = apicid_to_node[ht_nodeid]; +@@ -797,6 +826,39 @@ static void __init amd_detect_cmp(struct + #endif } -+#ifdef CONFIG_X86 -+unsigned long paddr_vmcoreinfo_note(void) ++#define ENABLE_C1E_MASK 0x18000000 ++#define CPUID_PROCESSOR_SIGNATURE 1 ++#define CPUID_XFAM 0x0ff00000 ++#define CPUID_XFAM_K8 0x00000000 ++#define CPUID_XFAM_10H 0x00100000 ++#define CPUID_XFAM_11H 0x00200000 ++#define CPUID_XMOD 0x000f0000 ++#define CPUID_XMOD_REV_F 0x00040000 ++ ++#ifndef CONFIG_XEN ++/* AMD systems with C1E don't have a working lAPIC timer. Check for that. */ ++static __cpuinit int amd_apic_timer_broken(void) +{ -+ return virt_to_machine(&vmcoreinfo_note); ++ u32 lo, hi; ++ u32 eax = cpuid_eax(CPUID_PROCESSOR_SIGNATURE); ++ switch (eax & CPUID_XFAM) { ++ case CPUID_XFAM_K8: ++ if ((eax & CPUID_XMOD) < CPUID_XMOD_REV_F) ++ break; ++ case CPUID_XFAM_10H: ++ case CPUID_XFAM_11H: ++ rdmsr(MSR_K8_ENABLE_C1E, lo, hi); ++ if (lo & ENABLE_C1E_MASK) ++ return 1; ++ break; ++ default: ++ /* err on the side of caution */ ++ return 1; ++ } ++ return 0; +} +#endif + - void machine_shutdown(void) + static void __cpuinit init_amd(struct cpuinfo_x86 *c) { - /* do nothing */ ---- head.orig/drivers/xen/core/machine_reboot.c 2011-01-31 17:32:29.000000000 +0100 -+++ head/drivers/xen/core/machine_reboot.c 2011-01-31 17:56:27.000000000 +0100 -@@ -204,8 +204,7 @@ int __xen_suspend(int fast_suspend, void + unsigned level; +@@ -826,7 +888,7 @@ static void __cpuinit init_amd(struct cp + level = cpuid_eax(1); + if (c->x86 == 15 && ((level >= 0x0f48 && level < 0x0f50) || level >= 0x0f58)) + set_bit(X86_FEATURE_REP_GOOD, &c->x86_capability); +- if (c->x86 == 0x10) ++ if (c->x86 == 0x10 || c->x86 == 0x11) + set_bit(X86_FEATURE_REP_GOOD, &c->x86_capability); - #if defined(__i386__) || defined(__x86_64__) - if (xen_feature(XENFEAT_auto_translated_physmap)) { -- printk(KERN_WARNING "Cannot suspend in " -- "auto_translated_physmap mode.\n"); -+ pr_warning("Can't suspend in auto_translated_physmap mode\n"); - return -EOPNOTSUPP; - } + /* Enable workaround for FXSAVE leak */ +@@ -868,6 +930,11 @@ static void __cpuinit init_amd(struct cp + /* Family 10 doesn't support C states in MWAIT so don't use it */ + if (c->x86 == 0x10 && !force_mwait) + clear_bit(X86_FEATURE_MWAIT, &c->x86_capability); ++ ++#ifndef CONFIG_XEN ++ if (amd_apic_timer_broken()) ++ disable_apic_timer = 1; ++#endif + } + + static void __cpuinit detect_ht(struct cpuinfo_x86 *c) +@@ -917,6 +984,7 @@ out: #endif ---- head.orig/drivers/xen/core/reboot.c 2011-01-31 17:49:31.000000000 +0100 -+++ head/drivers/xen/core/reboot.c 2011-01-31 17:56:27.000000000 +0100 -@@ -82,14 +82,14 @@ static int xen_suspend(void *__unused) - daemonize("suspend"); - err = set_cpus_allowed(current, cpumask_of_cpu(0)); - if (err) { -- printk(KERN_ERR "Xen suspend can't run on CPU0 (%d)\n", err); -+ pr_err("Xen suspend can't run on CPU0 (%d)\n", err); - goto fail; - } - - do { - err = __xen_suspend(fast_suspend, xen_resume_notifier); - if (err) { -- printk(KERN_ERR "Xen suspend failed (%d)\n", err); -+ pr_err("Xen suspend failed (%d)\n", err); - goto fail; - } - if (!suspend_cancelled) -@@ -151,8 +151,8 @@ static void __shutdown_handler(struct wo - NULL, CLONE_FS | CLONE_FILES); + } - if (err < 0) { -- printk(KERN_WARNING "Error creating shutdown process (%d): " -- "retrying...\n", -err); -+ pr_warning("Error creating shutdown process (%d): " -+ "retrying...\n", -err); - schedule_delayed_work(&shutdown_work, HZ/2); - } ++#ifndef CONFIG_XEN + /* + * find out the number of processor cores on the die + */ +@@ -934,6 +1002,7 @@ static int __cpuinit intel_num_cpu_cores + else + return 1; } -@@ -198,7 +198,7 @@ static void shutdown_handler(struct xenb - else if (strcmp(str, "halt") == 0) - new_state = SHUTDOWN_HALT; ++#endif + + static void srat_detect_node(void) + { +@@ -998,7 +1067,9 @@ static void __cpuinit init_intel(struct + set_bit(X86_FEATURE_SYNC_RDTSC, &c->x86_capability); else -- printk("Ignoring shutdown request: %s\n", str); -+ pr_warning("Ignoring shutdown request: %s\n", str); + clear_bit(X86_FEATURE_SYNC_RDTSC, &c->x86_capability); ++#ifndef CONFIG_XEN + c->x86_max_cores = intel_num_cpu_cores(c); ++#endif - switch_shutdown_state(new_state); + srat_detect_node(); + } +@@ -1036,7 +1107,9 @@ void __cpuinit early_identify_cpu(struct + c->x86_model_id[0] = '\0'; /* Unset */ + c->x86_clflush_size = 64; + c->x86_cache_alignment = c->x86_clflush_size; ++#ifndef CONFIG_XEN + c->x86_max_cores = 1; ++#endif + c->extended_cpuid_level = 0; + memset(&c->x86_capability, 0, sizeof c->x86_capability); -@@ -217,8 +217,7 @@ static void sysrq_handler(struct xenbus_ - if (err) - return; - if (xenbus_scanf(xbt, "control", "sysrq", "%c", &sysrq_key) <= 0) { -- printk(KERN_ERR "Unable to read sysrq code in " -- "control/sysrq\n"); -+ pr_err("Unable to read sysrq code in control/sysrq\n"); - xenbus_transaction_end(xbt, 1); - return; - } -@@ -267,7 +266,7 @@ static int setup_suspend_evtchn(void) - return -1; +@@ -1180,6 +1253,7 @@ void __cpuinit print_cpu_info(struct cpu + static int show_cpuinfo(struct seq_file *m, void *v) + { + struct cpuinfo_x86 *c = v; ++ int cpu = 0; - port = irq_to_evtchn_port(irq); -- printk(KERN_INFO "suspend: event channel %d\n", port); -+ pr_info("suspend: event channel %d\n", port); - sprintf(portstr, "%d", port); - xenbus_write(XBT_NIL, "device/suspend", "event-channel", portstr); + /* + * These flag bits must match the definitions in . +@@ -1189,7 +1263,7 @@ static int show_cpuinfo(struct seq_file + * applications want to get the raw CPUID data, they should access + * /dev/cpu//cpuid instead. + */ +- static char *x86_cap_flags[] = { ++ static const char *const x86_cap_flags[] = { + /* Intel-defined */ + "fpu", "vme", "de", "pse", "tsc", "msr", "pae", "mce", + "cx8", "apic", NULL, "sep", "mtrr", "pge", "mca", "cmov", +@@ -1220,7 +1294,7 @@ static int show_cpuinfo(struct seq_file + /* Intel-defined (#2) */ + "pni", NULL, NULL, "monitor", "ds_cpl", "vmx", "smx", "est", + "tm2", "ssse3", "cid", NULL, NULL, "cx16", "xtpr", NULL, +- NULL, NULL, "dca", NULL, NULL, NULL, NULL, "popcnt", ++ NULL, NULL, "dca", "sse4_1", "sse4_2", NULL, NULL, "popcnt", + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, -@@ -280,7 +279,7 @@ static int setup_shutdown_watcher(void) + /* VIA/Cyrix/Centaur-defined */ +@@ -1230,10 +1304,10 @@ static int show_cpuinfo(struct seq_file + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, - err = register_xenbus_watch(&sysrq_watch); - if (err) { -- printk(KERN_ERR "Failed to set sysrq watcher\n"); -+ pr_err("Failed to set sysrq watcher\n"); - return err; - } + /* AMD-defined (#2) */ +- "lahf_lm", "cmp_legacy", "svm", "extapic", "cr8_legacy", +- "altmovcr8", "abm", "sse4a", +- "misalignsse", "3dnowprefetch", +- "osvw", "ibs", NULL, NULL, NULL, NULL, ++ "lahf_lm", "cmp_legacy", "svm", "extapic", ++ "cr8_legacy", "abm", "sse4a", "misalignsse", ++ "3dnowprefetch", "osvw", "ibs", "sse5", ++ "skinit", "wdt", NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, -@@ -293,14 +292,14 @@ static int setup_shutdown_watcher(void) +@@ -1243,7 +1317,7 @@ static int show_cpuinfo(struct seq_file + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + }; +- static char *x86_power_flags[] = { ++ static const char *const x86_power_flags[] = { + "ts", /* temperature sensor */ + "fid", /* frequency id control */ + "vid", /* voltage id control */ +@@ -1258,8 +1332,7 @@ static int show_cpuinfo(struct seq_file - err = register_xenbus_watch(&shutdown_watch); - if (err) { -- printk(KERN_ERR "Failed to set shutdown watcher\n"); -+ pr_err("Failed to set shutdown watcher\n"); - return err; - } - /* suspend event channel */ - err = setup_suspend_evtchn(); - if (err) { -- printk(KERN_ERR "Failed to register suspend event channel\n"); -+ pr_err("Failed to register suspend event channel\n"); - return err; - } + #ifdef CONFIG_SMP +- if (!cpu_online(c-cpu_data)) +- return 0; ++ cpu = c->cpu_index; + #endif ---- head.orig/drivers/xen/core/smpboot.c 2012-03-22 16:08:04.000000000 +0100 -+++ head/drivers/xen/core/smpboot.c 2012-04-04 10:19:44.000000000 +0200 -@@ -34,31 +34,20 @@ extern void failsafe_callback(void); - extern void system_call(void); - extern void smp_trap_init(trap_info_t *); + seq_printf(m,"processor\t: %u\n" +@@ -1267,7 +1340,7 @@ static int show_cpuinfo(struct seq_file + "cpu family\t: %d\n" + "model\t\t: %d\n" + "model name\t: %s\n", +- (unsigned)(c-cpu_data), ++ (unsigned)cpu, + c->x86_vendor_id[0] ? c->x86_vendor_id : "unknown", + c->x86, + (int)c->x86_model, +@@ -1279,7 +1352,7 @@ static int show_cpuinfo(struct seq_file + seq_printf(m, "stepping\t: unknown\n"); + + if (cpu_has(c,X86_FEATURE_TSC)) { +- unsigned int freq = cpufreq_quick_get((unsigned)(c-cpu_data)); ++ unsigned int freq = cpufreq_quick_get((unsigned)cpu); + if (!freq) + freq = cpu_khz; + seq_printf(m, "cpu MHz\t\t: %u.%03u\n", +@@ -1292,9 +1365,9 @@ static int show_cpuinfo(struct seq_file + + #if defined(CONFIG_SMP) && !defined(CONFIG_XEN) + if (smp_num_siblings * c->x86_max_cores > 1) { +- int cpu = c - cpu_data; + seq_printf(m, "physical id\t: %d\n", c->phys_proc_id); +- seq_printf(m, "siblings\t: %d\n", cpus_weight(cpu_core_map[cpu])); ++ seq_printf(m, "siblings\t: %d\n", ++ cpus_weight(per_cpu(cpu_core_map, cpu))); + seq_printf(m, "core id\t\t: %d\n", c->cpu_core_id); + seq_printf(m, "cpu cores\t: %d\n", c->booted_cores); + } +@@ -1349,12 +1422,16 @@ static int show_cpuinfo(struct seq_file --/* Number of siblings per CPU package */ --int smp_num_siblings = 1; -- - cpumask_t cpu_online_map; - EXPORT_SYMBOL(cpu_online_map); - cpumask_t cpu_possible_map; - EXPORT_SYMBOL(cpu_possible_map); - cpumask_t cpu_initialized_map; + static void *c_start(struct seq_file *m, loff_t *pos) + { +- return *pos < NR_CPUS ? cpu_data + *pos : NULL; ++ if (*pos == 0) /* just in case, cpu 0 is not the first */ ++ *pos = first_cpu(cpu_online_map); ++ if ((*pos) < NR_CPUS && cpu_online(*pos)) ++ return &cpu_data(*pos); ++ return NULL; + } --struct cpuinfo_x86 cpu_data[NR_CPUS] __cacheline_aligned; --EXPORT_SYMBOL(cpu_data); -+DEFINE_PER_CPU(struct cpuinfo_x86, cpu_info); -+EXPORT_PER_CPU_SYMBOL(cpu_info); + static void *c_next(struct seq_file *m, void *v, loff_t *pos) + { +- ++*pos; ++ *pos = next_cpu(*pos, cpu_online_map); + return c_start(m, pos); + } - static DEFINE_PER_CPU(int, resched_irq); - static DEFINE_PER_CPU(int, callfunc_irq); - static char resched_name[NR_CPUS][15]; - static char callfunc_name[NR_CPUS][15]; +--- a/arch/x86/kernel/smp_32-xen.c ++++ b/arch/x86/kernel/smp_32-xen.c +@@ -72,7 +72,7 @@ + * + * B stepping CPUs may hang. There are hardware work arounds + * for this. We warn about it in case your board doesn't have the work +- * arounds. Basically thats so I can tell anyone with a B stepping ++ * arounds. Basically that's so I can tell anyone with a B stepping + * CPU and SMP problems "tough". + * + * Specific items [From Pentium Processor Specification Update] +@@ -241,7 +241,7 @@ void leave_mm(unsigned long cpu) + * 1a1) cpu_clear(cpu, old_mm->cpu_vm_mask); + * Stop ipi delivery for the old mm. This is not synchronized with + * the other cpus, but smp_invalidate_interrupt ignore flush ipis +- * for the wrong mm, and in the worst case we perform a superflous ++ * for the wrong mm, and in the worst case we perform a superfluous + * tlb flush. + * 1a2) set cpu_tlbstate to TLBSTATE_OK + * Now the smp_invalidate_interrupt won't call leave_mm if cpu0 +@@ -309,6 +309,7 @@ irqreturn_t smp_invalidate_interrupt(int + smp_mb__after_clear_bit(); + out: + put_cpu_no_resched(); ++ __get_cpu_var(irq_stat).irq_tlb_count++; --cpumask_t cpu_sibling_map[NR_CPUS] __cacheline_aligned; --cpumask_t cpu_core_map[NR_CPUS] __cacheline_aligned; -- --#if defined(__i386__) --u8 x86_cpu_to_apicid[NR_CPUS] = { [0 ... NR_CPUS-1] = 0xff }; --EXPORT_SYMBOL(x86_cpu_to_apicid); --#endif -- - void __init prefill_possible_map(void) - { - int i, rc; -@@ -78,30 +67,6 @@ void __init smp_alloc_memory(void) - { + return IRQ_HANDLED; + } +@@ -580,7 +581,7 @@ static void stop_this_cpu (void * dummy) + */ + cpu_clear(smp_processor_id(), cpu_online_map); + disable_all_local_evtchn(); +- if (cpu_data[smp_processor_id()].hlt_works_ok) ++ if (cpu_data(smp_processor_id()).hlt_works_ok) + for(;;) halt(); + for (;;); } +@@ -610,6 +611,7 @@ void xen_smp_send_stop(void) + */ + irqreturn_t smp_reschedule_interrupt(int irq, void *dev_id) + { ++ __get_cpu_var(irq_stat).irq_resched_count++; --static inline void --set_cpu_sibling_map(unsigned int cpu) --{ -- cpu_data[cpu].phys_proc_id = cpu; -- cpu_data[cpu].cpu_core_id = 0; -- -- cpu_sibling_map[cpu] = cpumask_of_cpu(cpu); -- cpu_core_map[cpu] = cpumask_of_cpu(cpu); -- -- cpu_data[cpu].booted_cores = 1; --} -- --static void --remove_siblinginfo(unsigned int cpu) --{ -- cpu_data[cpu].phys_proc_id = BAD_APICID; -- cpu_data[cpu].cpu_core_id = BAD_APICID; -- -- cpus_clear(cpu_sibling_map[cpu]); -- cpus_clear(cpu_core_map[cpu]); -- -- cpu_data[cpu].booted_cores = 0; --} -- - static int __cpuinit xen_smp_intr_init(unsigned int cpu) - { - int rc; -@@ -156,9 +121,9 @@ void __cpuinit cpu_bringup(void) - { - cpu_init(); - #ifdef __i386__ -- identify_secondary_cpu(cpu_data + smp_processor_id()); -+ identify_secondary_cpu(¤t_cpu_data); - #else -- identify_cpu(cpu_data + smp_processor_id()); -+ identify_cpu(¤t_cpu_data); - #endif - touch_softlockup_watchdog(); - preempt_disable(); -@@ -255,20 +220,9 @@ void __init smp_prepare_cpus(unsigned in - apicid = 0; - if (HYPERVISOR_vcpu_op(VCPUOP_get_physid, 0, &cpu_id) == 0) - apicid = xen_vcpu_physid_to_x86_apicid(cpu_id.phys_id); -- boot_cpu_data.apicid = apicid; -- cpu_data[0] = boot_cpu_data; -- -- x86_cpu_to_apicid[0] = apicid; -- -+ cpu_data(0) = boot_cpu_data; - current_thread_info()->cpu = 0; + return IRQ_HANDLED; + } +@@ -632,6 +634,7 @@ irqreturn_t smp_call_function_interrupt( + */ + irq_enter(); + (*func)(info); ++ __get_cpu_var(irq_stat).irq_call_count++; + irq_exit(); -- for (cpu = 0; cpu < NR_CPUS; cpu++) { -- cpus_clear(cpu_sibling_map[cpu]); -- cpus_clear(cpu_core_map[cpu]); -- } -- -- set_cpu_sibling_map(0); -- - if (xen_smp_intr_init(0)) - BUG(); + if (wait) { +--- a/arch/x86/kernel/smp_64-xen.c ++++ b/arch/x86/kernel/smp_64-xen.c +@@ -167,6 +167,7 @@ asmlinkage void smp_invalidate_interrupt + out: + ack_APIC_irq(); + cpu_clear(cpu, f->flush_cpumask); ++ add_pda(irq_tlb_count, 1); + } -@@ -293,8 +247,7 @@ void __init smp_prepare_cpus(unsigned in - gdt_descr = &cpu_gdt_descr[cpu]; - gdt_descr->address = get_zeroed_page(GFP_KERNEL); - if (unlikely(!gdt_descr->address)) { -- printk(KERN_CRIT "CPU%d failed to allocate GDT\n", -- cpu); -+ pr_crit("CPU%d failed to allocate GDT\n", cpu); - continue; - } - gdt_descr->size = GDT_SIZE; -@@ -309,10 +262,8 @@ void __init smp_prepare_cpus(unsigned in - apicid = cpu; - if (HYPERVISOR_vcpu_op(VCPUOP_get_physid, cpu, &cpu_id) == 0) - apicid = xen_vcpu_physid_to_x86_apicid(cpu_id.phys_id); -- cpu_data[cpu] = boot_cpu_data; -- cpu_data[cpu].apicid = apicid; -- -- x86_cpu_to_apicid[cpu] = apicid; -+ cpu_data(cpu) = boot_cpu_data; -+ cpu_data(cpu).cpu_index = cpu; + static void flush_tlb_others(cpumask_t cpumask, struct mm_struct *mm, +@@ -326,17 +327,27 @@ void unlock_ipi_call_lock(void) + } - #ifdef __x86_64__ - cpu_pda(cpu)->pcurrent = idle; -@@ -375,8 +326,6 @@ int __cpu_disable(void) - if (cpu == 0) - return -EBUSY; + /* +- * this function sends a 'generic call function' IPI to one other CPU +- * in the system. +- * +- * cpu is a standard Linux logical CPU number. ++ * this function sends a 'generic call function' IPI to all other CPU ++ * of the system defined in the mask. + */ +-static void +-__smp_call_function_single(int cpu, void (*func) (void *info), void *info, +- int nonatomic, int wait) ++ ++static int ++__smp_call_function_mask(cpumask_t mask, ++ void (*func)(void *), void *info, ++ int wait) + { + struct call_data_struct data; +- int cpus = 1; ++ cpumask_t allbutself; ++ int cpus; ++ ++ allbutself = cpu_online_map; ++ cpu_clear(smp_processor_id(), allbutself); ++ ++ cpus_and(mask, mask, allbutself); ++ cpus = cpus_weight(mask); ++ ++ if (!cpus) ++ return 0; -- remove_siblinginfo(cpu); -- - cpu_clear(cpu, map); - fixup_irqs(map); - cpu_clear(cpu, cpu_online_map); -@@ -417,7 +366,6 @@ int __cpuinit __cpu_up(unsigned int cpu) - alternatives_smp_switch(1); + data.func = func; + data.info = info; +@@ -347,19 +358,55 @@ __smp_call_function_single(int cpu, void - /* This must be done before setting cpu_online_map */ -- set_cpu_sibling_map(cpu); + call_data = &data; wmb(); +- /* Send a message to all other CPUs and wait for them to respond */ +- send_IPI_mask(cpumask_of_cpu(cpu), CALL_FUNCTION_VECTOR); ++ ++ /* Send a message to other CPUs */ ++ if (cpus_equal(mask, allbutself)) ++ send_IPI_allbutself(CALL_FUNCTION_VECTOR); ++ else ++ send_IPI_mask(mask, CALL_FUNCTION_VECTOR); - rc = HYPERVISOR_vcpu_op(VCPUOP_up, cpu, NULL); -@@ -435,7 +383,6 @@ int __cpuinit __cpu_up(unsigned int cpu) - - if (rc) { - xen_smp_intr_exit(cpu); -- remove_siblinginfo(cpu); - if (num_online_cpus() == 1) - alternatives_smp_switch(0); - } ---- head.orig/drivers/xen/fbfront/xenfb.c 2011-01-31 17:32:16.000000000 +0100 -+++ head/drivers/xen/fbfront/xenfb.c 2011-01-31 17:56:27.000000000 +0100 -@@ -240,8 +240,8 @@ static void xenfb_update_screen(struct x - mutex_unlock(&info->mm_lock); - - if (x2 < x1 || y2 < y1) { -- printk("xenfb_update_screen bogus rect %d %d %d %d\n", -- x1, x2, y1, y2); -+ pr_warning("xenfb_update_screen bogus rect %d %d %d %d\n", -+ x1, x2, y1, y2); - WARN_ON(1); - } - xenfb_do_update(info, x1, y1, x2 - x1, y2 - y1); ---- head.orig/drivers/xen/fbfront/xenkbd.c 2011-10-04 15:30:07.000000000 +0200 -+++ head/drivers/xen/fbfront/xenkbd.c 2011-01-31 17:56:27.000000000 +0100 -@@ -80,8 +80,8 @@ static irqreturn_t input_handler(int rq, - input_report_key(dev, event->key.keycode, - event->key.pressed); - else -- printk("xenkbd: unhandled keycode 0x%x\n", -- event->key.keycode); -+ pr_warning("xenkbd: unhandled keycode 0x%x\n", -+ event->key.keycode); - break; - case XENKBD_TYPE_POS: - if (event->pos.rel_z) ---- head.orig/drivers/xen/gntdev/gntdev.c 2012-05-23 13:04:13.000000000 +0200 -+++ head/drivers/xen/gntdev/gntdev.c 2012-05-23 13:29:28.000000000 +0200 -@@ -365,14 +365,14 @@ static int __init gntdev_init(void) - int err; + /* Wait for response */ + while (atomic_read(&data.started) != cpus) + cpu_relax(); - if (!is_running_on_xen()) { -- printk(KERN_ERR "You must be running Xen to use gntdev\n"); -+ pr_err("You must be running Xen to use gntdev\n"); - return -ENODEV; - } + if (!wait) +- return; ++ return 0; - err = misc_register(&gntdev_miscdev); - if (err) - { -- printk(KERN_ERR "Could not register gntdev device\n"); -+ pr_err("Could not register gntdev device\n"); - return err; - } + while (atomic_read(&data.finished) != cpus) + cpu_relax(); ++ ++ return 0; + } ++/** ++ * smp_call_function_mask(): Run a function on a set of other CPUs. ++ * @mask: The set of cpus to run on. Must not include the current cpu. ++ * @func: The function to run. This must be fast and non-blocking. ++ * @info: An arbitrary pointer to pass to the function. ++ * @wait: If true, wait (atomically) until function has completed on other CPUs. ++ * ++ * Returns 0 on success, else a negative status code. ++ * ++ * If @wait is true, then returns once @func has returned; otherwise ++ * it returns just before the target cpu calls @func. ++ * ++ * You must not call this function with disabled interrupts or from a ++ * hardware interrupt handler or from a bottom half handler. ++ */ ++int smp_call_function_mask(cpumask_t mask, ++ void (*func)(void *), void *info, ++ int wait) ++{ ++ int ret; ++ ++ /* Can deadlock when called with interrupts disabled */ ++ WARN_ON(irqs_disabled()); ++ ++ spin_lock(&call_lock); ++ ret = __smp_call_function_mask(mask, func, info, wait); ++ spin_unlock(&call_lock); ++ return ret; ++} ++EXPORT_SYMBOL(smp_call_function_mask); -@@ -453,7 +453,7 @@ static int gntdev_mmap (struct file *fli - struct vm_foreign_map *foreign_map; + /* + * smp_call_function_single - Run a function on a specific CPU +@@ -378,6 +425,7 @@ int smp_call_function_single (int cpu, v + int nonatomic, int wait) + { + /* prevent preemption and reschedule on another processor */ ++ int ret; + int me = get_cpu(); - if (unlikely(!private_data)) { -- printk(KERN_ERR "File's private data is NULL.\n"); -+ pr_err("file's private data is NULL\n"); - return -EINVAL; + /* Can deadlock when called with interrupts disabled */ +@@ -391,51 +439,14 @@ int smp_call_function_single (int cpu, v + return 0; } -@@ -463,28 +463,27 @@ static int gntdev_mmap (struct file *fli - up_read(&private_data->grants_sem); +- spin_lock(&call_lock); +- __smp_call_function_single(cpu, func, info, nonatomic, wait); +- spin_unlock(&call_lock); ++ ret = smp_call_function_mask(cpumask_of_cpu(cpu), func, info, wait); ++ + put_cpu(); +- return 0; ++ return ret; + } + EXPORT_SYMBOL(smp_call_function_single); - if (unlikely(!grants)) { -- printk(KERN_ERR "Attempted to mmap before ioctl.\n"); -+ pr_err("attempted to mmap before ioctl\n"); - return -EINVAL; - } - grants += slot_index; + /* +- * this function sends a 'generic call function' IPI to all other CPUs +- * in the system. +- */ +-static void __smp_call_function (void (*func) (void *info), void *info, +- int nonatomic, int wait) +-{ +- struct call_data_struct data; +- int cpus = num_online_cpus()-1; +- +- if (!cpus) +- return; +- +- data.func = func; +- data.info = info; +- atomic_set(&data.started, 0); +- data.wait = wait; +- if (wait) +- atomic_set(&data.finished, 0); +- +- call_data = &data; +- wmb(); +- /* Send a message to all other CPUs and wait for them to respond */ +- send_IPI_allbutself(CALL_FUNCTION_VECTOR); +- +- /* Wait for response */ +- while (atomic_read(&data.started) != cpus) +- cpu_relax(); +- +- if (!wait) +- return; +- +- while (atomic_read(&data.finished) != cpus) +- cpu_relax(); +-} +- +-/* + * smp_call_function - run a function on all other CPUs. + * @func: The function to run. This must be fast and non-blocking. + * @info: An arbitrary pointer to pass to the function. +@@ -453,10 +464,7 @@ static void __smp_call_function (void (* + int smp_call_function (void (*func) (void *info), void *info, int nonatomic, + int wait) + { +- spin_lock(&call_lock); +- __smp_call_function(func,info,nonatomic,wait); +- spin_unlock(&call_lock); +- return 0; ++ return smp_call_function_mask(cpu_online_map, func, info, wait); + } + EXPORT_SYMBOL(smp_call_function); - if (unlikely(size + slot_index <= slot_index || - size + slot_index > private_data->grants_size)) { -- printk(KERN_ERR "Invalid number of pages or offset" -+ pr_err("Invalid number of pages or offset" - "(num_pages = %lu, first_slot = %lu)\n", - size, slot_index); - return -ENXIO; - } +@@ -485,7 +493,7 @@ void smp_send_stop(void) + /* Don't deadlock on the call lock in panic */ + nolock = !spin_trylock(&call_lock); + local_irq_save(flags); +- __smp_call_function(stop_this_cpu, NULL, 0, 0); ++ __smp_call_function_mask(cpu_online_map, stop_this_cpu, NULL, 0); + if (!nolock) + spin_unlock(&call_lock); + disable_all_local_evtchn(); +@@ -505,7 +513,9 @@ asmlinkage irqreturn_t smp_reschedule_in + { + #ifndef CONFIG_XEN + ack_APIC_irq(); +-#else ++#endif ++ add_pda(irq_resched_count, 1); ++#ifdef CONFIG_XEN + return IRQ_HANDLED; + #endif + } +@@ -535,6 +545,7 @@ asmlinkage irqreturn_t smp_call_function + exit_idle(); + irq_enter(); + (*func)(info); ++ add_pda(irq_call_count, 1); + irq_exit(); + if (wait) { + mb(); +--- a/arch/x86/kernel/time-xen.c ++++ b/arch/x86/kernel/time-xen.c +@@ -1,6 +1,4 @@ + /* +- * linux/arch/i386/kernel/time.c +- * + * Copyright (C) 1991, 1992, 1995 Linus Torvalds + * + * This file contains the PC-specific time handling details: +@@ -72,6 +70,7 @@ + #include - if ((vma->vm_flags & VM_WRITE) && !(vma->vm_flags & VM_SHARED)) { -- printk(KERN_ERR "Writable mappings must be shared.\n"); -+ pr_err("writable mappings must be shared\n"); - return -EINVAL; - } + #include ++#include + #include - foreign_map = kmalloc(sizeof(*foreign_map), GFP_KERNEL); - if (!foreign_map) { -- printk(KERN_ERR "Couldn't allocate mapping structure for VM " -- "area.\n"); -+ pr_err("couldn't allocate mapping structure for VM area\n"); - return -ENOMEM; - } - foreign_map->map = &private_data->foreign_pages[slot_index]; -@@ -493,9 +492,8 @@ static int gntdev_mmap (struct file *fli - down_write(&private_data->grants_sem); - for (i = 0; i < size; ++i) { - if (grants[i].state != GNTDEV_SLOT_NOT_YET_MAPPED) { -- printk(KERN_ERR "Slot (index = %lu) is in the wrong " -- "state (%d).\n", slot_index + i, -- grants[i].state); -+ pr_err("Slot (index = %lu) is in the wrong state (%d)\n", -+ slot_index + i, grants[i].state); - up_write(&private_data->grants_sem); - kfree(foreign_map); - return -EINVAL; -@@ -547,7 +545,7 @@ static int gntdev_mmap (struct file *fli - BUG_ON(ret); - if (op.status != GNTST_okay) { - if (op.status != GNTST_eagain) -- printk(KERN_ERR "Error mapping the grant reference " -+ pr_err("Error mapping the grant reference " - "into the kernel (%d). domid = %d; ref = %d\n", - op.status, - grants[i].u.valid.domid, -@@ -592,8 +590,7 @@ static int gntdev_mmap (struct file *fli - user_vaddr, - &ptep))) - { -- printk(KERN_ERR "Error obtaining PTE pointer (%d)\n", -- ret); -+ pr_err("Error obtaining PTE pointer (%d)\n", ret); - goto undo_map_out; - } + #include +@@ -369,7 +368,6 @@ int xen_update_wallclock(const struct ti -@@ -616,7 +613,7 @@ static int gntdev_mmap (struct file *fli - &op, 1); - BUG_ON(ret); - if (op.status != GNTST_okay) { -- printk(KERN_ERR "Error mapping the grant reference " -+ pr_err("Error mapping the grant reference " - "into user space (%d). domid = %d; ref = %d\n", - op.status, - grants[i].u.valid.domid, -@@ -726,9 +723,9 @@ static pte_t gntdev_clear_pte(struct vm_ - BUG_ON(ret); + return 0; + } +-#endif - if (nr && op[0].status != GNTST_okay) -- printk("User unmap grant status = %d\n", op[0].status); -+ pr_warning("User unmap grant status = %d\n", op[0].status); - if (op[nr].status != GNTST_okay) -- printk("Kernel unmap grant status = %d\n", op[nr].status); -+ pr_warning("Kernel unmap grant status = %d\n", op[nr].status); + static void sync_xen_wallclock(unsigned long dummy); + static DEFINE_TIMER(sync_xen_wallclock_timer, sync_xen_wallclock, 0, 0); +@@ -418,6 +416,7 @@ static int set_rtc_mmss(unsigned long no - /* Return slot to the not-yet-mapped state, so that it may be - * mapped again, or removed by a subsequent ioctl. -@@ -781,8 +778,7 @@ static long gntdev_ioctl(struct file *fl - up_write(&private_data->grants_sem); + return retval; + } ++#endif /* CONFIG_XEN_PRIVILEGED_GUEST */ - if (rc) { -- printk (KERN_ERR "Initialising gntdev private data " -- "failed.\n"); -+ pr_err("Initialising gntdev private data failed\n"); - return rc; - } - } -@@ -824,22 +820,22 @@ private_data_initialised: - if (op.count == 1) { - if ((rc = add_grant_reference(private_data, op.refs, - &op.index)) < 0) { -- printk(KERN_ERR "Adding grant reference " -- "failed (%d).\n", rc); -+ pr_err("Adding grant reference failed (%d)\n", -+ rc); - goto map_out; - } - } else { - if ((rc = find_contiguous_free_range(private_data, - op.count)) < 0) { -- printk(KERN_ERR "Finding contiguous range " -- "failed (%d).\n", rc); -+ pr_err("Finding contiguous range failed" -+ " (%d)\n", rc); - goto map_out; - } - op.index = rc << PAGE_SHIFT; - if ((rc = add_grant_references(private_data, op.count, - refs, rc))) { -- printk(KERN_ERR "Adding grant references " -- "failed (%d).\n", rc); -+ pr_err("Adding grant references failed (%d)\n", -+ rc); - goto map_out; - } - compress_free_list(private_data); -@@ -892,8 +888,7 @@ private_data_initialised: - rc = -ENXIO; - break; - } -- printk(KERN_ERR "%s[%d] tried to remove a grant" -- " which is %s at %#x+%#x\n", -+ pr_err("%s[%d] tried to remove a grant which is %s at %#x+%#x\n", - current->comm, current->pid, - what, start_index, i); - goto unmap_out; -@@ -936,7 +931,7 @@ private_data_initialised: - goto get_offset_out; - } - if (vma->vm_start != vaddr) { -- printk(KERN_ERR "The vaddr specified in an " -+ pr_err("The vaddr specified in an " - "IOCTL_GNTDEV_GET_OFFSET_FOR_VADDR must be at " - "the start of the VM area. vma->vm_start = " - "%#lx; vaddr = %#lx\n", ---- head.orig/drivers/xen/netback/common.h 2012-06-06 13:53:20.000000000 +0200 -+++ head/drivers/xen/netback/common.h 2013-01-30 11:15:01.000000000 +0100 -@@ -45,10 +45,7 @@ - #define DPRINTK(_f, _a...) \ - pr_debug("(file=%s, line=%d) " _f, \ - __FILE__ , __LINE__ , ## _a ) --#define IPRINTK(fmt, args...) \ -- printk(KERN_INFO "xen_net: " fmt, ##args) --#define WPRINTK(fmt, args...) \ -- printk(KERN_WARNING "xen_net: " fmt, ##args) -+#define WPRINTK(fmt, args...) pr_warning("netbk: " fmt, ##args) + static unsigned long long local_clock(void) + { +@@ -547,6 +546,13 @@ irqreturn_t timer_interrupt(int irq, voi + struct shadow_time_info *shadow = &per_cpu(shadow_time, cpu); + struct vcpu_runstate_info runstate; - typedef struct netif_st { - /* Unique identifier for this interface. */ ---- head.orig/drivers/xen/netback/interface.c 2013-02-20 11:28:27.000000000 +0100 -+++ head/drivers/xen/netback/interface.c 2013-02-20 11:28:48.000000000 +0100 -@@ -180,9 +180,13 @@ static const struct netif_stat { - { "rx_gso_csum_fixups", offsetof(netif_t, rx_gso_csum_fixups) / sizeof(long) }, - }; ++ /* Keep nmi watchdog up to date */ ++#ifdef __i386__ ++ per_cpu(irq_stat, smp_processor_id()).irq0_irqs++; ++#else ++ add_pda(irq0_irqs, 1); ++#endif ++ + /* + * Here we are in the timer irq handler. We just have irqs locally + * disabled but we don't know if the timer_bh is running on the other +@@ -775,8 +781,12 @@ unsigned long read_persistent_clock(void --static int netbk_get_stats_count(struct net_device *dev) -+static int netbk_get_sset_count(struct net_device *dev, int sset) + int update_persistent_clock(struct timespec now) { -- return ARRAY_SIZE(netbk_stats); -+ switch (sset) { -+ case ETH_SS_STATS: -+ return ARRAY_SIZE(netbk_stats); -+ } -+ return -EOPNOTSUPP; ++#ifdef CONFIG_XEN_PRIVILEGED_GUEST + mod_timer(&sync_xen_wallclock_timer, jiffies + 1); + return set_rtc_mmss(now.tv_sec); ++#else ++ return 0; ++#endif } - static void netbk_get_ethtool_stats(struct net_device *dev, -@@ -220,7 +224,7 @@ static struct ethtool_ops network_ethtoo - .set_tso = netbk_set_tso, - .get_link = ethtool_op_get_link, + extern void (*late_time_init)(void); +@@ -1023,7 +1033,7 @@ static int time_cpufreq_notifier(struct + struct cpufreq_freqs *freq = data; + struct xen_platform_op op; -- .get_stats_count = netbk_get_stats_count, -+ .get_sset_count = netbk_get_sset_count, - .get_ethtool_stats = netbk_get_ethtool_stats, - .get_strings = netbk_get_strings, +- if (cpu_has(&cpu_data[freq->cpu], X86_FEATURE_CONSTANT_TSC)) ++ if (cpu_has(&cpu_data(freq->cpu), X86_FEATURE_CONSTANT_TSC)) + return 0; + + if (val == CPUFREQ_PRECHANGE) +@@ -1061,30 +1071,33 @@ core_initcall(cpufreq_time_setup); + */ + static ctl_table xen_subtable[] = { + { +- .ctl_name = 1, ++ .ctl_name = CTL_XEN_INDEPENDENT_WALLCLOCK, + .procname = "independent_wallclock", + .data = &independent_wallclock, + .maxlen = sizeof(independent_wallclock), + .mode = 0644, ++ .strategy = sysctl_data, + .proc_handler = proc_dointvec + }, + { +- .ctl_name = 2, ++ .ctl_name = CTL_XEN_PERMITTED_CLOCK_JITTER, + .procname = "permitted_clock_jitter", + .data = &permitted_clock_jitter, + .maxlen = sizeof(permitted_clock_jitter), + .mode = 0644, ++ .strategy = sysctl_data, + .proc_handler = proc_doulongvec_minmax + }, +- { 0 } ++ { } }; ---- head.orig/drivers/xen/netback/netback.c 2013-02-20 11:28:29.000000000 +0100 -+++ head/drivers/xen/netback/netback.c 2013-02-20 11:28:47.000000000 +0100 -@@ -364,8 +364,8 @@ static void xen_network_done_notify(void + static ctl_table xen_table[] = { + { +- .ctl_name = 123, ++ .ctl_name = CTL_XEN, + .procname = "xen", + .mode = 0555, +- .child = xen_subtable}, +- { 0 } ++ .child = xen_subtable ++ }, ++ { } + }; + static int __init xen_sysctl_init(void) { - static struct net_device *eth0_dev = NULL; - if (unlikely(eth0_dev == NULL)) -- eth0_dev = __dev_get_by_name("eth0"); -- netif_rx_schedule(eth0_dev); -+ eth0_dev = __dev_get_by_name(&init_net, "eth0"); -+ netif_rx_schedule(eth0_dev, ???); - } - /* - * Add following to poll() function in NAPI driver (Tigon3 is example): -@@ -1643,28 +1643,30 @@ static irqreturn_t netif_be_dbg(int irq, - netif_t *netif; - int i = 0; - -- printk(KERN_ALERT "netif_schedule_list:\n"); -+ pr_alert("netif_schedule_list:\n"); - spin_lock_irq(&net_schedule_list_lock); - - list_for_each (ent, &net_schedule_list) { - netif = list_entry(ent, netif_t, list); -- printk(KERN_ALERT " %d: private(rx_req_cons=%08x " -- "rx_resp_prod=%08x\n", -- i, netif->rx.req_cons, netif->rx.rsp_prod_pvt); -- printk(KERN_ALERT " tx_req_cons=%08x tx_resp_prod=%08x)\n", -- netif->tx.req_cons, netif->tx.rsp_prod_pvt); -- printk(KERN_ALERT " shared(rx_req_prod=%08x " -- "rx_resp_prod=%08x\n", -- netif->rx.sring->req_prod, netif->rx.sring->rsp_prod); -- printk(KERN_ALERT " rx_event=%08x tx_req_prod=%08x\n", -- netif->rx.sring->rsp_event, netif->tx.sring->req_prod); -- printk(KERN_ALERT " tx_resp_prod=%08x, tx_event=%08x)\n", -- netif->tx.sring->rsp_prod, netif->tx.sring->rsp_event); -+ pr_alert(" %d: private(rx_req_cons=%08x " -+ "rx_resp_prod=%08x\n", -+ i, netif->rx.req_cons, netif->rx.rsp_prod_pvt); -+ pr_alert(" tx_req_cons=%08x tx_resp_prod=%08x)\n", -+ netif->tx.req_cons, netif->tx.rsp_prod_pvt); -+ pr_alert(" shared(rx_req_prod=%08x " -+ "rx_resp_prod=%08x\n", -+ netif->rx.sring->req_prod, netif->rx.sring->rsp_prod); -+ pr_alert(" rx_event=%08x tx_req_prod=%08x\n", -+ netif->rx.sring->rsp_event, -+ netif->tx.sring->req_prod); -+ pr_alert(" tx_resp_prod=%08x, tx_event=%08x)\n", -+ netif->tx.sring->rsp_prod, -+ netif->tx.sring->rsp_event); - i++; - } +--- a/arch/x86/kernel/traps_32-xen.c ++++ b/arch/x86/kernel/traps_32-xen.c +@@ -1,6 +1,4 @@ + /* +- * linux/arch/i386/traps.c +- * + * Copyright (C) 1991, 1992 Linus Torvalds + * + * Pentium III FXSR, SSE support +@@ -65,6 +63,11 @@ - spin_unlock_irq(&net_schedule_list_lock); -- printk(KERN_ALERT " ** End of netif_schedule_list **\n"); -+ pr_alert(" ** End of netif_schedule_list **\n"); + int panic_on_unrecovered_nmi; - return IRQ_HANDLED; - } -@@ -1694,7 +1696,7 @@ static int __init netback_init(void) ++#ifndef CONFIG_XEN ++DECLARE_BITMAP(used_vectors, NR_VECTORS); ++EXPORT_SYMBOL_GPL(used_vectors); ++#endif ++ + asmlinkage int system_call(void); - mmap_pages = alloc_empty_pages_and_pagevec(MAX_PENDING_REQS); - if (mmap_pages == NULL) { -- printk("%s: out of memory\n", __FUNCTION__); -+ pr_err("%s: out of memory\n", __FUNCTION__); - return -ENOMEM; - } + /* Do we ignore FPU interrupts ? */ +@@ -120,7 +123,7 @@ struct stack_frame { ---- head.orig/drivers/xen/netback/xenbus.c 2012-01-03 11:55:56.000000000 +0100 -+++ head/drivers/xen/netback/xenbus.c 2012-01-06 10:44:04.000000000 +0100 -@@ -167,11 +167,9 @@ fail: - * and vif variables to the environment, for the benefit of the vif-* hotplug - * scripts. - */ --static int netback_uevent(struct xenbus_device *xdev, char **envp, -- int num_envp, char *buffer, int buffer_size) -+static int netback_uevent(struct xenbus_device *xdev, struct kobj_uevent_env *env) + static inline unsigned long print_context_stack(struct thread_info *tinfo, + unsigned long *stack, unsigned long ebp, +- struct stacktrace_ops *ops, void *data) ++ const struct stacktrace_ops *ops, void *data) { - struct backend_info *be; -- int i = 0, length = 0; - char *val; - - DPRINTK("netback_uevent"); -@@ -182,21 +180,16 @@ static int netback_uevent(struct xenbus_ - xenbus_dev_fatal(xdev, err, "reading script"); - return err; - } -- else { -- add_uevent_var(envp, num_envp, &i, buffer, buffer_size, -- &length, "script=%s", val); -- kfree(val); -- } -+ -+ add_uevent_var(env, "script=%s", val); -+ kfree(val); + #ifdef CONFIG_FRAME_POINTER + struct stack_frame *frame = (struct stack_frame *)ebp; +@@ -157,7 +160,7 @@ static inline unsigned long print_contex - down_read(&teardown_sem); - be = xdev->dev.driver_data; - if (be && be->netif) -- add_uevent_var(envp, num_envp, &i, buffer, buffer_size, -- &length, "vif=%s", be->netif->dev->name); -+ add_uevent_var(env, "vif=%s", be->netif->dev->name); - up_read(&teardown_sem); + void dump_trace(struct task_struct *task, struct pt_regs *regs, + unsigned long *stack, +- struct stacktrace_ops *ops, void *data) ++ const struct stacktrace_ops *ops, void *data) + { + unsigned long ebp = 0; -- envp[i] = NULL; -- - return 0; +@@ -229,7 +232,7 @@ static void print_trace_address(void *da + touch_nmi_watchdog(); } -@@ -244,8 +237,8 @@ static void frontend_changed(struct xenb - switch (frontend_state) { - case XenbusStateInitialising: - if (dev->state == XenbusStateClosed) { -- printk(KERN_INFO "%s: %s: prepare for reconnect\n", -- __FUNCTION__, dev->nodename); -+ pr_info("%s: %s: prepare for reconnect\n", -+ __FUNCTION__, dev->nodename); - xenbus_switch_state(dev, XenbusStateInitWait); - } - break; ---- head.orig/drivers/xen/netfront/accel.c 2011-01-31 17:32:29.000000000 +0100 -+++ head/drivers/xen/netfront/accel.c 2013-01-30 11:13:29.000000000 +0100 -@@ -40,10 +40,6 @@ - #define DPRINTK(fmt, args...) \ - pr_debug("netfront/accel (%s:%d) " fmt, \ - __FUNCTION__, __LINE__, ##args) --#define IPRINTK(fmt, args...) \ -- printk(KERN_INFO "netfront/accel: " fmt, ##args) --#define WPRINTK(fmt, args...) \ -- printk(KERN_WARNING "netfront/accel: " fmt, ##args) +-static struct stacktrace_ops print_trace_ops = { ++static const struct stacktrace_ops print_trace_ops = { + .warning = print_trace_warning, + .warning_symbol = print_trace_warning_symbol, + .stack = print_trace_stack, +@@ -288,6 +291,11 @@ void dump_stack(void) + { + unsigned long stack; - static int netfront_remove_accelerator(struct netfront_info *np, - struct xenbus_device *dev); -@@ -325,7 +321,7 @@ accelerator_set_vif_state_hooks(struct n - DPRINTK("%p\n",vif_state); ++ printk("Pid: %d, comm: %.20s %s %s %.*s\n", ++ current->pid, current->comm, print_tainted(), ++ init_utsname()->release, ++ (int)strcspn(init_utsname()->version, " "), ++ init_utsname()->version); + show_trace(current, NULL, &stack); + } - /* Make sure there are no data path operations going on */ -- netif_poll_disable(vif_state->np->netdev); -+ napi_disable(&vif_state->np->napi); - netif_tx_lock_bh(vif_state->np->netdev); - - accelerator = vif_state->np->accelerator; -@@ -334,7 +330,7 @@ accelerator_set_vif_state_hooks(struct n - spin_unlock_irqrestore(&accelerator->vif_states_lock, flags); - - netif_tx_unlock_bh(vif_state->np->netdev); -- netif_poll_enable(vif_state->np->netdev); -+ napi_enable(&vif_state->np->napi); - } - - -@@ -508,7 +504,7 @@ accelerator_remove_single_hook(struct ne - unsigned long flags; - - /* Make sure there are no data path operations going on */ -- netif_poll_disable(vif_state->np->netdev); -+ napi_disable(&vif_state->np->napi); - netif_tx_lock_bh(vif_state->np->netdev); +@@ -296,48 +304,24 @@ EXPORT_SYMBOL(dump_stack); + void show_registers(struct pt_regs *regs) + { + int i; +- int in_kernel = 1; +- unsigned long esp; +- unsigned short ss, gs; +- +- esp = (unsigned long) (®s->esp); +- savesegment(ss, ss); +- savesegment(gs, gs); +- if (user_mode_vm(regs)) { +- in_kernel = 0; +- esp = regs->esp; +- ss = regs->xss & 0xffff; +- } ++ + print_modules(); +- printk(KERN_EMERG "CPU: %d\n" +- KERN_EMERG "EIP: %04x:[<%08lx>] %s VLI\n" +- KERN_EMERG "EFLAGS: %08lx (%s %.*s)\n", +- smp_processor_id(), 0xffff & regs->xcs, regs->eip, +- print_tainted(), regs->eflags, init_utsname()->release, +- (int)strcspn(init_utsname()->version, " "), +- init_utsname()->version); +- print_symbol(KERN_EMERG "EIP is at %s\n", regs->eip); +- printk(KERN_EMERG "eax: %08lx ebx: %08lx ecx: %08lx edx: %08lx\n", +- regs->eax, regs->ebx, regs->ecx, regs->edx); +- printk(KERN_EMERG "esi: %08lx edi: %08lx ebp: %08lx esp: %08lx\n", +- regs->esi, regs->edi, regs->ebp, esp); +- printk(KERN_EMERG "ds: %04x es: %04x fs: %04x gs: %04x ss: %04x\n", +- regs->xds & 0xffff, regs->xes & 0xffff, regs->xfs & 0xffff, gs, ss); ++ __show_registers(regs, 0); + printk(KERN_EMERG "Process %.*s (pid: %d, ti=%p task=%p task.ti=%p)", +- TASK_COMM_LEN, current->comm, current->pid, ++ TASK_COMM_LEN, current->comm, task_pid_nr(current), + current_thread_info(), current, task_thread_info(current)); + /* + * When in-kernel, we also print out the stack and code at the + * time of the fault.. + */ +- if (in_kernel) { ++ if (!user_mode_vm(regs)) { + u8 *eip; + unsigned int code_prologue = code_bytes * 43 / 64; + unsigned int code_len = code_bytes; + unsigned char c; - spin_lock_irqsave(&accelerator->vif_states_lock, flags); -@@ -524,7 +520,7 @@ accelerator_remove_single_hook(struct ne - spin_unlock_irqrestore(&accelerator->vif_states_lock, flags); + printk("\n" KERN_EMERG "Stack: "); +- show_stack_log_lvl(NULL, regs, (unsigned long *)esp, KERN_EMERG); ++ show_stack_log_lvl(NULL, regs, ®s->esp, KERN_EMERG); - netif_tx_unlock_bh(vif_state->np->netdev); -- netif_poll_enable(vif_state->np->netdev); -+ napi_enable(&vif_state->np->napi); - } + printk(KERN_EMERG "Code: "); +@@ -382,11 +366,11 @@ int is_valid_bugaddr(unsigned long eip) + void die(const char * str, struct pt_regs * regs, long err) + { + static struct { +- spinlock_t lock; ++ raw_spinlock_t lock; + u32 lock_owner; + int lock_owner_depth; + } die = { +- .lock = __SPIN_LOCK_UNLOCKED(die.lock), ++ .lock = __RAW_SPIN_LOCK_UNLOCKED, + .lock_owner = -1, + .lock_owner_depth = 0 + }; +@@ -397,40 +381,33 @@ void die(const char * str, struct pt_reg ---- head.orig/drivers/xen/netfront/netfront.c 2012-12-18 11:57:55.000000000 +0100 -+++ head/drivers/xen/netfront/netfront.c 2013-01-30 11:13:00.000000000 +0100 -@@ -206,10 +206,7 @@ static inline grant_ref_t xennet_get_rx_ - #define DPRINTK(fmt, args...) \ - pr_debug("netfront (%s:%d) " fmt, \ - __FUNCTION__, __LINE__, ##args) --#define IPRINTK(fmt, args...) \ -- printk(KERN_INFO "netfront: " fmt, ##args) --#define WPRINTK(fmt, args...) \ -- printk(KERN_WARNING "netfront: " fmt, ##args) -+#define WPRINTK(fmt, args...) pr_warning("netfront: " fmt, ##args) + if (die.lock_owner != raw_smp_processor_id()) { + console_verbose(); +- spin_lock_irqsave(&die.lock, flags); ++ raw_local_irq_save(flags); ++ __raw_spin_lock(&die.lock); + die.lock_owner = smp_processor_id(); + die.lock_owner_depth = 0; + bust_spinlocks(1); +- } +- else +- local_save_flags(flags); ++ } else ++ raw_local_irq_save(flags); - static int setup_device(struct xenbus_device *, struct netfront_info *); - static struct net_device *create_netdev(struct xenbus_device *); -@@ -262,16 +259,16 @@ static int __devinit netfront_probe(stru + if (++die.lock_owner_depth < 3) { +- int nl = 0; + unsigned long esp; + unsigned short ss; - err = register_netdev(info->netdev); - if (err) { -- printk(KERN_WARNING "%s: register_netdev err=%d\n", -- __FUNCTION__, err); -+ pr_warning("%s: register_netdev err=%d\n", -+ __FUNCTION__, err); - goto fail; - } + report_bug(regs->eip, regs); - err = xennet_sysfs_addif(info->netdev); - if (err) { - unregister_netdev(info->netdev); -- printk(KERN_WARNING "%s: add sysfs failed err=%d\n", -- __FUNCTION__, err); -+ pr_warning("%s: add sysfs failed err=%d\n", -+ __FUNCTION__, err); - goto fail; - } +- printk(KERN_EMERG "%s: %04lx [#%d]\n", str, err & 0xffff, ++die_counter); ++ printk(KERN_EMERG "%s: %04lx [#%d] ", str, err & 0xffff, ++ ++die_counter); + #ifdef CONFIG_PREEMPT +- printk(KERN_EMERG "PREEMPT "); +- nl = 1; ++ printk("PREEMPT "); + #endif + #ifdef CONFIG_SMP +- if (!nl) +- printk(KERN_EMERG); + printk("SMP "); +- nl = 1; + #endif + #ifdef CONFIG_DEBUG_PAGEALLOC +- if (!nl) +- printk(KERN_EMERG); + printk("DEBUG_PAGEALLOC"); +- nl = 1; + #endif +- if (nl) +- printk("\n"); ++ printk("\n"); ++ + if (notify_die(DIE_OOPS, str, regs, err, + current->thread.trap_no, SIGSEGV) != + NOTIFY_STOP) { +@@ -454,7 +431,8 @@ void die(const char * str, struct pt_reg + bust_spinlocks(0); + die.lock_owner = -1; + add_taint(TAINT_DIE); +- spin_unlock_irqrestore(&die.lock, flags); ++ __raw_spin_unlock(&die.lock); ++ raw_local_irq_restore(flags); -@@ -627,11 +624,12 @@ int netfront_check_queue_ready(struct ne - } - EXPORT_SYMBOL(netfront_check_queue_ready); + if (!regs) + return; +@@ -571,6 +549,7 @@ fastcall void do_##name(struct pt_regs * + info.si_errno = 0; \ + info.si_code = sicode; \ + info.si_addr = (void __user *)siaddr; \ ++ trace_hardirqs_fixup(); \ + if (notify_die(DIE_TRAP, str, regs, error_code, trapnr, signr) \ + == NOTIFY_STOP) \ + return; \ +@@ -606,7 +585,7 @@ fastcall void __kprobes do_general_prote + printk_ratelimit()) + printk(KERN_INFO + "%s[%d] general protection eip:%lx esp:%lx error:%lx\n", +- current->comm, current->pid, ++ current->comm, task_pid_nr(current), + regs->eip, regs->esp, error_code); -- - static int network_open(struct net_device *dev) + force_sig(SIGSEGV, current); +@@ -785,6 +764,8 @@ void restart_nmi(void) + #ifdef CONFIG_KPROBES + fastcall void __kprobes do_int3(struct pt_regs *regs, long error_code) { - struct netfront_info *np = netdev_priv(dev); ++ trace_hardirqs_fixup(); ++ + if (notify_die(DIE_INT3, "int3", regs, error_code, 3, SIGTRAP) + == NOTIFY_STOP) + return; +@@ -822,6 +803,8 @@ fastcall void __kprobes do_debug(struct + unsigned int condition; + struct task_struct *tsk = current; -+ napi_enable(&np->napi); ++ trace_hardirqs_fixup(); + - spin_lock_bh(&np->rx_lock); - if (netfront_carrier_ok(np)) { - network_alloc_rx_buffers(dev); -@@ -639,7 +637,7 @@ static int network_open(struct net_devic - if (RING_HAS_UNCONSUMED_RESPONSES(&np->rx)){ - netfront_accelerator_call_stop_napi_irq(np, dev); + get_debugreg(condition, 6); -- netif_rx_schedule(dev); -+ netif_rx_schedule(dev, &np->napi); - } - } - spin_unlock_bh(&np->rx_lock); -@@ -673,9 +671,8 @@ static void network_tx_buf_gc(struct net - skb = np->tx_skbs[id]; - if (unlikely(gnttab_query_foreign_access( - np->grant_tx_ref[id]) != 0)) { -- printk(KERN_ALERT "network_tx_buf_gc: warning " -- "-- grant still in use by backend " -- "domain.\n"); -+ pr_alert("network_tx_buf_gc: grant still" -+ " in use by backend domain\n"); - BUG(); - } - gnttab_end_foreign_access_ref(np->grant_tx_ref[id]); -@@ -711,7 +708,7 @@ static void rx_refill_timeout(unsigned l + if (notify_die(DIE_DEBUG, "debug", regs, condition, error_code, +@@ -1084,20 +1067,6 @@ asmlinkage void math_emulate(long arg) - netfront_accelerator_call_stop_napi_irq(np, dev); + #endif /* CONFIG_MATH_EMULATION */ -- netif_rx_schedule(dev); -+ netif_rx_schedule(dev, &np->napi); - } +-#ifdef CONFIG_X86_F00F_BUG +-void __init trap_init_f00f_bug(void) +-{ +- __set_fixmap(FIX_F00F_IDT, __pa(&idt_table), PAGE_KERNEL_RO); +- +- /* +- * Update the IDT descriptor and reload the IDT so that +- * it uses the read-only mapped virtual address. +- */ +- idt_descr.address = fix_to_virt(FIX_F00F_IDT); +- load_idt(&idt_descr); +-} +-#endif +- - static void network_alloc_rx_buffers(struct net_device *dev) -@@ -962,8 +959,7 @@ static int network_start_xmit(struct sk_ + /* + * NB. All these are "trap gates" (i.e. events_mask isn't set) except +--- a/arch/x86/kernel/traps_64-xen.c ++++ b/arch/x86/kernel/traps_64-xen.c +@@ -1,6 +1,4 @@ + /* +- * linux/arch/x86-64/traps.c +- * + * Copyright (C) 1991, 1992 Linus Torvalds + * Copyright (C) 2000, 2001, 2002 Andi Kleen, SuSE Labs + * +@@ -33,6 +31,7 @@ + #include + #include + #include ++#include - frags += PFN_UP(offset + len); - if (unlikely(frags > MAX_SKB_FRAGS + 1)) { -- printk(KERN_ALERT "xennet: skb rides the rocket: %d frags\n", -- frags); -+ pr_alert("xennet: skb rides the rocket: %d frags\n", frags); - dump_stack(); - goto drop; - } -@@ -1066,7 +1062,7 @@ static irqreturn_t netif_int(int irq, vo - if (RING_HAS_UNCONSUMED_RESPONSES(&np->rx)) { - netfront_accelerator_call_stop_napi_irq(np, dev); + #if defined(CONFIG_EDAC) + #include +@@ -205,7 +204,7 @@ static unsigned long *in_exception_stack + #define MSG(txt) ops->warning(data, txt) -- netif_rx_schedule(dev); -+ netif_rx_schedule(dev, &np->napi); - dev->last_rx = jiffies; - } - } -@@ -1319,15 +1315,16 @@ static int xennet_set_skb_gso(struct sk_ - #endif - } + /* +- * x86-64 can have upto three kernel stacks: ++ * x86-64 can have up to three kernel stacks: + * process stack + * interrupt stack + * severe exception (double fault, nmi, stack fault, debug, mce) hardware stack +@@ -219,7 +218,7 @@ static inline int valid_stack_ptr(struct --static int netif_poll(struct net_device *dev, int *pbudget) -+static int netif_poll(struct napi_struct *napi, int budget) + void dump_trace(struct task_struct *tsk, struct pt_regs *regs, + unsigned long *stack, +- struct stacktrace_ops *ops, void *data) ++ const struct stacktrace_ops *ops, void *data) { -- struct netfront_info *np = netdev_priv(dev); -+ struct netfront_info *np = container_of(napi, struct netfront_info, napi); -+ struct net_device *dev = np->netdev; - struct sk_buff *skb; - struct netfront_rx_info rinfo; - struct netif_rx_response *rx = &rinfo.rx; - struct netif_extra_info *extras = rinfo.extras; - RING_IDX i, rp; -- int work_done, budget, more_to_do = 1, accel_more_to_do = 1; -+ int work_done, more_to_do = 1, accel_more_to_do = 1; - struct sk_buff_head rxq; - struct sk_buff_head errq; - struct sk_buff_head tmpq; -@@ -1347,8 +1344,6 @@ static int netif_poll(struct net_device - skb_queue_head_init(&errq); - skb_queue_head_init(&tmpq); - -- if ((budget = *pbudget) > dev->quota) -- budget = dev->quota; - rp = np->rx.sring->rsp_prod; - rmb(); /* Ensure we see queued responses up to 'rp'. */ + const unsigned cpu = get_cpu(); + unsigned long *irqstack_end = (unsigned long*)cpu_pda(cpu)->irqstackptr; +@@ -340,7 +339,7 @@ static void print_trace_address(void *da + printk_address(addr); + } -@@ -1507,9 +1502,6 @@ err: - accel_more_to_do = 0; - } +-static struct stacktrace_ops print_trace_ops = { ++static const struct stacktrace_ops print_trace_ops = { + .warning = print_trace_warning, + .warning_symbol = print_trace_warning_symbol, + .stack = print_trace_stack, +@@ -404,6 +403,12 @@ void show_stack(struct task_struct *tsk, + void dump_stack(void) + { + unsigned long dummy; ++ ++ printk("Pid: %d, comm: %.20s %s %s %.*s\n", ++ current->pid, current->comm, print_tainted(), ++ init_utsname()->release, ++ (int)strcspn(init_utsname()->version, " "), ++ init_utsname()->version); + show_trace(NULL, NULL, &dummy); + } -- *pbudget -= work_done; -- dev->quota -= work_done; -- - if (work_done < budget) { - local_irq_save(flags); +@@ -466,7 +471,7 @@ void out_of_line_bug(void) + EXPORT_SYMBOL(out_of_line_bug); + #endif -@@ -1526,14 +1518,14 @@ err: - } +-static DEFINE_SPINLOCK(die_lock); ++static raw_spinlock_t die_lock = __RAW_SPIN_LOCK_UNLOCKED; + static int die_owner = -1; + static unsigned int die_nest_count; - if (!more_to_do && !accel_more_to_do) -- __netif_rx_complete(dev); -+ __netif_rx_complete(dev, napi); +@@ -478,13 +483,13 @@ unsigned __kprobes long oops_begin(void) + oops_enter(); - local_irq_restore(flags); + /* racy, but better than risking deadlock. */ +- local_irq_save(flags); ++ raw_local_irq_save(flags); + cpu = smp_processor_id(); +- if (!spin_trylock(&die_lock)) { ++ if (!__raw_spin_trylock(&die_lock)) { + if (cpu == die_owner) + /* nested oops. should stop eventually */; + else +- spin_lock(&die_lock); ++ __raw_spin_lock(&die_lock); } + die_nest_count++; + die_owner = cpu; +@@ -498,12 +503,10 @@ void __kprobes oops_end(unsigned long fl + die_owner = -1; + bust_spinlocks(0); + die_nest_count--; +- if (die_nest_count) +- /* We still own the lock */ +- local_irq_restore(flags); +- else ++ if (!die_nest_count) + /* Nest count reaches zero, release the lock. */ +- spin_unlock_irqrestore(&die_lock, flags); ++ __raw_spin_unlock(&die_lock); ++ raw_local_irq_restore(flags); + if (panic_on_oops) + panic("Fatal exception"); + oops_exit(); +@@ -636,6 +639,7 @@ asmlinkage void do_##name(struct pt_regs + info.si_errno = 0; \ + info.si_code = sicode; \ + info.si_addr = (void __user *)siaddr; \ ++ trace_hardirqs_fixup(); \ + if (notify_die(DIE_TRAP, str, regs, error_code, trapnr, signr) \ + == NOTIFY_STOP) \ + return; \ +@@ -741,11 +745,8 @@ mem_parity_error(unsigned char reason, s - spin_unlock(&np->rx_lock); - -- return more_to_do | accel_more_to_do; -+ return work_done; - } + printk(KERN_EMERG "Dazed and confused, but trying to continue\n"); - static void netif_release_tx_bufs(struct netfront_info *np) -@@ -1676,6 +1668,7 @@ static int network_close(struct net_devi - { - struct netfront_info *np = netdev_priv(dev); - netif_stop_queue(np->netdev); -+ napi_disable(&np->napi); - return 0; +-#if 0 /* XEN */ + /* Clear and disable the memory parity error line. */ +- reason = (reason & 0xf) | 4; +- outb(reason, 0x61); +-#endif /* XEN */ ++ clear_mem_error(reason); } -@@ -1777,9 +1770,13 @@ static const struct xennet_stat { - }, - }; + static __kprobes void +@@ -754,14 +755,8 @@ io_check_error(unsigned char reason, str + printk("NMI: IOCK error (debug interrupt?)\n"); + show_registers(regs); --static int xennet_get_stats_count(struct net_device *dev) -+static int xennet_get_sset_count(struct net_device *dev, int sset) - { -- return ARRAY_SIZE(xennet_stats); -+ switch (sset) { -+ case ETH_SS_STATS: -+ return ARRAY_SIZE(xennet_stats); -+ } -+ return -EOPNOTSUPP; +-#if 0 /* XEN */ + /* Re-enable the IOCK line, wait for a few seconds */ +- reason = (reason & 0xf) | 8; +- outb(reason, 0x61); +- mdelay(2000); +- reason &= ~8; +- outb(reason, 0x61); +-#endif /* XEN */ ++ clear_io_check_error(reason); } - static void xennet_get_ethtool_stats(struct net_device *dev, -@@ -1931,7 +1928,7 @@ static struct ethtool_ops network_ethtoo - #endif - .get_link = ethtool_op_get_link, + static __kprobes void +@@ -821,6 +816,8 @@ asmlinkage __kprobes void default_do_nmi + /* runs on IST stack. */ + asmlinkage void __kprobes do_int3(struct pt_regs * regs, long error_code) + { ++ trace_hardirqs_fixup(); ++ + if (notify_die(DIE_INT3, "int3", regs, error_code, 3, SIGTRAP) == NOTIFY_STOP) { + return; + } +@@ -858,6 +855,8 @@ asmlinkage void __kprobes do_debug(struc + struct task_struct *tsk = current; + siginfo_t info; -- .get_stats_count = xennet_get_stats_count, -+ .get_sset_count = xennet_get_sset_count, - .get_ethtool_stats = xennet_get_ethtool_stats, - .get_strings = xennet_get_strings, - }; -@@ -2081,8 +2078,7 @@ static struct net_device * __devinit cre ++ trace_hardirqs_fixup(); ++ + get_debugreg(condition, 6); - netdev = alloc_etherdev(sizeof(struct netfront_info)); - if (!netdev) { -- printk(KERN_WARNING "%s> alloc_etherdev failed.\n", -- __FUNCTION__); -+ pr_warning("%s: alloc_etherdev failed\n", __FUNCTION__); - return ERR_PTR(-ENOMEM); - } + if (notify_die(DIE_DEBUG, "debug", regs, condition, error_code, +--- a/arch/x86/kernel/vsyscall_64-xen.c ++++ b/arch/x86/kernel/vsyscall_64-xen.c +@@ -1,6 +1,4 @@ + /* +- * linux/arch/x86_64/kernel/vsyscall.c +- * + * Copyright (C) 2001 Andrea Arcangeli SuSE + * Copyright 2003 Andi Kleen, SuSE Labs. + * +@@ -50,12 +48,12 @@ + ({unsigned long v; \ + extern char __vsyscall_0; \ + asm("" : "=r" (v) : "0" (x)); \ +- ((v - VSYSCALL_FIRST_PAGE) + __pa_symbol(&__vsyscall_0)); }) ++ ((v - VSYSCALL_START) + __pa_symbol(&__vsyscall_0)); }) -@@ -2117,14 +2113,14 @@ static struct net_device * __devinit cre - /* A grant for every tx ring slot */ - if (gnttab_alloc_grant_references(TX_MAX_TARGET, - &np->gref_tx_head) < 0) { -- printk(KERN_ALERT "#### netfront can't alloc tx grant refs\n"); -+ pr_alert("#### netfront can't alloc tx grant refs\n"); - err = -ENOMEM; - goto exit; - } - /* A grant for every rx ring slot */ - if (gnttab_alloc_grant_references(RX_MAX_TARGET, - &np->gref_rx_head) < 0) { -- printk(KERN_ALERT "#### netfront can't alloc rx grant refs\n"); -+ pr_alert("#### netfront can't alloc rx grant refs\n"); - err = -ENOMEM; - goto exit_free_tx; - } -@@ -2133,16 +2129,14 @@ static struct net_device * __devinit cre - netdev->hard_start_xmit = network_start_xmit; - netdev->stop = network_close; - netdev->get_stats = network_get_stats; -- netdev->poll = netif_poll; -+ netif_napi_add(netdev, &np->napi, netif_poll, 64); - netdev->set_multicast_list = network_set_multicast_list; - netdev->uninit = netif_uninit; - netdev->set_mac_address = xennet_set_mac_address; - netdev->change_mtu = xennet_change_mtu; -- netdev->weight = 64; - netdev->features = NETIF_F_IP_CSUM; - - SET_ETHTOOL_OPS(netdev, &network_ethtool_ops); -- SET_MODULE_OWNER(netdev); - SET_NETDEV_DEV(netdev, &dev->dev); - - np->netdev = netdev; -@@ -2255,7 +2249,7 @@ static int __init netif_init(void) - - netif_init_accel(); - -- IPRINTK("Initialising virtual ethernet driver.\n"); -+ pr_info("Initialising virtual ethernet driver.\n"); - - #ifdef CONFIG_INET - (void)register_inetaddr_notifier(¬ifier_inetdev); ---- head.orig/drivers/xen/netfront/netfront.h 2012-06-06 13:49:51.000000000 +0200 -+++ head/drivers/xen/netfront/netfront.h 2012-06-06 13:55:57.000000000 +0200 -@@ -156,6 +156,8 @@ struct netfront_info { - spinlock_t tx_lock; - spinlock_t rx_lock; + /* + * vsyscall_gtod_data contains data that is : + * - readonly from vsyscalls +- * - writen by timer interrupt or systcl (/proc/sys/kernel/vsyscall64) ++ * - written by timer interrupt or systcl (/proc/sys/kernel/vsyscall64) + * Try to keep this structure as small as possible to avoid cache line ping pongs + */ + int __vgetcpu_mode __section_vgetcpu_mode; +@@ -66,6 +64,16 @@ struct vsyscall_gtod_data __vsyscall_gto + .sysctl_enabled = 1, + }; -+ struct napi_struct napi; ++void update_vsyscall_tz(void) ++{ ++ unsigned long flags; + - unsigned int irq; - unsigned int copying_receiver; - unsigned int carrier; ---- head.orig/drivers/xen/xen-pciback/slot.c 2009-03-18 10:39:32.000000000 +0100 -+++ head/drivers/xen/xen-pciback/slot.c 2011-01-31 17:56:27.000000000 +0100 -@@ -64,9 +64,9 @@ int pciback_add_pci_dev(struct pciback_d - for (bus = 0; bus < PCI_BUS_NBR; bus++) - for (slot = 0; slot < PCI_SLOT_MAX; slot++) { - if (slot_dev->slots[bus][slot] == NULL) { -- printk(KERN_INFO -- "pciback: slot: %s: assign to virtual slot %d, bus %d\n", -- pci_name(dev), slot, bus); -+ pr_info("pciback: slot: %s: assign to" -+ " virtual slot %d, bus %d\n", -+ pci_name(dev), slot, bus); - slot_dev->slots[bus][slot] = dev; - goto unlock; - } ---- head.orig/drivers/xen/pcifront/Makefile 2007-06-12 13:13:45.000000000 +0200 -+++ head/drivers/xen/pcifront/Makefile 2011-01-31 17:56:27.000000000 +0100 -@@ -2,6 +2,4 @@ obj-y += pcifront.o - - pcifront-y := pci_op.o xenbus.o pci.o ++ write_seqlock_irqsave(&vsyscall_gtod_data.lock, flags); ++ /* sys_tz has changed */ ++ vsyscall_gtod_data.sys_tz = sys_tz; ++ write_sequnlock_irqrestore(&vsyscall_gtod_data.lock, flags); ++} ++ + void update_vsyscall(struct timespec *wall_time, struct clocksource *clock) + { + unsigned long flags; +@@ -79,8 +87,6 @@ void update_vsyscall(struct timespec *wa + vsyscall_gtod_data.clock.shift = clock->shift; + vsyscall_gtod_data.wall_time_sec = wall_time->tv_sec; + vsyscall_gtod_data.wall_time_nsec = wall_time->tv_nsec; +- vsyscall_gtod_data.sys_tz = sys_tz; +- vsyscall_gtod_data.wall_time_nsec = wall_time->tv_nsec; + vsyscall_gtod_data.wall_to_monotonic = wall_to_monotonic; + write_sequnlock_irqrestore(&vsyscall_gtod_data.lock, flags); + } +@@ -166,7 +172,7 @@ time_t __vsyscall(1) vtime(time_t *t) + if (unlikely(!__vsyscall_gtod_data.sysctl_enabled)) + return time_syscall(t); --ifeq ($(CONFIG_XEN_PCIDEV_FE_DEBUG),y) --EXTRA_CFLAGS += -DDEBUG --endif -+ccflags-$(CONFIG_XEN_PCIDEV_FE_DEBUG) += -DDEBUG ---- head.orig/drivers/xen/scsiback/emulate.c 2012-01-09 11:04:26.000000000 +0100 -+++ head/drivers/xen/scsiback/emulate.c 2012-01-09 11:06:45.000000000 +0100 -@@ -114,9 +114,10 @@ static void resp_not_supported_cmd(pendi +- vgettimeofday(&tv, 0); ++ vgettimeofday(&tv, NULL); + result = tv.tv_sec; + if (t) + *t = result; +@@ -260,18 +266,10 @@ out: + return ret; } +-static int vsyscall_sysctl_nostrat(ctl_table *t, int __user *name, int nlen, +- void __user *oldval, size_t __user *oldlenp, +- void __user *newval, size_t newlen) +-{ +- return -ENOSYS; +-} +- + static ctl_table kernel_table2[] = { +- { .ctl_name = 99, .procname = "vsyscall64", ++ { .procname = "vsyscall64", + .data = &vsyscall_gtod_data.sysctl_enabled, .maxlen = sizeof(int), + .mode = 0644, +- .strategy = vsyscall_sysctl_nostrat, + .proc_handler = vsyscall_sysctl_change }, + {} + }; +@@ -291,9 +289,9 @@ static void __cpuinit vsyscall_set_cpu(i + unsigned long d; + unsigned long node = 0; + #ifdef CONFIG_NUMA +- node = cpu_to_node[cpu]; ++ node = cpu_to_node(cpu); + #endif +- if (cpu_has(&cpu_data[cpu], X86_FEATURE_RDTSCP)) ++ if (cpu_has(&cpu_data(cpu), X86_FEATURE_RDTSCP)) + write_rdtscp_aux((node << 12) | cpu); --static int __copy_to_sg(struct scatterlist *sg, unsigned int nr_sg, -+static int __copy_to_sg(struct scatterlist *sgl, unsigned int nr_sg, - void *buf, unsigned int buflen) - { -+ struct scatterlist *sg; - void *from = buf; - void *to; - unsigned int from_rest = buflen; -@@ -125,17 +126,17 @@ static int __copy_to_sg(struct scatterli - unsigned int i; - unsigned long pfn; + /* Store cpu number in limit so that it can be loaded quickly +--- a/arch/x86/mm/fault_32-xen.c ++++ b/arch/x86/mm/fault_32-xen.c +@@ -25,6 +25,7 @@ + #include + #include + #include ++#include -- for (i = 0; i < nr_sg; i++) { -- if (sg->page == NULL) { -- printk(KERN_WARNING "%s: inconsistent length field in " -- "scatterlist\n", __FUNCTION__); -+ for_each_sg (sgl, sg, nr_sg, i) { -+ if (sg_page(sg) == NULL) { -+ pr_warning("%s: inconsistent length field in " -+ "scatterlist\n", __FUNCTION__); - return -ENOMEM; - } + #include + #include +@@ -32,33 +33,27 @@ - to_capa = sg->length; - copy_size = min_t(unsigned int, to_capa, from_rest); + extern void die(const char *,struct pt_regs *,long); -- pfn = page_to_pfn(sg->page); -+ pfn = page_to_pfn(sg_page(sg)); - to = pfn_to_kaddr(pfn) + (sg->offset); - memcpy(to, from, copy_size); +-static ATOMIC_NOTIFIER_HEAD(notify_page_fault_chain); +- +-int register_page_fault_notifier(struct notifier_block *nb) ++#ifdef CONFIG_KPROBES ++static inline int notify_page_fault(struct pt_regs *regs) + { +- vmalloc_sync_all(); +- return atomic_notifier_chain_register(¬ify_page_fault_chain, nb); +-} +-EXPORT_SYMBOL_GPL(register_page_fault_notifier); ++ int ret = 0; -@@ -144,19 +145,18 @@ static int __copy_to_sg(struct scatterli - return 0; - } - -- sg++; - from += copy_size; - } +-int unregister_page_fault_notifier(struct notifier_block *nb) +-{ +- return atomic_notifier_chain_unregister(¬ify_page_fault_chain, nb); +-} +-EXPORT_SYMBOL_GPL(unregister_page_fault_notifier); ++ /* kprobe_running() needs smp_processor_id() */ ++ if (!user_mode_vm(regs)) { ++ preempt_disable(); ++ if (kprobe_running() && kprobe_fault_handler(regs, 14)) ++ ret = 1; ++ preempt_enable(); ++ } -- printk(KERN_WARNING "%s: no space in scatterlist\n", -- __FUNCTION__); -+ pr_warning("%s: no space in scatterlist\n", __FUNCTION__); - return -ENOMEM; +-static inline int notify_page_fault(struct pt_regs *regs, long err) ++ return ret; ++} ++#else ++static inline int notify_page_fault(struct pt_regs *regs) + { +- struct die_args args = { +- .regs = regs, +- .str = "page fault", +- .err = err, +- .trapnr = 14, +- .signr = SIGSEGV +- }; +- return atomic_notifier_call_chain(¬ify_page_fault_chain, +- DIE_PAGE_FAULT, &args); ++ return 0; } ++#endif --static int __maybe_unused __copy_from_sg(struct scatterlist *sg, -+static int __maybe_unused __copy_from_sg(struct scatterlist *sgl, - unsigned int nr_sg, void *buf, - unsigned int buflen) - { -+ struct scatterlist *sg; - void *from; - void *to = buf; - unsigned int from_rest; -@@ -165,29 +165,26 @@ static int __maybe_unused __copy_from_sg - unsigned int i; - unsigned long pfn; + /* + * Return EIP plus the CS segment base. The segment limit is also +@@ -110,7 +105,7 @@ static inline unsigned long get_segment_ + LDT and other horrors are only used in user space. */ + if (seg & (1<<2)) { + /* Must lock the LDT while reading it. */ +- down(¤t->mm->context.sem); ++ mutex_lock(¤t->mm->context.lock); + desc = current->mm->context.ldt; + desc = (void *)desc + (seg & ~7); + } else { +@@ -123,7 +118,7 @@ static inline unsigned long get_segment_ + base = get_desc_base((unsigned long *)desc); -- for (i = 0; i < nr_sg; i++) { -- if (sg->page == NULL) { -- printk(KERN_WARNING "%s: inconsistent length field in " -- "scatterlist\n", __FUNCTION__); -+ for_each_sg (sgl, sg, nr_sg, i) { -+ if (sg_page(sg) == NULL) { -+ pr_warning("%s: inconsistent length field in " -+ "scatterlist\n", __FUNCTION__); - return -ENOMEM; - } + if (seg & (1<<2)) { +- up(¤t->mm->context.sem); ++ mutex_unlock(¤t->mm->context.lock); + } else + put_cpu(); - from_rest = sg->length; - if ((from_rest > 0) && (to_capa < from_rest)) { -- printk(KERN_WARNING -- "%s: no space in destination buffer\n", -- __FUNCTION__); -+ pr_warning("%s: no space in destination buffer\n", -+ __FUNCTION__); - return -ENOMEM; - } - copy_size = from_rest; +@@ -244,7 +239,7 @@ static void dump_fault_path(unsigned lon + if (mfn_to_pfn(mfn) >= highstart_pfn) + return; + #endif +- if (p[0] & _PAGE_PRESENT) { ++ if ((p[0] & _PAGE_PRESENT) && !(p[0] & _PAGE_PSE)) { + page = mfn_to_pfn(mfn) << PAGE_SHIFT; + p = (unsigned long *) __va(page); + address &= 0x001fffff; +@@ -270,7 +265,8 @@ static void dump_fault_path(unsigned lon + * it's allocated already. + */ + if ((machine_to_phys(page) >> PAGE_SHIFT) < max_low_pfn +- && (page & _PAGE_PRESENT)) { ++ && (page & _PAGE_PRESENT) ++ && !(page & _PAGE_PSE)) { + page = machine_to_phys(page & PAGE_MASK); + page = ((unsigned long *) __va(page))[(address >> PAGE_SHIFT) + & (PTRS_PER_PTE - 1)]; +@@ -416,6 +412,11 @@ fastcall void __kprobes do_page_fault(st + int write, si_code; + int fault; -- pfn = page_to_pfn(sg->page); -+ pfn = page_to_pfn(sg_page(sg)); - from = pfn_to_kaddr(pfn) + (sg->offset); - memcpy(to, from, copy_size); ++ /* ++ * We can fault from pretty much anywhere, with unknown IRQ state. ++ */ ++ trace_hardirqs_fixup(); ++ + /* get the address */ + address = read_cr2(); - to_capa -= copy_size; -- -- sg++; - to += copy_size; +@@ -453,7 +454,7 @@ fastcall void __kprobes do_page_fault(st + /* Can take a spurious fault if mapping changes R/O -> R/W. */ + if (spurious_fault(regs, address, error_code)) + return; +- if (notify_page_fault(regs, error_code) == NOTIFY_STOP) ++ if (notify_page_fault(regs)) + return; + /* + * Don't take the mm semaphore here. If we fixup a prefetch +@@ -462,7 +463,7 @@ fastcall void __kprobes do_page_fault(st + goto bad_area_nosemaphore; } -@@ -248,7 +245,7 @@ static void __report_luns(pending_req_t - + VSCSI_REPORT_LUNS_HEADER; - retry: - if ((buff = kzalloc(alloc_len, GFP_KERNEL)) == NULL) { -- printk(KERN_ERR "scsiback:%s kmalloc err\n", __FUNCTION__); -+ pr_err("scsiback:%s kmalloc err\n", __FUNCTION__); - goto fail; - } +- if (notify_page_fault(regs, error_code) == NOTIFY_STOP) ++ if (notify_page_fault(regs)) + return; ---- head.orig/drivers/xen/scsiback/interface.c 2011-04-11 14:52:22.000000000 +0200 -+++ head/drivers/xen/scsiback/interface.c 2011-04-11 15:00:59.000000000 +0200 -@@ -68,7 +68,7 @@ int scsiback_init_sring(struct vscsibk_i - int err; + /* It's safe to allow irq's after cr2 has been saved and the vmalloc +@@ -481,7 +482,7 @@ fastcall void __kprobes do_page_fault(st - if (info->irq) { -- printk(KERN_ERR "scsiback: Already connected through?\n"); -+ pr_err("scsiback: Already connected through?\n"); - return -1; + /* When running in the kernel we expect faults to occur only to + * addresses in user space. All other faults represent errors in the +- * kernel and should generate an OOPS. Unfortunatly, in the case of an ++ * kernel and should generate an OOPS. Unfortunately, in the case of an + * erroneous fault occurring in a code path which already holds mmap_sem + * we will deadlock attempting to validate the fault against the + * address space. Luckily the kernel only validly references user +@@ -489,7 +490,7 @@ fastcall void __kprobes do_page_fault(st + * exceptions table. + * + * As the vast majority of faults will be valid we will only perform +- * the source reference check when there is a possibilty of a deadlock. ++ * the source reference check when there is a possibility of a deadlock. + * Attempt to lock the address space, if we cannot we then validate the + * source. If this is invalid we can skip the address space check, + * thus avoiding the deadlock. +@@ -598,8 +599,8 @@ bad_area_nosemaphore: + printk_ratelimit()) { + printk("%s%s[%d]: segfault at %08lx eip %08lx " + "esp %08lx error %lx\n", +- tsk->pid > 1 ? KERN_INFO : KERN_EMERG, +- tsk->comm, tsk->pid, address, regs->eip, ++ task_pid_nr(tsk) > 1 ? KERN_INFO : KERN_EMERG, ++ tsk->comm, task_pid_nr(tsk), address, regs->eip, + regs->esp, error_code); + } + tsk->thread.cr2 = address; +@@ -664,8 +665,7 @@ no_context: + printk(KERN_ALERT "BUG: unable to handle kernel paging" + " request"); + printk(" at virtual address %08lx\n",address); +- printk(KERN_ALERT " printing eip:\n"); +- printk("%08lx\n", regs->eip); ++ printk(KERN_ALERT "printing eip: %08lx\n", regs->eip); + dump_fault_path(address); } - -@@ -128,7 +128,7 @@ int __init scsiback_interface_init(void) - scsiback_cachep = kmem_cache_create("vscsiif_cache", - sizeof(struct vscsibk_info), 0, 0, NULL); - if (!scsiback_cachep) { -- printk(KERN_ERR "scsiback: can't init scsi cache\n"); -+ pr_err("scsiback: can't init scsi cache\n"); - return -ENOMEM; + tsk->thread.cr2 = address; +@@ -681,14 +681,14 @@ no_context: + */ + out_of_memory: + up_read(&mm->mmap_sem); +- if (is_init(tsk)) { ++ if (is_global_init(tsk)) { + yield(); + down_read(&mm->mmap_sem); + goto survive; } - ---- head.orig/drivers/xen/scsiback/scsiback.c 2013-01-30 10:35:56.000000000 +0100 -+++ head/drivers/xen/scsiback/scsiback.c 2013-02-06 14:55:59.000000000 +0100 -@@ -194,14 +194,10 @@ static void scsiback_print_status(char * - { - struct scsi_device *sdev = pending_req->sdev; - -- printk(KERN_ERR "scsiback: %d:%d:%d:%d ",sdev->host->host_no, -- sdev->channel, sdev->id, sdev->lun); -- printk(KERN_ERR "status = 0x%02x, message = 0x%02x, host = 0x%02x, driver = 0x%02x\n", -- status_byte(errors), msg_byte(errors), -- host_byte(errors), driver_byte(errors)); -- -- printk(KERN_ERR "scsiback: cmnd[0]=0x%02X\n", -- pending_req->cmnd[0]); -+ pr_err("scsiback[%d:%d:%d:%d] cmnd[0]=%02x -> st=%02x msg=%02x host=%02x drv=%02x\n", -+ sdev->host->host_no, sdev->channel, sdev->id, sdev->lun, -+ pending_req->cmnd[0], status_byte(errors), msg_byte(errors), -+ host_byte(errors), driver_byte(errors)); - - if (CHECK_CONDITION & status_byte(errors)) - __scsi_print_sense("scsiback", sense_buffer, SCSI_SENSE_BUFFERSIZE); -@@ -250,14 +246,18 @@ static int scsiback_gnttab_data_map(vscs - write = (data_dir == DMA_TO_DEVICE); + printk("VM: killing process %s\n", tsk->comm); + if (error_code & 4) +- do_exit(SIGKILL); ++ do_group_exit(SIGKILL); + goto no_context; - if (nr_segments) { -+ struct scatterlist *sg; -+ - /* free of (sgl) in fast_flush_area()*/ - pending_req->sgl = kmalloc(sizeof(struct scatterlist) * nr_segments, - GFP_KERNEL); - if (!pending_req->sgl) { -- printk(KERN_ERR "scsiback: %s: kmalloc() error.\n", __FUNCTION__); -+ pr_err("scsiback: %s: kmalloc() error\n", __FUNCTION__); - return -ENOMEM; - } + do_sigbus: +--- a/arch/x86/mm/fault_64-xen.c ++++ b/arch/x86/mm/fault_64-xen.c +@@ -25,6 +25,7 @@ + #include + #include + #include ++#include -+ sg_init_table(pending_req->sgl, nr_segments); -+ - flags = GNTMAP_host_map; - if (write) - flags |= GNTMAP_readonly; -@@ -270,14 +270,14 @@ static int scsiback_gnttab_data_map(vscs - err = HYPERVISOR_grant_table_op(GNTTABOP_map_grant_ref, map, nr_segments); - BUG_ON(err); + #include + #include +@@ -40,34 +41,27 @@ + #define PF_RSVD (1<<3) + #define PF_INSTR (1<<4) -- for (i = 0; i < nr_segments; i++) { -+ for_each_sg (pending_req->sgl, sg, nr_segments, i) { - struct page *pg; +-static ATOMIC_NOTIFIER_HEAD(notify_page_fault_chain); +- +-/* Hook to register for page fault notifications */ +-int register_page_fault_notifier(struct notifier_block *nb) ++#ifdef CONFIG_KPROBES ++static inline int notify_page_fault(struct pt_regs *regs) + { +- vmalloc_sync_all(); +- return atomic_notifier_chain_register(¬ify_page_fault_chain, nb); +-} +-EXPORT_SYMBOL_GPL(register_page_fault_notifier); ++ int ret = 0; - /* Retry maps with GNTST_eagain */ - if (unlikely(map[i].status == GNTST_eagain)) - gnttab_check_GNTST_eagain_while(GNTTABOP_map_grant_ref, &map[i]); - if (unlikely(map[i].status != GNTST_okay)) { -- printk(KERN_ERR "scsiback: invalid buffer -- could not remap it\n"); -+ pr_err("scsiback: invalid buffer -- could not remap it\n"); - map[i].handle = SCSIBACK_INVALID_HANDLE; - err |= 1; - } -@@ -292,15 +292,14 @@ static int scsiback_gnttab_data_map(vscs - set_phys_to_machine(page_to_pfn(pg), - FOREIGN_FRAME(map[i].dev_bus_addr >> PAGE_SHIFT)); +-int unregister_page_fault_notifier(struct notifier_block *nb) +-{ +- return atomic_notifier_chain_unregister(¬ify_page_fault_chain, nb); +-} +-EXPORT_SYMBOL_GPL(unregister_page_fault_notifier); ++ /* kprobe_running() needs smp_processor_id() */ ++ if (!user_mode(regs)) { ++ preempt_disable(); ++ if (kprobe_running() && kprobe_fault_handler(regs, 14)) ++ ret = 1; ++ preempt_enable(); ++ } -- pending_req->sgl[i].page = pg; -- pending_req->sgl[i].offset = ring_req->seg[i].offset; -- pending_req->sgl[i].length = ring_req->seg[i].length; -- data_len += pending_req->sgl[i].length; -+ sg_set_page(sg, pg, ring_req->seg[i].length, -+ ring_req->seg[i].offset); -+ data_len += sg->length; - - barrier(); -- if (pending_req->sgl[i].offset >= PAGE_SIZE || -- pending_req->sgl[i].length > PAGE_SIZE || -- pending_req->sgl[i].offset + pending_req->sgl[i].length > PAGE_SIZE) -+ if (sg->offset >= PAGE_SIZE || -+ sg->length > PAGE_SIZE || -+ sg->offset + sg->length > PAGE_SIZE) - err |= 1; - - } -@@ -329,27 +328,14 @@ static int scsiback_merge_bio(struct req - - blk_queue_bounce(q, &bio); - -- if (!rq->bio) -- blk_rq_bio_prep(q, rq, bio); -- else if (!ll_back_merge_fn(q, rq, bio)) -- return -EINVAL; -- else { -- rq->biotail->bi_next = bio; -- rq->biotail = bio; -- } -- -- return 0; -+ return blk_rq_append_bio(q, rq, bio); - } +-static inline int notify_page_fault(struct pt_regs *regs, long err) ++ return ret; ++} ++#else ++static inline int notify_page_fault(struct pt_regs *regs) + { +- struct die_args args = { +- .regs = regs, +- .str = "page fault", +- .err = err, +- .trapnr = 14, +- .signr = SIGSEGV +- }; +- return atomic_notifier_call_chain(¬ify_page_fault_chain, +- DIE_PAGE_FAULT, &args); ++ return 0; + } ++#endif + /* Sometimes the CPU reports invalid exceptions on prefetch. + Check that here and ignore. +@@ -176,7 +170,7 @@ void dump_pagetable(unsigned long addres + pmd = pmd_offset(pud, address); + if (bad_address(pmd)) goto bad; + printk("PMD %lx ", pmd_val(*pmd)); +- if (!pmd_present(*pmd)) goto ret; ++ if (!pmd_present(*pmd) || pmd_large(*pmd)) goto ret; - /* quoted scsi_lib.c/scsi_bi_endio */ --static int scsiback_bi_endio(struct bio *bio, unsigned int bytes_done, int error) -+static void scsiback_bi_endio(struct bio *bio, int error) - { -- if (bio->bi_size) -- return 1; -- - bio_put(bio); -- return 0; + pte = pte_offset_kernel(pmd, address); + if (bad_address(pte)) goto bad; +@@ -295,7 +289,6 @@ static int vmalloc_fault(unsigned long a + return 0; } +-static int page_fault_trace; + int show_unhandled_signals = 1; -@@ -360,16 +346,16 @@ static int request_map_sg(struct request - struct request_queue *q = rq->q; - int nr_pages; - unsigned int nsegs = count; -- - unsigned int data_len = 0, len, bytes, off; -+ struct scatterlist *sg; - struct page *page; - struct bio *bio = NULL; - int i, err, nr_vecs = 0; -- for (i = 0; i < nsegs; i++) { -- page = pending_req->sgl[i].page; -- off = (unsigned int)pending_req->sgl[i].offset; -- len = (unsigned int)pending_req->sgl[i].length; -+ for_each_sg (pending_req->sgl, sg, nsegs, i) { -+ page = sg_page(sg); -+ off = sg->offset; -+ len = sg->length; - data_len += len; +@@ -372,6 +365,11 @@ asmlinkage void __kprobes do_page_fault( + if (!user_mode(regs)) + error_code &= ~PF_USER; /* means kernel */ - nr_pages = (len + off + PAGE_SIZE - 1) >> PAGE_SHIFT; -@@ -397,7 +383,7 @@ static int request_map_sg(struct request - if (bio->bi_vcnt >= nr_vecs) { - err = scsiback_merge_bio(rq, bio); - if (err) { -- bio_endio(bio, bio->bi_size, 0); -+ bio_endio(bio, 0); - goto free_bios; - } - bio = NULL; -@@ -420,7 +406,7 @@ free_bios: ++ /* ++ * We can fault from pretty much anywhere, with unknown IRQ state. ++ */ ++ trace_hardirqs_fixup(); ++ + tsk = current; + mm = tsk->mm; + prefetchw(&mm->mmap_sem); +@@ -409,7 +407,7 @@ asmlinkage void __kprobes do_page_fault( + /* Can take a spurious fault if mapping changes R/O -> R/W. */ + if (spurious_fault(regs, address, error_code)) + return; +- if (notify_page_fault(regs, error_code) == NOTIFY_STOP) ++ if (notify_page_fault(regs)) + return; /* - * call endio instead of bio_put incase it was bounced - */ -- bio_endio(bio, bio->bi_size, 0); -+ bio_endio(bio, 0); + * Don't take the mm semaphore here. If we fixup a prefetch +@@ -418,16 +416,12 @@ asmlinkage void __kprobes do_page_fault( + goto bad_area_nosemaphore; } - return err; -@@ -463,7 +449,7 @@ void scsiback_cmd_exec(pending_req_t *pe - if (nr_segments) { +- if (notify_page_fault(regs, error_code) == NOTIFY_STOP) ++ if (notify_page_fault(regs)) + return; - if (request_map_sg(rq, pending_req, nr_segments)) { -- printk(KERN_ERR "scsiback: SG Request Map Error\n"); -+ pr_err("scsiback: SG Request Map Error\n"); - return; - } + if (likely(regs->eflags & X86_EFLAGS_IF)) + local_irq_enable(); + +- if (unlikely(page_fault_trace)) +- printk("pagefault rip:%lx rsp:%lx cs:%lu ss:%lu address %lx error %lx\n", +- regs->rip,regs->rsp,regs->cs,regs->ss,address,error_code); +- + if (unlikely(error_code & PF_RSVD)) + pgtable_bad(address, regs, error_code); + +@@ -448,7 +442,7 @@ asmlinkage void __kprobes do_page_fault( + again: + /* When running in the kernel we expect faults to occur only to + * addresses in user space. All other faults represent errors in the +- * kernel and should generate an OOPS. Unfortunatly, in the case of an ++ * kernel and should generate an OOPS. Unfortunately, in the case of an + * erroneous fault occurring in a code path which already holds mmap_sem + * we will deadlock attempting to validate the fault against the + * address space. Luckily the kernel only validly references user +@@ -456,7 +450,7 @@ asmlinkage void __kprobes do_page_fault( + * exceptions table. + * + * As the vast majority of faults will be valid we will only perform +- * the source reference check when there is a possibilty of a deadlock. ++ * the source reference check when there is a possibility of a deadlock. + * Attempt to lock the address space, if we cannot we then validate the + * source. If this is invalid we can skip the address space check, + * thus avoiding the deadlock. +@@ -558,7 +552,7 @@ bad_area_nosemaphore: + if (show_unhandled_signals && unhandled_signal(tsk, SIGSEGV) && + printk_ratelimit()) { + printk( +- "%s%s[%d]: segfault at %016lx rip %016lx rsp %016lx error %lx\n", ++ "%s%s[%d]: segfault at %lx rip %lx rsp %lx error %lx\n", + tsk->pid > 1 ? KERN_INFO : KERN_EMERG, + tsk->comm, tsk->pid, address, regs->rip, + regs->rsp, error_code); +@@ -624,7 +618,7 @@ no_context: + */ + out_of_memory: + up_read(&mm->mmap_sem); +- if (is_init(current)) { ++ if (is_global_init(current)) { + yield(); + goto again; } -@@ -614,7 +600,7 @@ static int _scsiback_do_cmd_fn(struct vs - break; - default: - if(!err && printk_ratelimit()) -- printk(KERN_ERR "scsiback: invalid request\n"); -+ pr_err("scsiback: invalid request\n"); - scsiback_do_resp_with_sense(NULL, DRIVER_ERROR << 24, - 0, pending_req); - break; -@@ -717,7 +703,7 @@ out_of_memory: - kfree(pending_reqs); - kfree(pending_grant_handles); - free_empty_pages_and_pagevec(pending_pages, mmap_pages); -- printk(KERN_ERR "scsiback: %s: out of memory\n", __FUNCTION__); -+ pr_err("scsiback: %s: out of memory\n", __FUNCTION__); - return -ENOMEM; +@@ -697,10 +691,3 @@ void vmalloc_sync_all(void) + BUILD_BUG_ON(!(((MODULES_END - 1) & PGDIR_MASK) == + (__START_KERNEL & PGDIR_MASK))); } +- +-static int __init enable_pagefaulttrace(char *str) +-{ +- page_fault_trace = 1; +- return 1; +-} +-__setup("pagefaulttrace", enable_pagefaulttrace); +--- a/arch/x86/mm/hypervisor.c ++++ b/arch/x86/mm/hypervisor.c +@@ -71,8 +71,8 @@ static inline bool use_lazy_mmu_mode(voi ---- head.orig/drivers/xen/scsiback/translate.c 2008-07-21 11:00:33.000000000 +0200 -+++ head/drivers/xen/scsiback/translate.c 2011-01-31 17:56:27.000000000 +0100 -@@ -62,8 +62,8 @@ int scsiback_add_translation_entry(struc - if ((entry->v.chn == v->chn) && - (entry->v.tgt == v->tgt) && - (entry->v.lun == v->lun)) { -- printk(KERN_WARNING "scsiback: Virtual ID is already used. " -- "Assignment was not performed.\n"); -+ pr_warning("scsiback: Virtual ID is already used. " -+ "Assignment was not performed.\n"); - err = -EEXIST; - goto out; + static void multicall_failed(const multicall_entry_t *mc, int rc) + { +- printk(KERN_EMERG "hypercall#%lu(%lx, %lx, %lx, %lx)" +- " failed: %d (caller %lx)\n", ++ pr_emerg("hypercall#%lu(%lx, %lx, %lx, %lx) failed: %d" ++ " (caller %lx)\n", + mc->op, mc->args[0], mc->args[1], mc->args[2], mc->args[3], + rc, mc->args[5]); + BUG(); +@@ -532,9 +532,8 @@ static int check_contig_order(unsigned i } -@@ -72,7 +72,7 @@ int scsiback_add_translation_entry(struc - - /* Create a new translation entry and add to the list */ - if ((new = kmalloc(sizeof(struct v2p_entry), GFP_ATOMIC)) == NULL) { -- printk(KERN_ERR "scsiback: %s: kmalloc() error.\n", __FUNCTION__); -+ pr_err("scsiback: %s: kmalloc() error\n", __FUNCTION__); - err = -ENOMEM; - goto out; + balloon_unlock(flags); + vfree(df); +- printk(KERN_INFO +- "Adjusted maximum contiguous region order to %u\n", +- order); ++ pr_info("Adjusted maximum contiguous region order to %u\n", ++ order); } ---- head.orig/drivers/xen/scsiback/xenbus.c 2012-01-20 14:18:49.000000000 +0100 -+++ head/drivers/xen/scsiback/xenbus.c 2011-06-30 16:32:56.000000000 +0200 -@@ -101,14 +101,13 @@ struct scsi_device *scsiback_get_scsi_de - shost = scsi_host_lookup(phy->hst); - if (IS_ERR(shost)) { -- printk(KERN_ERR "scsiback: host%d doesn't exist.\n", -- phy->hst); -+ pr_err("scsiback: host%d doesn't exist\n", phy->hst); - return NULL; - } - sdev = scsi_device_lookup(shost, phy->chn, phy->tgt, phy->lun); - if (!sdev) { -- printk(KERN_ERR "scsiback: %d:%d:%d:%d doesn't exist.\n", -- phy->hst, phy->chn, phy->tgt, phy->lun); -+ pr_err("scsiback: %d:%d:%d:%d doesn't exist\n", -+ phy->hst, phy->chn, phy->tgt, phy->lun); - scsi_host_put(shost); - return NULL; - } -@@ -177,7 +176,8 @@ static void scsiback_do_lun_hotplug(stru - if (!err) { - if (xenbus_printf(XBT_NIL, dev->nodename, state_str, - "%d", XenbusStateInitialised)) { -- printk(KERN_ERR "scsiback: xenbus_printf error %s\n", state_str); -+ pr_err("scsiback: xenbus_printf error %s\n", -+ state_str); - scsiback_del_translation_entry(be->info, &vir); - } - } else { -@@ -192,7 +192,8 @@ static void scsiback_do_lun_hotplug(stru - if (!scsiback_del_translation_entry(be->info, &vir)) { - if (xenbus_printf(XBT_NIL, dev->nodename, state_str, - "%d", XenbusStateClosed)) -- printk(KERN_ERR "scsiback: xenbus_printf error %s\n", state_str); -+ pr_err("scsiback: xenbus_printf error %s\n", -+ state_str); - } - } - break; -@@ -202,7 +203,8 @@ static void scsiback_do_lun_hotplug(stru - /* modify vscsi-devs/dev-x/state */ - if (xenbus_printf(XBT_NIL, dev->nodename, state_str, - "%d", XenbusStateConnected)) { -- printk(KERN_ERR "scsiback: xenbus_printf error %s\n", state_str); -+ pr_err("scsiback: xenbus_printf error %s\n", -+ state_str); - scsiback_del_translation_entry(be->info, &vir); - xenbus_printf(XBT_NIL, dev->nodename, state_str, - "%d", XenbusStateClosed); -@@ -345,7 +347,7 @@ static int scsiback_probe(struct xenbus_ - - - fail: -- printk(KERN_WARNING "scsiback: %s failed\n",__FUNCTION__); -+ pr_warning("scsiback: %s failed\n",__FUNCTION__); - scsiback_remove(dev); - - return err; ---- head.orig/drivers/xen/scsifront/scsifront.c 2012-12-06 16:07:02.000000000 +0100 -+++ head/drivers/xen/scsifront/scsifront.c 2012-12-04 12:44:59.000000000 +0100 -@@ -260,10 +260,9 @@ static int map_data_for_request(struct v - { - grant_ref_t gref_head; - struct page *page; -- int err, i, ref, ref_cnt = 0; -+ int err, ref, ref_cnt = 0; - int write = (sc->sc_data_direction == DMA_TO_DEVICE); -- int nr_pages, off, len, bytes; -- unsigned int data_len = 0; -+ unsigned int i, nr_pages, off, len, bytes; - - if (sc->sc_data_direction == DMA_NONE || !sc->request_bufflen) - return 0; -@@ -277,9 +276,10 @@ static int map_data_for_request(struct v + return 0; +@@ -547,6 +546,9 @@ int xen_create_contiguous_region( + unsigned long *in_frames, out_frame, frame, flags; + unsigned int i; + int rc, success; ++#ifdef CONFIG_64BIT ++ pte_t *ptep = NULL; ++#endif + struct xen_memory_exchange exchange = { + .in = { + .nr_extents = 1UL << order, +@@ -573,6 +575,28 @@ int xen_create_contiguous_region( + if (unlikely(rc)) + return rc; - if (sc->use_sg) { - /* quoted scsi_lib.c/scsi_req_map_sg . */ -- struct scatterlist *sg = (struct scatterlist *)sc->request_buffer; -- nr_pages = (sc->request_bufflen + sg[0].offset + PAGE_SIZE - 1) >> PAGE_SHIFT; -+ struct scatterlist *sg, *sgl = (struct scatterlist *)sc->request_buffer; -+ unsigned int data_len = sc->request_bufflen; ++#ifdef CONFIG_64BIT ++ if (unlikely(vstart > PAGE_OFFSET + MAXMEM)) { ++ unsigned int level; ++ ++ if (vstart < __START_KERNEL_map ++ || vstart + (PAGE_SIZE << order) > (unsigned long)_end) ++ return -EINVAL; ++ ptep = lookup_address((unsigned long)__va(__pa(vstart)), ++ &level); ++ if (ptep && pte_none(*ptep)) ++ ptep = NULL; ++ if (vstart < __START_KERNEL && ptep) ++ return -EINVAL; ++ rc = check_contig_order(order + 1); ++ if (unlikely(rc)) ++ return rc; ++ } ++#else ++ if (unlikely(vstart + (PAGE_SIZE << order) > (unsigned long)high_memory)) ++ return -EINVAL; ++#endif ++ + set_xen_guest_handle(exchange.out.extent_start, &out_frame); -+ nr_pages = (sc->request_bufflen + sgl->offset + PAGE_SIZE - 1) >> PAGE_SHIFT; - if (nr_pages > VSCSIIF_SG_TABLESIZE) { - shost_printk(PREFIX(ERR), info->host, - "Unable to map request_buffer for command!\n"); -@@ -287,14 +287,19 @@ static int map_data_for_request(struct v - goto big_to_sg; - } + scrub_pages((void *)vstart, 1 << order); +@@ -587,9 +611,19 @@ int xen_create_contiguous_region( + in_frames[i] = pfn_to_mfn((__pa(vstart) >> PAGE_SHIFT) + i); + MULTI_update_va_mapping(cr_mcl + i, vstart + (i*PAGE_SIZE), + __pte_ma(0), 0); ++#ifdef CONFIG_64BIT ++ if (ptep) ++ MULTI_update_va_mapping(cr_mcl + i + (1U << order), ++ (unsigned long)__va(__pa(vstart)) + (i*PAGE_SIZE), ++ __pte_ma(0), 0); ++#endif + set_phys_to_machine((__pa(vstart)>>PAGE_SHIFT)+i, + INVALID_P2M_ENTRY); + } ++#ifdef CONFIG_64BIT ++ if (ptep) ++ i += i; ++#endif + if (HYPERVISOR_multicall_check(cr_mcl, i, NULL)) + BUG(); -- for (i = 0; i < sc->use_sg; i++) { -- page = sg[i].page; -- off = sg[i].offset; -- len = sg[i].length; -- data_len += len; +@@ -623,9 +657,18 @@ int xen_create_contiguous_region( + frame = success ? (out_frame + i) : in_frames[i]; + MULTI_update_va_mapping(cr_mcl + i, vstart + (i*PAGE_SIZE), + pfn_pte_ma(frame, PAGE_KERNEL), 0); ++#ifdef CONFIG_64BIT ++ if (ptep) ++ MULTI_update_va_mapping(cr_mcl + i + (1U << order), ++ (unsigned long)__va(__pa(vstart)) + (i*PAGE_SIZE), ++ pfn_pte_ma(frame, PAGE_KERNEL_RO), 0); ++#endif + set_phys_to_machine((__pa(vstart)>>PAGE_SHIFT)+i, frame); + } - -- while (len > 0) { -+ for_each_sg (sgl, sg, sc->use_sg, i) { -+ page = sg_page(sg); -+ off = sg->offset; -+ len = sg->length; ++#ifdef CONFIG_64BIT ++ if (ptep) ++ i += i; ++#endif + cr_mcl[i - 1].args[MULTI_UVMFLAGS_INDEX] = order + ? UVMF_TLB_FLUSH|UVMF_ALL + : UVMF_INVLPG|UVMF_ALL; +--- a/arch/x86/mm/init_32-xen.c ++++ b/arch/x86/mm/init_32-xen.c +@@ -94,7 +94,14 @@ static pte_t * __init one_page_table_ini + #else + if (!(__pmd_val(*pmd) & _PAGE_PRESENT)) { + #endif +- pte_t *page_table = (pte_t *) alloc_bootmem_low_pages(PAGE_SIZE); ++ pte_t *page_table = NULL; + -+ while (len > 0 && data_len > 0) { -+ /* -+ * sg sends a scatterlist that is larger than -+ * the data_len it wants transferred for certain -+ * IO sizes -+ */ - bytes = min_t(unsigned int, len, PAGE_SIZE - off); -+ bytes = min(bytes, data_len); - - ref = gnttab_claim_grant_reference(&gref_head); - BUG_ON(ref == -ENOSPC); -@@ -309,6 +314,7 @@ static int map_data_for_request(struct v - - page++; - len -= bytes; -+ data_len -= bytes; - off = 0; - ref_cnt++; - } ---- head.orig/drivers/xen/sfc_netback/accel_fwd.c 2011-01-31 17:32:29.000000000 +0100 -+++ head/drivers/xen/sfc_netback/accel_fwd.c 2011-01-31 17:56:27.000000000 +0100 -@@ -181,10 +181,11 @@ int netback_accel_fwd_add(const __u8 *ma - unsigned long flags; - cuckoo_hash_mac_key key = cuckoo_mac_to_key(mac); - struct port_fwd *fwd_set = (struct port_fwd *)fwd_priv; -+ DECLARE_MAC_BUF(buf); - - BUG_ON(fwd_priv == NULL); ++#ifdef CONFIG_DEBUG_PAGEALLOC ++ page_table = (pte_t *) alloc_bootmem_pages(PAGE_SIZE); ++#endif ++ if (!page_table) ++ page_table = ++ (pte_t *)alloc_bootmem_low_pages(PAGE_SIZE); -- DPRINTK("Adding mac " MAC_FMT "\n", MAC_ARG(mac)); -+ DPRINTK("Adding mac %s\n", print_mac(buf, mac)); - - spin_lock_irqsave(&fwd_set->fwd_lock, flags); - -@@ -199,8 +200,8 @@ int netback_accel_fwd_add(const __u8 *ma - if (cuckoo_hash_lookup(&fwd_set->fwd_hash_table, - (cuckoo_hash_key *)(&key), &rc) != 0) { - spin_unlock_irqrestore(&fwd_set->fwd_lock, flags); -- EPRINTK("MAC address " MAC_FMT " already accelerated.\n", -- MAC_ARG(mac)); -+ EPRINTK("MAC address %s already accelerated.\n", -+ print_mac(buf, mac)); - return -EEXIST; + paravirt_alloc_pt(&init_mm, __pa(page_table) >> PAGE_SHIFT); + make_lowmem_page_readonly(page_table, +@@ -102,7 +109,7 @@ static pte_t * __init one_page_table_ini + set_pmd(pmd, __pmd(__pa(page_table) | _PAGE_TABLE)); + BUG_ON(page_table != pte_offset_kernel(pmd, 0)); } +- ++ + return pte_offset_kernel(pmd, 0); + } -@@ -235,8 +236,9 @@ void netback_accel_fwd_remove(const __u8 - unsigned long flags; - cuckoo_hash_mac_key key = cuckoo_mac_to_key(mac); - struct port_fwd *fwd_set = (struct port_fwd *)fwd_priv; -+ DECLARE_MAC_BUF(buf); - -- DPRINTK("Removing mac " MAC_FMT "\n", MAC_ARG(mac)); -+ DPRINTK("Removing mac %s\n", print_mac(buf, mac)); - - BUG_ON(fwd_priv == NULL); +@@ -360,8 +367,13 @@ static void __init set_highmem_pages_ini + { + int pfn; + for (pfn = highstart_pfn; pfn < highend_pfn +- && pfn < xen_start_info->nr_pages; pfn++) +- add_one_highpage_init(pfn_to_page(pfn), pfn, bad_ppro); ++ && pfn < xen_start_info->nr_pages; pfn++) { ++ /* ++ * Holes under sparsemem might not have no mem_map[]: ++ */ ++ if (pfn_valid(pfn)) ++ add_one_highpage_init(pfn_to_page(pfn), pfn, bad_ppro); ++ } -@@ -394,14 +396,16 @@ void netback_accel_tx_packet(struct sk_b + /* XEN: init high-mem pages outside initial allocation. */ + for (; pfn < highend_pfn; pfn++) { +@@ -785,35 +797,18 @@ int arch_add_memory(int nid, u64 start, + return __add_pages(zone, start_pfn, nr_pages); + } - if (is_broadcast_ether_addr(skb_mac_header(skb)) - && packet_is_arp_reply(skb)) { -+ DECLARE_MAC_BUF(buf); -+ - /* - * update our fast path forwarding to reflect this - * gratuitous ARP - */ - mac = skb_mac_header(skb)+ETH_ALEN; +-int remove_memory(u64 start, u64 size) +-{ +- return -EINVAL; +-} +-EXPORT_SYMBOL_GPL(remove_memory); + #endif -- DPRINTK("%s: found gratuitous ARP for " MAC_FMT "\n", -- __FUNCTION__, MAC_ARG(mac)); -+ DPRINTK("%s: found gratuitous ARP for %s\n", -+ __FUNCTION__, print_mac(buf, mac)); + struct kmem_cache *pmd_cache; - spin_lock_irqsave(&fwd_set->fwd_lock, flags); - /* ---- head.orig/drivers/xen/sfc_netback/accel_msg.c 2008-02-20 09:32:49.000000000 +0100 -+++ head/drivers/xen/sfc_netback/accel_msg.c 2011-01-31 17:56:27.000000000 +0100 -@@ -57,11 +57,11 @@ static void netback_accel_msg_tx_localma + void __init pgtable_cache_init(void) { - unsigned long lock_state; - struct net_accel_msg *msg; -+ DECLARE_MAC_BUF(buf); - - BUG_ON(bend == NULL || mac == NULL); - -- VPRINTK("Sending local mac message: " MAC_FMT "\n", -- MAC_ARG((const char *)mac)); -+ VPRINTK("Sending local mac message: %s\n", print_mac(buf, mac)); - - msg = net_accel_msg_start_send(bend->shared_page, &bend->to_domU, - &lock_state); ---- head.orig/drivers/xen/sfc_netfront/accel_msg.c 2011-01-31 17:29:16.000000000 +0100 -+++ head/drivers/xen/sfc_netfront/accel_msg.c 2011-01-31 17:56:27.000000000 +0100 -@@ -41,11 +41,13 @@ static void vnic_start_interrupts(netfro - /* Prime our interrupt */ - spin_lock_irqsave(&vnic->irq_enabled_lock, flags); - if (!netfront_accel_vi_enable_interrupts(vnic)) { -+ struct netfront_info *np = netdev_priv(vnic->net_dev); -+ - /* Cripes, that was quick, better pass it up */ - netfront_accel_disable_net_interrupts(vnic); - vnic->irq_enabled = 0; - NETFRONT_ACCEL_STATS_OP(vnic->stats.poll_schedule_count++); -- netif_rx_schedule(vnic->net_dev); -+ netif_rx_schedule(vnic->net_dev, &np->napi); - } else { - /* - * Nothing yet, make sure we get interrupts through -@@ -72,6 +74,7 @@ static void vnic_stop_interrupts(netfron - static void vnic_start_fastpath(netfront_accel_vnic *vnic) - { - struct net_device *net_dev = vnic->net_dev; -+ struct netfront_info *np = netdev_priv(net_dev); - unsigned long flags; - - DPRINTK("%s\n", __FUNCTION__); -@@ -80,9 +83,9 @@ static void vnic_start_fastpath(netfront - vnic->tx_enabled = 1; - spin_unlock_irqrestore(&vnic->tx_lock, flags); - -- netif_poll_disable(net_dev); -+ napi_disable(&np->napi); - vnic->poll_enabled = 1; -- netif_poll_enable(net_dev); -+ napi_enable(&np->napi); - - vnic_start_interrupts(vnic); - } -@@ -114,11 +117,11 @@ void vnic_stop_fastpath(netfront_accel_v - spin_unlock_irqrestore(&vnic->tx_lock, flags1); - - /* Must prevent polls and hold lock to modify poll_enabled */ -- netif_poll_disable(net_dev); -+ napi_disable(&np->napi); - spin_lock_irqsave(&vnic->irq_enabled_lock, flags1); - vnic->poll_enabled = 0; - spin_unlock_irqrestore(&vnic->irq_enabled_lock, flags1); -- netif_poll_enable(net_dev); -+ napi_enable(&np->napi); +- size_t pgd_size = PTRS_PER_PGD*sizeof(pgd_t); +- +- if (PTRS_PER_PMD > 1) { ++ if (PTRS_PER_PMD > 1) + pmd_cache = kmem_cache_create("pmd", +- PTRS_PER_PMD*sizeof(pmd_t), +- PTRS_PER_PMD*sizeof(pmd_t), +- SLAB_PANIC, +- pmd_ctor); +- if (!SHARED_KERNEL_PMD) { +- /* If we're in PAE mode and have a non-shared +- kernel pmd, then the pgd size must be a +- page size. This is because the pgd_list +- links through the page structure, so there +- can only be one pgd per page for this to +- work. */ +- pgd_size = PAGE_SIZE; +- } +- } ++ PTRS_PER_PMD*sizeof(pmd_t), ++ PTRS_PER_PMD*sizeof(pmd_t), ++ SLAB_PANIC, ++ pmd_ctor); } + /* +--- a/arch/x86/mm/init_64-xen.c ++++ b/arch/x86/mm/init_64-xen.c +@@ -798,7 +798,7 @@ static void xen_finish_init_mapping(void + /* Setup the direct mapping of the physical memory at PAGE_OFFSET. + This runs before bootmem is initialized and gets pages directly from the + physical memory. To access them they are temporarily mapped. */ +-void __meminit init_memory_mapping(unsigned long start, unsigned long end) ++void __init_refok init_memory_mapping(unsigned long start, unsigned long end) + { + unsigned long next; -@@ -324,8 +327,10 @@ static int vnic_process_localmac_msg(net - cuckoo_hash_mac_key key; +@@ -932,12 +932,6 @@ error: + } + EXPORT_SYMBOL_GPL(arch_add_memory); - if (msg->u.localmac.flags & NET_ACCEL_MSG_ADD) { -- DPRINTK("MAC has moved, could be local: " MAC_FMT "\n", -- MAC_ARG(msg->u.localmac.mac)); -+ DECLARE_MAC_BUF(buf); -+ -+ DPRINTK("MAC has moved, could be local: %s\n", -+ print_mac(buf, msg->u.localmac.mac)); - key = cuckoo_mac_to_key(msg->u.localmac.mac); - spin_lock_irqsave(&vnic->table_lock, flags); - /* Try to remove it, not a big deal if not there */ -@@ -513,6 +518,8 @@ irqreturn_t netfront_accel_net_channel_i +-int remove_memory(u64 start, u64 size) +-{ +- return -EINVAL; +-} +-EXPORT_SYMBOL_GPL(remove_memory); +- + #if !defined(CONFIG_ACPI_NUMA) && defined(CONFIG_NUMA) + int memory_add_physaddr_to_nid(u64 start) + { +@@ -1216,14 +1210,6 @@ int in_gate_area_no_task(unsigned long a + return (addr >= VSYSCALL_START) && (addr < VSYSCALL_END); + } - spin_lock_irqsave(&vnic->irq_enabled_lock, flags); - if (vnic->irq_enabled) { -+ struct netfront_info *np = netdev_priv(net_dev); +-#ifndef CONFIG_XEN +-void * __init alloc_bootmem_high_node(pg_data_t *pgdat, unsigned long size) +-{ +- return __alloc_bootmem_core(pgdat->bdata, size, +- SMP_CACHE_BYTES, (4UL*1024*1024*1024), 0); +-} +-#endif +- + const char *arch_vma_name(struct vm_area_struct *vma) + { + if (vma->vm_mm && vma->vm_start == (long)vma->vm_mm->context.vdso) +@@ -1232,3 +1218,48 @@ const char *arch_vma_name(struct vm_area + return "[vsyscall]"; + return NULL; + } + - netfront_accel_disable_net_interrupts(vnic); - vnic->irq_enabled = 0; - spin_unlock_irqrestore(&vnic->irq_enabled_lock, flags); -@@ -525,7 +532,7 @@ irqreturn_t netfront_accel_net_channel_i - vnic->stats.event_count_since_irq; - vnic->stats.event_count_since_irq = 0; - #endif -- netif_rx_schedule(net_dev); -+ netif_rx_schedule(net_dev, &np->napi); - } - else { - spin_unlock_irqrestore(&vnic->irq_enabled_lock, flags); ---- head.orig/drivers/xen/sfc_netfront/accel_vi.c 2011-06-30 16:06:37.000000000 +0200 -+++ head/drivers/xen/sfc_netfront/accel_vi.c 2011-06-30 16:33:02.000000000 +0200 -@@ -645,8 +645,10 @@ netfront_accel_vi_tx_post(netfront_accel - (cuckoo_hash_key *)(&key), &value); - - if (!try_fastpath) { -- VPRINTK("try fast path false for mac: " MAC_FMT "\n", -- MAC_ARG(skb->data)); -+ DECLARE_MAC_BUF(buf); ++#ifdef CONFIG_SPARSEMEM_VMEMMAP ++/* ++ * Initialise the sparsemem vmemmap using huge-pages at the PMD level. ++ */ ++int __meminit vmemmap_populate(struct page *start_page, ++ unsigned long size, int node) ++{ ++ unsigned long addr = (unsigned long)start_page; ++ unsigned long end = (unsigned long)(start_page + size); ++ unsigned long next; ++ pgd_t *pgd; ++ pud_t *pud; ++ pmd_t *pmd; + -+ VPRINTK("try fast path false for mac: %s\n", -+ print_mac(buf, skb->data)); - - return NETFRONT_ACCEL_STATUS_CANT; - } -@@ -772,9 +774,10 @@ static void netfront_accel_vi_rx_comple - if (compare_ether_addr(skb->data, vnic->mac)) { - struct iphdr *ip = (struct iphdr *)(skb->data + ETH_HLEN); - u16 port; -+ DECLARE_MAC_BUF(buf); - -- DPRINTK("%s: saw wrong MAC address " MAC_FMT "\n", -- __FUNCTION__, MAC_ARG(skb->data)); -+ DPRINTK("%s: saw wrong MAC address %s\n", -+ __FUNCTION__, print_mac(buf, skb->data)); - - if (ip->protocol == IPPROTO_TCP) { - struct tcphdr *tcp = (struct tcphdr *) ---- head.orig/drivers/xen/sfc_netutil/accel_msg_iface.c 2008-02-20 09:32:49.000000000 +0100 -+++ head/drivers/xen/sfc_netutil/accel_msg_iface.c 2011-01-31 17:56:27.000000000 +0100 -@@ -36,7 +36,7 @@ - #else - #define NET_ACCEL_CHECK_MAGIC(_p, _errval) \ - if (_p->magic != NET_ACCEL_MSG_MAGIC) { \ -- printk(KERN_ERR "%s: passed invalid shared page %p!\n", \ -+ pr_err("%s: passed invalid shared page %p!\n", \ - __FUNCTION__, _p); \ - return _errval; \ - } ---- head.orig/drivers/xen/sfc_netutil/accel_util.h 2008-02-20 09:32:49.000000000 +0100 -+++ head/drivers/xen/sfc_netutil/accel_util.h 2011-01-31 17:56:27.000000000 +0100 -@@ -63,9 +63,6 @@ - DPRINTK("%s at %s:%d\n", #exp, __FILE__, __LINE__); \ - } while(0) ++ for (; addr < end; addr = next) { ++ next = pmd_addr_end(addr, end); ++ ++ pgd = vmemmap_pgd_populate(addr, node); ++ if (!pgd) ++ return -ENOMEM; ++ pud = vmemmap_pud_populate(pgd, addr, node); ++ if (!pud) ++ return -ENOMEM; ++ ++ pmd = pmd_offset(pud, addr); ++ if (pmd_none(*pmd)) { ++ pte_t entry; ++ void *p = vmemmap_alloc_block(PMD_SIZE, node); ++ if (!p) ++ return -ENOMEM; ++ ++ entry = pfn_pte(__pa(p) >> PAGE_SHIFT, PAGE_KERNEL); ++ mk_pte_huge(entry); ++ set_pmd(pmd, __pmd(pte_val(entry))); ++ ++ printk(KERN_DEBUG " [%lx-%lx] PMD ->%p on node %d\n", ++ addr, addr + PMD_SIZE - 1, p, node); ++ } else ++ vmemmap_verify((pte_t *)pmd, node, addr, next); ++ } ++ ++ return 0; ++} ++#endif +--- a/arch/x86/mm/pageattr_64-xen.c ++++ b/arch/x86/mm/pageattr_64-xen.c +@@ -17,9 +17,6 @@ + #include + #include --#define MAC_FMT "%.2x:%.2x:%.2x:%.2x:%.2x:%.2x" --#define MAC_ARG(_mac) (_mac)[0], (_mac)[1], (_mac)[2], (_mac)[3], (_mac)[4], (_mac)[5] +-LIST_HEAD(mm_unpinned); +-DEFINE_SPINLOCK(mm_unpinned_lock); - - #include + static void _pin_lock(struct mm_struct *mm, int lock) { + if (lock) + spin_lock(&mm->page_table_lock); +@@ -81,8 +78,8 @@ static void _pin_lock(struct mm_struct * + #define PIN_BATCH 8 + static DEFINE_PER_CPU(multicall_entry_t[PIN_BATCH], pb_mcl); - /*! Map a set of pages from another domain ---- head.orig/drivers/xen/tpmback/interface.c 2011-04-11 14:52:30.000000000 +0200 -+++ head/drivers/xen/tpmback/interface.c 2011-04-11 15:00:49.000000000 +0200 -@@ -50,7 +50,7 @@ static tpmif_t *alloc_tpmif(domid_t domi - out_of_memory: - if (tpmif != NULL) - kmem_cache_free(tpmif_cachep, tpmif); -- printk("%s: out of memory\n", __FUNCTION__); -+ pr_err("%s: out of memory\n", __FUNCTION__); - return ERR_PTR(-ENOMEM); +-static inline unsigned int mm_walk_set_prot(void *pt, pgprot_t flags, +- unsigned int cpu, unsigned int seq) ++static inline unsigned int pgd_walk_set_prot(void *pt, pgprot_t flags, ++ unsigned int cpu, unsigned int seq) + { + struct page *page = virt_to_page(pt); + unsigned long pfn = page_to_pfn(page); +@@ -100,9 +97,9 @@ static inline unsigned int mm_walk_set_p + return seq; } ---- head.orig/drivers/xen/tpmback/tpmback.c 2011-01-31 17:32:22.000000000 +0100 -+++ head/drivers/xen/tpmback/tpmback.c 2011-01-31 17:56:27.000000000 +0100 -@@ -908,8 +908,7 @@ static int __init tpmback_init(void) - int rc; - - if ((rc = misc_register(&vtpms_miscdevice)) != 0) { -- printk(KERN_ALERT -- "Could not register misc device for TPM BE.\n"); -+ pr_alert("Could not register misc device for TPM BE\n"); - return rc; - } - -@@ -929,7 +928,7 @@ static int __init tpmback_init(void) - return rc; - } - -- printk(KERN_ALERT "Successfully initialized TPM backend driver.\n"); -+ pr_alert("Successfully initialized TPM backend driver\n"); +-static void mm_walk(struct mm_struct *mm, pgprot_t flags) ++static void pgd_walk(pgd_t *pgd_base, pgprot_t flags) + { +- pgd_t *pgd; ++ pgd_t *pgd = pgd_base; + pud_t *pud; + pmd_t *pmd; + pte_t *pte; +@@ -110,7 +107,6 @@ static void mm_walk(struct mm_struct *mm + unsigned int cpu, seq; + multicall_entry_t *mcl; - return 0; - } ---- head.orig/drivers/xen/usbback/usbback.c 2011-04-11 14:30:35.000000000 +0200 -+++ head/drivers/xen/usbback/usbback.c 2013-01-28 15:55:45.000000000 +0100 -@@ -88,6 +88,8 @@ typedef struct { - static pending_req_t *pending_reqs; - static struct list_head pending_free; - static DEFINE_SPINLOCK(pending_free_lock); -+static LIST_HEAD(pending_urb_free); -+static DEFINE_SPINLOCK(urb_free_lock); - static DECLARE_WAIT_QUEUE_HEAD(pending_free_wq); +- pgd = mm->pgd; + cpu = get_cpu(); - #define USBBACK_INVALID_HANDLE (~0) -@@ -233,7 +235,7 @@ static int usbbk_alloc_urb(usbif_urb_req - else - pending_req->urb = usb_alloc_urb(0, GFP_KERNEL); - if (!pending_req->urb) { -- printk(KERN_ERR "usbback: can't alloc urb\n"); -+ pr_err("usbback: can't alloc urb\n"); - ret = -ENOMEM; - goto fail; - } -@@ -243,7 +245,7 @@ static int usbbk_alloc_urb(usbif_urb_req - req->buffer_length, GFP_KERNEL, - &pending_req->transfer_dma); - if (!pending_req->buffer) { -- printk(KERN_ERR "usbback: can't alloc urb buffer\n"); -+ pr_err("usbback: can't alloc urb buffer\n"); - ret = -ENOMEM; - goto fail_free_urb; - } -@@ -254,7 +256,7 @@ static int usbbk_alloc_urb(usbif_urb_req - sizeof(struct usb_ctrlrequest), GFP_KERNEL, - &pending_req->setup_dma); - if (!pending_req->setup) { -- printk(KERN_ERR "usbback: can't alloc usb_ctrlrequest\n"); -+ pr_err("usbback: can't alloc usb_ctrlrequest\n"); - ret = -ENOMEM; - goto fail_free_buffer; + /* +@@ -125,18 +121,18 @@ static void mm_walk(struct mm_struct *mm + continue; + pud = pud_offset(pgd, 0); + if (PTRS_PER_PUD > 1) /* not folded */ +- seq = mm_walk_set_prot(pud,flags,cpu,seq); ++ seq = pgd_walk_set_prot(pud,flags,cpu,seq); + for (u = 0; u < PTRS_PER_PUD; u++, pud++) { + if (pud_none(*pud)) + continue; + pmd = pmd_offset(pud, 0); + if (PTRS_PER_PMD > 1) /* not folded */ +- seq = mm_walk_set_prot(pmd,flags,cpu,seq); ++ seq = pgd_walk_set_prot(pmd,flags,cpu,seq); + for (m = 0; m < PTRS_PER_PMD; m++, pmd++) { + if (pmd_none(*pmd)) + continue; + pte = pte_offset_kernel(pmd,0); +- seq = mm_walk_set_prot(pte,flags,cpu,seq); ++ seq = pgd_walk_set_prot(pte,flags,cpu,seq); + } } -@@ -274,6 +276,15 @@ fail: - - static void usbbk_free_urb(struct urb *urb) - { -+ unsigned long flags; -+ -+ spin_lock_irqsave(&urb_free_lock, flags); -+ list_add(&urb->urb_list, &pending_urb_free); -+ spin_unlock_irqrestore(&urb_free_lock, flags); -+} -+ -+static void _usbbk_free_urb(struct urb *urb) -+{ - if (usb_pipecontrol(urb->pipe)) - usb_buffer_free(urb->dev, sizeof(struct usb_ctrlrequest), - urb->setup_packet, urb->setup_dma); -@@ -284,6 +295,29 @@ static void usbbk_free_urb(struct urb *u - usb_free_urb(urb); + } +@@ -148,12 +144,12 @@ static void mm_walk(struct mm_struct *mm + seq = 0; + } + MULTI_update_va_mapping(mcl + seq, +- (unsigned long)__user_pgd(mm->pgd), +- pfn_pte(virt_to_phys(__user_pgd(mm->pgd))>>PAGE_SHIFT, flags), ++ (unsigned long)__user_pgd(pgd_base), ++ pfn_pte(virt_to_phys(__user_pgd(pgd_base))>>PAGE_SHIFT, flags), + 0); + MULTI_update_va_mapping(mcl + seq + 1, +- (unsigned long)mm->pgd, +- pfn_pte(virt_to_phys(mm->pgd)>>PAGE_SHIFT, flags), ++ (unsigned long)pgd_base, ++ pfn_pte(virt_to_phys(pgd_base)>>PAGE_SHIFT, flags), + UVMF_TLB_FLUSH); + if (unlikely(HYPERVISOR_multicall_check(mcl, seq + 2, NULL))) + BUG(); +@@ -161,21 +157,35 @@ static void mm_walk(struct mm_struct *mm + put_cpu(); } -+static void usbbk_free_urbs(void) ++static void __pgd_pin(pgd_t *pgd) +{ -+ unsigned long flags; -+ struct list_head tmp_list; -+ -+ if (list_empty(&pending_urb_free)) -+ return; -+ -+ INIT_LIST_HEAD(&tmp_list); -+ -+ spin_lock_irqsave(&urb_free_lock, flags); -+ list_splice_init(&pending_urb_free, &tmp_list); -+ spin_unlock_irqrestore(&urb_free_lock, flags); ++ pgd_walk(pgd, PAGE_KERNEL_RO); ++ xen_pgd_pin(__pa(pgd)); /* kernel */ ++ xen_pgd_pin(__pa(__user_pgd(pgd))); /* user */ ++ SetPagePinned(virt_to_page(pgd)); ++} + -+ while (!list_empty(&tmp_list)) { -+ struct urb *next_urb = list_first_entry(&tmp_list, struct urb, -+ urb_list); ++static void __pgd_unpin(pgd_t *pgd) ++{ ++ xen_pgd_unpin(__pa(pgd)); ++ xen_pgd_unpin(__pa(__user_pgd(pgd))); ++ pgd_walk(pgd, PAGE_KERNEL); ++ ClearPagePinned(virt_to_page(pgd)); ++} + -+ list_del(&next_urb->urb_list); -+ _usbbk_free_urb(next_urb); -+ } ++void pgd_test_and_unpin(pgd_t *pgd) ++{ ++ if (PagePinned(virt_to_page(pgd))) ++ __pgd_unpin(pgd); +} + - static void usbbk_notify_work(usbif_t *usbif) + void mm_pin(struct mm_struct *mm) { - usbif->waiting_reqs = 1; -@@ -358,7 +392,7 @@ static int usbbk_gnttab_map(usbif_t *usb - nr_segs = pending_req->nr_buffer_segs + pending_req->nr_extra_segs; - - if (nr_segs > USBIF_MAX_SEGMENTS_PER_REQUEST) { -- printk(KERN_ERR "Bad number of segments in request\n"); -+ pr_err("Bad number of segments in request\n"); - ret = -EINVAL; - goto fail; - } -@@ -401,7 +435,7 @@ static int usbbk_gnttab_map(usbif_t *usb - gnttab_check_GNTST_eagain_while(GNTTABOP_map_grant_ref, &map[i]); - - if (unlikely(map[i].status != GNTST_okay)) { -- printk(KERN_ERR "usbback: invalid buffer -- could not remap it\n"); -+ pr_err("usbback: invalid buffer -- could not remap it\n"); - map[i].handle = USBBACK_INVALID_HANDLE; - ret |= 1; - } -@@ -929,7 +963,7 @@ static void dispatch_request_to_pending_ + if (xen_feature(XENFEAT_writable_page_tables)) + return; - ret = usbbk_gnttab_map(usbif, req, pending_req); - if (ret) { -- printk(KERN_ERR "usbback: invalid buffer\n"); -+ pr_err("usbback: invalid buffer\n"); - ret = -ESHUTDOWN; - goto fail_free_urb; - } -@@ -952,7 +986,7 @@ static void dispatch_request_to_pending_ + pin_lock(mm); +- +- mm_walk(mm, PAGE_KERNEL_RO); +- xen_pgd_pin(__pa(mm->pgd)); /* kernel */ +- xen_pgd_pin(__pa(__user_pgd(mm->pgd))); /* user */ +- SetPagePinned(virt_to_page(mm->pgd)); +- spin_lock(&mm_unpinned_lock); +- list_del(&mm->context.unpinned); +- spin_unlock(&mm_unpinned_lock); +- ++ __pgd_pin(mm->pgd); + pin_unlock(mm); + } - ret = usb_submit_urb(pending_req->urb, GFP_KERNEL); - if (ret) { -- printk(KERN_ERR "usbback: failed submitting urb, error %d\n", ret); -+ pr_err("usbback: failed submitting urb, error %d\n", ret); - ret = -ESHUTDOWN; - goto fail_flush_area; - } -@@ -985,8 +1019,7 @@ static int usbbk_start_submit_urb(usbif_ - while (rc != rp) { - if (RING_REQUEST_CONS_OVERFLOW(urb_ring, rc)) { - if(printk_ratelimit()) -- printk(KERN_WARNING "usbback: " -- "RING_REQUEST_CONS_OVERFLOW\n"); -+ pr_warning("RING_REQUEST_CONS_OVERFLOW\n"); - break; - } +@@ -185,34 +195,30 @@ void mm_unpin(struct mm_struct *mm) + return; -@@ -1057,8 +1090,11 @@ int usbbk_schedule(void *arg) + pin_lock(mm); +- +- xen_pgd_unpin(__pa(mm->pgd)); +- xen_pgd_unpin(__pa(__user_pgd(mm->pgd))); +- mm_walk(mm, PAGE_KERNEL); +- ClearPagePinned(virt_to_page(mm->pgd)); +- spin_lock(&mm_unpinned_lock); +- list_add(&mm->context.unpinned, &mm_unpinned); +- spin_unlock(&mm_unpinned_lock); +- ++ __pgd_unpin(mm->pgd); + pin_unlock(mm); + } - if (usbbk_start_submit_urb(usbif)) - usbif->waiting_reqs = 1; + void mm_pin_all(void) + { ++ struct page *page; ++ unsigned long flags; + -+ usbbk_free_urbs(); - } - -+ usbbk_free_urbs(); - usbif->xenusbd = NULL; - usbif_put(usbif); - ---- head.orig/drivers/xen/usbback/usbstub.c 2011-03-11 10:54:35.000000000 +0100 -+++ head/drivers/xen/usbback/usbstub.c 2011-03-11 10:55:46.000000000 +0100 -@@ -150,7 +150,7 @@ static struct usbstub *usbstub_alloc(str - - stub = kzalloc(sizeof(*stub), GFP_KERNEL); - if (!stub) { -- printk(KERN_ERR "no memory for alloc usbstub\n"); -+ pr_err("no memory for usbstub\n"); - return NULL; - } - kref_init(&stub->kref); -@@ -303,7 +303,7 @@ int __init usbstub_init(void) + if (xen_feature(XENFEAT_writable_page_tables)) + return; - err = usb_register(&usbback_usb_driver); - if (err < 0) { -- printk(KERN_ERR "usbback: usb_register failed (error %d)\n", err); -+ pr_err("usbback: usb_register failed (%d)\n", err); - goto out; - } - ---- head.orig/drivers/xen/usbback/xenbus.c 2011-12-21 10:02:58.000000000 +0100 -+++ head/drivers/xen/usbback/xenbus.c 2011-06-30 16:33:08.000000000 +0200 -@@ -240,9 +240,9 @@ static int connect_rings(usbif_t *usbif) - return err; - } - -- printk("usbback: urb-ring-ref %u, conn-ring-ref %u," -- " event-channel %u\n", -- urb_ring_ref, conn_ring_ref, evtchn); -+ pr_info("usbback: urb-ring-ref %u, conn-ring-ref %u," -+ " event-channel %u\n", -+ urb_ring_ref, conn_ring_ref, evtchn); - - err = usbif_map(usbif, urb_ring_ref, conn_ring_ref, evtchn); - if (err) { -@@ -269,8 +269,8 @@ static void frontend_changed(struct xenb + /* +- * Allow uninterrupted access to the mm_unpinned list. We don't +- * actually take the mm_unpinned_lock as it is taken inside mm_pin(). ++ * Allow uninterrupted access to the pgd_list. Also protects ++ * __pgd_pin() by disabling preemption. + * All other CPUs must be at a safe point (e.g., in stop_machine + * or offlined entirely). + */ +- preempt_disable(); +- while (!list_empty(&mm_unpinned)) +- mm_pin(list_entry(mm_unpinned.next, struct mm_struct, +- context.unpinned)); +- preempt_enable(); ++ spin_lock_irqsave(&pgd_lock, flags); ++ list_for_each_entry(page, &pgd_list, lru) { ++ if (!PagePinned(page)) ++ __pgd_pin((pgd_t *)page_address(page)); ++ } ++ spin_unlock_irqrestore(&pgd_lock, flags); + } - case XenbusStateInitialising: - if (dev->state == XenbusStateClosed) { -- printk("%s: %s: prepare for reconnect\n", -- __FUNCTION__, dev->nodename); -+ pr_info("%s: %s: prepare for reconnect\n", -+ __FUNCTION__, dev->nodename); - xenbus_switch_state(dev, XenbusStateInitWait); - } - break; ---- head.orig/drivers/xen/usbfront/usbfront.h 2012-06-06 13:48:26.000000000 +0200 -+++ head/drivers/xen/usbfront/usbfront.h 2012-06-06 13:56:04.000000000 +0200 -@@ -83,6 +83,7 @@ struct urb_priv { - struct urb *urb; - int req_id; /* RING_REQUEST id for submitting */ - int unlink_req_id; /* RING_REQUEST id for unlinking */ -+ int status; - unsigned unlinked:1; /* dequeued marker */ - }; + void arch_dup_mmap(struct mm_struct *oldmm, struct mm_struct *mm) +@@ -331,11 +337,11 @@ static struct page *split_large_page(uns + return base; + } ---- head.orig/drivers/xen/usbfront/usbfront-dbg.c 2011-01-31 17:29:16.000000000 +0100 -+++ head/drivers/xen/usbfront/usbfront-dbg.c 2011-01-31 17:56:27.000000000 +0100 -@@ -91,8 +91,8 @@ static inline void create_debug_file(str +-static void cache_flush_page(void *adr) ++void clflush_cache_range(void *adr, int size) { - struct class_device *cldev = info_to_hcd(info)->self.class_dev; - if (class_device_create_file(cldev, &class_device_attr_statistics)) -- printk(KERN_WARNING "statistics file not created for %s\n", -- info_to_hcd(info)->self.bus_name); -+ pr_warning("statistics file not created for %s\n", -+ info_to_hcd(info)->self.bus_name); + int i; +- for (i = 0; i < PAGE_SIZE; i += boot_cpu_data.x86_clflush_size) +- asm volatile("clflush (%0)" :: "r" (adr + i)); ++ for (i = 0; i < size; i += boot_cpu_data.x86_clflush_size) ++ clflush(adr+i); } - static inline void remove_debug_file(struct usbfront_info *info) ---- head.orig/drivers/xen/usbfront/usbfront-hcd.c 2009-10-15 11:45:41.000000000 +0200 -+++ head/drivers/xen/usbfront/usbfront-hcd.c 2011-01-31 17:56:27.000000000 +0100 -@@ -114,7 +114,6 @@ static void xenhcd_stop(struct usb_hcd * - * non-error returns are promise to giveback the urb later - */ - static int xenhcd_urb_enqueue(struct usb_hcd *hcd, -- struct usb_host_endpoint *ep, - struct urb *urb, - gfp_t mem_flags) - { -@@ -130,6 +129,7 @@ static int xenhcd_urb_enqueue(struct usb - ret = -ENOMEM; - goto done; + static void flush_kernel_map(void *arg) +@@ -350,7 +356,7 @@ static void flush_kernel_map(void *arg) + asm volatile("wbinvd" ::: "memory"); + else list_for_each_entry(pg, l, lru) { + void *adr = page_address(pg); +- cache_flush_page(adr); ++ clflush_cache_range(adr, PAGE_SIZE); } -+ urbp->status = 1; + __flush_tlb_all(); + } +@@ -418,6 +424,7 @@ __change_page_attr(unsigned long address + split = split_large_page(address, prot, ref_prot2); + if (!split) + return -ENOMEM; ++ pgprot_val(ref_prot2) &= ~_PAGE_NX; + set_pte(kpte, mk_pte(split, ref_prot2)); + kpte_page = split; + } +@@ -510,9 +517,14 @@ void global_flush_tlb(void) + struct page *pg, *next; + struct list_head l; - ret = xenhcd_submit_urb(info, urbp); - if (ret != 0) -@@ -144,7 +144,7 @@ done: - * called as .urb_dequeue() - */ - static int xenhcd_urb_dequeue(struct usb_hcd *hcd, -- struct urb *urb) -+ struct urb *urb, int status) - { - struct usbfront_info *info = hcd_to_info(hcd); - struct urb_priv *urbp; -@@ -157,6 +157,7 @@ static int xenhcd_urb_dequeue(struct usb - if (!urbp) - goto done; +- down_read(&init_mm.mmap_sem); ++ /* ++ * Write-protect the semaphore, to exclude two contexts ++ * doing a list_replace_init() call in parallel and to ++ * exclude new additions to the deferred_pages list: ++ */ ++ down_write(&init_mm.mmap_sem); + list_replace_init(&deferred_pages, &l); +- up_read(&init_mm.mmap_sem); ++ up_write(&init_mm.mmap_sem); -+ urbp->status = status; - ret = xenhcd_unlink_urb(info, urbp); + flush_map(&l); - done: ---- head.orig/drivers/xen/usbfront/usbfront-q.c 2011-01-31 17:29:16.000000000 +0100 -+++ head/drivers/xen/usbfront/usbfront-q.c 2011-01-31 17:56:27.000000000 +0100 -@@ -151,7 +151,7 @@ static int map_urb_for_request(struct us +--- a/arch/x86/mm/pgtable_32-xen.c ++++ b/arch/x86/mm/pgtable_32-xen.c +@@ -6,6 +6,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -46,6 +47,8 @@ void show_mem(void) + for_each_online_pgdat(pgdat) { + pgdat_resize_lock(pgdat, &flags); + for (i = 0; i < pgdat->node_spanned_pages; ++i) { ++ if (unlikely(i % MAX_ORDER_NR_PAGES == 0)) ++ touch_nmi_watchdog(); + page = pgdat_page_nr(pgdat, i); + total++; + if (PageHighMem(page)) +@@ -206,7 +209,7 @@ void pte_free(struct page *pte) + __free_page(pte); + } - ret = gnttab_alloc_grant_references(USBIF_MAX_SEGMENTS_PER_REQUEST, &gref_head); - if (ret) { -- printk(KERN_ERR "usbfront: gnttab_alloc_grant_references() error\n"); -+ pr_err("usbfront: gnttab_alloc_grant_references() error\n"); - return -ENOMEM; - } +-void pmd_ctor(void *pmd, struct kmem_cache *cache, unsigned long flags) ++void pmd_ctor(struct kmem_cache *cache, void *pmd) + { + memset(pmd, 0, PTRS_PER_PMD*sizeof(pmd_t)); + } +--- a/arch/x86/pci/pcifront.c ++++ b/arch/x86/pci/pcifront.c +@@ -31,7 +31,7 @@ static int __init pcifront_x86_stub_init + if (raw_pci_ops) + return 0; -@@ -236,7 +236,8 @@ __acquires(info->lock) - COUNT(info->stats.complete); +- printk(KERN_INFO "PCI: setting up Xen PCI frontend stub\n"); ++ pr_info("PCI: setting up Xen PCI frontend stub\n"); + + /* Copied from arch/i386/pci/common.c */ + pci_cache_line_size = 32 >> 2; +--- a/drivers/acpi/processor_core.c ++++ b/drivers/acpi/processor_core.c +@@ -200,11 +200,21 @@ int acpi_get_cpuid(acpi_handle handle, i } - spin_unlock(&info->lock); -- usb_hcd_giveback_urb(info_to_hcd(info), urb); -+ usb_hcd_giveback_urb(info_to_hcd(info), urb, -+ urbp->status <= 0 ? urbp->status : urb->status); - spin_lock(&info->lock); - } ---- head.orig/drivers/xen/usbfront/xenbus.c 2012-10-04 11:53:32.000000000 +0200 -+++ head/drivers/xen/usbfront/xenbus.c 2012-10-04 11:54:28.000000000 +0200 -@@ -394,7 +394,7 @@ static int __init usbfront_init(void) - xenhcd_urbp_cachep = kmem_cache_create("xenhcd_urb_priv", - sizeof(struct urb_priv), 0, 0, NULL); - if (!xenhcd_urbp_cachep) { -- printk(KERN_ERR "usbfront failed to create kmem cache\n"); -+ pr_err("usbfront failed to create kmem cache\n"); - return -ENOMEM; + #ifdef CONFIG_SMP ++#ifndef CONFIG_PROCESSOR_EXTERNAL_CONTROL + for_each_possible_cpu(i) { + if (cpu_physical_id(i) == apic_id) + return i; + } + #else ++ /* ++ * Use of cpu_physical_id() is bogus here. Rather than defining a ++ * stub enforcing a 1:1 mapping, we keep it undefined to catch bad ++ * uses. Return as if there was a 1:1 mapping. ++ */ ++ if (apic_id < NR_CPUS && cpu_possible(apic_id)) ++ return apic_id; ++#endif ++#else + /* In UP kernel, only processor 0 is valid */ + if (apic_id == 0) + return apic_id; +--- a/drivers/acpi/processor_extcntl.c ++++ b/drivers/acpi/processor_extcntl.c +@@ -95,7 +95,7 @@ int processor_notify_external(struct acp + ret = processor_extcntl_ops->hotplug(pr, type); + break; + default: +- printk(KERN_ERR "Unsupport processor events %d.\n", event); ++ pr_err("Unsupported processor event %d.\n", event); + break; } ---- head.orig/drivers/xen/util.c 2011-01-31 17:49:31.000000000 +0100 -+++ head/drivers/xen/util.c 2011-01-31 17:56:27.000000000 +0100 -@@ -11,7 +11,7 @@ struct class *get_xen_class(void) +--- a/drivers/acpi/processor_idle.c ++++ b/drivers/acpi/processor_idle.c +@@ -1087,6 +1087,14 @@ int acpi_processor_hotplug(struct acpi_p + if (!pr->flags.power_setup_done) + return -ENODEV; - xen_class = class_create(THIS_MODULE, "xen"); - if (IS_ERR(xen_class)) { -- printk("Failed to create xen sysfs class.\n"); -+ pr_err("failed to create xen sysfs class\n"); - xen_class = NULL; - } ++ if (processor_pm_external()) { ++ pr->flags.power = 0; ++ ret = acpi_processor_get_power_info(pr); ++ processor_notify_external(pr, ++ PROCESSOR_PM_CHANGE, PM_TYPE_IDLE); ++ return ret; ++ } ++ + dev = per_cpu(acpi_cpuidle_device, pr->id); + cpuidle_pause_and_lock(); + cpuidle_disable_device(dev); +--- a/drivers/char/tpm/tpm_xen.c ++++ b/drivers/char/tpm/tpm_xen.c +@@ -104,9 +104,9 @@ void __exit tpmif_exit(void); + #define DPRINTK(fmt, args...) \ + pr_debug("xen_tpm_fr (%s:%d) " fmt, __FUNCTION__, __LINE__, ##args) + #define IPRINTK(fmt, args...) \ +- printk(KERN_INFO "xen_tpm_fr: " fmt, ##args) ++ pr_info("xen_tpm_fr: " fmt, ##args) + #define WPRINTK(fmt, args...) \ +- printk(KERN_WARNING "xen_tpm_fr: " fmt, ##args) ++ pr_warning("xen_tpm_fr: " fmt, ##args) ---- head.orig/drivers/xen/xenbus/xenbus_comms.c 2011-04-11 14:52:53.000000000 +0200 -+++ head/drivers/xen/xenbus/xenbus_comms.c 2011-04-11 15:00:27.000000000 +0200 -@@ -238,13 +238,13 @@ int xb_init_comms(void) - int err; - if (intf->req_prod != intf->req_cons) -- printk(KERN_ERR "XENBUS request ring is not quiescent " -+ pr_err("XENBUS request ring is not quiescent " - "(%08x:%08x)!\n", intf->req_cons, intf->req_prod); + static inline int +--- a/drivers/cpuidle/Kconfig ++++ b/drivers/cpuidle/Kconfig +@@ -1,6 +1,7 @@ - if (intf->rsp_prod != intf->rsp_cons) { -- printk(KERN_WARNING "XENBUS response ring is not quiescent " -- "(%08x:%08x): fixing up\n", -- intf->rsp_cons, intf->rsp_prod); -+ pr_warning("XENBUS response ring is not quiescent" -+ " (%08x:%08x): fixing up\n", -+ intf->rsp_cons, intf->rsp_prod); - /* breaks kdump */ - if (!reset_devices) - intf->rsp_cons = intf->rsp_prod; -@@ -261,7 +261,7 @@ int xb_init_comms(void) - xen_store_evtchn, wake_waiting, - 0, "xenbus", &xb_waitq); - if (err <= 0) { -- printk(KERN_ERR "XENBUS request irq failed %i\n", err); -+ pr_err("XENBUS request irq failed %i\n", err); - return err; - } + config CPU_IDLE + bool "CPU idle PM support" ++ depends on !PROCESSOR_EXTERNAL_CONTROL + default y if ACPI || PPC_PSERIES + help + CPU idle is a generic framework for supporting software-controlled +--- a/drivers/dma/Kconfig ++++ b/drivers/dma/Kconfig +@@ -62,7 +62,7 @@ config INTEL_IOATDMA + tristate "Intel I/OAT DMA support" + depends on PCI && X86 + select DMA_ENGINE +- select DCA ++ select DCA if !XEN + select ASYNC_TX_DISABLE_PQ_VAL_DMA + select ASYNC_TX_DISABLE_XOR_VAL_DMA + help +--- a/drivers/dma/ioat/Makefile ++++ b/drivers/dma/ioat/Makefile +@@ -1,2 +1,3 @@ + obj-$(CONFIG_INTEL_IOATDMA) += ioatdma.o +-ioatdma-y := pci.o dma.o dma_v2.o dma_v3.o dca.o ++dca-$(CONFIG_DCA) := dca.o ++ioatdma-y := pci.o dma.o dma_v2.o dma_v3.o $(dca-y) $(dca-m) +--- a/drivers/dma/ioat/dca.c ++++ b/drivers/dma/ioat/dca.c +@@ -702,3 +702,15 @@ struct dca_provider *ioat3_dca_init(stru ---- head.orig/drivers/xen/xenbus/xenbus_probe.c 2012-03-12 13:39:04.000000000 +0100 -+++ head/drivers/xen/xenbus/xenbus_probe.c 2012-03-12 13:39:39.000000000 +0100 -@@ -112,13 +112,13 @@ static int frontend_bus_id(char bus_id[X - { - nodename = strchr(nodename, '/'); - if (!nodename || strlen(nodename + 1) >= XEN_BUS_ID_SIZE) { -- printk(KERN_WARNING "XENBUS: bad frontend %s\n", nodename); -+ pr_warning("XENBUS: bad frontend %s\n", nodename); - return -EINVAL; - } + return dca; + } ++ ++void ioat_remove_dca_provider(struct pci_dev *pdev) ++{ ++ struct ioatdma_device *device = pci_get_drvdata(pdev); ++ ++ if (!device->dca) ++ return; ++ ++ unregister_dca_provider(device->dca, &pdev->dev); ++ free_dca_provider(device->dca); ++ device->dca = NULL; ++} +--- a/drivers/dma/ioat/dma.h ++++ b/drivers/dma/ioat/dma.h +@@ -324,4 +324,22 @@ void ioat_kobject_del(struct ioatdma_dev + extern const struct sysfs_ops ioat_sysfs_ops; + extern struct ioat_sysfs_entry ioat_version_attr; + extern struct ioat_sysfs_entry ioat_cap_attr; ++ ++#ifndef CONFIG_XEN ++void ioat_remove_dca_provider(struct pci_dev *); ++#else ++static inline void ioat_remove_dca_provider(struct pci_dev *pdev) ++{ ++ struct ioatdma_device *device = pci_get_drvdata(pdev); ++ BUG_ON(device->dca); ++} ++static inline struct dca_provider *__devinit ++__ioat_dca_init(struct pci_dev *pdev, void __iomem *iobase) ++{ ++ return NULL; ++} ++#define ioat_dca_init __ioat_dca_init ++#define ioat2_dca_init __ioat_dca_init ++#endif ++ + #endif /* IOATDMA_H */ +--- a/drivers/dma/ioat/pci.c ++++ b/drivers/dma/ioat/pci.c +@@ -29,7 +29,6 @@ + #include + #include + #include +-#include + #include + #include "dma.h" + #include "dma_v2.h" +@@ -191,11 +190,7 @@ static void ioat_remove(struct pci_dev * + return; - strlcpy(bus_id, nodename + 1, XEN_BUS_ID_SIZE); - if (!strchr(bus_id, '/')) { -- printk(KERN_WARNING "XENBUS: bus_id %s no slash\n", bus_id); -+ pr_warning("XENBUS: bus_id %s no slash\n", bus_id); - return -EINVAL; - } - *strchr(bus_id, '/') = '-'; -@@ -176,11 +176,9 @@ static int read_backend_details(struct x + dev_err(&pdev->dev, "Removing dma and dca services\n"); +- if (device->dca) { +- unregister_dca_provider(device->dca, &pdev->dev); +- free_dca_provider(device->dca); +- device->dca = NULL; +- } ++ ioat_remove_dca_provider(pdev); + ioat_dma_remove(device); } - #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) && (defined(CONFIG_XEN) || defined(MODULE)) --static int xenbus_uevent_frontend(struct device *dev, char **envp, -- int num_envp, char *buffer, int buffer_size) -+static int xenbus_uevent_frontend(struct device *dev, struct kobj_uevent_env *env) - { - struct xenbus_device *xdev; -- int length = 0, i = 0; +--- a/drivers/firmware/dell_rbu.c ++++ b/drivers/firmware/dell_rbu.c +@@ -175,9 +175,8 @@ static int create_packet(void *data, siz + (unsigned long)packet_data_temp_buf, ordernum, 0)) { + free_pages((unsigned long)packet_data_temp_buf, + ordernum); +- printk(KERN_WARNING +- "dell_rbu:%s: failed to adjust new " +- "packet\n", __func__); ++ pr_warning("dell_rbu:%s: failed to adjust new " ++ "packet\n", __func__); + retval = -ENOMEM; + spin_lock(&rbu_data.lock); + goto out_alloc_packet_array; +--- a/drivers/hwmon/coretemp-xen.c ++++ b/drivers/hwmon/coretemp-xen.c +@@ -49,7 +49,7 @@ static struct coretemp_data *coretemp_up + struct pdev_entry { + struct list_head list; + struct platform_device *pdev; +- struct class_device *class_dev; ++ struct device *hwmon_dev; + struct mutex update_lock; + const char *name; + u8 x86_model, x86_mask; +@@ -61,8 +61,6 @@ struct pdev_entry { + u8 alarm; + }; - if (dev == NULL) - return -ENODEV; -@@ -189,12 +187,9 @@ static int xenbus_uevent_frontend(struct - return -ENODEV; +-static struct coretemp_data *coretemp_update_device(struct device *dev); +- + /* + * Sysfs stuff + */ +@@ -224,9 +222,9 @@ static int coretemp_probe(struct platfor + if ((err = sysfs_create_group(&pdev->dev.kobj, &coretemp_group))) + return err; - /* stuff we want to pass to /sbin/hotplug */ -- add_uevent_var(envp, num_envp, &i, buffer, buffer_size, &length, -- "XENBUS_TYPE=%s", xdev->devicetype); -- add_uevent_var(envp, num_envp, &i, buffer, buffer_size, &length, -- "XENBUS_PATH=%s", xdev->nodename); -- add_uevent_var(envp, num_envp, &i, buffer, buffer_size, &length, -- "MODALIAS=xen:%s", xdev->devicetype); -+ add_uevent_var(env, "XENBUS_TYPE=%s", xdev->devicetype); -+ add_uevent_var(env, "XENBUS_PATH=%s", xdev->nodename); -+ add_uevent_var(env, "MODALIAS=xen:%s", xdev->devicetype); +- data->class_dev = hwmon_device_register(&pdev->dev); +- if (IS_ERR(data->class_dev)) { +- err = PTR_ERR(data->class_dev); ++ data->hwmon_dev = hwmon_device_register(&pdev->dev); ++ if (IS_ERR(data->hwmon_dev)) { ++ err = PTR_ERR(data->hwmon_dev); + dev_err(&pdev->dev, "Class registration failed (%d)\n", + err); + goto exit_class; +@@ -243,7 +241,7 @@ static int coretemp_remove(struct platfo + { + struct coretemp_data *data = platform_get_drvdata(pdev); +- hwmon_device_unregister(data->class_dev); ++ hwmon_device_unregister(data->hwmon_dev); + sysfs_remove_group(&pdev->dev.kobj, &coretemp_group); return 0; } -@@ -751,8 +746,8 @@ static int suspend_dev(struct device *de - if (drv->suspend) - err = drv->suspend(xdev); +@@ -315,9 +313,10 @@ static int coretemp_device_add(unsigned if (err) -- printk(KERN_WARNING -- "xenbus: suspend %s failed: %i\n", dev->bus_id, err); -+ pr_warning("xenbus: suspend %s failed: %i\n", -+ dev->bus_id, err); - return 0; + goto exit_entry_free; + +- /* check if family 6, models e, f */ ++ /* check if family 6, models e, f, 16 */ + if (info.x86 != 0x6 || +- !((pdev_entry->x86_model == 0xe) || (pdev_entry->x86_model == 0xf))) { ++ !((pdev_entry->x86_model == 0xe) || (pdev_entry->x86_model == 0xf) || ++ (pdev_entry->x86_model == 0x16))) { + + /* supported CPU not found, but report the unknown + family 6 CPU */ +--- a/drivers/oprofile/cpu_buffer.c ++++ b/drivers/oprofile/cpu_buffer.c +@@ -425,6 +425,39 @@ void oprofile_add_pc(unsigned long pc, i + log_sample(cpu_buf, pc, 0, is_kernel, event, NULL); } -@@ -771,9 +766,8 @@ static int suspend_cancel_dev(struct dev - if (drv->suspend_cancel) - err = drv->suspend_cancel(xdev); - if (err) -- printk(KERN_WARNING -- "xenbus: suspend_cancel %s failed: %i\n", -- dev->bus_id, err); -+ pr_warning("xenbus: suspend_cancel %s failed: %i\n", -+ dev->bus_id, err); - return 0; ++#ifdef CONFIG_XEN ++/* ++ * This is basically log_sample(b, ESCAPE_CODE, cpu_mode, CPU_TRACE_BEGIN), ++ * as was previously accessible through oprofile_add_pc(). ++ */ ++void oprofile_add_mode(int cpu_mode) ++{ ++ struct oprofile_cpu_buffer *cpu_buf = &__get_cpu_var(cpu_buffer); ++ struct task_struct *task; ++ ++ if (nr_available_slots(cpu_buf) < 3) { ++ cpu_buf->sample_lost_overflow++; ++ return; ++ } ++ ++ task = current; ++ ++ /* notice a switch from user->kernel or vice versa */ ++ if (cpu_buf->last_cpu_mode != cpu_mode) { ++ cpu_buf->last_cpu_mode = cpu_mode; ++ add_code(cpu_buf, cpu_mode); ++ } ++ ++ /* notice a task switch */ ++ if (cpu_buf->last_task != task) { ++ cpu_buf->last_task = task; ++ add_code(cpu_buf, (unsigned long)task); ++ } ++ ++ add_code(cpu_buf, CPU_TRACE_BEGIN); ++} ++#endif ++ + void oprofile_add_trace(unsigned long pc) + { + struct oprofile_cpu_buffer *cpu_buf = &__get_cpu_var(op_cpu_buffer); +--- a/drivers/pci/msi-xen.c ++++ b/drivers/pci/msi-xen.c +@@ -277,6 +277,12 @@ static int msi_map_vector(struct pci_dev + map_irq.pirq : evtchn_map_pirq(-1, map_irq.pirq)); } -@@ -793,9 +787,8 @@ static int resume_dev(struct device *dev ++static void pci_intx_for_msi(struct pci_dev *dev, int enable) ++{ ++ if (!(dev->dev_flags & PCI_DEV_FLAGS_MSI_INTX_DISABLE_BUG)) ++ pci_intx(dev, enable); ++} ++ + #ifdef CONFIG_PM + void pci_restore_msi_state(struct pci_dev *dev) + { +@@ -285,7 +291,7 @@ void pci_restore_msi_state(struct pci_de + if (!dev->msi_enabled && !dev->msix_enabled) + return; - err = talk_to_otherend(xdev); - if (err) { -- printk(KERN_WARNING -- "xenbus: resume (talk_to_otherend) %s failed: %i\n", -- dev->bus_id, err); -+ pr_warning("xenbus: resume (talk_to_otherend) %s failed: %i\n", -+ dev->bus_id, err); - return err; - } +- pci_intx(dev, 0); /* disable intx */ ++ pci_intx_for_msi(dev, 0); + if (dev->msi_enabled) + msi_set_enable(dev, 0); + if (dev->msix_enabled) +@@ -340,7 +346,7 @@ static int msi_capability_init(struct pc + return -EBUSY; -@@ -804,18 +797,16 @@ static int resume_dev(struct device *dev - if (drv->resume) { - err = drv->resume(xdev); - if (err) { -- printk(KERN_WARNING -- "xenbus: resume %s failed: %i\n", -- dev->bus_id, err); -+ pr_warning("xenbus: resume %s failed: %i\n", -+ dev->bus_id, err); - return err; - } - } + /* Set MSI enabled bits */ +- pci_intx(dev, 0); /* disable intx */ ++ pci_intx_for_msi(dev, 0); + msi_set_enable(dev, 1); + dev->msi_enabled = 1; - err = watch_otherend(xdev); - if (err) { -- printk(KERN_WARNING -- "xenbus_probe: resume (watch_otherend) %s failed: " -- "%d.\n", dev->bus_id, err); -+ pr_warning("xenbus_probe: resume (watch_otherend) %s failed:" -+ " %d\n", dev->bus_id, err); - return err; +@@ -414,7 +420,7 @@ static int msix_capability_init(struct p + return avail; } -@@ -898,7 +889,7 @@ static void xenbus_reset_wait_for_backen - timeout = wait_event_interruptible_timeout(backend_state_wq, - backend_state == expected, 5 * HZ); - if (timeout <= 0) -- printk(KERN_INFO "XENBUS: backend %s timed out.\n", be); -+ pr_info("XENBUS: backend %s timed out.\n", be); +- pci_intx(dev, 0); /* disable intx */ ++ pci_intx_for_msi(dev, 0); + msix_set_enable(dev, 1); + dev->msix_enabled = 1; + +@@ -551,7 +557,7 @@ void pci_disable_msi(struct pci_dev* dev + + /* Disable MSI mode */ + msi_set_enable(dev, 0); +- pci_intx(dev, 1); /* enable intx */ ++ pci_intx_for_msi(dev, 1); + dev->msi_enabled = 0; + } + EXPORT_SYMBOL(pci_disable_msi); +@@ -677,7 +683,7 @@ void pci_disable_msix(struct pci_dev* de + /* Disable MSI mode */ + if (is_initial_xendomain()) { + msix_set_enable(dev, 0); +- pci_intx(dev, 1); /* enable intx */ ++ pci_intx_for_msi(dev, 1); + } + dev->msix_enabled = 0; } +--- a/drivers/xen/balloon/balloon.c ++++ b/drivers/xen/balloon/balloon.c +@@ -118,10 +118,8 @@ static DECLARE_WORK(balloon_worker, ball + PAGE_TO_LIST(p)->prev = NULL; \ + } while(0) - /* -@@ -921,7 +912,7 @@ static void xenbus_reset_frontend(char * - be_watch.callback = xenbus_reset_backend_state_changed; - backend_state = XenbusStateUnknown; +-#define IPRINTK(fmt, args...) \ +- printk(KERN_INFO "xen_mem: " fmt, ##args) +-#define WPRINTK(fmt, args...) \ +- printk(KERN_WARNING "xen_mem: " fmt, ##args) ++#define IPRINTK(fmt, args...) pr_info("xen_mem: " fmt, ##args) ++#define WPRINTK(fmt, args...) pr_warning("xen_mem: " fmt, ##args) -- printk(KERN_INFO "XENBUS: triggering reconnect on %s\n", be); -+ pr_info("XENBUS: triggering reconnect on %s\n", be); - register_xenbus_watch(&be_watch); + /* balloon_append: add the given page to the balloon. */ + static void balloon_append(struct page *page, int account) +@@ -317,6 +315,8 @@ static int increase_reservation(unsigned - /* fall through to forward backend to state XenbusStateInitialising */ -@@ -940,7 +931,7 @@ static void xenbus_reset_frontend(char * - } + #ifndef MODULE + setup_per_zone_pages_min(); ++ if (rc > 0) ++ kswapd_run(0); + if (need_zonelists_rebuild) + build_all_zonelists(); + else +@@ -468,7 +468,7 @@ static int balloon_init_watcher(struct n - unregister_xenbus_watch(&be_watch); -- printk(KERN_INFO "XENBUS: reconnect done on %s\n", be); -+ pr_info("XENBUS: reconnect done on %s\n", be); - kfree(be_watch.node); - } + err = register_xenbus_watch(&target_watch); + if (err) +- printk(KERN_ERR "Failed to set balloon watcher\n"); ++ pr_err("Failed to set balloon watcher\n"); -@@ -1129,9 +1120,8 @@ int xenbus_conn(domid_t remote_dom, gran - fail1: - rc2 = xb_free_port(xen_store_evtchn); - if (rc2 != 0) -- printk(KERN_WARNING -- "XENBUS: Error freeing xenstore event channel: %d\n", -- rc2); -+ pr_warning("XENBUS: Error freeing xenstore event channel:" -+ " %d\n", rc2); - fail0: - xen_store_evtchn = -1; - return rc; -@@ -1160,9 +1150,8 @@ xenbus_probe_init(void) - /* Register ourselves with the kernel bus subsystem */ - xenbus_frontend.error = bus_register(&xenbus_frontend.bus); - if (xenbus_frontend.error) -- printk(KERN_WARNING -- "XENBUS: Error registering frontend bus: %i\n", -- xenbus_frontend.error); -+ pr_warning("XENBUS: Error registering frontend bus: %i\n", -+ xenbus_frontend.error); - xenbus_backend_bus_register(); + return NOTIFY_DONE; + } +--- a/drivers/xen/blkback/blkback-pagemap.c ++++ b/drivers/xen/blkback/blkback-pagemap.c +@@ -38,8 +38,8 @@ blkback_pagemap_set(int idx, struct page - /* -@@ -1237,8 +1226,8 @@ xenbus_probe_init(void) - /* Initialize the interface to xenstore. */ - err = xs_init(); - if (err) { -- printk(KERN_WARNING -- "XENBUS: Error initializing xenstore comms: %i\n", err); -+ pr_warning("XENBUS: Error initializing xenstore comms: %i\n", -+ err); - goto err; + entry = blkback_pagemap + idx; + if (!blkback_pagemap_entry_clear(entry)) { +- printk("overwriting pagemap %d: d %u b %u g %u\n", +- idx, entry->domid, entry->busid, entry->gref); ++ pr_emerg("overwriting pagemap %d: d %u b %u g %u\n", ++ idx, entry->domid, entry->busid, entry->gref); + BUG(); } -@@ -1248,9 +1237,8 @@ xenbus_probe_init(void) - xenbus_frontend.error = device_register(&xenbus_frontend.dev); - if (xenbus_frontend.error) { - bus_unregister(&xenbus_frontend.bus); -- printk(KERN_WARNING -- "XENBUS: Error registering frontend device: %i\n", -- xenbus_frontend.error); -+ pr_warning("XENBUS: Error registering frontend device:" -+ " %d\n", xenbus_frontend.error); - } - } - #endif -@@ -1332,8 +1320,8 @@ static int print_device_status(struct de +@@ -63,7 +63,7 @@ blkback_pagemap_clear(struct page *page) - if (!dev->driver) { - /* Information only: is this too noisy? */ -- printk(KERN_INFO "XENBUS: Device with no driver: %s\n", -- xendev->nodename); -+ pr_info("XENBUS: Device with no driver: %s\n", -+ xendev->nodename); - return 0; + entry = blkback_pagemap + idx; + if (blkback_pagemap_entry_clear(entry)) { +- printk("clearing empty pagemap %d\n", idx); ++ pr_emerg("clearing empty pagemap %d\n", idx); + BUG(); } -@@ -1341,15 +1329,15 @@ static int print_device_status(struct de - enum xenbus_state rstate = XenbusStateUnknown; - if (xendev->otherend) - rstate = xenbus_read_driver_state(xendev->otherend); -- printk(KERN_WARNING "XENBUS: Timeout connecting " -- "to device: %s (local state %d, remote state %d)\n", -- xendev->nodename, xendev->state, rstate); -+ pr_warning("XENBUS: Timeout connecting to device: %s" -+ " (local state %d, remote state %d)\n", -+ xendev->nodename, xendev->state, rstate); - } +@@ -85,7 +85,7 @@ blkback_pagemap_read(struct page *page) - xendrv = to_xenbus_driver(dev->driver); - if (xendrv->is_ready && !xendrv->is_ready(xendev)) -- printk(KERN_WARNING "XENBUS: Device not ready: %s\n", -- xendev->nodename); -+ pr_warning("XENBUS: Device not ready: %s\n", -+ xendev->nodename); + entry = blkback_pagemap + idx; + if (blkback_pagemap_entry_clear(entry)) { +- printk("reading empty pagemap %d\n", idx); ++ pr_emerg("reading empty pagemap %d\n", idx); + BUG(); + } - return 0; +--- a/drivers/xen/blkback/blkback.c ++++ b/drivers/xen/blkback/blkback.c +@@ -278,13 +278,10 @@ static void __end_block_io_op(pending_re + } } -@@ -1383,8 +1371,8 @@ static void wait_for_devices(struct xenb - while (exists_connecting_device(drv)) { - if (time_after(jiffies, start + (seconds_waited+5)*HZ)) { - if (!seconds_waited) -- printk(KERN_WARNING "XENBUS: Waiting for " -- "devices to initialise: "); -+ pr_warning("XENBUS: Waiting for " -+ "devices to initialise: "); - seconds_waited += 5; - printk("%us...", 300 - seconds_waited); - if (seconds_waited == 300) ---- head.orig/drivers/xen/xenbus/xenbus_probe_backend.c 2011-12-21 10:51:23.000000000 +0100 -+++ head/drivers/xen/xenbus/xenbus_probe_backend.c 2011-12-21 10:56:21.000000000 +0100 -@@ -60,8 +60,7 @@ - #include - #endif - --static int xenbus_uevent_backend(struct device *dev, char **envp, -- int num_envp, char *buffer, int buffer_size); -+static int xenbus_uevent_backend(struct device *dev, struct kobj_uevent_env *env); - static int xenbus_probe_backend(const char *type, const char *domid); - - extern int read_otherend_details(struct xenbus_device *xendev, -@@ -128,13 +127,10 @@ static struct xen_bus_type xenbus_backen - }, - }; --static int xenbus_uevent_backend(struct device *dev, char **envp, -- int num_envp, char *buffer, int buffer_size) -+static int xenbus_uevent_backend(struct device *dev, struct kobj_uevent_env *env) +-static int end_block_io_op(struct bio *bio, unsigned int done, int error) ++static void end_block_io_op(struct bio *bio, int error) { - struct xenbus_device *xdev; - struct xenbus_driver *drv; -- int i = 0; -- int length = 0; +- if (bio->bi_size != 0) +- return 1; + __end_block_io_op(bio->bi_private, error); + bio_put(bio); +- return error; + } - DPRINTK(""); -@@ -146,27 +142,16 @@ static int xenbus_uevent_backend(struct - return -ENODEV; +@@ -664,7 +661,7 @@ static int __init blkif_init(void) + kfree(pending_reqs); + kfree(pending_grant_handles); + free_empty_pages_and_pagevec(pending_pages, mmap_pages); +- printk("%s: out of memory\n", __FUNCTION__); ++ pr_warning("%s: out of memory\n", __FUNCTION__); + return -ENOMEM; + } - /* stuff we want to pass to /sbin/hotplug */ -- add_uevent_var(envp, num_envp, &i, buffer, buffer_size, &length, -- "XENBUS_TYPE=%s", xdev->devicetype); -+ add_uevent_var(env, "XENBUS_TYPE=%s", xdev->devicetype); - -- add_uevent_var(envp, num_envp, &i, buffer, buffer_size, &length, -- "XENBUS_PATH=%s", xdev->nodename); -+ add_uevent_var(env, "XENBUS_PATH=%s", xdev->nodename); - -- add_uevent_var(envp, num_envp, &i, buffer, buffer_size, &length, -- "XENBUS_BASE_PATH=%s", xenbus_backend.root); -- -- /* terminate, set to next free slot, shrink available space */ -- envp[i] = NULL; -- envp = &envp[i]; -- num_envp -= i; -- buffer = &buffer[length]; -- buffer_size -= length; -+ add_uevent_var(env, "XENBUS_BASE_PATH=%s", xenbus_backend.root); +--- a/drivers/xen/blkback/vbd.c ++++ b/drivers/xen/blkback/vbd.c +@@ -133,18 +133,18 @@ void vbd_resize(blkif_t *blkif) + struct xenbus_device *dev = blkif->be->dev; + unsigned long long new_size = vbd_size(vbd); - if (dev->driver) { - drv = to_xenbus_driver(dev->driver); - if (drv && drv->uevent) -- return drv->uevent(xdev, envp, num_envp, buffer, -- buffer_size); -+ return drv->uevent(xdev, env); +- printk(KERN_INFO "VBD Resize: new size %Lu\n", new_size); ++ pr_info("VBD Resize: new size %Lu\n", new_size); + vbd->size = new_size; + again: + err = xenbus_transaction_start(&xbt); + if (err) { +- printk(KERN_WARNING "Error starting transaction"); ++ pr_warning("Error %d starting transaction", err); + return; } - - return 0; -@@ -266,9 +251,8 @@ void xenbus_backend_bus_register(void) - { - xenbus_backend.error = bus_register(&xenbus_backend.bus); - if (xenbus_backend.error) -- printk(KERN_WARNING -- "XENBUS: Error registering backend bus: %i\n", -- xenbus_backend.error); -+ pr_warning("XENBUS: Error registering backend bus: %i\n", -+ xenbus_backend.error); - } - - void xenbus_backend_device_register(void) -@@ -279,9 +263,8 @@ void xenbus_backend_device_register(void - xenbus_backend.error = device_register(&xenbus_backend.dev); - if (xenbus_backend.error) { - bus_unregister(&xenbus_backend.bus); -- printk(KERN_WARNING -- "XENBUS: Error registering backend device: %i\n", -- xenbus_backend.error); -+ pr_warning("XENBUS: Error registering backend device: %i\n", -+ xenbus_backend.error); + err = xenbus_printf(xbt, dev->nodename, "sectors", "%Lu", + vbd_size(vbd)); + if (err) { +- printk(KERN_WARNING "Error writing new size"); ++ pr_warning("Error %d writing new size", err); + goto abort; + } + /* +@@ -154,7 +154,7 @@ again: + */ + err = xenbus_printf(xbt, dev->nodename, "state", "%d", dev->state); + if (err) { +- printk(KERN_WARNING "Error writing the state"); ++ pr_warning("Error %d writing the state", err); + goto abort; } - } ---- head.orig/drivers/xen/xenbus/xenbus_xs.c 2012-01-20 14:47:34.000000000 +0100 -+++ head/drivers/xen/xenbus/xenbus_xs.c 2012-03-12 15:30:16.000000000 +0100 -@@ -135,9 +135,8 @@ static int get_error(const char *errorst +@@ -162,7 +162,7 @@ again: + if (err == -EAGAIN) + goto again; + if (err) +- printk(KERN_WARNING "Error ending transaction"); ++ pr_warning("Error %d ending transaction", err); + return; + abort: + xenbus_transaction_end(xbt, 1); +--- a/drivers/xen/blkback/xenbus.c ++++ b/drivers/xen/blkback/xenbus.c +@@ -293,10 +293,9 @@ static void backend_changed(struct xenbu - for (i = 0; strcmp(errorstring, xsd_errors[i].errstring) != 0; i++) { - if (i == ARRAY_SIZE(xsd_errors) - 1) { -- printk(KERN_WARNING -- "XENBUS xen store gave: unknown error %s", -- errorstring); -+ pr_warning("XENBUS xen store gave: unknown error %s", -+ errorstring); - return EINVAL; - } + if (be->major | be->minor) { + if (be->major != major || be->minor != minor) +- printk(KERN_WARNING "blkback: " +- "changing physical device (from %x:%x to " +- "%x:%x) not supported.\n", +- be->major, be->minor, major, minor); ++ pr_warning("blkback: changing physical device" ++ " (from %x:%x to %x:%x) not supported\n", ++ be->major, be->minor, major, minor); + return; } -@@ -277,9 +276,9 @@ static void *xs_talkv(struct xenbus_tran - if (msg.type != type) { - if (printk_ratelimit()) -- printk(KERN_WARNING -- "XENBUS unexpected type [%d], expected [%d]\n", -- msg.type, type); -+ pr_warning("XENBUS unexpected type [%d]," -+ " expected [%d]\n", -+ msg.type, type); - kfree(ret); - return ERR_PTR(-EINVAL); +@@ -358,8 +357,8 @@ static void frontend_changed(struct xenb + switch (frontend_state) { + case XenbusStateInitialising: + if (dev->state == XenbusStateClosed) { +- printk(KERN_INFO "%s: %s: prepare for reconnect\n", +- __FUNCTION__, dev->nodename); ++ pr_info("%s: %s: prepare for reconnect\n", ++ __FUNCTION__, dev->nodename); + xenbus_switch_state(dev, XenbusStateInitWait); + } + break; +@@ -505,10 +504,9 @@ static int connect_ring(struct backend_i + kfree(protocol); + return -1; } -@@ -637,7 +636,7 @@ static void xs_reset_watches(void) - - err = xs_error(xs_single(XBT_NIL, XS_RESET_WATCHES, "", NULL)); - if (err && err != -EEXIST) -- printk(KERN_WARNING "xs_reset_watches failed: %d\n", err); -+ pr_warning("xs_reset_watches failed: %d\n", err); - #endif - } +- printk(KERN_INFO +- "blkback: ring-ref %u, event-channel %u, protocol %d (%s)\n", +- ring_ref, evtchn, be->blkif->blk_protocol, +- protocol ?: "unspecified, assuming native"); ++ pr_info("blkback: ring-ref %u, event-channel %u, protocol %d (%s)\n", ++ ring_ref, evtchn, be->blkif->blk_protocol, ++ protocol ?: "unspecified, assuming native"); + kfree(protocol); -@@ -692,9 +691,8 @@ void unregister_xenbus_watch(struct xenb + /* Map the shared frame, irq etc. */ +--- a/drivers/xen/blkfront/blkfront.c ++++ b/drivers/xen/blkfront/blkfront.c +@@ -233,7 +233,7 @@ static int setup_blkring(struct xenbus_d + SHARED_RING_INIT(sring); + FRONT_RING_INIT(&info->ring, sring, PAGE_SIZE); - err = xs_unwatch(watch->node, token); - if (err) -- printk(KERN_WARNING -- "XENBUS Failed to release watch %s: %i\n", -- watch->node, err); -+ pr_warning("XENBUS Failed to release watch %s: %i\n", -+ watch->node, err); +- memset(info->sg, 0, sizeof(info->sg)); ++ sg_init_table(info->sg, BLKIF_MAX_SEGMENTS_PER_REQUEST); - up_read(&xs_state.watch_mutex); + err = xenbus_grant_ring(dev, virt_to_mfn(info->ring.sring)); + if (err < 0) { +@@ -339,8 +339,7 @@ static void connect(struct blkfront_info + "sectors", "%Lu", §ors); + if (err != 1) + return; +- printk(KERN_INFO "Setting capacity to %Lu\n", +- sectors); ++ pr_info("Setting capacity to %Lu\n", sectors); + set_capacity(info->gd, sectors); -@@ -930,8 +928,8 @@ static int xenbus_thread(void *unused) - for (;;) { - err = process_msg(); - if (err) -- printk(KERN_WARNING "XENBUS error %d while reading " -- "message\n", err); -+ pr_warning("XENBUS error %d while reading " -+ "message\n", err); - if (kthread_should_stop()) - break; - } ---- head.orig/drivers/xen/xenoprof/xenoprofile.c 2011-01-31 17:49:31.000000000 +0100 -+++ head/drivers/xen/xenoprof/xenoprofile.c 2012-02-16 12:31:04.000000000 +0100 -@@ -28,7 +28,6 @@ - #include - #include - #include --#include "../../../drivers/oprofile/cpu_buffer.h" - #include "../../../drivers/oprofile/event_buffer.h" + /* fall through */ +@@ -620,8 +619,6 @@ int blkif_ioctl(struct inode *inode, str + } + } - #define MAX_XENOPROF_SAMPLES 16 -@@ -145,8 +144,7 @@ static void xenoprof_add_pc(xenoprof_buf - if (xenoprof_is_escape(buf, tail) && - xenoprof_get_event(buf, tail) == XENOPROF_TRACE_BEGIN) { - tracing=1; -- oprofile_add_pc(ESCAPE_CODE, buf->event_log[tail].mode, -- CPU_TRACE_BEGIN); -+ oprofile_add_mode(buf->event_log[tail].mode); - if (!is_passive) - oprofile_samples++; - else -@@ -569,8 +567,8 @@ int __init xenoprofile_init(struct oprof - active_defined = 0; +- /*printk(KERN_ALERT "ioctl %08x not supported by Xen blkdev\n", +- command);*/ + return -EINVAL; /* same return as native Linux */ } -- printk(KERN_INFO "%s: ret %d, events %d, xenoprof_is_primary %d\n", -- __func__, ret, init.num_events, xenoprof_is_primary); -+ pr_info("%s: ret %d, events %d, xenoprof_is_primary %d\n", -+ __func__, ret, init.num_events, xenoprof_is_primary); - return ret; - } +@@ -696,9 +693,8 @@ static int blkif_queue_request(struct re ---- head.orig/arch/x86/include/asm/acpi.h 2013-03-21 12:25:09.000000000 +0100 -+++ head/arch/x86/include/asm/acpi.h 2013-03-21 14:20:18.000000000 +0100 -@@ -31,7 +31,7 @@ - #include - #include + ring_req->nr_segments = blk_rq_map_sg(req->q, req, info->sg); + BUG_ON(ring_req->nr_segments > BLKIF_MAX_SEGMENTS_PER_REQUEST); +- for (i = 0; i < ring_req->nr_segments; ++i) { +- sg = info->sg + i; +- buffer_mfn = page_to_phys(sg->page) >> PAGE_SHIFT; ++ for_each_sg(info->sg, sg, ring_req->nr_segments, i) { ++ buffer_mfn = page_to_phys(sg_page(sg)) >> PAGE_SHIFT; + fsect = sg->offset >> 9; + lsect = fsect + (sg->length >> 9) - 1; + /* install a grant reference. */ +@@ -815,10 +811,10 @@ static irqreturn_t blkif_int(int irq, vo + * we would never have given to it (we stamp it up to + * BLK_RING_SIZE - see GET_ID_FROM_FREELIST()). + */ +- printk(KERN_WARNING +- "%s: response to %s has incorrect id (%#Lx)\n", +- info->gd->disk_name, op_name(bret->operation), +- (unsigned long long)bret->id); ++ pr_warning("%s: response to %s has incorrect id (%#Lx)\n", ++ info->gd->disk_name, ++ op_name(bret->operation), ++ (unsigned long long)bret->id); + continue; + } + id = bret->id; +@@ -828,10 +824,9 @@ static irqreturn_t blkif_int(int irq, vo --#ifdef CONFIG_XEN -+#ifdef CONFIG_XEN_PRIVILEGED_GUEST - #include - #endif + ret = ADD_ID_TO_FREELIST(info, id); + if (unlikely(ret)) { +- printk(KERN_WARNING +- "%s: id %#lx (response to %s) couldn't be recycled (%d)!\n", +- info->gd->disk_name, id, +- op_name(bret->operation), ret); ++ pr_warning("%s: id %#lx (response to %s) couldn't be recycled (%d)!\n", ++ info->gd->disk_name, id, ++ op_name(bret->operation), ret); + continue; + } -@@ -120,7 +120,7 @@ extern int acpi_suspend_lowlevel(void); - /* Physical address to resume after wakeup */ - #define acpi_wakeup_address ((unsigned long)(real_mode_header->wakeup_start)) +@@ -839,10 +834,9 @@ static irqreturn_t blkif_int(int irq, vo + switch (bret->operation) { + case BLKIF_OP_WRITE_BARRIER: + if (unlikely(bret->status == BLKIF_RSP_EOPNOTSUPP)) { +- printk(KERN_WARNING +- "blkfront: %s: %s op failed\n", +- info->gd->disk_name, +- op_name(bret->operation)); ++ pr_warning("blkfront: %s: %s op failed\n", ++ info->gd->disk_name, ++ op_name(bret->operation)); + uptodate = -EOPNOTSUPP; + info->feature_barrier = 0; + xlvbd_barrier(info); +--- a/drivers/xen/blkfront/block.h ++++ b/drivers/xen/blkfront/block.h +@@ -60,7 +60,7 @@ + #define DPRINTK(_f, _a...) pr_debug(_f, ## _a) --#ifdef CONFIG_XEN -+#ifdef CONFIG_XEN_PRIVILEGED_GUEST - static inline int acpi_notify_hypervisor_state(u8 sleep_state, - u32 pm1a_cnt_val, - u32 pm1b_cnt_val) -@@ -139,13 +139,14 @@ static inline int acpi_notify_hypervisor + #if 0 +-#define DPRINTK_IOCTL(_f, _a...) printk(KERN_ALERT _f, ## _a) ++#define DPRINTK_IOCTL(_f, _a...) pr_alert(_f, ## _a) + #else + #define DPRINTK_IOCTL(_f, _a...) ((void)0) + #endif +--- a/drivers/xen/blkfront/vbd.c ++++ b/drivers/xen/blkfront/vbd.c +@@ -208,7 +208,8 @@ xlbd_alloc_major_info(int major, int min + return NULL; + } - return HYPERVISOR_platform_op(&op); - } --#endif /* CONFIG_XEN */ -+#endif +- printk("xen-vbd: registered block device major %i\n", ptr->major); ++ pr_info("xen-vbd: registered block device major %i\n", ++ ptr->major); + } - /* - * Check if the CPU can handle C2 and deeper - */ - static inline unsigned int acpi_processor_cstate_check(unsigned int max_cstate) + ptr->minors = minors; +@@ -276,9 +277,8 @@ xlbd_release_major_info(void) + if (!mi) + continue; + if (mi->usage) +- printk(KERN_WARNING +- "vbd: major %u still in use (%u times)\n", +- mi->major, mi->usage); ++ pr_warning("vbd: major %u still in use (%u times)\n", ++ mi->major, mi->usage); + if (mi->major != XENVBD_MAJOR || !vbd_done) { + unregister_blkdev(mi->major, mi->type->devname); + kfree(mi->minors->bitmap); +@@ -483,7 +483,8 @@ xlvbd_add(blkif_sector_t capacity, int v + + if ((vdevice>>EXT_SHIFT) > 1) { + /* this is above the extended range; something is wrong */ +- printk(KERN_WARNING "blkfront: vdevice 0x%x is above the extended range; ignoring\n", vdevice); ++ pr_warning("blkfront: vdevice %#x is above the extended" ++ " range; ignoring\n", vdevice); + return -ENODEV; + } + +@@ -495,8 +496,8 @@ xlvbd_add(blkif_sector_t capacity, int v + major = XENVBD_MAJOR; + minor = BLKIF_MINOR_EXT(vdevice); + if (minor >> MINORBITS) { +- printk(KERN_WARNING "blkfront: %#x's minor (%#x)" +- " out of range; ignoring\n", vdevice, minor); ++ pr_warning("blkfront: %#x's minor (%#x) out of range;" ++ " ignoring\n", vdevice, minor); + return -ENODEV; + } + } +@@ -547,15 +548,16 @@ xlvbd_barrier(struct blkfront_info *info + info->feature_barrier ? QUEUE_ORDERED_DRAIN : QUEUE_ORDERED_NONE, NULL); + if (err) + return err; +- printk(KERN_INFO "blkfront: %s: barriers %s\n", +- info->gd->disk_name, info->feature_barrier ? "enabled" : "disabled"); ++ pr_info("blkfront: %s: barriers %s\n", ++ info->gd->disk_name, ++ info->feature_barrier ? "enabled" : "disabled"); + return 0; + } + #else + int + xlvbd_barrier(struct blkfront_info *info) { -+#ifndef CONFIG_PROCESSOR_EXTERNAL_CONTROL - /* - * Early models (<=5) of AMD Opterons are not supposed to go into - * C2 state. -@@ -160,6 +161,7 @@ static inline unsigned int acpi_processo - else if (amd_e400_c1e_detected) - return 1; - else -+#endif - return max_cstate; +- printk(KERN_INFO "blkfront: %s: barriers disabled\n", info->gd->disk_name); ++ pr_info("blkfront: %s: barriers disabled\n", info->gd->disk_name); + return -ENOSYS; } + #endif +--- a/drivers/xen/blktap/blktap.c ++++ b/drivers/xen/blktap/blktap.c +@@ -794,8 +794,8 @@ static int blktap_ioctl(struct inode *in + case BLKTAP_IOCTL_PRINT_IDXS: + { + if (info) { +- printk("User Rings: \n-----------\n"); +- printk("UF: rsp_cons: %2d, req_prod_prv: %2d " ++ pr_info("User Rings: \n-----------\n"); ++ pr_info("UF: rsp_cons: %2d, req_prod_prv: %2d " + "| req_prod: %2d, rsp_prod: %2d\n", + info->ufe_ring.rsp_cons, + info->ufe_ring.req_prod_pvt, +--- a/drivers/xen/blktap/common.h ++++ b/drivers/xen/blktap/common.h +@@ -41,8 +41,7 @@ + __FILE__ , __LINE__ , ## _a ) ---- head.orig/arch/x86/include/mach-xen/asm/agp.h 2007-06-22 09:08:06.000000000 +0200 -+++ head/arch/x86/include/mach-xen/asm/agp.h 2011-01-31 17:56:27.000000000 +0100 -@@ -1,20 +1,22 @@ --#ifndef AGP_H --#define AGP_H 1 -+#ifndef _ASM_X86_AGP_H -+#define _ASM_X86_AGP_H + #define WPRINTK(fmt, args...) \ +- ((void)(printk_ratelimit() && \ +- printk(KERN_WARNING "blktap: " fmt, ##args))) ++ ((void)(printk_ratelimit() && pr_warning("blktap: " fmt, ##args))) - #include - #include - #include + struct backend_info; --/* -- * Functions to keep the agpgart mappings coherent with the MMU. -- * The GART gives the CPU a physical alias of pages in memory. The alias region is -- * mapped uncacheable. Make sure there are no conflicting mappings -- * with different cachability attributes for the same page. This avoids -- * data corruption on some CPUs. -+/* -+ * Functions to keep the agpgart mappings coherent with the MMU. The -+ * GART gives the CPU a physical alias of pages in memory. The alias -+ * region is mapped uncacheable. Make sure there are no conflicting -+ * mappings with different cachability attributes for the same -+ * page. This avoids data corruption on some CPUs. - */ +--- a/drivers/xen/blktap/xenbus.c ++++ b/drivers/xen/blktap/xenbus.c +@@ -354,8 +354,8 @@ static void tap_frontend_changed(struct + switch (frontend_state) { + case XenbusStateInitialising: + if (dev->state == XenbusStateClosed) { +- printk(KERN_INFO "%s: %s: prepare for reconnect\n", +- __FUNCTION__, dev->nodename); ++ pr_info("%s: %s: prepare for reconnect\n", ++ __FUNCTION__, dev->nodename); + xenbus_switch_state(dev, XenbusStateInitWait); + } + break; +@@ -457,10 +457,9 @@ static int connect_ring(struct backend_i + kfree(protocol); + return -1; + } +- printk(KERN_INFO +- "blktap: ring-ref %u, event-channel %u, protocol %d (%s)\n", +- ring_ref, evtchn, be->blkif->blk_protocol, +- protocol ?: "unspecified, assuming native"); ++ pr_info("blktap: ring-ref %u, event-channel %u, protocol %d (%s)\n", ++ ring_ref, evtchn, be->blkif->blk_protocol, ++ protocol ?: "unspecified, assuming native"); + kfree(protocol); --/* Caller's responsibility to call global_flush_tlb() for -- * performance reasons */ -+/* -+ * Caller's responsibility to call global_flush_tlb() for performance -+ * reasons -+ */ - #define map_page_into_agp(page) ( \ - xen_create_contiguous_region((unsigned long)page_address(page), 0, 32) \ - ?: change_page_attr(page, 1, PAGE_KERNEL_NOCACHE)) -@@ -24,9 +26,11 @@ - change_page_attr(page, 1, PAGE_KERNEL)) - #define flush_agp_mappings() global_flush_tlb() + /* Map the shared frame, irq etc. */ +--- a/drivers/xen/blktap2/control.c ++++ b/drivers/xen/blktap2/control.c +@@ -18,6 +18,7 @@ blktap_control_initialize_tap(struct blk + memset(tap, 0, sizeof(*tap)); + set_bit(BLKTAP_CONTROL, &tap->dev_inuse); + init_rwsem(&tap->tap_sem); ++ sg_init_table(tap->sg, BLKIF_MAX_SEGMENTS_PER_REQUEST); + init_waitqueue_head(&tap->wq); + atomic_set(&tap->refcnt, 0); --/* Could use CLFLUSH here if the cpu supports it. But then it would -- need to be called for each cacheline of the whole page so it may not be -- worth it. Would need a page for it. */ -+/* -+ * Could use CLFLUSH here if the cpu supports it. But then it would -+ * need to be called for each cacheline of the whole page so it may -+ * not be worth it. Would need a page for it. -+ */ - #define flush_agp_cache() wbinvd() +--- a/drivers/xen/blktap2/device.c ++++ b/drivers/xen/blktap2/device.c +@@ -17,7 +17,7 @@ + #include "../blkback/blkback-pagemap.h" - /* Convert a physical address to an address suitable for the GART. */ ---- head.orig/arch/x86/include/mach-xen/asm/cmpxchg_32.h 2011-12-23 11:18:49.000000000 +0100 -+++ head/arch/x86/include/mach-xen/asm/cmpxchg_32.h 2011-12-23 11:19:52.000000000 +0100 -@@ -1,8 +1,6 @@ - #ifndef _ASM_X86_XEN_CMPXCHG_32_H - #define _ASM_X86_XEN_CMPXCHG_32_H + #if 0 +-#define DPRINTK_IOCTL(_f, _a...) printk(KERN_ALERT _f, ## _a) ++#define DPRINTK_IOCTL(_f, _a...) pr_alert(_f, ## _a) + #else + #define DPRINTK_IOCTL(_f, _a...) ((void)0) + #endif +@@ -113,8 +113,6 @@ blktap_device_ioctl(struct inode *inode, + return 0; --#include_next -- - static inline u64 get_64bit(const volatile u64 *ptr) - { - u64 res; ---- head.orig/arch/x86/include/mach-xen/asm/cmpxchg_64.h 2011-12-23 11:18:57.000000000 +0100 -+++ head/arch/x86/include/mach-xen/asm/cmpxchg_64.h 2011-12-23 11:19:55.000000000 +0100 -@@ -1,8 +1,6 @@ - #ifndef _ASM_X86_XEN_CMPXCHG_64_H - #define _ASM_X86_XEN_CMPXCHG_64_H + default: +- /*printk(KERN_ALERT "ioctl %08x not supported by Xen blkdev\n", +- command);*/ + return -EINVAL; /* same return as native Linux */ + } --#include_next -- - static inline u64 get_64bit(const volatile u64 *ptr) - { - return *ptr; ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ head/arch/x86/include/mach-xen/asm/desc.h 2011-01-31 17:56:27.000000000 +0100 -@@ -0,0 +1,5 @@ -+#ifdef CONFIG_X86_32 -+# include "desc_32.h" -+#else -+# include "desc_64.h" -+#endif ---- head.orig/arch/x86/include/mach-xen/asm/desc_64.h 2011-01-31 17:32:29.000000000 +0100 -+++ head/arch/x86/include/mach-xen/asm/desc_64.h 2011-01-31 17:56:27.000000000 +0100 -@@ -34,6 +34,18 @@ static inline void clear_LDT(void) - put_cpu(); - } +@@ -640,8 +638,7 @@ blktap_device_process_request(struct blk + request->nr_pages = 0; + blkif_req.nr_segments = blk_rq_map_sg(req->q, req, tap->sg); + BUG_ON(blkif_req.nr_segments > BLKIF_MAX_SEGMENTS_PER_REQUEST); +- for (i = 0; i < blkif_req.nr_segments; ++i) { +- sg = tap->sg + i; ++ for_each_sg(tap->sg, sg, blkif_req.nr_segments, i) { + fsect = sg->offset >> 9; + lsect = fsect + (sg->length >> 9) - 1; + nr_sects += sg->length >> 9; +@@ -652,13 +649,13 @@ blktap_device_process_request(struct blk + .first_sect = fsect, + .last_sect = lsect }; -+#ifndef CONFIG_X86_NO_TSS -+static inline unsigned long __store_tr(void) -+{ -+ unsigned long tr; -+ -+ asm volatile ("str %w0":"=r" (tr)); -+ return tr; -+} -+ -+#define store_tr(tr) (tr) = __store_tr() -+#endif -+ - /* - * This is the ldt that every process will get unless we need - * something other than this. -@@ -47,6 +59,18 @@ extern struct desc_ptr cpu_gdt_descr[]; - /* the cpu gdt accessor */ - #define cpu_gdt(_cpu) ((struct desc_struct *)cpu_gdt_descr[_cpu].address) +- if (PageBlkback(sg->page)) { ++ if (PageBlkback(sg_page(sg))) { + /* foreign page -- use xen */ + if (blktap_prep_foreign(tap, + request, + &blkif_req, + i, +- sg->page, ++ sg_page(sg), + &table)) + goto out; + } else { +@@ -666,7 +663,7 @@ blktap_device_process_request(struct blk + if (blktap_map(tap, + request, + i, +- sg->page)) ++ sg_page(sg))) + goto out; + } -+#ifndef CONFIG_XEN -+static inline void load_gdt(const struct desc_ptr *ptr) -+{ -+ asm volatile("lgdt %w0"::"m" (*ptr)); -+} -+ -+static inline void store_gdt(struct desc_ptr *ptr) -+{ -+ asm("sgdt %w0":"=m" (*ptr)); -+} -+#endif -+ - static inline void _set_gate(void *adr, unsigned type, unsigned long func, unsigned dpl, unsigned ist) - { - struct gate_struct s; -@@ -87,6 +111,16 @@ static inline void set_system_gate_ist(i - { - _set_gate(&idt_table[nr], GATE_INTERRUPT, (unsigned long) func, 3, ist); - } -+ -+static inline void load_idt(const struct desc_ptr *ptr) -+{ -+ asm volatile("lidt %w0"::"m" (*ptr)); -+} -+ -+static inline void store_idt(struct desc_ptr *dtr) -+{ -+ asm("sidt %w0":"=m" (*dtr)); -+} - #endif +--- a/drivers/xen/console/console.c ++++ b/drivers/xen/console/console.c +@@ -704,10 +704,10 @@ static int __init xencons_init(void) + tty_set_operations(xencons_driver, &xencons_ops); - static inline void set_tssldt_descriptor(void *ptr, unsigned long tss, unsigned type, ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ head/arch/x86/include/mach-xen/asm/dma-mapping.h 2011-01-31 17:56:27.000000000 +0100 -@@ -0,0 +1,5 @@ -+#ifdef CONFIG_X86_32 -+# include "dma-mapping_32.h" -+#else -+# include "dma-mapping_64.h" -+#endif ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ head/arch/x86/include/mach-xen/asm/fixmap.h 2011-01-31 17:56:27.000000000 +0100 -@@ -0,0 +1,5 @@ -+#ifdef CONFIG_X86_32 -+# include "fixmap_32.h" -+#else -+# include "fixmap_64.h" -+#endif ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ head/arch/x86/include/mach-xen/asm/hypercall.h 2012-10-31 11:11:46.000000000 +0100 -@@ -0,0 +1,424 @@ -+/****************************************************************************** -+ * hypercall.h -+ * -+ * Linux-specific hypervisor handling. -+ * -+ * Copyright (c) 2002-2004, K A Fraser -+ * -+ * 64-bit updates: -+ * Benjamin Liu -+ * Jun Nakajima -+ * -+ * This program is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU General Public License version 2 -+ * as published by the Free Software Foundation; or, when distributed -+ * separately from the Linux kernel or incorporated into other -+ * software packages, subject to the following license: -+ * -+ * Permission is hereby granted, free of charge, to any person obtaining a copy -+ * of this source file (the "Software"), to deal in the Software without -+ * restriction, including without limitation the rights to use, copy, modify, -+ * merge, publish, distribute, sublicense, and/or sell copies of the Software, -+ * and to permit persons to whom the Software is furnished to do so, subject to -+ * the following conditions: -+ * -+ * The above copyright notice and this permission notice shall be included in -+ * all copies or substantial portions of the Software. -+ * -+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -+ * IN THE SOFTWARE. -+ */ -+ -+#ifndef __HYPERCALL_H__ -+#define __HYPERCALL_H__ -+ -+#ifndef __HYPERVISOR_H__ -+# error "please don't include this file directly" -+#endif -+ -+#ifdef CONFIG_XEN_PRIVILEGED_GUEST -+# include -+# include -+#endif -+ -+#ifdef CONFIG_XEN -+#define HYPERCALL_ASM_OPERAND "%c" -+#define HYPERCALL_LOCATION(op) (hypercall_page + (op) * 32) -+#define HYPERCALL_C_OPERAND(name) "i" (HYPERCALL_LOCATION(__HYPERVISOR_##name)) -+#else -+#define HYPERCALL_ASM_OPERAND "*%" -+#define HYPERCALL_LOCATION(op) (hypercall_stubs + (op) * 32) -+#define HYPERCALL_C_OPERAND(name) "g" (HYPERCALL_LOCATION(__HYPERVISOR_##name)) -+#endif -+ -+#define HYPERCALL_ARG(arg, n) \ -+ register typeof((arg)+0) __arg##n asm(HYPERCALL_arg##n) = (arg) -+ -+#define _hypercall0(type, name) \ -+({ \ -+ type __res; \ -+ asm volatile ( \ -+ "call " HYPERCALL_ASM_OPERAND "1" \ -+ : "=a" (__res) \ -+ : HYPERCALL_C_OPERAND(name) \ -+ : "memory" ); \ -+ __res; \ -+}) -+ -+#define _hypercall1(type, name, arg) \ -+({ \ -+ type __res; \ -+ HYPERCALL_ARG(arg, 1); \ -+ asm volatile ( \ -+ "call " HYPERCALL_ASM_OPERAND "2" \ -+ : "=a" (__res), "+r" (__arg1) \ -+ : HYPERCALL_C_OPERAND(name) \ -+ : "memory" ); \ -+ __res; \ -+}) -+ -+#define _hypercall2(type, name, a1, a2) \ -+({ \ -+ type __res; \ -+ HYPERCALL_ARG(a1, 1); \ -+ HYPERCALL_ARG(a2, 2); \ -+ asm volatile ( \ -+ "call " HYPERCALL_ASM_OPERAND "3" \ -+ : "=a" (__res), "+r" (__arg1), "+r" (__arg2) \ -+ : HYPERCALL_C_OPERAND(name) \ -+ : "memory" ); \ -+ __res; \ -+}) -+ -+#define _hypercall3(type, name, a1, a2, a3) \ -+({ \ -+ type __res; \ -+ HYPERCALL_ARG(a1, 1); \ -+ HYPERCALL_ARG(a2, 2); \ -+ HYPERCALL_ARG(a3, 3); \ -+ asm volatile ( \ -+ "call " HYPERCALL_ASM_OPERAND "4" \ -+ : "=a" (__res), "+r" (__arg1), \ -+ "+r" (__arg2), "+r" (__arg3) \ -+ : HYPERCALL_C_OPERAND(name) \ -+ : "memory" ); \ -+ __res; \ -+}) -+ -+#define _hypercall4(type, name, a1, a2, a3, a4) \ -+({ \ -+ type __res; \ -+ HYPERCALL_ARG(a1, 1); \ -+ HYPERCALL_ARG(a2, 2); \ -+ HYPERCALL_ARG(a3, 3); \ -+ HYPERCALL_ARG(a4, 4); \ -+ asm volatile ( \ -+ "call " HYPERCALL_ASM_OPERAND "5" \ -+ : "=a" (__res), "+r" (__arg1), "+r" (__arg2), \ -+ "+r" (__arg3), "+r" (__arg4) \ -+ : HYPERCALL_C_OPERAND(name) \ -+ : "memory" ); \ -+ __res; \ -+}) -+ -+#define _hypercall5(type, name, a1, a2, a3, a4, a5) \ -+({ \ -+ type __res; \ -+ HYPERCALL_ARG(a1, 1); \ -+ HYPERCALL_ARG(a2, 2); \ -+ HYPERCALL_ARG(a3, 3); \ -+ HYPERCALL_ARG(a4, 4); \ -+ HYPERCALL_ARG(a5, 5); \ -+ asm volatile ( \ -+ "call " HYPERCALL_ASM_OPERAND "6" \ -+ : "=a" (__res), "+r" (__arg1), "+r" (__arg2), \ -+ "+r" (__arg3), "+r" (__arg4), "+r" (__arg5) \ -+ : HYPERCALL_C_OPERAND(name) \ -+ : "memory" ); \ -+ __res; \ -+}) -+ -+#define _hypercall(type, op, a1, a2, a3, a4, a5) \ -+({ \ -+ type __res; \ -+ HYPERCALL_ARG(a1, 1); \ -+ HYPERCALL_ARG(a2, 2); \ -+ HYPERCALL_ARG(a3, 3); \ -+ HYPERCALL_ARG(a4, 4); \ -+ HYPERCALL_ARG(a5, 5); \ -+ asm volatile ( \ -+ "call *%6" \ -+ : "=a" (__res), "+r" (__arg1), "+r" (__arg2), \ -+ "+r" (__arg3), "+r" (__arg4), "+r" (__arg5) \ -+ : "g" (HYPERCALL_LOCATION(op)) \ -+ : "memory" ); \ -+ __res; \ -+}) -+ -+#ifdef CONFIG_X86_32 -+# include "hypercall_32.h" -+#else -+# include "hypercall_64.h" -+#endif -+ -+static inline int __must_check -+HYPERVISOR_set_trap_table( -+ const trap_info_t *table) -+{ -+ return _hypercall1(int, set_trap_table, table); -+} -+ -+static inline int __must_check -+HYPERVISOR_mmu_update( -+ mmu_update_t *req, unsigned int count, unsigned int *success_count, -+ domid_t domid) -+{ -+ if (arch_use_lazy_mmu_mode()) -+ return xen_multi_mmu_update(req, count, success_count, domid); -+ return _hypercall4(int, mmu_update, req, count, success_count, domid); -+} -+ -+static inline int __must_check -+HYPERVISOR_mmuext_op( -+ struct mmuext_op *op, unsigned int count, unsigned int *success_count, -+ domid_t domid) -+{ -+ if (arch_use_lazy_mmu_mode()) -+ return xen_multi_mmuext_op(op, count, success_count, domid); -+ return _hypercall4(int, mmuext_op, op, count, success_count, domid); -+} -+ -+static inline int __must_check -+HYPERVISOR_set_gdt( -+ unsigned long *frame_list, unsigned int entries) -+{ -+ return _hypercall2(int, set_gdt, frame_list, entries); -+} -+ -+static inline int __must_check -+HYPERVISOR_stack_switch( -+ unsigned long ss, unsigned long esp) -+{ -+ return _hypercall2(int, stack_switch, ss, esp); -+} -+ -+static inline int -+HYPERVISOR_fpu_taskswitch( -+ int set) -+{ -+ return _hypercall1(int, fpu_taskswitch, set); -+} -+ -+#if CONFIG_XEN_COMPAT <= 0x030002 -+static inline int __must_check -+HYPERVISOR_sched_op_compat( -+ int cmd, unsigned long arg) -+{ -+ return _hypercall2(int, sched_op_compat, cmd, arg); -+} -+#endif -+ -+static inline int __must_check -+HYPERVISOR_sched_op( -+ int cmd, void *arg) -+{ -+ return _hypercall2(int, sched_op, cmd, arg); -+} -+ -+#ifdef CONFIG_XEN_PRIVILEGED_GUEST -+static inline int __must_check -+HYPERVISOR_platform_op( -+ struct xen_platform_op *platform_op) -+{ -+ platform_op->interface_version = XENPF_INTERFACE_VERSION; -+ return _hypercall1(int, platform_op, platform_op); -+} -+ -+static inline int __must_check -+HYPERVISOR_mca( -+ struct xen_mc *mc_op) -+{ -+ mc_op->interface_version = XEN_MCA_INTERFACE_VERSION; -+ return _hypercall1(int, mca, mc_op); -+} -+#endif -+ -+static inline int __must_check -+HYPERVISOR_set_debugreg( -+ unsigned int reg, unsigned long value) -+{ -+ return _hypercall2(int, set_debugreg, reg, value); -+} -+ -+static inline unsigned long __must_check -+HYPERVISOR_get_debugreg( -+ unsigned int reg) -+{ -+ return _hypercall1(unsigned long, get_debugreg, reg); -+} -+ -+static inline int __must_check -+HYPERVISOR_memory_op( -+ unsigned int cmd, void *arg) -+{ -+ if (arch_use_lazy_mmu_mode()) -+ xen_multicall_flush(false); -+ return _hypercall2(int, memory_op, cmd, arg); -+} -+ -+static inline int __must_check -+HYPERVISOR_multicall( -+ multicall_entry_t *call_list, unsigned int nr_calls) -+{ -+ return _hypercall2(int, multicall, call_list, nr_calls); -+} -+ -+static inline int __must_check -+HYPERVISOR_event_channel_op( -+ int cmd, void *arg) -+{ -+ int rc = _hypercall2(int, event_channel_op, cmd, arg); -+ -+#if CONFIG_XEN_COMPAT <= 0x030002 -+ if (unlikely(rc == -ENOSYS)) { -+ struct evtchn_op op; -+ op.cmd = cmd; -+ memcpy(&op.u, arg, sizeof(op.u)); -+ rc = _hypercall1(int, event_channel_op_compat, &op); -+ memcpy(arg, &op.u, sizeof(op.u)); -+ } -+#endif -+ -+ return rc; -+} -+ -+static inline int __must_check -+HYPERVISOR_xen_version( -+ int cmd, void *arg) -+{ -+ return _hypercall2(int, xen_version, cmd, arg); -+} -+ -+static inline int __must_check -+HYPERVISOR_console_io( -+ int cmd, unsigned int count, char *str) -+{ -+ return _hypercall3(int, console_io, cmd, count, str); -+} -+ -+static inline int __must_check -+HYPERVISOR_physdev_op( -+ int cmd, void *arg) -+{ -+ int rc = _hypercall2(int, physdev_op, cmd, arg); -+ -+#if CONFIG_XEN_COMPAT <= 0x030002 -+ if (unlikely(rc == -ENOSYS)) { -+ struct physdev_op op; -+ op.cmd = cmd; -+ memcpy(&op.u, arg, sizeof(op.u)); -+ rc = _hypercall1(int, physdev_op_compat, &op); -+ memcpy(arg, &op.u, sizeof(op.u)); -+ } -+#endif -+ -+ return rc; -+} -+ -+static inline int __must_check -+HYPERVISOR_grant_table_op( -+ unsigned int cmd, void *uop, unsigned int count) -+{ -+ if (arch_use_lazy_mmu_mode()) -+ xen_multicall_flush(false); -+ return _hypercall3(int, grant_table_op, cmd, uop, count); -+} -+ -+static inline int __must_check -+HYPERVISOR_vm_assist( -+ unsigned int cmd, unsigned int type) -+{ -+ return _hypercall2(int, vm_assist, cmd, type); -+} -+ -+static inline int __must_check -+HYPERVISOR_vcpu_op( -+ int cmd, unsigned int vcpuid, void *extra_args) -+{ -+ return _hypercall3(int, vcpu_op, cmd, vcpuid, extra_args); -+} -+ -+static inline int __must_check -+HYPERVISOR_suspend( -+ unsigned long srec) -+{ -+ struct sched_shutdown sched_shutdown = { -+ .reason = SHUTDOWN_suspend -+ }; -+ -+ int rc = _hypercall3(int, sched_op, SCHEDOP_shutdown, -+ &sched_shutdown, srec); -+ -+#if CONFIG_XEN_COMPAT <= 0x030002 -+ if (rc == -ENOSYS) -+ rc = _hypercall3(int, sched_op_compat, SCHEDOP_shutdown, -+ SHUTDOWN_suspend, srec); -+#endif -+ -+ return rc; -+} + if ((rc = tty_register_driver(DRV(xencons_driver))) != 0) { +- printk("WARNING: Failed to register Xen virtual " +- "console driver as '%s%d'\n", +- DRV(xencons_driver)->name, +- DRV(xencons_driver)->name_base); ++ pr_warning("WARNING: Failed to register Xen virtual " ++ "console driver as '%s%d'\n", ++ DRV(xencons_driver)->name, ++ DRV(xencons_driver)->name_base); + put_tty_driver(xencons_driver); + xencons_driver = NULL; + return rc; +@@ -724,8 +724,8 @@ static int __init xencons_init(void) + BUG_ON(xencons_priv_irq < 0); + } + +- printk("Xen virtual console successfully installed as %s%d\n", +- DRV(xencons_driver)->name, xc_num); ++ pr_info("Xen virtual console successfully installed as %s%d\n", ++ DRV(xencons_driver)->name, xc_num); + + return 0; + } +--- a/drivers/xen/console/xencons_ring.c ++++ b/drivers/xen/console/xencons_ring.c +@@ -100,7 +100,7 @@ int xencons_ring_init(void) + xen_start_info->console.domU.evtchn, + handle_input, 0, "xencons", NULL); + if (irq < 0) { +- printk(KERN_ERR "XEN console request irq failed %i\n", irq); ++ pr_err("XEN console request irq failed %i\n", irq); + return irq; + } + +--- a/drivers/xen/core/cpu_hotplug.c ++++ b/drivers/xen/core/cpu_hotplug.c +@@ -36,7 +36,7 @@ static void vcpu_hotplug(unsigned int cp + sprintf(dir, "cpu/%u", cpu); + err = xenbus_scanf(XBT_NIL, dir, "availability", "%15s", state); + if (err != 1) { +- printk(KERN_ERR "XENBUS: Unable to read cpu state\n"); ++ pr_err("XENBUS: Unable to read cpu state\n"); + return; + } + +@@ -49,7 +49,7 @@ static void vcpu_hotplug(unsigned int cp + if (!cpu_down(cpu) && dev) + kobject_uevent(&dev->kobj, KOBJ_OFFLINE); + } else { +- printk(KERN_ERR "XENBUS: unknown state(%s) on CPU%d\n", ++ pr_err("XENBUS: unknown state(%s) on CPU%d\n", + state, cpu); + } + } +@@ -97,8 +97,7 @@ static int setup_cpu_watcher(struct noti + if (!is_initial_xendomain()) { + for_each_possible_cpu(i) + vcpu_hotplug(i, get_cpu_sysdev(i)); +- printk(KERN_INFO "Brought up %ld CPUs\n", +- (long)num_online_cpus()); ++ pr_info("Brought up %ld CPUs\n", (long)num_online_cpus()); + } + + return NOTIFY_DONE; +@@ -132,8 +131,7 @@ int smp_suspend(void) + continue; + err = cpu_down(cpu); + if (err) { +- printk(KERN_CRIT "Failed to take all CPUs " +- "down: %d.\n", err); ++ pr_crit("Failed to take all CPUs down: %d\n", err); + for_each_possible_cpu(cpu) + vcpu_hotplug(cpu, NULL); + return err; +@@ -161,8 +159,8 @@ int cpu_up_check(unsigned int cpu) + if (local_cpu_hotplug_request()) { + cpu_set(cpu, local_allowed_cpumask); + if (!cpu_isset(cpu, xenbus_allowed_cpumask)) { +- printk("%s: attempt to bring up CPU %u disallowed by " +- "remote admin.\n", __FUNCTION__, cpu); ++ pr_warning("%s: attempt to bring up CPU %u disallowed " ++ "by remote admin.\n", __FUNCTION__, cpu); + rc = -EBUSY; + } + } else if (!cpu_isset(cpu, local_allowed_cpumask) || +--- a/drivers/xen/core/evtchn.c ++++ b/drivers/xen/core/evtchn.c +@@ -361,8 +361,8 @@ static int find_unbound_irq(void) + + if (!warned) { + warned = 1; +- printk(KERN_WARNING "No available IRQ to bind to: " +- "increase NR_DYNIRQS.\n"); ++ pr_warning("No available IRQ to bind to: " ++ "increase NR_DYNIRQS.\n"); + } + + return -ENOSPC; +@@ -850,8 +850,7 @@ static void enable_pirq(unsigned int irq + bind_pirq.flags = probing_irq(irq) ? 0 : BIND_PIRQ__WILL_SHARE; + if (HYPERVISOR_event_channel_op(EVTCHNOP_bind_pirq, &bind_pirq) != 0) { + if (!probing_irq(irq)) +- printk(KERN_INFO "Failed to obtain physical IRQ %d\n", +- irq); ++ pr_info("Failed to obtain physical IRQ %d\n", irq); + return; + } + evtchn = bind_pirq.port; +@@ -1150,8 +1149,8 @@ int evtchn_map_pirq(int irq, int xen_pir + return 0; + } else if (type_from_irq(irq) != IRQT_PIRQ + || index_from_irq(irq) != xen_pirq) { +- printk(KERN_ERR "IRQ#%d is already mapped to %d:%u - " +- "cannot map to PIRQ#%u\n", ++ pr_err("IRQ#%d is already mapped to %d:%u - " ++ "cannot map to PIRQ#%u\n", + irq, type_from_irq(irq), index_from_irq(irq), xen_pirq); + return -EINVAL; + } +--- a/drivers/xen/core/firmware.c ++++ b/drivers/xen/core/firmware.c +@@ -1,4 +1,5 @@ + #include ++#include + #include + #include + #include +--- a/drivers/xen/core/gnttab.c ++++ b/drivers/xen/core/gnttab.c +@@ -246,8 +246,8 @@ static void gnttab_handle_deferred(unsig + entry = NULL; + } else { + if (!--entry->warn_delay) +- printk(KERN_INFO "g.e. %#x still pending\n", +- entry->ref); ++ pr_info("g.e. %#x still pending\n", ++ entry->ref); + if (!first) + first = entry; + } +@@ -778,7 +778,7 @@ int gnttab_resume(void) + resume_frames = alloc_xen_mmio(PAGE_SIZE * max_nr_gframes); + shared = ioremap(resume_frames, PAGE_SIZE * max_nr_gframes); + if (shared == NULL) { +- printk("error to ioremap gnttab share frames\n"); ++ pr_warning("error to ioremap gnttab share frames\n"); + return -1; + } + } +--- a/drivers/xen/core/machine_kexec.c ++++ b/drivers/xen/core/machine_kexec.c +@@ -31,6 +31,10 @@ void __init xen_machine_kexec_setup_reso + unsigned int k = 0, nr = 0; + int rc; + ++ if (strstr(boot_command_line, "crashkernel=")) ++ pr_warning("Ignoring crashkernel command line, " ++ "parameter will be supplied by xen\n"); + -+#if CONFIG_XEN_COMPAT <= 0x030002 -+static inline int -+HYPERVISOR_nmi_op( -+ unsigned long op, void *arg) -+{ -+ return _hypercall2(int, nmi_op, op, arg); -+} + if (!is_initial_xendomain()) + return; + +@@ -147,6 +151,13 @@ void __init xen_machine_kexec_setup_reso + + xen_max_nr_phys_cpus = nr; + ++#ifdef CONFIG_X86 ++ if (xen_create_contiguous_region((unsigned long)&vmcoreinfo_note, ++ get_order(sizeof(vmcoreinfo_note)), ++ BITS_PER_LONG)) ++ goto err; +#endif + -+#ifndef CONFIG_XEN -+static inline unsigned long __must_check -+HYPERVISOR_hvm_op( -+ int op, void *arg) + return; + + free: +@@ -227,6 +238,13 @@ void __noreturn machine_kexec(struct kim + panic("KEXEC_CMD_kexec hypercall should not return\n"); + } + ++#ifdef CONFIG_X86 ++unsigned long paddr_vmcoreinfo_note(void) +{ -+ return _hypercall2(unsigned long, hvm_op, op, arg); ++ return virt_to_machine(&vmcoreinfo_note); +} +#endif + -+static inline int __must_check -+HYPERVISOR_callback_op( -+ int cmd, const void *arg) -+{ -+ return _hypercall2(int, callback_op, cmd, arg); -+} -+ -+static inline int __must_check -+HYPERVISOR_xenoprof_op( -+ int op, void *arg) -+{ -+ return _hypercall2(int, xenoprof_op, op, arg); -+} -+ -+static inline int __must_check -+HYPERVISOR_kexec_op( -+ unsigned long op, void *args) -+{ -+ return _hypercall2(int, kexec_op, op, args); -+} -+ -+struct tmem_op; -+ -+static inline int __must_check -+HYPERVISOR_tmem_op( -+ struct tmem_op *op) -+{ -+ return _hypercall1(int, tmem_op, (void *)op); -+} -+ -+#endif /* __HYPERCALL_H__ */ ---- head.orig/arch/x86/include/mach-xen/asm/hypercall_32.h 2012-10-31 10:58:57.000000000 +0100 -+++ head/arch/x86/include/mach-xen/asm/hypercall_32.h 2012-10-31 11:11:48.000000000 +0100 -@@ -1,195 +1,10 @@ --/****************************************************************************** -- * hypercall.h -- * -- * Linux-specific hypervisor handling. -- * -- * Copyright (c) 2002-2004, K A Fraser -- * -- * This program is free software; you can redistribute it and/or -- * modify it under the terms of the GNU General Public License version 2 -- * as published by the Free Software Foundation; or, when distributed -- * separately from the Linux kernel or incorporated into other -- * software packages, subject to the following license: -- * -- * Permission is hereby granted, free of charge, to any person obtaining a copy -- * of this source file (the "Software"), to deal in the Software without -- * restriction, including without limitation the rights to use, copy, modify, -- * merge, publish, distribute, sublicense, and/or sell copies of the Software, -- * and to permit persons to whom the Software is furnished to do so, subject to -- * the following conditions: -- * -- * The above copyright notice and this permission notice shall be included in -- * all copies or substantial portions of the Software. -- * -- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -- * IN THE SOFTWARE. -- */ -- --#ifndef __HYPERCALL_H__ --#define __HYPERCALL_H__ + void machine_shutdown(void) + { + /* do nothing */ +--- a/drivers/xen/core/machine_reboot.c ++++ b/drivers/xen/core/machine_reboot.c +@@ -204,8 +204,7 @@ int __xen_suspend(int fast_suspend, void + + #if defined(__i386__) || defined(__x86_64__) + if (xen_feature(XENFEAT_auto_translated_physmap)) { +- printk(KERN_WARNING "Cannot suspend in " +- "auto_translated_physmap mode.\n"); ++ pr_warning("Can't suspend in auto_translated_physmap mode\n"); + return -EOPNOTSUPP; + } + #endif +--- a/drivers/xen/core/reboot.c ++++ b/drivers/xen/core/reboot.c +@@ -82,14 +82,14 @@ static int xen_suspend(void *__unused) + daemonize("suspend"); + err = set_cpus_allowed(current, cpumask_of_cpu(0)); + if (err) { +- printk(KERN_ERR "Xen suspend can't run on CPU0 (%d)\n", err); ++ pr_err("Xen suspend can't run on CPU0 (%d)\n", err); + goto fail; + } + + do { + err = __xen_suspend(fast_suspend, xen_resume_notifier); + if (err) { +- printk(KERN_ERR "Xen suspend failed (%d)\n", err); ++ pr_err("Xen suspend failed (%d)\n", err); + goto fail; + } + if (!suspend_cancelled) +@@ -151,8 +151,8 @@ static void __shutdown_handler(struct wo + NULL, CLONE_FS | CLONE_FILES); + + if (err < 0) { +- printk(KERN_WARNING "Error creating shutdown process (%d): " +- "retrying...\n", -err); ++ pr_warning("Error creating shutdown process (%d): " ++ "retrying...\n", -err); + schedule_delayed_work(&shutdown_work, HZ/2); + } + } +@@ -198,7 +198,7 @@ static void shutdown_handler(struct xenb + else if (strcmp(str, "halt") == 0) + new_state = SHUTDOWN_HALT; + else +- printk("Ignoring shutdown request: %s\n", str); ++ pr_warning("Ignoring shutdown request: %s\n", str); + + switch_shutdown_state(new_state); + +@@ -217,8 +217,7 @@ static void sysrq_handler(struct xenbus_ + if (err) + return; + if (xenbus_scanf(xbt, "control", "sysrq", "%c", &sysrq_key) <= 0) { +- printk(KERN_ERR "Unable to read sysrq code in " +- "control/sysrq\n"); ++ pr_err("Unable to read sysrq code in control/sysrq\n"); + xenbus_transaction_end(xbt, 1); + return; + } +@@ -267,7 +266,7 @@ static int setup_suspend_evtchn(void) + return -1; + + port = irq_to_evtchn_port(irq); +- printk(KERN_INFO "suspend: event channel %d\n", port); ++ pr_info("suspend: event channel %d\n", port); + sprintf(portstr, "%d", port); + xenbus_write(XBT_NIL, "device/suspend", "event-channel", portstr); + +@@ -280,7 +279,7 @@ static int setup_shutdown_watcher(void) + + err = register_xenbus_watch(&sysrq_watch); + if (err) { +- printk(KERN_ERR "Failed to set sysrq watcher\n"); ++ pr_err("Failed to set sysrq watcher\n"); + return err; + } + +@@ -293,14 +292,14 @@ static int setup_shutdown_watcher(void) + + err = register_xenbus_watch(&shutdown_watch); + if (err) { +- printk(KERN_ERR "Failed to set shutdown watcher\n"); ++ pr_err("Failed to set shutdown watcher\n"); + return err; + } + + /* suspend event channel */ + err = setup_suspend_evtchn(); + if (err) { +- printk(KERN_ERR "Failed to register suspend event channel\n"); ++ pr_err("Failed to register suspend event channel\n"); + return err; + } + +--- a/drivers/xen/core/smpboot.c ++++ b/drivers/xen/core/smpboot.c +@@ -34,31 +34,20 @@ extern void failsafe_callback(void); + extern void system_call(void); + extern void smp_trap_init(trap_info_t *); + +-/* Number of siblings per CPU package */ +-int smp_num_siblings = 1; - --#include + cpumask_t cpu_online_map; + EXPORT_SYMBOL(cpu_online_map); + cpumask_t cpu_possible_map; + EXPORT_SYMBOL(cpu_possible_map); + cpumask_t cpu_initialized_map; + +-struct cpuinfo_x86 cpu_data[NR_CPUS] __cacheline_aligned; +-EXPORT_SYMBOL(cpu_data); ++DEFINE_PER_CPU(struct cpuinfo_x86, cpu_info); ++EXPORT_PER_CPU_SYMBOL(cpu_info); + + static DEFINE_PER_CPU(int, resched_irq); + static DEFINE_PER_CPU(int, callfunc_irq); + static char resched_name[NR_CPUS][15]; + static char callfunc_name[NR_CPUS][15]; + +-cpumask_t cpu_sibling_map[NR_CPUS] __cacheline_aligned; +-cpumask_t cpu_core_map[NR_CPUS] __cacheline_aligned; - --#ifndef __HYPERVISOR_H__ --# error "please don't include this file directly" +-#if defined(__i386__) +-u8 x86_cpu_to_apicid[NR_CPUS] = { [0 ... NR_CPUS-1] = 0xff }; +-EXPORT_SYMBOL(x86_cpu_to_apicid); -#endif - --#ifdef CONFIG_XEN --#define HYPERCALL_STR(name) \ -- "call hypercall_page + ("__stringify(__HYPERVISOR_##name)" * 32)" --#else --#define HYPERCALL_STR(name) \ -- "mov hypercall_stubs,%%eax; " \ -- "add $("__stringify(__HYPERVISOR_##name)" * 32),%%eax; "\ -- "call *%%eax" --#endif + void __init prefill_possible_map(void) + { + int i, rc; +@@ -78,30 +67,6 @@ void __init smp_alloc_memory(void) + { + } + +-static inline void +-set_cpu_sibling_map(unsigned int cpu) +-{ +- cpu_data[cpu].phys_proc_id = cpu; +- cpu_data[cpu].cpu_core_id = 0; - --#define _hypercall0(type, name) \ --({ \ -- type __res; \ -- asm volatile ( \ -- HYPERCALL_STR(name) \ -- : "=a" (__res) \ -- : \ -- : "memory" ); \ -- __res; \ --}) +- cpu_sibling_map[cpu] = cpumask_of_cpu(cpu); +- cpu_core_map[cpu] = cpumask_of_cpu(cpu); - --#define _hypercall1(type, name, a1) \ --({ \ -- type __res; \ -- long __ign1; \ -- asm volatile ( \ -- HYPERCALL_STR(name) \ -- : "=a" (__res), "=b" (__ign1) \ -- : "1" ((long)(a1)) \ -- : "memory" ); \ -- __res; \ --}) +- cpu_data[cpu].booted_cores = 1; +-} - --#define _hypercall2(type, name, a1, a2) \ --({ \ -- type __res; \ -- long __ign1, __ign2; \ -- asm volatile ( \ -- HYPERCALL_STR(name) \ -- : "=a" (__res), "=b" (__ign1), "=c" (__ign2) \ -- : "1" ((long)(a1)), "2" ((long)(a2)) \ -- : "memory" ); \ -- __res; \ --}) +-static void +-remove_siblinginfo(unsigned int cpu) +-{ +- cpu_data[cpu].phys_proc_id = BAD_APICID; +- cpu_data[cpu].cpu_core_id = BAD_APICID; - --#define _hypercall3(type, name, a1, a2, a3) \ --({ \ -- type __res; \ -- long __ign1, __ign2, __ign3; \ -- asm volatile ( \ -- HYPERCALL_STR(name) \ -- : "=a" (__res), "=b" (__ign1), "=c" (__ign2), \ -- "=d" (__ign3) \ -- : "1" ((long)(a1)), "2" ((long)(a2)), \ -- "3" ((long)(a3)) \ -- : "memory" ); \ -- __res; \ --}) +- cpus_clear(cpu_sibling_map[cpu]); +- cpus_clear(cpu_core_map[cpu]); - --#define _hypercall4(type, name, a1, a2, a3, a4) \ --({ \ -- type __res; \ -- long __ign1, __ign2, __ign3, __ign4; \ -- asm volatile ( \ -- HYPERCALL_STR(name) \ -- : "=a" (__res), "=b" (__ign1), "=c" (__ign2), \ -- "=d" (__ign3), "=S" (__ign4) \ -- : "1" ((long)(a1)), "2" ((long)(a2)), \ -- "3" ((long)(a3)), "4" ((long)(a4)) \ -- : "memory" ); \ -- __res; \ --}) +- cpu_data[cpu].booted_cores = 0; +-} - --#define _hypercall5(type, name, a1, a2, a3, a4, a5) \ --({ \ -- type __res; \ -- long __ign1, __ign2, __ign3, __ign4, __ign5; \ -- asm volatile ( \ -- HYPERCALL_STR(name) \ -- : "=a" (__res), "=b" (__ign1), "=c" (__ign2), \ -- "=d" (__ign3), "=S" (__ign4), "=D" (__ign5) \ -- : "1" ((long)(a1)), "2" ((long)(a2)), \ -- "3" ((long)(a3)), "4" ((long)(a4)), \ -- "5" ((long)(a5)) \ -- : "memory" ); \ -- __res; \ --}) + static int __cpuinit xen_smp_intr_init(unsigned int cpu) + { + int rc; +@@ -156,9 +121,9 @@ void __cpuinit cpu_bringup(void) + { + cpu_init(); + #ifdef __i386__ +- identify_secondary_cpu(cpu_data + smp_processor_id()); ++ identify_secondary_cpu(¤t_cpu_data); + #else +- identify_cpu(cpu_data + smp_processor_id()); ++ identify_cpu(¤t_cpu_data); + #endif + touch_softlockup_watchdog(); + preempt_disable(); +@@ -255,20 +220,9 @@ void __init smp_prepare_cpus(unsigned in + apicid = 0; + if (HYPERVISOR_vcpu_op(VCPUOP_get_physid, 0, &cpu_id) == 0) + apicid = xen_vcpu_physid_to_x86_apicid(cpu_id.phys_id); +- boot_cpu_data.apicid = apicid; +- cpu_data[0] = boot_cpu_data; +- +- x86_cpu_to_apicid[0] = apicid; +- ++ cpu_data(0) = boot_cpu_data; + current_thread_info()->cpu = 0; + +- for (cpu = 0; cpu < NR_CPUS; cpu++) { +- cpus_clear(cpu_sibling_map[cpu]); +- cpus_clear(cpu_core_map[cpu]); +- } +- +- set_cpu_sibling_map(0); +- + if (xen_smp_intr_init(0)) + BUG(); + +@@ -293,8 +247,7 @@ void __init smp_prepare_cpus(unsigned in + gdt_descr = &cpu_gdt_descr[cpu]; + gdt_descr->address = get_zeroed_page(GFP_KERNEL); + if (unlikely(!gdt_descr->address)) { +- printk(KERN_CRIT "CPU%d failed to allocate GDT\n", +- cpu); ++ pr_crit("CPU%d failed to allocate GDT\n", cpu); + continue; + } + gdt_descr->size = GDT_SIZE; +@@ -309,10 +262,8 @@ void __init smp_prepare_cpus(unsigned in + apicid = cpu; + if (HYPERVISOR_vcpu_op(VCPUOP_get_physid, cpu, &cpu_id) == 0) + apicid = xen_vcpu_physid_to_x86_apicid(cpu_id.phys_id); +- cpu_data[cpu] = boot_cpu_data; +- cpu_data[cpu].apicid = apicid; - --#define _hypercall(type, op, a1, a2, a3, a4, a5) \ --({ \ -- type __res; \ -- register typeof((a1)+0) __arg1 asm("ebx") = (a1); \ -- register typeof((a2)+0) __arg2 asm("ecx") = (a2); \ -- register typeof((a3)+0) __arg3 asm("edx") = (a3); \ -- register typeof((a4)+0) __arg4 asm("esi") = (a4); \ -- register typeof((a5)+0) __arg5 asm("edi") = (a5); \ -- asm volatile ( \ -- "call *%6" \ -- : "=a" (__res), "+r" (__arg1), "+r" (__arg2), \ -- "+r" (__arg3), "+r" (__arg4), "+r" (__arg5) \ -- : "0" (hypercall_page + (op) * 32) \ -- : "memory" ); \ -- __res; \ --}) -+#define HYPERCALL_arg1 "ebx" -+#define HYPERCALL_arg2 "ecx" -+#define HYPERCALL_arg3 "edx" -+#define HYPERCALL_arg4 "esi" -+#define HYPERCALL_arg5 "edi" +- x86_cpu_to_apicid[cpu] = apicid; ++ cpu_data(cpu) = boot_cpu_data; ++ cpu_data(cpu).cpu_index = cpu; + + #ifdef __x86_64__ + cpu_pda(cpu)->pcurrent = idle; +@@ -375,8 +326,6 @@ int __cpu_disable(void) + if (cpu == 0) + return -EBUSY; + +- remove_siblinginfo(cpu); +- + cpu_clear(cpu, map); + fixup_irqs(map); + cpu_clear(cpu, cpu_online_map); +@@ -417,7 +366,6 @@ int __cpuinit __cpu_up(unsigned int cpu) + alternatives_smp_switch(1); + + /* This must be done before setting cpu_online_map */ +- set_cpu_sibling_map(cpu); + wmb(); + + rc = HYPERVISOR_vcpu_op(VCPUOP_up, cpu, NULL); +@@ -435,7 +383,6 @@ int __cpuinit __cpu_up(unsigned int cpu) + + if (rc) { + xen_smp_intr_exit(cpu); +- remove_siblinginfo(cpu); + if (num_online_cpus() == 1) + alternatives_smp_switch(0); + } +--- a/drivers/xen/fbfront/xenfb.c ++++ b/drivers/xen/fbfront/xenfb.c +@@ -240,8 +240,8 @@ static void xenfb_update_screen(struct x + mutex_unlock(&info->mm_lock); + + if (x2 < x1 || y2 < y1) { +- printk("xenfb_update_screen bogus rect %d %d %d %d\n", +- x1, x2, y1, y2); ++ pr_warning("xenfb_update_screen bogus rect %d %d %d %d\n", ++ x1, x2, y1, y2); + WARN_ON(1); + } + xenfb_do_update(info, x1, y1, x2 - x1, y2 - y1); +--- a/drivers/xen/fbfront/xenkbd.c ++++ b/drivers/xen/fbfront/xenkbd.c +@@ -80,8 +80,8 @@ static irqreturn_t input_handler(int rq, + input_report_key(dev, event->key.keycode, + event->key.pressed); + else +- printk("xenkbd: unhandled keycode 0x%x\n", +- event->key.keycode); ++ pr_warning("xenkbd: unhandled keycode 0x%x\n", ++ event->key.keycode); + break; + case XENKBD_TYPE_POS: + if (event->pos.rel_z) +--- a/drivers/xen/gntdev/gntdev.c ++++ b/drivers/xen/gntdev/gntdev.c +@@ -365,14 +365,14 @@ static int __init gntdev_init(void) + int err; + + if (!is_running_on_xen()) { +- printk(KERN_ERR "You must be running Xen to use gntdev\n"); ++ pr_err("You must be running Xen to use gntdev\n"); + return -ENODEV; + } + + err = misc_register(&gntdev_miscdev); + if (err) + { +- printk(KERN_ERR "Could not register gntdev device\n"); ++ pr_err("Could not register gntdev device\n"); + return err; + } + +@@ -453,7 +453,7 @@ static int gntdev_mmap (struct file *fli + struct vm_foreign_map *foreign_map; + + if (unlikely(!private_data)) { +- printk(KERN_ERR "File's private data is NULL.\n"); ++ pr_err("file's private data is NULL\n"); + return -EINVAL; + } + +@@ -463,28 +463,27 @@ static int gntdev_mmap (struct file *fli + up_read(&private_data->grants_sem); + + if (unlikely(!grants)) { +- printk(KERN_ERR "Attempted to mmap before ioctl.\n"); ++ pr_err("attempted to mmap before ioctl\n"); + return -EINVAL; + } + grants += slot_index; + + if (unlikely(size + slot_index <= slot_index || + size + slot_index > private_data->grants_size)) { +- printk(KERN_ERR "Invalid number of pages or offset" ++ pr_err("Invalid number of pages or offset" + "(num_pages = %lu, first_slot = %lu)\n", + size, slot_index); + return -ENXIO; + } + + if ((vma->vm_flags & VM_WRITE) && !(vma->vm_flags & VM_SHARED)) { +- printk(KERN_ERR "Writable mappings must be shared.\n"); ++ pr_err("writable mappings must be shared\n"); + return -EINVAL; + } + + foreign_map = kmalloc(sizeof(*foreign_map), GFP_KERNEL); + if (!foreign_map) { +- printk(KERN_ERR "Couldn't allocate mapping structure for VM " +- "area.\n"); ++ pr_err("couldn't allocate mapping structure for VM area\n"); + return -ENOMEM; + } + foreign_map->map = &private_data->foreign_pages[slot_index]; +@@ -493,9 +492,8 @@ static int gntdev_mmap (struct file *fli + down_write(&private_data->grants_sem); + for (i = 0; i < size; ++i) { + if (grants[i].state != GNTDEV_SLOT_NOT_YET_MAPPED) { +- printk(KERN_ERR "Slot (index = %lu) is in the wrong " +- "state (%d).\n", slot_index + i, +- grants[i].state); ++ pr_err("Slot (index = %lu) is in the wrong state (%d)\n", ++ slot_index + i, grants[i].state); + up_write(&private_data->grants_sem); + kfree(foreign_map); + return -EINVAL; +@@ -547,7 +545,7 @@ static int gntdev_mmap (struct file *fli + BUG_ON(ret); + if (op.status != GNTST_okay) { + if (op.status != GNTST_eagain) +- printk(KERN_ERR "Error mapping the grant reference " ++ pr_err("Error mapping the grant reference " + "into the kernel (%d). domid = %d; ref = %d\n", + op.status, + grants[i].u.valid.domid, +@@ -592,8 +590,7 @@ static int gntdev_mmap (struct file *fli + user_vaddr, + &ptep))) + { +- printk(KERN_ERR "Error obtaining PTE pointer (%d)\n", +- ret); ++ pr_err("Error obtaining PTE pointer (%d)\n", ret); + goto undo_map_out; + } + +@@ -616,7 +613,7 @@ static int gntdev_mmap (struct file *fli + &op, 1); + BUG_ON(ret); + if (op.status != GNTST_okay) { +- printk(KERN_ERR "Error mapping the grant reference " ++ pr_err("Error mapping the grant reference " + "into user space (%d). domid = %d; ref = %d\n", + op.status, + grants[i].u.valid.domid, +@@ -726,9 +723,9 @@ static pte_t gntdev_clear_pte(struct vm_ + BUG_ON(ret); + + if (nr && op[0].status != GNTST_okay) +- printk("User unmap grant status = %d\n", op[0].status); ++ pr_warning("User unmap grant status = %d\n", op[0].status); + if (op[nr].status != GNTST_okay) +- printk("Kernel unmap grant status = %d\n", op[nr].status); ++ pr_warning("Kernel unmap grant status = %d\n", op[nr].status); + + /* Return slot to the not-yet-mapped state, so that it may be + * mapped again, or removed by a subsequent ioctl. +@@ -781,8 +778,7 @@ static long gntdev_ioctl(struct file *fl + up_write(&private_data->grants_sem); + + if (rc) { +- printk (KERN_ERR "Initialising gntdev private data " +- "failed.\n"); ++ pr_err("Initialising gntdev private data failed\n"); + return rc; + } + } +@@ -824,22 +820,22 @@ private_data_initialised: + if (op.count == 1) { + if ((rc = add_grant_reference(private_data, op.refs, + &op.index)) < 0) { +- printk(KERN_ERR "Adding grant reference " +- "failed (%d).\n", rc); ++ pr_err("Adding grant reference failed (%d)\n", ++ rc); + goto map_out; + } + } else { + if ((rc = find_contiguous_free_range(private_data, + op.count)) < 0) { +- printk(KERN_ERR "Finding contiguous range " +- "failed (%d).\n", rc); ++ pr_err("Finding contiguous range failed" ++ " (%d)\n", rc); + goto map_out; + } + op.index = rc << PAGE_SHIFT; + if ((rc = add_grant_references(private_data, op.count, + refs, rc))) { +- printk(KERN_ERR "Adding grant references " +- "failed (%d).\n", rc); ++ pr_err("Adding grant references failed (%d)\n", ++ rc); + goto map_out; + } + compress_free_list(private_data); +@@ -892,8 +888,7 @@ private_data_initialised: + rc = -ENXIO; + break; + } +- printk(KERN_ERR "%s[%d] tried to remove a grant" +- " which is %s at %#x+%#x\n", ++ pr_err("%s[%d] tried to remove a grant which is %s at %#x+%#x\n", + current->comm, current->pid, + what, start_index, i); + goto unmap_out; +@@ -936,7 +931,7 @@ private_data_initialised: + goto get_offset_out; + } + if (vma->vm_start != vaddr) { +- printk(KERN_ERR "The vaddr specified in an " ++ pr_err("The vaddr specified in an " + "IOCTL_GNTDEV_GET_OFFSET_FOR_VADDR must be at " + "the start of the VM area. vma->vm_start = " + "%#lx; vaddr = %#lx\n", +--- a/drivers/xen/netback/common.h ++++ b/drivers/xen/netback/common.h +@@ -45,10 +45,7 @@ + #define DPRINTK(_f, _a...) \ + pr_debug("(file=%s, line=%d) " _f, \ + __FILE__ , __LINE__ , ## _a ) +-#define IPRINTK(fmt, args...) \ +- printk(KERN_INFO "xen_net: " fmt, ##args) +-#define WPRINTK(fmt, args...) \ +- printk(KERN_WARNING "xen_net: " fmt, ##args) ++#define WPRINTK(fmt, args...) pr_warning("netbk: " fmt, ##args) - #if CONFIG_XEN_COMPAT <= 0x030002 --int __must_check HYPERVISOR_event_channel_op_compat(int, void *); --int __must_check HYPERVISOR_physdev_op_compat(int, void *); --#endif -- --static inline int __must_check --HYPERVISOR_set_trap_table( -- const trap_info_t *table) --{ -- return _hypercall1(int, set_trap_table, table); --} -- --static inline int __must_check --HYPERVISOR_mmu_update( -- mmu_update_t *req, unsigned int count, unsigned int *success_count, -- domid_t domid) --{ -- if (arch_use_lazy_mmu_mode()) -- return xen_multi_mmu_update(req, count, success_count, domid); -- return _hypercall4(int, mmu_update, req, count, success_count, domid); --} -- --static inline int __must_check --HYPERVISOR_mmuext_op( -- struct mmuext_op *op, unsigned int count, unsigned int *success_count, -- domid_t domid) --{ -- if (arch_use_lazy_mmu_mode()) -- return xen_multi_mmuext_op(op, count, success_count, domid); -- return _hypercall4(int, mmuext_op, op, count, success_count, domid); --} -- --static inline int __must_check --HYPERVISOR_set_gdt( -- unsigned long *frame_list, unsigned int entries) --{ -- return _hypercall2(int, set_gdt, frame_list, entries); --} -- --static inline int __must_check --HYPERVISOR_stack_switch( -- unsigned long ss, unsigned long esp) --{ -- return _hypercall2(int, stack_switch, ss, esp); --} -- - static inline int __must_check - HYPERVISOR_set_callbacks( - unsigned long event_selector, unsigned long event_address, -@@ -199,80 +14,24 @@ HYPERVISOR_set_callbacks( - event_selector, event_address, - failsafe_selector, failsafe_address); - } -- --static inline int --HYPERVISOR_fpu_taskswitch( -- int set) --{ -- return _hypercall1(int, fpu_taskswitch, set); --} -- --static inline int __must_check --HYPERVISOR_sched_op_compat( -- int cmd, unsigned long arg) --{ -- return _hypercall2(int, sched_op_compat, cmd, arg); --} -- --static inline int __must_check --HYPERVISOR_sched_op( -- int cmd, void *arg) --{ -- return _hypercall2(int, sched_op, cmd, arg); --} -+#endif + typedef struct netif_st { + /* Unique identifier for this interface. */ +--- a/drivers/xen/netback/interface.c ++++ b/drivers/xen/netback/interface.c +@@ -180,9 +180,13 @@ static const struct netif_stat { + { "rx_gso_csum_fixups", offsetof(netif_t, rx_gso_csum_fixups) / sizeof(long) }, + }; - static inline long __must_check - HYPERVISOR_set_timer_op( - u64 timeout) +-static int netbk_get_stats_count(struct net_device *dev) ++static int netbk_get_sset_count(struct net_device *dev, int sset) { -- unsigned long timeout_hi = (unsigned long)(timeout>>32); -- unsigned long timeout_lo = (unsigned long)timeout; -- return _hypercall2(long, set_timer_op, timeout_lo, timeout_hi); --} -- --static inline int __must_check --HYPERVISOR_platform_op( -- struct xen_platform_op *platform_op) --{ -- platform_op->interface_version = XENPF_INTERFACE_VERSION; -- return _hypercall1(int, platform_op, platform_op); --} -- --static inline int __must_check --HYPERVISOR_set_debugreg( -- unsigned int reg, unsigned long value) --{ -- return _hypercall2(int, set_debugreg, reg, value); --} -- --static inline unsigned long __must_check --HYPERVISOR_get_debugreg( -- unsigned int reg) --{ -- return _hypercall1(unsigned long, get_debugreg, reg); -+ return _hypercall2(long, set_timer_op, -+ (unsigned long)timeout, -+ (unsigned long)(timeout>>32)); +- return ARRAY_SIZE(netbk_stats); ++ switch (sset) { ++ case ETH_SS_STATS: ++ return ARRAY_SIZE(netbk_stats); ++ } ++ return -EOPNOTSUPP; } - static inline int __must_check - HYPERVISOR_update_descriptor( - u64 ma, u64 desc) + static void netbk_get_ethtool_stats(struct net_device *dev, +@@ -220,7 +224,7 @@ static struct ethtool_ops network_ethtoo + .set_tso = netbk_set_tso, + .get_link = ethtool_op_get_link, + +- .get_stats_count = netbk_get_stats_count, ++ .get_sset_count = netbk_get_sset_count, + .get_ethtool_stats = netbk_get_ethtool_stats, + .get_strings = netbk_get_strings, + }; +--- a/drivers/xen/netback/netback.c ++++ b/drivers/xen/netback/netback.c +@@ -364,8 +364,8 @@ static void xen_network_done_notify(void { -- return _hypercall4(int, update_descriptor, ma, ma>>32, desc, desc>>32); --} -- --static inline int __must_check --HYPERVISOR_memory_op( -- unsigned int cmd, void *arg) --{ -- if (arch_use_lazy_mmu_mode()) -- xen_multicall_flush(false); -- return _hypercall2(int, memory_op, cmd, arg); --} -- --static inline int __must_check --HYPERVISOR_multicall( -- multicall_entry_t *call_list, unsigned int nr_calls) --{ -- return _hypercall2(int, multicall, call_list, nr_calls); -+ return _hypercall4(int, update_descriptor, -+ (unsigned long)ma, (unsigned long)(ma>>32), -+ (unsigned long)desc, (unsigned long)(desc>>32)); + static struct net_device *eth0_dev = NULL; + if (unlikely(eth0_dev == NULL)) +- eth0_dev = __dev_get_by_name("eth0"); +- netif_rx_schedule(eth0_dev); ++ eth0_dev = __dev_get_by_name(&init_net, "eth0"); ++ netif_rx_schedule(eth0_dev, ???); } + /* + * Add following to poll() function in NAPI driver (Tigon3 is example): +@@ -1643,28 +1643,30 @@ static irqreturn_t netif_be_dbg(int irq, + netif_t *netif; + int i = 0; - static inline int __must_check -@@ -291,57 +50,6 @@ HYPERVISOR_update_va_mapping( - } +- printk(KERN_ALERT "netif_schedule_list:\n"); ++ pr_alert("netif_schedule_list:\n"); + spin_lock_irq(&net_schedule_list_lock); - static inline int __must_check --HYPERVISOR_event_channel_op( -- int cmd, void *arg) --{ -- int rc = _hypercall2(int, event_channel_op, cmd, arg); -- --#if CONFIG_XEN_COMPAT <= 0x030002 -- if (unlikely(rc == -ENOSYS)) -- rc = HYPERVISOR_event_channel_op_compat(cmd, arg); --#endif -- -- return rc; --} -- --static inline int __must_check --HYPERVISOR_xen_version( -- int cmd, void *arg) --{ -- return _hypercall2(int, xen_version, cmd, arg); --} -- --static inline int __must_check --HYPERVISOR_console_io( -- int cmd, unsigned int count, char *str) --{ -- return _hypercall3(int, console_io, cmd, count, str); --} -- --static inline int __must_check --HYPERVISOR_physdev_op( -- int cmd, void *arg) --{ -- int rc = _hypercall2(int, physdev_op, cmd, arg); -- --#if CONFIG_XEN_COMPAT <= 0x030002 -- if (unlikely(rc == -ENOSYS)) -- rc = HYPERVISOR_physdev_op_compat(cmd, arg); --#endif -- -- return rc; --} -- --static inline int __must_check --HYPERVISOR_grant_table_op( -- unsigned int cmd, void *uop, unsigned int count) --{ -- if (arch_use_lazy_mmu_mode()) -- xen_multicall_flush(false); -- return _hypercall3(int, grant_table_op, cmd, uop, count); --} -- --static inline int __must_check - HYPERVISOR_update_va_mapping_otherdomain( - unsigned long va, pte_t new_val, unsigned long flags, domid_t domid) - { -@@ -352,86 +60,3 @@ HYPERVISOR_update_va_mapping_otherdomain - return _hypercall5(int, update_va_mapping_otherdomain, va, - new_val.pte_low, pte_hi, flags, domid); + list_for_each (ent, &net_schedule_list) { + netif = list_entry(ent, netif_t, list); +- printk(KERN_ALERT " %d: private(rx_req_cons=%08x " +- "rx_resp_prod=%08x\n", +- i, netif->rx.req_cons, netif->rx.rsp_prod_pvt); +- printk(KERN_ALERT " tx_req_cons=%08x tx_resp_prod=%08x)\n", +- netif->tx.req_cons, netif->tx.rsp_prod_pvt); +- printk(KERN_ALERT " shared(rx_req_prod=%08x " +- "rx_resp_prod=%08x\n", +- netif->rx.sring->req_prod, netif->rx.sring->rsp_prod); +- printk(KERN_ALERT " rx_event=%08x tx_req_prod=%08x\n", +- netif->rx.sring->rsp_event, netif->tx.sring->req_prod); +- printk(KERN_ALERT " tx_resp_prod=%08x, tx_event=%08x)\n", +- netif->tx.sring->rsp_prod, netif->tx.sring->rsp_event); ++ pr_alert(" %d: private(rx_req_cons=%08x " ++ "rx_resp_prod=%08x\n", ++ i, netif->rx.req_cons, netif->rx.rsp_prod_pvt); ++ pr_alert(" tx_req_cons=%08x tx_resp_prod=%08x)\n", ++ netif->tx.req_cons, netif->tx.rsp_prod_pvt); ++ pr_alert(" shared(rx_req_prod=%08x " ++ "rx_resp_prod=%08x\n", ++ netif->rx.sring->req_prod, netif->rx.sring->rsp_prod); ++ pr_alert(" rx_event=%08x tx_req_prod=%08x\n", ++ netif->rx.sring->rsp_event, ++ netif->tx.sring->req_prod); ++ pr_alert(" tx_resp_prod=%08x, tx_event=%08x)\n", ++ netif->tx.sring->rsp_prod, ++ netif->tx.sring->rsp_event); + i++; + } + + spin_unlock_irq(&net_schedule_list_lock); +- printk(KERN_ALERT " ** End of netif_schedule_list **\n"); ++ pr_alert(" ** End of netif_schedule_list **\n"); + + return IRQ_HANDLED; } -- --static inline int __must_check --HYPERVISOR_vm_assist( -- unsigned int cmd, unsigned int type) --{ -- return _hypercall2(int, vm_assist, cmd, type); --} -- --static inline int __must_check --HYPERVISOR_vcpu_op( -- int cmd, unsigned int vcpuid, void *extra_args) --{ -- return _hypercall3(int, vcpu_op, cmd, vcpuid, extra_args); --} -- --static inline int __must_check --HYPERVISOR_suspend( -- unsigned long srec) --{ -- struct sched_shutdown sched_shutdown = { -- .reason = SHUTDOWN_suspend -- }; -- -- int rc = _hypercall3(int, sched_op, SCHEDOP_shutdown, -- &sched_shutdown, srec); -- --#if CONFIG_XEN_COMPAT <= 0x030002 -- if (rc == -ENOSYS) -- rc = _hypercall3(int, sched_op_compat, SCHEDOP_shutdown, -- SHUTDOWN_suspend, srec); --#endif -- -- return rc; --} -- --#if CONFIG_XEN_COMPAT <= 0x030002 --static inline int --HYPERVISOR_nmi_op( -- unsigned long op, void *arg) --{ -- return _hypercall2(int, nmi_op, op, arg); --} --#endif -- --#ifndef CONFIG_XEN --static inline unsigned long __must_check --HYPERVISOR_hvm_op( -- int op, void *arg) --{ -- return _hypercall2(unsigned long, hvm_op, op, arg); --} --#endif -- --static inline int __must_check --HYPERVISOR_callback_op( -- int cmd, const void *arg) --{ -- return _hypercall2(int, callback_op, cmd, arg); --} -- --static inline int __must_check --HYPERVISOR_xenoprof_op( -- int op, void *arg) --{ -- return _hypercall2(int, xenoprof_op, op, arg); --} -- --static inline int __must_check --HYPERVISOR_kexec_op( -- unsigned long op, void *args) --{ -- return _hypercall2(int, kexec_op, op, args); --} -- --static inline int __must_check --HYPERVISOR_tmem_op( -- struct tmem_op *op) --{ -- return _hypercall1(int, tmem_op, op); --} -- -- --#endif /* __HYPERCALL_H__ */ ---- head.orig/arch/x86/include/mach-xen/asm/hypercall_64.h 2012-10-31 10:59:05.000000000 +0100 -+++ head/arch/x86/include/mach-xen/asm/hypercall_64.h 2012-10-31 11:11:50.000000000 +0100 -@@ -1,202 +1,10 @@ --/****************************************************************************** -- * hypercall.h -- * -- * Linux-specific hypervisor handling. -- * -- * Copyright (c) 2002-2004, K A Fraser -- * -- * 64-bit updates: -- * Benjamin Liu -- * Jun Nakajima -- * -- * This program is free software; you can redistribute it and/or -- * modify it under the terms of the GNU General Public License version 2 -- * as published by the Free Software Foundation; or, when distributed -- * separately from the Linux kernel or incorporated into other -- * software packages, subject to the following license: -- * -- * Permission is hereby granted, free of charge, to any person obtaining a copy -- * of this source file (the "Software"), to deal in the Software without -- * restriction, including without limitation the rights to use, copy, modify, -- * merge, publish, distribute, sublicense, and/or sell copies of the Software, -- * and to permit persons to whom the Software is furnished to do so, subject to -- * the following conditions: -- * -- * The above copyright notice and this permission notice shall be included in -- * all copies or substantial portions of the Software. -- * -- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -- * IN THE SOFTWARE. -- */ -- --#ifndef __HYPERCALL_H__ --#define __HYPERCALL_H__ -- --#include --#include -- --#ifndef __HYPERVISOR_H__ --# error "please don't include this file directly" --#endif -- --#ifdef CONFIG_XEN --#define HYPERCALL_STR(name) \ -- "call hypercall_page + ("__stringify(__HYPERVISOR_##name)" * 32)" --#else --#define HYPERCALL_STR(name) \ -- "mov $("__stringify(__HYPERVISOR_##name)" * 32),%%eax; "\ -- "add hypercall_stubs(%%rip),%%rax; " \ -- "call *%%rax" --#endif -- --#define _hypercall0(type, name) \ --({ \ -- type __res; \ -- asm volatile ( \ -- HYPERCALL_STR(name) \ -- : "=a" (__res) \ -- : \ -- : "memory" ); \ -- __res; \ --}) -- --#define _hypercall1(type, name, a1) \ --({ \ -- type __res; \ -- long __ign1; \ -- asm volatile ( \ -- HYPERCALL_STR(name) \ -- : "=a" (__res), "=D" (__ign1) \ -- : "1" ((long)(a1)) \ -- : "memory" ); \ -- __res; \ --}) -- --#define _hypercall2(type, name, a1, a2) \ --({ \ -- type __res; \ -- long __ign1, __ign2; \ -- asm volatile ( \ -- HYPERCALL_STR(name) \ -- : "=a" (__res), "=D" (__ign1), "=S" (__ign2) \ -- : "1" ((long)(a1)), "2" ((long)(a2)) \ -- : "memory" ); \ -- __res; \ --}) -- --#define _hypercall3(type, name, a1, a2, a3) \ --({ \ -- type __res; \ -- long __ign1, __ign2, __ign3; \ -- asm volatile ( \ -- HYPERCALL_STR(name) \ -- : "=a" (__res), "=D" (__ign1), "=S" (__ign2), \ -- "=d" (__ign3) \ -- : "1" ((long)(a1)), "2" ((long)(a2)), \ -- "3" ((long)(a3)) \ -- : "memory" ); \ -- __res; \ --}) -- --#define _hypercall4(type, name, a1, a2, a3, a4) \ --({ \ -- type __res; \ -- long __ign1, __ign2, __ign3; \ -- register long __arg4 asm("r10") = (long)(a4); \ -- asm volatile ( \ -- HYPERCALL_STR(name) \ -- : "=a" (__res), "=D" (__ign1), "=S" (__ign2), \ -- "=d" (__ign3), "+r" (__arg4) \ -- : "1" ((long)(a1)), "2" ((long)(a2)), \ -- "3" ((long)(a3)) \ -- : "memory" ); \ -- __res; \ --}) -- --#define _hypercall5(type, name, a1, a2, a3, a4, a5) \ --({ \ -- type __res; \ -- long __ign1, __ign2, __ign3; \ -- register long __arg4 asm("r10") = (long)(a4); \ -- register long __arg5 asm("r8") = (long)(a5); \ -- asm volatile ( \ -- HYPERCALL_STR(name) \ -- : "=a" (__res), "=D" (__ign1), "=S" (__ign2), \ -- "=d" (__ign3), "+r" (__arg4), "+r" (__arg5) \ -- : "1" ((long)(a1)), "2" ((long)(a2)), \ -- "3" ((long)(a3)) \ -- : "memory" ); \ -- __res; \ --}) -- --#define _hypercall(type, op, a1, a2, a3, a4, a5) \ --({ \ -- type __res; \ -- register typeof((a1)+0) __arg1 asm("rdi") = (a1); \ -- register typeof((a2)+0) __arg2 asm("rsi") = (a2); \ -- register typeof((a3)+0) __arg3 asm("rdx") = (a3); \ -- register typeof((a4)+0) __arg4 asm("r10") = (a4); \ -- register typeof((a5)+0) __arg5 asm("r8") = (a5); \ -- asm volatile ( \ -- "call *%6" \ -- : "=a" (__res), "+r" (__arg1), "+r" (__arg2), \ -- "+r" (__arg3), "+r" (__arg4), "+r" (__arg5) \ -- : "0" (hypercall_page + (op) * 32) \ -- : "memory" ); \ -- __res; \ --}) -+#define HYPERCALL_arg1 "rdi" -+#define HYPERCALL_arg2 "rsi" -+#define HYPERCALL_arg3 "rdx" -+#define HYPERCALL_arg4 "r10" -+#define HYPERCALL_arg5 "r8" +@@ -1694,7 +1696,7 @@ static int __init netback_init(void) + + mmap_pages = alloc_empty_pages_and_pagevec(MAX_PENDING_REQS); + if (mmap_pages == NULL) { +- printk("%s: out of memory\n", __FUNCTION__); ++ pr_err("%s: out of memory\n", __FUNCTION__); + return -ENOMEM; + } - #if CONFIG_XEN_COMPAT <= 0x030002 --int __must_check HYPERVISOR_event_channel_op_compat(int, void *); --int __must_check HYPERVISOR_physdev_op_compat(int, void *); --#endif -- --static inline int __must_check --HYPERVISOR_set_trap_table( -- const trap_info_t *table) --{ -- return _hypercall1(int, set_trap_table, table); --} +--- a/drivers/xen/netback/xenbus.c ++++ b/drivers/xen/netback/xenbus.c +@@ -167,11 +167,9 @@ fail: + * and vif variables to the environment, for the benefit of the vif-* hotplug + * scripts. + */ +-static int netback_uevent(struct xenbus_device *xdev, char **envp, +- int num_envp, char *buffer, int buffer_size) ++static int netback_uevent(struct xenbus_device *xdev, struct kobj_uevent_env *env) + { + struct backend_info *be; +- int i = 0, length = 0; + char *val; + + DPRINTK("netback_uevent"); +@@ -182,21 +180,16 @@ static int netback_uevent(struct xenbus_ + xenbus_dev_fatal(xdev, err, "reading script"); + return err; + } +- else { +- add_uevent_var(envp, num_envp, &i, buffer, buffer_size, +- &length, "script=%s", val); +- kfree(val); +- } ++ ++ add_uevent_var(env, "script=%s", val); ++ kfree(val); + + down_read(&teardown_sem); + be = xdev->dev.driver_data; + if (be && be->netif) +- add_uevent_var(envp, num_envp, &i, buffer, buffer_size, +- &length, "vif=%s", be->netif->dev->name); ++ add_uevent_var(env, "vif=%s", be->netif->dev->name); + up_read(&teardown_sem); + +- envp[i] = NULL; - --static inline int __must_check --HYPERVISOR_mmu_update( -- mmu_update_t *req, unsigned int count, unsigned int *success_count, -- domid_t domid) --{ -- if (arch_use_lazy_mmu_mode()) -- return xen_multi_mmu_update(req, count, success_count, domid); -- return _hypercall4(int, mmu_update, req, count, success_count, domid); --} + return 0; + } + +@@ -244,8 +237,8 @@ static void frontend_changed(struct xenb + switch (frontend_state) { + case XenbusStateInitialising: + if (dev->state == XenbusStateClosed) { +- printk(KERN_INFO "%s: %s: prepare for reconnect\n", +- __FUNCTION__, dev->nodename); ++ pr_info("%s: %s: prepare for reconnect\n", ++ __FUNCTION__, dev->nodename); + xenbus_switch_state(dev, XenbusStateInitWait); + } + break; +--- a/drivers/xen/netfront/accel.c ++++ b/drivers/xen/netfront/accel.c +@@ -40,10 +40,6 @@ + #define DPRINTK(fmt, args...) \ + pr_debug("netfront/accel (%s:%d) " fmt, \ + __FUNCTION__, __LINE__, ##args) +-#define IPRINTK(fmt, args...) \ +- printk(KERN_INFO "netfront/accel: " fmt, ##args) +-#define WPRINTK(fmt, args...) \ +- printk(KERN_WARNING "netfront/accel: " fmt, ##args) + + static int netfront_remove_accelerator(struct netfront_info *np, + struct xenbus_device *dev); +@@ -325,7 +321,7 @@ accelerator_set_vif_state_hooks(struct n + DPRINTK("%p\n",vif_state); + + /* Make sure there are no data path operations going on */ +- netif_poll_disable(vif_state->np->netdev); ++ napi_disable(&vif_state->np->napi); + netif_tx_lock_bh(vif_state->np->netdev); + + accelerator = vif_state->np->accelerator; +@@ -334,7 +330,7 @@ accelerator_set_vif_state_hooks(struct n + spin_unlock_irqrestore(&accelerator->vif_states_lock, flags); + + netif_tx_unlock_bh(vif_state->np->netdev); +- netif_poll_enable(vif_state->np->netdev); ++ napi_enable(&vif_state->np->napi); + } + + +@@ -508,7 +504,7 @@ accelerator_remove_single_hook(struct ne + unsigned long flags; + + /* Make sure there are no data path operations going on */ +- netif_poll_disable(vif_state->np->netdev); ++ napi_disable(&vif_state->np->napi); + netif_tx_lock_bh(vif_state->np->netdev); + + spin_lock_irqsave(&accelerator->vif_states_lock, flags); +@@ -524,7 +520,7 @@ accelerator_remove_single_hook(struct ne + spin_unlock_irqrestore(&accelerator->vif_states_lock, flags); + + netif_tx_unlock_bh(vif_state->np->netdev); +- netif_poll_enable(vif_state->np->netdev); ++ napi_enable(&vif_state->np->napi); + } + + +--- a/drivers/xen/netfront/netfront.c ++++ b/drivers/xen/netfront/netfront.c +@@ -206,10 +206,7 @@ static inline grant_ref_t xennet_get_rx_ + #define DPRINTK(fmt, args...) \ + pr_debug("netfront (%s:%d) " fmt, \ + __FUNCTION__, __LINE__, ##args) +-#define IPRINTK(fmt, args...) \ +- printk(KERN_INFO "netfront: " fmt, ##args) +-#define WPRINTK(fmt, args...) \ +- printk(KERN_WARNING "netfront: " fmt, ##args) ++#define WPRINTK(fmt, args...) pr_warning("netfront: " fmt, ##args) + + static int setup_device(struct xenbus_device *, struct netfront_info *); + static struct net_device *create_netdev(struct xenbus_device *); +@@ -262,16 +259,16 @@ static int __devinit netfront_probe(stru + + err = register_netdev(info->netdev); + if (err) { +- printk(KERN_WARNING "%s: register_netdev err=%d\n", +- __FUNCTION__, err); ++ pr_warning("%s: register_netdev err=%d\n", ++ __FUNCTION__, err); + goto fail; + } + + err = xennet_sysfs_addif(info->netdev); + if (err) { + unregister_netdev(info->netdev); +- printk(KERN_WARNING "%s: add sysfs failed err=%d\n", +- __FUNCTION__, err); ++ pr_warning("%s: add sysfs failed err=%d\n", ++ __FUNCTION__, err); + goto fail; + } + +@@ -627,11 +624,12 @@ int netfront_check_queue_ready(struct ne + } + EXPORT_SYMBOL(netfront_check_queue_ready); + - --static inline int __must_check --HYPERVISOR_mmuext_op( -- struct mmuext_op *op, unsigned int count, unsigned int *success_count, -- domid_t domid) --{ -- if (arch_use_lazy_mmu_mode()) -- return xen_multi_mmuext_op(op, count, success_count, domid); -- return _hypercall4(int, mmuext_op, op, count, success_count, domid); --} + static int network_open(struct net_device *dev) + { + struct netfront_info *np = netdev_priv(dev); + ++ napi_enable(&np->napi); ++ + spin_lock_bh(&np->rx_lock); + if (netfront_carrier_ok(np)) { + network_alloc_rx_buffers(dev); +@@ -639,7 +637,7 @@ static int network_open(struct net_devic + if (RING_HAS_UNCONSUMED_RESPONSES(&np->rx)){ + netfront_accelerator_call_stop_napi_irq(np, dev); + +- netif_rx_schedule(dev); ++ netif_rx_schedule(dev, &np->napi); + } + } + spin_unlock_bh(&np->rx_lock); +@@ -673,9 +671,8 @@ static void network_tx_buf_gc(struct net + skb = np->tx_skbs[id]; + if (unlikely(gnttab_query_foreign_access( + np->grant_tx_ref[id]) != 0)) { +- printk(KERN_ALERT "network_tx_buf_gc: warning " +- "-- grant still in use by backend " +- "domain.\n"); ++ pr_alert("network_tx_buf_gc: grant still" ++ " in use by backend domain\n"); + BUG(); + } + gnttab_end_foreign_access_ref(np->grant_tx_ref[id]); +@@ -711,7 +708,7 @@ static void rx_refill_timeout(unsigned l + + netfront_accelerator_call_stop_napi_irq(np, dev); + +- netif_rx_schedule(dev); ++ netif_rx_schedule(dev, &np->napi); + } + + static void network_alloc_rx_buffers(struct net_device *dev) +@@ -962,8 +959,7 @@ static int network_start_xmit(struct sk_ + + frags += PFN_UP(offset + len); + if (unlikely(frags > MAX_SKB_FRAGS + 1)) { +- printk(KERN_ALERT "xennet: skb rides the rocket: %d frags\n", +- frags); ++ pr_alert("xennet: skb rides the rocket: %d frags\n", frags); + dump_stack(); + goto drop; + } +@@ -1066,7 +1062,7 @@ static irqreturn_t netif_int(int irq, vo + if (RING_HAS_UNCONSUMED_RESPONSES(&np->rx)) { + netfront_accelerator_call_stop_napi_irq(np, dev); + +- netif_rx_schedule(dev); ++ netif_rx_schedule(dev, &np->napi); + dev->last_rx = jiffies; + } + } +@@ -1319,15 +1315,16 @@ static int xennet_set_skb_gso(struct sk_ + #endif + } + +-static int netif_poll(struct net_device *dev, int *pbudget) ++static int netif_poll(struct napi_struct *napi, int budget) + { +- struct netfront_info *np = netdev_priv(dev); ++ struct netfront_info *np = container_of(napi, struct netfront_info, napi); ++ struct net_device *dev = np->netdev; + struct sk_buff *skb; + struct netfront_rx_info rinfo; + struct netif_rx_response *rx = &rinfo.rx; + struct netif_extra_info *extras = rinfo.extras; + RING_IDX i, rp; +- int work_done, budget, more_to_do = 1, accel_more_to_do = 1; ++ int work_done, more_to_do = 1, accel_more_to_do = 1; + struct sk_buff_head rxq; + struct sk_buff_head errq; + struct sk_buff_head tmpq; +@@ -1347,8 +1344,6 @@ static int netif_poll(struct net_device + skb_queue_head_init(&errq); + skb_queue_head_init(&tmpq); + +- if ((budget = *pbudget) > dev->quota) +- budget = dev->quota; + rp = np->rx.sring->rsp_prod; + rmb(); /* Ensure we see queued responses up to 'rp'. */ + +@@ -1507,9 +1502,6 @@ err: + accel_more_to_do = 0; + } + +- *pbudget -= work_done; +- dev->quota -= work_done; - --static inline int __must_check --HYPERVISOR_set_gdt( -- unsigned long *frame_list, unsigned int entries) --{ -- return _hypercall2(int, set_gdt, frame_list, entries); --} + if (work_done < budget) { + local_irq_save(flags); + +@@ -1526,14 +1518,14 @@ err: + } + + if (!more_to_do && !accel_more_to_do) +- __netif_rx_complete(dev); ++ __netif_rx_complete(dev, napi); + + local_irq_restore(flags); + } + + spin_unlock(&np->rx_lock); + +- return more_to_do | accel_more_to_do; ++ return work_done; + } + + static void netif_release_tx_bufs(struct netfront_info *np) +@@ -1676,6 +1668,7 @@ static int network_close(struct net_devi + { + struct netfront_info *np = netdev_priv(dev); + netif_stop_queue(np->netdev); ++ napi_disable(&np->napi); + return 0; + } + +@@ -1777,9 +1770,13 @@ static const struct xennet_stat { + }, + }; + +-static int xennet_get_stats_count(struct net_device *dev) ++static int xennet_get_sset_count(struct net_device *dev, int sset) + { +- return ARRAY_SIZE(xennet_stats); ++ switch (sset) { ++ case ETH_SS_STATS: ++ return ARRAY_SIZE(xennet_stats); ++ } ++ return -EOPNOTSUPP; + } + + static void xennet_get_ethtool_stats(struct net_device *dev, +@@ -1931,7 +1928,7 @@ static struct ethtool_ops network_ethtoo + #endif + .get_link = ethtool_op_get_link, + +- .get_stats_count = xennet_get_stats_count, ++ .get_sset_count = xennet_get_sset_count, + .get_ethtool_stats = xennet_get_ethtool_stats, + .get_strings = xennet_get_strings, + }; +@@ -2081,8 +2078,7 @@ static struct net_device * __devinit cre + + netdev = alloc_etherdev(sizeof(struct netfront_info)); + if (!netdev) { +- printk(KERN_WARNING "%s> alloc_etherdev failed.\n", +- __FUNCTION__); ++ pr_warning("%s: alloc_etherdev failed\n", __FUNCTION__); + return ERR_PTR(-ENOMEM); + } + +@@ -2117,14 +2113,14 @@ static struct net_device * __devinit cre + /* A grant for every tx ring slot */ + if (gnttab_alloc_grant_references(TX_MAX_TARGET, + &np->gref_tx_head) < 0) { +- printk(KERN_ALERT "#### netfront can't alloc tx grant refs\n"); ++ pr_alert("#### netfront can't alloc tx grant refs\n"); + err = -ENOMEM; + goto exit; + } + /* A grant for every rx ring slot */ + if (gnttab_alloc_grant_references(RX_MAX_TARGET, + &np->gref_rx_head) < 0) { +- printk(KERN_ALERT "#### netfront can't alloc rx grant refs\n"); ++ pr_alert("#### netfront can't alloc rx grant refs\n"); + err = -ENOMEM; + goto exit_free_tx; + } +@@ -2133,16 +2129,14 @@ static struct net_device * __devinit cre + netdev->hard_start_xmit = network_start_xmit; + netdev->stop = network_close; + netdev->get_stats = network_get_stats; +- netdev->poll = netif_poll; ++ netif_napi_add(netdev, &np->napi, netif_poll, 64); + netdev->set_multicast_list = network_set_multicast_list; + netdev->uninit = netif_uninit; + netdev->set_mac_address = xennet_set_mac_address; + netdev->change_mtu = xennet_change_mtu; +- netdev->weight = 64; + netdev->features = NETIF_F_IP_CSUM; + + SET_ETHTOOL_OPS(netdev, &network_ethtool_ops); +- SET_MODULE_OWNER(netdev); + SET_NETDEV_DEV(netdev, &dev->dev); + + np->netdev = netdev; +@@ -2255,7 +2249,7 @@ static int __init netif_init(void) + + netif_init_accel(); + +- IPRINTK("Initialising virtual ethernet driver.\n"); ++ pr_info("Initialising virtual ethernet driver.\n"); + + #ifdef CONFIG_INET + (void)register_inetaddr_notifier(¬ifier_inetdev); +--- a/drivers/xen/netfront/netfront.h ++++ b/drivers/xen/netfront/netfront.h +@@ -156,6 +156,8 @@ struct netfront_info { + spinlock_t tx_lock; + spinlock_t rx_lock; + ++ struct napi_struct napi; ++ + unsigned int irq; + unsigned int copying_receiver; + unsigned int carrier; +--- a/drivers/xen/pcifront/Makefile ++++ b/drivers/xen/pcifront/Makefile +@@ -2,6 +2,4 @@ obj-y += pcifront.o + + pcifront-y := pci_op.o xenbus.o pci.o + +-ifeq ($(CONFIG_XEN_PCIDEV_FE_DEBUG),y) +-EXTRA_CFLAGS += -DDEBUG +-endif ++ccflags-$(CONFIG_XEN_PCIDEV_FE_DEBUG) += -DDEBUG +--- a/drivers/xen/scsiback/emulate.c ++++ b/drivers/xen/scsiback/emulate.c +@@ -114,9 +114,10 @@ static void resp_not_supported_cmd(pendi + } + + +-static int __copy_to_sg(struct scatterlist *sg, unsigned int nr_sg, ++static int __copy_to_sg(struct scatterlist *sgl, unsigned int nr_sg, + void *buf, unsigned int buflen) + { ++ struct scatterlist *sg; + void *from = buf; + void *to; + unsigned int from_rest = buflen; +@@ -125,17 +126,17 @@ static int __copy_to_sg(struct scatterli + unsigned int i; + unsigned long pfn; + +- for (i = 0; i < nr_sg; i++) { +- if (sg->page == NULL) { +- printk(KERN_WARNING "%s: inconsistent length field in " +- "scatterlist\n", __FUNCTION__); ++ for_each_sg (sgl, sg, nr_sg, i) { ++ if (sg_page(sg) == NULL) { ++ pr_warning("%s: inconsistent length field in " ++ "scatterlist\n", __FUNCTION__); + return -ENOMEM; + } + + to_capa = sg->length; + copy_size = min_t(unsigned int, to_capa, from_rest); + +- pfn = page_to_pfn(sg->page); ++ pfn = page_to_pfn(sg_page(sg)); + to = pfn_to_kaddr(pfn) + (sg->offset); + memcpy(to, from, copy_size); + +@@ -144,19 +145,18 @@ static int __copy_to_sg(struct scatterli + return 0; + } + +- sg++; + from += copy_size; + } + +- printk(KERN_WARNING "%s: no space in scatterlist\n", +- __FUNCTION__); ++ pr_warning("%s: no space in scatterlist\n", __FUNCTION__); + return -ENOMEM; + } + +-static int __maybe_unused __copy_from_sg(struct scatterlist *sg, ++static int __maybe_unused __copy_from_sg(struct scatterlist *sgl, + unsigned int nr_sg, void *buf, + unsigned int buflen) + { ++ struct scatterlist *sg; + void *from; + void *to = buf; + unsigned int from_rest; +@@ -165,29 +165,26 @@ static int __maybe_unused __copy_from_sg + unsigned int i; + unsigned long pfn; + +- for (i = 0; i < nr_sg; i++) { +- if (sg->page == NULL) { +- printk(KERN_WARNING "%s: inconsistent length field in " +- "scatterlist\n", __FUNCTION__); ++ for_each_sg (sgl, sg, nr_sg, i) { ++ if (sg_page(sg) == NULL) { ++ pr_warning("%s: inconsistent length field in " ++ "scatterlist\n", __FUNCTION__); + return -ENOMEM; + } + + from_rest = sg->length; + if ((from_rest > 0) && (to_capa < from_rest)) { +- printk(KERN_WARNING +- "%s: no space in destination buffer\n", +- __FUNCTION__); ++ pr_warning("%s: no space in destination buffer\n", ++ __FUNCTION__); + return -ENOMEM; + } + copy_size = from_rest; + +- pfn = page_to_pfn(sg->page); ++ pfn = page_to_pfn(sg_page(sg)); + from = pfn_to_kaddr(pfn) + (sg->offset); + memcpy(to, from, copy_size); + + to_capa -= copy_size; +- +- sg++; + to += copy_size; + } + +@@ -248,7 +245,7 @@ static void __report_luns(pending_req_t + + VSCSI_REPORT_LUNS_HEADER; + retry: + if ((buff = kzalloc(alloc_len, GFP_KERNEL)) == NULL) { +- printk(KERN_ERR "scsiback:%s kmalloc err\n", __FUNCTION__); ++ pr_err("scsiback:%s kmalloc err\n", __FUNCTION__); + goto fail; + } + +--- a/drivers/xen/scsiback/interface.c ++++ b/drivers/xen/scsiback/interface.c +@@ -68,7 +68,7 @@ int scsiback_init_sring(struct vscsibk_i + int err; + + if (info->irq) { +- printk(KERN_ERR "scsiback: Already connected through?\n"); ++ pr_err("scsiback: Already connected through?\n"); + return -1; + } + +@@ -128,7 +128,7 @@ int __init scsiback_interface_init(void) + scsiback_cachep = kmem_cache_create("vscsiif_cache", + sizeof(struct vscsibk_info), 0, 0, NULL); + if (!scsiback_cachep) { +- printk(KERN_ERR "scsiback: can't init scsi cache\n"); ++ pr_err("scsiback: can't init scsi cache\n"); + return -ENOMEM; + } + +--- a/drivers/xen/scsiback/scsiback.c ++++ b/drivers/xen/scsiback/scsiback.c +@@ -194,14 +194,10 @@ static void scsiback_print_status(char * + { + struct scsi_device *sdev = pending_req->sdev; + +- printk(KERN_ERR "scsiback: %d:%d:%d:%d ",sdev->host->host_no, +- sdev->channel, sdev->id, sdev->lun); +- printk(KERN_ERR "status = 0x%02x, message = 0x%02x, host = 0x%02x, driver = 0x%02x\n", +- status_byte(errors), msg_byte(errors), +- host_byte(errors), driver_byte(errors)); - --static inline int __must_check --HYPERVISOR_stack_switch( -- unsigned long ss, unsigned long esp) --{ -- return _hypercall2(int, stack_switch, ss, esp); --} +- printk(KERN_ERR "scsiback: cmnd[0]=0x%02X\n", +- pending_req->cmnd[0]); ++ pr_err("scsiback[%d:%d:%d:%d] cmnd[0]=%02x -> st=%02x msg=%02x host=%02x drv=%02x\n", ++ sdev->host->host_no, sdev->channel, sdev->id, sdev->lun, ++ pending_req->cmnd[0], status_byte(errors), msg_byte(errors), ++ host_byte(errors), driver_byte(errors)); + + if (CHECK_CONDITION & status_byte(errors)) + __scsi_print_sense("scsiback", sense_buffer, SCSI_SENSE_BUFFERSIZE); +@@ -250,14 +246,18 @@ static int scsiback_gnttab_data_map(vscs + write = (data_dir == DMA_TO_DEVICE); + + if (nr_segments) { ++ struct scatterlist *sg; ++ + /* free of (sgl) in fast_flush_area()*/ + pending_req->sgl = kmalloc(sizeof(struct scatterlist) * nr_segments, + GFP_KERNEL); + if (!pending_req->sgl) { +- printk(KERN_ERR "scsiback: %s: kmalloc() error.\n", __FUNCTION__); ++ pr_err("scsiback: %s: kmalloc() error\n", __FUNCTION__); + return -ENOMEM; + } + ++ sg_init_table(pending_req->sgl, nr_segments); ++ + flags = GNTMAP_host_map; + if (write) + flags |= GNTMAP_readonly; +@@ -270,14 +270,14 @@ static int scsiback_gnttab_data_map(vscs + err = HYPERVISOR_grant_table_op(GNTTABOP_map_grant_ref, map, nr_segments); + BUG_ON(err); + +- for (i = 0; i < nr_segments; i++) { ++ for_each_sg (pending_req->sgl, sg, nr_segments, i) { + struct page *pg; + + /* Retry maps with GNTST_eagain */ + if (unlikely(map[i].status == GNTST_eagain)) + gnttab_check_GNTST_eagain_while(GNTTABOP_map_grant_ref, &map[i]); + if (unlikely(map[i].status != GNTST_okay)) { +- printk(KERN_ERR "scsiback: invalid buffer -- could not remap it\n"); ++ pr_err("scsiback: invalid buffer -- could not remap it\n"); + map[i].handle = SCSIBACK_INVALID_HANDLE; + err |= 1; + } +@@ -292,15 +292,14 @@ static int scsiback_gnttab_data_map(vscs + set_phys_to_machine(page_to_pfn(pg), + FOREIGN_FRAME(map[i].dev_bus_addr >> PAGE_SHIFT)); + +- pending_req->sgl[i].page = pg; +- pending_req->sgl[i].offset = ring_req->seg[i].offset; +- pending_req->sgl[i].length = ring_req->seg[i].length; +- data_len += pending_req->sgl[i].length; ++ sg_set_page(sg, pg, ring_req->seg[i].length, ++ ring_req->seg[i].offset); ++ data_len += sg->length; + + barrier(); +- if (pending_req->sgl[i].offset >= PAGE_SIZE || +- pending_req->sgl[i].length > PAGE_SIZE || +- pending_req->sgl[i].offset + pending_req->sgl[i].length > PAGE_SIZE) ++ if (sg->offset >= PAGE_SIZE || ++ sg->length > PAGE_SIZE || ++ sg->offset + sg->length > PAGE_SIZE) + err |= 1; + + } +@@ -329,27 +328,14 @@ static int scsiback_merge_bio(struct req + + blk_queue_bounce(q, &bio); + +- if (!rq->bio) +- blk_rq_bio_prep(q, rq, bio); +- else if (!ll_back_merge_fn(q, rq, bio)) +- return -EINVAL; +- else { +- rq->biotail->bi_next = bio; +- rq->biotail = bio; +- } - - static inline int __must_check - HYPERVISOR_set_callbacks( - unsigned long event_address, unsigned long failsafe_address, -@@ -205,27 +13,7 @@ HYPERVISOR_set_callbacks( - return _hypercall3(int, set_callbacks, - event_address, failsafe_address, syscall_address); +- return 0; ++ return blk_rq_append_bio(q, rq, bio); } + + + /* quoted scsi_lib.c/scsi_bi_endio */ +-static int scsiback_bi_endio(struct bio *bio, unsigned int bytes_done, int error) ++static void scsiback_bi_endio(struct bio *bio, int error) + { +- if (bio->bi_size) +- return 1; - --static inline int --HYPERVISOR_fpu_taskswitch( -- int set) --{ -- return _hypercall1(int, fpu_taskswitch, set); --} -- --static inline int __must_check --HYPERVISOR_sched_op_compat( -- int cmd, unsigned long arg) --{ -- return _hypercall2(int, sched_op_compat, cmd, arg); --} + bio_put(bio); +- return 0; + } + + +@@ -360,16 +346,16 @@ static int request_map_sg(struct request + struct request_queue *q = rq->q; + int nr_pages; + unsigned int nsegs = count; - --static inline int __must_check --HYPERVISOR_sched_op( -- int cmd, void *arg) --{ -- return _hypercall2(int, sched_op, cmd, arg); --} -+#endif + unsigned int data_len = 0, len, bytes, off; ++ struct scatterlist *sg; + struct page *page; + struct bio *bio = NULL; + int i, err, nr_vecs = 0; + +- for (i = 0; i < nsegs; i++) { +- page = pending_req->sgl[i].page; +- off = (unsigned int)pending_req->sgl[i].offset; +- len = (unsigned int)pending_req->sgl[i].length; ++ for_each_sg (pending_req->sgl, sg, nsegs, i) { ++ page = sg_page(sg); ++ off = sg->offset; ++ len = sg->length; + data_len += len; + + nr_pages = (len + off + PAGE_SIZE - 1) >> PAGE_SHIFT; +@@ -397,7 +383,7 @@ static int request_map_sg(struct request + if (bio->bi_vcnt >= nr_vecs) { + err = scsiback_merge_bio(rq, bio); + if (err) { +- bio_endio(bio, bio->bi_size, 0); ++ bio_endio(bio, 0); + goto free_bios; + } + bio = NULL; +@@ -420,7 +406,7 @@ free_bios: + /* + * call endio instead of bio_put incase it was bounced + */ +- bio_endio(bio, bio->bi_size, 0); ++ bio_endio(bio, 0); + } + + return err; +@@ -463,7 +449,7 @@ void scsiback_cmd_exec(pending_req_t *pe + if (nr_segments) { + + if (request_map_sg(rq, pending_req, nr_segments)) { +- printk(KERN_ERR "scsiback: SG Request Map Error\n"); ++ pr_err("scsiback: SG Request Map Error\n"); + return; + } + } +@@ -614,7 +600,7 @@ static int _scsiback_do_cmd_fn(struct vs + break; + default: + if(!err && printk_ratelimit()) +- printk(KERN_ERR "scsiback: invalid request\n"); ++ pr_err("scsiback: invalid request\n"); + scsiback_do_resp_with_sense(NULL, DRIVER_ERROR << 24, + 0, pending_req); + break; +@@ -717,7 +703,7 @@ out_of_memory: + kfree(pending_reqs); + kfree(pending_grant_handles); + free_empty_pages_and_pagevec(pending_pages, mmap_pages); +- printk(KERN_ERR "scsiback: %s: out of memory\n", __FUNCTION__); ++ pr_err("scsiback: %s: out of memory\n", __FUNCTION__); + return -ENOMEM; + } + +--- a/drivers/xen/scsiback/translate.c ++++ b/drivers/xen/scsiback/translate.c +@@ -62,8 +62,8 @@ int scsiback_add_translation_entry(struc + if ((entry->v.chn == v->chn) && + (entry->v.tgt == v->tgt) && + (entry->v.lun == v->lun)) { +- printk(KERN_WARNING "scsiback: Virtual ID is already used. " +- "Assignment was not performed.\n"); ++ pr_warning("scsiback: Virtual ID is already used. " ++ "Assignment was not performed.\n"); + err = -EEXIST; + goto out; + } +@@ -72,7 +72,7 @@ int scsiback_add_translation_entry(struc + + /* Create a new translation entry and add to the list */ + if ((new = kmalloc(sizeof(struct v2p_entry), GFP_ATOMIC)) == NULL) { +- printk(KERN_ERR "scsiback: %s: kmalloc() error.\n", __FUNCTION__); ++ pr_err("scsiback: %s: kmalloc() error\n", __FUNCTION__); + err = -ENOMEM; + goto out; + } +--- a/drivers/xen/scsiback/xenbus.c ++++ b/drivers/xen/scsiback/xenbus.c +@@ -101,14 +101,13 @@ struct scsi_device *scsiback_get_scsi_de + + shost = scsi_host_lookup(phy->hst); + if (IS_ERR(shost)) { +- printk(KERN_ERR "scsiback: host%d doesn't exist.\n", +- phy->hst); ++ pr_err("scsiback: host%d doesn't exist\n", phy->hst); + return NULL; + } + sdev = scsi_device_lookup(shost, phy->chn, phy->tgt, phy->lun); + if (!sdev) { +- printk(KERN_ERR "scsiback: %d:%d:%d:%d doesn't exist.\n", +- phy->hst, phy->chn, phy->tgt, phy->lun); ++ pr_err("scsiback: %d:%d:%d:%d doesn't exist\n", ++ phy->hst, phy->chn, phy->tgt, phy->lun); + scsi_host_put(shost); + return NULL; + } +@@ -177,7 +176,8 @@ static void scsiback_do_lun_hotplug(stru + if (!err) { + if (xenbus_printf(XBT_NIL, dev->nodename, state_str, + "%d", XenbusStateInitialised)) { +- printk(KERN_ERR "scsiback: xenbus_printf error %s\n", state_str); ++ pr_err("scsiback: xenbus_printf error %s\n", ++ state_str); + scsiback_del_translation_entry(be->info, &vir); + } + } else { +@@ -192,7 +192,8 @@ static void scsiback_do_lun_hotplug(stru + if (!scsiback_del_translation_entry(be->info, &vir)) { + if (xenbus_printf(XBT_NIL, dev->nodename, state_str, + "%d", XenbusStateClosed)) +- printk(KERN_ERR "scsiback: xenbus_printf error %s\n", state_str); ++ pr_err("scsiback: xenbus_printf error %s\n", ++ state_str); + } + } + break; +@@ -202,7 +203,8 @@ static void scsiback_do_lun_hotplug(stru + /* modify vscsi-devs/dev-x/state */ + if (xenbus_printf(XBT_NIL, dev->nodename, state_str, + "%d", XenbusStateConnected)) { +- printk(KERN_ERR "scsiback: xenbus_printf error %s\n", state_str); ++ pr_err("scsiback: xenbus_printf error %s\n", ++ state_str); + scsiback_del_translation_entry(be->info, &vir); + xenbus_printf(XBT_NIL, dev->nodename, state_str, + "%d", XenbusStateClosed); +@@ -345,7 +347,7 @@ static int scsiback_probe(struct xenbus_ - static inline long __must_check - HYPERVISOR_set_timer_op( -@@ -235,34 +23,6 @@ HYPERVISOR_set_timer_op( - } - static inline int __must_check --HYPERVISOR_platform_op( -- struct xen_platform_op *platform_op) --{ -- platform_op->interface_version = XENPF_INTERFACE_VERSION; -- return _hypercall1(int, platform_op, platform_op); --} --static inline int __must_check --HYPERVISOR_mca( -- struct xen_mc *mc_op) --{ -- mc_op->interface_version = XEN_MCA_INTERFACE_VERSION; -- return _hypercall1(int, mca, mc_op); --} --static inline int __must_check --HYPERVISOR_set_debugreg( -- unsigned int reg, unsigned long value) --{ -- return _hypercall2(int, set_debugreg, reg, value); --} -- --static inline unsigned long __must_check --HYPERVISOR_get_debugreg( -- unsigned int reg) --{ -- return _hypercall1(unsigned long, get_debugreg, reg); --} -- --static inline int __must_check - HYPERVISOR_update_descriptor( - unsigned long ma, unsigned long word) + fail: +- printk(KERN_WARNING "scsiback: %s failed\n",__FUNCTION__); ++ pr_warning("scsiback: %s failed\n",__FUNCTION__); + scsiback_remove(dev); + + return err; +--- a/drivers/xen/scsifront/scsifront.c ++++ b/drivers/xen/scsifront/scsifront.c +@@ -260,10 +260,9 @@ static int map_data_for_request(struct v { -@@ -270,22 +30,6 @@ HYPERVISOR_update_descriptor( - } + grant_ref_t gref_head; + struct page *page; +- int err, i, ref, ref_cnt = 0; ++ int err, ref, ref_cnt = 0; + int write = (sc->sc_data_direction == DMA_TO_DEVICE); +- int nr_pages, off, len, bytes; +- unsigned int data_len = 0; ++ unsigned int i, nr_pages, off, len, bytes; - static inline int __must_check --HYPERVISOR_memory_op( -- unsigned int cmd, void *arg) --{ -- if (arch_use_lazy_mmu_mode()) -- xen_multicall_flush(false); -- return _hypercall2(int, memory_op, cmd, arg); --} -- --static inline int __must_check --HYPERVISOR_multicall( -- multicall_entry_t *call_list, unsigned int nr_calls) --{ -- return _hypercall2(int, multicall, call_list, nr_calls); --} + if (sc->sc_data_direction == DMA_NONE || !sc->request_bufflen) + return 0; +@@ -277,9 +276,10 @@ static int map_data_for_request(struct v + + if (sc->use_sg) { + /* quoted scsi_lib.c/scsi_req_map_sg . */ +- struct scatterlist *sg = (struct scatterlist *)sc->request_buffer; +- nr_pages = (sc->request_bufflen + sg[0].offset + PAGE_SIZE - 1) >> PAGE_SHIFT; ++ struct scatterlist *sg, *sgl = (struct scatterlist *)sc->request_buffer; ++ unsigned int data_len = sc->request_bufflen; + ++ nr_pages = (sc->request_bufflen + sgl->offset + PAGE_SIZE - 1) >> PAGE_SHIFT; + if (nr_pages > VSCSIIF_SG_TABLESIZE) { + shost_printk(PREFIX(ERR), info->host, + "Unable to map request_buffer for command!\n"); +@@ -287,14 +287,19 @@ static int map_data_for_request(struct v + goto big_to_sg; + } + +- for (i = 0; i < sc->use_sg; i++) { +- page = sg[i].page; +- off = sg[i].offset; +- len = sg[i].length; +- data_len += len; - --static inline int __must_check - HYPERVISOR_update_va_mapping( - unsigned long va, pte_t new_val, unsigned long flags) +- while (len > 0) { ++ for_each_sg (sgl, sg, sc->use_sg, i) { ++ page = sg_page(sg); ++ off = sg->offset; ++ len = sg->length; ++ ++ while (len > 0 && data_len > 0) { ++ /* ++ * sg sends a scatterlist that is larger than ++ * the data_len it wants transferred for certain ++ * IO sizes ++ */ + bytes = min_t(unsigned int, len, PAGE_SIZE - off); ++ bytes = min(bytes, data_len); + + ref = gnttab_claim_grant_reference(&gref_head); + BUG_ON(ref == -ENOSPC); +@@ -309,6 +314,7 @@ static int map_data_for_request(struct v + + page++; + len -= bytes; ++ data_len -= bytes; + off = 0; + ref_cnt++; + } +--- a/drivers/xen/sfc_netback/accel_fwd.c ++++ b/drivers/xen/sfc_netback/accel_fwd.c +@@ -181,10 +181,11 @@ int netback_accel_fwd_add(const __u8 *ma + unsigned long flags; + cuckoo_hash_mac_key key = cuckoo_mac_to_key(mac); + struct port_fwd *fwd_set = (struct port_fwd *)fwd_priv; ++ DECLARE_MAC_BUF(buf); + + BUG_ON(fwd_priv == NULL); + +- DPRINTK("Adding mac " MAC_FMT "\n", MAC_ARG(mac)); ++ DPRINTK("Adding mac %s\n", print_mac(buf, mac)); + + spin_lock_irqsave(&fwd_set->fwd_lock, flags); + +@@ -199,8 +200,8 @@ int netback_accel_fwd_add(const __u8 *ma + if (cuckoo_hash_lookup(&fwd_set->fwd_hash_table, + (cuckoo_hash_key *)(&key), &rc) != 0) { + spin_unlock_irqrestore(&fwd_set->fwd_lock, flags); +- EPRINTK("MAC address " MAC_FMT " already accelerated.\n", +- MAC_ARG(mac)); ++ EPRINTK("MAC address %s already accelerated.\n", ++ print_mac(buf, mac)); + return -EEXIST; + } + +@@ -235,8 +236,9 @@ void netback_accel_fwd_remove(const __u8 + unsigned long flags; + cuckoo_hash_mac_key key = cuckoo_mac_to_key(mac); + struct port_fwd *fwd_set = (struct port_fwd *)fwd_priv; ++ DECLARE_MAC_BUF(buf); + +- DPRINTK("Removing mac " MAC_FMT "\n", MAC_ARG(mac)); ++ DPRINTK("Removing mac %s\n", print_mac(buf, mac)); + + BUG_ON(fwd_priv == NULL); + +@@ -394,14 +396,16 @@ void netback_accel_tx_packet(struct sk_b + + if (is_broadcast_ether_addr(skb_mac_header(skb)) + && packet_is_arp_reply(skb)) { ++ DECLARE_MAC_BUF(buf); ++ + /* + * update our fast path forwarding to reflect this + * gratuitous ARP + */ + mac = skb_mac_header(skb)+ETH_ALEN; + +- DPRINTK("%s: found gratuitous ARP for " MAC_FMT "\n", +- __FUNCTION__, MAC_ARG(mac)); ++ DPRINTK("%s: found gratuitous ARP for %s\n", ++ __FUNCTION__, print_mac(buf, mac)); + + spin_lock_irqsave(&fwd_set->fwd_lock, flags); + /* +--- a/drivers/xen/sfc_netback/accel_msg.c ++++ b/drivers/xen/sfc_netback/accel_msg.c +@@ -57,11 +57,11 @@ static void netback_accel_msg_tx_localma { -@@ -295,57 +39,6 @@ HYPERVISOR_update_va_mapping( - } + unsigned long lock_state; + struct net_accel_msg *msg; ++ DECLARE_MAC_BUF(buf); - static inline int __must_check --HYPERVISOR_event_channel_op( -- int cmd, void *arg) --{ -- int rc = _hypercall2(int, event_channel_op, cmd, arg); -- --#if CONFIG_XEN_COMPAT <= 0x030002 -- if (unlikely(rc == -ENOSYS)) -- rc = HYPERVISOR_event_channel_op_compat(cmd, arg); --#endif -- -- return rc; --} -- --static inline int __must_check --HYPERVISOR_xen_version( -- int cmd, void *arg) --{ -- return _hypercall2(int, xen_version, cmd, arg); --} -- --static inline int __must_check --HYPERVISOR_console_io( -- int cmd, unsigned int count, char *str) --{ -- return _hypercall3(int, console_io, cmd, count, str); --} -- --static inline int __must_check --HYPERVISOR_physdev_op( -- int cmd, void *arg) --{ -- int rc = _hypercall2(int, physdev_op, cmd, arg); -- --#if CONFIG_XEN_COMPAT <= 0x030002 -- if (unlikely(rc == -ENOSYS)) -- rc = HYPERVISOR_physdev_op_compat(cmd, arg); --#endif -- -- return rc; --} -- --static inline int __must_check --HYPERVISOR_grant_table_op( -- unsigned int cmd, void *uop, unsigned int count) --{ -- if (arch_use_lazy_mmu_mode()) -- xen_multicall_flush(false); -- return _hypercall3(int, grant_table_op, cmd, uop, count); --} -- --static inline int __must_check - HYPERVISOR_update_va_mapping_otherdomain( - unsigned long va, pte_t new_val, unsigned long flags, domid_t domid) + BUG_ON(bend == NULL || mac == NULL); + +- VPRINTK("Sending local mac message: " MAC_FMT "\n", +- MAC_ARG((const char *)mac)); ++ VPRINTK("Sending local mac message: %s\n", print_mac(buf, mac)); + + msg = net_accel_msg_start_send(bend->shared_page, &bend->to_domU, + &lock_state); +--- a/drivers/xen/sfc_netfront/accel_msg.c ++++ b/drivers/xen/sfc_netfront/accel_msg.c +@@ -41,11 +41,13 @@ static void vnic_start_interrupts(netfro + /* Prime our interrupt */ + spin_lock_irqsave(&vnic->irq_enabled_lock, flags); + if (!netfront_accel_vi_enable_interrupts(vnic)) { ++ struct netfront_info *np = netdev_priv(vnic->net_dev); ++ + /* Cripes, that was quick, better pass it up */ + netfront_accel_disable_net_interrupts(vnic); + vnic->irq_enabled = 0; + NETFRONT_ACCEL_STATS_OP(vnic->stats.poll_schedule_count++); +- netif_rx_schedule(vnic->net_dev); ++ netif_rx_schedule(vnic->net_dev, &np->napi); + } else { + /* + * Nothing yet, make sure we get interrupts through +@@ -72,6 +74,7 @@ static void vnic_stop_interrupts(netfron + static void vnic_start_fastpath(netfront_accel_vnic *vnic) { -@@ -354,90 +47,8 @@ HYPERVISOR_update_va_mapping_otherdomain - } + struct net_device *net_dev = vnic->net_dev; ++ struct netfront_info *np = netdev_priv(net_dev); + unsigned long flags; - static inline int __must_check --HYPERVISOR_vm_assist( -- unsigned int cmd, unsigned int type) --{ -- return _hypercall2(int, vm_assist, cmd, type); --} -- --static inline int __must_check --HYPERVISOR_vcpu_op( -- int cmd, unsigned int vcpuid, void *extra_args) --{ -- return _hypercall3(int, vcpu_op, cmd, vcpuid, extra_args); --} -- --static inline int __must_check - HYPERVISOR_set_segment_base( - int reg, unsigned long value) - { - return _hypercall2(int, set_segment_base, reg, value); + DPRINTK("%s\n", __FUNCTION__); +@@ -80,9 +83,9 @@ static void vnic_start_fastpath(netfront + vnic->tx_enabled = 1; + spin_unlock_irqrestore(&vnic->tx_lock, flags); + +- netif_poll_disable(net_dev); ++ napi_disable(&np->napi); + vnic->poll_enabled = 1; +- netif_poll_enable(net_dev); ++ napi_enable(&np->napi); + + vnic_start_interrupts(vnic); + } +@@ -114,11 +117,11 @@ void vnic_stop_fastpath(netfront_accel_v + spin_unlock_irqrestore(&vnic->tx_lock, flags1); + + /* Must prevent polls and hold lock to modify poll_enabled */ +- netif_poll_disable(net_dev); ++ napi_disable(&np->napi); + spin_lock_irqsave(&vnic->irq_enabled_lock, flags1); + vnic->poll_enabled = 0; + spin_unlock_irqrestore(&vnic->irq_enabled_lock, flags1); +- netif_poll_enable(net_dev); ++ napi_enable(&np->napi); } -- --static inline int __must_check --HYPERVISOR_suspend( -- unsigned long srec) --{ -- struct sched_shutdown sched_shutdown = { -- .reason = SHUTDOWN_suspend -- }; -- -- int rc = _hypercall3(int, sched_op, SCHEDOP_shutdown, -- &sched_shutdown, srec); -- --#if CONFIG_XEN_COMPAT <= 0x030002 -- if (rc == -ENOSYS) -- rc = _hypercall3(int, sched_op_compat, SCHEDOP_shutdown, -- SHUTDOWN_suspend, srec); --#endif -- -- return rc; --} -- --#if CONFIG_XEN_COMPAT <= 0x030002 --static inline int --HYPERVISOR_nmi_op( -- unsigned long op, void *arg) --{ -- return _hypercall2(int, nmi_op, op, arg); --} --#endif -- --#ifndef CONFIG_XEN --static inline unsigned long __must_check --HYPERVISOR_hvm_op( -- int op, void *arg) --{ -- return _hypercall2(unsigned long, hvm_op, op, arg); --} --#endif -- --static inline int __must_check --HYPERVISOR_callback_op( -- int cmd, const void *arg) --{ -- return _hypercall2(int, callback_op, cmd, arg); --} -- --static inline int __must_check --HYPERVISOR_xenoprof_op( -- int op, void *arg) --{ -- return _hypercall2(int, xenoprof_op, op, arg); --} -- --static inline int __must_check --HYPERVISOR_kexec_op( -- unsigned long op, void *args) --{ -- return _hypercall2(int, kexec_op, op, args); --} -- --static inline int __must_check --HYPERVISOR_tmem_op( -- struct tmem_op *op) --{ -- return _hypercall1(int, tmem_op, op); --} -- --#endif /* __HYPERCALL_H__ */ ---- head.orig/arch/x86/include/mach-xen/asm/hypervisor.h 2012-10-31 11:01:51.000000000 +0100 -+++ head/arch/x86/include/mach-xen/asm/hypervisor.h 2012-10-31 11:11:51.000000000 +0100 -@@ -38,10 +38,7 @@ - #include - #include - #include --#include - #include --#include --#include - #include - #include - #include -@@ -198,7 +195,6 @@ static inline void xen_multicall_flush(b - extern char hypercall_page[PAGE_SIZE]; - #else - extern char *hypercall_stubs; --#define hypercall_page hypercall_stubs - #define is_running_on_xen() (!!hypercall_stubs) - #endif ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ head/arch/x86/include/mach-xen/asm/io.h 2011-01-31 17:56:27.000000000 +0100 -@@ -0,0 +1,5 @@ -+#ifdef CONFIG_X86_32 -+# include "io_32.h" -+#else -+# include "io_64.h" -+#endif ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ head/arch/x86/include/mach-xen/asm/irqflags.h 2011-01-31 17:56:27.000000000 +0100 -@@ -0,0 +1,5 @@ -+#ifdef CONFIG_X86_32 -+# include "irqflags_32.h" -+#else -+# include "irqflags_64.h" -+#endif ---- head.orig/arch/x86/include/mach-xen/asm/irqflags_32.h 2011-01-31 17:32:29.000000000 +0100 -+++ head/arch/x86/include/mach-xen/asm/irqflags_32.h 2011-01-31 17:56:27.000000000 +0100 -@@ -150,6 +150,23 @@ static inline int raw_irqs_disabled_flag - \ - raw_irqs_disabled_flags(flags); \ - }) + +@@ -324,8 +327,10 @@ static int vnic_process_localmac_msg(net + cuckoo_hash_mac_key key; + + if (msg->u.localmac.flags & NET_ACCEL_MSG_ADD) { +- DPRINTK("MAC has moved, could be local: " MAC_FMT "\n", +- MAC_ARG(msg->u.localmac.mac)); ++ DECLARE_MAC_BUF(buf); + -+/* -+ * makes the traced hardirq state match with the machine state -+ * -+ * should be a rarely used function, only in places where its -+ * otherwise impossible to know the irq state, like in traps. -+ */ -+static inline void trace_hardirqs_fixup_flags(unsigned long flags) -+{ -+ if (raw_irqs_disabled_flags(flags)) -+ trace_hardirqs_off(); -+ else -+ trace_hardirqs_on(); -+} ++ DPRINTK("MAC has moved, could be local: %s\n", ++ print_mac(buf, msg->u.localmac.mac)); + key = cuckoo_mac_to_key(msg->u.localmac.mac); + spin_lock_irqsave(&vnic->table_lock, flags); + /* Try to remove it, not a big deal if not there */ +@@ -513,6 +518,8 @@ irqreturn_t netfront_accel_net_channel_i + + spin_lock_irqsave(&vnic->irq_enabled_lock, flags); + if (vnic->irq_enabled) { ++ struct netfront_info *np = netdev_priv(net_dev); + -+#define trace_hardirqs_fixup() \ -+ trace_hardirqs_fixup_flags(__raw_local_save_flags()) - #endif /* __ASSEMBLY__ */ + netfront_accel_disable_net_interrupts(vnic); + vnic->irq_enabled = 0; + spin_unlock_irqrestore(&vnic->irq_enabled_lock, flags); +@@ -525,7 +532,7 @@ irqreturn_t netfront_accel_net_channel_i + vnic->stats.event_count_since_irq; + vnic->stats.event_count_since_irq = 0; + #endif +- netif_rx_schedule(net_dev); ++ netif_rx_schedule(net_dev, &np->napi); + } + else { + spin_unlock_irqrestore(&vnic->irq_enabled_lock, flags); +--- a/drivers/xen/sfc_netfront/accel_vi.c ++++ b/drivers/xen/sfc_netfront/accel_vi.c +@@ -645,8 +645,10 @@ netfront_accel_vi_tx_post(netfront_accel + (cuckoo_hash_key *)(&key), &value); + + if (!try_fastpath) { +- VPRINTK("try fast path false for mac: " MAC_FMT "\n", +- MAC_ARG(skb->data)); ++ DECLARE_MAC_BUF(buf); ++ ++ VPRINTK("try fast path false for mac: %s\n", ++ print_mac(buf, skb->data)); + + return NETFRONT_ACCEL_STATUS_CANT; + } +@@ -772,9 +774,10 @@ static void netfront_accel_vi_rx_comple + if (compare_ether_addr(skb->data, vnic->mac)) { + struct iphdr *ip = (struct iphdr *)(skb->data + ETH_HLEN); + u16 port; ++ DECLARE_MAC_BUF(buf); + +- DPRINTK("%s: saw wrong MAC address " MAC_FMT "\n", +- __FUNCTION__, MAC_ARG(skb->data)); ++ DPRINTK("%s: saw wrong MAC address %s\n", ++ __FUNCTION__, print_mac(buf, skb->data)); + + if (ip->protocol == IPPROTO_TCP) { + struct tcphdr *tcp = (struct tcphdr *) +--- a/drivers/xen/sfc_netutil/accel_msg_iface.c ++++ b/drivers/xen/sfc_netutil/accel_msg_iface.c +@@ -36,7 +36,7 @@ + #else + #define NET_ACCEL_CHECK_MAGIC(_p, _errval) \ + if (_p->magic != NET_ACCEL_MSG_MAGIC) { \ +- printk(KERN_ERR "%s: passed invalid shared page %p!\n", \ ++ pr_err("%s: passed invalid shared page %p!\n", \ + __FUNCTION__, _p); \ + return _errval; \ + } +--- a/drivers/xen/sfc_netutil/accel_util.h ++++ b/drivers/xen/sfc_netutil/accel_util.h +@@ -63,9 +63,6 @@ + DPRINTK("%s at %s:%d\n", #exp, __FILE__, __LINE__); \ + } while(0) + +-#define MAC_FMT "%.2x:%.2x:%.2x:%.2x:%.2x:%.2x" +-#define MAC_ARG(_mac) (_mac)[0], (_mac)[1], (_mac)[2], (_mac)[3], (_mac)[4], (_mac)[5] +- + #include + + /*! Map a set of pages from another domain +--- a/drivers/xen/tpmback/interface.c ++++ b/drivers/xen/tpmback/interface.c +@@ -50,7 +50,7 @@ static tpmif_t *alloc_tpmif(domid_t domi + out_of_memory: + if (tpmif != NULL) + kmem_cache_free(tpmif_cachep, tpmif); +- printk("%s: out of memory\n", __FUNCTION__); ++ pr_err("%s: out of memory\n", __FUNCTION__); + return ERR_PTR(-ENOMEM); + } - /* -@@ -181,4 +198,17 @@ static inline int raw_irqs_disabled_flag - # define TRACE_IRQS_OFF - #endif +--- a/drivers/xen/tpmback/tpmback.c ++++ b/drivers/xen/tpmback/tpmback.c +@@ -908,8 +908,7 @@ static int __init tpmback_init(void) + int rc; -+#ifdef CONFIG_DEBUG_LOCK_ALLOC -+# define LOCKDEP_SYS_EXIT \ -+ pushl %eax; \ -+ pushl %ecx; \ -+ pushl %edx; \ -+ call lockdep_sys_exit; \ -+ popl %edx; \ -+ popl %ecx; \ -+ popl %eax; -+#else -+# define LOCKDEP_SYS_EXIT -+#endif -+ - #endif ---- head.orig/arch/x86/include/mach-xen/asm/irqflags_64.h 2011-01-31 17:32:29.000000000 +0100 -+++ head/arch/x86/include/mach-xen/asm/irqflags_64.h 2011-01-31 17:56:27.000000000 +0100 -@@ -116,6 +116,22 @@ static inline int raw_irqs_disabled_flag - }) + if ((rc = misc_register(&vtpms_miscdevice)) != 0) { +- printk(KERN_ALERT +- "Could not register misc device for TPM BE.\n"); ++ pr_alert("Could not register misc device for TPM BE\n"); + return rc; + } - /* -+ * makes the traced hardirq state match with the machine state -+ * -+ * should be a rarely used function, only in places where its -+ * otherwise impossible to know the irq state, like in traps. -+ */ -+static inline void trace_hardirqs_fixup_flags(unsigned long flags) -+{ -+ if (raw_irqs_disabled_flags(flags)) -+ trace_hardirqs_off(); -+ else -+ trace_hardirqs_on(); -+} -+ -+#define trace_hardirqs_fixup() \ -+ trace_hardirqs_fixup_flags(__raw_local_save_flags()) -+/* - * Used in the idle loop; sti takes one instruction cycle - * to complete: - */ -@@ -143,6 +159,20 @@ static inline void halt(void) - # define TRACE_IRQS_ON - # define TRACE_IRQS_OFF - # endif -+# ifdef CONFIG_DEBUG_LOCK_ALLOC -+# define LOCKDEP_SYS_EXIT call lockdep_sys_exit_thunk -+# define LOCKDEP_SYS_EXIT_IRQ \ -+ TRACE_IRQS_ON; \ -+ sti; \ -+ SAVE_REST; \ -+ LOCKDEP_SYS_EXIT; \ -+ RESTORE_REST; \ -+ cli; \ -+ TRACE_IRQS_OFF; -+# else -+# define LOCKDEP_SYS_EXIT -+# define LOCKDEP_SYS_EXIT_IRQ -+# endif - #endif +@@ -929,7 +928,7 @@ static int __init tpmback_init(void) + return rc; + } - #endif ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ head/arch/x86/include/mach-xen/asm/maddr.h 2011-01-31 17:56:27.000000000 +0100 -@@ -0,0 +1,5 @@ -+#ifdef CONFIG_X86_32 -+# include "maddr_32.h" -+#else -+# include "maddr_64.h" -+#endif ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ head/arch/x86/include/mach-xen/asm/mmu_context.h 2011-01-31 17:56:27.000000000 +0100 -@@ -0,0 +1,5 @@ -+#ifdef CONFIG_X86_32 -+# include "mmu_context_32.h" -+#else -+# include "mmu_context_64.h" -+#endif ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ head/arch/x86/include/mach-xen/asm/pci.h 2011-01-31 17:56:27.000000000 +0100 -@@ -0,0 +1,100 @@ -+#ifndef __x86_PCI_H -+#define __x86_PCI_H -+ -+#include /* for struct page */ -+#include -+#include -+#include -+#include -+#include -+ -+ -+#ifdef __KERNEL__ -+ -+struct pci_sysdata { -+ int domain; /* PCI domain */ -+ int node; /* NUMA node */ -+#ifdef CONFIG_X86_64 -+ void* iommu; /* IOMMU private data */ -+#endif -+#ifdef CONFIG_XEN_PCIDEV_FRONTEND -+ struct pcifront_device *pdev; -+#endif -+}; -+ -+/* scan a bus after allocating a pci_sysdata for it */ -+extern struct pci_bus *pci_scan_bus_with_sysdata(int busno); +- printk(KERN_ALERT "Successfully initialized TPM backend driver.\n"); ++ pr_alert("Successfully initialized TPM backend driver\n"); + + return 0; + } +--- a/drivers/xen/usbback/usbback.c ++++ b/drivers/xen/usbback/usbback.c +@@ -88,6 +88,8 @@ typedef struct { + static pending_req_t *pending_reqs; + static struct list_head pending_free; + static DEFINE_SPINLOCK(pending_free_lock); ++static LIST_HEAD(pending_urb_free); ++static DEFINE_SPINLOCK(urb_free_lock); + static DECLARE_WAIT_QUEUE_HEAD(pending_free_wq); + + #define USBBACK_INVALID_HANDLE (~0) +@@ -233,7 +235,7 @@ static int usbbk_alloc_urb(usbif_urb_req + else + pending_req->urb = usb_alloc_urb(0, GFP_KERNEL); + if (!pending_req->urb) { +- printk(KERN_ERR "usbback: can't alloc urb\n"); ++ pr_err("usbback: can't alloc urb\n"); + ret = -ENOMEM; + goto fail; + } +@@ -243,7 +245,7 @@ static int usbbk_alloc_urb(usbif_urb_req + req->buffer_length, GFP_KERNEL, + &pending_req->transfer_dma); + if (!pending_req->buffer) { +- printk(KERN_ERR "usbback: can't alloc urb buffer\n"); ++ pr_err("usbback: can't alloc urb buffer\n"); + ret = -ENOMEM; + goto fail_free_urb; + } +@@ -254,7 +256,7 @@ static int usbbk_alloc_urb(usbif_urb_req + sizeof(struct usb_ctrlrequest), GFP_KERNEL, + &pending_req->setup_dma); + if (!pending_req->setup) { +- printk(KERN_ERR "usbback: can't alloc usb_ctrlrequest\n"); ++ pr_err("usbback: can't alloc usb_ctrlrequest\n"); + ret = -ENOMEM; + goto fail_free_buffer; + } +@@ -274,6 +276,15 @@ fail: + + static void usbbk_free_urb(struct urb *urb) + { ++ unsigned long flags; + -+static inline int pci_domain_nr(struct pci_bus *bus) -+{ -+ struct pci_sysdata *sd = bus->sysdata; -+ return sd->domain; ++ spin_lock_irqsave(&urb_free_lock, flags); ++ list_add(&urb->urb_list, &pending_urb_free); ++ spin_unlock_irqrestore(&urb_free_lock, flags); +} + -+static inline int pci_proc_domain(struct pci_bus *bus) ++static void _usbbk_free_urb(struct urb *urb) +{ -+ return pci_domain_nr(bus); -+} -+ -+ -+/* Can be used to override the logic in pci_scan_bus for skipping -+ already-configured bus numbers - to be used for buggy BIOSes -+ or architectures with incomplete PCI setup by the loader */ -+ -+#ifdef CONFIG_PCI -+extern unsigned int pcibios_assign_all_busses(void); -+#else -+#define pcibios_assign_all_busses() 0 -+#endif -+ -+#include -+#define pcibios_scan_all_fns(a, b) (!is_initial_xendomain()) -+ -+extern unsigned long pci_mem_start; -+#define PCIBIOS_MIN_IO 0x1000 -+#define PCIBIOS_MIN_MEM (pci_mem_start) -+ -+#define PCIBIOS_MIN_CARDBUS_IO 0x4000 -+ -+void pcibios_config_init(void); -+struct pci_bus * pcibios_scan_root(int bus); -+ -+void pcibios_set_master(struct pci_dev *dev); -+void pcibios_penalize_isa_irq(int irq, int active); -+struct irq_routing_table *pcibios_get_irq_routing_table(void); -+int pcibios_set_irq_routing(struct pci_dev *dev, int pin, int irq); -+ -+ -+#define HAVE_PCI_MMAP -+extern int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma, -+ enum pci_mmap_state mmap_state, int write_combine); -+ -+ -+#ifdef CONFIG_PCI -+static inline void pci_dma_burst_advice(struct pci_dev *pdev, -+ enum pci_dma_burst_strategy *strat, -+ unsigned long *strategy_parameter) + if (usb_pipecontrol(urb->pipe)) + usb_buffer_free(urb->dev, sizeof(struct usb_ctrlrequest), + urb->setup_packet, urb->setup_dma); +@@ -284,6 +295,29 @@ static void usbbk_free_urb(struct urb *u + usb_free_urb(urb); + } + ++static void usbbk_free_urbs(void) +{ -+ *strat = PCI_DMA_BURST_INFINITY; -+ *strategy_parameter = ~0UL; -+} -+#endif -+ ++ unsigned long flags; ++ struct list_head tmp_list; + -+#endif /* __KERNEL__ */ ++ if (list_empty(&pending_urb_free)) ++ return; + -+#ifdef CONFIG_X86_32 -+# include "pci_32.h" -+#else -+# include "pci_64.h" -+#endif ++ INIT_LIST_HEAD(&tmp_list); + -+/* implement the pci_ DMA API in terms of the generic device dma_ one */ -+#include ++ spin_lock_irqsave(&urb_free_lock, flags); ++ list_splice_init(&pending_urb_free, &tmp_list); ++ spin_unlock_irqrestore(&urb_free_lock, flags); + -+/* generic pci stuff */ -+#include ++ while (!list_empty(&tmp_list)) { ++ struct urb *next_urb = list_first_entry(&tmp_list, struct urb, ++ urb_list); + ++ list_del(&next_urb->urb_list); ++ _usbbk_free_urb(next_urb); ++ } ++} + + static void usbbk_notify_work(usbif_t *usbif) + { + usbif->waiting_reqs = 1; +@@ -358,7 +392,7 @@ static int usbbk_gnttab_map(usbif_t *usb + nr_segs = pending_req->nr_buffer_segs + pending_req->nr_extra_segs; + + if (nr_segs > USBIF_MAX_SEGMENTS_PER_REQUEST) { +- printk(KERN_ERR "Bad number of segments in request\n"); ++ pr_err("Bad number of segments in request\n"); + ret = -EINVAL; + goto fail; + } +@@ -401,7 +435,7 @@ static int usbbk_gnttab_map(usbif_t *usb + gnttab_check_GNTST_eagain_while(GNTTABOP_map_grant_ref, &map[i]); + + if (unlikely(map[i].status != GNTST_okay)) { +- printk(KERN_ERR "usbback: invalid buffer -- could not remap it\n"); ++ pr_err("usbback: invalid buffer -- could not remap it\n"); + map[i].handle = USBBACK_INVALID_HANDLE; + ret |= 1; + } +@@ -929,7 +963,7 @@ static void dispatch_request_to_pending_ + + ret = usbbk_gnttab_map(usbif, req, pending_req); + if (ret) { +- printk(KERN_ERR "usbback: invalid buffer\n"); ++ pr_err("usbback: invalid buffer\n"); + ret = -ESHUTDOWN; + goto fail_free_urb; + } +@@ -952,7 +986,7 @@ static void dispatch_request_to_pending_ + + ret = usb_submit_urb(pending_req->urb, GFP_KERNEL); + if (ret) { +- printk(KERN_ERR "usbback: failed submitting urb, error %d\n", ret); ++ pr_err("usbback: failed submitting urb, error %d\n", ret); + ret = -ESHUTDOWN; + goto fail_flush_area; + } +@@ -985,8 +1019,7 @@ static int usbbk_start_submit_urb(usbif_ + while (rc != rp) { + if (RING_REQUEST_CONS_OVERFLOW(urb_ring, rc)) { + if(printk_ratelimit()) +- printk(KERN_WARNING "usbback: " +- "RING_REQUEST_CONS_OVERFLOW\n"); ++ pr_warning("RING_REQUEST_CONS_OVERFLOW\n"); + break; + } + +@@ -1057,8 +1090,11 @@ int usbbk_schedule(void *arg) + + if (usbbk_start_submit_urb(usbif)) + usbif->waiting_reqs = 1; + -+#endif ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ head/arch/x86/include/mach-xen/asm/pgalloc.h 2011-01-31 17:56:27.000000000 +0100 -@@ -0,0 +1,5 @@ -+#ifdef CONFIG_X86_32 -+# include "pgalloc_32.h" -+#else -+# include "pgalloc_64.h" -+#endif ---- head.orig/arch/x86/include/mach-xen/asm/pgalloc_64.h 2011-01-31 17:49:31.000000000 +0100 -+++ head/arch/x86/include/mach-xen/asm/pgalloc_64.h 2011-01-31 17:56:27.000000000 +0100 -@@ -115,6 +115,8 @@ static inline void pgd_list_del(pgd_t *p - spin_unlock(&pgd_lock); ++ usbbk_free_urbs(); + } + ++ usbbk_free_urbs(); + usbif->xenusbd = NULL; + usbif_put(usbif); + +--- a/drivers/xen/usbback/usbstub.c ++++ b/drivers/xen/usbback/usbstub.c +@@ -150,7 +150,7 @@ static struct usbstub *usbstub_alloc(str + + stub = kzalloc(sizeof(*stub), GFP_KERNEL); + if (!stub) { +- printk(KERN_ERR "no memory for alloc usbstub\n"); ++ pr_err("no memory for usbstub\n"); + return NULL; + } + kref_init(&stub->kref); +@@ -303,7 +303,7 @@ int __init usbstub_init(void) + + err = usb_register(&usbback_usb_driver); + if (err < 0) { +- printk(KERN_ERR "usbback: usb_register failed (error %d)\n", err); ++ pr_err("usbback: usb_register failed (%d)\n", err); + goto out; + } + +--- a/drivers/xen/usbback/xenbus.c ++++ b/drivers/xen/usbback/xenbus.c +@@ -240,9 +240,9 @@ static int connect_rings(usbif_t *usbif) + return err; + } + +- printk("usbback: urb-ring-ref %u, conn-ring-ref %u," +- " event-channel %u\n", +- urb_ring_ref, conn_ring_ref, evtchn); ++ pr_info("usbback: urb-ring-ref %u, conn-ring-ref %u," ++ " event-channel %u\n", ++ urb_ring_ref, conn_ring_ref, evtchn); + + err = usbif_map(usbif, urb_ring_ref, conn_ring_ref, evtchn); + if (err) { +@@ -269,8 +269,8 @@ static void frontend_changed(struct xenb + + case XenbusStateInitialising: + if (dev->state == XenbusStateClosed) { +- printk("%s: %s: prepare for reconnect\n", +- __FUNCTION__, dev->nodename); ++ pr_info("%s: %s: prepare for reconnect\n", ++ __FUNCTION__, dev->nodename); + xenbus_switch_state(dev, XenbusStateInitWait); + } + break; +--- a/drivers/xen/usbfront/usbfront-dbg.c ++++ b/drivers/xen/usbfront/usbfront-dbg.c +@@ -91,8 +91,8 @@ static inline void create_debug_file(str + { + struct class_device *cldev = info_to_hcd(info)->self.class_dev; + if (class_device_create_file(cldev, &class_device_attr_statistics)) +- printk(KERN_WARNING "statistics file not created for %s\n", +- info_to_hcd(info)->self.bus_name); ++ pr_warning("statistics file not created for %s\n", ++ info_to_hcd(info)->self.bus_name); } -+extern void pgd_test_and_unpin(pgd_t *); -+ - static inline pgd_t *pgd_alloc(struct mm_struct *mm) + static inline void remove_debug_file(struct usbfront_info *info) +--- a/drivers/xen/usbfront/usbfront-hcd.c ++++ b/drivers/xen/usbfront/usbfront-hcd.c +@@ -114,7 +114,6 @@ static void xenhcd_stop(struct usb_hcd * + * non-error returns are promise to giveback the urb later + */ + static int xenhcd_urb_enqueue(struct usb_hcd *hcd, +- struct usb_host_endpoint *ep, + struct urb *urb, + gfp_t mem_flags) { - /* -@@ -126,6 +128,7 @@ static inline pgd_t *pgd_alloc(struct mm - pgd = (pgd_t *)__get_free_pages(GFP_KERNEL|__GFP_REPEAT|__GFP_ZERO, 1); - if (!pgd) - return NULL; -+ pgd_test_and_unpin(pgd); - pgd_list_add(pgd, mm); - /* - * Copy kernel pointers in from init. -@@ -147,29 +150,8 @@ static inline pgd_t *pgd_alloc(struct mm +@@ -130,6 +129,7 @@ static int xenhcd_urb_enqueue(struct usb + ret = -ENOMEM; + goto done; + } ++ urbp->status = 1; - static inline void pgd_free(pgd_t *pgd) + ret = xenhcd_submit_urb(info, urbp); + if (ret != 0) +@@ -144,7 +144,7 @@ done: + * called as .urb_dequeue() + */ + static int xenhcd_urb_dequeue(struct usb_hcd *hcd, +- struct urb *urb) ++ struct urb *urb, int status) { -- pte_t *ptep = virt_to_ptep(pgd); -- - pgd_list_del(pgd); -- -- if (!pte_write(*ptep)) { -- xen_pgd_unpin(__pa(pgd)); -- BUG_ON(HYPERVISOR_update_va_mapping( -- (unsigned long)pgd, -- pfn_pte(virt_to_phys(pgd)>>PAGE_SHIFT, PAGE_KERNEL), -- 0)); -- } -- -- ptep = virt_to_ptep(__user_pgd(pgd)); -- -- if (!pte_write(*ptep)) { -- xen_pgd_unpin(__pa(__user_pgd(pgd))); -- BUG_ON(HYPERVISOR_update_va_mapping( -- (unsigned long)__user_pgd(pgd), -- pfn_pte(virt_to_phys(__user_pgd(pgd))>>PAGE_SHIFT, -- PAGE_KERNEL), -- 0)); -- } -- -+ pgd_test_and_unpin(pgd); - free_pages((unsigned long)pgd, 1); + struct usbfront_info *info = hcd_to_info(hcd); + struct urb_priv *urbp; +@@ -157,6 +157,7 @@ static int xenhcd_urb_dequeue(struct usb + if (!urbp) + goto done; + ++ urbp->status = status; + ret = xenhcd_unlink_urb(info, urbp); + + done: +--- a/drivers/xen/usbfront/usbfront-q.c ++++ b/drivers/xen/usbfront/usbfront-q.c +@@ -151,7 +151,7 @@ static int map_urb_for_request(struct us + + ret = gnttab_alloc_grant_references(USBIF_MAX_SEGMENTS_PER_REQUEST, &gref_head); + if (ret) { +- printk(KERN_ERR "usbfront: gnttab_alloc_grant_references() error\n"); ++ pr_err("usbfront: gnttab_alloc_grant_references() error\n"); + return -ENOMEM; + } + +@@ -236,7 +236,8 @@ __acquires(info->lock) + COUNT(info->stats.complete); + } + spin_unlock(&info->lock); +- usb_hcd_giveback_urb(info_to_hcd(info), urb); ++ usb_hcd_giveback_urb(info_to_hcd(info), urb, ++ urbp->status <= 0 ? urbp->status : urb->status); + spin_lock(&info->lock); } ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ head/arch/x86/include/mach-xen/asm/pgtable.h 2011-01-31 17:56:27.000000000 +0100 -@@ -0,0 +1,5 @@ -+#ifdef CONFIG_X86_32 -+# include "pgtable_32.h" -+#else -+# include "pgtable_64.h" -+#endif ---- head.orig/arch/x86/include/mach-xen/asm/pgtable_32.h 2011-02-07 15:38:23.000000000 +0100 -+++ head/arch/x86/include/mach-xen/asm/pgtable_32.h 2011-01-31 17:56:27.000000000 +0100 -@@ -17,10 +17,7 @@ - #include - #include +--- a/drivers/xen/usbfront/usbfront.h ++++ b/drivers/xen/usbfront/usbfront.h +@@ -83,6 +83,7 @@ struct urb_priv { + struct urb *urb; + int req_id; /* RING_REQUEST id for submitting */ + int unlink_req_id; /* RING_REQUEST id for unlinking */ ++ int status; + unsigned unlinked:1; /* dequeued marker */ + }; + +--- a/drivers/xen/usbfront/xenbus.c ++++ b/drivers/xen/usbfront/xenbus.c +@@ -394,7 +394,7 @@ static int __init usbfront_init(void) + xenhcd_urbp_cachep = kmem_cache_create("xenhcd_urb_priv", + sizeof(struct urb_priv), 0, 0, NULL); + if (!xenhcd_urbp_cachep) { +- printk(KERN_ERR "usbfront failed to create kmem cache\n"); ++ pr_err("usbfront failed to create kmem cache\n"); + return -ENOMEM; + } + +--- a/drivers/xen/util.c ++++ b/drivers/xen/util.c +@@ -11,7 +11,7 @@ struct class *get_xen_class(void) + + xen_class = class_create(THIS_MODULE, "xen"); + if (IS_ERR(xen_class)) { +- printk("Failed to create xen sysfs class.\n"); ++ pr_err("failed to create xen sysfs class\n"); + xen_class = NULL; + } + +--- a/drivers/xen/xen-pciback/slot.c ++++ b/drivers/xen/xen-pciback/slot.c +@@ -64,9 +64,9 @@ int pciback_add_pci_dev(struct pciback_d + for (bus = 0; bus < PCI_BUS_NBR; bus++) + for (slot = 0; slot < PCI_SLOT_MAX; slot++) { + if (slot_dev->slots[bus][slot] == NULL) { +- printk(KERN_INFO +- "pciback: slot: %s: assign to virtual slot %d, bus %d\n", +- pci_name(dev), slot, bus); ++ pr_info("pciback: slot: %s: assign to" ++ " virtual slot %d, bus %d\n", ++ pci_name(dev), slot, bus); + slot_dev->slots[bus][slot] = dev; + goto unlock; + } +--- a/drivers/xen/xenbus/xenbus_comms.c ++++ b/drivers/xen/xenbus/xenbus_comms.c +@@ -238,13 +238,13 @@ int xb_init_comms(void) + int err; + + if (intf->req_prod != intf->req_cons) +- printk(KERN_ERR "XENBUS request ring is not quiescent " ++ pr_err("XENBUS request ring is not quiescent " + "(%08x:%08x)!\n", intf->req_cons, intf->req_prod); --#ifndef _I386_BITOPS_H --#include --#endif -- -+#include - #include - #include - #include -@@ -40,7 +37,7 @@ extern spinlock_t pgd_lock; - extern struct page *pgd_list; - void check_pgt_cache(void); + if (intf->rsp_prod != intf->rsp_cons) { +- printk(KERN_WARNING "XENBUS response ring is not quiescent " +- "(%08x:%08x): fixing up\n", +- intf->rsp_cons, intf->rsp_prod); ++ pr_warning("XENBUS response ring is not quiescent" ++ " (%08x:%08x): fixing up\n", ++ intf->rsp_cons, intf->rsp_prod); + /* breaks kdump */ + if (!reset_devices) + intf->rsp_cons = intf->rsp_prod; +@@ -261,7 +261,7 @@ int xb_init_comms(void) + xen_store_evtchn, wake_waiting, + 0, "xenbus", &xb_waitq); + if (err <= 0) { +- printk(KERN_ERR "XENBUS request irq failed %i\n", err); ++ pr_err("XENBUS request irq failed %i\n", err); + return err; + } --void pmd_ctor(void *, struct kmem_cache *, unsigned long); -+void pmd_ctor(struct kmem_cache *, void *); - void pgtable_cache_init(void); - void paging_init(void); +--- a/drivers/xen/xenbus/xenbus_probe.c ++++ b/drivers/xen/xenbus/xenbus_probe.c +@@ -112,13 +112,13 @@ static int frontend_bus_id(char bus_id[X + { + nodename = strchr(nodename, '/'); + if (!nodename || strlen(nodename + 1) >= XEN_BUS_ID_SIZE) { +- printk(KERN_WARNING "XENBUS: bad frontend %s\n", nodename); ++ pr_warning("XENBUS: bad frontend %s\n", nodename); + return -EINVAL; + } ---- head.orig/arch/x86/include/mach-xen/asm/pgtable_64.h 2011-02-07 15:38:18.000000000 +0100 -+++ head/arch/x86/include/mach-xen/asm/pgtable_64.h 2011-01-31 17:56:27.000000000 +0100 -@@ -9,7 +9,7 @@ - * the x86-64 page table tree. - */ - #include --#include -+#include - #include - #include - #include -@@ -139,6 +139,7 @@ static inline void pgd_clear (pgd_t * pg - #define MAXMEM _AC(0x6fffffffff, UL) - #define VMALLOC_START _AC(0xffffc20000000000, UL) - #define VMALLOC_END _AC(0xffffe1ffffffffff, UL) -+#define VMEMMAP_START _AC(0xffffe20000000000, UL) - #define MODULES_VADDR _AC(0xffffffff88000000, UL) - #define MODULES_END _AC(0xffffffffff000000, UL) - #define MODULES_LEN (MODULES_END - MODULES_VADDR) ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ head/arch/x86/include/mach-xen/asm/processor.h 2011-01-31 17:56:27.000000000 +0100 -@@ -0,0 +1,5 @@ -+#ifdef CONFIG_X86_32 -+# include "processor_32.h" -+#else -+# include "processor_64.h" -+#endif ---- head.orig/arch/x86/include/mach-xen/asm/processor_32.h 2011-01-31 17:49:31.000000000 +0100 -+++ head/arch/x86/include/mach-xen/asm/processor_32.h 2011-01-31 17:56:27.000000000 +0100 -@@ -70,17 +70,22 @@ struct cpuinfo_x86 { - char pad0; - int x86_power; - unsigned long loops_per_jiffy; -+#ifndef CONFIG_XEN - #ifdef CONFIG_SMP - cpumask_t llc_shared_map; /* cpus sharing the last level cache */ - #endif - unsigned char x86_max_cores; /* cpuid returned max cores value */ - unsigned char apicid; -+#endif - unsigned short x86_clflush_size; --#ifdef CONFIG_SMP -+#ifdef CONFIG_X86_HT - unsigned char booted_cores; /* number of cores as seen by OS */ - __u8 phys_proc_id; /* Physical processor id. */ - __u8 cpu_core_id; /* Core id */ - #endif -+#ifdef CONFIG_SMP -+ __u8 cpu_index; /* index into per_cpu list */ -+#endif - } __attribute__((__aligned__(SMP_CACHE_BYTES))); + strlcpy(bus_id, nodename + 1, XEN_BUS_ID_SIZE); + if (!strchr(bus_id, '/')) { +- printk(KERN_WARNING "XENBUS: bus_id %s no slash\n", bus_id); ++ pr_warning("XENBUS: bus_id %s no slash\n", bus_id); + return -EINVAL; + } + *strchr(bus_id, '/') = '-'; +@@ -176,11 +176,9 @@ static int read_backend_details(struct x + } - #define X86_VENDOR_INTEL 0 -@@ -106,14 +111,19 @@ DECLARE_PER_CPU(struct tss_struct, init_ - #endif + #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) && (defined(CONFIG_XEN) || defined(MODULE)) +-static int xenbus_uevent_frontend(struct device *dev, char **envp, +- int num_envp, char *buffer, int buffer_size) ++static int xenbus_uevent_frontend(struct device *dev, struct kobj_uevent_env *env) + { + struct xenbus_device *xdev; +- int length = 0, i = 0; - #ifdef CONFIG_SMP --extern struct cpuinfo_x86 cpu_data[]; --#define current_cpu_data cpu_data[smp_processor_id()] -+DECLARE_PER_CPU(struct cpuinfo_x86, cpu_info); -+#define cpu_data(cpu) per_cpu(cpu_info, cpu) -+#define current_cpu_data cpu_data(smp_processor_id()) - #else --#define cpu_data (&boot_cpu_data) --#define current_cpu_data boot_cpu_data -+#define cpu_data(cpu) boot_cpu_data -+#define current_cpu_data boot_cpu_data - #endif + if (dev == NULL) + return -ENODEV; +@@ -189,12 +187,9 @@ static int xenbus_uevent_frontend(struct + return -ENODEV; --extern int cpu_llc_id[NR_CPUS]; -+/* -+ * the following now lives in the per cpu area: -+ * extern int cpu_llc_id[NR_CPUS]; -+ */ -+DECLARE_PER_CPU(u8, cpu_llc_id); - extern char ignore_fpu_irq; + /* stuff we want to pass to /sbin/hotplug */ +- add_uevent_var(envp, num_envp, &i, buffer, buffer_size, &length, +- "XENBUS_TYPE=%s", xdev->devicetype); +- add_uevent_var(envp, num_envp, &i, buffer, buffer_size, &length, +- "XENBUS_PATH=%s", xdev->nodename); +- add_uevent_var(envp, num_envp, &i, buffer, buffer_size, &length, +- "MODALIAS=xen:%s", xdev->devicetype); ++ add_uevent_var(env, "XENBUS_TYPE=%s", xdev->devicetype); ++ add_uevent_var(env, "XENBUS_PATH=%s", xdev->nodename); ++ add_uevent_var(env, "MODALIAS=xen:%s", xdev->devicetype); - void __init cpu_detect(struct cpuinfo_x86 *c); -@@ -560,7 +570,9 @@ static inline void xen_set_iopl_mask(uns - * clear %ecx since some cpus (Cyrix MII) do not set or clear %ecx - * resulting in stale register contents being returned. - */ --static inline void cpuid(unsigned int op, unsigned int *eax, unsigned int *ebx, unsigned int *ecx, unsigned int *edx) -+static inline void cpuid(unsigned int op, -+ unsigned int *eax, unsigned int *ebx, -+ unsigned int *ecx, unsigned int *edx) - { - *eax = op; - *ecx = 0; -@@ -568,8 +580,9 @@ static inline void cpuid(unsigned int op + return 0; + } +@@ -751,8 +746,8 @@ static int suspend_dev(struct device *de + if (drv->suspend) + err = drv->suspend(xdev); + if (err) +- printk(KERN_WARNING +- "xenbus: suspend %s failed: %i\n", dev->bus_id, err); ++ pr_warning("xenbus: suspend %s failed: %i\n", ++ dev->bus_id, err); + return 0; } - /* Some CPUID calls want 'count' to be placed in ecx */ --static inline void cpuid_count(int op, int count, int *eax, int *ebx, int *ecx, -- int *edx) -+static inline void cpuid_count(unsigned int op, int count, -+ unsigned int *eax, unsigned int *ebx, -+ unsigned int *ecx, unsigned int *edx) - { - *eax = op; - *ecx = count; -@@ -639,6 +652,17 @@ static inline unsigned int cpuid_edx(uns - #define K7_NOP7 ".byte 0x8D,0x04,0x05,0,0,0,0\n" - #define K7_NOP8 K7_NOP7 ASM_NOP1 +@@ -771,9 +766,8 @@ static int suspend_cancel_dev(struct dev + if (drv->suspend_cancel) + err = drv->suspend_cancel(xdev); + if (err) +- printk(KERN_WARNING +- "xenbus: suspend_cancel %s failed: %i\n", +- dev->bus_id, err); ++ pr_warning("xenbus: suspend_cancel %s failed: %i\n", ++ dev->bus_id, err); + return 0; + } -+/* P6 nops */ -+/* uses eax dependencies (Intel-recommended choice) */ -+#define P6_NOP1 GENERIC_NOP1 -+#define P6_NOP2 ".byte 0x66,0x90\n" -+#define P6_NOP3 ".byte 0x0f,0x1f,0x00\n" -+#define P6_NOP4 ".byte 0x0f,0x1f,0x40,0\n" -+#define P6_NOP5 ".byte 0x0f,0x1f,0x44,0x00,0\n" -+#define P6_NOP6 ".byte 0x66,0x0f,0x1f,0x44,0x00,0\n" -+#define P6_NOP7 ".byte 0x0f,0x1f,0x80,0,0,0,0\n" -+#define P6_NOP8 ".byte 0x0f,0x1f,0x84,0x00,0,0,0,0\n" -+ - #ifdef CONFIG_MK8 - #define ASM_NOP1 K8_NOP1 - #define ASM_NOP2 K8_NOP2 -@@ -657,6 +681,17 @@ static inline unsigned int cpuid_edx(uns - #define ASM_NOP6 K7_NOP6 - #define ASM_NOP7 K7_NOP7 - #define ASM_NOP8 K7_NOP8 -+#elif defined(CONFIG_M686) || defined(CONFIG_MPENTIUMII) || \ -+ defined(CONFIG_MPENTIUMIII) || defined(CONFIG_MPENTIUMM) || \ -+ defined(CONFIG_MCORE2) || defined(CONFIG_PENTIUM4) -+#define ASM_NOP1 P6_NOP1 -+#define ASM_NOP2 P6_NOP2 -+#define ASM_NOP3 P6_NOP3 -+#define ASM_NOP4 P6_NOP4 -+#define ASM_NOP5 P6_NOP5 -+#define ASM_NOP6 P6_NOP6 -+#define ASM_NOP7 P6_NOP7 -+#define ASM_NOP8 P6_NOP8 - #else - #define ASM_NOP1 GENERIC_NOP1 - #define ASM_NOP2 GENERIC_NOP2 ---- head.orig/arch/x86/include/mach-xen/asm/processor_64.h 2011-01-31 17:49:31.000000000 +0100 -+++ head/arch/x86/include/mach-xen/asm/processor_64.h 2011-01-31 17:56:27.000000000 +0100 -@@ -62,19 +62,26 @@ struct cpuinfo_x86 { - int x86_cache_alignment; - int x86_tlbsize; /* number of 4K pages in DTLB/ITLB combined(in pages)*/ - __u8 x86_virt_bits, x86_phys_bits; -+#ifndef CONFIG_XEN - __u8 x86_max_cores; /* cpuid returned max cores value */ -+#endif - __u32 x86_power; - __u32 extended_cpuid_level; /* Max extended CPUID function supported */ - unsigned long loops_per_jiffy; --#ifdef CONFIG_SMP -+#if defined(CONFIG_SMP) && !defined(CONFIG_XEN) - cpumask_t llc_shared_map; /* cpus sharing the last level cache */ - #endif -+#ifndef CONFIG_XEN - __u8 apicid; --#ifdef CONFIG_SMP -+#endif -+#ifdef CONFIG_X86_HT - __u8 booted_cores; /* number of cores as seen by OS */ - __u8 phys_proc_id; /* Physical Processor id. */ - __u8 cpu_core_id; /* Core id. */ - #endif -+#ifdef CONFIG_SMP -+ __u8 cpu_index; /* index into per_cpu list */ -+#endif - } ____cacheline_aligned; +@@ -793,9 +787,8 @@ static int resume_dev(struct device *dev - #define X86_VENDOR_INTEL 0 -@@ -88,11 +95,12 @@ struct cpuinfo_x86 { - #define X86_VENDOR_UNKNOWN 0xff + err = talk_to_otherend(xdev); + if (err) { +- printk(KERN_WARNING +- "xenbus: resume (talk_to_otherend) %s failed: %i\n", +- dev->bus_id, err); ++ pr_warning("xenbus: resume (talk_to_otherend) %s failed: %i\n", ++ dev->bus_id, err); + return err; + } - #ifdef CONFIG_SMP --extern struct cpuinfo_x86 cpu_data[]; --#define current_cpu_data cpu_data[smp_processor_id()] -+DECLARE_PER_CPU(struct cpuinfo_x86, cpu_info); -+#define cpu_data(cpu) per_cpu(cpu_info, cpu) -+#define current_cpu_data cpu_data(smp_processor_id()) - #else --#define cpu_data (&boot_cpu_data) --#define current_cpu_data boot_cpu_data -+#define cpu_data(cpu) boot_cpu_data -+#define current_cpu_data boot_cpu_data - #endif +@@ -804,18 +797,16 @@ static int resume_dev(struct device *dev + if (drv->resume) { + err = drv->resume(xdev); + if (err) { +- printk(KERN_WARNING +- "xenbus: resume %s failed: %i\n", +- dev->bus_id, err); ++ pr_warning("xenbus: resume %s failed: %i\n", ++ dev->bus_id, err); + return err; + } + } - extern char ignore_irq13; -@@ -343,6 +351,16 @@ struct extended_sigtable { - }; + err = watch_otherend(xdev); + if (err) { +- printk(KERN_WARNING +- "xenbus_probe: resume (watch_otherend) %s failed: " +- "%d.\n", dev->bus_id, err); ++ pr_warning("xenbus_probe: resume (watch_otherend) %s failed:" ++ " %d\n", dev->bus_id, err); + return err; + } +@@ -898,7 +889,7 @@ static void xenbus_reset_wait_for_backen + timeout = wait_event_interruptible_timeout(backend_state_wq, + backend_state == expected, 5 * HZ); + if (timeout <= 0) +- printk(KERN_INFO "XENBUS: backend %s timed out.\n", be); ++ pr_info("XENBUS: backend %s timed out.\n", be); + } -+#if defined(CONFIG_MPSC) || defined(CONFIG_MCORE2) -+#define ASM_NOP1 P6_NOP1 -+#define ASM_NOP2 P6_NOP2 -+#define ASM_NOP3 P6_NOP3 -+#define ASM_NOP4 P6_NOP4 -+#define ASM_NOP5 P6_NOP5 -+#define ASM_NOP6 P6_NOP6 -+#define ASM_NOP7 P6_NOP7 -+#define ASM_NOP8 P6_NOP8 -+#else - #define ASM_NOP1 K8_NOP1 - #define ASM_NOP2 K8_NOP2 - #define ASM_NOP3 K8_NOP3 -@@ -351,6 +369,7 @@ struct extended_sigtable { - #define ASM_NOP6 K8_NOP6 - #define ASM_NOP7 K8_NOP7 - #define ASM_NOP8 K8_NOP8 -+#endif + /* +@@ -921,7 +912,7 @@ static void xenbus_reset_frontend(char * + be_watch.callback = xenbus_reset_backend_state_changed; + backend_state = XenbusStateUnknown; - /* Opteron nops */ - #define K8_NOP1 ".byte 0x90\n" -@@ -362,6 +381,17 @@ struct extended_sigtable { - #define K8_NOP7 K8_NOP4 K8_NOP3 - #define K8_NOP8 K8_NOP4 K8_NOP4 +- printk(KERN_INFO "XENBUS: triggering reconnect on %s\n", be); ++ pr_info("XENBUS: triggering reconnect on %s\n", be); + register_xenbus_watch(&be_watch); -+/* P6 nops */ -+/* uses eax dependencies (Intel-recommended choice) */ -+#define P6_NOP1 ".byte 0x90\n" -+#define P6_NOP2 ".byte 0x66,0x90\n" -+#define P6_NOP3 ".byte 0x0f,0x1f,0x00\n" -+#define P6_NOP4 ".byte 0x0f,0x1f,0x40,0\n" -+#define P6_NOP5 ".byte 0x0f,0x1f,0x44,0x00,0\n" -+#define P6_NOP6 ".byte 0x66,0x0f,0x1f,0x44,0x00,0\n" -+#define P6_NOP7 ".byte 0x0f,0x1f,0x80,0,0,0,0\n" -+#define P6_NOP8 ".byte 0x0f,0x1f,0x84,0x00,0,0,0,0\n" -+ - #define ASM_NOP_MAX 8 + /* fall through to forward backend to state XenbusStateInitialising */ +@@ -940,7 +931,7 @@ static void xenbus_reset_frontend(char * + } - /* REP NOP (PAUSE) is a good thing to insert into busy-wait loops. */ -@@ -377,12 +407,6 @@ static inline void sync_core(void) - asm volatile("cpuid" : "=a" (tmp) : "0" (1) : "ebx","ecx","edx","memory"); - } + unregister_xenbus_watch(&be_watch); +- printk(KERN_INFO "XENBUS: reconnect done on %s\n", be); ++ pr_info("XENBUS: reconnect done on %s\n", be); + kfree(be_watch.node); + } --#define ARCH_HAS_PREFETCH --static inline void prefetch(void *x) --{ -- asm volatile("prefetcht0 (%0)" :: "r" (x)); --} -- - #define ARCH_HAS_PREFETCHW 1 - static inline void prefetchw(void *x) - { -@@ -398,11 +422,6 @@ static inline void prefetchw(void *x) +@@ -1129,9 +1120,8 @@ int xenbus_conn(domid_t remote_dom, gran + fail1: + rc2 = xb_free_port(xen_store_evtchn); + if (rc2 != 0) +- printk(KERN_WARNING +- "XENBUS: Error freeing xenstore event channel: %d\n", +- rc2); ++ pr_warning("XENBUS: Error freeing xenstore event channel:" ++ " %d\n", rc2); + fail0: + xen_store_evtchn = -1; + return rc; +@@ -1160,9 +1150,8 @@ xenbus_probe_init(void) + /* Register ourselves with the kernel bus subsystem */ + xenbus_frontend.error = bus_register(&xenbus_frontend.bus); + if (xenbus_frontend.error) +- printk(KERN_WARNING +- "XENBUS: Error registering frontend bus: %i\n", +- xenbus_frontend.error); ++ pr_warning("XENBUS: Error registering frontend bus: %i\n", ++ xenbus_frontend.error); + xenbus_backend_bus_register(); - #define cpu_relax() rep_nop() + /* +@@ -1237,8 +1226,8 @@ xenbus_probe_init(void) + /* Initialize the interface to xenstore. */ + err = xs_init(); + if (err) { +- printk(KERN_WARNING +- "XENBUS: Error initializing xenstore comms: %i\n", err); ++ pr_warning("XENBUS: Error initializing xenstore comms: %i\n", ++ err); + goto err; + } --static inline void serialize_cpu(void) --{ -- __asm__ __volatile__ ("cpuid" : : : "ax", "bx", "cx", "dx"); --} -- - static inline void __monitor(const void *eax, unsigned long ecx, - unsigned long edx) - { ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ head/arch/x86/include/mach-xen/asm/smp.h 2011-01-31 17:56:27.000000000 +0100 -@@ -0,0 +1,5 @@ -+#ifdef CONFIG_X86_32 -+# include "smp_32.h" -+#else -+# include "smp_64.h" -+#endif ---- head.orig/arch/x86/include/mach-xen/asm/smp_32.h 2011-01-31 17:32:29.000000000 +0100 -+++ head/arch/x86/include/mach-xen/asm/smp_32.h 2011-01-31 17:56:27.000000000 +0100 -@@ -11,7 +11,7 @@ +@@ -1248,9 +1237,8 @@ xenbus_probe_init(void) + xenbus_frontend.error = device_register(&xenbus_frontend.dev); + if (xenbus_frontend.error) { + bus_unregister(&xenbus_frontend.bus); +- printk(KERN_WARNING +- "XENBUS: Error registering frontend device: %i\n", +- xenbus_frontend.error); ++ pr_warning("XENBUS: Error registering frontend device:" ++ " %d\n", xenbus_frontend.error); + } + } #endif +@@ -1332,8 +1320,8 @@ static int print_device_status(struct de - #if defined(CONFIG_X86_LOCAL_APIC) && !defined(__ASSEMBLY__) --#include -+#include - #include - #include - #ifdef CONFIG_X86_IO_APIC -@@ -29,19 +29,20 @@ - - extern void smp_alloc_memory(void); - extern int pic_mode; --extern int smp_num_siblings; --extern cpumask_t cpu_sibling_map[]; --extern cpumask_t cpu_core_map[]; + if (!dev->driver) { + /* Information only: is this too noisy? */ +- printk(KERN_INFO "XENBUS: Device with no driver: %s\n", +- xendev->nodename); ++ pr_info("XENBUS: Device with no driver: %s\n", ++ xendev->nodename); + return 0; + } - extern void (*mtrr_hook) (void); - extern void zap_low_mappings (void); - extern void lock_ipi_call_lock(void); - extern void unlock_ipi_call_lock(void); +@@ -1341,15 +1329,15 @@ static int print_device_status(struct de + enum xenbus_state rstate = XenbusStateUnknown; + if (xendev->otherend) + rstate = xenbus_read_driver_state(xendev->otherend); +- printk(KERN_WARNING "XENBUS: Timeout connecting " +- "to device: %s (local state %d, remote state %d)\n", +- xendev->nodename, xendev->state, rstate); ++ pr_warning("XENBUS: Timeout connecting to device: %s" ++ " (local state %d, remote state %d)\n", ++ xendev->nodename, xendev->state, rstate); + } -+#ifndef CONFIG_XEN - #define MAX_APICID 256 --extern u8 x86_cpu_to_apicid[]; -+extern u8 __initdata x86_cpu_to_apicid_init[]; -+extern void *x86_cpu_to_apicid_ptr; -+DECLARE_PER_CPU(u8, x86_cpu_to_apicid); -+#endif + xendrv = to_xenbus_driver(dev->driver); + if (xendrv->is_ready && !xendrv->is_ready(xendev)) +- printk(KERN_WARNING "XENBUS: Device not ready: %s\n", +- xendev->nodename); ++ pr_warning("XENBUS: Device not ready: %s\n", ++ xendev->nodename); --#define cpu_physical_id(cpu) x86_cpu_to_apicid[cpu] -+#define cpu_physical_id(cpu) (cpu) + return 0; + } +@@ -1383,8 +1371,8 @@ static void wait_for_devices(struct xenb + while (exists_connecting_device(drv)) { + if (time_after(jiffies, start + (seconds_waited+5)*HZ)) { + if (!seconds_waited) +- printk(KERN_WARNING "XENBUS: Waiting for " +- "devices to initialise: "); ++ pr_warning("XENBUS: Waiting for " ++ "devices to initialise: "); + seconds_waited += 5; + printk("%us...", 300 - seconds_waited); + if (seconds_waited == 300) +--- a/drivers/xen/xenbus/xenbus_probe_backend.c ++++ b/drivers/xen/xenbus/xenbus_probe_backend.c +@@ -60,8 +60,7 @@ + #include + #endif - #ifdef CONFIG_HOTPLUG_CPU - extern void cpu_exit_clear(void); -@@ -148,7 +149,7 @@ extern unsigned int num_processors; - #else /* CONFIG_SMP */ +-static int xenbus_uevent_backend(struct device *dev, char **envp, +- int num_envp, char *buffer, int buffer_size); ++static int xenbus_uevent_backend(struct device *dev, struct kobj_uevent_env *env); + static int xenbus_probe_backend(const char *type, const char *domid); - #define safe_smp_processor_id() 0 --#define cpu_physical_id(cpu) boot_cpu_physical_apicid -+#define cpu_physical_id(cpu) 0 + extern int read_otherend_details(struct xenbus_device *xendev, +@@ -128,13 +127,10 @@ static struct xen_bus_type xenbus_backen + }, + }; + +-static int xenbus_uevent_backend(struct device *dev, char **envp, +- int num_envp, char *buffer, int buffer_size) ++static int xenbus_uevent_backend(struct device *dev, struct kobj_uevent_env *env) + { + struct xenbus_device *xdev; + struct xenbus_driver *drv; +- int i = 0; +- int length = 0; - #define NO_PROC_ID 0xFF /* No processor magic marker */ + DPRINTK(""); ---- head.orig/arch/x86/include/mach-xen/asm/smp_64.h 2011-01-31 17:32:29.000000000 +0100 -+++ head/arch/x86/include/mach-xen/asm/smp_64.h 2011-01-31 17:56:27.000000000 +0100 -@@ -38,12 +38,11 @@ extern void smp_alloc_memory(void); - extern volatile unsigned long smp_invalidate_needed; - extern void lock_ipi_call_lock(void); - extern void unlock_ipi_call_lock(void); --extern int smp_num_siblings; - extern void smp_send_reschedule(int cpu); -+extern int smp_call_function_mask(cpumask_t mask, void (*func)(void *), -+ void *info, int wait); +@@ -146,27 +142,16 @@ static int xenbus_uevent_backend(struct + return -ENODEV; --extern cpumask_t cpu_sibling_map[NR_CPUS]; --extern cpumask_t cpu_core_map[NR_CPUS]; --extern u8 cpu_llc_id[NR_CPUS]; -+DECLARE_PER_CPU(u8, cpu_llc_id); + /* stuff we want to pass to /sbin/hotplug */ +- add_uevent_var(envp, num_envp, &i, buffer, buffer_size, &length, +- "XENBUS_TYPE=%s", xdev->devicetype); ++ add_uevent_var(env, "XENBUS_TYPE=%s", xdev->devicetype); - #define SMP_TRAMPOLINE_BASE 0x6000 +- add_uevent_var(envp, num_envp, &i, buffer, buffer_size, &length, +- "XENBUS_PATH=%s", xdev->nodename); ++ add_uevent_var(env, "XENBUS_PATH=%s", xdev->nodename); -@@ -70,6 +69,9 @@ extern unsigned __cpuinitdata disabled_c +- add_uevent_var(envp, num_envp, &i, buffer, buffer_size, &length, +- "XENBUS_BASE_PATH=%s", xenbus_backend.root); +- +- /* terminate, set to next free slot, shrink available space */ +- envp[i] = NULL; +- envp = &envp[i]; +- num_envp -= i; +- buffer = &buffer[length]; +- buffer_size -= length; ++ add_uevent_var(env, "XENBUS_BASE_PATH=%s", xenbus_backend.root); - #endif /* CONFIG_SMP */ + if (dev->driver) { + drv = to_xenbus_driver(dev->driver); + if (drv && drv->uevent) +- return drv->uevent(xdev, envp, num_envp, buffer, +- buffer_size); ++ return drv->uevent(xdev, env); + } -+#define safe_smp_processor_id() smp_processor_id() -+ -+#ifndef CONFIG_XEN - #ifdef CONFIG_X86_LOCAL_APIC - static inline int hard_smp_processor_id(void) + return 0; +@@ -266,9 +251,8 @@ void xenbus_backend_bus_register(void) { -@@ -82,8 +84,9 @@ static inline int hard_smp_processor_id( - * Some lowlevel functions might want to know about - * the real APIC ID <-> CPU # mapping. - */ --extern u8 x86_cpu_to_apicid[NR_CPUS]; /* physical ID */ --extern u8 x86_cpu_to_log_apicid[NR_CPUS]; -+extern u8 __initdata x86_cpu_to_apicid_init[]; -+extern void *x86_cpu_to_apicid_ptr; -+DECLARE_PER_CPU(u8, x86_cpu_to_apicid); /* physical ID */ - extern u8 bios_cpu_apicid[]; + xenbus_backend.error = bus_register(&xenbus_backend.bus); + if (xenbus_backend.error) +- printk(KERN_WARNING +- "XENBUS: Error registering backend bus: %i\n", +- xenbus_backend.error); ++ pr_warning("XENBUS: Error registering backend bus: %i\n", ++ xenbus_backend.error); + } - #ifdef CONFIG_X86_LOCAL_APIC -@@ -95,6 +98,7 @@ static inline int cpu_present_to_apicid( - return BAD_APICID; + void xenbus_backend_device_register(void) +@@ -279,9 +263,8 @@ void xenbus_backend_device_register(void + xenbus_backend.error = device_register(&xenbus_backend.dev); + if (xenbus_backend.error) { + bus_unregister(&xenbus_backend.bus); +- printk(KERN_WARNING +- "XENBUS: Error registering backend device: %i\n", +- xenbus_backend.error); ++ pr_warning("XENBUS: Error registering backend device: %i\n", ++ xenbus_backend.error); + } } - #endif -+#endif /* CONFIG_XEN */ - #ifndef CONFIG_SMP - #define stack_smp_processor_id() 0 -@@ -118,9 +122,9 @@ static __inline int logical_smp_processo - #endif +--- a/drivers/xen/xenbus/xenbus_xs.c ++++ b/drivers/xen/xenbus/xenbus_xs.c +@@ -135,9 +135,8 @@ static int get_error(const char *errorst - #ifdef CONFIG_SMP --#define cpu_physical_id(cpu) x86_cpu_to_apicid[cpu] -+#define cpu_physical_id(cpu) (cpu) - #else --#define cpu_physical_id(cpu) boot_cpu_id -+#define cpu_physical_id(cpu) 0 - #endif /* !CONFIG_SMP */ - #endif + for (i = 0; strcmp(errorstring, xsd_errors[i].errstring) != 0; i++) { + if (i == ARRAY_SIZE(xsd_errors) - 1) { +- printk(KERN_WARNING +- "XENBUS xen store gave: unknown error %s", +- errorstring); ++ pr_warning("XENBUS xen store gave: unknown error %s", ++ errorstring); + return EINVAL; + } + } +@@ -277,9 +276,9 @@ static void *xs_talkv(struct xenbus_tran ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ head/arch/x86/include/mach-xen/asm/swiotlb.h 2011-01-31 17:56:27.000000000 +0100 -@@ -0,0 +1,5 @@ -+#ifdef CONFIG_X86_32 -+# include "swiotlb_32.h" -+#else -+# include_next -+#endif ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ head/arch/x86/include/mach-xen/asm/tlbflush.h 2011-01-31 17:56:27.000000000 +0100 -@@ -0,0 +1,5 @@ -+#ifdef CONFIG_X86_32 -+# include "tlbflush_32.h" -+#else -+# include "tlbflush_64.h" -+#endif ---- head.orig/arch/x86/include/mach-xen/asm/tlbflush_32.h 2011-01-31 17:49:31.000000000 +0100 -+++ head/arch/x86/include/mach-xen/asm/tlbflush_32.h 2011-01-31 17:56:27.000000000 +0100 -@@ -23,7 +23,6 @@ - * - flush_tlb_page(vma, vmaddr) flushes one page - * - flush_tlb_range(vma, start, end) flushes a range of pages - * - flush_tlb_kernel_range(start, end) flushes a range of kernel pages -- * - flush_tlb_pgtables(mm, start, end) flushes a range of page tables - * - * ..but the i386 has somewhat limited tlb flushing capabilities, - * and page-granular flushes are available only on i486 and up. -@@ -97,10 +96,4 @@ static inline void flush_tlb_kernel_rang - flush_tlb_all(); + if (msg.type != type) { + if (printk_ratelimit()) +- printk(KERN_WARNING +- "XENBUS unexpected type [%d], expected [%d]\n", +- msg.type, type); ++ pr_warning("XENBUS unexpected type [%d]," ++ " expected [%d]\n", ++ msg.type, type); + kfree(ret); + return ERR_PTR(-EINVAL); + } +@@ -637,7 +636,7 @@ static void xs_reset_watches(void) + + err = xs_error(xs_single(XBT_NIL, XS_RESET_WATCHES, "", NULL)); + if (err && err != -EEXIST) +- printk(KERN_WARNING "xs_reset_watches failed: %d\n", err); ++ pr_warning("xs_reset_watches failed: %d\n", err); + #endif } --static inline void flush_tlb_pgtables(struct mm_struct *mm, -- unsigned long start, unsigned long end) --{ -- /* i386 does not keep any page table caches in TLB */ --} -- - #endif /* _I386_TLBFLUSH_H */ ---- head.orig/arch/x86/include/mach-xen/asm/tlbflush_64.h 2011-01-31 17:49:31.000000000 +0100 -+++ head/arch/x86/include/mach-xen/asm/tlbflush_64.h 2011-01-31 17:56:27.000000000 +0100 +@@ -692,9 +691,8 @@ void unregister_xenbus_watch(struct xenb + + err = xs_unwatch(watch->node, token); + if (err) +- printk(KERN_WARNING +- "XENBUS Failed to release watch %s: %i\n", +- watch->node, err); ++ pr_warning("XENBUS Failed to release watch %s: %i\n", ++ watch->node, err); + + up_read(&xs_state.watch_mutex); + +@@ -930,8 +928,8 @@ static int xenbus_thread(void *unused) + for (;;) { + err = process_msg(); + if (err) +- printk(KERN_WARNING "XENBUS error %d while reading " +- "message\n", err); ++ pr_warning("XENBUS error %d while reading " ++ "message\n", err); + if (kthread_should_stop()) + break; + } +--- a/drivers/xen/xenoprof/xenoprofile.c ++++ b/drivers/xen/xenoprof/xenoprofile.c @@ -28,7 +28,6 @@ - * - flush_tlb_page(vma, vmaddr) flushes one page - * - flush_tlb_range(vma, start, end) flushes a range of pages - * - flush_tlb_kernel_range(start, end) flushes a range of kernel pages -- * - flush_tlb_pgtables(mm, start, end) flushes a range of page tables - * - * x86-64 can only flush individual pages or full VMs. For a range flush - * we always do the full VM. Might be worth trying if for a small -@@ -95,12 +94,4 @@ static inline void flush_tlb_kernel_rang - flush_tlb_all(); - } + #include + #include + #include +-#include "../../../drivers/oprofile/cpu_buffer.h" + #include "../../../drivers/oprofile/event_buffer.h" --static inline void flush_tlb_pgtables(struct mm_struct *mm, -- unsigned long start, unsigned long end) --{ -- /* x86_64 does not keep any page table caches in a software TLB. -- The CPUs do in their hardware TLBs, but they are handled -- by the normal TLB flushing algorithms. */ --} -- - #endif /* _X8664_TLBFLUSH_H */ ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ head/arch/x86/include/mach-xen/asm/xor.h 2012-07-05 10:56:25.000000000 +0200 -@@ -0,0 +1,21 @@ -+#include_next -+ -+#undef XOR_SELECT_TEMPLATE -+ -+#ifdef CONFIG_X86_64 -+ -+/* Also try the generic routines. */ -+#undef XOR_TRY_TEMPLATES -+#include -+ -+#undef XOR_TRY_TEMPLATES -+#define XOR_TRY_TEMPLATES \ -+do { \ -+ xor_speed(&xor_block_8regs); \ -+ xor_speed(&xor_block_8regs_p); \ -+ xor_speed(&xor_block_32regs); \ -+ xor_speed(&xor_block_32regs_p); \ -+ xor_speed(&xor_block_sse); \ -+} while (0) -+ -+#endif ---- head.orig/arch/x86/include/asm/mmu.h 2011-07-22 04:17:23.000000000 +0200 -+++ head/arch/x86/include/asm/mmu.h 2011-06-30 16:30:20.000000000 +0200 -@@ -16,6 +16,9 @@ typedef struct { - /* True if mm supports a task running in 32 bit compatibility mode. */ - unsigned short ia32_compat; - #endif -+#ifdef CONFIG_XEN -+ bool has_foreign_mappings:1; -+#endif + #define MAX_XENOPROF_SAMPLES 16 +@@ -145,8 +144,7 @@ static void xenoprof_add_pc(xenoprof_buf + if (xenoprof_is_escape(buf, tail) && + xenoprof_get_event(buf, tail) == XENOPROF_TRACE_BEGIN) { + tracing=1; +- oprofile_add_pc(ESCAPE_CODE, buf->event_log[tail].mode, +- CPU_TRACE_BEGIN); ++ oprofile_add_mode(buf->event_log[tail].mode); + if (!is_passive) + oprofile_samples++; + else +@@ -569,8 +567,8 @@ int __init xenoprofile_init(struct oprof + active_defined = 0; + } - struct mutex lock; - void *vdso; ---- head.orig/include/linux/kexec.h 2012-10-22 17:19:14.000000000 +0200 -+++ head/include/linux/kexec.h 2012-10-23 14:53:19.000000000 +0200 +- printk(KERN_INFO "%s: ret %d, events %d, xenoprof_is_primary %d\n", +- __func__, ret, init.num_events, xenoprof_is_primary); ++ pr_info("%s: ret %d, events %d, xenoprof_is_primary %d\n", ++ __func__, ret, init.num_events, xenoprof_is_primary); + return ret; + } + +--- a/include/linux/kexec.h ++++ b/include/linux/kexec.h @@ -198,8 +198,15 @@ extern struct kimage *kexec_crash_image; #define VMCOREINFO_BYTES (4096) #define VMCOREINFO_NOTE_NAME "VMCOREINFO" @@ -9439,8 +9608,8 @@ Acked-by: jbeulich@novell.com /* Location of a reserved region to hold the crash kernel. */ ---- head.orig/include/linux/oprofile.h 2011-09-07 15:19:35.000000000 +0200 -+++ head/include/linux/oprofile.h 2011-04-13 12:44:12.000000000 +0200 +--- a/include/linux/oprofile.h ++++ b/include/linux/oprofile.h @@ -130,6 +130,8 @@ void oprofile_add_ext_hw_sample(unsigned * backtrace. */ void oprofile_add_pc(unsigned long pc, int is_kernel, unsigned long event); @@ -9450,8 +9619,8 @@ Acked-by: jbeulich@novell.com /* add a backtrace entry, to be called from the ->backtrace callback */ void oprofile_add_trace(unsigned long eip); ---- head.orig/include/uapi/linux/sysctl.h 2012-12-11 04:30:57.000000000 +0100 -+++ head/include/uapi/linux/sysctl.h 2011-01-31 17:56:27.000000000 +0100 +--- a/include/uapi/linux/sysctl.h ++++ b/include/uapi/linux/sysctl.h @@ -59,6 +59,7 @@ enum CTL_BUS=8, /* Busses */ CTL_ABI=9, /* Binary emulation */ @@ -9460,8 +9629,8 @@ Acked-by: jbeulich@novell.com CTL_ARLAN=254, /* arlan wireless driver */ CTL_S390DBF=5677, /* s390 debug */ CTL_SUNRPC=7249, /* sunrpc debug */ ---- head.orig/include/xen/cpu_hotplug.h 2007-08-16 18:07:01.000000000 +0200 -+++ head/include/xen/cpu_hotplug.h 2011-01-31 17:56:27.000000000 +0100 +--- a/include/xen/cpu_hotplug.h ++++ b/include/xen/cpu_hotplug.h @@ -25,8 +25,8 @@ void cpu_bringup(void); static inline int smp_suspend(void) { @@ -9473,8 +9642,8 @@ Acked-by: jbeulich@novell.com return -EOPNOTSUPP; } return 0; ---- head.orig/include/xen/gnttab.h 2012-03-12 12:51:05.000000000 +0100 -+++ head/include/xen/gnttab.h 2012-03-12 13:39:32.000000000 +0100 +--- a/include/xen/gnttab.h ++++ b/include/xen/gnttab.h @@ -174,11 +174,11 @@ gnttab_set_replace_op(struct gnttab_unma BUG_ON(__ret); \ } \ @@ -9503,8 +9672,8 @@ Acked-by: jbeulich@novell.com __func__, current->comm, (__HCarg_p)->status); \ } ---- head.orig/include/xen/hvm.h 2011-01-31 15:14:12.000000000 +0100 -+++ head/include/xen/hvm.h 2011-01-31 17:56:27.000000000 +0100 +--- a/include/xen/hvm.h ++++ b/include/xen/hvm.h @@ -13,8 +13,7 @@ static inline unsigned long hvm_get_para xhv.index = idx; r = HYPERVISOR_hvm_op(HVMOP_get_param, &xhv); @@ -9515,8 +9684,8 @@ Acked-by: jbeulich@novell.com return 0; } return xhv.value; ---- head.orig/include/xen/net-util.h 2011-02-09 15:53:07.000000000 +0100 -+++ head/include/xen/net-util.h 2011-02-09 15:55:10.000000000 +0100 +--- a/include/xen/net-util.h ++++ b/include/xen/net-util.h @@ -51,7 +51,7 @@ static inline int skb_checksum_setup(str break; default: @@ -9526,8 +9695,8 @@ Acked-by: jbeulich@novell.com "TCP/UDP packet, dropping a protocol" " %d packet\n", iph->protocol); goto out; ---- head.orig/include/xen/pcifront.h 2012-04-04 08:57:09.000000000 +0200 -+++ head/include/xen/pcifront.h 2012-04-04 10:19:31.000000000 +0200 +--- a/include/xen/pcifront.h ++++ b/include/xen/pcifront.h @@ -12,13 +12,11 @@ #ifndef __ia64__ @@ -9564,8 +9733,8 @@ Acked-by: jbeulich@novell.com static inline void pcifront_setup_root_resources(struct pci_bus *bus, struct pcifront_sd *sd) { ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ head/include/xen/sysctl.h 2011-01-31 17:56:27.000000000 +0100 +--- /dev/null ++++ b/include/xen/sysctl.h @@ -0,0 +1,11 @@ +#ifndef _XEN_SYSCTL_H +#define _XEN_SYSCTL_H @@ -9578,8 +9747,8 @@ Acked-by: jbeulich@novell.com +}; + +#endif /* _XEN_SYSCTL_H */ ---- head.orig/include/xen/xenbus.h 2011-12-21 10:50:40.000000000 +0100 -+++ head/include/xen/xenbus.h 2011-01-31 17:56:27.000000000 +0100 +--- a/include/xen/xenbus.h ++++ b/include/xen/xenbus.h @@ -107,7 +107,7 @@ struct xenbus_driver { int (*suspend)(struct xenbus_device *dev); int (*suspend_cancel)(struct xenbus_device *dev); @@ -9589,8 +9758,8 @@ Acked-by: jbeulich@novell.com struct device_driver driver; int (*read_otherend_details)(struct xenbus_device *dev); int (*is_ready)(struct xenbus_device *dev); ---- head.orig/kernel/kexec.c 2013-03-21 14:13:51.000000000 +0100 -+++ head/kernel/kexec.c 2013-03-21 14:19:59.000000000 +0100 +--- a/kernel/kexec.c ++++ b/kernel/kexec.c @@ -45,7 +45,11 @@ note_buf_t __percpu *crash_notes; /* vmcoreinfo stuff */ @@ -9612,15 +9781,15 @@ Acked-by: jbeulich@novell.com /* * parsing the "crashkernel" commandline * -@@ -1476,6 +1481,7 @@ int __init parse_crashkernel_low(char *c +@@ -1568,6 +1573,7 @@ int __init parse_crashkernel_low(char *c return __parse_crashkernel(cmdline, system_ram, crash_size, crash_base, - "crashkernel_low="); + "crashkernel=", suffix_tbl[SUFFIX_LOW]); } +#endif static void update_vmcoreinfo_note(void) { -@@ -1532,7 +1538,18 @@ static int __init crash_save_vmcoreinfo_ +@@ -1624,7 +1630,18 @@ static int __init crash_save_vmcoreinfo_ VMCOREINFO_SYMBOL(init_uts_ns); VMCOREINFO_SYMBOL(node_online_map); #ifdef CONFIG_MMU @@ -9639,8 +9808,8 @@ Acked-by: jbeulich@novell.com #endif VMCOREINFO_SYMBOL(_stext); VMCOREINFO_SYMBOL(vmlist); ---- head.orig/kernel/sysctl_binary.c 2013-03-21 11:15:32.000000000 +0100 -+++ head/kernel/sysctl_binary.c 2013-03-21 14:20:04.000000000 +0100 +--- a/kernel/sysctl_binary.c ++++ b/kernel/sysctl_binary.c @@ -872,6 +872,14 @@ static const struct bin_table bin_bus_ta }; @@ -9666,8 +9835,8 @@ Acked-by: jbeulich@novell.com /* CTL_ARLAN "arlan" no longer used */ { CTL_DIR, CTL_S390DBF, "s390dbf", bin_s390dbf_table }, { CTL_DIR, CTL_SUNRPC, "sunrpc", bin_sunrpc_table }, ---- head.orig/lib/swiotlb-xen.c 2011-01-31 17:32:29.000000000 +0100 -+++ head/lib/swiotlb-xen.c 2013-03-21 14:20:09.000000000 +0100 +--- a/lib/swiotlb-xen.c ++++ b/lib/swiotlb-xen.c @@ -27,7 +27,7 @@ #include #include diff --git a/patches.xen/xen3-patch-3.9-rc5 b/patches.xen/xen3-patch-3.9-rc5 index cd6bb20..4f26910 100644 --- a/patches.xen/xen3-patch-3.9-rc5 +++ b/patches.xen/xen3-patch-3.9-rc5 @@ -7,8 +7,77 @@ Patch-mainline: 3.9-rc5 Automatically created from "tmp/patch-3.9-rc5" by xen-port-patches.py Acked-by: jbeulich@suse.com ---- head.orig/arch/x86/Kconfig 2013-03-21 15:40:03.000000000 +0100 -+++ head/arch/x86/Kconfig 2013-04-02 15:09:08.000000000 +0200 +--- + arch/x86/Kconfig | 2 + arch/x86/ia32/ia32entry-xen.S | 12 + arch/x86/include/asm/efi.h | 4 + arch/x86/include/asm/page_64.h | 7 + arch/x86/include/asm/processor.h | 2 + arch/x86/include/mach-xen/asm/pci.h | 6 + arch/x86/include/mach-xen/asm/pgtable.h | 30 + arch/x86/include/mach-xen/asm/pgtable_32.h | 7 + arch/x86/include/mach-xen/asm/pgtable_64.h | 8 + arch/x86/include/mach-xen/asm/pgtable_64_types.h | 4 + arch/x86/include/mach-xen/asm/pgtable_types.h | 5 + arch/x86/include/mach-xen/asm/processor.h | 31 + arch/x86/include/mach-xen/asm/xor.h | 1 + arch/x86/kernel/apic/io_apic-xen.c | 463 ++++++-------- + arch/x86/kernel/cpu/amd.c | 1 + arch/x86/kernel/cpu/common-xen.c | 17 + arch/x86/kernel/e820-xen.c | 16 + arch/x86/kernel/entry_32-xen.S | 45 - + arch/x86/kernel/entry_64-xen.S | 34 - + arch/x86/kernel/head-xen.c | 62 + + arch/x86/kernel/head32-xen.c | 20 + arch/x86/kernel/head64-xen.c | 131 +++- + arch/x86/kernel/head_64-xen.S | 9 + arch/x86/kernel/head_64.S | 2 + arch/x86/kernel/ioport-xen.c | 2 + arch/x86/kernel/process-xen.c | 122 --- + arch/x86/kernel/process.c | 2 + arch/x86/kernel/process_64-xen.c | 2 + arch/x86/kernel/setup-xen.c | 307 +++++---- + arch/x86/kernel/traps-xen.c | 15 + arch/x86/kernel/x86_init-xen.c | 4 + arch/x86/mm/fault-xen.c | 8 + arch/x86/mm/init-xen.c | 533 +++++++++------- + arch/x86/mm/init_32-xen.c | 151 +--- + arch/x86/mm/init_64-xen.c | 744 ++++++++++++++++++----- + arch/x86/mm/mm_internal.h | 2 + arch/x86/mm/pageattr-xen.c | 163 +++-- + arch/x86/mm/pgtable-xen.c | 7 + arch/x86/mm/physaddr.c | 4 + drivers/acpi/acpi_pad-xen.c | 3 + drivers/acpi/processor_driver.c | 1 + drivers/acpi/processor_idle.c | 9 + drivers/char/tpm/tpm.h | 4 + drivers/char/tpm/tpm_vtpm.c | 7 + drivers/hwmon/coretemp-xen.c | 5 + drivers/misc/vmw_vmci/Kconfig | 2 + drivers/pci/msi-xen.c | 26 + drivers/thermal/Kconfig | 2 + drivers/xen/Kconfig | 2 + drivers/xen/Makefile | 3 + drivers/xen/blkback/blkback.c | 4 + drivers/xen/blkback/common.h | 16 + drivers/xen/blkback/xenbus.c | 16 + drivers/xen/blktap/blktap.c | 2 + drivers/xen/blktap/common.h | 10 + drivers/xen/blktap/xenbus.c | 10 + drivers/xen/char/mem.c | 4 + drivers/xen/console/console.c | 6 + drivers/xen/core/gnttab.c | 2 + drivers/xen/xenbus/xenbus_client.c | 1 + drivers/xen/xenbus/xenbus_probe.c | 2 + include/xen/interface/io/blkif.h | 8 + include/xen/interface/memory.h | 6 + include/xen/interface/physdev.h | 6 + include/xen/interface/xen.h | 8 + lib/swiotlb-xen.c | 110 ++- + 66 files changed, 1993 insertions(+), 1267 deletions(-) + +--- a/arch/x86/Kconfig ++++ b/arch/x86/Kconfig @@ -439,7 +439,7 @@ config X86_UV config X86_GOLDFISH @@ -18,8 +87,8 @@ Acked-by: jbeulich@suse.com ---help--- Enable support for the Goldfish virtual platform used primarily for Android development. Unless you are building for the Android ---- head.orig/arch/x86/ia32/ia32entry-xen.S 2013-01-09 15:32:56.000000000 +0100 -+++ head/arch/x86/ia32/ia32entry-xen.S 2013-03-25 09:13:57.000000000 +0100 +--- a/arch/x86/ia32/ia32entry-xen.S ++++ b/arch/x86/ia32/ia32entry-xen.S @@ -346,18 +346,16 @@ ia32_badsys: ALIGN GLOBAL(\label) @@ -44,9 +113,9 @@ Acked-by: jbeulich@suse.com ALIGN GLOBAL(stub32_clone) ---- head.orig/arch/x86/include/asm/efi.h 2013-04-05 12:31:26.000000000 +0200 -+++ head/arch/x86/include/asm/efi.h 2013-03-25 09:13:57.000000000 +0100 -@@ -106,7 +106,11 @@ extern void efi_memory_uc(u64 addr, unsi +--- a/arch/x86/include/asm/efi.h ++++ b/arch/x86/include/asm/efi.h +@@ -113,7 +113,11 @@ struct efi_var_bootdata { static inline bool efi_is_native(void) { @@ -58,8 +127,8 @@ Acked-by: jbeulich@suse.com } #else ---- head.orig/arch/x86/include/asm/page_64.h 2013-03-21 14:43:37.000000000 +0100 -+++ head/arch/x86/include/asm/page_64.h 2013-04-05 12:33:18.000000000 +0200 +--- a/arch/x86/include/asm/page_64.h ++++ b/arch/x86/include/asm/page_64.h @@ -7,7 +7,14 @@ /* duplicated to the one in bootmem.h */ @@ -75,8 +144,8 @@ Acked-by: jbeulich@suse.com static inline unsigned long __phys_addr_nodebug(unsigned long x) { ---- head.orig/arch/x86/include/asm/processor.h 2013-04-05 12:31:26.000000000 +0200 -+++ head/arch/x86/include/asm/processor.h 2013-03-25 14:50:31.000000000 +0100 +--- a/arch/x86/include/asm/processor.h ++++ b/arch/x86/include/asm/processor.h @@ -997,7 +997,7 @@ extern unsigned long arch_align_stack(un extern void free_init_pages(char *what, unsigned long begin, unsigned long end); @@ -86,8 +155,8 @@ Acked-by: jbeulich@suse.com bool xen_set_default_idle(void); #else #define xen_set_default_idle 0 ---- head.orig/arch/x86/include/mach-xen/asm/pci.h 2013-01-09 15:32:33.000000000 +0100 -+++ head/arch/x86/include/mach-xen/asm/pci.h 2013-03-25 09:13:57.000000000 +0100 +--- a/arch/x86/include/mach-xen/asm/pci.h ++++ b/arch/x86/include/mach-xen/asm/pci.h @@ -14,6 +14,9 @@ struct pci_sysdata { int domain; /* PCI domain */ @@ -111,9 +180,9 @@ Acked-by: jbeulich@suse.com /* default to the implementation in drivers/lib/msi.c */ #define HAVE_DEFAULT_MSI_TEARDOWN_IRQS #define HAVE_DEFAULT_MSI_RESTORE_IRQS ---- head.orig/arch/x86/include/mach-xen/asm/pgtable.h 2013-02-20 11:39:48.000000000 +0100 -+++ head/arch/x86/include/mach-xen/asm/pgtable.h 2013-03-25 09:13:57.000000000 +0100 -@@ -393,6 +393,7 @@ pte_t *populate_extra_pte(unsigned long +--- a/arch/x86/include/mach-xen/asm/pgtable.h ++++ b/arch/x86/include/mach-xen/asm/pgtable.h +@@ -393,6 +393,7 @@ pte_t *populate_extra_pte(unsigned long #ifndef __ASSEMBLY__ #include @@ -164,8 +233,8 @@ Acked-by: jbeulich@suse.com #define arbitrary_virt_to_mfn(va) \ ({ \ unsigned int __lvl; \ ---- head.orig/arch/x86/include/mach-xen/asm/pgtable_32.h 2012-10-29 17:13:41.000000000 +0100 -+++ head/arch/x86/include/mach-xen/asm/pgtable_32.h 2013-03-25 09:13:57.000000000 +0100 +--- a/arch/x86/include/mach-xen/asm/pgtable_32.h ++++ b/arch/x86/include/mach-xen/asm/pgtable_32.h @@ -65,13 +65,6 @@ do { \ BUG(); \ } while (0) @@ -180,8 +249,8 @@ Acked-by: jbeulich@suse.com void make_lowmem_page_readonly(void *va, unsigned int feature); void make_lowmem_page_writable(void *va, unsigned int feature); ---- head.orig/arch/x86/include/mach-xen/asm/pgtable_64.h 2012-10-29 17:13:41.000000000 +0100 -+++ head/arch/x86/include/mach-xen/asm/pgtable_64.h 2013-03-25 09:13:57.000000000 +0100 +--- a/arch/x86/include/mach-xen/asm/pgtable_64.h ++++ b/arch/x86/include/mach-xen/asm/pgtable_64.h @@ -142,9 +142,6 @@ static inline int pgd_large(pgd_t pgd) { #define pte_offset_map(dir, address) pte_offset_kernel((dir), (address)) #define pte_unmap(pte) ((void)(pte))/* NOP */ @@ -204,8 +273,8 @@ Acked-by: jbeulich@suse.com #endif /* !__ASSEMBLY__ */ #endif /* _ASM_X86_PGTABLE_64_H */ ---- head.orig/arch/x86/include/mach-xen/asm/pgtable_64_types.h 2011-02-01 14:50:44.000000000 +0100 -+++ head/arch/x86/include/mach-xen/asm/pgtable_64_types.h 2013-03-25 09:13:57.000000000 +0100 +--- a/arch/x86/include/mach-xen/asm/pgtable_64_types.h ++++ b/arch/x86/include/mach-xen/asm/pgtable_64_types.h @@ -1,6 +1,8 @@ #ifndef _ASM_X86_PGTABLE_64_DEFS_H #define _ASM_X86_PGTABLE_64_DEFS_H @@ -222,9 +291,9 @@ Acked-by: jbeulich@suse.com +#define EARLY_DYNAMIC_PAGE_TABLES 64 + #endif /* _ASM_X86_PGTABLE_64_DEFS_H */ ---- head.orig/arch/x86/include/mach-xen/asm/pgtable_types.h 2013-01-09 15:32:33.000000000 +0100 -+++ head/arch/x86/include/mach-xen/asm/pgtable_types.h 2013-03-25 09:13:57.000000000 +0100 -@@ -380,13 +380,12 @@ int phys_mem_access_prot_allowed(struct +--- a/arch/x86/include/mach-xen/asm/pgtable_types.h ++++ b/arch/x86/include/mach-xen/asm/pgtable_types.h +@@ -380,13 +380,12 @@ int phys_mem_access_prot_allowed(struct /* Install a pte for a particular vaddr in kernel space. */ void set_pte_vaddr(unsigned long vaddr, pte_t pte); @@ -248,8 +317,8 @@ Acked-by: jbeulich@suse.com #endif /* !__ASSEMBLY__ */ ---- head.orig/arch/x86/include/mach-xen/asm/processor.h 2013-01-09 15:32:33.000000000 +0100 -+++ head/arch/x86/include/mach-xen/asm/processor.h 2013-03-25 14:50:48.000000000 +0100 +--- a/arch/x86/include/mach-xen/asm/processor.h ++++ b/arch/x86/include/mach-xen/asm/processor.h @@ -91,9 +91,6 @@ struct cpuinfo_x86 { char wp_works_ok; /* It doesn't on 386's */ @@ -306,7 +375,7 @@ Acked-by: jbeulich@suse.com /* Defined in head.S */ extern struct desc_ptr early_gdt_descr; -@@ -942,7 +939,7 @@ extern void start_thread(struct pt_regs +@@ -942,7 +939,7 @@ extern void start_thread(struct pt_regs extern int get_tsc_mode(unsigned long adr); extern int set_tsc_mode(unsigned int val); @@ -328,8 +397,8 @@ Acked-by: jbeulich@suse.com void stop_this_cpu(void *dummy); ---- head.orig/arch/x86/include/mach-xen/asm/xor.h 2012-07-05 12:24:15.000000000 +0200 -+++ head/arch/x86/include/mach-xen/asm/xor.h 2013-03-25 09:13:57.000000000 +0100 +--- a/arch/x86/include/mach-xen/asm/xor.h ++++ b/arch/x86/include/mach-xen/asm/xor.h @@ -19,6 +19,7 @@ do { \ xor_speed(&xor_block_32regs); \ xor_speed(&xor_block_32regs_p); \ @@ -338,8 +407,8 @@ Acked-by: jbeulich@suse.com AVX_XOR_SPEED; \ } while (0) ---- head.orig/arch/x86/kernel/apic/io_apic-xen.c 2013-01-09 15:32:33.000000000 +0100 -+++ head/arch/x86/kernel/apic/io_apic-xen.c 2013-04-02 18:04:13.000000000 +0200 +--- a/arch/x86/kernel/apic/io_apic-xen.c ++++ b/arch/x86/kernel/apic/io_apic-xen.c @@ -78,22 +78,6 @@ unsigned long io_apic_irqs; #define for_each_irq_pin(entry, head) \ for (entry = head; entry; entry = entry->next) @@ -556,7 +625,7 @@ Acked-by: jbeulich@suse.com union IO_APIC_reg_00 reg_00; union IO_APIC_reg_01 reg_01; union IO_APIC_reg_02 reg_02; -@@ -1647,58 +1675,7 @@ __apicdebuginit(void) print_IO_APIC(int +@@ -1647,58 +1675,7 @@ __apicdebuginit(void) print_IO_APIC(int printk(KERN_DEBUG ".... IRQ redirection table:\n"); @@ -984,7 +1053,7 @@ Acked-by: jbeulich@suse.com irq_set_chip_and_handler_name(irq, chip, handle_edge_irq, "edge"); -@@ -3265,46 +3243,26 @@ static int setup_msi_irq(struct pci_dev +@@ -3265,46 +3243,26 @@ static int setup_msi_irq(struct pci_dev int native_setup_msi_irqs(struct pci_dev *dev, int nvec, int type) { @@ -1085,8 +1154,8 @@ Acked-by: jbeulich@suse.com } } ---- head.orig/arch/x86/kernel/cpu/amd.c 2013-03-21 15:37:56.000000000 +0100 -+++ head/arch/x86/kernel/cpu/amd.c 2013-04-03 14:04:08.000000000 +0200 +--- a/arch/x86/kernel/cpu/amd.c ++++ b/arch/x86/kernel/cpu/amd.c @@ -567,7 +567,6 @@ static void __cpuinit init_amd(struct cp #else pr_warning("Long-mode LAHF feature wrongly enabled -" @@ -1095,8 +1164,8 @@ Acked-by: jbeulich@suse.com #endif } ---- head.orig/arch/x86/kernel/cpu/common-xen.c 2013-01-09 15:32:33.000000000 +0100 -+++ head/arch/x86/kernel/cpu/common-xen.c 2013-03-25 09:13:57.000000000 +0100 +--- a/arch/x86/kernel/cpu/common-xen.c ++++ b/arch/x86/kernel/cpu/common-xen.c @@ -37,6 +37,8 @@ #include #include @@ -1149,8 +1218,8 @@ Acked-by: jbeulich@suse.com if (cpumask_test_and_set_cpu(cpu, cpu_initialized_mask)) { printk(KERN_WARNING "CPU#%d already initialized!\n", cpu); for (;;) ---- head.orig/arch/x86/kernel/e820-xen.c 2012-10-31 11:57:31.000000000 +0100 -+++ head/arch/x86/kernel/e820-xen.c 2013-03-25 09:13:57.000000000 +0100 +--- a/arch/x86/kernel/e820-xen.c ++++ b/arch/x86/kernel/e820-xen.c @@ -946,7 +946,7 @@ static int __init parse_memopt(char *p) early_param("mem", parse_memopt); @@ -1160,7 +1229,7 @@ Acked-by: jbeulich@suse.com { char *oldp; u64 start_at, mem_size; -@@ -988,6 +988,20 @@ static int __init parse_memmap_opt(char +@@ -988,6 +988,20 @@ static int __init parse_memmap_opt(char return *p == '\0' ? 0 : -EINVAL; } @@ -1181,8 +1250,8 @@ Acked-by: jbeulich@suse.com early_param("memmap", parse_memmap_opt); #endif ---- head.orig/arch/x86/kernel/entry_32-xen.S 2013-01-09 15:32:33.000000000 +0100 -+++ head/arch/x86/kernel/entry_32-xen.S 2013-03-25 09:13:57.000000000 +0100 +--- a/arch/x86/kernel/entry_32-xen.S ++++ b/arch/x86/kernel/entry_32-xen.S @@ -762,51 +762,6 @@ END(syscall_badsys) */ .popsection @@ -1235,8 +1304,8 @@ Acked-by: jbeulich@suse.com #ifndef CONFIG_XEN .macro FIXUP_ESPFIX_STACK /* ---- head.orig/arch/x86/kernel/entry_64-xen.S 2013-01-09 15:32:33.000000000 +0100 -+++ head/arch/x86/kernel/entry_64-xen.S 2013-03-25 09:13:57.000000000 +0100 +--- a/arch/x86/kernel/entry_64-xen.S ++++ b/arch/x86/kernel/entry_64-xen.S @@ -844,23 +844,6 @@ int_restore_rest: CFI_ENDPROC END(system_call) @@ -1309,8 +1378,8 @@ Acked-by: jbeulich@suse.com FIXUP_TOP_OF_STACK %r11 call sys32_x32_rt_sigreturn movq %rax,RAX(%rsp) # fixme, this could be done at the higher layer ---- head.orig/arch/x86/kernel/head-xen.c 2013-04-05 09:22:12.000000000 +0200 -+++ head/arch/x86/kernel/head-xen.c 2013-04-05 09:25:29.000000000 +0200 +--- a/arch/x86/kernel/head-xen.c ++++ b/arch/x86/kernel/head-xen.c @@ -7,8 +7,6 @@ #ifndef CONFIG_XEN #include @@ -1413,8 +1482,8 @@ Acked-by: jbeulich@suse.com } #else xen_init_pt(); ---- head.orig/arch/x86/kernel/head32-xen.c 2012-06-14 11:23:26.000000000 +0200 -+++ head/arch/x86/kernel/head32-xen.c 2013-03-25 09:13:57.000000000 +0100 +--- a/arch/x86/kernel/head32-xen.c ++++ b/arch/x86/kernel/head32-xen.c @@ -46,20 +46,8 @@ void __init i386_start_kernel(void) BUG_ON(pte_index(hypervisor_virt_start)); #endif @@ -1449,8 +1518,8 @@ Acked-by: jbeulich@suse.com - start_kernel(); } ---- head.orig/arch/x86/kernel/head64-xen.c 2012-06-14 11:23:26.000000000 +0200 -+++ head/arch/x86/kernel/head64-xen.c 2013-04-05 12:38:17.000000000 +0200 +--- a/arch/x86/kernel/head64-xen.c ++++ b/arch/x86/kernel/head64-xen.c @@ -30,11 +30,81 @@ #include @@ -1629,8 +1698,8 @@ Acked-by: jbeulich@suse.com - start_kernel(); } ---- head.orig/arch/x86/kernel/head_64-xen.S 2012-12-06 16:12:32.000000000 +0100 -+++ head/arch/x86/kernel/head_64-xen.S 2013-04-05 12:37:24.000000000 +0200 +--- a/arch/x86/kernel/head_64-xen.S ++++ b/arch/x86/kernel/head_64-xen.S @@ -53,7 +53,7 @@ startup_64: #define NEXT_PAGE(name) \ @@ -1657,8 +1726,8 @@ Acked-by: jbeulich@suse.com #ifdef CONFIG_XEN_UNPRIVILEGED_GUEST # define XEN_DOM0_CAP 0 # define XEN_DOM0_CAP_STR "" ---- head.orig/arch/x86/kernel/head_64.S 2013-04-05 12:31:26.000000000 +0200 -+++ head/arch/x86/kernel/head_64.S 2013-03-25 14:52:16.000000000 +0100 +--- a/arch/x86/kernel/head_64.S ++++ b/arch/x86/kernel/head_64.S @@ -442,7 +442,7 @@ NEXT_PAGE(early_dynamic_pgts) .data @@ -1668,8 +1737,8 @@ Acked-by: jbeulich@suse.com NEXT_PAGE(init_level4_pgt) .fill 512,8,0 #else ---- head.orig/arch/x86/kernel/ioport-xen.c 2011-04-12 16:53:32.000000000 +0200 -+++ head/arch/x86/kernel/ioport-xen.c 2013-03-25 09:13:57.000000000 +0100 +--- a/arch/x86/kernel/ioport-xen.c ++++ b/arch/x86/kernel/ioport-xen.c @@ -65,7 +65,7 @@ asmlinkage long sys_ioperm(unsigned long * beyond the 0x3ff range: to get the full 65536 ports bitmapped * you'd need 8kB of bitmaps/process, which is a bit excessive. @@ -1679,8 +1748,8 @@ Acked-by: jbeulich@suse.com { struct thread_struct *t = ¤t->thread; unsigned int old = t->iopl >> 12; ---- head.orig/arch/x86/kernel/process-xen.c 2013-01-09 15:32:33.000000000 +0100 -+++ head/arch/x86/kernel/process-xen.c 2013-03-25 09:13:57.000000000 +0100 +--- a/arch/x86/kernel/process-xen.c ++++ b/arch/x86/kernel/process-xen.c @@ -257,13 +257,7 @@ void __switch_to_xtra(struct task_struct unsigned long boot_option_idle_override = IDLE_NO_OVERRIDE; EXPORT_SYMBOL(boot_option_idle_override); @@ -1895,8 +1964,8 @@ Acked-by: jbeulich@suse.com boot_option_idle_override = IDLE_HALT; } else if (!strcmp(str, "nomwait")) { /* ---- head.orig/arch/x86/kernel/process.c 2013-04-05 12:31:26.000000000 +0200 -+++ head/arch/x86/kernel/process.c 2013-03-25 14:53:22.000000000 +0100 +--- a/arch/x86/kernel/process.c ++++ b/arch/x86/kernel/process.c @@ -388,7 +388,7 @@ void default_idle(void) EXPORT_SYMBOL(default_idle); #endif @@ -1906,8 +1975,8 @@ Acked-by: jbeulich@suse.com bool xen_set_default_idle(void) { bool ret = !!x86_idle; ---- head.orig/arch/x86/kernel/process_64-xen.c 2013-01-09 15:32:33.000000000 +0100 -+++ head/arch/x86/kernel/process_64-xen.c 2013-03-25 09:13:57.000000000 +0100 +--- a/arch/x86/kernel/process_64-xen.c ++++ b/arch/x86/kernel/process_64-xen.c @@ -126,7 +126,7 @@ void release_thread(struct task_struct * { if (dead_task->mm) { @@ -1917,8 +1986,8 @@ Acked-by: jbeulich@suse.com dead_task->comm, dead_task->mm->context.ldt, dead_task->mm->context.size); ---- head.orig/arch/x86/kernel/setup-xen.c 2013-02-06 15:28:03.000000000 +0100 -+++ head/arch/x86/kernel/setup-xen.c 2013-04-02 15:50:04.000000000 +0200 +--- a/arch/x86/kernel/setup-xen.c ++++ b/arch/x86/kernel/setup-xen.c @@ -107,9 +107,6 @@ #include #include @@ -2339,7 +2408,7 @@ Acked-by: jbeulich@suse.com static int __init parse_reservelow(char *p) { unsigned long long size; -@@ -802,6 +870,11 @@ static int __init parse_reservelow(char +@@ -802,6 +870,11 @@ static int __init parse_reservelow(char } early_param("reservelow", parse_reservelow); @@ -2477,9 +2546,9 @@ Acked-by: jbeulich@suse.com pr_info("efi: Setup done, disabling due to 32/64-bit mismatch\n"); efi_unmap_memmap(); } ---- head.orig/arch/x86/kernel/traps-xen.c 2013-01-09 15:32:33.000000000 +0100 -+++ head/arch/x86/kernel/traps-xen.c 2013-03-25 09:13:57.000000000 +0100 -@@ -702,6 +702,11 @@ dotraplinkage void do_iret_error(struct +--- a/arch/x86/kernel/traps-xen.c ++++ b/arch/x86/kernel/traps-xen.c +@@ -702,6 +702,11 @@ dotraplinkage void do_iret_error(struct static const trap_info_t __initconst early_trap_table[] = { { X86_TRAP_DB, 0|4, __KERNEL_CS, (unsigned long)debug }, { X86_TRAP_BP, 3|4, __KERNEL_CS, (unsigned long)int3 }, @@ -2508,9 +2577,9 @@ Acked-by: jbeulich@suse.com void __init trap_init(void) { int ret; ---- head.orig/arch/x86/kernel/x86_init-xen.c 2012-10-29 17:13:41.000000000 +0100 -+++ head/arch/x86/kernel/x86_init-xen.c 2013-03-25 09:13:57.000000000 +0100 -@@ -64,10 +64,6 @@ struct x86_init_ops x86_init __initdata +--- a/arch/x86/kernel/x86_init-xen.c ++++ b/arch/x86/kernel/x86_init-xen.c +@@ -64,10 +64,6 @@ struct x86_init_ops x86_init __initdata .banner = x86_init_noop, }, @@ -2521,8 +2590,8 @@ Acked-by: jbeulich@suse.com .paging = { .pagetable_init = xen_pagetable_init, }, ---- head.orig/arch/x86/mm/fault-xen.c 2013-02-20 11:39:48.000000000 +0100 -+++ head/arch/x86/mm/fault-xen.c 2013-03-25 09:13:57.000000000 +0100 +--- a/arch/x86/mm/fault-xen.c ++++ b/arch/x86/mm/fault-xen.c @@ -948,14 +948,8 @@ spurious_fault(unsigned long error_code, if (pmd_large(*pmd)) return spurious_fault_check(error_code, (pte_t *) pmd); @@ -2539,8 +2608,8 @@ Acked-by: jbeulich@suse.com return 0; ret = spurious_fault_check(error_code, pte); ---- head.orig/arch/x86/mm/init-xen.c 2012-10-31 11:57:31.000000000 +0100 -+++ head/arch/x86/mm/init-xen.c 2013-04-05 09:25:22.000000000 +0200 +--- a/arch/x86/mm/init-xen.c ++++ b/arch/x86/mm/init-xen.c @@ -16,105 +16,155 @@ #include #include @@ -3204,8 +3273,8 @@ Acked-by: jbeulich@suse.com /* * end could be not aligned, and We can not align that, * decompresser could be confused by aligned initrd_end ---- head.orig/arch/x86/mm/init_32-xen.c 2013-01-09 15:32:33.000000000 +0100 -+++ head/arch/x86/mm/init_32-xen.c 2013-03-25 15:59:59.000000000 +0100 +--- a/arch/x86/mm/init_32-xen.c ++++ b/arch/x86/mm/init_32-xen.c @@ -56,25 +56,14 @@ #include #include @@ -3442,7 +3511,7 @@ Acked-by: jbeulich@suse.com codesize = (unsigned long) &_etext - (unsigned long) &_text; datasize = (unsigned long) &_edata - (unsigned long) &_etext; initsize = (unsigned long) &__init_end - (unsigned long) &__init_begin; -@@ -900,6 +861,18 @@ int arch_add_memory(int nid, u64 start, +@@ -900,6 +861,18 @@ int arch_add_memory(int nid, u64 start, return __add_pages(nid, zone, start_pfn, nr_pages); } @@ -3461,8 +3530,8 @@ Acked-by: jbeulich@suse.com #endif /* ---- head.orig/arch/x86/mm/init_64-xen.c 2013-04-05 09:23:18.000000000 +0200 -+++ head/arch/x86/mm/init_64-xen.c 2013-04-05 09:25:24.000000000 +0200 +--- a/arch/x86/mm/init_64-xen.c ++++ b/arch/x86/mm/init_64-xen.c @@ -58,6 +58,8 @@ #include @@ -3678,7 +3747,7 @@ Acked-by: jbeulich@suse.com if (addr >= end || (!after_bootmem && (addr >> PAGE_SHIFT) >= xen_start_info->nr_pages)) -@@ -525,23 +558,20 @@ phys_pmd_init(pmd_t *pmd_page, unsigned +@@ -525,23 +558,20 @@ phys_pmd_init(pmd_t *pmd_page, unsigned int i = pmd_index(address); for (; i < PTRS_PER_PMD; i++, address = next) { @@ -3704,7 +3773,7 @@ Acked-by: jbeulich@suse.com spin_unlock(&init_mm.page_table_lock); continue; } -@@ -570,35 +600,31 @@ phys_pmd_init(pmd_t *pmd_page, unsigned +@@ -570,35 +600,31 @@ phys_pmd_init(pmd_t *pmd_page, unsigned pages++; spin_lock(&init_mm.page_table_lock); set_pte((pte_t *)pmd, @@ -3746,7 +3815,7 @@ Acked-by: jbeulich@suse.com spin_unlock(&init_mm.page_table_lock); } } -@@ -615,23 +641,20 @@ phys_pud_init(pud_t *pud_page, unsigned +@@ -615,23 +641,20 @@ phys_pud_init(pud_t *pud_page, unsigned int i = pud_index(addr); for (; i < PTRS_PER_PUD; i++, addr = next) { @@ -3772,7 +3841,7 @@ Acked-by: jbeulich@suse.com __flush_tlb_all(); continue; } -@@ -660,36 +683,33 @@ phys_pud_init(pud_t *pud_page, unsigned +@@ -660,36 +683,33 @@ phys_pud_init(pud_t *pud_page, unsigned pages++; spin_lock(&init_mm.page_table_lock); set_pte((pte_t *)pud, @@ -3816,7 +3885,7 @@ Acked-by: jbeulich@suse.com spin_unlock(&init_mm.page_table_lock); } } -@@ -700,9 +720,15 @@ phys_pud_init(pud_t *pud_page, unsigned +@@ -700,9 +720,15 @@ phys_pud_init(pud_t *pud_page, unsigned return last_map_addr; } @@ -3969,7 +4038,7 @@ Acked-by: jbeulich@suse.com return last_map_addr; } -@@ -922,13 +981,11 @@ int arch_add_memory(int nid, u64 start, +@@ -922,13 +981,11 @@ int arch_add_memory(int nid, u64 start, { struct pglist_data *pgdat = NODE_DATA(nid); struct zone *zone = pgdat->node_zones + ZONE_NORMAL; @@ -3985,7 +4054,7 @@ Acked-by: jbeulich@suse.com ret = __add_pages(nid, zone, start_pfn, nr_pages); WARN_ON_ONCE(ret); -@@ -940,10 +997,357 @@ int arch_add_memory(int nid, u64 start, +@@ -940,10 +997,357 @@ int arch_add_memory(int nid, u64 start, } EXPORT_SYMBOL_GPL(arch_add_memory); @@ -4477,8 +4546,8 @@ Acked-by: jbeulich@suse.com void __meminit vmemmap_populate_print_last(void) { if (p_start) { ---- head.orig/arch/x86/mm/mm_internal.h 2013-04-05 12:31:26.000000000 +0200 -+++ head/arch/x86/mm/mm_internal.h 2013-04-03 17:43:19.000000000 +0200 +--- a/arch/x86/mm/mm_internal.h ++++ b/arch/x86/mm/mm_internal.h @@ -14,6 +14,8 @@ unsigned long kernel_physical_mapping_in unsigned long page_size_mask); void zone_sizes_init(void); @@ -4488,9 +4557,9 @@ Acked-by: jbeulich@suse.com extern int after_bootmem; #endif /* __X86_MM_INTERNAL_H */ ---- head.orig/arch/x86/mm/pageattr-xen.c 2012-06-19 12:14:10.000000000 +0200 -+++ head/arch/x86/mm/pageattr-xen.c 2013-03-25 09:13:57.000000000 +0100 -@@ -94,12 +94,12 @@ static inline void split_page_count(int +--- a/arch/x86/mm/pageattr-xen.c ++++ b/arch/x86/mm/pageattr-xen.c +@@ -94,12 +94,12 @@ static inline void split_page_count(int static inline unsigned long highmap_start_pfn(void) { @@ -4772,8 +4841,8 @@ Acked-by: jbeulich@suse.com /* * No need to redo, when the primary call touched the direct * mapping already: ---- head.orig/arch/x86/mm/pgtable-xen.c 2013-01-09 15:32:33.000000000 +0100 -+++ head/arch/x86/mm/pgtable-xen.c 2013-03-25 09:13:57.000000000 +0100 +--- a/arch/x86/mm/pgtable-xen.c ++++ b/arch/x86/mm/pgtable-xen.c @@ -748,7 +748,12 @@ int pmdp_set_access_flags(struct vm_area if (changed && dirty) { *pmdp = entry; @@ -4788,8 +4857,8 @@ Acked-by: jbeulich@suse.com } return changed; ---- head.orig/arch/x86/mm/physaddr.c 2013-03-21 15:12:19.000000000 +0100 -+++ head/arch/x86/mm/physaddr.c 2013-04-03 14:23:10.000000000 +0200 +--- a/arch/x86/mm/physaddr.c ++++ b/arch/x86/mm/physaddr.c @@ -9,10 +9,6 @@ #ifdef CONFIG_X86_64 @@ -4801,8 +4870,8 @@ Acked-by: jbeulich@suse.com #ifdef CONFIG_DEBUG_VIRTUAL unsigned long __phys_addr(unsigned long x) { ---- head.orig/drivers/acpi/acpi_pad-xen.c 2013-01-09 15:32:33.000000000 +0100 -+++ head/drivers/acpi/acpi_pad-xen.c 2013-03-25 09:13:58.000000000 +0100 +--- a/drivers/acpi/acpi_pad-xen.c ++++ b/drivers/acpi/acpi_pad-xen.c @@ -187,8 +187,7 @@ static int acpi_pad_add(struct acpi_devi return 0; } @@ -4813,8 +4882,8 @@ Acked-by: jbeulich@suse.com { mutex_lock(&xen_cpu_lock); xen_acpi_pad_idle_cpus(0); ---- head.orig/drivers/acpi/processor_driver.c 2013-03-21 15:40:48.000000000 +0100 -+++ head/drivers/acpi/processor_driver.c 2013-04-02 17:01:21.000000000 +0200 +--- a/drivers/acpi/processor_driver.c ++++ b/drivers/acpi/processor_driver.c @@ -802,6 +802,7 @@ static void acpi_processor_hotplug_notif break; } @@ -4823,8 +4892,8 @@ Acked-by: jbeulich@suse.com if (processor_cntl_external() && pr) processor_notify_external(pr, PROCESSOR_HOTPLUG, HOTPLUG_TYPE_ADD); ---- head.orig/drivers/acpi/processor_idle.c 2013-03-21 15:38:05.000000000 +0100 -+++ head/drivers/acpi/processor_idle.c 2013-04-02 17:19:24.000000000 +0200 +--- a/drivers/acpi/processor_idle.c ++++ b/drivers/acpi/processor_idle.c @@ -66,9 +66,6 @@ module_param(latency_factor, uint, 0644) static DEFINE_PER_CPU(struct cpuidle_device *, acpi_cpuidle_device); @@ -4845,7 +4914,7 @@ Acked-by: jbeulich@suse.com /** * acpi_idle_enter_c1 - enters an ACPI C1 state-type * @dev: the target CPU -@@ -1073,7 +1073,8 @@ static int acpi_processor_setup_cpuidle_ +@@ -1074,7 +1074,8 @@ static int acpi_processor_setup_cpuidle_ return 0; } #else @@ -4855,8 +4924,8 @@ Acked-by: jbeulich@suse.com static void acpi_processor_setup_cpuidle_states(struct acpi_processor *pr) {} #endif /* CONFIG_PROCESSOR_EXTERNAL_CONTROL */ ---- head.orig/drivers/char/tpm/tpm.h 2013-03-21 15:38:12.000000000 +0100 -+++ head/drivers/char/tpm/tpm.h 2013-04-02 16:07:26.000000000 +0200 +--- a/drivers/char/tpm/tpm.h ++++ b/drivers/char/tpm/tpm.h @@ -324,12 +324,12 @@ ssize_t tpm_getcap(struct device *, __be static inline void *chip_get_private(const struct tpm_chip *chip) @@ -4872,8 +4941,8 @@ Acked-by: jbeulich@suse.com } extern int tpm_get_timeouts(struct tpm_chip *); ---- head.orig/drivers/char/tpm/tpm_vtpm.c 2011-02-01 15:03:03.000000000 +0100 -+++ head/drivers/char/tpm/tpm_vtpm.c 2013-04-02 16:11:18.000000000 +0200 +--- a/drivers/char/tpm/tpm_vtpm.c ++++ b/drivers/char/tpm/tpm_vtpm.c @@ -450,6 +450,11 @@ static u8 vtpm_status(struct tpm_chip *c return rc; } @@ -4895,8 +4964,8 @@ Acked-by: jbeulich@suse.com .attr_group = &vtpm_attr_grp, .miscdev = { .fops = &vtpm_ops, ---- head.orig/drivers/hwmon/coretemp-xen.c 2013-01-09 15:32:33.000000000 +0100 -+++ head/drivers/hwmon/coretemp-xen.c 2013-03-25 09:13:58.000000000 +0100 +--- a/drivers/hwmon/coretemp-xen.c ++++ b/drivers/hwmon/coretemp-xen.c @@ -206,7 +206,7 @@ struct tjmax { static const struct tjmax tjmax_table[] = { { "CPU 230", 100000 }, /* Model 0x1c, stepping 2 */ @@ -4923,20 +4992,20 @@ Acked-by: jbeulich@suse.com { 0x36, ANY, 100000 }, /* Atom Cedar Trail/Cedarview (N2xxx, D2xxx) */ }; ---- head.orig/drivers/misc/vmw_vmci/Kconfig 2013-04-05 12:31:26.000000000 +0200 -+++ head/drivers/misc/vmw_vmci/Kconfig 2013-04-02 15:09:54.000000000 +0200 +--- a/drivers/misc/vmw_vmci/Kconfig ++++ b/drivers/misc/vmw_vmci/Kconfig @@ -4,7 +4,7 @@ config VMWARE_VMCI tristate "VMware VMCI Driver" -- depends on X86 && PCI -+ depends on X86 && PCI && !XEN +- depends on X86 && PCI && NET ++ depends on X86 && PCI && NET && !XEN help This is VMware's Virtual Machine Communication Interface. It enables high-speed communication between host and guest in a virtual ---- head.orig/drivers/pci/msi-xen.c 2012-10-31 11:21:39.000000000 +0100 -+++ head/drivers/pci/msi-xen.c 2013-03-25 09:13:58.000000000 +0100 -@@ -744,6 +744,32 @@ int pci_enable_msi_block(struct pci_dev +--- a/drivers/pci/msi-xen.c ++++ b/drivers/pci/msi-xen.c +@@ -744,6 +744,32 @@ int pci_enable_msi_block(struct pci_dev } EXPORT_SYMBOL(pci_enable_msi_block); @@ -4969,8 +5038,8 @@ Acked-by: jbeulich@suse.com extern void pci_frontend_disable_msi(struct pci_dev* dev); void pci_msi_shutdown(struct pci_dev *dev) { ---- head.orig/drivers/thermal/Kconfig 2013-04-05 12:31:26.000000000 +0200 -+++ head/drivers/thermal/Kconfig 2013-04-02 15:07:43.000000000 +0200 +--- a/drivers/thermal/Kconfig ++++ b/drivers/thermal/Kconfig @@ -158,7 +158,7 @@ config DB8500_CPUFREQ_COOLING config INTEL_POWERCLAMP tristate "Intel PowerClamp idle injection driver" @@ -4980,8 +5049,8 @@ Acked-by: jbeulich@suse.com depends on CPU_SUP_INTEL help Enable this to enable Intel PowerClamp idle injection driver. This ---- head.orig/drivers/xen/Kconfig 2013-03-21 15:30:43.000000000 +0100 -+++ head/drivers/xen/Kconfig 2013-04-03 10:50:46.000000000 +0200 +--- a/drivers/xen/Kconfig ++++ b/drivers/xen/Kconfig @@ -597,7 +597,7 @@ config XEN_PRIVCMD config XEN_STUB @@ -4991,8 +5060,8 @@ Acked-by: jbeulich@suse.com default n help Allow kernel to install stub drivers, to reserve space for Xen drivers, ---- head.orig/drivers/xen/Makefile 2013-01-09 15:32:33.000000000 +0100 -+++ head/drivers/xen/Makefile 2013-03-25 09:13:58.000000000 +0100 +--- a/drivers/xen/Makefile ++++ b/drivers/xen/Makefile @@ -52,6 +52,9 @@ obj-$(CONFIG_SWIOTLB_XEN) += swiotlb-xe obj-$(CONFIG_XEN_MCE_LOG) += mcelog.o obj-$(CONFIG_XEN_PCIDEV_BACKEND) += xen-pciback/ @@ -5003,8 +5072,8 @@ Acked-by: jbeulich@suse.com obj-$(CONFIG_XEN_ACPI_PROCESSOR) += xen-acpi-processor.o xen-evtchn-y := evtchn.o xen-gntdev-y := gntdev.o ---- head.orig/drivers/xen/blkback/blkback.c 2013-03-05 12:37:53.000000000 +0100 -+++ head/drivers/xen/blkback/blkback.c 2013-04-03 10:59:17.000000000 +0200 +--- a/drivers/xen/blkback/blkback.c ++++ b/drivers/xen/blkback/blkback.c @@ -175,8 +175,8 @@ static void fast_flush_area(pending_req_ static void print_stats(blkif_t *blkif) @@ -5016,8 +5085,8 @@ Acked-by: jbeulich@suse.com current->comm, blkif->st_oo_req, blkif->st_rd_req, blkif->st_wr_req, blkif->st_br_req, blkif->st_fl_req, blkif->st_ds_req); ---- head.orig/drivers/xen/blkback/common.h 2012-06-08 10:38:21.000000000 +0200 -+++ head/drivers/xen/blkback/common.h 2013-04-03 11:00:10.000000000 +0200 +--- a/drivers/xen/blkback/common.h ++++ b/drivers/xen/blkback/common.h @@ -83,14 +83,14 @@ typedef struct blkif_st { /* statistics */ @@ -5041,9 +5110,9 @@ Acked-by: jbeulich@suse.com wait_queue_head_t waiting_to_free; } blkif_t; ---- head.orig/drivers/xen/blkback/xenbus.c 2012-12-18 12:11:42.000000000 +0100 -+++ head/drivers/xen/blkback/xenbus.c 2013-04-03 11:36:44.000000000 +0200 -@@ -114,14 +114,14 @@ static void update_blkif_status(blkif_t +--- a/drivers/xen/blkback/xenbus.c ++++ b/drivers/xen/blkback/xenbus.c +@@ -114,14 +114,14 @@ static void update_blkif_status(blkif_t } \ static DEVICE_ATTR(name, S_IRUGO, show_##name, NULL) @@ -5066,8 +5135,8 @@ Acked-by: jbeulich@suse.com static struct attribute *vbdstat_attrs[] = { &dev_attr_oo_req.attr, ---- head.orig/drivers/xen/blktap/blktap.c 2012-10-30 14:54:13.000000000 +0100 -+++ head/drivers/xen/blktap/blktap.c 2013-04-03 11:02:00.000000000 +0200 +--- a/drivers/xen/blktap/blktap.c ++++ b/drivers/xen/blktap/blktap.c @@ -1142,7 +1142,7 @@ static void fast_flush_area(pending_req_ static void print_stats(blkif_t *blkif) @@ -5077,8 +5146,8 @@ Acked-by: jbeulich@suse.com current->comm, blkif->st_oo_req, blkif->st_rd_req, blkif->st_wr_req); blkif->st_print = jiffies + msecs_to_jiffies(10 * 1000); ---- head.orig/drivers/xen/blktap/common.h 2011-11-18 15:35:50.000000000 +0100 -+++ head/drivers/xen/blktap/common.h 2013-04-03 11:02:15.000000000 +0200 +--- a/drivers/xen/blktap/common.h ++++ b/drivers/xen/blktap/common.h @@ -67,11 +67,11 @@ typedef struct blkif_st { /* statistics */ @@ -5096,8 +5165,8 @@ Acked-by: jbeulich@suse.com wait_queue_head_t waiting_to_free; ---- head.orig/drivers/xen/blktap/xenbus.c 2011-11-18 15:35:43.000000000 +0100 -+++ head/drivers/xen/blktap/xenbus.c 2013-04-03 11:37:01.000000000 +0200 +--- a/drivers/xen/blktap/xenbus.c ++++ b/drivers/xen/blktap/xenbus.c @@ -132,11 +132,11 @@ static int blktap_name(blkif_t *blkif, c } \ static DEVICE_ATTR(name, S_IRUGO, show_##name, NULL) @@ -5115,8 +5184,8 @@ Acked-by: jbeulich@suse.com static struct attribute *tapstat_attrs[] = { &dev_attr_oo_req.attr, ---- head.orig/drivers/xen/char/mem.c 2013-01-09 15:32:33.000000000 +0100 -+++ head/drivers/xen/char/mem.c 2013-03-25 09:13:58.000000000 +0100 +--- a/drivers/xen/char/mem.c ++++ b/drivers/xen/char/mem.c @@ -187,7 +187,7 @@ static loff_t memory_lseek(struct file * { loff_t ret; @@ -5135,8 +5204,8 @@ Acked-by: jbeulich@suse.com return ret; } ---- head.orig/drivers/xen/console/console.c 2013-01-29 14:57:06.000000000 +0100 -+++ head/drivers/xen/console/console.c 2013-04-02 16:43:06.000000000 +0200 +--- a/drivers/xen/console/console.c ++++ b/drivers/xen/console/console.c @@ -351,10 +351,12 @@ void xencons_rx(char *buf, unsigned len) { int i; @@ -5162,8 +5231,8 @@ Acked-by: jbeulich@suse.com out: spin_unlock_irqrestore(&xencons_lock, flags); ---- head.orig/drivers/xen/core/gnttab.c 2013-01-09 17:00:21.000000000 +0100 -+++ head/drivers/xen/core/gnttab.c 2013-04-02 17:20:40.000000000 +0200 +--- a/drivers/xen/core/gnttab.c ++++ b/drivers/xen/core/gnttab.c @@ -691,7 +691,7 @@ EXPORT_SYMBOL_GPL(gnttab_copy_grant_page void gnttab_reset_grant_page(struct page *page) { @@ -5173,8 +5242,8 @@ Acked-by: jbeulich@suse.com } EXPORT_SYMBOL_GPL(gnttab_reset_grant_page); ---- head.orig/drivers/xen/xenbus/xenbus_client.c 2012-10-29 17:13:41.000000000 +0100 -+++ head/drivers/xen/xenbus/xenbus_client.c 2013-03-25 09:13:58.000000000 +0100 +--- a/drivers/xen/xenbus/xenbus_client.c ++++ b/drivers/xen/xenbus/xenbus_client.c @@ -30,6 +30,7 @@ * IN THE SOFTWARE. */ @@ -5183,8 +5252,8 @@ Acked-by: jbeulich@suse.com #include #if defined(CONFIG_XEN) || defined(MODULE) #include ---- head.orig/drivers/xen/xenbus/xenbus_probe.c 2013-01-09 17:03:24.000000000 +0100 -+++ head/drivers/xen/xenbus/xenbus_probe.c 2013-03-25 09:13:58.000000000 +0100 +--- a/drivers/xen/xenbus/xenbus_probe.c ++++ b/drivers/xen/xenbus/xenbus_probe.c @@ -1375,7 +1375,7 @@ xenbus_init(void) goto out_error; xen_store_mfn = (unsigned long)v; @@ -5194,8 +5263,8 @@ Acked-by: jbeulich@suse.com break; default: pr_warn("Xenstore state unknown\n"); ---- head.orig/include/xen/interface/io/blkif.h 2012-12-18 12:12:00.000000000 +0100 -+++ head/include/xen/interface/io/blkif.h 2013-04-03 10:55:46.000000000 +0200 +--- a/include/xen/interface/io/blkif.h ++++ b/include/xen/interface/io/blkif.h @@ -519,6 +519,14 @@ struct blkif_request { uint64_t nr_sectors; uint8_t _pad3; @@ -5211,8 +5280,8 @@ Acked-by: jbeulich@suse.com } u; } __attribute__((__packed__)); #endif ---- head.orig/include/xen/interface/memory.h 2013-01-09 15:32:33.000000000 +0100 -+++ head/include/xen/interface/memory.h 2013-03-25 09:13:58.000000000 +0100 +--- a/include/xen/interface/memory.h ++++ b/include/xen/interface/memory.h @@ -249,6 +249,7 @@ DEFINE_XEN_GUEST_HANDLE(xen_add_to_physm /* A batched version of add_to_physmap. */ #define XENMEM_add_to_physmap_range 23 @@ -5233,8 +5302,8 @@ Acked-by: jbeulich@suse.com }; DEFINE_GUEST_HANDLE_STRUCT(xen_add_to_physmap_range); typedef struct xen_add_to_physmap_range xen_add_to_physmap_range_t; ---- head.orig/include/xen/interface/physdev.h 2012-10-04 11:18:40.000000000 +0200 -+++ head/include/xen/interface/physdev.h 2013-04-03 10:55:46.000000000 +0200 +--- a/include/xen/interface/physdev.h ++++ b/include/xen/interface/physdev.h @@ -298,6 +298,12 @@ DEFINE_XEN_GUEST_HANDLE(physdev_pci_devi #define PHYSDEVOP_pci_device_remove 26 @@ -5248,8 +5317,8 @@ Acked-by: jbeulich@suse.com struct physdev_pci_device { /* IN */ uint16_t seg; ---- head.orig/include/xen/interface/xen.h 2012-10-29 17:13:41.000000000 +0100 -+++ head/include/xen/interface/xen.h 2013-03-25 09:13:58.000000000 +0100 +--- a/include/xen/interface/xen.h ++++ b/include/xen/interface/xen.h @@ -569,7 +569,7 @@ DEFINE_XEN_GUEST_HANDLE(multicall_entry_ * Event channel endpoints per domain: * 1024 if a long is 32 bits; 4096 if a long is 64 bits. @@ -5279,8 +5348,8 @@ Acked-by: jbeulich@suse.com /* * Wallclock time: updated only by control software. Guests should base ---- head.orig/lib/swiotlb-xen.c 2013-01-14 15:36:34.000000000 +0100 -+++ head/lib/swiotlb-xen.c 2013-03-25 10:04:56.000000000 +0100 +--- a/lib/swiotlb-xen.c ++++ b/lib/swiotlb-xen.c @@ -129,10 +129,17 @@ static dma_addr_t swiotlb_virt_to_bus(st } #endif @@ -5430,16 +5499,17 @@ Acked-by: jbeulich@suse.com - defsz = 2 * (1 << 20); /* 2MB on <2GB on systems. */ - swiotlb = 1; - } +- +- if (swiotlb) +- swiotlb_init_with_default_size(defsz, verbose); +- else +- printk(KERN_INFO "Software IO TLB disabled\n"); + /* Get IO TLB memory from the low pages */ + vstart = alloc_bootmem_pages_nopanic(PAGE_ALIGN(bytes)); + msg = _swiotlb_init_with_tbl(vstart, io_tlb_nslabs, verbose); + if (!msg) + return; - -- if (swiotlb) -- swiotlb_init_with_default_size(defsz, verbose); -- else -- printk(KERN_INFO "Software IO TLB disabled\n"); ++ + if (swiotlb_force > 0) + panic(msg); + if (io_tlb_start) diff --git a/rpm/config.sh b/rpm/config.sh index 977345d..999e699 100644 --- a/rpm/config.sh +++ b/rpm/config.sh @@ -1,5 +1,5 @@ # The version of the main tarball to use -SRCVERSION=3.9-rc6 +SRCVERSION=3.9-rc8 # variant of the kernel-source package, either empty or "-rt" VARIANT= # buildservice projects to build the kernel against diff --git a/series.conf b/series.conf index e06ce09..61dbc9b 100644 --- a/series.conf +++ b/series.conf @@ -151,7 +151,6 @@ # ARM ######################################################## patches.arch/cubox-configuration.patch - patches.arch/arm-fix-build-ux500-module.diff patches.arch/arm-exynos-nosparse.patch patches.arch/arm-origen-regulator.patch patches.arch/arm-OMAP-Fix-missing-cm3xxx.h-include.patch @@ -162,7 +161,7 @@ patches.arch/arm-fec.patch patches.arch/arm-smdkv310.patch patches.arch/arm-exynos-devtree.patch - patches.arch/arm-pl330-fix.patch ++needs_update patches.arch/arm-pl330-fix.patch patches.arch/arm-highbank-cpuidle.patch # Compile fix for Xen on ARM with our Xen patches applied patches.arch/arm-xen-fixup.patch -- 1.8.1.4