Эх сурвалжийг харах

Merge remote-tracking branch 'origin/x86/espfix' into x86/vdso

Merge x86/espfix into x86/vdso, due to changes in the vdso setup code
that otherwise cause conflicts.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
H. Peter Anvin 11 жил өмнө
parent
commit
03c1b4e8e5
100 өөрчлөгдсөн 896 нэмэгдсэн , 400 устгасан
  1. 1 1
      Documentation/devicetree/bindings/clock/at91-clock.txt
  2. 2 2
      Documentation/devicetree/bindings/dma/ti-edma.txt
  3. 10 2
      Documentation/devicetree/bindings/net/arc_emac.txt
  4. 4 1
      Documentation/input/elantech.txt
  5. 4 4
      Documentation/kernel-parameters.txt
  6. 1 1
      Documentation/networking/scaling.txt
  7. 2 0
      Documentation/x86/x86_64/mm.txt
  8. 18 11
      MAINTAINERS
  9. 1 1
      Makefile
  10. 1 1
      arch/arm/boot/dts/am33xx.dtsi
  11. 16 0
      arch/arm/boot/dts/am3517.dtsi
  12. 5 0
      arch/arm/boot/dts/am437x-gp-evm.dts
  13. 1 0
      arch/arm/boot/dts/armada-370-db.dts
  14. 5 0
      arch/arm/boot/dts/armada-375-db.dts
  15. 1 1
      arch/arm/boot/dts/armada-xp-db.dts
  16. 5 5
      arch/arm/boot/dts/armada-xp-gp.dts
  17. 1 1
      arch/arm/boot/dts/armada-xp-openblocks-ax3-4.dts
  18. 2 2
      arch/arm/boot/dts/at91-sama5d3_xplained.dts
  19. 1 1
      arch/arm/boot/dts/at91sam9261.dtsi
  20. 1 1
      arch/arm/boot/dts/at91sam9rl.dtsi
  21. 1 1
      arch/arm/boot/dts/imx53.dtsi
  22. 10 8
      arch/arm/boot/dts/kirkwood-mv88f6281gtw-ge.dts
  23. 10 8
      arch/arm/boot/dts/kirkwood-nsa310-common.dtsi
  24. 0 5
      arch/arm/boot/dts/kirkwood-t5325.dts
  25. 8 11
      arch/arm/boot/dts/omap-gpmc-smsc911x.dtsi
  26. 0 7
      arch/arm/boot/dts/omap2.dtsi
  27. 8 0
      arch/arm/boot/dts/omap2420.dtsi
  28. 7 0
      arch/arm/boot/dts/omap2430.dtsi
  29. 15 51
      arch/arm/boot/dts/omap3-cm-t3x30.dtsi
  30. 1 1
      arch/arm/boot/dts/omap3-igep.dtsi
  31. 2 2
      arch/arm/boot/dts/omap3-igep0020.dts
  32. 10 27
      arch/arm/boot/dts/omap3-sb-t35.dtsi
  33. 13 0
      arch/arm/boot/dts/omap3-sbc-t3517.dts
  34. 1 1
      arch/arm/boot/dts/omap3.dtsi
  35. 7 0
      arch/arm/boot/dts/omap5.dtsi
  36. 1 1
      arch/arm/boot/dts/sama5d3.dtsi
  37. 1 1
      arch/arm/boot/dts/sama5d3_mci2.dtsi
  38. 1 1
      arch/arm/boot/dts/sama5d3_tcb1.dtsi
  39. 1 1
      arch/arm/boot/dts/sama5d3_uart.dtsi
  40. 11 3
      arch/arm/boot/dts/sun7i-a20.dtsi
  41. 15 33
      arch/arm/common/edma.c
  42. 1 1
      arch/arm/configs/sunxi_defconfig
  43. 0 1
      arch/arm/include/asm/xen/page.h
  44. 6 2
      arch/arm/mach-omap2/omap-headsmp.S
  45. 1 1
      arch/arm/mach-orion5x/common.h
  46. 1 0
      arch/arm64/include/asm/memory.h
  47. 46 37
      arch/sparc/include/asm/pgtable_64.h
  48. 2 1
      arch/sparc/include/asm/tsb.h
  49. 2 2
      arch/sparc/kernel/head_64.S
  50. 1 1
      arch/sparc/kernel/ktlb.S
  51. 5 16
      arch/sparc/kernel/nmi.c
  52. 3 3
      arch/sparc/kernel/smp_64.c
  53. 1 1
      arch/sparc/kernel/sys32.S
  54. 9 3
      arch/sparc/kernel/unaligned_64.c
  55. 52 30
      arch/sparc/mm/fault_64.c
  56. 1 1
      arch/sparc/mm/gup.c
  57. 6 6
      arch/sparc/mm/init_64.c
  58. 20 6
      arch/sparc/mm/tlb.c
  59. 21 4
      arch/x86/Kconfig
  60. 1 0
      arch/x86/Makefile
  61. 2 2
      arch/x86/boot/Makefile
  62. 1 1
      arch/x86/boot/compressed/misc.c
  63. 16 0
      arch/x86/include/asm/espfix.h
  64. 1 0
      arch/x86/include/asm/hpet.h
  65. 1 0
      arch/x86/include/asm/hugetlb.h
  66. 2 0
      arch/x86/include/asm/pgtable_64_types.h
  67. 2 0
      arch/x86/include/asm/setup.h
  68. 1 1
      arch/x86/include/uapi/asm/msr-index.h
  69. 1 0
      arch/x86/kernel/Makefile
  70. 1 1
      arch/x86/kernel/acpi/sleep.c
  71. 1 1
      arch/x86/kernel/apic/io_apic.c
  72. 2 2
      arch/x86/kernel/cpu/mcheck/therm_throt.c
  73. 2 2
      arch/x86/kernel/cpu/mcheck/threshold.c
  74. 1 0
      arch/x86/kernel/cpu/rdrand.c
  75. 16 0
      arch/x86/kernel/early-quirks.c
  76. 12 5
      arch/x86/kernel/entry_32.S
  77. 77 4
      arch/x86/kernel/entry_64.S
  78. 209 0
      arch/x86/kernel/espfix_64.c
  79. 1 1
      arch/x86/kernel/head32.c
  80. 1 1
      arch/x86/kernel/head64.c
  81. 1 1
      arch/x86/kernel/hpet.c
  82. 1 7
      arch/x86/kernel/ldt.c
  83. 1 1
      arch/x86/kernel/process_64.c
  84. 10 0
      arch/x86/kernel/reboot.c
  85. 1 1
      arch/x86/kernel/smp.c
  86. 7 0
      arch/x86/kernel/smpboot.c
  87. 3 3
      arch/x86/kernel/traps.c
  88. 3 3
      arch/x86/kernel/vsmp_64.c
  89. 1 1
      arch/x86/kernel/vsyscall_gtod.c
  90. 1 1
      arch/x86/kvm/x86.c
  91. 2 2
      arch/x86/lguest/boot.c
  92. 1 1
      arch/x86/lib/msr.c
  93. 8 8
      arch/x86/math-emu/errors.c
  94. 33 11
      arch/x86/mm/dump_pagetables.c
  95. 64 19
      arch/x86/platform/efi/early_printk.c
  96. 1 1
      arch/x86/platform/olpc/olpc-xo1-pm.c
  97. 1 1
      arch/x86/power/hibernate_64.c
  98. 1 1
      arch/x86/xen/enlighten.c
  99. 3 3
      arch/x86/xen/irq.c
  100. 19 1
      arch/xtensa/Kconfig

+ 1 - 1
Documentation/devicetree/bindings/clock/at91-clock.txt

@@ -62,7 +62,7 @@ Required properties for PMC node:
 - interrupt-controller : tell that the PMC is an interrupt controller.
 - interrupt-controller : tell that the PMC is an interrupt controller.
 - #interrupt-cells : must be set to 1. The first cell encodes the interrupt id,
 - #interrupt-cells : must be set to 1. The first cell encodes the interrupt id,
 	and reflect the bit position in the PMC_ER/DR/SR registers.
 	and reflect the bit position in the PMC_ER/DR/SR registers.
-	You can use the dt macros defined in dt-bindings/clk/at91.h.
+	You can use the dt macros defined in dt-bindings/clock/at91.h.
 	0 (AT91_PMC_MOSCS) -> main oscillator ready
 	0 (AT91_PMC_MOSCS) -> main oscillator ready
 	1 (AT91_PMC_LOCKA) -> PLL A ready
 	1 (AT91_PMC_LOCKA) -> PLL A ready
 	2 (AT91_PMC_LOCKB) -> PLL B ready
 	2 (AT91_PMC_LOCKB) -> PLL B ready

+ 2 - 2
Documentation/devicetree/bindings/dma/ti-edma.txt

@@ -29,6 +29,6 @@ edma: edma@49000000 {
 	dma-channels = <64>;
 	dma-channels = <64>;
 	ti,edma-regions = <4>;
 	ti,edma-regions = <4>;
 	ti,edma-slots = <256>;
 	ti,edma-slots = <256>;
-	ti,edma-xbar-event-map = <1 12
-				  2 13>;
+	ti,edma-xbar-event-map = /bits/ 16 <1 12
+					    2 13>;
 };
 };

+ 10 - 2
Documentation/devicetree/bindings/net/arc_emac.txt

@@ -4,11 +4,15 @@ Required properties:
 - compatible: Should be "snps,arc-emac"
 - compatible: Should be "snps,arc-emac"
 - reg: Address and length of the register set for the device
 - reg: Address and length of the register set for the device
 - interrupts: Should contain the EMAC interrupts
 - interrupts: Should contain the EMAC interrupts
-- clock-frequency: CPU frequency. It is needed to calculate and set polling
-period of EMAC.
 - max-speed: see ethernet.txt file in the same directory.
 - max-speed: see ethernet.txt file in the same directory.
 - phy: see ethernet.txt file in the same directory.
 - phy: see ethernet.txt file in the same directory.
 
 
+Clock handling:
+The clock frequency is needed to calculate and set polling period of EMAC.
+It must be provided by one of:
+- clock-frequency: CPU frequency.
+- clocks: reference to the clock supplying the EMAC.
+
 Child nodes of the driver are the individual PHY devices connected to the
 Child nodes of the driver are the individual PHY devices connected to the
 MDIO bus. They must have a "reg" property given the PHY address on the MDIO bus.
 MDIO bus. They must have a "reg" property given the PHY address on the MDIO bus.
 
 
@@ -19,7 +23,11 @@ Examples:
 		reg = <0xc0fc2000 0x3c>;
 		reg = <0xc0fc2000 0x3c>;
 		interrupts = <6>;
 		interrupts = <6>;
 		mac-address = [ 00 11 22 33 44 55 ];
 		mac-address = [ 00 11 22 33 44 55 ];
+
 		clock-frequency = <80000000>;
 		clock-frequency = <80000000>;
+		/* or */
+		clocks = <&emac_clock>;
+
 		max-speed = <100>;
 		max-speed = <100>;
 		phy = <&phy0>;
 		phy = <&phy0>;
 
 

+ 4 - 1
Documentation/input/elantech.txt

@@ -504,9 +504,12 @@ byte 5:
 * reg_10
 * reg_10
 
 
    bit   7   6   5   4   3   2   1   0
    bit   7   6   5   4   3   2   1   0
-         0   0   0   0   0   0   0   A
+         0   0   0   0   R   F   T   A
 
 
          A: 1 = enable absolute tracking
          A: 1 = enable absolute tracking
+         T: 1 = enable two finger mode auto correct
+         F: 1 = disable ABS Position Filter
+         R: 1 = enable real hardware resolution
 
 
 6.2 Native absolute mode 6 byte packet format
 6.2 Native absolute mode 6 byte packet format
     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

+ 4 - 4
Documentation/kernel-parameters.txt

@@ -2218,10 +2218,10 @@ bytes respectively. Such letter suffixes can also be entirely omitted.
 	noreplace-smp	[X86-32,SMP] Don't replace SMP instructions
 	noreplace-smp	[X86-32,SMP] Don't replace SMP instructions
 			with UP alternatives
 			with UP alternatives
 
 
-	nordrand	[X86] Disable the direct use of the RDRAND
-			instruction even if it is supported by the
-			processor.  RDRAND is still available to user
-			space applications.
+	nordrand	[X86] Disable kernel use of the RDRAND and
+			RDSEED instructions even if they are supported
+			by the processor.  RDRAND and RDSEED are still
+			available to user space applications.
 
 
 	noresume	[SWSUSP] Disables resume and restores original swap
 	noresume	[SWSUSP] Disables resume and restores original swap
 			space.
 			space.

+ 1 - 1
Documentation/networking/scaling.txt

@@ -429,7 +429,7 @@ RPS and RFS were introduced in kernel 2.6.35. XPS was incorporated into
 (therbert@google.com)
 (therbert@google.com)
 
 
 Accelerated RFS was introduced in 2.6.35. Original patches were
 Accelerated RFS was introduced in 2.6.35. Original patches were
-submitted by Ben Hutchings (bhutchings@solarflare.com)
+submitted by Ben Hutchings (bwh@kernel.org)
 
 
 Authors:
 Authors:
 Tom Herbert (therbert@google.com)
 Tom Herbert (therbert@google.com)

+ 2 - 0
Documentation/x86/x86_64/mm.txt

@@ -12,6 +12,8 @@ ffffc90000000000 - ffffe8ffffffffff (=45 bits) vmalloc/ioremap space
 ffffe90000000000 - ffffe9ffffffffff (=40 bits) hole
 ffffe90000000000 - ffffe9ffffffffff (=40 bits) hole
 ffffea0000000000 - ffffeaffffffffff (=40 bits) virtual memory map (1TB)
 ffffea0000000000 - ffffeaffffffffff (=40 bits) virtual memory map (1TB)
 ... unused hole ...
 ... unused hole ...
+ffffff0000000000 - ffffff7fffffffff (=39 bits) %esp fixup stacks
+... unused hole ...
 ffffffff80000000 - ffffffffa0000000 (=512 MB)  kernel text mapping, from phys 0
 ffffffff80000000 - ffffffffa0000000 (=512 MB)  kernel text mapping, from phys 0
 ffffffffa0000000 - ffffffffff5fffff (=1525 MB) module mapping space
 ffffffffa0000000 - ffffffffff5fffff (=1525 MB) module mapping space
 ffffffffff600000 - ffffffffffdfffff (=8 MB) vsyscalls
 ffffffffff600000 - ffffffffffdfffff (=8 MB) vsyscalls

+ 18 - 11
MAINTAINERS

@@ -1893,14 +1893,15 @@ L:	netdev@vger.kernel.org
 S:	Supported
 S:	Supported
 F:	drivers/net/ethernet/broadcom/bnx2x/
 F:	drivers/net/ethernet/broadcom/bnx2x/
 
 
-BROADCOM BCM281XX/BCM11XXX ARM ARCHITECTURE
+BROADCOM BCM281XX/BCM11XXX/BCM216XX ARM ARCHITECTURE
 M:	Christian Daudt <bcm@fixthebug.org>
 M:	Christian Daudt <bcm@fixthebug.org>
 M:	Matt Porter <mporter@linaro.org>
 M:	Matt Porter <mporter@linaro.org>
 L:	bcm-kernel-feedback-list@broadcom.com
 L:	bcm-kernel-feedback-list@broadcom.com
-T:	git git://git.github.com/broadcom/bcm11351
+T:	git git://github.com/broadcom/mach-bcm
 S:	Maintained
 S:	Maintained
 F:	arch/arm/mach-bcm/
 F:	arch/arm/mach-bcm/
 F:	arch/arm/boot/dts/bcm113*
 F:	arch/arm/boot/dts/bcm113*
+F:	arch/arm/boot/dts/bcm216*
 F:	arch/arm/boot/dts/bcm281*
 F:	arch/arm/boot/dts/bcm281*
 F:	arch/arm/configs/bcm_defconfig
 F:	arch/arm/configs/bcm_defconfig
 F:	drivers/mmc/host/sdhci_bcm_kona.c
 F:	drivers/mmc/host/sdhci_bcm_kona.c
@@ -4818,6 +4819,14 @@ L:	linux-kernel@vger.kernel.org
 S:	Maintained
 S:	Maintained
 T:	git git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git irq/core
 T:	git git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git irq/core
 F:	kernel/irq/
 F:	kernel/irq/
+
+IRQCHIP DRIVERS
+M:	Thomas Gleixner <tglx@linutronix.de>
+M:	Jason Cooper <jason@lakedaemon.net>
+L:	linux-kernel@vger.kernel.org
+S:	Maintained
+T:	git git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git irq/core
+T:	git git://git.infradead.org/users/jcooper/linux.git irqchip/core
 F:	drivers/irqchip/
 F:	drivers/irqchip/
 
 
 IRQ DOMAINS (IRQ NUMBER MAPPING LIBRARY)
 IRQ DOMAINS (IRQ NUMBER MAPPING LIBRARY)
@@ -5490,15 +5499,15 @@ F:	Documentation/hwmon/ltc4261
 F:	drivers/hwmon/ltc4261.c
 F:	drivers/hwmon/ltc4261.c
 
 
 LTP (Linux Test Project)
 LTP (Linux Test Project)
-M:	Shubham Goyal <shubham@linux.vnet.ibm.com>
 M:	Mike Frysinger <vapier@gentoo.org>
 M:	Mike Frysinger <vapier@gentoo.org>
 M:	Cyril Hrubis <chrubis@suse.cz>
 M:	Cyril Hrubis <chrubis@suse.cz>
-M:	Caspar Zhang <caspar@casparzhang.com>
 M:	Wanlong Gao <gaowanlong@cn.fujitsu.com>
 M:	Wanlong Gao <gaowanlong@cn.fujitsu.com>
+M:	Jan Stancek <jstancek@redhat.com>
+M:	Stanislav Kholmanskikh <stanislav.kholmanskikh@oracle.com>
+M:	Alexey Kodanev <alexey.kodanev@oracle.com>
 L:	ltp-list@lists.sourceforge.net (subscribers-only)
 L:	ltp-list@lists.sourceforge.net (subscribers-only)
-W:	http://ltp.sourceforge.net/
+W:	http://linux-test-project.github.io/
 T:	git git://github.com/linux-test-project/ltp.git
 T:	git git://github.com/linux-test-project/ltp.git
-T:	git git://ltp.git.sourceforge.net/gitroot/ltp/ltp-dev
 S:	Maintained
 S:	Maintained
 
 
 M32R ARCHITECTURE
 M32R ARCHITECTURE
@@ -7288,7 +7297,6 @@ F:	drivers/video/aty/aty128fb.c
 RALINK RT2X00 WIRELESS LAN DRIVER
 RALINK RT2X00 WIRELESS LAN DRIVER
 P:	rt2x00 project
 P:	rt2x00 project
 M:	Ivo van Doorn <IvDoorn@gmail.com>
 M:	Ivo van Doorn <IvDoorn@gmail.com>
-M:	Gertjan van Wingerde <gwingerde@gmail.com>
 M:	Helmut Schaa <helmut.schaa@googlemail.com>
 M:	Helmut Schaa <helmut.schaa@googlemail.com>
 L:	linux-wireless@vger.kernel.org
 L:	linux-wireless@vger.kernel.org
 L:	users@rt2x00.serialmonkey.com (moderated for non-subscribers)
 L:	users@rt2x00.serialmonkey.com (moderated for non-subscribers)
@@ -7304,7 +7312,7 @@ F:	Documentation/blockdev/ramdisk.txt
 F:	drivers/block/brd.c
 F:	drivers/block/brd.c
 
 
 RANDOM NUMBER DRIVER
 RANDOM NUMBER DRIVER
-M:	Theodore Ts'o" <tytso@mit.edu>
+M:	"Theodore Ts'o" <tytso@mit.edu>
 S:	Maintained
 S:	Maintained
 F:	drivers/char/random.c
 F:	drivers/char/random.c
 
 
@@ -7685,7 +7693,6 @@ F:	drivers/clk/samsung/
 SAMSUNG SXGBE DRIVERS
 SAMSUNG SXGBE DRIVERS
 M:	Byungho An <bh74.an@samsung.com>
 M:	Byungho An <bh74.an@samsung.com>
 M:	Girish K S <ks.giri@samsung.com>
 M:	Girish K S <ks.giri@samsung.com>
-M:	Siva Reddy Kallam <siva.kallam@samsung.com>
 M:	Vipul Pandya <vipul.pandya@samsung.com>
 M:	Vipul Pandya <vipul.pandya@samsung.com>
 S:	Supported
 S:	Supported
 L:	netdev@vger.kernel.org
 L:	netdev@vger.kernel.org
@@ -9962,7 +9969,7 @@ F:	drivers/net/hamradio/*scc.c
 F:	drivers/net/hamradio/z8530.h
 F:	drivers/net/hamradio/z8530.h
 
 
 ZBUD COMPRESSED PAGE ALLOCATOR
 ZBUD COMPRESSED PAGE ALLOCATOR
-M:	Seth Jennings <sjenning@linux.vnet.ibm.com>
+M:	Seth Jennings <sjennings@variantweb.net>
 L:	linux-mm@kvack.org
 L:	linux-mm@kvack.org
 S:	Maintained
 S:	Maintained
 F:	mm/zbud.c
 F:	mm/zbud.c
@@ -10007,7 +10014,7 @@ F:	mm/zsmalloc.c
 F:	include/linux/zsmalloc.h
 F:	include/linux/zsmalloc.h
 
 
 ZSWAP COMPRESSED SWAP CACHING
 ZSWAP COMPRESSED SWAP CACHING
-M:	Seth Jennings <sjenning@linux.vnet.ibm.com>
+M:	Seth Jennings <sjennings@variantweb.net>
 L:	linux-mm@kvack.org
 L:	linux-mm@kvack.org
 S:	Maintained
 S:	Maintained
 F:	mm/zswap.c
 F:	mm/zswap.c

+ 1 - 1
Makefile

@@ -1,7 +1,7 @@
 VERSION = 3
 VERSION = 3
 PATCHLEVEL = 15
 PATCHLEVEL = 15
 SUBLEVEL = 0
 SUBLEVEL = 0
-EXTRAVERSION = -rc4
+EXTRAVERSION = -rc5
 NAME = Shuffling Zombie Juror
 NAME = Shuffling Zombie Juror
 
 
 # *DOCUMENTATION*
 # *DOCUMENTATION*

+ 1 - 1
arch/arm/boot/dts/am33xx.dtsi

@@ -144,7 +144,7 @@
 			compatible = "ti,edma3";
 			compatible = "ti,edma3";
 			ti,hwmods = "tpcc", "tptc0", "tptc1", "tptc2";
 			ti,hwmods = "tpcc", "tptc0", "tptc1", "tptc2";
 			reg =	<0x49000000 0x10000>,
 			reg =	<0x49000000 0x10000>,
-				<0x44e10f90 0x10>;
+				<0x44e10f90 0x40>;
 			interrupts = <12 13 14>;
 			interrupts = <12 13 14>;
 			#dma-cells = <1>;
 			#dma-cells = <1>;
 			dma-channels = <64>;
 			dma-channels = <64>;

+ 16 - 0
arch/arm/boot/dts/am3517.dtsi

@@ -62,5 +62,21 @@
 	};
 	};
 };
 };
 
 
+&iva {
+	status = "disabled";
+};
+
+&mailbox {
+	status = "disabled";
+};
+
+&mmu_isp {
+	status = "disabled";
+};
+
+&smartreflex_mpu_iva {
+	status = "disabled";
+};
+
 /include/ "am35xx-clocks.dtsi"
 /include/ "am35xx-clocks.dtsi"
 /include/ "omap36xx-am35xx-omap3430es2plus-clocks.dtsi"
 /include/ "omap36xx-am35xx-omap3430es2plus-clocks.dtsi"

+ 5 - 0
arch/arm/boot/dts/am437x-gp-evm.dts

@@ -117,6 +117,11 @@
 	status = "okay";
 	status = "okay";
 };
 };
 
 
+&gpio5 {
+	status = "okay";
+	ti,no-reset-on-init;
+};
+
 &mmc1 {
 &mmc1 {
 	status = "okay";
 	status = "okay";
 	vmmc-supply = <&vmmcsd_fixed>;
 	vmmc-supply = <&vmmcsd_fixed>;

+ 1 - 0
arch/arm/boot/dts/armada-370-db.dts

@@ -67,6 +67,7 @@
 			i2c@11000 {
 			i2c@11000 {
 				pinctrl-0 = <&i2c0_pins>;
 				pinctrl-0 = <&i2c0_pins>;
 				pinctrl-names = "default";
 				pinctrl-names = "default";
+				clock-frequency = <100000>;
 				status = "okay";
 				status = "okay";
 				audio_codec: audio-codec@4a {
 				audio_codec: audio-codec@4a {
 					compatible = "cirrus,cs42l51";
 					compatible = "cirrus,cs42l51";

+ 5 - 0
arch/arm/boot/dts/armada-375-db.dts

@@ -79,6 +79,11 @@
 				};
 				};
 			};
 			};
 
 
+			sata@a0000 {
+				status = "okay";
+				nr-ports = <2>;
+			};
+
 			nand: nand@d0000 {
 			nand: nand@d0000 {
 				pinctrl-0 = <&nand_pins>;
 				pinctrl-0 = <&nand_pins>;
 				pinctrl-names = "default";
 				pinctrl-names = "default";

+ 1 - 1
arch/arm/boot/dts/armada-xp-db.dts

@@ -49,7 +49,7 @@
 			/* Device Bus parameters are required */
 			/* Device Bus parameters are required */
 
 
 			/* Read parameters */
 			/* Read parameters */
-			devbus,bus-width    = <8>;
+			devbus,bus-width    = <16>;
 			devbus,turn-off-ps  = <60000>;
 			devbus,turn-off-ps  = <60000>;
 			devbus,badr-skew-ps = <0>;
 			devbus,badr-skew-ps = <0>;
 			devbus,acc-first-ps = <124000>;
 			devbus,acc-first-ps = <124000>;

+ 5 - 5
arch/arm/boot/dts/armada-xp-gp.dts

@@ -59,7 +59,7 @@
 			/* Device Bus parameters are required */
 			/* Device Bus parameters are required */
 
 
 			/* Read parameters */
 			/* Read parameters */
-			devbus,bus-width    = <8>;
+			devbus,bus-width    = <16>;
 			devbus,turn-off-ps  = <60000>;
 			devbus,turn-off-ps  = <60000>;
 			devbus,badr-skew-ps = <0>;
 			devbus,badr-skew-ps = <0>;
 			devbus,acc-first-ps = <124000>;
 			devbus,acc-first-ps = <124000>;
@@ -146,22 +146,22 @@
 			ethernet@70000 {
 			ethernet@70000 {
 				status = "okay";
 				status = "okay";
 				phy = <&phy0>;
 				phy = <&phy0>;
-				phy-mode = "rgmii-id";
+				phy-mode = "qsgmii";
 			};
 			};
 			ethernet@74000 {
 			ethernet@74000 {
 				status = "okay";
 				status = "okay";
 				phy = <&phy1>;
 				phy = <&phy1>;
-				phy-mode = "rgmii-id";
+				phy-mode = "qsgmii";
 			};
 			};
 			ethernet@30000 {
 			ethernet@30000 {
 				status = "okay";
 				status = "okay";
 				phy = <&phy2>;
 				phy = <&phy2>;
-				phy-mode = "rgmii-id";
+				phy-mode = "qsgmii";
 			};
 			};
 			ethernet@34000 {
 			ethernet@34000 {
 				status = "okay";
 				status = "okay";
 				phy = <&phy3>;
 				phy = <&phy3>;
-				phy-mode = "rgmii-id";
+				phy-mode = "qsgmii";
 			};
 			};
 
 
 			/* Front-side USB slot */
 			/* Front-side USB slot */

+ 1 - 1
arch/arm/boot/dts/armada-xp-openblocks-ax3-4.dts

@@ -39,7 +39,7 @@
 			/* Device Bus parameters are required */
 			/* Device Bus parameters are required */
 
 
 			/* Read parameters */
 			/* Read parameters */
-			devbus,bus-width    = <8>;
+			devbus,bus-width    = <16>;
 			devbus,turn-off-ps  = <60000>;
 			devbus,turn-off-ps  = <60000>;
 			devbus,badr-skew-ps = <0>;
 			devbus,badr-skew-ps = <0>;
 			devbus,acc-first-ps = <124000>;
 			devbus,acc-first-ps = <124000>;

+ 2 - 2
arch/arm/boot/dts/at91-sama5d3_xplained.dts

@@ -34,7 +34,7 @@
 			};
 			};
 
 
 			spi0: spi@f0004000 {
 			spi0: spi@f0004000 {
-				cs-gpios = <&pioD 13 0>;
+				cs-gpios = <&pioD 13 0>, <0>, <0>, <&pioD 16 0>;
 				status = "okay";
 				status = "okay";
 			};
 			};
 
 
@@ -79,7 +79,7 @@
 			};
 			};
 
 
 			spi1: spi@f8008000 {
 			spi1: spi@f8008000 {
-				cs-gpios = <&pioC 25 0>, <0>, <0>, <&pioD 16 0>;
+				cs-gpios = <&pioC 25 0>;
 				status = "okay";
 				status = "okay";
 			};
 			};
 
 

+ 1 - 1
arch/arm/boot/dts/at91sam9261.dtsi

@@ -10,7 +10,7 @@
 #include <dt-bindings/pinctrl/at91.h>
 #include <dt-bindings/pinctrl/at91.h>
 #include <dt-bindings/interrupt-controller/irq.h>
 #include <dt-bindings/interrupt-controller/irq.h>
 #include <dt-bindings/gpio/gpio.h>
 #include <dt-bindings/gpio/gpio.h>
-#include <dt-bindings/clk/at91.h>
+#include <dt-bindings/clock/at91.h>
 
 
 / {
 / {
 	model = "Atmel AT91SAM9261 family SoC";
 	model = "Atmel AT91SAM9261 family SoC";

+ 1 - 1
arch/arm/boot/dts/at91sam9rl.dtsi

@@ -8,7 +8,7 @@
 
 
 #include "skeleton.dtsi"
 #include "skeleton.dtsi"
 #include <dt-bindings/pinctrl/at91.h>
 #include <dt-bindings/pinctrl/at91.h>
-#include <dt-bindings/clk/at91.h>
+#include <dt-bindings/clock/at91.h>
 #include <dt-bindings/interrupt-controller/irq.h>
 #include <dt-bindings/interrupt-controller/irq.h>
 #include <dt-bindings/gpio/gpio.h>
 #include <dt-bindings/gpio/gpio.h>
 
 

+ 1 - 1
arch/arm/boot/dts/imx53.dtsi

@@ -115,7 +115,7 @@
 			#address-cells = <1>;
 			#address-cells = <1>;
 			#size-cells = <0>;
 			#size-cells = <0>;
 			compatible = "fsl,imx53-ipu";
 			compatible = "fsl,imx53-ipu";
-			reg = <0x18000000 0x080000000>;
+			reg = <0x18000000 0x08000000>;
 			interrupts = <11 10>;
 			interrupts = <11 10>;
 			clocks = <&clks IMX5_CLK_IPU_GATE>,
 			clocks = <&clks IMX5_CLK_IPU_GATE>,
 			         <&clks IMX5_CLK_IPU_DI0_GATE>,
 			         <&clks IMX5_CLK_IPU_DI0_GATE>,

+ 10 - 8
arch/arm/boot/dts/kirkwood-mv88f6281gtw-ge.dts

@@ -30,6 +30,16 @@
 		bootargs = "console=ttyS0,115200n8 earlyprintk";
 		bootargs = "console=ttyS0,115200n8 earlyprintk";
 	};
 	};
 
 
+	mbus {
+		pcie-controller {
+			status = "okay";
+
+			pcie@1,0 {
+				status = "okay";
+			};
+		};
+        };
+
 	ocp@f1000000 {
 	ocp@f1000000 {
 		pinctrl@10000 {
 		pinctrl@10000 {
 			pmx_usb_led: pmx-usb-led {
 			pmx_usb_led: pmx-usb-led {
@@ -73,14 +83,6 @@
 		ehci@50000 {
 		ehci@50000 {
 			status = "okay";
 			status = "okay";
 		};
 		};
-
-		pcie-controller {
-			status = "okay";
-
-			pcie@1,0 {
-				status = "okay";
-			};
-		};
 	};
 	};
 
 
 	gpio-leds {
 	gpio-leds {

+ 10 - 8
arch/arm/boot/dts/kirkwood-nsa310-common.dtsi

@@ -4,6 +4,16 @@
 / {
 / {
 	model = "ZyXEL NSA310";
 	model = "ZyXEL NSA310";
 
 
+	mbus {
+		pcie-controller {
+			status = "okay";
+
+			pcie@1,0 {
+				status = "okay";
+			};
+		};
+	};
+
 	ocp@f1000000 {
 	ocp@f1000000 {
 		pinctrl: pinctrl@10000 {
 		pinctrl: pinctrl@10000 {
 
 
@@ -26,14 +36,6 @@
 			status = "okay";
 			status = "okay";
 			nr-ports = <2>;
 			nr-ports = <2>;
 		};
 		};
-
-		pcie-controller {
-			status = "okay";
-
-			pcie@1,0 {
-				status = "okay";
-			};
-		};
 	};
 	};
 
 
 	gpio_poweroff {
 	gpio_poweroff {

+ 0 - 5
arch/arm/boot/dts/kirkwood-t5325.dts

@@ -127,11 +127,6 @@
 
 
 		i2c@11000 {
 		i2c@11000 {
 			status = "okay";
 			status = "okay";
-
-			alc5621: alc5621@1a {
-				compatible = "realtek,alc5621";
-				reg = <0x1a>;
-			};
 		};
 		};
 
 
 		serial@12000 {
 		serial@12000 {

+ 8 - 11
arch/arm/boot/dts/omap-gpmc-smsc911x.dtsi

@@ -24,11 +24,10 @@
 		compatible = "smsc,lan9221", "smsc,lan9115";
 		compatible = "smsc,lan9221", "smsc,lan9115";
 		bank-width = <2>;
 		bank-width = <2>;
 		gpmc,mux-add-data;
 		gpmc,mux-add-data;
-		gpmc,cs-on-ns = <0>;
-		gpmc,cs-rd-off-ns = <186>;
-		gpmc,cs-wr-off-ns = <186>;
-		gpmc,adv-on-ns = <12>;
-		gpmc,adv-rd-off-ns = <48>;
+		gpmc,cs-on-ns = <1>;
+		gpmc,cs-rd-off-ns = <180>;
+		gpmc,cs-wr-off-ns = <180>;
+		gpmc,adv-rd-off-ns = <18>;
 		gpmc,adv-wr-off-ns = <48>;
 		gpmc,adv-wr-off-ns = <48>;
 		gpmc,oe-on-ns = <54>;
 		gpmc,oe-on-ns = <54>;
 		gpmc,oe-off-ns = <168>;
 		gpmc,oe-off-ns = <168>;
@@ -36,12 +35,10 @@
 		gpmc,we-off-ns = <168>;
 		gpmc,we-off-ns = <168>;
 		gpmc,rd-cycle-ns = <186>;
 		gpmc,rd-cycle-ns = <186>;
 		gpmc,wr-cycle-ns = <186>;
 		gpmc,wr-cycle-ns = <186>;
-		gpmc,access-ns = <114>;
-		gpmc,page-burst-access-ns = <6>;
-		gpmc,bus-turnaround-ns = <12>;
-		gpmc,cycle2cycle-delay-ns = <18>;
-		gpmc,wr-data-mux-bus-ns = <90>;
-		gpmc,wr-access-ns = <186>;
+		gpmc,access-ns = <144>;
+		gpmc,page-burst-access-ns = <24>;
+		gpmc,bus-turnaround-ns = <90>;
+		gpmc,cycle2cycle-delay-ns = <90>;
 		gpmc,cycle2cycle-samecsen;
 		gpmc,cycle2cycle-samecsen;
 		gpmc,cycle2cycle-diffcsen;
 		gpmc,cycle2cycle-diffcsen;
 		vddvario-supply = <&vddvario>;
 		vddvario-supply = <&vddvario>;

+ 0 - 7
arch/arm/boot/dts/omap2.dtsi

@@ -71,13 +71,6 @@
 			interrupts = <58>;
 			interrupts = <58>;
 		};
 		};
 
 
-		mailbox: mailbox@48094000 {
-			compatible = "ti,omap2-mailbox";
-			ti,hwmods = "mailbox";
-			reg = <0x48094000 0x200>;
-			interrupts = <26>;
-		};
-
 		intc: interrupt-controller@1 {
 		intc: interrupt-controller@1 {
 			compatible = "ti,omap2-intc";
 			compatible = "ti,omap2-intc";
 			interrupt-controller;
 			interrupt-controller;

+ 8 - 0
arch/arm/boot/dts/omap2420.dtsi

@@ -125,6 +125,14 @@
 			dma-names = "tx", "rx";
 			dma-names = "tx", "rx";
 		};
 		};
 
 
+		mailbox: mailbox@48094000 {
+			compatible = "ti,omap2-mailbox";
+			reg = <0x48094000 0x200>;
+			interrupts = <26>, <34>;
+			interrupt-names = "dsp", "iva";
+			ti,hwmods = "mailbox";
+		};
+
 		timer1: timer@48028000 {
 		timer1: timer@48028000 {
 			compatible = "ti,omap2420-timer";
 			compatible = "ti,omap2420-timer";
 			reg = <0x48028000 0x400>;
 			reg = <0x48028000 0x400>;

+ 7 - 0
arch/arm/boot/dts/omap2430.dtsi

@@ -216,6 +216,13 @@
 			dma-names = "tx", "rx";
 			dma-names = "tx", "rx";
 		};
 		};
 
 
+		mailbox: mailbox@48094000 {
+			compatible = "ti,omap2-mailbox";
+			reg = <0x48094000 0x200>;
+			interrupts = <26>;
+			ti,hwmods = "mailbox";
+		};
+
 		timer1: timer@49018000 {
 		timer1: timer@49018000 {
 			compatible = "ti,omap2420-timer";
 			compatible = "ti,omap2420-timer";
 			reg = <0x49018000 0x400>;
 			reg = <0x49018000 0x400>;

+ 15 - 51
arch/arm/boot/dts/omap3-cm-t3x30.dtsi

@@ -10,18 +10,6 @@
 			cpu0-supply = <&vcc>;
 			cpu0-supply = <&vcc>;
 		};
 		};
 	};
 	};
-
-	vddvario: regulator-vddvario {
-		compatible = "regulator-fixed";
-		regulator-name = "vddvario";
-		regulator-always-on;
-	};
-
-	vdd33a: regulator-vdd33a {
-		compatible = "regulator-fixed";
-		regulator-name = "vdd33a";
-		regulator-always-on;
-	};
 };
 };
 
 
 &omap3_pmx_core {
 &omap3_pmx_core {
@@ -35,58 +23,34 @@
 
 
  	hsusb0_pins: pinmux_hsusb0_pins {
  	hsusb0_pins: pinmux_hsusb0_pins {
 		pinctrl-single,pins = <
 		pinctrl-single,pins = <
-			OMAP3_CORE1_IOPAD(0x21a0, PIN_OUTPUT | MUX_MODE0)		/* hsusb0_clk.hsusb0_clk */
-			OMAP3_CORE1_IOPAD(0x21a2, PIN_OUTPUT | MUX_MODE0)		/* hsusb0_stp.hsusb0_stp */
-			OMAP3_CORE1_IOPAD(0x21a4, PIN_INPUT_PULLDOWN | MUX_MODE0)	/* hsusb0_dir.hsusb0_dir */
-			OMAP3_CORE1_IOPAD(0x21a6, PIN_INPUT_PULLDOWN | MUX_MODE0)	/* hsusb0_nxt.hsusb0_nxt */
-			OMAP3_CORE1_IOPAD(0x21a8, PIN_INPUT_PULLDOWN | MUX_MODE0)	/* hsusb0_data0.hsusb2_data0 */
-			OMAP3_CORE1_IOPAD(0x21aa, PIN_INPUT_PULLDOWN | MUX_MODE0)	/* hsusb0_data1.hsusb0_data1 */
-			OMAP3_CORE1_IOPAD(0x21ac, PIN_INPUT_PULLDOWN | MUX_MODE0)	/* hsusb0_data2.hsusb0_data2 */
-			OMAP3_CORE1_IOPAD(0x21ae, PIN_INPUT_PULLDOWN | MUX_MODE0)	/* hsusb0_data7.hsusb0_data3 */
-			OMAP3_CORE1_IOPAD(0x21b0, PIN_INPUT_PULLDOWN | MUX_MODE0)	/* hsusb0_data7.hsusb0_data4 */
-			OMAP3_CORE1_IOPAD(0x21b2, PIN_INPUT_PULLDOWN | MUX_MODE0)	/* hsusb0_data7.hsusb0_data5 */
-			OMAP3_CORE1_IOPAD(0x21b4, PIN_INPUT_PULLDOWN | MUX_MODE0)	/* hsusb0_data7.hsusb0_data6 */
-			OMAP3_CORE1_IOPAD(0x21b6, PIN_INPUT_PULLDOWN | MUX_MODE0)	/* hsusb0_data7.hsusb0_data7 */
+			OMAP3_CORE1_IOPAD(0x21a2, PIN_OUTPUT | MUX_MODE0)		/* hsusb0_clk.hsusb0_clk */
+			OMAP3_CORE1_IOPAD(0x21a4, PIN_OUTPUT | MUX_MODE0)		/* hsusb0_stp.hsusb0_stp */
+			OMAP3_CORE1_IOPAD(0x21a6, PIN_INPUT_PULLDOWN | MUX_MODE0)	/* hsusb0_dir.hsusb0_dir */
+			OMAP3_CORE1_IOPAD(0x21a8, PIN_INPUT_PULLDOWN | MUX_MODE0)	/* hsusb0_nxt.hsusb0_nxt */
+			OMAP3_CORE1_IOPAD(0x21aa, PIN_INPUT_PULLDOWN | MUX_MODE0)	/* hsusb0_data0.hsusb2_data0 */
+			OMAP3_CORE1_IOPAD(0x21ac, PIN_INPUT_PULLDOWN | MUX_MODE0)	/* hsusb0_data1.hsusb0_data1 */
+			OMAP3_CORE1_IOPAD(0x21ae, PIN_INPUT_PULLDOWN | MUX_MODE0)	/* hsusb0_data2.hsusb0_data2 */
+			OMAP3_CORE1_IOPAD(0x21b0, PIN_INPUT_PULLDOWN | MUX_MODE0)	/* hsusb0_data7.hsusb0_data3 */
+			OMAP3_CORE1_IOPAD(0x21b2, PIN_INPUT_PULLDOWN | MUX_MODE0)	/* hsusb0_data7.hsusb0_data4 */
+			OMAP3_CORE1_IOPAD(0x21b4, PIN_INPUT_PULLDOWN | MUX_MODE0)	/* hsusb0_data7.hsusb0_data5 */
+			OMAP3_CORE1_IOPAD(0x21b6, PIN_INPUT_PULLDOWN | MUX_MODE0)	/* hsusb0_data7.hsusb0_data6 */
+			OMAP3_CORE1_IOPAD(0x21b8, PIN_INPUT_PULLDOWN | MUX_MODE0)	/* hsusb0_data7.hsusb0_data7 */
 		>;
 		>;
 	};
 	};
 };
 };
 
 
+#include "omap-gpmc-smsc911x.dtsi"
+
 &gpmc {
 &gpmc {
 	ranges = <5 0 0x2c000000 0x01000000>;
 	ranges = <5 0 0x2c000000 0x01000000>;
 
 
-	smsc1: ethernet@5,0 {
+	smsc1: ethernet@gpmc {
 		compatible = "smsc,lan9221", "smsc,lan9115";
 		compatible = "smsc,lan9221", "smsc,lan9115";
 		pinctrl-names = "default";
 		pinctrl-names = "default";
 		pinctrl-0 = <&smsc1_pins>;
 		pinctrl-0 = <&smsc1_pins>;
 		interrupt-parent = <&gpio6>;
 		interrupt-parent = <&gpio6>;
 		interrupts = <3 IRQ_TYPE_LEVEL_LOW>;
 		interrupts = <3 IRQ_TYPE_LEVEL_LOW>;
 		reg = <5 0 0xff>;
 		reg = <5 0 0xff>;
-		bank-width = <2>;
-		gpmc,mux-add-data;
-		gpmc,cs-on-ns = <0>;
-		gpmc,cs-rd-off-ns = <186>;
-		gpmc,cs-wr-off-ns = <186>;
-		gpmc,adv-on-ns = <12>;
-		gpmc,adv-rd-off-ns = <48>;
-		gpmc,adv-wr-off-ns = <48>;
-		gpmc,oe-on-ns = <54>;
-		gpmc,oe-off-ns = <168>;
-		gpmc,we-on-ns = <54>;
-		gpmc,we-off-ns = <168>;
-		gpmc,rd-cycle-ns = <186>;
-		gpmc,wr-cycle-ns = <186>;
-		gpmc,access-ns = <114>;
-		gpmc,page-burst-access-ns = <6>;
-		gpmc,bus-turnaround-ns = <12>;
-		gpmc,cycle2cycle-delay-ns = <18>;
-		gpmc,wr-data-mux-bus-ns = <90>;
-		gpmc,wr-access-ns = <186>;
-		gpmc,cycle2cycle-samecsen;
-		gpmc,cycle2cycle-diffcsen;
-		vddvario-supply = <&vddvario>;
-		vdd33a-supply = <&vdd33a>;
-		reg-io-width = <4>;
-		smsc,save-mac-address;
 	};
 	};
 };
 };
 
 

+ 1 - 1
arch/arm/boot/dts/omap3-igep.dtsi

@@ -107,7 +107,7 @@
 		>;
 		>;
 	};
 	};
 
 
-	smsc911x_pins: pinmux_smsc911x_pins {
+	smsc9221_pins: pinmux_smsc9221_pins {
 		pinctrl-single,pins = <
 		pinctrl-single,pins = <
 			0x1a2 (PIN_INPUT | MUX_MODE4)		/* mcspi1_cs2.gpio_176 */
 			0x1a2 (PIN_INPUT | MUX_MODE4)		/* mcspi1_cs2.gpio_176 */
 		>;
 		>;

+ 2 - 2
arch/arm/boot/dts/omap3-igep0020.dts

@@ -10,7 +10,7 @@
  */
  */
 
 
 #include "omap3-igep.dtsi"
 #include "omap3-igep.dtsi"
-#include "omap-gpmc-smsc911x.dtsi"
+#include "omap-gpmc-smsc9221.dtsi"
 
 
 / {
 / {
 	model = "IGEPv2 (TI OMAP AM/DM37x)";
 	model = "IGEPv2 (TI OMAP AM/DM37x)";
@@ -248,7 +248,7 @@
 
 
 	ethernet@gpmc {
 	ethernet@gpmc {
 		pinctrl-names = "default";
 		pinctrl-names = "default";
-		pinctrl-0 = <&smsc911x_pins>;
+		pinctrl-0 = <&smsc9221_pins>;
 		reg = <5 0 0xff>;
 		reg = <5 0 0xff>;
 		interrupt-parent = <&gpio6>;
 		interrupt-parent = <&gpio6>;
 		interrupts = <16 IRQ_TYPE_LEVEL_LOW>;
 		interrupts = <16 IRQ_TYPE_LEVEL_LOW>;

+ 10 - 27
arch/arm/boot/dts/omap3-sb-t35.dtsi

@@ -2,20 +2,6 @@
  * Common support for CompuLab SB-T35 used on SBC-T3530, SBC-T3517 and SBC-T3730
  * Common support for CompuLab SB-T35 used on SBC-T3530, SBC-T3517 and SBC-T3730
  */
  */
 
 
-/ {
-	vddvario_sb_t35: regulator-vddvario-sb-t35 {
-		compatible = "regulator-fixed";
-		regulator-name = "vddvario";
-		regulator-always-on;
-	};
-
-	vdd33a_sb_t35: regulator-vdd33a-sb-t35 {
-		compatible = "regulator-fixed";
-		regulator-name = "vdd33a";
-		regulator-always-on;
-	};
-};
-
 &omap3_pmx_core {
 &omap3_pmx_core {
 	smsc2_pins: pinmux_smsc2_pins {
 	smsc2_pins: pinmux_smsc2_pins {
 		pinctrl-single,pins = <
 		pinctrl-single,pins = <
@@ -37,11 +23,10 @@
 		reg = <4 0 0xff>;
 		reg = <4 0 0xff>;
 		bank-width = <2>;
 		bank-width = <2>;
 		gpmc,mux-add-data;
 		gpmc,mux-add-data;
-		gpmc,cs-on-ns = <0>;
-		gpmc,cs-rd-off-ns = <186>;
-		gpmc,cs-wr-off-ns = <186>;
-		gpmc,adv-on-ns = <12>;
-		gpmc,adv-rd-off-ns = <48>;
+		gpmc,cs-on-ns = <1>;
+		gpmc,cs-rd-off-ns = <180>;
+		gpmc,cs-wr-off-ns = <180>;
+		gpmc,adv-rd-off-ns = <18>;
 		gpmc,adv-wr-off-ns = <48>;
 		gpmc,adv-wr-off-ns = <48>;
 		gpmc,oe-on-ns = <54>;
 		gpmc,oe-on-ns = <54>;
 		gpmc,oe-off-ns = <168>;
 		gpmc,oe-off-ns = <168>;
@@ -49,16 +34,14 @@
 		gpmc,we-off-ns = <168>;
 		gpmc,we-off-ns = <168>;
 		gpmc,rd-cycle-ns = <186>;
 		gpmc,rd-cycle-ns = <186>;
 		gpmc,wr-cycle-ns = <186>;
 		gpmc,wr-cycle-ns = <186>;
-		gpmc,access-ns = <114>;
-		gpmc,page-burst-access-ns = <6>;
-		gpmc,bus-turnaround-ns = <12>;
-		gpmc,cycle2cycle-delay-ns = <18>;
-		gpmc,wr-data-mux-bus-ns = <90>;
-		gpmc,wr-access-ns = <186>;
+		gpmc,access-ns = <144>;
+		gpmc,page-burst-access-ns = <24>;
+		gpmc,bus-turnaround-ns = <90>;
+		gpmc,cycle2cycle-delay-ns = <90>;
 		gpmc,cycle2cycle-samecsen;
 		gpmc,cycle2cycle-samecsen;
 		gpmc,cycle2cycle-diffcsen;
 		gpmc,cycle2cycle-diffcsen;
-		vddvario-supply = <&vddvario_sb_t35>;
-		vdd33a-supply = <&vdd33a_sb_t35>;
+		vddvario-supply = <&vddvario>;
+		vdd33a-supply = <&vdd33a>;
 		reg-io-width = <4>;
 		reg-io-width = <4>;
 		smsc,save-mac-address;
 		smsc,save-mac-address;
 	};
 	};

+ 13 - 0
arch/arm/boot/dts/omap3-sbc-t3517.dts

@@ -8,6 +8,19 @@
 / {
 / {
 	model = "CompuLab SBC-T3517 with CM-T3517";
 	model = "CompuLab SBC-T3517 with CM-T3517";
 	compatible = "compulab,omap3-sbc-t3517", "compulab,omap3-cm-t3517", "ti,am3517", "ti,omap3";
 	compatible = "compulab,omap3-sbc-t3517", "compulab,omap3-cm-t3517", "ti,am3517", "ti,omap3";
+
+	/* Only one GPMC smsc9220 on SBC-T3517, CM-T3517 uses am35x Ethernet */
+	vddvario: regulator-vddvario-sb-t35 {
+		compatible = "regulator-fixed";
+		regulator-name = "vddvario";
+		regulator-always-on;
+	};
+
+	vdd33a: regulator-vdd33a-sb-t35 {
+		compatible = "regulator-fixed";
+		regulator-name = "vdd33a";
+		regulator-always-on;
+	};
 };
 };
 
 
 &omap3_pmx_core {
 &omap3_pmx_core {

+ 1 - 1
arch/arm/boot/dts/omap3.dtsi

@@ -61,7 +61,7 @@
 			ti,hwmods = "mpu";
 			ti,hwmods = "mpu";
 		};
 		};
 
 
-		iva {
+		iva: iva {
 			compatible = "ti,iva2.2";
 			compatible = "ti,iva2.2";
 			ti,hwmods = "iva";
 			ti,hwmods = "iva";
 
 

+ 7 - 0
arch/arm/boot/dts/omap5.dtsi

@@ -630,6 +630,13 @@
 			status = "disabled";
 			status = "disabled";
 		};
 		};
 
 
+		mailbox: mailbox@4a0f4000 {
+			compatible = "ti,omap4-mailbox";
+			reg = <0x4a0f4000 0x200>;
+			interrupts = <GIC_SPI 26 IRQ_TYPE_LEVEL_HIGH>;
+			ti,hwmods = "mailbox";
+		};
+
 		timer1: timer@4ae18000 {
 		timer1: timer@4ae18000 {
 			compatible = "ti,omap5430-timer";
 			compatible = "ti,omap5430-timer";
 			reg = <0x4ae18000 0x80>;
 			reg = <0x4ae18000 0x80>;

+ 1 - 1
arch/arm/boot/dts/sama5d3.dtsi

@@ -13,7 +13,7 @@
 #include <dt-bindings/pinctrl/at91.h>
 #include <dt-bindings/pinctrl/at91.h>
 #include <dt-bindings/interrupt-controller/irq.h>
 #include <dt-bindings/interrupt-controller/irq.h>
 #include <dt-bindings/gpio/gpio.h>
 #include <dt-bindings/gpio/gpio.h>
-#include <dt-bindings/clk/at91.h>
+#include <dt-bindings/clock/at91.h>
 
 
 / {
 / {
 	model = "Atmel SAMA5D3 family SoC";
 	model = "Atmel SAMA5D3 family SoC";

+ 1 - 1
arch/arm/boot/dts/sama5d3_mci2.dtsi

@@ -9,7 +9,7 @@
 
 
 #include <dt-bindings/pinctrl/at91.h>
 #include <dt-bindings/pinctrl/at91.h>
 #include <dt-bindings/interrupt-controller/irq.h>
 #include <dt-bindings/interrupt-controller/irq.h>
-#include <dt-bindings/clk/at91.h>
+#include <dt-bindings/clock/at91.h>
 
 
 / {
 / {
 	ahb {
 	ahb {

+ 1 - 1
arch/arm/boot/dts/sama5d3_tcb1.dtsi

@@ -9,7 +9,7 @@
 
 
 #include <dt-bindings/pinctrl/at91.h>
 #include <dt-bindings/pinctrl/at91.h>
 #include <dt-bindings/interrupt-controller/irq.h>
 #include <dt-bindings/interrupt-controller/irq.h>
-#include <dt-bindings/clk/at91.h>
+#include <dt-bindings/clock/at91.h>
 
 
 / {
 / {
 	aliases {
 	aliases {

+ 1 - 1
arch/arm/boot/dts/sama5d3_uart.dtsi

@@ -9,7 +9,7 @@
 
 
 #include <dt-bindings/pinctrl/at91.h>
 #include <dt-bindings/pinctrl/at91.h>
 #include <dt-bindings/interrupt-controller/irq.h>
 #include <dt-bindings/interrupt-controller/irq.h>
-#include <dt-bindings/clk/at91.h>
+#include <dt-bindings/clock/at91.h>
 
 
 / {
 / {
 	aliases {
 	aliases {

+ 11 - 3
arch/arm/boot/dts/sun7i-a20.dtsi

@@ -87,7 +87,7 @@
 
 
 		pll4: clk@01c20018 {
 		pll4: clk@01c20018 {
 			#clock-cells = <0>;
 			#clock-cells = <0>;
-			compatible = "allwinner,sun4i-a10-pll1-clk";
+			compatible = "allwinner,sun7i-a20-pll4-clk";
 			reg = <0x01c20018 0x4>;
 			reg = <0x01c20018 0x4>;
 			clocks = <&osc24M>;
 			clocks = <&osc24M>;
 			clock-output-names = "pll4";
 			clock-output-names = "pll4";
@@ -109,6 +109,14 @@
 			clock-output-names = "pll6_sata", "pll6_other", "pll6";
 			clock-output-names = "pll6_sata", "pll6_other", "pll6";
 		};
 		};
 
 
+		pll8: clk@01c20040 {
+			#clock-cells = <0>;
+			compatible = "allwinner,sun7i-a20-pll4-clk";
+			reg = <0x01c20040 0x4>;
+			clocks = <&osc24M>;
+			clock-output-names = "pll8";
+		};
+
 		cpu: cpu@01c20054 {
 		cpu: cpu@01c20054 {
 			#clock-cells = <0>;
 			#clock-cells = <0>;
 			compatible = "allwinner,sun4i-a10-cpu-clk";
 			compatible = "allwinner,sun4i-a10-cpu-clk";
@@ -805,9 +813,9 @@
 			status = "disabled";
 			status = "disabled";
 		};
 		};
 
 
-		i2c4: i2c@01c2bc00 {
+		i2c4: i2c@01c2c000 {
 			compatible = "allwinner,sun4i-i2c";
 			compatible = "allwinner,sun4i-i2c";
-			reg = <0x01c2bc00 0x400>;
+			reg = <0x01c2c000 0x400>;
 			interrupts = <0 89 4>;
 			interrupts = <0 89 4>;
 			clocks = <&apb1_gates 15>;
 			clocks = <&apb1_gates 15>;
 			clock-frequency = <100000>;
 			clock-frequency = <100000>;

+ 15 - 33
arch/arm/common/edma.c

@@ -1423,55 +1423,38 @@ EXPORT_SYMBOL(edma_clear_event);
 
 
 #if IS_ENABLED(CONFIG_OF) && IS_ENABLED(CONFIG_DMADEVICES)
 #if IS_ENABLED(CONFIG_OF) && IS_ENABLED(CONFIG_DMADEVICES)
 
 
-static int edma_of_read_u32_to_s16_array(const struct device_node *np,
-					 const char *propname, s16 *out_values,
-					 size_t sz)
+static int edma_xbar_event_map(struct device *dev, struct device_node *node,
+			       struct edma_soc_info *pdata, size_t sz)
 {
 {
-	int ret;
-
-	ret = of_property_read_u16_array(np, propname, out_values, sz);
-	if (ret)
-		return ret;
-
-	/* Terminate it */
-	*out_values++ = -1;
-	*out_values++ = -1;
-
-	return 0;
-}
-
-static int edma_xbar_event_map(struct device *dev,
-			       struct device_node *node,
-			       struct edma_soc_info *pdata, int len)
-{
-	int ret, i;
+	const char pname[] = "ti,edma-xbar-event-map";
 	struct resource res;
 	struct resource res;
 	void __iomem *xbar;
 	void __iomem *xbar;
-	const s16 (*xbar_chans)[2];
+	s16 (*xbar_chans)[2];
+	size_t nelm = sz / sizeof(s16);
 	u32 shift, offset, mux;
 	u32 shift, offset, mux;
+	int ret, i;
 
 
-	xbar_chans = devm_kzalloc(dev,
-				  len/sizeof(s16) + 2*sizeof(s16),
-				  GFP_KERNEL);
+	xbar_chans = devm_kzalloc(dev, (nelm + 2) * sizeof(s16), GFP_KERNEL);
 	if (!xbar_chans)
 	if (!xbar_chans)
 		return -ENOMEM;
 		return -ENOMEM;
 
 
 	ret = of_address_to_resource(node, 1, &res);
 	ret = of_address_to_resource(node, 1, &res);
 	if (ret)
 	if (ret)
-		return -EIO;
+		return -ENOMEM;
 
 
 	xbar = devm_ioremap(dev, res.start, resource_size(&res));
 	xbar = devm_ioremap(dev, res.start, resource_size(&res));
 	if (!xbar)
 	if (!xbar)
 		return -ENOMEM;
 		return -ENOMEM;
 
 
-	ret = edma_of_read_u32_to_s16_array(node,
-					    "ti,edma-xbar-event-map",
-					    (s16 *)xbar_chans,
-					    len/sizeof(u32));
+	ret = of_property_read_u16_array(node, pname, (u16 *)xbar_chans, nelm);
 	if (ret)
 	if (ret)
 		return -EIO;
 		return -EIO;
 
 
-	for (i = 0; xbar_chans[i][0] != -1; i++) {
+	/* Invalidate last entry for the other user of this mess */
+	nelm >>= 1;
+	xbar_chans[nelm][0] = xbar_chans[nelm][1] = -1;
+
+	for (i = 0; i < nelm; i++) {
 		shift = (xbar_chans[i][1] & 0x03) << 3;
 		shift = (xbar_chans[i][1] & 0x03) << 3;
 		offset = xbar_chans[i][1] & 0xfffffffc;
 		offset = xbar_chans[i][1] & 0xfffffffc;
 		mux = readl(xbar + offset);
 		mux = readl(xbar + offset);
@@ -1480,8 +1463,7 @@ static int edma_xbar_event_map(struct device *dev,
 		writel(mux, (xbar + offset));
 		writel(mux, (xbar + offset));
 	}
 	}
 
 
-	pdata->xbar_chans = xbar_chans;
-
+	pdata->xbar_chans = (const s16 (*)[2]) xbar_chans;
 	return 0;
 	return 0;
 }
 }
 
 

+ 1 - 1
arch/arm/configs/sunxi_defconfig

@@ -37,7 +37,7 @@ CONFIG_SUN4I_EMAC=y
 # CONFIG_NET_VENDOR_NATSEMI is not set
 # CONFIG_NET_VENDOR_NATSEMI is not set
 # CONFIG_NET_VENDOR_SEEQ is not set
 # CONFIG_NET_VENDOR_SEEQ is not set
 # CONFIG_NET_VENDOR_SMSC is not set
 # CONFIG_NET_VENDOR_SMSC is not set
-# CONFIG_NET_VENDOR_STMICRO is not set
+CONFIG_STMMAC_ETH=y
 # CONFIG_NET_VENDOR_WIZNET is not set
 # CONFIG_NET_VENDOR_WIZNET is not set
 # CONFIG_WLAN is not set
 # CONFIG_WLAN is not set
 CONFIG_SERIAL_8250=y
 CONFIG_SERIAL_8250=y

+ 0 - 1
arch/arm/include/asm/xen/page.h

@@ -77,7 +77,6 @@ static inline xpaddr_t machine_to_phys(xmaddr_t machine)
 }
 }
 /* VIRT <-> MACHINE conversion */
 /* VIRT <-> MACHINE conversion */
 #define virt_to_machine(v)	(phys_to_machine(XPADDR(__pa(v))))
 #define virt_to_machine(v)	(phys_to_machine(XPADDR(__pa(v))))
-#define virt_to_pfn(v)          (PFN_DOWN(__pa(v)))
 #define virt_to_mfn(v)		(pfn_to_mfn(virt_to_pfn(v)))
 #define virt_to_mfn(v)		(pfn_to_mfn(virt_to_pfn(v)))
 #define mfn_to_virt(m)		(__va(mfn_to_pfn(m) << PAGE_SHIFT))
 #define mfn_to_virt(m)		(__va(mfn_to_pfn(m) << PAGE_SHIFT))
 
 

+ 6 - 2
arch/arm/mach-omap2/omap-headsmp.S

@@ -1,7 +1,7 @@
 /*
 /*
  * Secondary CPU startup routine source file.
  * Secondary CPU startup routine source file.
  *
  *
- * Copyright (C) 2009 Texas Instruments, Inc.
+ * Copyright (C) 2009-2014 Texas Instruments, Inc.
  *
  *
  * Author:
  * Author:
  *      Santosh Shilimkar <santosh.shilimkar@ti.com>
  *      Santosh Shilimkar <santosh.shilimkar@ti.com>
@@ -28,9 +28,13 @@
  * code.  This routine also provides a holding flag into which
  * code.  This routine also provides a holding flag into which
  * secondary core is held until we're ready for it to initialise.
  * secondary core is held until we're ready for it to initialise.
  * The primary core will update this flag using a hardware
  * The primary core will update this flag using a hardware
-+ * register AuxCoreBoot0.
+ * register AuxCoreBoot0.
  */
  */
 ENTRY(omap5_secondary_startup)
 ENTRY(omap5_secondary_startup)
+.arm
+THUMB( adr     r9, BSYM(wait)  )       @ CPU may be entered in ARM mode.
+THUMB( bx      r9              )       @ If this is a Thumb-2 kernel,
+THUMB( .thumb                  )       @ switch to Thumb now.
 wait:	ldr	r2, =AUX_CORE_BOOT0_PA	@ read from AuxCoreBoot0
 wait:	ldr	r2, =AUX_CORE_BOOT0_PA	@ read from AuxCoreBoot0
 	ldr	r0, [r2]
 	ldr	r0, [r2]
 	mov	r0, r0, lsr #5
 	mov	r0, r0, lsr #5

+ 1 - 1
arch/arm/mach-orion5x/common.h

@@ -21,7 +21,7 @@ struct mv_sata_platform_data;
 #define ORION_MBUS_DEVBUS_BOOT_ATTR   0x0f
 #define ORION_MBUS_DEVBUS_BOOT_ATTR   0x0f
 #define ORION_MBUS_DEVBUS_TARGET(cs)  0x01
 #define ORION_MBUS_DEVBUS_TARGET(cs)  0x01
 #define ORION_MBUS_DEVBUS_ATTR(cs)    (~(1 << cs))
 #define ORION_MBUS_DEVBUS_ATTR(cs)    (~(1 << cs))
-#define ORION_MBUS_SRAM_TARGET        0x00
+#define ORION_MBUS_SRAM_TARGET        0x09
 #define ORION_MBUS_SRAM_ATTR          0x00
 #define ORION_MBUS_SRAM_ATTR          0x00
 
 
 /*
 /*

+ 1 - 0
arch/arm64/include/asm/memory.h

@@ -138,6 +138,7 @@ static inline void *phys_to_virt(phys_addr_t x)
 #define __pa(x)			__virt_to_phys((unsigned long)(x))
 #define __pa(x)			__virt_to_phys((unsigned long)(x))
 #define __va(x)			((void *)__phys_to_virt((phys_addr_t)(x)))
 #define __va(x)			((void *)__phys_to_virt((phys_addr_t)(x)))
 #define pfn_to_kaddr(pfn)	__va((pfn) << PAGE_SHIFT)
 #define pfn_to_kaddr(pfn)	__va((pfn) << PAGE_SHIFT)
+#define virt_to_pfn(x)      __phys_to_pfn(__virt_to_phys(x))
 
 
 /*
 /*
  *  virt_to_page(k)	convert a _valid_ virtual address to struct page *
  *  virt_to_page(k)	convert a _valid_ virtual address to struct page *

+ 46 - 37
arch/sparc/include/asm/pgtable_64.h

@@ -71,6 +71,23 @@
 
 
 #include <linux/sched.h>
 #include <linux/sched.h>
 
 
+extern unsigned long sparc64_valid_addr_bitmap[];
+
+/* Needs to be defined here and not in linux/mm.h, as it is arch dependent */
+static inline bool __kern_addr_valid(unsigned long paddr)
+{
+	if ((paddr >> MAX_PHYS_ADDRESS_BITS) != 0UL)
+		return false;
+	return test_bit(paddr >> ILOG2_4MB, sparc64_valid_addr_bitmap);
+}
+
+static inline bool kern_addr_valid(unsigned long addr)
+{
+	unsigned long paddr = __pa(addr);
+
+	return __kern_addr_valid(paddr);
+}
+
 /* Entries per page directory level. */
 /* Entries per page directory level. */
 #define PTRS_PER_PTE	(1UL << (PAGE_SHIFT-3))
 #define PTRS_PER_PTE	(1UL << (PAGE_SHIFT-3))
 #define PTRS_PER_PMD	(1UL << PMD_BITS)
 #define PTRS_PER_PMD	(1UL << PMD_BITS)
@@ -79,9 +96,12 @@
 /* Kernel has a separate 44bit address space. */
 /* Kernel has a separate 44bit address space. */
 #define FIRST_USER_ADDRESS	0
 #define FIRST_USER_ADDRESS	0
 
 
-#define pte_ERROR(e)	__builtin_trap()
-#define pmd_ERROR(e)	__builtin_trap()
-#define pgd_ERROR(e)	__builtin_trap()
+#define pmd_ERROR(e)							\
+	pr_err("%s:%d: bad pmd %p(%016lx) seen at (%pS)\n",		\
+	       __FILE__, __LINE__, &(e), pmd_val(e), __builtin_return_address(0))
+#define pgd_ERROR(e)							\
+	pr_err("%s:%d: bad pgd %p(%016lx) seen at (%pS)\n",		\
+	       __FILE__, __LINE__, &(e), pgd_val(e), __builtin_return_address(0))
 
 
 #endif /* !(__ASSEMBLY__) */
 #endif /* !(__ASSEMBLY__) */
 
 
@@ -258,8 +278,8 @@ static inline pte_t pte_modify(pte_t pte, pgprot_t prot)
 {
 {
 	unsigned long mask, tmp;
 	unsigned long mask, tmp;
 
 
-	/* SUN4U: 0x600307ffffffecb8 (negated == 0x9ffcf80000001347)
-	 * SUN4V: 0x30ffffffffffee17 (negated == 0xcf000000000011e8)
+	/* SUN4U: 0x630107ffffffec38 (negated == 0x9cfef800000013c7)
+	 * SUN4V: 0x33ffffffffffee07 (negated == 0xcc000000000011f8)
 	 *
 	 *
 	 * Even if we use negation tricks the result is still a 6
 	 * Even if we use negation tricks the result is still a 6
 	 * instruction sequence, so don't try to play fancy and just
 	 * instruction sequence, so don't try to play fancy and just
@@ -289,10 +309,10 @@ static inline pte_t pte_modify(pte_t pte, pgprot_t prot)
 	"	.previous\n"
 	"	.previous\n"
 	: "=r" (mask), "=r" (tmp)
 	: "=r" (mask), "=r" (tmp)
 	: "i" (_PAGE_PADDR_4U | _PAGE_MODIFIED_4U | _PAGE_ACCESSED_4U |
 	: "i" (_PAGE_PADDR_4U | _PAGE_MODIFIED_4U | _PAGE_ACCESSED_4U |
-	       _PAGE_CP_4U | _PAGE_CV_4U | _PAGE_E_4U | _PAGE_PRESENT_4U |
+	       _PAGE_CP_4U | _PAGE_CV_4U | _PAGE_E_4U |
 	       _PAGE_SPECIAL | _PAGE_PMD_HUGE | _PAGE_SZALL_4U),
 	       _PAGE_SPECIAL | _PAGE_PMD_HUGE | _PAGE_SZALL_4U),
 	  "i" (_PAGE_PADDR_4V | _PAGE_MODIFIED_4V | _PAGE_ACCESSED_4V |
 	  "i" (_PAGE_PADDR_4V | _PAGE_MODIFIED_4V | _PAGE_ACCESSED_4V |
-	       _PAGE_CP_4V | _PAGE_CV_4V | _PAGE_E_4V | _PAGE_PRESENT_4V |
+	       _PAGE_CP_4V | _PAGE_CV_4V | _PAGE_E_4V |
 	       _PAGE_SPECIAL | _PAGE_PMD_HUGE | _PAGE_SZALL_4V));
 	       _PAGE_SPECIAL | _PAGE_PMD_HUGE | _PAGE_SZALL_4V));
 
 
 	return __pte((pte_val(pte) & mask) | (pgprot_val(prot) & ~mask));
 	return __pte((pte_val(pte) & mask) | (pgprot_val(prot) & ~mask));
@@ -633,7 +653,7 @@ static inline unsigned long pmd_large(pmd_t pmd)
 {
 {
 	pte_t pte = __pte(pmd_val(pmd));
 	pte_t pte = __pte(pmd_val(pmd));
 
 
-	return (pte_val(pte) & _PAGE_PMD_HUGE) && pte_present(pte);
+	return pte_val(pte) & _PAGE_PMD_HUGE;
 }
 }
 
 
 #ifdef CONFIG_TRANSPARENT_HUGEPAGE
 #ifdef CONFIG_TRANSPARENT_HUGEPAGE
@@ -719,20 +739,6 @@ static inline pmd_t pmd_mkwrite(pmd_t pmd)
 	return __pmd(pte_val(pte));
 	return __pmd(pte_val(pte));
 }
 }
 
 
-static inline pmd_t pmd_mknotpresent(pmd_t pmd)
-{
-	unsigned long mask;
-
-	if (tlb_type == hypervisor)
-		mask = _PAGE_PRESENT_4V;
-	else
-		mask = _PAGE_PRESENT_4U;
-
-	pmd_val(pmd) &= ~mask;
-
-	return pmd;
-}
-
 static inline pmd_t pmd_mksplitting(pmd_t pmd)
 static inline pmd_t pmd_mksplitting(pmd_t pmd)
 {
 {
 	pte_t pte = __pte(pmd_val(pmd));
 	pte_t pte = __pte(pmd_val(pmd));
@@ -757,6 +763,20 @@ static inline int pmd_present(pmd_t pmd)
 
 
 #define pmd_none(pmd)			(!pmd_val(pmd))
 #define pmd_none(pmd)			(!pmd_val(pmd))
 
 
+/* pmd_bad() is only called on non-trans-huge PMDs.  Our encoding is
+ * very simple, it's just the physical address.  PTE tables are of
+ * size PAGE_SIZE so make sure the sub-PAGE_SIZE bits are clear and
+ * the top bits outside of the range of any physical address size we
+ * support are clear as well.  We also validate the physical itself.
+ */
+#define pmd_bad(pmd)			((pmd_val(pmd) & ~PAGE_MASK) || \
+					 !__kern_addr_valid(pmd_val(pmd)))
+
+#define pud_none(pud)			(!pud_val(pud))
+
+#define pud_bad(pud)			((pud_val(pud) & ~PAGE_MASK) || \
+					 !__kern_addr_valid(pud_val(pud)))
+
 #ifdef CONFIG_TRANSPARENT_HUGEPAGE
 #ifdef CONFIG_TRANSPARENT_HUGEPAGE
 extern void set_pmd_at(struct mm_struct *mm, unsigned long addr,
 extern void set_pmd_at(struct mm_struct *mm, unsigned long addr,
 		       pmd_t *pmdp, pmd_t pmd);
 		       pmd_t *pmdp, pmd_t pmd);
@@ -790,10 +810,7 @@ static inline unsigned long __pmd_page(pmd_t pmd)
 #define pud_page_vaddr(pud)		\
 #define pud_page_vaddr(pud)		\
 	((unsigned long) __va(pud_val(pud)))
 	((unsigned long) __va(pud_val(pud)))
 #define pud_page(pud) 			virt_to_page((void *)pud_page_vaddr(pud))
 #define pud_page(pud) 			virt_to_page((void *)pud_page_vaddr(pud))
-#define pmd_bad(pmd)			(0)
 #define pmd_clear(pmdp)			(pmd_val(*(pmdp)) = 0UL)
 #define pmd_clear(pmdp)			(pmd_val(*(pmdp)) = 0UL)
-#define pud_none(pud)			(!pud_val(pud))
-#define pud_bad(pud)			(0)
 #define pud_present(pud)		(pud_val(pud) != 0U)
 #define pud_present(pud)		(pud_val(pud) != 0U)
 #define pud_clear(pudp)			(pud_val(*(pudp)) = 0UL)
 #define pud_clear(pudp)			(pud_val(*(pudp)) = 0UL)
 
 
@@ -893,6 +910,10 @@ extern void update_mmu_cache(struct vm_area_struct *, unsigned long, pte_t *);
 extern void update_mmu_cache_pmd(struct vm_area_struct *vma, unsigned long addr,
 extern void update_mmu_cache_pmd(struct vm_area_struct *vma, unsigned long addr,
 				 pmd_t *pmd);
 				 pmd_t *pmd);
 
 
+#define __HAVE_ARCH_PMDP_INVALIDATE
+extern void pmdp_invalidate(struct vm_area_struct *vma, unsigned long address,
+			    pmd_t *pmdp);
+
 #define __HAVE_ARCH_PGTABLE_DEPOSIT
 #define __HAVE_ARCH_PGTABLE_DEPOSIT
 extern void pgtable_trans_huge_deposit(struct mm_struct *mm, pmd_t *pmdp,
 extern void pgtable_trans_huge_deposit(struct mm_struct *mm, pmd_t *pmdp,
 				       pgtable_t pgtable);
 				       pgtable_t pgtable);
@@ -919,18 +940,6 @@ extern unsigned long pte_file(pte_t);
 extern pte_t pgoff_to_pte(unsigned long);
 extern pte_t pgoff_to_pte(unsigned long);
 #define PTE_FILE_MAX_BITS	(64UL - PAGE_SHIFT - 1UL)
 #define PTE_FILE_MAX_BITS	(64UL - PAGE_SHIFT - 1UL)
 
 
-extern unsigned long sparc64_valid_addr_bitmap[];
-
-/* Needs to be defined here and not in linux/mm.h, as it is arch dependent */
-static inline bool kern_addr_valid(unsigned long addr)
-{
-	unsigned long paddr = __pa(addr);
-
-	if ((paddr >> 41UL) != 0UL)
-		return false;
-	return test_bit(paddr >> 22, sparc64_valid_addr_bitmap);
-}
-
 extern int page_in_phys_avail(unsigned long paddr);
 extern int page_in_phys_avail(unsigned long paddr);
 
 
 /*
 /*

+ 2 - 1
arch/sparc/include/asm/tsb.h

@@ -171,7 +171,8 @@ extern struct tsb_phys_patch_entry __tsb_phys_patch, __tsb_phys_patch_end;
 	andcc		REG1, REG2, %g0;		\
 	andcc		REG1, REG2, %g0;		\
 	be,pt		%xcc, 700f;			\
 	be,pt		%xcc, 700f;			\
 	 sethi		%hi(4 * 1024 * 1024), REG2;	\
 	 sethi		%hi(4 * 1024 * 1024), REG2;	\
-	andn		REG1, REG2, REG1;		\
+	brgez,pn	REG1, FAIL_LABEL;		\
+	 andn		REG1, REG2, REG1;		\
 	and		VADDR, REG2, REG2;		\
 	and		VADDR, REG2, REG2;		\
 	brlz,pt		REG1, PTE_LABEL;		\
 	brlz,pt		REG1, PTE_LABEL;		\
 	 or		REG1, REG2, REG1;		\
 	 or		REG1, REG2, REG1;		\

+ 2 - 2
arch/sparc/kernel/head_64.S

@@ -282,8 +282,8 @@ sun4v_chip_type:
 	stx	%l2, [%l4 + 0x0]
 	stx	%l2, [%l4 + 0x0]
 	ldx	[%sp + 2047 + 128 + 0x50], %l3	! physaddr low
 	ldx	[%sp + 2047 + 128 + 0x50], %l3	! physaddr low
 	/* 4MB align */
 	/* 4MB align */
-	srlx	%l3, 22, %l3
-	sllx	%l3, 22, %l3
+	srlx	%l3, ILOG2_4MB, %l3
+	sllx	%l3, ILOG2_4MB, %l3
 	stx	%l3, [%l4 + 0x8]
 	stx	%l3, [%l4 + 0x8]
 
 
 	/* Leave service as-is, "call-method" */
 	/* Leave service as-is, "call-method" */

+ 1 - 1
arch/sparc/kernel/ktlb.S

@@ -277,7 +277,7 @@ kvmap_dtlb_load:
 #ifdef CONFIG_SPARSEMEM_VMEMMAP
 #ifdef CONFIG_SPARSEMEM_VMEMMAP
 kvmap_vmemmap:
 kvmap_vmemmap:
 	sub		%g4, %g5, %g5
 	sub		%g4, %g5, %g5
-	srlx		%g5, 22, %g5
+	srlx		%g5, ILOG2_4MB, %g5
 	sethi		%hi(vmemmap_table), %g1
 	sethi		%hi(vmemmap_table), %g1
 	sllx		%g5, 3, %g5
 	sllx		%g5, 3, %g5
 	or		%g1, %lo(vmemmap_table), %g1
 	or		%g1, %lo(vmemmap_table), %g1

+ 5 - 16
arch/sparc/kernel/nmi.c

@@ -68,27 +68,16 @@ EXPORT_SYMBOL(touch_nmi_watchdog);
 
 
 static void die_nmi(const char *str, struct pt_regs *regs, int do_panic)
 static void die_nmi(const char *str, struct pt_regs *regs, int do_panic)
 {
 {
+	int this_cpu = smp_processor_id();
+
 	if (notify_die(DIE_NMIWATCHDOG, str, regs, 0,
 	if (notify_die(DIE_NMIWATCHDOG, str, regs, 0,
 		       pt_regs_trap_type(regs), SIGINT) == NOTIFY_STOP)
 		       pt_regs_trap_type(regs), SIGINT) == NOTIFY_STOP)
 		return;
 		return;
 
 
-	console_verbose();
-	bust_spinlocks(1);
-
-	printk(KERN_EMERG "%s", str);
-	printk(" on CPU%d, ip %08lx, registers:\n",
-	       smp_processor_id(), regs->tpc);
-	show_regs(regs);
-	dump_stack();
-
-	bust_spinlocks(0);
-
 	if (do_panic || panic_on_oops)
 	if (do_panic || panic_on_oops)
-		panic("Non maskable interrupt");
-
-	nmi_exit();
-	local_irq_enable();
-	do_exit(SIGBUS);
+		panic("Watchdog detected hard LOCKUP on cpu %d", this_cpu);
+	else
+		WARN(1, "Watchdog detected hard LOCKUP on cpu %d", this_cpu);
 }
 }
 
 
 notrace __kprobes void perfctr_irq(int irq, struct pt_regs *regs)
 notrace __kprobes void perfctr_irq(int irq, struct pt_regs *regs)

+ 3 - 3
arch/sparc/kernel/smp_64.c

@@ -149,7 +149,7 @@ void cpu_panic(void)
 #define NUM_ROUNDS	64	/* magic value */
 #define NUM_ROUNDS	64	/* magic value */
 #define NUM_ITERS	5	/* likewise */
 #define NUM_ITERS	5	/* likewise */
 
 
-static DEFINE_SPINLOCK(itc_sync_lock);
+static DEFINE_RAW_SPINLOCK(itc_sync_lock);
 static unsigned long go[SLAVE + 1];
 static unsigned long go[SLAVE + 1];
 
 
 #define DEBUG_TICK_SYNC	0
 #define DEBUG_TICK_SYNC	0
@@ -257,7 +257,7 @@ static void smp_synchronize_one_tick(int cpu)
 	go[MASTER] = 0;
 	go[MASTER] = 0;
 	membar_safe("#StoreLoad");
 	membar_safe("#StoreLoad");
 
 
-	spin_lock_irqsave(&itc_sync_lock, flags);
+	raw_spin_lock_irqsave(&itc_sync_lock, flags);
 	{
 	{
 		for (i = 0; i < NUM_ROUNDS*NUM_ITERS; i++) {
 		for (i = 0; i < NUM_ROUNDS*NUM_ITERS; i++) {
 			while (!go[MASTER])
 			while (!go[MASTER])
@@ -268,7 +268,7 @@ static void smp_synchronize_one_tick(int cpu)
 			membar_safe("#StoreLoad");
 			membar_safe("#StoreLoad");
 		}
 		}
 	}
 	}
-	spin_unlock_irqrestore(&itc_sync_lock, flags);
+	raw_spin_unlock_irqrestore(&itc_sync_lock, flags);
 }
 }
 
 
 #if defined(CONFIG_SUN_LDOMS) && defined(CONFIG_HOTPLUG_CPU)
 #if defined(CONFIG_SUN_LDOMS) && defined(CONFIG_HOTPLUG_CPU)

+ 1 - 1
arch/sparc/kernel/sys32.S

@@ -44,7 +44,7 @@ SIGN1(sys32_timer_settime, compat_sys_timer_settime, %o1)
 SIGN1(sys32_io_submit, compat_sys_io_submit, %o1)
 SIGN1(sys32_io_submit, compat_sys_io_submit, %o1)
 SIGN1(sys32_mq_open, compat_sys_mq_open, %o1)
 SIGN1(sys32_mq_open, compat_sys_mq_open, %o1)
 SIGN1(sys32_select, compat_sys_select, %o0)
 SIGN1(sys32_select, compat_sys_select, %o0)
-SIGN3(sys32_futex, compat_sys_futex, %o1, %o2, %o5)
+SIGN1(sys32_futex, compat_sys_futex, %o1)
 SIGN1(sys32_recvfrom, compat_sys_recvfrom, %o0)
 SIGN1(sys32_recvfrom, compat_sys_recvfrom, %o0)
 SIGN1(sys32_recvmsg, compat_sys_recvmsg, %o0)
 SIGN1(sys32_recvmsg, compat_sys_recvmsg, %o0)
 SIGN1(sys32_sendmsg, compat_sys_sendmsg, %o0)
 SIGN1(sys32_sendmsg, compat_sys_sendmsg, %o0)

+ 9 - 3
arch/sparc/kernel/unaligned_64.c

@@ -166,17 +166,23 @@ static unsigned long *fetch_reg_addr(unsigned int reg, struct pt_regs *regs)
 unsigned long compute_effective_address(struct pt_regs *regs,
 unsigned long compute_effective_address(struct pt_regs *regs,
 					unsigned int insn, unsigned int rd)
 					unsigned int insn, unsigned int rd)
 {
 {
+	int from_kernel = (regs->tstate & TSTATE_PRIV) != 0;
 	unsigned int rs1 = (insn >> 14) & 0x1f;
 	unsigned int rs1 = (insn >> 14) & 0x1f;
 	unsigned int rs2 = insn & 0x1f;
 	unsigned int rs2 = insn & 0x1f;
-	int from_kernel = (regs->tstate & TSTATE_PRIV) != 0;
+	unsigned long addr;
 
 
 	if (insn & 0x2000) {
 	if (insn & 0x2000) {
 		maybe_flush_windows(rs1, 0, rd, from_kernel);
 		maybe_flush_windows(rs1, 0, rd, from_kernel);
-		return (fetch_reg(rs1, regs) + sign_extend_imm13(insn));
+		addr = (fetch_reg(rs1, regs) + sign_extend_imm13(insn));
 	} else {
 	} else {
 		maybe_flush_windows(rs1, rs2, rd, from_kernel);
 		maybe_flush_windows(rs1, rs2, rd, from_kernel);
-		return (fetch_reg(rs1, regs) + fetch_reg(rs2, regs));
+		addr = (fetch_reg(rs1, regs) + fetch_reg(rs2, regs));
 	}
 	}
+
+	if (!from_kernel && test_thread_flag(TIF_32BIT))
+		addr &= 0xffffffff;
+
+	return addr;
 }
 }
 
 
 /* This is just to make gcc think die_if_kernel does return... */
 /* This is just to make gcc think die_if_kernel does return... */

+ 52 - 30
arch/sparc/mm/fault_64.c

@@ -96,38 +96,51 @@ static unsigned int get_user_insn(unsigned long tpc)
 	pte_t *ptep, pte;
 	pte_t *ptep, pte;
 	unsigned long pa;
 	unsigned long pa;
 	u32 insn = 0;
 	u32 insn = 0;
-	unsigned long pstate;
 
 
-	if (pgd_none(*pgdp))
-		goto outret;
+	if (pgd_none(*pgdp) || unlikely(pgd_bad(*pgdp)))
+		goto out;
 	pudp = pud_offset(pgdp, tpc);
 	pudp = pud_offset(pgdp, tpc);
-	if (pud_none(*pudp))
-		goto outret;
-	pmdp = pmd_offset(pudp, tpc);
-	if (pmd_none(*pmdp))
-		goto outret;
+	if (pud_none(*pudp) || unlikely(pud_bad(*pudp)))
+		goto out;
 
 
 	/* This disables preemption for us as well. */
 	/* This disables preemption for us as well. */
-	__asm__ __volatile__("rdpr %%pstate, %0" : "=r" (pstate));
-	__asm__ __volatile__("wrpr %0, %1, %%pstate"
-				: : "r" (pstate), "i" (PSTATE_IE));
-	ptep = pte_offset_map(pmdp, tpc);
-	pte = *ptep;
-	if (!pte_present(pte))
-		goto out;
+	local_irq_disable();
 
 
-	pa  = (pte_pfn(pte) << PAGE_SHIFT);
-	pa += (tpc & ~PAGE_MASK);
+	pmdp = pmd_offset(pudp, tpc);
+	if (pmd_none(*pmdp) || unlikely(pmd_bad(*pmdp)))
+		goto out_irq_enable;
+
+#ifdef CONFIG_TRANSPARENT_HUGEPAGE
+	if (pmd_trans_huge(*pmdp)) {
+		if (pmd_trans_splitting(*pmdp))
+			goto out_irq_enable;
 
 
-	/* Use phys bypass so we don't pollute dtlb/dcache. */
-	__asm__ __volatile__("lduwa [%1] %2, %0"
-			     : "=r" (insn)
-			     : "r" (pa), "i" (ASI_PHYS_USE_EC));
+		pa  = pmd_pfn(*pmdp) << PAGE_SHIFT;
+		pa += tpc & ~HPAGE_MASK;
 
 
+		/* Use phys bypass so we don't pollute dtlb/dcache. */
+		__asm__ __volatile__("lduwa [%1] %2, %0"
+				     : "=r" (insn)
+				     : "r" (pa), "i" (ASI_PHYS_USE_EC));
+	} else
+#endif
+	{
+		ptep = pte_offset_map(pmdp, tpc);
+		pte = *ptep;
+		if (pte_present(pte)) {
+			pa  = (pte_pfn(pte) << PAGE_SHIFT);
+			pa += (tpc & ~PAGE_MASK);
+
+			/* Use phys bypass so we don't pollute dtlb/dcache. */
+			__asm__ __volatile__("lduwa [%1] %2, %0"
+					     : "=r" (insn)
+					     : "r" (pa), "i" (ASI_PHYS_USE_EC));
+		}
+		pte_unmap(ptep);
+	}
+out_irq_enable:
+	local_irq_enable();
 out:
 out:
-	pte_unmap(ptep);
-	__asm__ __volatile__("wrpr %0, 0x0, %%pstate" : : "r" (pstate));
-outret:
 	return insn;
 	return insn;
 }
 }
 
 
@@ -153,7 +166,8 @@ show_signal_msg(struct pt_regs *regs, int sig, int code,
 }
 }
 
 
 static void do_fault_siginfo(int code, int sig, struct pt_regs *regs,
 static void do_fault_siginfo(int code, int sig, struct pt_regs *regs,
-			     unsigned int insn, int fault_code)
+			     unsigned long fault_addr, unsigned int insn,
+			     int fault_code)
 {
 {
 	unsigned long addr;
 	unsigned long addr;
 	siginfo_t info;
 	siginfo_t info;
@@ -161,10 +175,18 @@ static void do_fault_siginfo(int code, int sig, struct pt_regs *regs,
 	info.si_code = code;
 	info.si_code = code;
 	info.si_signo = sig;
 	info.si_signo = sig;
 	info.si_errno = 0;
 	info.si_errno = 0;
-	if (fault_code & FAULT_CODE_ITLB)
+	if (fault_code & FAULT_CODE_ITLB) {
 		addr = regs->tpc;
 		addr = regs->tpc;
-	else
-		addr = compute_effective_address(regs, insn, 0);
+	} else {
+		/* If we were able to probe the faulting instruction, use it
+		 * to compute a precise fault address.  Otherwise use the fault
+		 * time provided address which may only have page granularity.
+		 */
+		if (insn)
+			addr = compute_effective_address(regs, insn, 0);
+		else
+			addr = fault_addr;
+	}
 	info.si_addr = (void __user *) addr;
 	info.si_addr = (void __user *) addr;
 	info.si_trapno = 0;
 	info.si_trapno = 0;
 
 
@@ -239,7 +261,7 @@ static void __kprobes do_kernel_fault(struct pt_regs *regs, int si_code,
 		/* The si_code was set to make clear whether
 		/* The si_code was set to make clear whether
 		 * this was a SEGV_MAPERR or SEGV_ACCERR fault.
 		 * this was a SEGV_MAPERR or SEGV_ACCERR fault.
 		 */
 		 */
-		do_fault_siginfo(si_code, SIGSEGV, regs, insn, fault_code);
+		do_fault_siginfo(si_code, SIGSEGV, regs, address, insn, fault_code);
 		return;
 		return;
 	}
 	}
 
 
@@ -525,7 +547,7 @@ do_sigbus:
 	 * Send a sigbus, regardless of whether we were in kernel
 	 * Send a sigbus, regardless of whether we were in kernel
 	 * or user mode.
 	 * or user mode.
 	 */
 	 */
-	do_fault_siginfo(BUS_ADRERR, SIGBUS, regs, insn, fault_code);
+	do_fault_siginfo(BUS_ADRERR, SIGBUS, regs, address, insn, fault_code);
 
 
 	/* Kernel mode? Handle exceptions or die */
 	/* Kernel mode? Handle exceptions or die */
 	if (regs->tstate & TSTATE_PRIV)
 	if (regs->tstate & TSTATE_PRIV)

+ 1 - 1
arch/sparc/mm/gup.c

@@ -73,7 +73,7 @@ static int gup_huge_pmd(pmd_t *pmdp, pmd_t pmd, unsigned long addr,
 	struct page *head, *page, *tail;
 	struct page *head, *page, *tail;
 	int refs;
 	int refs;
 
 
-	if (!pmd_large(pmd))
+	if (!(pmd_val(pmd) & _PAGE_VALID))
 		return 0;
 		return 0;
 
 
 	if (write && !pmd_write(pmd))
 	if (write && !pmd_write(pmd))

+ 6 - 6
arch/sparc/mm/init_64.c

@@ -588,7 +588,7 @@ static void __init remap_kernel(void)
 	int i, tlb_ent = sparc64_highest_locked_tlbent();
 	int i, tlb_ent = sparc64_highest_locked_tlbent();
 
 
 	tte_vaddr = (unsigned long) KERNBASE;
 	tte_vaddr = (unsigned long) KERNBASE;
-	phys_page = (prom_boot_mapping_phys_low >> 22UL) << 22UL;
+	phys_page = (prom_boot_mapping_phys_low >> ILOG2_4MB) << ILOG2_4MB;
 	tte_data = kern_large_tte(phys_page);
 	tte_data = kern_large_tte(phys_page);
 
 
 	kern_locked_tte_data = tte_data;
 	kern_locked_tte_data = tte_data;
@@ -1881,7 +1881,7 @@ void __init paging_init(void)
 
 
 	BUILD_BUG_ON(NR_CPUS > 4096);
 	BUILD_BUG_ON(NR_CPUS > 4096);
 
 
-	kern_base = (prom_boot_mapping_phys_low >> 22UL) << 22UL;
+	kern_base = (prom_boot_mapping_phys_low >> ILOG2_4MB) << ILOG2_4MB;
 	kern_size = (unsigned long)&_end - (unsigned long)KERNBASE;
 	kern_size = (unsigned long)&_end - (unsigned long)KERNBASE;
 
 
 	/* Invalidate both kernel TSBs.  */
 	/* Invalidate both kernel TSBs.  */
@@ -1937,7 +1937,7 @@ void __init paging_init(void)
 	shift = kern_base + PAGE_OFFSET - ((unsigned long)KERNBASE);
 	shift = kern_base + PAGE_OFFSET - ((unsigned long)KERNBASE);
 
 
 	real_end = (unsigned long)_end;
 	real_end = (unsigned long)_end;
-	num_kernel_image_mappings = DIV_ROUND_UP(real_end - KERNBASE, 1 << 22);
+	num_kernel_image_mappings = DIV_ROUND_UP(real_end - KERNBASE, 1 << ILOG2_4MB);
 	printk("Kernel: Using %d locked TLB entries for main kernel image.\n",
 	printk("Kernel: Using %d locked TLB entries for main kernel image.\n",
 	       num_kernel_image_mappings);
 	       num_kernel_image_mappings);
 
 
@@ -2094,7 +2094,7 @@ static void __init setup_valid_addr_bitmap_from_pavail(unsigned long *bitmap)
 
 
 				if (new_start <= old_start &&
 				if (new_start <= old_start &&
 				    new_end >= (old_start + PAGE_SIZE)) {
 				    new_end >= (old_start + PAGE_SIZE)) {
-					set_bit(old_start >> 22, bitmap);
+					set_bit(old_start >> ILOG2_4MB, bitmap);
 					goto do_next_page;
 					goto do_next_page;
 				}
 				}
 			}
 			}
@@ -2143,7 +2143,7 @@ void __init mem_init(void)
 	addr = PAGE_OFFSET + kern_base;
 	addr = PAGE_OFFSET + kern_base;
 	last = PAGE_ALIGN(kern_size) + addr;
 	last = PAGE_ALIGN(kern_size) + addr;
 	while (addr < last) {
 	while (addr < last) {
-		set_bit(__pa(addr) >> 22, sparc64_valid_addr_bitmap);
+		set_bit(__pa(addr) >> ILOG2_4MB, sparc64_valid_addr_bitmap);
 		addr += PAGE_SIZE;
 		addr += PAGE_SIZE;
 	}
 	}
 
 
@@ -2267,7 +2267,7 @@ int __meminit vmemmap_populate(unsigned long vstart, unsigned long vend,
 		void *block;
 		void *block;
 
 
 		if (!(*vmem_pp & _PAGE_VALID)) {
 		if (!(*vmem_pp & _PAGE_VALID)) {
-			block = vmemmap_alloc_block(1UL << 22, node);
+			block = vmemmap_alloc_block(1UL << ILOG2_4MB, node);
 			if (!block)
 			if (!block)
 				return -ENOMEM;
 				return -ENOMEM;
 
 

+ 20 - 6
arch/sparc/mm/tlb.c

@@ -134,7 +134,7 @@ no_cache_flush:
 
 
 #ifdef CONFIG_TRANSPARENT_HUGEPAGE
 #ifdef CONFIG_TRANSPARENT_HUGEPAGE
 static void tlb_batch_pmd_scan(struct mm_struct *mm, unsigned long vaddr,
 static void tlb_batch_pmd_scan(struct mm_struct *mm, unsigned long vaddr,
-			       pmd_t pmd, bool exec)
+			       pmd_t pmd)
 {
 {
 	unsigned long end;
 	unsigned long end;
 	pte_t *pte;
 	pte_t *pte;
@@ -142,8 +142,11 @@ static void tlb_batch_pmd_scan(struct mm_struct *mm, unsigned long vaddr,
 	pte = pte_offset_map(&pmd, vaddr);
 	pte = pte_offset_map(&pmd, vaddr);
 	end = vaddr + HPAGE_SIZE;
 	end = vaddr + HPAGE_SIZE;
 	while (vaddr < end) {
 	while (vaddr < end) {
-		if (pte_val(*pte) & _PAGE_VALID)
+		if (pte_val(*pte) & _PAGE_VALID) {
+			bool exec = pte_exec(*pte);
+
 			tlb_batch_add_one(mm, vaddr, exec);
 			tlb_batch_add_one(mm, vaddr, exec);
+		}
 		pte++;
 		pte++;
 		vaddr += PAGE_SIZE;
 		vaddr += PAGE_SIZE;
 	}
 	}
@@ -177,19 +180,30 @@ void set_pmd_at(struct mm_struct *mm, unsigned long addr,
 	}
 	}
 
 
 	if (!pmd_none(orig)) {
 	if (!pmd_none(orig)) {
-		pte_t orig_pte = __pte(pmd_val(orig));
-		bool exec = pte_exec(orig_pte);
-
 		addr &= HPAGE_MASK;
 		addr &= HPAGE_MASK;
 		if (pmd_trans_huge(orig)) {
 		if (pmd_trans_huge(orig)) {
+			pte_t orig_pte = __pte(pmd_val(orig));
+			bool exec = pte_exec(orig_pte);
+
 			tlb_batch_add_one(mm, addr, exec);
 			tlb_batch_add_one(mm, addr, exec);
 			tlb_batch_add_one(mm, addr + REAL_HPAGE_SIZE, exec);
 			tlb_batch_add_one(mm, addr + REAL_HPAGE_SIZE, exec);
 		} else {
 		} else {
-			tlb_batch_pmd_scan(mm, addr, orig, exec);
+			tlb_batch_pmd_scan(mm, addr, orig);
 		}
 		}
 	}
 	}
 }
 }
 
 
+void pmdp_invalidate(struct vm_area_struct *vma, unsigned long address,
+		     pmd_t *pmdp)
+{
+	pmd_t entry = *pmdp;
+
+	pmd_val(entry) &= ~_PAGE_VALID;
+
+	set_pmd_at(vma->vm_mm, address, pmdp, entry);
+	flush_tlb_range(vma, address, address + HPAGE_PMD_SIZE);
+}
+
 void pgtable_trans_huge_deposit(struct mm_struct *mm, pmd_t *pmdp,
 void pgtable_trans_huge_deposit(struct mm_struct *mm, pmd_t *pmdp,
 				pgtable_t pgtable)
 				pgtable_t pgtable)
 {
 {

+ 21 - 4
arch/x86/Kconfig

@@ -909,10 +909,27 @@ config VM86
 	default y
 	default y
 	depends on X86_32
 	depends on X86_32
 	---help---
 	---help---
-	  This option is required by programs like DOSEMU to run 16-bit legacy
-	  code on X86 processors. It also may be needed by software like
-	  XFree86 to initialize some video cards via BIOS. Disabling this
-	  option saves about 6k.
+	  This option is required by programs like DOSEMU to run
+	  16-bit real mode legacy code on x86 processors. It also may
+	  be needed by software like XFree86 to initialize some video
+	  cards via BIOS. Disabling this option saves about 6K.
+
+config X86_16BIT
+	bool "Enable support for 16-bit segments" if EXPERT
+	default y
+	---help---
+	  This option is required by programs like Wine to run 16-bit
+	  protected mode legacy code on x86 processors.  Disabling
+	  this option saves about 300 bytes on i386, or around 6K text
+	  plus 16K runtime memory on x86-64,
+
+config X86_ESPFIX32
+	def_bool y
+	depends on X86_16BIT && X86_32
+
+config X86_ESPFIX64
+	def_bool y
+	depends on X86_16BIT && X86_64
 
 
 config TOSHIBA
 config TOSHIBA
 	tristate "Toshiba Laptop support"
 	tristate "Toshiba Laptop support"

+ 1 - 0
arch/x86/Makefile

@@ -79,6 +79,7 @@ else
         UTS_MACHINE := x86_64
         UTS_MACHINE := x86_64
         CHECKFLAGS += -D__x86_64__ -m64
         CHECKFLAGS += -D__x86_64__ -m64
 
 
+        biarch := -m64
         KBUILD_AFLAGS += -m64
         KBUILD_AFLAGS += -m64
         KBUILD_CFLAGS += -m64
         KBUILD_CFLAGS += -m64
 
 

+ 2 - 2
arch/x86/boot/Makefile

@@ -71,7 +71,7 @@ $(obj)/vmlinux.bin: $(obj)/compressed/vmlinux FORCE
 
 
 SETUP_OBJS = $(addprefix $(obj)/,$(setup-y))
 SETUP_OBJS = $(addprefix $(obj)/,$(setup-y))
 
 
-sed-voffset := -e 's/^\([0-9a-fA-F]*\) . \(_text\|_end\)$$/\#define VO_\2 0x\1/p'
+sed-voffset := -e 's/^\([0-9a-fA-F]*\) [ABCDGRSTVW] \(_text\|_end\)$$/\#define VO_\2 0x\1/p'
 
 
 quiet_cmd_voffset = VOFFSET $@
 quiet_cmd_voffset = VOFFSET $@
       cmd_voffset = $(NM) $< | sed -n $(sed-voffset) > $@
       cmd_voffset = $(NM) $< | sed -n $(sed-voffset) > $@
@@ -80,7 +80,7 @@ targets += voffset.h
 $(obj)/voffset.h: vmlinux FORCE
 $(obj)/voffset.h: vmlinux FORCE
 	$(call if_changed,voffset)
 	$(call if_changed,voffset)
 
 
-sed-zoffset := -e 's/^\([0-9a-fA-F]*\) . \(startup_32\|startup_64\|efi32_stub_entry\|efi64_stub_entry\|efi_pe_entry\|input_data\|_end\|z_.*\)$$/\#define ZO_\2 0x\1/p'
+sed-zoffset := -e 's/^\([0-9a-fA-F]*\) [ABCDGRSTVW] \(startup_32\|startup_64\|efi32_stub_entry\|efi64_stub_entry\|efi_pe_entry\|input_data\|_end\|z_.*\)$$/\#define ZO_\2 0x\1/p'
 
 
 quiet_cmd_zoffset = ZOFFSET $@
 quiet_cmd_zoffset = ZOFFSET $@
       cmd_zoffset = $(NM) $< | sed -n $(sed-zoffset) > $@
       cmd_zoffset = $(NM) $< | sed -n $(sed-zoffset) > $@

+ 1 - 1
arch/x86/boot/compressed/misc.c

@@ -354,7 +354,7 @@ static void parse_elf(void *output)
 	free(phdrs);
 	free(phdrs);
 }
 }
 
 
-asmlinkage void *decompress_kernel(void *rmode, memptr heap,
+asmlinkage __visible void *decompress_kernel(void *rmode, memptr heap,
 				  unsigned char *input_data,
 				  unsigned char *input_data,
 				  unsigned long input_len,
 				  unsigned long input_len,
 				  unsigned char *output,
 				  unsigned char *output,

+ 16 - 0
arch/x86/include/asm/espfix.h

@@ -0,0 +1,16 @@
+#ifndef _ASM_X86_ESPFIX_H
+#define _ASM_X86_ESPFIX_H
+
+#ifdef CONFIG_X86_64
+
+#include <asm/percpu.h>
+
+DECLARE_PER_CPU_READ_MOSTLY(unsigned long, espfix_stack);
+DECLARE_PER_CPU_READ_MOSTLY(unsigned long, espfix_waddr);
+
+extern void init_espfix_bsp(void);
+extern void init_espfix_ap(void);
+
+#endif /* CONFIG_X86_64 */
+
+#endif /* _ASM_X86_ESPFIX_H */

+ 1 - 0
arch/x86/include/asm/hpet.h

@@ -63,6 +63,7 @@
 /* hpet memory map physical address */
 /* hpet memory map physical address */
 extern unsigned long hpet_address;
 extern unsigned long hpet_address;
 extern unsigned long force_hpet_address;
 extern unsigned long force_hpet_address;
+extern int boot_hpet_disable;
 extern u8 hpet_blockid;
 extern u8 hpet_blockid;
 extern int hpet_force_user;
 extern int hpet_force_user;
 extern u8 hpet_msi_disable;
 extern u8 hpet_msi_disable;

+ 1 - 0
arch/x86/include/asm/hugetlb.h

@@ -52,6 +52,7 @@ static inline pte_t huge_ptep_get_and_clear(struct mm_struct *mm,
 static inline void huge_ptep_clear_flush(struct vm_area_struct *vma,
 static inline void huge_ptep_clear_flush(struct vm_area_struct *vma,
 					 unsigned long addr, pte_t *ptep)
 					 unsigned long addr, pte_t *ptep)
 {
 {
+	ptep_clear_flush(vma, addr, ptep);
 }
 }
 
 
 static inline int huge_pte_none(pte_t pte)
 static inline int huge_pte_none(pte_t pte)

+ 2 - 0
arch/x86/include/asm/pgtable_64_types.h

@@ -61,6 +61,8 @@ typedef struct { pteval_t pte; } pte_t;
 #define MODULES_VADDR    (__START_KERNEL_map + KERNEL_IMAGE_SIZE)
 #define MODULES_VADDR    (__START_KERNEL_map + KERNEL_IMAGE_SIZE)
 #define MODULES_END      _AC(0xffffffffff000000, UL)
 #define MODULES_END      _AC(0xffffffffff000000, UL)
 #define MODULES_LEN   (MODULES_END - MODULES_VADDR)
 #define MODULES_LEN   (MODULES_END - MODULES_VADDR)
+#define ESPFIX_PGD_ENTRY _AC(-2, UL)
+#define ESPFIX_BASE_ADDR (ESPFIX_PGD_ENTRY << PGDIR_SHIFT)
 
 
 #define EARLY_DYNAMIC_PAGE_TABLES	64
 #define EARLY_DYNAMIC_PAGE_TABLES	64
 
 

+ 2 - 0
arch/x86/include/asm/setup.h

@@ -59,6 +59,8 @@ static inline void x86_ce4100_early_setup(void) { }
 
 
 #ifndef _SETUP
 #ifndef _SETUP
 
 
+#include <asm/espfix.h>
+
 /*
 /*
  * This is set up by the setup-routine at boot-time
  * This is set up by the setup-routine at boot-time
  */
  */

+ 1 - 1
arch/x86/include/uapi/asm/msr-index.h

@@ -384,7 +384,7 @@
 #define MSR_IA32_MISC_ENABLE_MWAIT_BIT			18
 #define MSR_IA32_MISC_ENABLE_MWAIT_BIT			18
 #define MSR_IA32_MISC_ENABLE_MWAIT			(1ULL << MSR_IA32_MISC_ENABLE_MWAIT_BIT)
 #define MSR_IA32_MISC_ENABLE_MWAIT			(1ULL << MSR_IA32_MISC_ENABLE_MWAIT_BIT)
 #define MSR_IA32_MISC_ENABLE_LIMIT_CPUID_BIT		22
 #define MSR_IA32_MISC_ENABLE_LIMIT_CPUID_BIT		22
-#define MSR_IA32_MISC_ENABLE_LIMIT_CPUID		(1ULL << MSR_IA32_MISC_ENABLE_LIMIT_CPUID_BIT);
+#define MSR_IA32_MISC_ENABLE_LIMIT_CPUID		(1ULL << MSR_IA32_MISC_ENABLE_LIMIT_CPUID_BIT)
 #define MSR_IA32_MISC_ENABLE_XTPR_DISABLE_BIT		23
 #define MSR_IA32_MISC_ENABLE_XTPR_DISABLE_BIT		23
 #define MSR_IA32_MISC_ENABLE_XTPR_DISABLE		(1ULL << MSR_IA32_MISC_ENABLE_XTPR_DISABLE_BIT)
 #define MSR_IA32_MISC_ENABLE_XTPR_DISABLE		(1ULL << MSR_IA32_MISC_ENABLE_XTPR_DISABLE_BIT)
 #define MSR_IA32_MISC_ENABLE_XD_DISABLE_BIT		34
 #define MSR_IA32_MISC_ENABLE_XD_DISABLE_BIT		34

+ 1 - 0
arch/x86/kernel/Makefile

@@ -29,6 +29,7 @@ obj-$(CONFIG_X86_64)	+= sys_x86_64.o x8664_ksyms_64.o
 obj-y			+= syscall_$(BITS).o vsyscall_gtod.o
 obj-y			+= syscall_$(BITS).o vsyscall_gtod.o
 obj-$(CONFIG_X86_64)	+= vsyscall_64.o
 obj-$(CONFIG_X86_64)	+= vsyscall_64.o
 obj-$(CONFIG_X86_64)	+= vsyscall_emu_64.o
 obj-$(CONFIG_X86_64)	+= vsyscall_emu_64.o
+obj-$(CONFIG_X86_ESPFIX64)	+= espfix_64.o
 obj-$(CONFIG_SYSFS)	+= ksysfs.o
 obj-$(CONFIG_SYSFS)	+= ksysfs.o
 obj-y			+= bootflag.o e820.o
 obj-y			+= bootflag.o e820.o
 obj-y			+= pci-dma.o quirks.o topology.o kdebugfs.o
 obj-y			+= pci-dma.o quirks.o topology.o kdebugfs.o

+ 1 - 1
arch/x86/kernel/acpi/sleep.c

@@ -31,7 +31,7 @@ static char temp_stack[4096];
  *
  *
  * Wrapper around acpi_enter_sleep_state() to be called by assmebly.
  * Wrapper around acpi_enter_sleep_state() to be called by assmebly.
  */
  */
-acpi_status asmlinkage x86_acpi_enter_sleep_state(u8 state)
+acpi_status asmlinkage __visible x86_acpi_enter_sleep_state(u8 state)
 {
 {
 	return acpi_enter_sleep_state(state);
 	return acpi_enter_sleep_state(state);
 }
 }

+ 1 - 1
arch/x86/kernel/apic/io_apic.c

@@ -2189,7 +2189,7 @@ void send_cleanup_vector(struct irq_cfg *cfg)
 	cfg->move_in_progress = 0;
 	cfg->move_in_progress = 0;
 }
 }
 
 
-asmlinkage void smp_irq_move_cleanup_interrupt(void)
+asmlinkage __visible void smp_irq_move_cleanup_interrupt(void)
 {
 {
 	unsigned vector, me;
 	unsigned vector, me;
 
 

+ 2 - 2
arch/x86/kernel/cpu/mcheck/therm_throt.c

@@ -429,14 +429,14 @@ static inline void __smp_thermal_interrupt(void)
 	smp_thermal_vector();
 	smp_thermal_vector();
 }
 }
 
 
-asmlinkage void smp_thermal_interrupt(struct pt_regs *regs)
+asmlinkage __visible void smp_thermal_interrupt(struct pt_regs *regs)
 {
 {
 	entering_irq();
 	entering_irq();
 	__smp_thermal_interrupt();
 	__smp_thermal_interrupt();
 	exiting_ack_irq();
 	exiting_ack_irq();
 }
 }
 
 
-asmlinkage void smp_trace_thermal_interrupt(struct pt_regs *regs)
+asmlinkage __visible void smp_trace_thermal_interrupt(struct pt_regs *regs)
 {
 {
 	entering_irq();
 	entering_irq();
 	trace_thermal_apic_entry(THERMAL_APIC_VECTOR);
 	trace_thermal_apic_entry(THERMAL_APIC_VECTOR);

+ 2 - 2
arch/x86/kernel/cpu/mcheck/threshold.c

@@ -24,14 +24,14 @@ static inline void __smp_threshold_interrupt(void)
 	mce_threshold_vector();
 	mce_threshold_vector();
 }
 }
 
 
-asmlinkage void smp_threshold_interrupt(void)
+asmlinkage __visible void smp_threshold_interrupt(void)
 {
 {
 	entering_irq();
 	entering_irq();
 	__smp_threshold_interrupt();
 	__smp_threshold_interrupt();
 	exiting_ack_irq();
 	exiting_ack_irq();
 }
 }
 
 
-asmlinkage void smp_trace_threshold_interrupt(void)
+asmlinkage __visible void smp_trace_threshold_interrupt(void)
 {
 {
 	entering_irq();
 	entering_irq();
 	trace_threshold_apic_entry(THRESHOLD_APIC_VECTOR);
 	trace_threshold_apic_entry(THRESHOLD_APIC_VECTOR);

+ 1 - 0
arch/x86/kernel/cpu/rdrand.c

@@ -27,6 +27,7 @@
 static int __init x86_rdrand_setup(char *s)
 static int __init x86_rdrand_setup(char *s)
 {
 {
 	setup_clear_cpu_cap(X86_FEATURE_RDRAND);
 	setup_clear_cpu_cap(X86_FEATURE_RDRAND);
+	setup_clear_cpu_cap(X86_FEATURE_RDSEED);
 	return 1;
 	return 1;
 }
 }
 __setup("nordrand", x86_rdrand_setup);
 __setup("nordrand", x86_rdrand_setup);

+ 16 - 0
arch/x86/kernel/early-quirks.c

@@ -17,6 +17,7 @@
 #include <asm/dma.h>
 #include <asm/dma.h>
 #include <asm/io_apic.h>
 #include <asm/io_apic.h>
 #include <asm/apic.h>
 #include <asm/apic.h>
+#include <asm/hpet.h>
 #include <asm/iommu.h>
 #include <asm/iommu.h>
 #include <asm/gart.h>
 #include <asm/gart.h>
 #include <asm/irq_remapping.h>
 #include <asm/irq_remapping.h>
@@ -530,6 +531,15 @@ static void __init intel_graphics_stolen(int num, int slot, int func)
 	}
 	}
 }
 }
 
 
+static void __init force_disable_hpet(int num, int slot, int func)
+{
+#ifdef CONFIG_HPET_TIMER
+	boot_hpet_disable = 1;
+	pr_info("x86/hpet: Will disable the HPET for this platform because it's not reliable\n");
+#endif
+}
+
+
 #define QFLAG_APPLY_ONCE 	0x1
 #define QFLAG_APPLY_ONCE 	0x1
 #define QFLAG_APPLIED		0x2
 #define QFLAG_APPLIED		0x2
 #define QFLAG_DONE		(QFLAG_APPLY_ONCE|QFLAG_APPLIED)
 #define QFLAG_DONE		(QFLAG_APPLY_ONCE|QFLAG_APPLIED)
@@ -567,6 +577,12 @@ static struct chipset early_qrk[] __initdata = {
 	  PCI_BASE_CLASS_BRIDGE, 0, intel_remapping_check },
 	  PCI_BASE_CLASS_BRIDGE, 0, intel_remapping_check },
 	{ PCI_VENDOR_ID_INTEL, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA, PCI_ANY_ID,
 	{ PCI_VENDOR_ID_INTEL, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA, PCI_ANY_ID,
 	  QFLAG_APPLY_ONCE, intel_graphics_stolen },
 	  QFLAG_APPLY_ONCE, intel_graphics_stolen },
+	/*
+	 * HPET on current version of Baytrail platform has accuracy
+	 * problems, disable it for now:
+	 */
+	{ PCI_VENDOR_ID_INTEL, 0x0f00,
+		PCI_CLASS_BRIDGE_HOST, PCI_ANY_ID, 0, force_disable_hpet},
 	{}
 	{}
 };
 };
 
 

+ 12 - 5
arch/x86/kernel/entry_32.S

@@ -527,6 +527,7 @@ syscall_exit:
 restore_all:
 restore_all:
 	TRACE_IRQS_IRET
 	TRACE_IRQS_IRET
 restore_all_notrace:
 restore_all_notrace:
+#ifdef CONFIG_X86_ESPFIX32
 	movl PT_EFLAGS(%esp), %eax	# mix EFLAGS, SS and CS
 	movl PT_EFLAGS(%esp), %eax	# mix EFLAGS, SS and CS
 	# Warning: PT_OLDSS(%esp) contains the wrong/random values if we
 	# Warning: PT_OLDSS(%esp) contains the wrong/random values if we
 	# are returning to the kernel.
 	# are returning to the kernel.
@@ -537,6 +538,7 @@ restore_all_notrace:
 	cmpl $((SEGMENT_LDT << 8) | USER_RPL), %eax
 	cmpl $((SEGMENT_LDT << 8) | USER_RPL), %eax
 	CFI_REMEMBER_STATE
 	CFI_REMEMBER_STATE
 	je ldt_ss			# returning to user-space with LDT SS
 	je ldt_ss			# returning to user-space with LDT SS
+#endif
 restore_nocheck:
 restore_nocheck:
 	RESTORE_REGS 4			# skip orig_eax/error_code
 	RESTORE_REGS 4			# skip orig_eax/error_code
 irq_return:
 irq_return:
@@ -549,13 +551,9 @@ ENTRY(iret_exc)
 .previous
 .previous
 	_ASM_EXTABLE(irq_return,iret_exc)
 	_ASM_EXTABLE(irq_return,iret_exc)
 
 
+#ifdef CONFIG_X86_ESPFIX32
 	CFI_RESTORE_STATE
 	CFI_RESTORE_STATE
 ldt_ss:
 ldt_ss:
-	larl PT_OLDSS(%esp), %eax
-	jnz restore_nocheck
-	testl $0x00400000, %eax		# returning to 32bit stack?
-	jnz restore_nocheck		# allright, normal return
-
 #ifdef CONFIG_PARAVIRT
 #ifdef CONFIG_PARAVIRT
 	/*
 	/*
 	 * The kernel can't run on a non-flat stack if paravirt mode
 	 * The kernel can't run on a non-flat stack if paravirt mode
@@ -597,6 +595,7 @@ ldt_ss:
 	lss (%esp), %esp		/* switch to espfix segment */
 	lss (%esp), %esp		/* switch to espfix segment */
 	CFI_ADJUST_CFA_OFFSET -8
 	CFI_ADJUST_CFA_OFFSET -8
 	jmp restore_nocheck
 	jmp restore_nocheck
+#endif
 	CFI_ENDPROC
 	CFI_ENDPROC
 ENDPROC(system_call)
 ENDPROC(system_call)
 
 
@@ -704,6 +703,7 @@ END(syscall_badsys)
  * the high word of the segment base from the GDT and swiches to the
  * the high word of the segment base from the GDT and swiches to the
  * normal stack and adjusts ESP with the matching offset.
  * normal stack and adjusts ESP with the matching offset.
  */
  */
+#ifdef CONFIG_X86_ESPFIX32
 	/* fixup the stack */
 	/* fixup the stack */
 	mov GDT_ESPFIX_SS + 4, %al /* bits 16..23 */
 	mov GDT_ESPFIX_SS + 4, %al /* bits 16..23 */
 	mov GDT_ESPFIX_SS + 7, %ah /* bits 24..31 */
 	mov GDT_ESPFIX_SS + 7, %ah /* bits 24..31 */
@@ -713,8 +713,10 @@ END(syscall_badsys)
 	pushl_cfi %eax
 	pushl_cfi %eax
 	lss (%esp), %esp		/* switch to the normal stack segment */
 	lss (%esp), %esp		/* switch to the normal stack segment */
 	CFI_ADJUST_CFA_OFFSET -8
 	CFI_ADJUST_CFA_OFFSET -8
+#endif
 .endm
 .endm
 .macro UNWIND_ESPFIX_STACK
 .macro UNWIND_ESPFIX_STACK
+#ifdef CONFIG_X86_ESPFIX32
 	movl %ss, %eax
 	movl %ss, %eax
 	/* see if on espfix stack */
 	/* see if on espfix stack */
 	cmpw $__ESPFIX_SS, %ax
 	cmpw $__ESPFIX_SS, %ax
@@ -725,6 +727,7 @@ END(syscall_badsys)
 	/* switch to normal stack */
 	/* switch to normal stack */
 	FIXUP_ESPFIX_STACK
 	FIXUP_ESPFIX_STACK
 27:
 27:
+#endif
 .endm
 .endm
 
 
 /*
 /*
@@ -1355,11 +1358,13 @@ END(debug)
 ENTRY(nmi)
 ENTRY(nmi)
 	RING0_INT_FRAME
 	RING0_INT_FRAME
 	ASM_CLAC
 	ASM_CLAC
+#ifdef CONFIG_X86_ESPFIX32
 	pushl_cfi %eax
 	pushl_cfi %eax
 	movl %ss, %eax
 	movl %ss, %eax
 	cmpw $__ESPFIX_SS, %ax
 	cmpw $__ESPFIX_SS, %ax
 	popl_cfi %eax
 	popl_cfi %eax
 	je nmi_espfix_stack
 	je nmi_espfix_stack
+#endif
 	cmpl $ia32_sysenter_target,(%esp)
 	cmpl $ia32_sysenter_target,(%esp)
 	je nmi_stack_fixup
 	je nmi_stack_fixup
 	pushl_cfi %eax
 	pushl_cfi %eax
@@ -1399,6 +1404,7 @@ nmi_debug_stack_check:
 	FIX_STACK 24, nmi_stack_correct, 1
 	FIX_STACK 24, nmi_stack_correct, 1
 	jmp nmi_stack_correct
 	jmp nmi_stack_correct
 
 
+#ifdef CONFIG_X86_ESPFIX32
 nmi_espfix_stack:
 nmi_espfix_stack:
 	/* We have a RING0_INT_FRAME here.
 	/* We have a RING0_INT_FRAME here.
 	 *
 	 *
@@ -1420,6 +1426,7 @@ nmi_espfix_stack:
 	lss 12+4(%esp), %esp		# back to espfix stack
 	lss 12+4(%esp), %esp		# back to espfix stack
 	CFI_ADJUST_CFA_OFFSET -24
 	CFI_ADJUST_CFA_OFFSET -24
 	jmp irq_return
 	jmp irq_return
+#endif
 	CFI_ENDPROC
 	CFI_ENDPROC
 END(nmi)
 END(nmi)
 
 

+ 77 - 4
arch/x86/kernel/entry_64.S

@@ -58,6 +58,7 @@
 #include <asm/asm.h>
 #include <asm/asm.h>
 #include <asm/context_tracking.h>
 #include <asm/context_tracking.h>
 #include <asm/smap.h>
 #include <asm/smap.h>
+#include <asm/pgtable_types.h>
 #include <linux/err.h>
 #include <linux/err.h>
 
 
 /* Avoid __ASSEMBLER__'ifying <linux/audit.h> just for this.  */
 /* Avoid __ASSEMBLER__'ifying <linux/audit.h> just for this.  */
@@ -1040,8 +1041,18 @@ restore_args:
 	RESTORE_ARGS 1,8,1
 	RESTORE_ARGS 1,8,1
 
 
 irq_return:
 irq_return:
+	/*
+	 * Are we returning to a stack segment from the LDT?  Note: in
+	 * 64-bit mode SS:RSP on the exception stack is always valid.
+	 */
+#ifdef CONFIG_X86_ESPFIX64
+	testb $4,(SS-RIP)(%rsp)
+	jnz irq_return_ldt
+#endif
+
+irq_return_iret:
 	INTERRUPT_RETURN
 	INTERRUPT_RETURN
-	_ASM_EXTABLE(irq_return, bad_iret)
+	_ASM_EXTABLE(irq_return_iret, bad_iret)
 
 
 #ifdef CONFIG_PARAVIRT
 #ifdef CONFIG_PARAVIRT
 ENTRY(native_iret)
 ENTRY(native_iret)
@@ -1049,6 +1060,32 @@ ENTRY(native_iret)
 	_ASM_EXTABLE(native_iret, bad_iret)
 	_ASM_EXTABLE(native_iret, bad_iret)
 #endif
 #endif
 
 
+#ifdef CONFIG_X86_ESPFIX64
+irq_return_ldt:
+	pushq_cfi %rax
+	pushq_cfi %rdi
+	SWAPGS
+	movq PER_CPU_VAR(espfix_waddr),%rdi
+	movq %rax,(0*8)(%rdi)	/* RAX */
+	movq (2*8)(%rsp),%rax	/* RIP */
+	movq %rax,(1*8)(%rdi)
+	movq (3*8)(%rsp),%rax	/* CS */
+	movq %rax,(2*8)(%rdi)
+	movq (4*8)(%rsp),%rax	/* RFLAGS */
+	movq %rax,(3*8)(%rdi)
+	movq (6*8)(%rsp),%rax	/* SS */
+	movq %rax,(5*8)(%rdi)
+	movq (5*8)(%rsp),%rax	/* RSP */
+	movq %rax,(4*8)(%rdi)
+	andl $0xffff0000,%eax
+	popq_cfi %rdi
+	orq PER_CPU_VAR(espfix_stack),%rax
+	SWAPGS
+	movq %rax,%rsp
+	popq_cfi %rax
+	jmp irq_return_iret
+#endif
+
 	.section .fixup,"ax"
 	.section .fixup,"ax"
 bad_iret:
 bad_iret:
 	/*
 	/*
@@ -1110,9 +1147,45 @@ ENTRY(retint_kernel)
 	call preempt_schedule_irq
 	call preempt_schedule_irq
 	jmp exit_intr
 	jmp exit_intr
 #endif
 #endif
-
 	CFI_ENDPROC
 	CFI_ENDPROC
 END(common_interrupt)
 END(common_interrupt)
+
+	/*
+	 * If IRET takes a fault on the espfix stack, then we
+	 * end up promoting it to a doublefault.  In that case,
+	 * modify the stack to make it look like we just entered
+	 * the #GP handler from user space, similar to bad_iret.
+	 */
+#ifdef CONFIG_X86_ESPFIX64
+	ALIGN
+__do_double_fault:
+	XCPT_FRAME 1 RDI+8
+	movq RSP(%rdi),%rax		/* Trap on the espfix stack? */
+	sarq $PGDIR_SHIFT,%rax
+	cmpl $ESPFIX_PGD_ENTRY,%eax
+	jne do_double_fault		/* No, just deliver the fault */
+	cmpl $__KERNEL_CS,CS(%rdi)
+	jne do_double_fault
+	movq RIP(%rdi),%rax
+	cmpq $irq_return_iret,%rax
+#ifdef CONFIG_PARAVIRT
+	je 1f
+	cmpq $native_iret,%rax
+#endif
+	jne do_double_fault		/* This shouldn't happen... */
+1:
+	movq PER_CPU_VAR(kernel_stack),%rax
+	subq $(6*8-KERNEL_STACK_OFFSET),%rax	/* Reset to original stack */
+	movq %rax,RSP(%rdi)
+	movq $0,(%rax)			/* Missing (lost) #GP error code */
+	movq $general_protection,RIP(%rdi)
+	retq
+	CFI_ENDPROC
+END(__do_double_fault)
+#else
+# define __do_double_fault do_double_fault
+#endif
+
 /*
 /*
  * End of kprobes section
  * End of kprobes section
  */
  */
@@ -1314,7 +1387,7 @@ zeroentry overflow do_overflow
 zeroentry bounds do_bounds
 zeroentry bounds do_bounds
 zeroentry invalid_op do_invalid_op
 zeroentry invalid_op do_invalid_op
 zeroentry device_not_available do_device_not_available
 zeroentry device_not_available do_device_not_available
-paranoiderrorentry double_fault do_double_fault
+paranoiderrorentry double_fault __do_double_fault
 zeroentry coprocessor_segment_overrun do_coprocessor_segment_overrun
 zeroentry coprocessor_segment_overrun do_coprocessor_segment_overrun
 errorentry invalid_TSS do_invalid_TSS
 errorentry invalid_TSS do_invalid_TSS
 errorentry segment_not_present do_segment_not_present
 errorentry segment_not_present do_segment_not_present
@@ -1601,7 +1674,7 @@ error_sti:
  */
  */
 error_kernelspace:
 error_kernelspace:
 	incl %ebx
 	incl %ebx
-	leaq irq_return(%rip),%rcx
+	leaq irq_return_iret(%rip),%rcx
 	cmpq %rcx,RIP+8(%rsp)
 	cmpq %rcx,RIP+8(%rsp)
 	je error_swapgs
 	je error_swapgs
 	movl %ecx,%eax	/* zero extend */
 	movl %ecx,%eax	/* zero extend */

+ 209 - 0
arch/x86/kernel/espfix_64.c

@@ -0,0 +1,209 @@
+/* ----------------------------------------------------------------------- *
+ *
+ *   Copyright 2014 Intel Corporation; author: H. Peter Anvin
+ *
+ *   This program is free software; you can redistribute it and/or modify it
+ *   under the terms and conditions of the GNU General Public License,
+ *   version 2, as published by the Free Software Foundation.
+ *
+ *   This program is distributed in the hope it will be useful, but WITHOUT
+ *   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ *   FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+ *   more details.
+ *
+ * ----------------------------------------------------------------------- */
+
+/*
+ * The IRET instruction, when returning to a 16-bit segment, only
+ * restores the bottom 16 bits of the user space stack pointer.  This
+ * causes some 16-bit software to break, but it also leaks kernel state
+ * to user space.
+ *
+ * This works around this by creating percpu "ministacks", each of which
+ * is mapped 2^16 times 64K apart.  When we detect that the return SS is
+ * on the LDT, we copy the IRET frame to the ministack and use the
+ * relevant alias to return to userspace.  The ministacks are mapped
+ * readonly, so if the IRET fault we promote #GP to #DF which is an IST
+ * vector and thus has its own stack; we then do the fixup in the #DF
+ * handler.
+ *
+ * This file sets up the ministacks and the related page tables.  The
+ * actual ministack invocation is in entry_64.S.
+ */
+
+#include <linux/init.h>
+#include <linux/init_task.h>
+#include <linux/kernel.h>
+#include <linux/percpu.h>
+#include <linux/gfp.h>
+#include <linux/random.h>
+#include <asm/pgtable.h>
+#include <asm/pgalloc.h>
+#include <asm/setup.h>
+#include <asm/espfix.h>
+
+/*
+ * Note: we only need 6*8 = 48 bytes for the espfix stack, but round
+ * it up to a cache line to avoid unnecessary sharing.
+ */
+#define ESPFIX_STACK_SIZE	(8*8UL)
+#define ESPFIX_STACKS_PER_PAGE	(PAGE_SIZE/ESPFIX_STACK_SIZE)
+
+/* There is address space for how many espfix pages? */
+#define ESPFIX_PAGE_SPACE	(1UL << (PGDIR_SHIFT-PAGE_SHIFT-16))
+
+#define ESPFIX_MAX_CPUS		(ESPFIX_STACKS_PER_PAGE * ESPFIX_PAGE_SPACE)
+#if CONFIG_NR_CPUS > ESPFIX_MAX_CPUS
+# error "Need more than one PGD for the ESPFIX hack"
+#endif
+
+#define PGALLOC_GFP (GFP_KERNEL | __GFP_NOTRACK | __GFP_REPEAT | __GFP_ZERO)
+
+/* This contains the *bottom* address of the espfix stack */
+DEFINE_PER_CPU_READ_MOSTLY(unsigned long, espfix_stack);
+DEFINE_PER_CPU_READ_MOSTLY(unsigned long, espfix_waddr);
+
+/* Initialization mutex - should this be a spinlock? */
+static DEFINE_MUTEX(espfix_init_mutex);
+
+/* Page allocation bitmap - each page serves ESPFIX_STACKS_PER_PAGE CPUs */
+#define ESPFIX_MAX_PAGES  DIV_ROUND_UP(CONFIG_NR_CPUS, ESPFIX_STACKS_PER_PAGE)
+static void *espfix_pages[ESPFIX_MAX_PAGES];
+
+static __page_aligned_bss pud_t espfix_pud_page[PTRS_PER_PUD]
+	__aligned(PAGE_SIZE);
+
+static unsigned int page_random, slot_random;
+
+/*
+ * This returns the bottom address of the espfix stack for a specific CPU.
+ * The math allows for a non-power-of-two ESPFIX_STACK_SIZE, in which case
+ * we have to account for some amount of padding at the end of each page.
+ */
+static inline unsigned long espfix_base_addr(unsigned int cpu)
+{
+	unsigned long page, slot;
+	unsigned long addr;
+
+	page = (cpu / ESPFIX_STACKS_PER_PAGE) ^ page_random;
+	slot = (cpu + slot_random) % ESPFIX_STACKS_PER_PAGE;
+	addr = (page << PAGE_SHIFT) + (slot * ESPFIX_STACK_SIZE);
+	addr = (addr & 0xffffUL) | ((addr & ~0xffffUL) << 16);
+	addr += ESPFIX_BASE_ADDR;
+	return addr;
+}
+
+#define PTE_STRIDE        (65536/PAGE_SIZE)
+#define ESPFIX_PTE_CLONES (PTRS_PER_PTE/PTE_STRIDE)
+#define ESPFIX_PMD_CLONES PTRS_PER_PMD
+#define ESPFIX_PUD_CLONES (65536/(ESPFIX_PTE_CLONES*ESPFIX_PMD_CLONES))
+
+#define PGTABLE_PROT	  ((_KERNPG_TABLE & ~_PAGE_RW) | _PAGE_NX)
+
+static void init_espfix_random(void)
+{
+	unsigned long rand;
+
+	/*
+	 * This is run before the entropy pools are initialized,
+	 * but this is hopefully better than nothing.
+	 */
+	if (!arch_get_random_long(&rand)) {
+		/* The constant is an arbitrary large prime */
+		rdtscll(rand);
+		rand *= 0xc345c6b72fd16123UL;
+	}
+
+	slot_random = rand % ESPFIX_STACKS_PER_PAGE;
+	page_random = (rand / ESPFIX_STACKS_PER_PAGE)
+		& (ESPFIX_PAGE_SPACE - 1);
+}
+
+void __init init_espfix_bsp(void)
+{
+	pgd_t *pgd_p;
+	pteval_t ptemask;
+
+	ptemask = __supported_pte_mask;
+
+	/* Install the espfix pud into the kernel page directory */
+	pgd_p = &init_level4_pgt[pgd_index(ESPFIX_BASE_ADDR)];
+	pgd_populate(&init_mm, pgd_p, (pud_t *)espfix_pud_page);
+
+	/* Randomize the locations */
+	init_espfix_random();
+
+	/* The rest is the same as for any other processor */
+	init_espfix_ap();
+}
+
+void init_espfix_ap(void)
+{
+	unsigned int cpu, page;
+	unsigned long addr;
+	pud_t pud, *pud_p;
+	pmd_t pmd, *pmd_p;
+	pte_t pte, *pte_p;
+	int n;
+	void *stack_page;
+	pteval_t ptemask;
+
+	/* We only have to do this once... */
+	if (likely(this_cpu_read(espfix_stack)))
+		return;		/* Already initialized */
+
+	cpu = smp_processor_id();
+	addr = espfix_base_addr(cpu);
+	page = cpu/ESPFIX_STACKS_PER_PAGE;
+
+	/* Did another CPU already set this up? */
+	stack_page = ACCESS_ONCE(espfix_pages[page]);
+	if (likely(stack_page))
+		goto done;
+
+	mutex_lock(&espfix_init_mutex);
+
+	/* Did we race on the lock? */
+	stack_page = ACCESS_ONCE(espfix_pages[page]);
+	if (stack_page)
+		goto unlock_done;
+
+	ptemask = __supported_pte_mask;
+
+	pud_p = &espfix_pud_page[pud_index(addr)];
+	pud = *pud_p;
+	if (!pud_present(pud)) {
+		pmd_p = (pmd_t *)__get_free_page(PGALLOC_GFP);
+		pud = __pud(__pa(pmd_p) | (PGTABLE_PROT & ptemask));
+		paravirt_alloc_pud(&init_mm, __pa(pmd_p) >> PAGE_SHIFT);
+		for (n = 0; n < ESPFIX_PUD_CLONES; n++)
+			set_pud(&pud_p[n], pud);
+	}
+
+	pmd_p = pmd_offset(&pud, addr);
+	pmd = *pmd_p;
+	if (!pmd_present(pmd)) {
+		pte_p = (pte_t *)__get_free_page(PGALLOC_GFP);
+		pmd = __pmd(__pa(pte_p) | (PGTABLE_PROT & ptemask));
+		paravirt_alloc_pmd(&init_mm, __pa(pte_p) >> PAGE_SHIFT);
+		for (n = 0; n < ESPFIX_PMD_CLONES; n++)
+			set_pmd(&pmd_p[n], pmd);
+	}
+
+	pte_p = pte_offset_kernel(&pmd, addr);
+	stack_page = (void *)__get_free_page(GFP_KERNEL);
+	pte = __pte(__pa(stack_page) | (__PAGE_KERNEL_RO & ptemask));
+	paravirt_alloc_pte(&init_mm, __pa(stack_page) >> PAGE_SHIFT);
+	for (n = 0; n < ESPFIX_PTE_CLONES; n++)
+		set_pte(&pte_p[n*PTE_STRIDE], pte);
+
+	/* Job is done for this CPU and any CPU which shares this page */
+	ACCESS_ONCE(espfix_pages[page]) = stack_page;
+
+unlock_done:
+	mutex_unlock(&espfix_init_mutex);
+done:
+	this_cpu_write(espfix_stack, addr);
+	this_cpu_write(espfix_waddr, (unsigned long)stack_page
+		       + (addr & ~PAGE_MASK));
+}

+ 1 - 1
arch/x86/kernel/head32.c

@@ -29,7 +29,7 @@ static void __init i386_default_early_setup(void)
 	reserve_ebda_region();
 	reserve_ebda_region();
 }
 }
 
 
-asmlinkage void __init i386_start_kernel(void)
+asmlinkage __visible void __init i386_start_kernel(void)
 {
 {
 	sanitize_boot_params(&boot_params);
 	sanitize_boot_params(&boot_params);
 
 

+ 1 - 1
arch/x86/kernel/head64.c

@@ -137,7 +137,7 @@ static void __init copy_bootdata(char *real_mode_data)
 	}
 	}
 }
 }
 
 
-asmlinkage void __init x86_64_start_kernel(char * real_mode_data)
+asmlinkage __visible void __init x86_64_start_kernel(char * real_mode_data)
 {
 {
 	int i;
 	int i;
 
 

+ 1 - 1
arch/x86/kernel/hpet.c

@@ -85,7 +85,7 @@ static inline void hpet_clear_mapping(void)
 /*
 /*
  * HPET command line enable / disable
  * HPET command line enable / disable
  */
  */
-static int boot_hpet_disable;
+int boot_hpet_disable;
 int hpet_force_user;
 int hpet_force_user;
 static int hpet_verbose;
 static int hpet_verbose;
 
 

+ 1 - 7
arch/x86/kernel/ldt.c

@@ -229,16 +229,10 @@ static int write_ldt(void __user *ptr, unsigned long bytecount, int oldmode)
 		}
 		}
 	}
 	}
 
 
-	/*
-	 * On x86-64 we do not support 16-bit segments due to
-	 * IRET leaking the high bits of the kernel stack address.
-	 */
-#ifdef CONFIG_X86_64
-	if (!ldt_info.seg_32bit) {
+	if (!IS_ENABLED(CONFIG_X86_16BIT) && !ldt_info.seg_32bit) {
 		error = -EINVAL;
 		error = -EINVAL;
 		goto out_unlock;
 		goto out_unlock;
 	}
 	}
-#endif
 
 
 	fill_ldt(&ldt, &ldt_info);
 	fill_ldt(&ldt, &ldt_info);
 	if (oldmode)
 	if (oldmode)

+ 1 - 1
arch/x86/kernel/process_64.c

@@ -52,7 +52,7 @@
 
 
 asmlinkage extern void ret_from_fork(void);
 asmlinkage extern void ret_from_fork(void);
 
 
-asmlinkage DEFINE_PER_CPU(unsigned long, old_rsp);
+__visible DEFINE_PER_CPU(unsigned long, old_rsp);
 
 
 /* Prints also some state that isn't saved in the pt_regs */
 /* Prints also some state that isn't saved in the pt_regs */
 void __show_regs(struct pt_regs *regs, int all)
 void __show_regs(struct pt_regs *regs, int all)

+ 10 - 0
arch/x86/kernel/reboot.c

@@ -191,6 +191,16 @@ static struct dmi_system_id __initdata reboot_dmi_table[] = {
 		},
 		},
 	},
 	},
 
 
+	/* Certec */
+	{       /* Handle problems with rebooting on Certec BPC600 */
+		.callback = set_pci_reboot,
+		.ident = "Certec BPC600",
+		.matches = {
+			DMI_MATCH(DMI_SYS_VENDOR, "Certec"),
+			DMI_MATCH(DMI_PRODUCT_NAME, "BPC600"),
+		},
+	},
+
 	/* Dell */
 	/* Dell */
 	{	/* Handle problems with rebooting on Dell DXP061 */
 	{	/* Handle problems with rebooting on Dell DXP061 */
 		.callback = set_bios_reboot,
 		.callback = set_bios_reboot,

+ 1 - 1
arch/x86/kernel/smp.c

@@ -168,7 +168,7 @@ static int smp_stop_nmi_callback(unsigned int val, struct pt_regs *regs)
  * this function calls the 'stop' function on all other CPUs in the system.
  * this function calls the 'stop' function on all other CPUs in the system.
  */
  */
 
 
-asmlinkage void smp_reboot_interrupt(void)
+asmlinkage __visible void smp_reboot_interrupt(void)
 {
 {
 	ack_APIC_irq();
 	ack_APIC_irq();
 	irq_enter();
 	irq_enter();

+ 7 - 0
arch/x86/kernel/smpboot.c

@@ -243,6 +243,13 @@ static void notrace start_secondary(void *unused)
 	 */
 	 */
 	check_tsc_sync_target();
 	check_tsc_sync_target();
 
 
+	/*
+	 * Enable the espfix hack for this CPU
+	 */
+#ifdef CONFIG_X86_ESPFIX64
+	init_espfix_ap();
+#endif
+
 	/*
 	/*
 	 * We need to hold vector_lock so there the set of online cpus
 	 * We need to hold vector_lock so there the set of online cpus
 	 * does not change while we are assigning vectors to cpus.  Holding
 	 * does not change while we are assigning vectors to cpus.  Holding

+ 3 - 3
arch/x86/kernel/traps.c

@@ -357,7 +357,7 @@ exit:
  * for scheduling or signal handling. The actual stack switch is done in
  * for scheduling or signal handling. The actual stack switch is done in
  * entry.S
  * entry.S
  */
  */
-asmlinkage __kprobes struct pt_regs *sync_regs(struct pt_regs *eregs)
+asmlinkage __visible __kprobes struct pt_regs *sync_regs(struct pt_regs *eregs)
 {
 {
 	struct pt_regs *regs = eregs;
 	struct pt_regs *regs = eregs;
 	/* Did already sync */
 	/* Did already sync */
@@ -601,11 +601,11 @@ do_spurious_interrupt_bug(struct pt_regs *regs, long error_code)
 #endif
 #endif
 }
 }
 
 
-asmlinkage void __attribute__((weak)) smp_thermal_interrupt(void)
+asmlinkage __visible void __attribute__((weak)) smp_thermal_interrupt(void)
 {
 {
 }
 }
 
 
-asmlinkage void __attribute__((weak)) smp_threshold_interrupt(void)
+asmlinkage __visible void __attribute__((weak)) smp_threshold_interrupt(void)
 {
 {
 }
 }
 
 

+ 3 - 3
arch/x86/kernel/vsmp_64.c

@@ -36,7 +36,7 @@ static int irq_routing_comply = 1;
  * and vice versa.
  * and vice versa.
  */
  */
 
 
-asmlinkage unsigned long vsmp_save_fl(void)
+asmlinkage __visible unsigned long vsmp_save_fl(void)
 {
 {
 	unsigned long flags = native_save_fl();
 	unsigned long flags = native_save_fl();
 
 
@@ -56,7 +56,7 @@ __visible void vsmp_restore_fl(unsigned long flags)
 }
 }
 PV_CALLEE_SAVE_REGS_THUNK(vsmp_restore_fl);
 PV_CALLEE_SAVE_REGS_THUNK(vsmp_restore_fl);
 
 
-asmlinkage void vsmp_irq_disable(void)
+asmlinkage __visible void vsmp_irq_disable(void)
 {
 {
 	unsigned long flags = native_save_fl();
 	unsigned long flags = native_save_fl();
 
 
@@ -64,7 +64,7 @@ asmlinkage void vsmp_irq_disable(void)
 }
 }
 PV_CALLEE_SAVE_REGS_THUNK(vsmp_irq_disable);
 PV_CALLEE_SAVE_REGS_THUNK(vsmp_irq_disable);
 
 
-asmlinkage void vsmp_irq_enable(void)
+asmlinkage __visible void vsmp_irq_enable(void)
 {
 {
 	unsigned long flags = native_save_fl();
 	unsigned long flags = native_save_fl();
 
 

+ 1 - 1
arch/x86/kernel/vsyscall_gtod.c

@@ -43,7 +43,7 @@ void update_vsyscall(struct timekeeper *tk)
 	vdata->monotonic_time_sec	= tk->xtime_sec
 	vdata->monotonic_time_sec	= tk->xtime_sec
 					+ tk->wall_to_monotonic.tv_sec;
 					+ tk->wall_to_monotonic.tv_sec;
 	vdata->monotonic_time_snsec	= tk->xtime_nsec
 	vdata->monotonic_time_snsec	= tk->xtime_nsec
-					+ (tk->wall_to_monotonic.tv_nsec
+					+ ((u64)tk->wall_to_monotonic.tv_nsec
 						<< tk->shift);
 						<< tk->shift);
 	while (vdata->monotonic_time_snsec >=
 	while (vdata->monotonic_time_snsec >=
 					(((u64)NSEC_PER_SEC) << tk->shift)) {
 					(((u64)NSEC_PER_SEC) << tk->shift)) {

+ 1 - 1
arch/x86/kvm/x86.c

@@ -280,7 +280,7 @@ int kvm_set_apic_base(struct kvm_vcpu *vcpu, struct msr_data *msr_info)
 }
 }
 EXPORT_SYMBOL_GPL(kvm_set_apic_base);
 EXPORT_SYMBOL_GPL(kvm_set_apic_base);
 
 
-asmlinkage void kvm_spurious_fault(void)
+asmlinkage __visible void kvm_spurious_fault(void)
 {
 {
 	/* Fault while not rebooting.  We want the trace. */
 	/* Fault while not rebooting.  We want the trace. */
 	BUG();
 	BUG();

+ 2 - 2
arch/x86/lguest/boot.c

@@ -233,13 +233,13 @@ static void lguest_end_context_switch(struct task_struct *next)
  * flags word contains all kind of stuff, but in practice Linux only cares
  * flags word contains all kind of stuff, but in practice Linux only cares
  * about the interrupt flag.  Our "save_flags()" just returns that.
  * about the interrupt flag.  Our "save_flags()" just returns that.
  */
  */
-asmlinkage unsigned long lguest_save_fl(void)
+asmlinkage __visible unsigned long lguest_save_fl(void)
 {
 {
 	return lguest_data.irq_enabled;
 	return lguest_data.irq_enabled;
 }
 }
 
 
 /* Interrupts go off... */
 /* Interrupts go off... */
-asmlinkage void lguest_irq_disable(void)
+asmlinkage __visible void lguest_irq_disable(void)
 {
 {
 	lguest_data.irq_enabled = 0;
 	lguest_data.irq_enabled = 0;
 }
 }

+ 1 - 1
arch/x86/lib/msr.c

@@ -76,7 +76,7 @@ static inline int __flip_bit(u32 msr, u8 bit, bool set)
 	if (m1.q == m.q)
 	if (m1.q == m.q)
 		return 0;
 		return 0;
 
 
-	err = msr_write(msr, &m);
+	err = msr_write(msr, &m1);
 	if (err)
 	if (err)
 		return err;
 		return err;
 
 

+ 8 - 8
arch/x86/math-emu/errors.c

@@ -302,7 +302,7 @@ static struct {
 	      0x242  in div_Xsig.S
 	      0x242  in div_Xsig.S
  */
  */
 
 
-asmlinkage void FPU_exception(int n)
+asmlinkage __visible void FPU_exception(int n)
 {
 {
 	int i, int_type;
 	int i, int_type;
 
 
@@ -492,7 +492,7 @@ int real_2op_NaN(FPU_REG const *b, u_char tagb,
 
 
 /* Invalid arith operation on Valid registers */
 /* Invalid arith operation on Valid registers */
 /* Returns < 0 if the exception is unmasked */
 /* Returns < 0 if the exception is unmasked */
-asmlinkage int arith_invalid(int deststnr)
+asmlinkage __visible int arith_invalid(int deststnr)
 {
 {
 
 
 	EXCEPTION(EX_Invalid);
 	EXCEPTION(EX_Invalid);
@@ -507,7 +507,7 @@ asmlinkage int arith_invalid(int deststnr)
 }
 }
 
 
 /* Divide a finite number by zero */
 /* Divide a finite number by zero */
-asmlinkage int FPU_divide_by_zero(int deststnr, u_char sign)
+asmlinkage __visible int FPU_divide_by_zero(int deststnr, u_char sign)
 {
 {
 	FPU_REG *dest = &st(deststnr);
 	FPU_REG *dest = &st(deststnr);
 	int tag = TAG_Valid;
 	int tag = TAG_Valid;
@@ -539,7 +539,7 @@ int set_precision_flag(int flags)
 }
 }
 
 
 /* This may be called often, so keep it lean */
 /* This may be called often, so keep it lean */
-asmlinkage void set_precision_flag_up(void)
+asmlinkage __visible void set_precision_flag_up(void)
 {
 {
 	if (control_word & CW_Precision)
 	if (control_word & CW_Precision)
 		partial_status |= (SW_Precision | SW_C1);	/* The masked response */
 		partial_status |= (SW_Precision | SW_C1);	/* The masked response */
@@ -548,7 +548,7 @@ asmlinkage void set_precision_flag_up(void)
 }
 }
 
 
 /* This may be called often, so keep it lean */
 /* This may be called often, so keep it lean */
-asmlinkage void set_precision_flag_down(void)
+asmlinkage __visible void set_precision_flag_down(void)
 {
 {
 	if (control_word & CW_Precision) {	/* The masked response */
 	if (control_word & CW_Precision) {	/* The masked response */
 		partial_status &= ~SW_C1;
 		partial_status &= ~SW_C1;
@@ -557,7 +557,7 @@ asmlinkage void set_precision_flag_down(void)
 		EXCEPTION(EX_Precision);
 		EXCEPTION(EX_Precision);
 }
 }
 
 
-asmlinkage int denormal_operand(void)
+asmlinkage __visible int denormal_operand(void)
 {
 {
 	if (control_word & CW_Denormal) {	/* The masked response */
 	if (control_word & CW_Denormal) {	/* The masked response */
 		partial_status |= SW_Denorm_Op;
 		partial_status |= SW_Denorm_Op;
@@ -568,7 +568,7 @@ asmlinkage int denormal_operand(void)
 	}
 	}
 }
 }
 
 
-asmlinkage int arith_overflow(FPU_REG *dest)
+asmlinkage __visible int arith_overflow(FPU_REG *dest)
 {
 {
 	int tag = TAG_Valid;
 	int tag = TAG_Valid;
 
 
@@ -596,7 +596,7 @@ asmlinkage int arith_overflow(FPU_REG *dest)
 
 
 }
 }
 
 
-asmlinkage int arith_underflow(FPU_REG *dest)
+asmlinkage __visible int arith_underflow(FPU_REG *dest)
 {
 {
 	int tag = TAG_Valid;
 	int tag = TAG_Valid;
 
 

+ 33 - 11
arch/x86/mm/dump_pagetables.c

@@ -30,12 +30,14 @@ struct pg_state {
 	unsigned long start_address;
 	unsigned long start_address;
 	unsigned long current_address;
 	unsigned long current_address;
 	const struct addr_marker *marker;
 	const struct addr_marker *marker;
+	unsigned long lines;
 	bool to_dmesg;
 	bool to_dmesg;
 };
 };
 
 
 struct addr_marker {
 struct addr_marker {
 	unsigned long start_address;
 	unsigned long start_address;
 	const char *name;
 	const char *name;
+	unsigned long max_lines;
 };
 };
 
 
 /* indices for address_markers; keep sync'd w/ address_markers below */
 /* indices for address_markers; keep sync'd w/ address_markers below */
@@ -46,6 +48,7 @@ enum address_markers_idx {
 	LOW_KERNEL_NR,
 	LOW_KERNEL_NR,
 	VMALLOC_START_NR,
 	VMALLOC_START_NR,
 	VMEMMAP_START_NR,
 	VMEMMAP_START_NR,
+	ESPFIX_START_NR,
 	HIGH_KERNEL_NR,
 	HIGH_KERNEL_NR,
 	MODULES_VADDR_NR,
 	MODULES_VADDR_NR,
 	MODULES_END_NR,
 	MODULES_END_NR,
@@ -68,6 +71,7 @@ static struct addr_marker address_markers[] = {
 	{ PAGE_OFFSET,		"Low Kernel Mapping" },
 	{ PAGE_OFFSET,		"Low Kernel Mapping" },
 	{ VMALLOC_START,        "vmalloc() Area" },
 	{ VMALLOC_START,        "vmalloc() Area" },
 	{ VMEMMAP_START,        "Vmemmap" },
 	{ VMEMMAP_START,        "Vmemmap" },
+	{ ESPFIX_BASE_ADDR,	"ESPfix Area", 16 },
 	{ __START_KERNEL_map,   "High Kernel Mapping" },
 	{ __START_KERNEL_map,   "High Kernel Mapping" },
 	{ MODULES_VADDR,        "Modules" },
 	{ MODULES_VADDR,        "Modules" },
 	{ MODULES_END,          "End Modules" },
 	{ MODULES_END,          "End Modules" },
@@ -182,7 +186,7 @@ static void note_page(struct seq_file *m, struct pg_state *st,
 		      pgprot_t new_prot, int level)
 		      pgprot_t new_prot, int level)
 {
 {
 	pgprotval_t prot, cur;
 	pgprotval_t prot, cur;
-	static const char units[] = "KMGTPE";
+	static const char units[] = "BKMGTPE";
 
 
 	/*
 	/*
 	 * If we have a "break" in the series, we need to flush the state that
 	 * If we have a "break" in the series, we need to flush the state that
@@ -197,6 +201,7 @@ static void note_page(struct seq_file *m, struct pg_state *st,
 		st->current_prot = new_prot;
 		st->current_prot = new_prot;
 		st->level = level;
 		st->level = level;
 		st->marker = address_markers;
 		st->marker = address_markers;
+		st->lines = 0;
 		pt_dump_seq_printf(m, st->to_dmesg, "---[ %s ]---\n",
 		pt_dump_seq_printf(m, st->to_dmesg, "---[ %s ]---\n",
 				   st->marker->name);
 				   st->marker->name);
 	} else if (prot != cur || level != st->level ||
 	} else if (prot != cur || level != st->level ||
@@ -208,17 +213,24 @@ static void note_page(struct seq_file *m, struct pg_state *st,
 		/*
 		/*
 		 * Now print the actual finished series
 		 * Now print the actual finished series
 		 */
 		 */
-		pt_dump_seq_printf(m, st->to_dmesg,  "0x%0*lx-0x%0*lx   ",
-				   width, st->start_address,
-				   width, st->current_address);
-
-		delta = (st->current_address - st->start_address) >> 10;
-		while (!(delta & 1023) && unit[1]) {
-			delta >>= 10;
-			unit++;
+		if (!st->marker->max_lines ||
+		    st->lines < st->marker->max_lines) {
+			pt_dump_seq_printf(m, st->to_dmesg,
+					   "0x%0*lx-0x%0*lx   ",
+					   width, st->start_address,
+					   width, st->current_address);
+
+			delta = st->current_address - st->start_address;
+			while (!(delta & 1023) && unit[1]) {
+				delta >>= 10;
+				unit++;
+			}
+			pt_dump_cont_printf(m, st->to_dmesg, "%9lu%c ",
+					    delta, *unit);
+			printk_prot(m, st->current_prot, st->level,
+				    st->to_dmesg);
 		}
 		}
-		pt_dump_cont_printf(m, st->to_dmesg, "%9lu%c ", delta, *unit);
-		printk_prot(m, st->current_prot, st->level, st->to_dmesg);
+		st->lines++;
 
 
 		/*
 		/*
 		 * We print markers for special areas of address space,
 		 * We print markers for special areas of address space,
@@ -226,7 +238,17 @@ static void note_page(struct seq_file *m, struct pg_state *st,
 		 * This helps in the interpretation.
 		 * This helps in the interpretation.
 		 */
 		 */
 		if (st->current_address >= st->marker[1].start_address) {
 		if (st->current_address >= st->marker[1].start_address) {
+			if (st->marker->max_lines &&
+			    st->lines > st->marker->max_lines) {
+				unsigned long nskip =
+					st->lines - st->marker->max_lines;
+				pt_dump_seq_printf(m, st->to_dmesg,
+						   "... %lu entr%s skipped ... \n",
+						   nskip,
+						   nskip == 1 ? "y" : "ies");
+			}
 			st->marker++;
 			st->marker++;
+			st->lines = 0;
 			pt_dump_seq_printf(m, st->to_dmesg, "---[ %s ]---\n",
 			pt_dump_seq_printf(m, st->to_dmesg, "---[ %s ]---\n",
 					   st->marker->name);
 					   st->marker->name);
 		}
 		}

+ 64 - 19
arch/x86/platform/efi/early_printk.c

@@ -14,48 +14,92 @@
 
 
 static const struct font_desc *font;
 static const struct font_desc *font;
 static u32 efi_x, efi_y;
 static u32 efi_x, efi_y;
+static void *efi_fb;
+static bool early_efi_keep;
 
 
-static __init void early_efi_clear_scanline(unsigned int y)
+/*
+ * efi earlyprintk need use early_ioremap to map the framebuffer.
+ * But early_ioremap is not usable for earlyprintk=efi,keep, ioremap should
+ * be used instead. ioremap will be available after paging_init() which is
+ * earlier than initcall callbacks. Thus adding this early initcall function
+ * early_efi_map_fb to map the whole efi framebuffer.
+ */
+static __init int early_efi_map_fb(void)
 {
 {
-	unsigned long base, *dst;
-	u16 len;
+	unsigned long base, size;
+
+	if (!early_efi_keep)
+		return 0;
 
 
 	base = boot_params.screen_info.lfb_base;
 	base = boot_params.screen_info.lfb_base;
-	len = boot_params.screen_info.lfb_linelength;
+	size = boot_params.screen_info.lfb_size;
+	efi_fb = ioremap(base, size);
+
+	return efi_fb ? 0 : -ENOMEM;
+}
+early_initcall(early_efi_map_fb);
+
+/*
+ * early_efi_map maps efi framebuffer region [start, start + len -1]
+ * In case earlyprintk=efi,keep we have the whole framebuffer mapped already
+ * so just return the offset efi_fb + start.
+ */
+static __init_refok void *early_efi_map(unsigned long start, unsigned long len)
+{
+	unsigned long base;
+
+	base = boot_params.screen_info.lfb_base;
+
+	if (efi_fb)
+		return (efi_fb + start);
+	else
+		return early_ioremap(base + start, len);
+}
 
 
-	dst = early_ioremap(base + y*len, len);
+static __init_refok void early_efi_unmap(void *addr, unsigned long len)
+{
+	if (!efi_fb)
+		early_iounmap(addr, len);
+}
+
+static void early_efi_clear_scanline(unsigned int y)
+{
+	unsigned long *dst;
+	u16 len;
+
+	len = boot_params.screen_info.lfb_linelength;
+	dst = early_efi_map(y*len, len);
 	if (!dst)
 	if (!dst)
 		return;
 		return;
 
 
 	memset(dst, 0, len);
 	memset(dst, 0, len);
-	early_iounmap(dst, len);
+	early_efi_unmap(dst, len);
 }
 }
 
 
-static __init void early_efi_scroll_up(void)
+static void early_efi_scroll_up(void)
 {
 {
-	unsigned long base, *dst, *src;
+	unsigned long *dst, *src;
 	u16 len;
 	u16 len;
 	u32 i, height;
 	u32 i, height;
 
 
-	base = boot_params.screen_info.lfb_base;
 	len = boot_params.screen_info.lfb_linelength;
 	len = boot_params.screen_info.lfb_linelength;
 	height = boot_params.screen_info.lfb_height;
 	height = boot_params.screen_info.lfb_height;
 
 
 	for (i = 0; i < height - font->height; i++) {
 	for (i = 0; i < height - font->height; i++) {
-		dst = early_ioremap(base + i*len, len);
+		dst = early_efi_map(i*len, len);
 		if (!dst)
 		if (!dst)
 			return;
 			return;
 
 
-		src = early_ioremap(base + (i + font->height) * len, len);
+		src = early_efi_map((i + font->height) * len, len);
 		if (!src) {
 		if (!src) {
-			early_iounmap(dst, len);
+			early_efi_unmap(dst, len);
 			return;
 			return;
 		}
 		}
 
 
 		memmove(dst, src, len);
 		memmove(dst, src, len);
 
 
-		early_iounmap(src, len);
-		early_iounmap(dst, len);
+		early_efi_unmap(src, len);
+		early_efi_unmap(dst, len);
 	}
 	}
 }
 }
 
 
@@ -79,16 +123,14 @@ static void early_efi_write_char(u32 *dst, unsigned char c, unsigned int h)
 	}
 	}
 }
 }
 
 
-static __init void
+static void
 early_efi_write(struct console *con, const char *str, unsigned int num)
 early_efi_write(struct console *con, const char *str, unsigned int num)
 {
 {
 	struct screen_info *si;
 	struct screen_info *si;
-	unsigned long base;
 	unsigned int len;
 	unsigned int len;
 	const char *s;
 	const char *s;
 	void *dst;
 	void *dst;
 
 
-	base = boot_params.screen_info.lfb_base;
 	si = &boot_params.screen_info;
 	si = &boot_params.screen_info;
 	len = si->lfb_linelength;
 	len = si->lfb_linelength;
 
 
@@ -109,7 +151,7 @@ early_efi_write(struct console *con, const char *str, unsigned int num)
 		for (h = 0; h < font->height; h++) {
 		for (h = 0; h < font->height; h++) {
 			unsigned int n, x;
 			unsigned int n, x;
 
 
-			dst = early_ioremap(base + (efi_y + h) * len, len);
+			dst = early_efi_map((efi_y + h) * len, len);
 			if (!dst)
 			if (!dst)
 				return;
 				return;
 
 
@@ -123,7 +165,7 @@ early_efi_write(struct console *con, const char *str, unsigned int num)
 				s++;
 				s++;
 			}
 			}
 
 
-			early_iounmap(dst, len);
+			early_efi_unmap(dst, len);
 		}
 		}
 
 
 		num -= count;
 		num -= count;
@@ -179,6 +221,9 @@ static __init int early_efi_setup(struct console *con, char *options)
 	for (i = 0; i < (yres - efi_y) / font->height; i++)
 	for (i = 0; i < (yres - efi_y) / font->height; i++)
 		early_efi_scroll_up();
 		early_efi_scroll_up();
 
 
+	/* early_console_register will unset CON_BOOT in case ,keep */
+	if (!(con->flags & CON_BOOT))
+		early_efi_keep = true;
 	return 0;
 	return 0;
 }
 }
 
 

+ 1 - 1
arch/x86/platform/olpc/olpc-xo1-pm.c

@@ -75,7 +75,7 @@ static int xo1_power_state_enter(suspend_state_t pm_state)
 	return 0;
 	return 0;
 }
 }
 
 
-asmlinkage int xo1_do_sleep(u8 sleep_state)
+asmlinkage __visible int xo1_do_sleep(u8 sleep_state)
 {
 {
 	void *pgd_addr = __va(read_cr3());
 	void *pgd_addr = __va(read_cr3());
 
 

+ 1 - 1
arch/x86/power/hibernate_64.c

@@ -23,7 +23,7 @@
 extern __visible const void __nosave_begin, __nosave_end;
 extern __visible const void __nosave_begin, __nosave_end;
 
 
 /* Defined in hibernate_asm_64.S */
 /* Defined in hibernate_asm_64.S */
-extern asmlinkage int restore_image(void);
+extern asmlinkage __visible int restore_image(void);
 
 
 /*
 /*
  * Address to jump to in the last phase of restore in order to get to the image
  * Address to jump to in the last phase of restore in order to get to the image

+ 1 - 1
arch/x86/xen/enlighten.c

@@ -1515,7 +1515,7 @@ static void __init xen_pvh_early_guest_init(void)
 }
 }
 
 
 /* First C function to be called on Xen boot */
 /* First C function to be called on Xen boot */
-asmlinkage void __init xen_start_kernel(void)
+asmlinkage __visible void __init xen_start_kernel(void)
 {
 {
 	struct physdev_set_iopl set_iopl;
 	struct physdev_set_iopl set_iopl;
 	int rc;
 	int rc;

+ 3 - 3
arch/x86/xen/irq.c

@@ -23,7 +23,7 @@ void xen_force_evtchn_callback(void)
 	(void)HYPERVISOR_xen_version(0, NULL);
 	(void)HYPERVISOR_xen_version(0, NULL);
 }
 }
 
 
-asmlinkage unsigned long xen_save_fl(void)
+asmlinkage __visible unsigned long xen_save_fl(void)
 {
 {
 	struct vcpu_info *vcpu;
 	struct vcpu_info *vcpu;
 	unsigned long flags;
 	unsigned long flags;
@@ -63,7 +63,7 @@ __visible void xen_restore_fl(unsigned long flags)
 }
 }
 PV_CALLEE_SAVE_REGS_THUNK(xen_restore_fl);
 PV_CALLEE_SAVE_REGS_THUNK(xen_restore_fl);
 
 
-asmlinkage void xen_irq_disable(void)
+asmlinkage __visible void xen_irq_disable(void)
 {
 {
 	/* There's a one instruction preempt window here.  We need to
 	/* There's a one instruction preempt window here.  We need to
 	   make sure we're don't switch CPUs between getting the vcpu
 	   make sure we're don't switch CPUs between getting the vcpu
@@ -74,7 +74,7 @@ asmlinkage void xen_irq_disable(void)
 }
 }
 PV_CALLEE_SAVE_REGS_THUNK(xen_irq_disable);
 PV_CALLEE_SAVE_REGS_THUNK(xen_irq_disable);
 
 
-asmlinkage void xen_irq_enable(void)
+asmlinkage __visible void xen_irq_enable(void)
 {
 {
 	struct vcpu_info *vcpu;
 	struct vcpu_info *vcpu;
 
 

+ 19 - 1
arch/xtensa/Kconfig

@@ -14,6 +14,7 @@ config XTENSA
 	select GENERIC_PCI_IOMAP
 	select GENERIC_PCI_IOMAP
 	select ARCH_WANT_IPC_PARSE_VERSION
 	select ARCH_WANT_IPC_PARSE_VERSION
 	select ARCH_WANT_OPTIONAL_GPIOLIB
 	select ARCH_WANT_OPTIONAL_GPIOLIB
+	select BUILDTIME_EXTABLE_SORT
 	select CLONE_BACKWARDS
 	select CLONE_BACKWARDS
 	select IRQ_DOMAIN
 	select IRQ_DOMAIN
 	select HAVE_OPROFILE
 	select HAVE_OPROFILE
@@ -189,6 +190,24 @@ config INITIALIZE_XTENSA_MMU_INSIDE_VMLINUX
 
 
 	  If in doubt, say Y.
 	  If in doubt, say Y.
 
 
+config HIGHMEM
+	bool "High Memory Support"
+	help
+	  Linux can use the full amount of RAM in the system by
+	  default. However, the default MMUv2 setup only maps the
+	  lowermost 128 MB of memory linearly to the areas starting
+	  at 0xd0000000 (cached) and 0xd8000000 (uncached).
+	  When there are more than 128 MB memory in the system not
+	  all of it can be "permanently mapped" by the kernel.
+	  The physical memory that's not permanently mapped is called
+	  "high memory".
+
+	  If you are compiling a kernel which will never run on a
+	  machine with more than 128 MB total physical RAM, answer
+	  N here.
+
+	  If unsure, say Y.
+
 endmenu
 endmenu
 
 
 config XTENSA_CALIBRATE_CCOUNT
 config XTENSA_CALIBRATE_CCOUNT
@@ -224,7 +243,6 @@ choice
 
 
 config XTENSA_PLATFORM_ISS
 config XTENSA_PLATFORM_ISS
 	bool "ISS"
 	bool "ISS"
-	depends on TTY
 	select XTENSA_CALIBRATE_CCOUNT
 	select XTENSA_CALIBRATE_CCOUNT
 	select SERIAL_CONSOLE
 	select SERIAL_CONSOLE
 	help
 	help

Энэ ялгаанд хэт олон файл өөрчлөгдсөн тул зарим файлыг харуулаагүй болно