Browse Source

Merge 3.9-rc6 into usb-next

We want the fixes here as well.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Greg Kroah-Hartman 12 years ago
parent
commit
31e918908c
100 changed files with 948 additions and 414 deletions
  1. 2 3
      Documentation/sound/alsa/ALSA-Configuration.txt
  2. 2 2
      MAINTAINERS
  3. 1 1
      Makefile
  4. 1 1
      arch/alpha/Makefile
  5. 1 1
      arch/alpha/include/asm/floppy.h
  6. 0 7
      arch/alpha/kernel/irq.c
  7. 8 2
      arch/alpha/kernel/irq_alpha.c
  8. 5 0
      arch/alpha/kernel/sys_nautilus.c
  9. 7 7
      arch/alpha/kernel/sys_titan.c
  10. 12 2
      arch/arm/Kconfig
  11. 1 1
      arch/arm/boot/dts/armada-370-mirabox.dts
  12. 6 0
      arch/arm/boot/dts/armada-370.dtsi
  13. 2 2
      arch/arm/boot/dts/dbx5x0.dtsi
  14. 1 0
      arch/arm/boot/dts/kirkwood-goflexnet.dts
  15. 7 2
      arch/arm/boot/dts/orion5x.dtsi
  16. 1 1
      arch/arm/include/asm/delay.h
  17. 7 0
      arch/arm/include/asm/highmem.h
  18. 2 0
      arch/arm/include/asm/mmu_context.h
  19. 15 0
      arch/arm/include/asm/tlbflush.h
  20. 12 0
      arch/arm/kernel/entry-common.S
  21. 1 1
      arch/arm/kernel/head.S
  22. 3 3
      arch/arm/kernel/hw_breakpoint.c
  23. 22 2
      arch/arm/kernel/setup.c
  24. 0 3
      arch/arm/kernel/smp.c
  25. 66 0
      arch/arm/kernel/smp_tlb.c
  26. 14 21
      arch/arm/kvm/vgic.c
  27. 5 3
      arch/arm/lib/delay.c
  28. 3 13
      arch/arm/mach-cns3xxx/core.c
  29. 8 8
      arch/arm/mach-cns3xxx/include/mach/cns3xxx.h
  30. 7 3
      arch/arm/mach-ep93xx/include/mach/uncompress.h
  31. 2 0
      arch/arm/mach-imx/common.h
  32. 12 0
      arch/arm/mach-imx/hotplug.c
  33. 12 0
      arch/arm/mach-imx/src.c
  34. 2 0
      arch/arm/mach-kirkwood/guruplug-setup.c
  35. 1 0
      arch/arm/mach-kirkwood/openrd-setup.c
  36. 1 0
      arch/arm/mach-kirkwood/rd88f6281-setup.c
  37. 4 1
      arch/arm/mach-msm/timer.c
  38. 5 3
      arch/arm/mach-mvebu/irq-armada-370-xp.c
  39. 1 11
      arch/arm/mach-omap1/clock_data.c
  40. 20 0
      arch/arm/mach-omap2/cclock44xx_data.c
  41. 3 0
      arch/arm/mach-omap2/common.h
  42. 12 6
      arch/arm/mach-omap2/io.c
  43. 5 2
      arch/arm/mach-omap2/omap_hwmod.c
  44. 7 2
      arch/arm/mach-omap2/omap_hwmod.h
  45. 6 1
      arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
  46. 6 0
      arch/arm/mach-omap2/omap_hwmod_44xx_data.c
  47. 4 0
      arch/arm/mach-omap2/timer.c
  48. 0 1
      arch/arm/mach-ux500/board-mop500-sdi.c
  49. 12 0
      arch/arm/mach-ux500/board-mop500.c
  50. 1 0
      arch/arm/mach-ux500/board-mop500.h
  51. 3 2
      arch/arm/mach-ux500/cpu-db8500.c
  52. 4 7
      arch/arm/mm/cache-l2x0.c
  53. 2 1
      arch/arm/mm/context.c
  54. 47 26
      arch/arm/mm/mmu.c
  55. 17 2
      arch/arm/mm/proc-v7.S
  56. 3 4
      arch/mips/Kconfig
  57. 1 4
      arch/mips/bcm63xx/boards/board_bcm963xx.c
  58. 3 4
      arch/mips/bcm63xx/nvram.c
  59. 1 1
      arch/mips/bcm63xx/setup.c
  60. 4 1
      arch/mips/cavium-octeon/setup.c
  61. 1 3
      arch/mips/include/asm/mach-bcm63xx/bcm63xx_nvram.h
  62. 0 4
      arch/mips/include/asm/mach-sead3/cpu-feature-overrides.h
  63. 190 19
      arch/mips/include/asm/mipsregs.h
  64. 1 1
      arch/mips/include/asm/signal.h
  65. 6 2
      arch/mips/include/uapi/asm/signal.h
  66. 6 19
      arch/mips/kernel/Makefile
  67. 6 7
      arch/mips/kernel/cpu-probe.c
  68. 1 1
      arch/mips/kernel/linux32.c
  69. 7 4
      arch/mips/kernel/mcount.S
  70. 1 1
      arch/mips/kernel/proc.c
  71. 1 1
      arch/mips/kernel/traps.c
  72. 8 8
      arch/mips/lib/bitops.c
  73. 2 2
      arch/mips/lib/csum_partial.S
  74. 2 4
      arch/mips/mm/c-r4k.c
  75. 2 4
      arch/mips/mm/sc-mips.c
  76. 2 2
      arch/mips/pci/pci-alchemy.c
  77. 3 1
      arch/s390/include/asm/pgtable.h
  78. 55 28
      arch/s390/lib/uaccess_pt.c
  79. 12 13
      arch/tile/kernel/setup.c
  80. 2 3
      arch/x86/boot/compressed/Makefile
  81. 2 2
      arch/x86/include/asm/syscall.h
  82. 1 1
      arch/x86/kvm/lapic.c
  83. 6 7
      arch/x86/kvm/x86.c
  84. 1 1
      drivers/acpi/Kconfig
  85. 1 1
      drivers/acpi/acpi_i2c.c
  86. 37 39
      drivers/acpi/pci_root.c
  87. 7 6
      drivers/acpi/processor_idle.c
  88. 47 13
      drivers/base/power/qos.c
  89. 1 1
      drivers/base/regmap/regcache-rbtree.c
  90. 5 4
      drivers/base/regmap/regmap.c
  91. 2 1
      drivers/block/aoe/aoecmd.c
  92. 8 1
      drivers/block/loop.c
  93. 9 0
      drivers/char/hw_random/core.c
  94. 30 14
      drivers/char/virtio_console.c
  95. 1 1
      drivers/clk/tegra/clk-tegra20.c
  96. 8 2
      drivers/cpufreq/cpufreq-cpu0.c
  97. 3 3
      drivers/cpufreq/cpufreq_governor.h
  98. 1 0
      drivers/dma/Kconfig
  99. 46 21
      drivers/eisa/pci_eisa.c
  100. 1 1
      drivers/gpio/gpio-ich.c

+ 2 - 3
Documentation/sound/alsa/ALSA-Configuration.txt

@@ -890,9 +890,8 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
     enable_msi	- Enable Message Signaled Interrupt (MSI) (default = off)
     enable_msi	- Enable Message Signaled Interrupt (MSI) (default = off)
     power_save	- Automatic power-saving timeout (in second, 0 =
     power_save	- Automatic power-saving timeout (in second, 0 =
 		disable)
 		disable)
-    power_save_controller - Support runtime D3 of HD-audio controller
-		(-1 = on for supported chip (default), false = off,
-		 true = force to on even for unsupported hardware)
+    power_save_controller - Reset HD-audio controller in power-saving mode
+		(default = on)
     align_buffer_size - Force rounding of buffer/period sizes to multiples
     align_buffer_size - Force rounding of buffer/period sizes to multiples
     		      of 128 bytes. This is more efficient in terms of memory
     		      of 128 bytes. This is more efficient in terms of memory
 		      access but isn't required by the HDA spec and prevents
 		      access but isn't required by the HDA spec and prevents

+ 2 - 2
MAINTAINERS

@@ -5065,9 +5065,8 @@ S:	Maintained
 F:	drivers/net/ethernet/marvell/sk*
 F:	drivers/net/ethernet/marvell/sk*
 
 
 MARVELL LIBERTAS WIRELESS DRIVER
 MARVELL LIBERTAS WIRELESS DRIVER
-M:	Dan Williams <dcbw@redhat.com>
 L:	libertas-dev@lists.infradead.org
 L:	libertas-dev@lists.infradead.org
-S:	Maintained
+S:	Orphan
 F:	drivers/net/wireless/libertas/
 F:	drivers/net/wireless/libertas/
 
 
 MARVELL MV643XX ETHERNET DRIVER
 MARVELL MV643XX ETHERNET DRIVER
@@ -5569,6 +5568,7 @@ F:	include/uapi/linux/if_*
 F:	include/uapi/linux/netdevice.h
 F:	include/uapi/linux/netdevice.h
 
 
 NETXEN (1/10) GbE SUPPORT
 NETXEN (1/10) GbE SUPPORT
+M:	Manish Chopra <manish.chopra@qlogic.com>
 M:	Sony Chacko <sony.chacko@qlogic.com>
 M:	Sony Chacko <sony.chacko@qlogic.com>
 M:	Rajesh Borundia <rajesh.borundia@qlogic.com>
 M:	Rajesh Borundia <rajesh.borundia@qlogic.com>
 L:	netdev@vger.kernel.org
 L:	netdev@vger.kernel.org

+ 1 - 1
Makefile

@@ -1,7 +1,7 @@
 VERSION = 3
 VERSION = 3
 PATCHLEVEL = 9
 PATCHLEVEL = 9
 SUBLEVEL = 0
 SUBLEVEL = 0
-EXTRAVERSION = -rc5
+EXTRAVERSION = -rc6
 NAME = Unicycling Gorilla
 NAME = Unicycling Gorilla
 
 
 # *DOCUMENTATION*
 # *DOCUMENTATION*

+ 1 - 1
arch/alpha/Makefile

@@ -12,7 +12,7 @@ NM := $(NM) -B
 
 
 LDFLAGS_vmlinux	:= -static -N #-relax
 LDFLAGS_vmlinux	:= -static -N #-relax
 CHECKFLAGS	+= -D__alpha__ -m64
 CHECKFLAGS	+= -D__alpha__ -m64
-cflags-y	:= -pipe -mno-fp-regs -ffixed-8 -msmall-data
+cflags-y	:= -pipe -mno-fp-regs -ffixed-8
 cflags-y	+= $(call cc-option, -fno-jump-tables)
 cflags-y	+= $(call cc-option, -fno-jump-tables)
 
 
 cpuflags-$(CONFIG_ALPHA_EV4)		:= -mcpu=ev4
 cpuflags-$(CONFIG_ALPHA_EV4)		:= -mcpu=ev4

+ 1 - 1
arch/alpha/include/asm/floppy.h

@@ -26,7 +26,7 @@
 #define fd_disable_irq()        disable_irq(FLOPPY_IRQ)
 #define fd_disable_irq()        disable_irq(FLOPPY_IRQ)
 #define fd_cacheflush(addr,size) /* nothing */
 #define fd_cacheflush(addr,size) /* nothing */
 #define fd_request_irq()        request_irq(FLOPPY_IRQ, floppy_interrupt,\
 #define fd_request_irq()        request_irq(FLOPPY_IRQ, floppy_interrupt,\
-					    IRQF_DISABLED, "floppy", NULL)
+					    0, "floppy", NULL)
 #define fd_free_irq()           free_irq(FLOPPY_IRQ, NULL)
 #define fd_free_irq()           free_irq(FLOPPY_IRQ, NULL)
 
 
 #ifdef CONFIG_PCI
 #ifdef CONFIG_PCI

+ 0 - 7
arch/alpha/kernel/irq.c

@@ -117,13 +117,6 @@ handle_irq(int irq)
 		return;
 		return;
 	}
 	}
 
 
-	/*
-	 * From here we must proceed with IPL_MAX. Note that we do not
-	 * explicitly enable interrupts afterwards - some MILO PALcode
-	 * (namely LX164 one) seems to have severe problems with RTI
-	 * at IPL 0.
-	 */
-	local_irq_disable();
 	irq_enter();
 	irq_enter();
 	generic_handle_irq_desc(irq, desc);
 	generic_handle_irq_desc(irq, desc);
 	irq_exit();
 	irq_exit();

+ 8 - 2
arch/alpha/kernel/irq_alpha.c

@@ -45,6 +45,14 @@ do_entInt(unsigned long type, unsigned long vector,
 	  unsigned long la_ptr, struct pt_regs *regs)
 	  unsigned long la_ptr, struct pt_regs *regs)
 {
 {
 	struct pt_regs *old_regs;
 	struct pt_regs *old_regs;
+
+	/*
+	 * Disable interrupts during IRQ handling.
+	 * Note that there is no matching local_irq_enable() due to
+	 * severe problems with RTI at IPL0 and some MILO PALcode
+	 * (namely LX164).
+	 */
+	local_irq_disable();
 	switch (type) {
 	switch (type) {
 	case 0:
 	case 0:
 #ifdef CONFIG_SMP
 #ifdef CONFIG_SMP
@@ -62,7 +70,6 @@ do_entInt(unsigned long type, unsigned long vector,
 	  {
 	  {
 		long cpu;
 		long cpu;
 
 
-		local_irq_disable();
 		smp_percpu_timer_interrupt(regs);
 		smp_percpu_timer_interrupt(regs);
 		cpu = smp_processor_id();
 		cpu = smp_processor_id();
 		if (cpu != boot_cpuid) {
 		if (cpu != boot_cpuid) {
@@ -222,7 +229,6 @@ process_mcheck_info(unsigned long vector, unsigned long la_ptr,
 
 
 struct irqaction timer_irqaction = {
 struct irqaction timer_irqaction = {
 	.handler	= timer_interrupt,
 	.handler	= timer_interrupt,
-	.flags		= IRQF_DISABLED,
 	.name		= "timer",
 	.name		= "timer",
 };
 };
 
 

+ 5 - 0
arch/alpha/kernel/sys_nautilus.c

@@ -188,6 +188,10 @@ nautilus_machine_check(unsigned long vector, unsigned long la_ptr)
 extern void free_reserved_mem(void *, void *);
 extern void free_reserved_mem(void *, void *);
 extern void pcibios_claim_one_bus(struct pci_bus *);
 extern void pcibios_claim_one_bus(struct pci_bus *);
 
 
+static struct resource irongate_io = {
+	.name	= "Irongate PCI IO",
+	.flags	= IORESOURCE_IO,
+};
 static struct resource irongate_mem = {
 static struct resource irongate_mem = {
 	.name	= "Irongate PCI MEM",
 	.name	= "Irongate PCI MEM",
 	.flags	= IORESOURCE_MEM,
 	.flags	= IORESOURCE_MEM,
@@ -209,6 +213,7 @@ nautilus_init_pci(void)
 
 
 	irongate = pci_get_bus_and_slot(0, 0);
 	irongate = pci_get_bus_and_slot(0, 0);
 	bus->self = irongate;
 	bus->self = irongate;
+	bus->resource[0] = &irongate_io;
 	bus->resource[1] = &irongate_mem;
 	bus->resource[1] = &irongate_mem;
 
 
 	pci_bus_size_bridges(bus);
 	pci_bus_size_bridges(bus);

+ 7 - 7
arch/alpha/kernel/sys_titan.c

@@ -280,15 +280,15 @@ titan_late_init(void)
 	 * all reported to the kernel as machine checks, so the handler
 	 * all reported to the kernel as machine checks, so the handler
 	 * is a nop so it can be called to count the individual events.
 	 * is a nop so it can be called to count the individual events.
 	 */
 	 */
-	titan_request_irq(63+16, titan_intr_nop, IRQF_DISABLED,
+	titan_request_irq(63+16, titan_intr_nop, 0,
 		    "CChip Error", NULL);
 		    "CChip Error", NULL);
-	titan_request_irq(62+16, titan_intr_nop, IRQF_DISABLED,
+	titan_request_irq(62+16, titan_intr_nop, 0,
 		    "PChip 0 H_Error", NULL);
 		    "PChip 0 H_Error", NULL);
-	titan_request_irq(61+16, titan_intr_nop, IRQF_DISABLED,
+	titan_request_irq(61+16, titan_intr_nop, 0,
 		    "PChip 1 H_Error", NULL);
 		    "PChip 1 H_Error", NULL);
-	titan_request_irq(60+16, titan_intr_nop, IRQF_DISABLED,
+	titan_request_irq(60+16, titan_intr_nop, 0,
 		    "PChip 0 C_Error", NULL);
 		    "PChip 0 C_Error", NULL);
-	titan_request_irq(59+16, titan_intr_nop, IRQF_DISABLED,
+	titan_request_irq(59+16, titan_intr_nop, 0,
 		    "PChip 1 C_Error", NULL);
 		    "PChip 1 C_Error", NULL);
 
 
 	/* 
 	/* 
@@ -348,9 +348,9 @@ privateer_init_pci(void)
 	 * Hook a couple of extra err interrupts that the
 	 * Hook a couple of extra err interrupts that the
 	 * common titan code won't.
 	 * common titan code won't.
 	 */
 	 */
-	titan_request_irq(53+16, titan_intr_nop, IRQF_DISABLED,
+	titan_request_irq(53+16, titan_intr_nop, 0,
 		    "NMI", NULL);
 		    "NMI", NULL);
-	titan_request_irq(50+16, titan_intr_nop, IRQF_DISABLED,
+	titan_request_irq(50+16, titan_intr_nop, 0,
 		    "Temperature Warning", NULL);
 		    "Temperature Warning", NULL);
 
 
 	/*
 	/*

+ 12 - 2
arch/arm/Kconfig

@@ -1183,9 +1183,9 @@ config ARM_NR_BANKS
 	default 8
 	default 8
 
 
 config IWMMXT
 config IWMMXT
-	bool "Enable iWMMXt support"
+	bool "Enable iWMMXt support" if !CPU_PJ4
 	depends on CPU_XSCALE || CPU_XSC3 || CPU_MOHAWK || CPU_PJ4
 	depends on CPU_XSCALE || CPU_XSC3 || CPU_MOHAWK || CPU_PJ4
-	default y if PXA27x || PXA3xx || ARCH_MMP
+	default y if PXA27x || PXA3xx || ARCH_MMP || CPU_PJ4
 	help
 	help
 	  Enable support for iWMMXt context switching at run time if
 	  Enable support for iWMMXt context switching at run time if
 	  running on a CPU that supports it.
 	  running on a CPU that supports it.
@@ -1439,6 +1439,16 @@ config ARM_ERRATA_775420
 	 to deadlock. This workaround puts DSB before executing ISB if
 	 to deadlock. This workaround puts DSB before executing ISB if
 	 an abort may occur on cache maintenance.
 	 an abort may occur on cache maintenance.
 
 
+config ARM_ERRATA_798181
+	bool "ARM errata: TLBI/DSB failure on Cortex-A15"
+	depends on CPU_V7 && SMP
+	help
+	  On Cortex-A15 (r0p0..r3p2) the TLBI*IS/DSB operations are not
+	  adequately shooting down all use of the old entries. This
+	  option enables the Linux kernel workaround for this erratum
+	  which sends an IPI to the CPUs that are running the same ASID
+	  as the one being invalidated.
+
 endmenu
 endmenu
 
 
 source "arch/arm/common/Kconfig"
 source "arch/arm/common/Kconfig"

+ 1 - 1
arch/arm/boot/dts/armada-370-mirabox.dts

@@ -54,7 +54,7 @@
 		};
 		};
 
 
 		mvsdio@d00d4000 {
 		mvsdio@d00d4000 {
-			pinctrl-0 = <&sdio_pins2>;
+			pinctrl-0 = <&sdio_pins3>;
 			pinctrl-names = "default";
 			pinctrl-names = "default";
 			status = "okay";
 			status = "okay";
 			/*
 			/*

+ 6 - 0
arch/arm/boot/dts/armada-370.dtsi

@@ -59,6 +59,12 @@
 					     "mpp50", "mpp51", "mpp52";
 					     "mpp50", "mpp51", "mpp52";
 			      marvell,function = "sd0";
 			      marvell,function = "sd0";
 			};
 			};
+
+			sdio_pins3: sdio-pins3 {
+			      marvell,pins = "mpp48", "mpp49", "mpp50",
+					     "mpp51", "mpp52", "mpp53";
+			      marvell,function = "sd0";
+			};
 	        };
 	        };
 
 
 		gpio0: gpio@d0018100 {
 		gpio0: gpio@d0018100 {

+ 2 - 2
arch/arm/boot/dts/dbx5x0.dtsi

@@ -191,8 +191,8 @@
 
 
 		prcmu: prcmu@80157000 {
 		prcmu: prcmu@80157000 {
 			compatible = "stericsson,db8500-prcmu";
 			compatible = "stericsson,db8500-prcmu";
-			reg = <0x80157000 0x1000>;
-			reg-names = "prcmu";
+			reg = <0x80157000 0x1000>, <0x801b0000 0x8000>, <0x801b8000 0x1000>;
+			reg-names = "prcmu", "prcmu-tcpm", "prcmu-tcdm";
 			interrupts = <0 47 0x4>;
 			interrupts = <0 47 0x4>;
 			#address-cells = <1>;
 			#address-cells = <1>;
 			#size-cells = <1>;
 			#size-cells = <1>;

+ 1 - 0
arch/arm/boot/dts/kirkwood-goflexnet.dts

@@ -77,6 +77,7 @@
 		};
 		};
 
 
 		nand@3000000 {
 		nand@3000000 {
+			chip-delay = <40>;
 			status = "okay";
 			status = "okay";
 
 
 			partition@0 {
 			partition@0 {

+ 7 - 2
arch/arm/boot/dts/orion5x.dtsi

@@ -13,6 +13,9 @@
 	compatible = "marvell,orion5x";
 	compatible = "marvell,orion5x";
 	interrupt-parent = <&intc>;
 	interrupt-parent = <&intc>;
 
 
+	aliases {
+		gpio0 = &gpio0;
+	};
 	intc: interrupt-controller {
 	intc: interrupt-controller {
 		compatible = "marvell,orion-intc", "marvell,intc";
 		compatible = "marvell,orion-intc", "marvell,intc";
 		interrupt-controller;
 		interrupt-controller;
@@ -32,7 +35,9 @@
 			#gpio-cells = <2>;
 			#gpio-cells = <2>;
 			gpio-controller;
 			gpio-controller;
 			reg = <0x10100 0x40>;
 			reg = <0x10100 0x40>;
-			ngpio = <32>;
+			ngpios = <32>;
+			interrupt-controller;
+			#interrupt-cells = <2>;
 			interrupts = <6>, <7>, <8>, <9>;
 			interrupts = <6>, <7>, <8>, <9>;
 		};
 		};
 
 
@@ -91,7 +96,7 @@
 			reg = <0x90000 0x10000>,
 			reg = <0x90000 0x10000>,
 			      <0xf2200000 0x800>;
 			      <0xf2200000 0x800>;
 			reg-names = "regs", "sram";
 			reg-names = "regs", "sram";
-			interrupts = <22>;
+			interrupts = <28>;
 			status = "okay";
 			status = "okay";
 		};
 		};
 	};
 	};

+ 1 - 1
arch/arm/include/asm/delay.h

@@ -24,7 +24,7 @@ extern struct arm_delay_ops {
 	void (*delay)(unsigned long);
 	void (*delay)(unsigned long);
 	void (*const_udelay)(unsigned long);
 	void (*const_udelay)(unsigned long);
 	void (*udelay)(unsigned long);
 	void (*udelay)(unsigned long);
-	bool const_clock;
+	unsigned long ticks_per_jiffy;
 } arm_delay_ops;
 } arm_delay_ops;
 
 
 #define __delay(n)		arm_delay_ops.delay(n)
 #define __delay(n)		arm_delay_ops.delay(n)

+ 7 - 0
arch/arm/include/asm/highmem.h

@@ -41,6 +41,13 @@ extern void kunmap_high(struct page *page);
 #endif
 #endif
 #endif
 #endif
 
 
+/*
+ * Needed to be able to broadcast the TLB invalidation for kmap.
+ */
+#ifdef CONFIG_ARM_ERRATA_798181
+#undef ARCH_NEEDS_KMAP_HIGH_GET
+#endif
+
 #ifdef ARCH_NEEDS_KMAP_HIGH_GET
 #ifdef ARCH_NEEDS_KMAP_HIGH_GET
 extern void *kmap_high_get(struct page *page);
 extern void *kmap_high_get(struct page *page);
 #else
 #else

+ 2 - 0
arch/arm/include/asm/mmu_context.h

@@ -27,6 +27,8 @@ void __check_vmalloc_seq(struct mm_struct *mm);
 void check_and_switch_context(struct mm_struct *mm, struct task_struct *tsk);
 void check_and_switch_context(struct mm_struct *mm, struct task_struct *tsk);
 #define init_new_context(tsk,mm)	({ atomic64_set(&mm->context.id, 0); 0; })
 #define init_new_context(tsk,mm)	({ atomic64_set(&mm->context.id, 0); 0; })
 
 
+DECLARE_PER_CPU(atomic64_t, active_asids);
+
 #else	/* !CONFIG_CPU_HAS_ASID */
 #else	/* !CONFIG_CPU_HAS_ASID */
 
 
 #ifdef CONFIG_MMU
 #ifdef CONFIG_MMU

+ 15 - 0
arch/arm/include/asm/tlbflush.h

@@ -450,6 +450,21 @@ static inline void local_flush_bp_all(void)
 		isb();
 		isb();
 }
 }
 
 
+#ifdef CONFIG_ARM_ERRATA_798181
+static inline void dummy_flush_tlb_a15_erratum(void)
+{
+	/*
+	 * Dummy TLBIMVAIS. Using the unmapped address 0 and ASID 0.
+	 */
+	asm("mcr p15, 0, %0, c8, c3, 1" : : "r" (0));
+	dsb();
+}
+#else
+static inline void dummy_flush_tlb_a15_erratum(void)
+{
+}
+#endif
+
 /*
 /*
  *	flush_pmd_entry
  *	flush_pmd_entry
  *
  *

+ 12 - 0
arch/arm/kernel/entry-common.S

@@ -276,7 +276,13 @@ ENDPROC(ftrace_graph_caller_old)
  */
  */
 
 
 .macro mcount_enter
 .macro mcount_enter
+/*
+ * This pad compensates for the push {lr} at the call site.  Note that we are
+ * unable to unwind through a function which does not otherwise save its lr.
+ */
+ UNWIND(.pad	#4)
 	stmdb	sp!, {r0-r3, lr}
 	stmdb	sp!, {r0-r3, lr}
+ UNWIND(.save	{r0-r3, lr})
 .endm
 .endm
 
 
 .macro mcount_get_lr reg
 .macro mcount_get_lr reg
@@ -289,6 +295,7 @@ ENDPROC(ftrace_graph_caller_old)
 .endm
 .endm
 
 
 ENTRY(__gnu_mcount_nc)
 ENTRY(__gnu_mcount_nc)
+UNWIND(.fnstart)
 #ifdef CONFIG_DYNAMIC_FTRACE
 #ifdef CONFIG_DYNAMIC_FTRACE
 	mov	ip, lr
 	mov	ip, lr
 	ldmia	sp!, {lr}
 	ldmia	sp!, {lr}
@@ -296,17 +303,22 @@ ENTRY(__gnu_mcount_nc)
 #else
 #else
 	__mcount
 	__mcount
 #endif
 #endif
+UNWIND(.fnend)
 ENDPROC(__gnu_mcount_nc)
 ENDPROC(__gnu_mcount_nc)
 
 
 #ifdef CONFIG_DYNAMIC_FTRACE
 #ifdef CONFIG_DYNAMIC_FTRACE
 ENTRY(ftrace_caller)
 ENTRY(ftrace_caller)
+UNWIND(.fnstart)
 	__ftrace_caller
 	__ftrace_caller
+UNWIND(.fnend)
 ENDPROC(ftrace_caller)
 ENDPROC(ftrace_caller)
 #endif
 #endif
 
 
 #ifdef CONFIG_FUNCTION_GRAPH_TRACER
 #ifdef CONFIG_FUNCTION_GRAPH_TRACER
 ENTRY(ftrace_graph_caller)
 ENTRY(ftrace_graph_caller)
+UNWIND(.fnstart)
 	__ftrace_graph_caller
 	__ftrace_graph_caller
+UNWIND(.fnend)
 ENDPROC(ftrace_graph_caller)
 ENDPROC(ftrace_graph_caller)
 #endif
 #endif
 
 

+ 1 - 1
arch/arm/kernel/head.S

@@ -267,7 +267,7 @@ __create_page_tables:
 	addne	r6, r6, #1 << SECTION_SHIFT
 	addne	r6, r6, #1 << SECTION_SHIFT
 	strne	r6, [r3]
 	strne	r6, [r3]
 
 
-#if defined(CONFIG_LPAE) && defined(CONFIG_CPU_ENDIAN_BE8)
+#if defined(CONFIG_ARM_LPAE) && defined(CONFIG_CPU_ENDIAN_BE8)
 	sub	r4, r4, #4			@ Fixup page table pointer
 	sub	r4, r4, #4			@ Fixup page table pointer
 						@ for 64-bit descriptors
 						@ for 64-bit descriptors
 #endif
 #endif

+ 3 - 3
arch/arm/kernel/hw_breakpoint.c

@@ -966,7 +966,7 @@ static void reset_ctrl_regs(void *unused)
 	}
 	}
 
 
 	if (err) {
 	if (err) {
-		pr_warning("CPU %d debug is powered down!\n", cpu);
+		pr_warn_once("CPU %d debug is powered down!\n", cpu);
 		cpumask_or(&debug_err_mask, &debug_err_mask, cpumask_of(cpu));
 		cpumask_or(&debug_err_mask, &debug_err_mask, cpumask_of(cpu));
 		return;
 		return;
 	}
 	}
@@ -987,7 +987,7 @@ clear_vcr:
 	isb();
 	isb();
 
 
 	if (cpumask_intersects(&debug_err_mask, cpumask_of(cpu))) {
 	if (cpumask_intersects(&debug_err_mask, cpumask_of(cpu))) {
-		pr_warning("CPU %d failed to disable vector catch\n", cpu);
+		pr_warn_once("CPU %d failed to disable vector catch\n", cpu);
 		return;
 		return;
 	}
 	}
 
 
@@ -1007,7 +1007,7 @@ clear_vcr:
 	}
 	}
 
 
 	if (cpumask_intersects(&debug_err_mask, cpumask_of(cpu))) {
 	if (cpumask_intersects(&debug_err_mask, cpumask_of(cpu))) {
-		pr_warning("CPU %d failed to clear debug register pairs\n", cpu);
+		pr_warn_once("CPU %d failed to clear debug register pairs\n", cpu);
 		return;
 		return;
 	}
 	}
 
 

+ 22 - 2
arch/arm/kernel/setup.c

@@ -353,6 +353,23 @@ void __init early_print(const char *str, ...)
 	printk("%s", buf);
 	printk("%s", buf);
 }
 }
 
 
+static void __init cpuid_init_hwcaps(void)
+{
+	unsigned int divide_instrs;
+
+	if (cpu_architecture() < CPU_ARCH_ARMv7)
+		return;
+
+	divide_instrs = (read_cpuid_ext(CPUID_EXT_ISAR0) & 0x0f000000) >> 24;
+
+	switch (divide_instrs) {
+	case 2:
+		elf_hwcap |= HWCAP_IDIVA;
+	case 1:
+		elf_hwcap |= HWCAP_IDIVT;
+	}
+}
+
 static void __init feat_v6_fixup(void)
 static void __init feat_v6_fixup(void)
 {
 {
 	int id = read_cpuid_id();
 	int id = read_cpuid_id();
@@ -483,8 +500,11 @@ static void __init setup_processor(void)
 	snprintf(elf_platform, ELF_PLATFORM_SIZE, "%s%c",
 	snprintf(elf_platform, ELF_PLATFORM_SIZE, "%s%c",
 		 list->elf_name, ENDIANNESS);
 		 list->elf_name, ENDIANNESS);
 	elf_hwcap = list->elf_hwcap;
 	elf_hwcap = list->elf_hwcap;
+
+	cpuid_init_hwcaps();
+
 #ifndef CONFIG_ARM_THUMB
 #ifndef CONFIG_ARM_THUMB
-	elf_hwcap &= ~HWCAP_THUMB;
+	elf_hwcap &= ~(HWCAP_THUMB | HWCAP_IDIVT);
 #endif
 #endif
 
 
 	feat_v6_fixup();
 	feat_v6_fixup();
@@ -524,7 +544,7 @@ int __init arm_add_memory(phys_addr_t start, phys_addr_t size)
 	size -= start & ~PAGE_MASK;
 	size -= start & ~PAGE_MASK;
 	bank->start = PAGE_ALIGN(start);
 	bank->start = PAGE_ALIGN(start);
 
 
-#ifndef CONFIG_LPAE
+#ifndef CONFIG_ARM_LPAE
 	if (bank->start + size < bank->start) {
 	if (bank->start + size < bank->start) {
 		printk(KERN_CRIT "Truncating memory at 0x%08llx to fit in "
 		printk(KERN_CRIT "Truncating memory at 0x%08llx to fit in "
 			"32-bit physical address space\n", (long long)start);
 			"32-bit physical address space\n", (long long)start);

+ 0 - 3
arch/arm/kernel/smp.c

@@ -673,9 +673,6 @@ static int cpufreq_callback(struct notifier_block *nb,
 	if (freq->flags & CPUFREQ_CONST_LOOPS)
 	if (freq->flags & CPUFREQ_CONST_LOOPS)
 		return NOTIFY_OK;
 		return NOTIFY_OK;
 
 
-	if (arm_delay_ops.const_clock)
-		return NOTIFY_OK;
-
 	if (!per_cpu(l_p_j_ref, cpu)) {
 	if (!per_cpu(l_p_j_ref, cpu)) {
 		per_cpu(l_p_j_ref, cpu) =
 		per_cpu(l_p_j_ref, cpu) =
 			per_cpu(cpu_data, cpu).loops_per_jiffy;
 			per_cpu(cpu_data, cpu).loops_per_jiffy;

+ 66 - 0
arch/arm/kernel/smp_tlb.c

@@ -12,6 +12,7 @@
 
 
 #include <asm/smp_plat.h>
 #include <asm/smp_plat.h>
 #include <asm/tlbflush.h>
 #include <asm/tlbflush.h>
+#include <asm/mmu_context.h>
 
 
 /**********************************************************************/
 /**********************************************************************/
 
 
@@ -69,12 +70,72 @@ static inline void ipi_flush_bp_all(void *ignored)
 	local_flush_bp_all();
 	local_flush_bp_all();
 }
 }
 
 
+#ifdef CONFIG_ARM_ERRATA_798181
+static int erratum_a15_798181(void)
+{
+	unsigned int midr = read_cpuid_id();
+
+	/* Cortex-A15 r0p0..r3p2 affected */
+	if ((midr & 0xff0ffff0) != 0x410fc0f0 || midr > 0x413fc0f2)
+		return 0;
+	return 1;
+}
+#else
+static int erratum_a15_798181(void)
+{
+	return 0;
+}
+#endif
+
+static void ipi_flush_tlb_a15_erratum(void *arg)
+{
+	dmb();
+}
+
+static void broadcast_tlb_a15_erratum(void)
+{
+	if (!erratum_a15_798181())
+		return;
+
+	dummy_flush_tlb_a15_erratum();
+	smp_call_function_many(cpu_online_mask, ipi_flush_tlb_a15_erratum,
+			       NULL, 1);
+}
+
+static void broadcast_tlb_mm_a15_erratum(struct mm_struct *mm)
+{
+	int cpu;
+	cpumask_t mask = { CPU_BITS_NONE };
+
+	if (!erratum_a15_798181())
+		return;
+
+	dummy_flush_tlb_a15_erratum();
+	for_each_online_cpu(cpu) {
+		if (cpu == smp_processor_id())
+			continue;
+		/*
+		 * We only need to send an IPI if the other CPUs are running
+		 * the same ASID as the one being invalidated. There is no
+		 * need for locking around the active_asids check since the
+		 * switch_mm() function has at least one dmb() (as required by
+		 * this workaround) in case a context switch happens on
+		 * another CPU after the condition below.
+		 */
+		if (atomic64_read(&mm->context.id) ==
+		    atomic64_read(&per_cpu(active_asids, cpu)))
+			cpumask_set_cpu(cpu, &mask);
+	}
+	smp_call_function_many(&mask, ipi_flush_tlb_a15_erratum, NULL, 1);
+}
+
 void flush_tlb_all(void)
 void flush_tlb_all(void)
 {
 {
 	if (tlb_ops_need_broadcast())
 	if (tlb_ops_need_broadcast())
 		on_each_cpu(ipi_flush_tlb_all, NULL, 1);
 		on_each_cpu(ipi_flush_tlb_all, NULL, 1);
 	else
 	else
 		local_flush_tlb_all();
 		local_flush_tlb_all();
+	broadcast_tlb_a15_erratum();
 }
 }
 
 
 void flush_tlb_mm(struct mm_struct *mm)
 void flush_tlb_mm(struct mm_struct *mm)
@@ -83,6 +144,7 @@ void flush_tlb_mm(struct mm_struct *mm)
 		on_each_cpu_mask(mm_cpumask(mm), ipi_flush_tlb_mm, mm, 1);
 		on_each_cpu_mask(mm_cpumask(mm), ipi_flush_tlb_mm, mm, 1);
 	else
 	else
 		local_flush_tlb_mm(mm);
 		local_flush_tlb_mm(mm);
+	broadcast_tlb_mm_a15_erratum(mm);
 }
 }
 
 
 void flush_tlb_page(struct vm_area_struct *vma, unsigned long uaddr)
 void flush_tlb_page(struct vm_area_struct *vma, unsigned long uaddr)
@@ -95,6 +157,7 @@ void flush_tlb_page(struct vm_area_struct *vma, unsigned long uaddr)
 					&ta, 1);
 					&ta, 1);
 	} else
 	} else
 		local_flush_tlb_page(vma, uaddr);
 		local_flush_tlb_page(vma, uaddr);
+	broadcast_tlb_mm_a15_erratum(vma->vm_mm);
 }
 }
 
 
 void flush_tlb_kernel_page(unsigned long kaddr)
 void flush_tlb_kernel_page(unsigned long kaddr)
@@ -105,6 +168,7 @@ void flush_tlb_kernel_page(unsigned long kaddr)
 		on_each_cpu(ipi_flush_tlb_kernel_page, &ta, 1);
 		on_each_cpu(ipi_flush_tlb_kernel_page, &ta, 1);
 	} else
 	} else
 		local_flush_tlb_kernel_page(kaddr);
 		local_flush_tlb_kernel_page(kaddr);
+	broadcast_tlb_a15_erratum();
 }
 }
 
 
 void flush_tlb_range(struct vm_area_struct *vma,
 void flush_tlb_range(struct vm_area_struct *vma,
@@ -119,6 +183,7 @@ void flush_tlb_range(struct vm_area_struct *vma,
 					&ta, 1);
 					&ta, 1);
 	} else
 	} else
 		local_flush_tlb_range(vma, start, end);
 		local_flush_tlb_range(vma, start, end);
+	broadcast_tlb_mm_a15_erratum(vma->vm_mm);
 }
 }
 
 
 void flush_tlb_kernel_range(unsigned long start, unsigned long end)
 void flush_tlb_kernel_range(unsigned long start, unsigned long end)
@@ -130,6 +195,7 @@ void flush_tlb_kernel_range(unsigned long start, unsigned long end)
 		on_each_cpu(ipi_flush_tlb_kernel_range, &ta, 1);
 		on_each_cpu(ipi_flush_tlb_kernel_range, &ta, 1);
 	} else
 	} else
 		local_flush_tlb_kernel_range(start, end);
 		local_flush_tlb_kernel_range(start, end);
+	broadcast_tlb_a15_erratum();
 }
 }
 
 
 void flush_bp_all(void)
 void flush_bp_all(void)

+ 14 - 21
arch/arm/kvm/vgic.c

@@ -883,8 +883,7 @@ static bool vgic_queue_irq(struct kvm_vcpu *vcpu, u8 sgi_source_id, int irq)
 			  lr, irq, vgic_cpu->vgic_lr[lr]);
 			  lr, irq, vgic_cpu->vgic_lr[lr]);
 		BUG_ON(!test_bit(lr, vgic_cpu->lr_used));
 		BUG_ON(!test_bit(lr, vgic_cpu->lr_used));
 		vgic_cpu->vgic_lr[lr] |= GICH_LR_PENDING_BIT;
 		vgic_cpu->vgic_lr[lr] |= GICH_LR_PENDING_BIT;
-
-		goto out;
+		return true;
 	}
 	}
 
 
 	/* Try to use another LR for this interrupt */
 	/* Try to use another LR for this interrupt */
@@ -898,7 +897,6 @@ static bool vgic_queue_irq(struct kvm_vcpu *vcpu, u8 sgi_source_id, int irq)
 	vgic_cpu->vgic_irq_lr_map[irq] = lr;
 	vgic_cpu->vgic_irq_lr_map[irq] = lr;
 	set_bit(lr, vgic_cpu->lr_used);
 	set_bit(lr, vgic_cpu->lr_used);
 
 
-out:
 	if (!vgic_irq_is_edge(vcpu, irq))
 	if (!vgic_irq_is_edge(vcpu, irq))
 		vgic_cpu->vgic_lr[lr] |= GICH_LR_EOI;
 		vgic_cpu->vgic_lr[lr] |= GICH_LR_EOI;
 
 
@@ -1018,21 +1016,6 @@ static bool vgic_process_maintenance(struct kvm_vcpu *vcpu)
 
 
 	kvm_debug("MISR = %08x\n", vgic_cpu->vgic_misr);
 	kvm_debug("MISR = %08x\n", vgic_cpu->vgic_misr);
 
 
-	/*
-	 * We do not need to take the distributor lock here, since the only
-	 * action we perform is clearing the irq_active_bit for an EOIed
-	 * level interrupt.  There is a potential race with
-	 * the queuing of an interrupt in __kvm_vgic_flush_hwstate(), where we
-	 * check if the interrupt is already active. Two possibilities:
-	 *
-	 * - The queuing is occurring on the same vcpu: cannot happen,
-	 *   as we're already in the context of this vcpu, and
-	 *   executing the handler
-	 * - The interrupt has been migrated to another vcpu, and we
-	 *   ignore this interrupt for this run. Big deal. It is still
-	 *   pending though, and will get considered when this vcpu
-	 *   exits.
-	 */
 	if (vgic_cpu->vgic_misr & GICH_MISR_EOI) {
 	if (vgic_cpu->vgic_misr & GICH_MISR_EOI) {
 		/*
 		/*
 		 * Some level interrupts have been EOIed. Clear their
 		 * Some level interrupts have been EOIed. Clear their
@@ -1054,6 +1037,13 @@ static bool vgic_process_maintenance(struct kvm_vcpu *vcpu)
 			} else {
 			} else {
 				vgic_cpu_irq_clear(vcpu, irq);
 				vgic_cpu_irq_clear(vcpu, irq);
 			}
 			}
+
+			/*
+			 * Despite being EOIed, the LR may not have
+			 * been marked as empty.
+			 */
+			set_bit(lr, (unsigned long *)vgic_cpu->vgic_elrsr);
+			vgic_cpu->vgic_lr[lr] &= ~GICH_LR_ACTIVE_BIT;
 		}
 		}
 	}
 	}
 
 
@@ -1064,9 +1054,8 @@ static bool vgic_process_maintenance(struct kvm_vcpu *vcpu)
 }
 }
 
 
 /*
 /*
- * Sync back the VGIC state after a guest run. We do not really touch
- * the distributor here (the irq_pending_on_cpu bit is safe to set),
- * so there is no need for taking its lock.
+ * Sync back the VGIC state after a guest run. The distributor lock is
+ * needed so we don't get preempted in the middle of the state processing.
  */
  */
 static void __kvm_vgic_sync_hwstate(struct kvm_vcpu *vcpu)
 static void __kvm_vgic_sync_hwstate(struct kvm_vcpu *vcpu)
 {
 {
@@ -1112,10 +1101,14 @@ void kvm_vgic_flush_hwstate(struct kvm_vcpu *vcpu)
 
 
 void kvm_vgic_sync_hwstate(struct kvm_vcpu *vcpu)
 void kvm_vgic_sync_hwstate(struct kvm_vcpu *vcpu)
 {
 {
+	struct vgic_dist *dist = &vcpu->kvm->arch.vgic;
+
 	if (!irqchip_in_kernel(vcpu->kvm))
 	if (!irqchip_in_kernel(vcpu->kvm))
 		return;
 		return;
 
 
+	spin_lock(&dist->lock);
 	__kvm_vgic_sync_hwstate(vcpu);
 	__kvm_vgic_sync_hwstate(vcpu);
+	spin_unlock(&dist->lock);
 }
 }
 
 
 int kvm_vgic_vcpu_pending_irq(struct kvm_vcpu *vcpu)
 int kvm_vgic_vcpu_pending_irq(struct kvm_vcpu *vcpu)

+ 5 - 3
arch/arm/lib/delay.c

@@ -58,7 +58,7 @@ static void __timer_delay(unsigned long cycles)
 static void __timer_const_udelay(unsigned long xloops)
 static void __timer_const_udelay(unsigned long xloops)
 {
 {
 	unsigned long long loops = xloops;
 	unsigned long long loops = xloops;
-	loops *= loops_per_jiffy;
+	loops *= arm_delay_ops.ticks_per_jiffy;
 	__timer_delay(loops >> UDELAY_SHIFT);
 	__timer_delay(loops >> UDELAY_SHIFT);
 }
 }
 
 
@@ -73,11 +73,13 @@ void __init register_current_timer_delay(const struct delay_timer *timer)
 		pr_info("Switching to timer-based delay loop\n");
 		pr_info("Switching to timer-based delay loop\n");
 		delay_timer			= timer;
 		delay_timer			= timer;
 		lpj_fine			= timer->freq / HZ;
 		lpj_fine			= timer->freq / HZ;
-		loops_per_jiffy			= lpj_fine;
+
+		/* cpufreq may scale loops_per_jiffy, so keep a private copy */
+		arm_delay_ops.ticks_per_jiffy	= lpj_fine;
 		arm_delay_ops.delay		= __timer_delay;
 		arm_delay_ops.delay		= __timer_delay;
 		arm_delay_ops.const_udelay	= __timer_const_udelay;
 		arm_delay_ops.const_udelay	= __timer_const_udelay;
 		arm_delay_ops.udelay		= __timer_udelay;
 		arm_delay_ops.udelay		= __timer_udelay;
-		arm_delay_ops.const_clock	= true;
+
 		delay_calibrated		= true;
 		delay_calibrated		= true;
 	} else {
 	} else {
 		pr_info("Ignoring duplicate/late registration of read_current_timer delay\n");
 		pr_info("Ignoring duplicate/late registration of read_current_timer delay\n");

+ 3 - 13
arch/arm/mach-cns3xxx/core.c

@@ -22,19 +22,9 @@
 
 
 static struct map_desc cns3xxx_io_desc[] __initdata = {
 static struct map_desc cns3xxx_io_desc[] __initdata = {
 	{
 	{
-		.virtual	= CNS3XXX_TC11MP_TWD_BASE_VIRT,
-		.pfn		= __phys_to_pfn(CNS3XXX_TC11MP_TWD_BASE),
-		.length		= SZ_4K,
-		.type		= MT_DEVICE,
-	}, {
-		.virtual	= CNS3XXX_TC11MP_GIC_CPU_BASE_VIRT,
-		.pfn		= __phys_to_pfn(CNS3XXX_TC11MP_GIC_CPU_BASE),
-		.length		= SZ_4K,
-		.type		= MT_DEVICE,
-	}, {
-		.virtual	= CNS3XXX_TC11MP_GIC_DIST_BASE_VIRT,
-		.pfn		= __phys_to_pfn(CNS3XXX_TC11MP_GIC_DIST_BASE),
-		.length		= SZ_4K,
+		.virtual	= CNS3XXX_TC11MP_SCU_BASE_VIRT,
+		.pfn		= __phys_to_pfn(CNS3XXX_TC11MP_SCU_BASE),
+		.length		= SZ_8K,
 		.type		= MT_DEVICE,
 		.type		= MT_DEVICE,
 	}, {
 	}, {
 		.virtual	= CNS3XXX_TIMER1_2_3_BASE_VIRT,
 		.virtual	= CNS3XXX_TIMER1_2_3_BASE_VIRT,

+ 8 - 8
arch/arm/mach-cns3xxx/include/mach/cns3xxx.h

@@ -94,10 +94,10 @@
 #define RTC_INTR_STS_OFFSET			0x34
 #define RTC_INTR_STS_OFFSET			0x34
 
 
 #define CNS3XXX_MISC_BASE			0x76000000	/* Misc Control */
 #define CNS3XXX_MISC_BASE			0x76000000	/* Misc Control */
-#define CNS3XXX_MISC_BASE_VIRT			0xFFF07000	/* Misc Control */
+#define CNS3XXX_MISC_BASE_VIRT			0xFB000000	/* Misc Control */
 
 
 #define CNS3XXX_PM_BASE				0x77000000	/* Power Management Control */
 #define CNS3XXX_PM_BASE				0x77000000	/* Power Management Control */
-#define CNS3XXX_PM_BASE_VIRT			0xFFF08000
+#define CNS3XXX_PM_BASE_VIRT			0xFB001000
 
 
 #define PM_CLK_GATE_OFFSET			0x00
 #define PM_CLK_GATE_OFFSET			0x00
 #define PM_SOFT_RST_OFFSET			0x04
 #define PM_SOFT_RST_OFFSET			0x04
@@ -109,7 +109,7 @@
 #define PM_PLL_HM_PD_OFFSET			0x1C
 #define PM_PLL_HM_PD_OFFSET			0x1C
 
 
 #define CNS3XXX_UART0_BASE			0x78000000	/* UART 0 */
 #define CNS3XXX_UART0_BASE			0x78000000	/* UART 0 */
-#define CNS3XXX_UART0_BASE_VIRT			0xFFF09000
+#define CNS3XXX_UART0_BASE_VIRT			0xFB002000
 
 
 #define CNS3XXX_UART1_BASE			0x78400000	/* UART 1 */
 #define CNS3XXX_UART1_BASE			0x78400000	/* UART 1 */
 #define CNS3XXX_UART1_BASE_VIRT			0xFFF0A000
 #define CNS3XXX_UART1_BASE_VIRT			0xFFF0A000
@@ -130,7 +130,7 @@
 #define CNS3XXX_I2S_BASE_VIRT			0xFFF10000
 #define CNS3XXX_I2S_BASE_VIRT			0xFFF10000
 
 
 #define CNS3XXX_TIMER1_2_3_BASE			0x7C800000	/* Timer */
 #define CNS3XXX_TIMER1_2_3_BASE			0x7C800000	/* Timer */
-#define CNS3XXX_TIMER1_2_3_BASE_VIRT		0xFFF10800
+#define CNS3XXX_TIMER1_2_3_BASE_VIRT		0xFB003000
 
 
 #define TIMER1_COUNTER_OFFSET			0x00
 #define TIMER1_COUNTER_OFFSET			0x00
 #define TIMER1_AUTO_RELOAD_OFFSET		0x04
 #define TIMER1_AUTO_RELOAD_OFFSET		0x04
@@ -227,16 +227,16 @@
  * Testchip peripheral and fpga gic regions
  * Testchip peripheral and fpga gic regions
  */
  */
 #define CNS3XXX_TC11MP_SCU_BASE			0x90000000	/* IRQ, Test chip */
 #define CNS3XXX_TC11MP_SCU_BASE			0x90000000	/* IRQ, Test chip */
-#define CNS3XXX_TC11MP_SCU_BASE_VIRT		0xFF000000
+#define CNS3XXX_TC11MP_SCU_BASE_VIRT		0xFB004000
 
 
 #define CNS3XXX_TC11MP_GIC_CPU_BASE		0x90000100	/* Test chip interrupt controller CPU interface */
 #define CNS3XXX_TC11MP_GIC_CPU_BASE		0x90000100	/* Test chip interrupt controller CPU interface */
-#define CNS3XXX_TC11MP_GIC_CPU_BASE_VIRT	0xFF000100
+#define CNS3XXX_TC11MP_GIC_CPU_BASE_VIRT	(CNS3XXX_TC11MP_SCU_BASE_VIRT + 0x100)
 
 
 #define CNS3XXX_TC11MP_TWD_BASE			0x90000600
 #define CNS3XXX_TC11MP_TWD_BASE			0x90000600
-#define CNS3XXX_TC11MP_TWD_BASE_VIRT		0xFF000600
+#define CNS3XXX_TC11MP_TWD_BASE_VIRT		(CNS3XXX_TC11MP_SCU_BASE_VIRT + 0x600)
 
 
 #define CNS3XXX_TC11MP_GIC_DIST_BASE		0x90001000	/* Test chip interrupt controller distributor */
 #define CNS3XXX_TC11MP_GIC_DIST_BASE		0x90001000	/* Test chip interrupt controller distributor */
-#define CNS3XXX_TC11MP_GIC_DIST_BASE_VIRT	0xFF001000
+#define CNS3XXX_TC11MP_GIC_DIST_BASE_VIRT	(CNS3XXX_TC11MP_SCU_BASE_VIRT + 0x1000)
 
 
 #define CNS3XXX_TC11MP_L220_BASE		0x92002000	/* L220 registers */
 #define CNS3XXX_TC11MP_L220_BASE		0x92002000	/* L220 registers */
 #define CNS3XXX_TC11MP_L220_BASE_VIRT		0xFF002000
 #define CNS3XXX_TC11MP_L220_BASE_VIRT		0xFF002000

+ 7 - 3
arch/arm/mach-ep93xx/include/mach/uncompress.h

@@ -47,9 +47,13 @@ static void __raw_writel(unsigned int value, unsigned int ptr)
 
 
 static inline void putc(int c)
 static inline void putc(int c)
 {
 {
-	/* Transmit fifo not full?  */
-	while (__raw_readb(PHYS_UART_FLAG) & UART_FLAG_TXFF)
-		;
+	int i;
+
+	for (i = 0; i < 10000; i++) {
+		/* Transmit fifo not full? */
+		if (!(__raw_readb(PHYS_UART_FLAG) & UART_FLAG_TXFF))
+			break;
+	}
 
 
 	__raw_writeb(c, PHYS_UART_DATA);
 	__raw_writeb(c, PHYS_UART_DATA);
 }
 }

+ 2 - 0
arch/arm/mach-imx/common.h

@@ -110,6 +110,8 @@ void tzic_handle_irq(struct pt_regs *);
 
 
 extern void imx_enable_cpu(int cpu, bool enable);
 extern void imx_enable_cpu(int cpu, bool enable);
 extern void imx_set_cpu_jump(int cpu, void *jump_addr);
 extern void imx_set_cpu_jump(int cpu, void *jump_addr);
+extern u32 imx_get_cpu_arg(int cpu);
+extern void imx_set_cpu_arg(int cpu, u32 arg);
 extern void v7_cpu_resume(void);
 extern void v7_cpu_resume(void);
 extern u32 *pl310_get_save_ptr(void);
 extern u32 *pl310_get_save_ptr(void);
 #ifdef CONFIG_SMP
 #ifdef CONFIG_SMP

+ 12 - 0
arch/arm/mach-imx/hotplug.c

@@ -46,11 +46,23 @@ static inline void cpu_enter_lowpower(void)
 void imx_cpu_die(unsigned int cpu)
 void imx_cpu_die(unsigned int cpu)
 {
 {
 	cpu_enter_lowpower();
 	cpu_enter_lowpower();
+	/*
+	 * We use the cpu jumping argument register to sync with
+	 * imx_cpu_kill() which is running on cpu0 and waiting for
+	 * the register being cleared to kill the cpu.
+	 */
+	imx_set_cpu_arg(cpu, ~0);
 	cpu_do_idle();
 	cpu_do_idle();
 }
 }
 
 
 int imx_cpu_kill(unsigned int cpu)
 int imx_cpu_kill(unsigned int cpu)
 {
 {
+	unsigned long timeout = jiffies + msecs_to_jiffies(50);
+
+	while (imx_get_cpu_arg(cpu) == 0)
+		if (time_after(jiffies, timeout))
+			return 0;
 	imx_enable_cpu(cpu, false);
 	imx_enable_cpu(cpu, false);
+	imx_set_cpu_arg(cpu, 0);
 	return 1;
 	return 1;
 }
 }

+ 12 - 0
arch/arm/mach-imx/src.c

@@ -43,6 +43,18 @@ void imx_set_cpu_jump(int cpu, void *jump_addr)
 		       src_base + SRC_GPR1 + cpu * 8);
 		       src_base + SRC_GPR1 + cpu * 8);
 }
 }
 
 
+u32 imx_get_cpu_arg(int cpu)
+{
+	cpu = cpu_logical_map(cpu);
+	return readl_relaxed(src_base + SRC_GPR1 + cpu * 8 + 4);
+}
+
+void imx_set_cpu_arg(int cpu, u32 arg)
+{
+	cpu = cpu_logical_map(cpu);
+	writel_relaxed(arg, src_base + SRC_GPR1 + cpu * 8 + 4);
+}
+
 void imx_src_prepare_restart(void)
 void imx_src_prepare_restart(void)
 {
 {
 	u32 val;
 	u32 val;

+ 2 - 0
arch/arm/mach-kirkwood/guruplug-setup.c

@@ -53,6 +53,8 @@ static struct mv_sata_platform_data guruplug_sata_data = {
 
 
 static struct mvsdio_platform_data guruplug_mvsdio_data = {
 static struct mvsdio_platform_data guruplug_mvsdio_data = {
 	/* unfortunately the CD signal has not been connected */
 	/* unfortunately the CD signal has not been connected */
+	.gpio_card_detect = -1,
+	.gpio_write_protect = -1,
 };
 };
 
 
 static struct gpio_led guruplug_led_pins[] = {
 static struct gpio_led guruplug_led_pins[] = {

+ 1 - 0
arch/arm/mach-kirkwood/openrd-setup.c

@@ -55,6 +55,7 @@ static struct mv_sata_platform_data openrd_sata_data = {
 
 
 static struct mvsdio_platform_data openrd_mvsdio_data = {
 static struct mvsdio_platform_data openrd_mvsdio_data = {
 	.gpio_card_detect = 29,	/* MPP29 used as SD card detect */
 	.gpio_card_detect = 29,	/* MPP29 used as SD card detect */
+	.gpio_write_protect = -1,
 };
 };
 
 
 static unsigned int openrd_mpp_config[] __initdata = {
 static unsigned int openrd_mpp_config[] __initdata = {

+ 1 - 0
arch/arm/mach-kirkwood/rd88f6281-setup.c

@@ -69,6 +69,7 @@ static struct mv_sata_platform_data rd88f6281_sata_data = {
 
 
 static struct mvsdio_platform_data rd88f6281_mvsdio_data = {
 static struct mvsdio_platform_data rd88f6281_mvsdio_data = {
 	.gpio_card_detect = 28,
 	.gpio_card_detect = 28,
+	.gpio_write_protect = -1,
 };
 };
 
 
 static unsigned int rd88f6281_mpp_config[] __initdata = {
 static unsigned int rd88f6281_mpp_config[] __initdata = {

+ 4 - 1
arch/arm/mach-msm/timer.c

@@ -62,7 +62,10 @@ static int msm_timer_set_next_event(unsigned long cycles,
 {
 {
 	u32 ctrl = readl_relaxed(event_base + TIMER_ENABLE);
 	u32 ctrl = readl_relaxed(event_base + TIMER_ENABLE);
 
 
-	writel_relaxed(0, event_base + TIMER_CLEAR);
+	ctrl &= ~TIMER_ENABLE_EN;
+	writel_relaxed(ctrl, event_base + TIMER_ENABLE);
+
+	writel_relaxed(ctrl, event_base + TIMER_CLEAR);
 	writel_relaxed(cycles, event_base + TIMER_MATCH_VAL);
 	writel_relaxed(cycles, event_base + TIMER_MATCH_VAL);
 	writel_relaxed(ctrl | TIMER_ENABLE_EN, event_base + TIMER_ENABLE);
 	writel_relaxed(ctrl | TIMER_ENABLE_EN, event_base + TIMER_ENABLE);
 	return 0;
 	return 0;

+ 5 - 3
arch/arm/mach-mvebu/irq-armada-370-xp.c

@@ -44,6 +44,8 @@
 
 
 #define ARMADA_370_XP_MAX_PER_CPU_IRQS		(28)
 #define ARMADA_370_XP_MAX_PER_CPU_IRQS		(28)
 
 
+#define ARMADA_370_XP_TIMER0_PER_CPU_IRQ	(5)
+
 #define ACTIVE_DOORBELLS			(8)
 #define ACTIVE_DOORBELLS			(8)
 
 
 static DEFINE_RAW_SPINLOCK(irq_controller_lock);
 static DEFINE_RAW_SPINLOCK(irq_controller_lock);
@@ -62,7 +64,7 @@ static void armada_370_xp_irq_mask(struct irq_data *d)
 #ifdef CONFIG_SMP
 #ifdef CONFIG_SMP
 	irq_hw_number_t hwirq = irqd_to_hwirq(d);
 	irq_hw_number_t hwirq = irqd_to_hwirq(d);
 
 
-	if (hwirq > ARMADA_370_XP_MAX_PER_CPU_IRQS)
+	if (hwirq != ARMADA_370_XP_TIMER0_PER_CPU_IRQ)
 		writel(hwirq, main_int_base +
 		writel(hwirq, main_int_base +
 				ARMADA_370_XP_INT_CLEAR_ENABLE_OFFS);
 				ARMADA_370_XP_INT_CLEAR_ENABLE_OFFS);
 	else
 	else
@@ -79,7 +81,7 @@ static void armada_370_xp_irq_unmask(struct irq_data *d)
 #ifdef CONFIG_SMP
 #ifdef CONFIG_SMP
 	irq_hw_number_t hwirq = irqd_to_hwirq(d);
 	irq_hw_number_t hwirq = irqd_to_hwirq(d);
 
 
-	if (hwirq > ARMADA_370_XP_MAX_PER_CPU_IRQS)
+	if (hwirq != ARMADA_370_XP_TIMER0_PER_CPU_IRQ)
 		writel(hwirq, main_int_base +
 		writel(hwirq, main_int_base +
 				ARMADA_370_XP_INT_SET_ENABLE_OFFS);
 				ARMADA_370_XP_INT_SET_ENABLE_OFFS);
 	else
 	else
@@ -147,7 +149,7 @@ static int armada_370_xp_mpic_irq_map(struct irq_domain *h,
 	writel(hw, main_int_base + ARMADA_370_XP_INT_SET_ENABLE_OFFS);
 	writel(hw, main_int_base + ARMADA_370_XP_INT_SET_ENABLE_OFFS);
 	irq_set_status_flags(virq, IRQ_LEVEL);
 	irq_set_status_flags(virq, IRQ_LEVEL);
 
 
-	if (hw < ARMADA_370_XP_MAX_PER_CPU_IRQS) {
+	if (hw == ARMADA_370_XP_TIMER0_PER_CPU_IRQ) {
 		irq_set_percpu_devid(virq);
 		irq_set_percpu_devid(virq);
 		irq_set_chip_and_handler(virq, &armada_370_xp_irq_chip,
 		irq_set_chip_and_handler(virq, &armada_370_xp_irq_chip,
 					handle_percpu_devid_irq);
 					handle_percpu_devid_irq);

+ 1 - 11
arch/arm/mach-omap1/clock_data.c

@@ -538,15 +538,6 @@ static struct clk usb_hhc_ck16xx = {
 };
 };
 
 
 static struct clk usb_dc_ck = {
 static struct clk usb_dc_ck = {
-	.name		= "usb_dc_ck",
-	.ops		= &clkops_generic,
-	/* Direct from ULPD, no parent */
-	.rate		= 48000000,
-	.enable_reg	= OMAP1_IO_ADDRESS(SOFT_REQ_REG),
-	.enable_bit	= USB_REQ_EN_SHIFT,
-};
-
-static struct clk usb_dc_ck7xx = {
 	.name		= "usb_dc_ck",
 	.name		= "usb_dc_ck",
 	.ops		= &clkops_generic,
 	.ops		= &clkops_generic,
 	/* Direct from ULPD, no parent */
 	/* Direct from ULPD, no parent */
@@ -727,8 +718,7 @@ static struct omap_clk omap_clks[] = {
 	CLK(NULL,	"usb_clko",	&usb_clko,	CK_16XX | CK_1510 | CK_310),
 	CLK(NULL,	"usb_clko",	&usb_clko,	CK_16XX | CK_1510 | CK_310),
 	CLK(NULL,	"usb_hhc_ck",	&usb_hhc_ck1510, CK_1510 | CK_310),
 	CLK(NULL,	"usb_hhc_ck",	&usb_hhc_ck1510, CK_1510 | CK_310),
 	CLK(NULL,	"usb_hhc_ck",	&usb_hhc_ck16xx, CK_16XX),
 	CLK(NULL,	"usb_hhc_ck",	&usb_hhc_ck16xx, CK_16XX),
-	CLK(NULL,	"usb_dc_ck",	&usb_dc_ck,	CK_16XX),
-	CLK(NULL,	"usb_dc_ck",	&usb_dc_ck7xx,	CK_7XX),
+	CLK(NULL,	"usb_dc_ck",	&usb_dc_ck,	CK_16XX | CK_7XX),
 	CLK(NULL,	"mclk",		&mclk_1510,	CK_1510 | CK_310),
 	CLK(NULL,	"mclk",		&mclk_1510,	CK_1510 | CK_310),
 	CLK(NULL,	"mclk",		&mclk_16xx,	CK_16XX),
 	CLK(NULL,	"mclk",		&mclk_16xx,	CK_16XX),
 	CLK(NULL,	"bclk",		&bclk_1510,	CK_1510 | CK_310),
 	CLK(NULL,	"bclk",		&bclk_1510,	CK_1510 | CK_310),

+ 20 - 0
arch/arm/mach-omap2/cclock44xx_data.c

@@ -52,6 +52,13 @@
  */
  */
 #define OMAP4_DPLL_ABE_DEFFREQ				98304000
 #define OMAP4_DPLL_ABE_DEFFREQ				98304000
 
 
+/*
+ * OMAP4 USB DPLL default frequency. In OMAP4430 TRM version V, section
+ * "3.6.3.9.5 DPLL_USB Preferred Settings" shows that the preferred
+ * locked frequency for the USB DPLL is 960MHz.
+ */
+#define OMAP4_DPLL_USB_DEFFREQ				960000000
+
 /* Root clocks */
 /* Root clocks */
 
 
 DEFINE_CLK_FIXED_RATE(extalt_clkin_ck, CLK_IS_ROOT, 59000000, 0x0);
 DEFINE_CLK_FIXED_RATE(extalt_clkin_ck, CLK_IS_ROOT, 59000000, 0x0);
@@ -1011,6 +1018,10 @@ DEFINE_CLK_OMAP_MUX(hsmmc2_fclk, "l3_init_clkdm", hsmmc1_fclk_sel,
 		    OMAP4430_CM_L3INIT_MMC2_CLKCTRL, OMAP4430_CLKSEL_MASK,
 		    OMAP4430_CM_L3INIT_MMC2_CLKCTRL, OMAP4430_CLKSEL_MASK,
 		    hsmmc1_fclk_parents, func_dmic_abe_gfclk_ops);
 		    hsmmc1_fclk_parents, func_dmic_abe_gfclk_ops);
 
 
+DEFINE_CLK_GATE(ocp2scp_usb_phy_phy_48m, "func_48m_fclk", &func_48m_fclk, 0x0,
+		OMAP4430_CM_L3INIT_USBPHYOCP2SCP_CLKCTRL,
+		OMAP4430_OPTFCLKEN_PHY_48M_SHIFT, 0x0, NULL);
+
 DEFINE_CLK_GATE(sha2md5_fck, "l3_div_ck", &l3_div_ck, 0x0,
 DEFINE_CLK_GATE(sha2md5_fck, "l3_div_ck", &l3_div_ck, 0x0,
 		OMAP4430_CM_L4SEC_SHA2MD51_CLKCTRL,
 		OMAP4430_CM_L4SEC_SHA2MD51_CLKCTRL,
 		OMAP4430_MODULEMODE_SWCTRL_SHIFT, 0x0, NULL);
 		OMAP4430_MODULEMODE_SWCTRL_SHIFT, 0x0, NULL);
@@ -1538,6 +1549,7 @@ static struct omap_clk omap44xx_clks[] = {
 	CLK(NULL,	"per_mcbsp4_gfclk",			&per_mcbsp4_gfclk,	CK_443X),
 	CLK(NULL,	"per_mcbsp4_gfclk",			&per_mcbsp4_gfclk,	CK_443X),
 	CLK(NULL,	"hsmmc1_fclk",			&hsmmc1_fclk,	CK_443X),
 	CLK(NULL,	"hsmmc1_fclk",			&hsmmc1_fclk,	CK_443X),
 	CLK(NULL,	"hsmmc2_fclk",			&hsmmc2_fclk,	CK_443X),
 	CLK(NULL,	"hsmmc2_fclk",			&hsmmc2_fclk,	CK_443X),
+	CLK(NULL,	"ocp2scp_usb_phy_phy_48m",	&ocp2scp_usb_phy_phy_48m,	CK_443X),
 	CLK(NULL,	"sha2md5_fck",			&sha2md5_fck,	CK_443X),
 	CLK(NULL,	"sha2md5_fck",			&sha2md5_fck,	CK_443X),
 	CLK(NULL,	"slimbus1_fclk_1",		&slimbus1_fclk_1,	CK_443X),
 	CLK(NULL,	"slimbus1_fclk_1",		&slimbus1_fclk_1,	CK_443X),
 	CLK(NULL,	"slimbus1_fclk_0",		&slimbus1_fclk_0,	CK_443X),
 	CLK(NULL,	"slimbus1_fclk_0",		&slimbus1_fclk_0,	CK_443X),
@@ -1705,5 +1717,13 @@ int __init omap4xxx_clk_init(void)
 	if (rc)
 	if (rc)
 		pr_err("%s: failed to configure ABE DPLL!\n", __func__);
 		pr_err("%s: failed to configure ABE DPLL!\n", __func__);
 
 
+	/*
+	 * Lock USB DPLL on OMAP4 devices so that the L3INIT power
+	 * domain can transition to retention state when not in use.
+	 */
+	rc = clk_set_rate(&dpll_usb_ck, OMAP4_DPLL_USB_DEFFREQ);
+	if (rc)
+		pr_err("%s: failed to configure USB DPLL!\n", __func__);
+
 	return 0;
 	return 0;
 }
 }

+ 3 - 0
arch/arm/mach-omap2/common.h

@@ -293,5 +293,8 @@ extern void omap_reserve(void);
 struct omap_hwmod;
 struct omap_hwmod;
 extern int omap_dss_reset(struct omap_hwmod *);
 extern int omap_dss_reset(struct omap_hwmod *);
 
 
+/* SoC specific clock initializer */
+extern int (*omap_clk_init)(void);
+
 #endif /* __ASSEMBLER__ */
 #endif /* __ASSEMBLER__ */
 #endif /* __ARCH_ARM_MACH_OMAP2PLUS_COMMON_H */
 #endif /* __ARCH_ARM_MACH_OMAP2PLUS_COMMON_H */

+ 12 - 6
arch/arm/mach-omap2/io.c

@@ -54,6 +54,12 @@
 #include "prm3xxx.h"
 #include "prm3xxx.h"
 #include "prm44xx.h"
 #include "prm44xx.h"
 
 
+/*
+ * omap_clk_init: points to a function that does the SoC-specific
+ * clock initializations
+ */
+int (*omap_clk_init)(void);
+
 /*
 /*
  * The machine specific code may provide the extra mapping besides the
  * The machine specific code may provide the extra mapping besides the
  * default mapping provided here.
  * default mapping provided here.
@@ -397,7 +403,7 @@ void __init omap2420_init_early(void)
 	omap242x_clockdomains_init();
 	omap242x_clockdomains_init();
 	omap2420_hwmod_init();
 	omap2420_hwmod_init();
 	omap_hwmod_init_postsetup();
 	omap_hwmod_init_postsetup();
-	omap2420_clk_init();
+	omap_clk_init = omap2420_clk_init;
 }
 }
 
 
 void __init omap2420_init_late(void)
 void __init omap2420_init_late(void)
@@ -427,7 +433,7 @@ void __init omap2430_init_early(void)
 	omap243x_clockdomains_init();
 	omap243x_clockdomains_init();
 	omap2430_hwmod_init();
 	omap2430_hwmod_init();
 	omap_hwmod_init_postsetup();
 	omap_hwmod_init_postsetup();
-	omap2430_clk_init();
+	omap_clk_init = omap2430_clk_init;
 }
 }
 
 
 void __init omap2430_init_late(void)
 void __init omap2430_init_late(void)
@@ -462,7 +468,7 @@ void __init omap3_init_early(void)
 	omap3xxx_clockdomains_init();
 	omap3xxx_clockdomains_init();
 	omap3xxx_hwmod_init();
 	omap3xxx_hwmod_init();
 	omap_hwmod_init_postsetup();
 	omap_hwmod_init_postsetup();
-	omap3xxx_clk_init();
+	omap_clk_init = omap3xxx_clk_init;
 }
 }
 
 
 void __init omap3430_init_early(void)
 void __init omap3430_init_early(void)
@@ -500,7 +506,7 @@ void __init ti81xx_init_early(void)
 	omap3xxx_clockdomains_init();
 	omap3xxx_clockdomains_init();
 	omap3xxx_hwmod_init();
 	omap3xxx_hwmod_init();
 	omap_hwmod_init_postsetup();
 	omap_hwmod_init_postsetup();
-	omap3xxx_clk_init();
+	omap_clk_init = omap3xxx_clk_init;
 }
 }
 
 
 void __init omap3_init_late(void)
 void __init omap3_init_late(void)
@@ -568,7 +574,7 @@ void __init am33xx_init_early(void)
 	am33xx_clockdomains_init();
 	am33xx_clockdomains_init();
 	am33xx_hwmod_init();
 	am33xx_hwmod_init();
 	omap_hwmod_init_postsetup();
 	omap_hwmod_init_postsetup();
-	am33xx_clk_init();
+	omap_clk_init = am33xx_clk_init;
 }
 }
 #endif
 #endif
 
 
@@ -593,7 +599,7 @@ void __init omap4430_init_early(void)
 	omap44xx_clockdomains_init();
 	omap44xx_clockdomains_init();
 	omap44xx_hwmod_init();
 	omap44xx_hwmod_init();
 	omap_hwmod_init_postsetup();
 	omap_hwmod_init_postsetup();
-	omap4xxx_clk_init();
+	omap_clk_init = omap4xxx_clk_init;
 }
 }
 
 
 void __init omap4430_init_late(void)
 void __init omap4430_init_late(void)

+ 5 - 2
arch/arm/mach-omap2/omap_hwmod.c

@@ -1368,7 +1368,9 @@ static void _enable_sysc(struct omap_hwmod *oh)
 	}
 	}
 
 
 	if (sf & SYSC_HAS_MIDLEMODE) {
 	if (sf & SYSC_HAS_MIDLEMODE) {
-		if (oh->flags & HWMOD_SWSUP_MSTANDBY) {
+		if (oh->flags & HWMOD_FORCE_MSTANDBY) {
+			idlemode = HWMOD_IDLEMODE_FORCE;
+		} else if (oh->flags & HWMOD_SWSUP_MSTANDBY) {
 			idlemode = HWMOD_IDLEMODE_NO;
 			idlemode = HWMOD_IDLEMODE_NO;
 		} else {
 		} else {
 			if (sf & SYSC_HAS_ENAWAKEUP)
 			if (sf & SYSC_HAS_ENAWAKEUP)
@@ -1440,7 +1442,8 @@ static void _idle_sysc(struct omap_hwmod *oh)
 	}
 	}
 
 
 	if (sf & SYSC_HAS_MIDLEMODE) {
 	if (sf & SYSC_HAS_MIDLEMODE) {
-		if (oh->flags & HWMOD_SWSUP_MSTANDBY) {
+		if ((oh->flags & HWMOD_SWSUP_MSTANDBY) ||
+		    (oh->flags & HWMOD_FORCE_MSTANDBY)) {
 			idlemode = HWMOD_IDLEMODE_FORCE;
 			idlemode = HWMOD_IDLEMODE_FORCE;
 		} else {
 		} else {
 			if (sf & SYSC_HAS_ENAWAKEUP)
 			if (sf & SYSC_HAS_ENAWAKEUP)

+ 7 - 2
arch/arm/mach-omap2/omap_hwmod.h

@@ -427,8 +427,8 @@ struct omap_hwmod_omap4_prcm {
  *
  *
  * HWMOD_SWSUP_SIDLE: omap_hwmod code should manually bring module in and out
  * HWMOD_SWSUP_SIDLE: omap_hwmod code should manually bring module in and out
  *     of idle, rather than relying on module smart-idle
  *     of idle, rather than relying on module smart-idle
- * HWMOD_SWSUP_MSTDBY: omap_hwmod code should manually bring module in and out
- *     of standby, rather than relying on module smart-standby
+ * HWMOD_SWSUP_MSTANDBY: omap_hwmod code should manually bring module in and
+ *     out of standby, rather than relying on module smart-standby
  * HWMOD_INIT_NO_RESET: don't reset this module at boot - important for
  * HWMOD_INIT_NO_RESET: don't reset this module at boot - important for
  *     SDRAM controller, etc. XXX probably belongs outside the main hwmod file
  *     SDRAM controller, etc. XXX probably belongs outside the main hwmod file
  *     XXX Should be HWMOD_SETUP_NO_RESET
  *     XXX Should be HWMOD_SETUP_NO_RESET
@@ -459,6 +459,10 @@ struct omap_hwmod_omap4_prcm {
  *     correctly, or this is being abused to deal with some PM latency
  *     correctly, or this is being abused to deal with some PM latency
  *     issues -- but we're currently suffering from a shortage of
  *     issues -- but we're currently suffering from a shortage of
  *     folks who are able to track these issues down properly.
  *     folks who are able to track these issues down properly.
+ * HWMOD_FORCE_MSTANDBY: Always keep MIDLEMODE bits cleared so that device
+ *     is kept in force-standby mode. Failing to do so causes PM problems
+ *     with musb on OMAP3630 at least. Note that musb has a dedicated register
+ *     to control MSTANDBY signal when MIDLEMODE is set to force-standby.
  */
  */
 #define HWMOD_SWSUP_SIDLE			(1 << 0)
 #define HWMOD_SWSUP_SIDLE			(1 << 0)
 #define HWMOD_SWSUP_MSTANDBY			(1 << 1)
 #define HWMOD_SWSUP_MSTANDBY			(1 << 1)
@@ -471,6 +475,7 @@ struct omap_hwmod_omap4_prcm {
 #define HWMOD_16BIT_REG				(1 << 8)
 #define HWMOD_16BIT_REG				(1 << 8)
 #define HWMOD_EXT_OPT_MAIN_CLK			(1 << 9)
 #define HWMOD_EXT_OPT_MAIN_CLK			(1 << 9)
 #define HWMOD_BLOCK_WFI				(1 << 10)
 #define HWMOD_BLOCK_WFI				(1 << 10)
+#define HWMOD_FORCE_MSTANDBY			(1 << 11)
 
 
 /*
 /*
  * omap_hwmod._int_flags definitions
  * omap_hwmod._int_flags definitions

+ 6 - 1
arch/arm/mach-omap2/omap_hwmod_3xxx_data.c

@@ -1707,9 +1707,14 @@ static struct omap_hwmod omap3xxx_usbhsotg_hwmod = {
 	 * Erratum ID: i479  idle_req / idle_ack mechanism potentially
 	 * Erratum ID: i479  idle_req / idle_ack mechanism potentially
 	 * broken when autoidle is enabled
 	 * broken when autoidle is enabled
 	 * workaround is to disable the autoidle bit at module level.
 	 * workaround is to disable the autoidle bit at module level.
+	 *
+	 * Enabling the device in any other MIDLEMODE setting but force-idle
+	 * causes core_pwrdm not enter idle states at least on OMAP3630.
+	 * Note that musb has OTG_FORCESTDBY register that controls MSTANDBY
+	 * signal when MIDLEMODE is set to force-idle.
 	 */
 	 */
 	.flags		= HWMOD_NO_OCP_AUTOIDLE | HWMOD_SWSUP_SIDLE
 	.flags		= HWMOD_NO_OCP_AUTOIDLE | HWMOD_SWSUP_SIDLE
-				| HWMOD_SWSUP_MSTANDBY,
+				| HWMOD_FORCE_MSTANDBY,
 };
 };
 
 
 /* usb_otg_hs */
 /* usb_otg_hs */

+ 6 - 0
arch/arm/mach-omap2/omap_hwmod_44xx_data.c

@@ -2714,6 +2714,10 @@ static struct omap_ocp2scp_dev ocp2scp_dev_attr[] = {
 	{ }
 	{ }
 };
 };
 
 
+static struct omap_hwmod_opt_clk ocp2scp_usb_phy_opt_clks[] = {
+	{ .role = "48mhz", .clk = "ocp2scp_usb_phy_phy_48m" },
+};
+
 /* ocp2scp_usb_phy */
 /* ocp2scp_usb_phy */
 static struct omap_hwmod omap44xx_ocp2scp_usb_phy_hwmod = {
 static struct omap_hwmod omap44xx_ocp2scp_usb_phy_hwmod = {
 	.name		= "ocp2scp_usb_phy",
 	.name		= "ocp2scp_usb_phy",
@@ -2728,6 +2732,8 @@ static struct omap_hwmod omap44xx_ocp2scp_usb_phy_hwmod = {
 		},
 		},
 	},
 	},
 	.dev_attr	= ocp2scp_dev_attr,
 	.dev_attr	= ocp2scp_dev_attr,
+	.opt_clks	= ocp2scp_usb_phy_opt_clks,
+	.opt_clks_cnt	= ARRAY_SIZE(ocp2scp_usb_phy_opt_clks),
 };
 };
 
 
 /*
 /*

+ 4 - 0
arch/arm/mach-omap2/timer.c

@@ -547,6 +547,8 @@ static inline void __init realtime_counter_init(void)
 			       clksrc_nr, clksrc_src)			\
 			       clksrc_nr, clksrc_src)			\
 void __init omap##name##_gptimer_timer_init(void)			\
 void __init omap##name##_gptimer_timer_init(void)			\
 {									\
 {									\
+	if (omap_clk_init)						\
+		omap_clk_init();					\
 	omap_dmtimer_init();						\
 	omap_dmtimer_init();						\
 	omap2_gp_clockevent_init((clkev_nr), clkev_src, clkev_prop);	\
 	omap2_gp_clockevent_init((clkev_nr), clkev_src, clkev_prop);	\
 	omap2_gptimer_clocksource_init((clksrc_nr), clksrc_src);	\
 	omap2_gptimer_clocksource_init((clksrc_nr), clksrc_src);	\
@@ -556,6 +558,8 @@ void __init omap##name##_gptimer_timer_init(void)			\
 				clksrc_nr, clksrc_src)			\
 				clksrc_nr, clksrc_src)			\
 void __init omap##name##_sync32k_timer_init(void)		\
 void __init omap##name##_sync32k_timer_init(void)		\
 {									\
 {									\
+	if (omap_clk_init)						\
+		omap_clk_init();					\
 	omap_dmtimer_init();						\
 	omap_dmtimer_init();						\
 	omap2_gp_clockevent_init((clkev_nr), clkev_src, clkev_prop);	\
 	omap2_gp_clockevent_init((clkev_nr), clkev_src, clkev_prop);	\
 	/* Enable the use of clocksource="gp_timer" kernel parameter */	\
 	/* Enable the use of clocksource="gp_timer" kernel parameter */	\

+ 0 - 1
arch/arm/mach-ux500/board-mop500-sdi.c

@@ -81,7 +81,6 @@ static struct stedma40_chan_cfg mop500_sdi0_dma_cfg_tx = {
 #endif
 #endif
 
 
 struct mmci_platform_data mop500_sdi0_data = {
 struct mmci_platform_data mop500_sdi0_data = {
-	.ios_handler	= mop500_sdi0_ios_handler,
 	.ocr_mask	= MMC_VDD_29_30,
 	.ocr_mask	= MMC_VDD_29_30,
 	.f_max		= 50000000,
 	.f_max		= 50000000,
 	.capabilities	= MMC_CAP_4_BIT_DATA |
 	.capabilities	= MMC_CAP_4_BIT_DATA |

+ 12 - 0
arch/arm/mach-ux500/board-mop500.c

@@ -12,6 +12,7 @@
 #include <linux/init.h>
 #include <linux/init.h>
 #include <linux/interrupt.h>
 #include <linux/interrupt.h>
 #include <linux/platform_device.h>
 #include <linux/platform_device.h>
+#include <linux/clk.h>
 #include <linux/io.h>
 #include <linux/io.h>
 #include <linux/i2c.h>
 #include <linux/i2c.h>
 #include <linux/platform_data/i2c-nomadik.h>
 #include <linux/platform_data/i2c-nomadik.h>
@@ -439,6 +440,15 @@ static void mop500_prox_deactivate(struct device *dev)
 	regulator_put(prox_regulator);
 	regulator_put(prox_regulator);
 }
 }
 
 
+void mop500_snowball_ethernet_clock_enable(void)
+{
+	struct clk *clk;
+
+	clk = clk_get_sys("fsmc", NULL);
+	if (!IS_ERR(clk))
+		clk_prepare_enable(clk);
+}
+
 static struct cryp_platform_data u8500_cryp1_platform_data = {
 static struct cryp_platform_data u8500_cryp1_platform_data = {
 		.mem_to_engine = {
 		.mem_to_engine = {
 				.dir = STEDMA40_MEM_TO_PERIPH,
 				.dir = STEDMA40_MEM_TO_PERIPH,
@@ -683,6 +693,8 @@ static void __init snowball_init_machine(void)
 	mop500_audio_init(parent);
 	mop500_audio_init(parent);
 	mop500_uart_init(parent);
 	mop500_uart_init(parent);
 
 
+	mop500_snowball_ethernet_clock_enable();
+
 	/* This board has full regulator constraints */
 	/* This board has full regulator constraints */
 	regulator_has_full_constraints();
 	regulator_has_full_constraints();
 }
 }

+ 1 - 0
arch/arm/mach-ux500/board-mop500.h

@@ -104,6 +104,7 @@ void __init mop500_pinmaps_init(void);
 void __init snowball_pinmaps_init(void);
 void __init snowball_pinmaps_init(void);
 void __init hrefv60_pinmaps_init(void);
 void __init hrefv60_pinmaps_init(void);
 void mop500_audio_init(struct device *parent);
 void mop500_audio_init(struct device *parent);
+void mop500_snowball_ethernet_clock_enable(void);
 
 
 int __init mop500_uib_init(void);
 int __init mop500_uib_init(void);
 void mop500_uib_i2c_add(int busnum, struct i2c_board_info *info,
 void mop500_uib_i2c_add(int busnum, struct i2c_board_info *info,

+ 3 - 2
arch/arm/mach-ux500/cpu-db8500.c

@@ -312,9 +312,10 @@ static void __init u8500_init_machine(void)
 	/* Pinmaps must be in place before devices register */
 	/* Pinmaps must be in place before devices register */
 	if (of_machine_is_compatible("st-ericsson,mop500"))
 	if (of_machine_is_compatible("st-ericsson,mop500"))
 		mop500_pinmaps_init();
 		mop500_pinmaps_init();
-	else if (of_machine_is_compatible("calaosystems,snowball-a9500"))
+	else if (of_machine_is_compatible("calaosystems,snowball-a9500")) {
 		snowball_pinmaps_init();
 		snowball_pinmaps_init();
-	else if (of_machine_is_compatible("st-ericsson,hrefv60+"))
+		mop500_snowball_ethernet_clock_enable();
+	} else if (of_machine_is_compatible("st-ericsson,hrefv60+"))
 		hrefv60_pinmaps_init();
 		hrefv60_pinmaps_init();
 	else if (of_machine_is_compatible("st-ericsson,ccu9540")) {}
 	else if (of_machine_is_compatible("st-ericsson,ccu9540")) {}
 		/* TODO: Add pinmaps for ccu9540 board. */
 		/* TODO: Add pinmaps for ccu9540 board. */

+ 4 - 7
arch/arm/mm/cache-l2x0.c

@@ -299,7 +299,7 @@ static void l2x0_unlock(u32 cache_id)
 	int lockregs;
 	int lockregs;
 	int i;
 	int i;
 
 
-	switch (cache_id) {
+	switch (cache_id & L2X0_CACHE_ID_PART_MASK) {
 	case L2X0_CACHE_ID_PART_L310:
 	case L2X0_CACHE_ID_PART_L310:
 		lockregs = 8;
 		lockregs = 8;
 		break;
 		break;
@@ -333,15 +333,14 @@ void __init l2x0_init(void __iomem *base, u32 aux_val, u32 aux_mask)
 	if (cache_id_part_number_from_dt)
 	if (cache_id_part_number_from_dt)
 		cache_id = cache_id_part_number_from_dt;
 		cache_id = cache_id_part_number_from_dt;
 	else
 	else
-		cache_id = readl_relaxed(l2x0_base + L2X0_CACHE_ID)
-			& L2X0_CACHE_ID_PART_MASK;
+		cache_id = readl_relaxed(l2x0_base + L2X0_CACHE_ID);
 	aux = readl_relaxed(l2x0_base + L2X0_AUX_CTRL);
 	aux = readl_relaxed(l2x0_base + L2X0_AUX_CTRL);
 
 
 	aux &= aux_mask;
 	aux &= aux_mask;
 	aux |= aux_val;
 	aux |= aux_val;
 
 
 	/* Determine the number of ways */
 	/* Determine the number of ways */
-	switch (cache_id) {
+	switch (cache_id & L2X0_CACHE_ID_PART_MASK) {
 	case L2X0_CACHE_ID_PART_L310:
 	case L2X0_CACHE_ID_PART_L310:
 		if (aux & (1 << 16))
 		if (aux & (1 << 16))
 			ways = 16;
 			ways = 16;
@@ -725,7 +724,6 @@ static const struct l2x0_of_data pl310_data = {
 		.flush_all   = l2x0_flush_all,
 		.flush_all   = l2x0_flush_all,
 		.inv_all     = l2x0_inv_all,
 		.inv_all     = l2x0_inv_all,
 		.disable     = l2x0_disable,
 		.disable     = l2x0_disable,
-		.set_debug   = pl310_set_debug,
 	},
 	},
 };
 };
 
 
@@ -814,9 +812,8 @@ int __init l2x0_of_init(u32 aux_val, u32 aux_mask)
 		data->save();
 		data->save();
 
 
 	of_init = true;
 	of_init = true;
-	l2x0_init(l2x0_base, aux_val, aux_mask);
-
 	memcpy(&outer_cache, &data->outer_cache, sizeof(outer_cache));
 	memcpy(&outer_cache, &data->outer_cache, sizeof(outer_cache));
+	l2x0_init(l2x0_base, aux_val, aux_mask);
 
 
 	return 0;
 	return 0;
 }
 }

+ 2 - 1
arch/arm/mm/context.c

@@ -48,7 +48,7 @@ static DEFINE_RAW_SPINLOCK(cpu_asid_lock);
 static atomic64_t asid_generation = ATOMIC64_INIT(ASID_FIRST_VERSION);
 static atomic64_t asid_generation = ATOMIC64_INIT(ASID_FIRST_VERSION);
 static DECLARE_BITMAP(asid_map, NUM_USER_ASIDS);
 static DECLARE_BITMAP(asid_map, NUM_USER_ASIDS);
 
 
-static DEFINE_PER_CPU(atomic64_t, active_asids);
+DEFINE_PER_CPU(atomic64_t, active_asids);
 static DEFINE_PER_CPU(u64, reserved_asids);
 static DEFINE_PER_CPU(u64, reserved_asids);
 static cpumask_t tlb_flush_pending;
 static cpumask_t tlb_flush_pending;
 
 
@@ -215,6 +215,7 @@ void check_and_switch_context(struct mm_struct *mm, struct task_struct *tsk)
 	if (cpumask_test_and_clear_cpu(cpu, &tlb_flush_pending)) {
 	if (cpumask_test_and_clear_cpu(cpu, &tlb_flush_pending)) {
 		local_flush_bp_all();
 		local_flush_bp_all();
 		local_flush_tlb_all();
 		local_flush_tlb_all();
+		dummy_flush_tlb_a15_erratum();
 	}
 	}
 
 
 	atomic64_set(&per_cpu(active_asids, cpu), asid);
 	atomic64_set(&per_cpu(active_asids, cpu), asid);

+ 47 - 26
arch/arm/mm/mmu.c

@@ -598,39 +598,60 @@ static void __init alloc_init_pte(pmd_t *pmd, unsigned long addr,
 	} while (pte++, addr += PAGE_SIZE, addr != end);
 	} while (pte++, addr += PAGE_SIZE, addr != end);
 }
 }
 
 
-static void __init alloc_init_section(pud_t *pud, unsigned long addr,
-				      unsigned long end, phys_addr_t phys,
-				      const struct mem_type *type)
+static void __init map_init_section(pmd_t *pmd, unsigned long addr,
+			unsigned long end, phys_addr_t phys,
+			const struct mem_type *type)
 {
 {
-	pmd_t *pmd = pmd_offset(pud, addr);
-
+#ifndef CONFIG_ARM_LPAE
 	/*
 	/*
-	 * Try a section mapping - end, addr and phys must all be aligned
-	 * to a section boundary.  Note that PMDs refer to the individual
-	 * L1 entries, whereas PGDs refer to a group of L1 entries making
-	 * up one logical pointer to an L2 table.
+	 * In classic MMU format, puds and pmds are folded in to
+	 * the pgds. pmd_offset gives the PGD entry. PGDs refer to a
+	 * group of L1 entries making up one logical pointer to
+	 * an L2 table (2MB), where as PMDs refer to the individual
+	 * L1 entries (1MB). Hence increment to get the correct
+	 * offset for odd 1MB sections.
+	 * (See arch/arm/include/asm/pgtable-2level.h)
 	 */
 	 */
-	if (type->prot_sect && ((addr | end | phys) & ~SECTION_MASK) == 0) {
-		pmd_t *p = pmd;
-
-#ifndef CONFIG_ARM_LPAE
-		if (addr & SECTION_SIZE)
-			pmd++;
+	if (addr & SECTION_SIZE)
+		pmd++;
 #endif
 #endif
+	do {
+		*pmd = __pmd(phys | type->prot_sect);
+		phys += SECTION_SIZE;
+	} while (pmd++, addr += SECTION_SIZE, addr != end);
 
 
-		do {
-			*pmd = __pmd(phys | type->prot_sect);
-			phys += SECTION_SIZE;
-		} while (pmd++, addr += SECTION_SIZE, addr != end);
+	flush_pmd_entry(pmd);
+}
 
 
-		flush_pmd_entry(p);
-	} else {
+static void __init alloc_init_pmd(pud_t *pud, unsigned long addr,
+				      unsigned long end, phys_addr_t phys,
+				      const struct mem_type *type)
+{
+	pmd_t *pmd = pmd_offset(pud, addr);
+	unsigned long next;
+
+	do {
 		/*
 		/*
-		 * No need to loop; pte's aren't interested in the
-		 * individual L1 entries.
+		 * With LPAE, we must loop over to map
+		 * all the pmds for the given range.
 		 */
 		 */
-		alloc_init_pte(pmd, addr, end, __phys_to_pfn(phys), type);
-	}
+		next = pmd_addr_end(addr, end);
+
+		/*
+		 * Try a section mapping - addr, next and phys must all be
+		 * aligned to a section boundary.
+		 */
+		if (type->prot_sect &&
+				((addr | next | phys) & ~SECTION_MASK) == 0) {
+			map_init_section(pmd, addr, next, phys, type);
+		} else {
+			alloc_init_pte(pmd, addr, next,
+						__phys_to_pfn(phys), type);
+		}
+
+		phys += next - addr;
+
+	} while (pmd++, addr = next, addr != end);
 }
 }
 
 
 static void __init alloc_init_pud(pgd_t *pgd, unsigned long addr,
 static void __init alloc_init_pud(pgd_t *pgd, unsigned long addr,
@@ -641,7 +662,7 @@ static void __init alloc_init_pud(pgd_t *pgd, unsigned long addr,
 
 
 	do {
 	do {
 		next = pud_addr_end(addr, end);
 		next = pud_addr_end(addr, end);
-		alloc_init_section(pud, addr, next, phys, type);
+		alloc_init_pmd(pud, addr, next, phys, type);
 		phys += next - addr;
 		phys += next - addr;
 	} while (pud++, addr = next, addr != end);
 	} while (pud++, addr = next, addr != end);
 }
 }

+ 17 - 2
arch/arm/mm/proc-v7.S

@@ -420,7 +420,7 @@ __v7_pj4b_proc_info:
 __v7_ca7mp_proc_info:
 __v7_ca7mp_proc_info:
 	.long	0x410fc070
 	.long	0x410fc070
 	.long	0xff0ffff0
 	.long	0xff0ffff0
-	__v7_proc __v7_ca7mp_setup, hwcaps = HWCAP_IDIV
+	__v7_proc __v7_ca7mp_setup
 	.size	__v7_ca7mp_proc_info, . - __v7_ca7mp_proc_info
 	.size	__v7_ca7mp_proc_info, . - __v7_ca7mp_proc_info
 
 
 	/*
 	/*
@@ -430,9 +430,24 @@ __v7_ca7mp_proc_info:
 __v7_ca15mp_proc_info:
 __v7_ca15mp_proc_info:
 	.long	0x410fc0f0
 	.long	0x410fc0f0
 	.long	0xff0ffff0
 	.long	0xff0ffff0
-	__v7_proc __v7_ca15mp_setup, hwcaps = HWCAP_IDIV
+	__v7_proc __v7_ca15mp_setup
 	.size	__v7_ca15mp_proc_info, . - __v7_ca15mp_proc_info
 	.size	__v7_ca15mp_proc_info, . - __v7_ca15mp_proc_info
 
 
+	/*
+	 * Qualcomm Inc. Krait processors.
+	 */
+	.type	__krait_proc_info, #object
+__krait_proc_info:
+	.long	0x510f0400		@ Required ID value
+	.long	0xff0ffc00		@ Mask for ID
+	/*
+	 * Some Krait processors don't indicate support for SDIV and UDIV
+	 * instructions in the ARM instruction set, even though they actually
+	 * do support them.
+	 */
+	__v7_proc __v7_setup, hwcaps = HWCAP_IDIV
+	.size	__krait_proc_info, . - __krait_proc_info
+
 	/*
 	/*
 	 * Match any ARMv7 processor core.
 	 * Match any ARMv7 processor core.
 	 */
 	 */

+ 3 - 4
arch/mips/Kconfig

@@ -18,7 +18,7 @@ config MIPS
 	select HAVE_KRETPROBES
 	select HAVE_KRETPROBES
 	select HAVE_DEBUG_KMEMLEAK
 	select HAVE_DEBUG_KMEMLEAK
 	select ARCH_BINFMT_ELF_RANDOMIZE_PIE
 	select ARCH_BINFMT_ELF_RANDOMIZE_PIE
-	select HAVE_ARCH_TRANSPARENT_HUGEPAGE
+	select HAVE_ARCH_TRANSPARENT_HUGEPAGE if CPU_SUPPORTS_HUGEPAGES && 64BIT
 	select RTC_LIB if !MACH_LOONGSON
 	select RTC_LIB if !MACH_LOONGSON
 	select GENERIC_ATOMIC64 if !64BIT
 	select GENERIC_ATOMIC64 if !64BIT
 	select ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE
 	select ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE
@@ -657,7 +657,7 @@ config SNI_RM
 	bool "SNI RM200/300/400"
 	bool "SNI RM200/300/400"
 	select FW_ARC if CPU_LITTLE_ENDIAN
 	select FW_ARC if CPU_LITTLE_ENDIAN
 	select FW_ARC32 if CPU_LITTLE_ENDIAN
 	select FW_ARC32 if CPU_LITTLE_ENDIAN
-	select SNIPROM if CPU_BIG_ENDIAN
+	select FW_SNIPROM if CPU_BIG_ENDIAN
 	select ARCH_MAY_HAVE_PC_FDC
 	select ARCH_MAY_HAVE_PC_FDC
 	select BOOT_ELF32
 	select BOOT_ELF32
 	select CEVT_R4K
 	select CEVT_R4K
@@ -1144,7 +1144,7 @@ config DEFAULT_SGI_PARTITION
 config FW_ARC32
 config FW_ARC32
 	bool
 	bool
 
 
-config SNIPROM
+config FW_SNIPROM
 	bool
 	bool
 
 
 config BOOT_ELF32
 config BOOT_ELF32
@@ -1493,7 +1493,6 @@ config CPU_XLP
 	select CPU_SUPPORTS_32BIT_KERNEL
 	select CPU_SUPPORTS_32BIT_KERNEL
 	select CPU_SUPPORTS_64BIT_KERNEL
 	select CPU_SUPPORTS_64BIT_KERNEL
 	select CPU_SUPPORTS_HIGHMEM
 	select CPU_SUPPORTS_HIGHMEM
-	select CPU_HAS_LLSC
 	select WEAK_ORDERING
 	select WEAK_ORDERING
 	select WEAK_REORDERING_BEYOND_LLSC
 	select WEAK_REORDERING_BEYOND_LLSC
 	select CPU_HAS_PREFETCH
 	select CPU_HAS_PREFETCH

+ 1 - 4
arch/mips/bcm63xx/boards/board_bcm963xx.c

@@ -745,10 +745,7 @@ void __init board_prom_init(void)
 		strcpy(cfe_version, "unknown");
 		strcpy(cfe_version, "unknown");
 	printk(KERN_INFO PFX "CFE version: %s\n", cfe_version);
 	printk(KERN_INFO PFX "CFE version: %s\n", cfe_version);
 
 
-	if (bcm63xx_nvram_init(boot_addr + BCM963XX_NVRAM_OFFSET)) {
-		printk(KERN_ERR PFX "invalid nvram checksum\n");
-		return;
-	}
+	bcm63xx_nvram_init(boot_addr + BCM963XX_NVRAM_OFFSET);
 
 
 	board_name = bcm63xx_nvram_get_name();
 	board_name = bcm63xx_nvram_get_name();
 	/* find board by name */
 	/* find board by name */

+ 3 - 4
arch/mips/bcm63xx/nvram.c

@@ -38,7 +38,7 @@ struct bcm963xx_nvram {
 static struct bcm963xx_nvram nvram;
 static struct bcm963xx_nvram nvram;
 static int mac_addr_used;
 static int mac_addr_used;
 
 
-int __init bcm63xx_nvram_init(void *addr)
+void __init bcm63xx_nvram_init(void *addr)
 {
 {
 	unsigned int check_len;
 	unsigned int check_len;
 	u32 crc, expected_crc;
 	u32 crc, expected_crc;
@@ -60,9 +60,8 @@ int __init bcm63xx_nvram_init(void *addr)
 	crc = crc32_le(~0, (u8 *)&nvram, check_len);
 	crc = crc32_le(~0, (u8 *)&nvram, check_len);
 
 
 	if (crc != expected_crc)
 	if (crc != expected_crc)
-		return -EINVAL;
-
-	return 0;
+		pr_warn("nvram checksum failed, contents may be invalid (expected %08x, got %08x)\n",
+			expected_crc, crc);
 }
 }
 
 
 u8 *bcm63xx_nvram_get_name(void)
 u8 *bcm63xx_nvram_get_name(void)

+ 1 - 1
arch/mips/bcm63xx/setup.c

@@ -157,4 +157,4 @@ int __init bcm63xx_register_devices(void)
 	return board_register_devices();
 	return board_register_devices();
 }
 }
 
 
-device_initcall(bcm63xx_register_devices);
+arch_initcall(bcm63xx_register_devices);

+ 4 - 1
arch/mips/cavium-octeon/setup.c

@@ -174,7 +174,10 @@ static int octeon_kexec_prepare(struct kimage *image)
 
 
 static void octeon_generic_shutdown(void)
 static void octeon_generic_shutdown(void)
 {
 {
-	int cpu, i;
+	int i;
+#ifdef CONFIG_SMP
+	int cpu;
+#endif
 	struct cvmx_bootmem_desc *bootmem_desc;
 	struct cvmx_bootmem_desc *bootmem_desc;
 	void *named_block_array_ptr;
 	void *named_block_array_ptr;
 
 

+ 1 - 3
arch/mips/include/asm/mach-bcm63xx/bcm63xx_nvram.h

@@ -9,10 +9,8 @@
  *
  *
  * Initialized the local nvram copy from the target address and checks
  * Initialized the local nvram copy from the target address and checks
  * its checksum.
  * its checksum.
- *
- * Returns 0 on success.
  */
  */
-int __init bcm63xx_nvram_init(void *nvram);
+void bcm63xx_nvram_init(void *nvram);
 
 
 /**
 /**
  * bcm63xx_nvram_get_name() - returns the board name according to nvram
  * bcm63xx_nvram_get_name() - returns the board name according to nvram

+ 0 - 4
arch/mips/include/asm/mach-sead3/cpu-feature-overrides.h

@@ -28,11 +28,7 @@
 /* #define cpu_has_prefetch	? */
 /* #define cpu_has_prefetch	? */
 #define cpu_has_mcheck		1
 #define cpu_has_mcheck		1
 /* #define cpu_has_ejtag	? */
 /* #define cpu_has_ejtag	? */
-#ifdef CONFIG_CPU_HAS_LLSC
 #define cpu_has_llsc		1
 #define cpu_has_llsc		1
-#else
-#define cpu_has_llsc		0
-#endif
 /* #define cpu_has_vtag_icache	? */
 /* #define cpu_has_vtag_icache	? */
 /* #define cpu_has_dc_aliases	? */
 /* #define cpu_has_dc_aliases	? */
 /* #define cpu_has_ic_fills_f_dc ? */
 /* #define cpu_has_ic_fills_f_dc ? */

+ 190 - 19
arch/mips/include/asm/mipsregs.h

@@ -1166,7 +1166,10 @@ do {									\
 	unsigned int __dspctl;						\
 	unsigned int __dspctl;						\
 									\
 									\
 	__asm__ __volatile__(						\
 	__asm__ __volatile__(						\
+	"	.set push					\n"	\
+	"	.set dsp					\n"	\
 	"	rddsp	%0, %x1					\n"	\
 	"	rddsp	%0, %x1					\n"	\
+	"	.set pop					\n"	\
 	: "=r" (__dspctl)						\
 	: "=r" (__dspctl)						\
 	: "i" (mask));							\
 	: "i" (mask));							\
 	__dspctl;							\
 	__dspctl;							\
@@ -1175,30 +1178,198 @@ do {									\
 #define wrdsp(val, mask)						\
 #define wrdsp(val, mask)						\
 do {									\
 do {									\
 	__asm__ __volatile__(						\
 	__asm__ __volatile__(						\
+	"	.set push					\n"	\
+	"	.set dsp					\n"	\
 	"	wrdsp	%0, %x1					\n"	\
 	"	wrdsp	%0, %x1					\n"	\
+	"	.set pop					\n"	\
 	:								\
 	:								\
 	: "r" (val), "i" (mask));					\
 	: "r" (val), "i" (mask));					\
 } while (0)
 } while (0)
 
 
-#define mflo0() ({ long mflo0; __asm__("mflo %0, $ac0" : "=r" (mflo0)); mflo0;})
-#define mflo1() ({ long mflo1; __asm__("mflo %0, $ac1" : "=r" (mflo1)); mflo1;})
-#define mflo2() ({ long mflo2; __asm__("mflo %0, $ac2" : "=r" (mflo2)); mflo2;})
-#define mflo3() ({ long mflo3; __asm__("mflo %0, $ac3" : "=r" (mflo3)); mflo3;})
-
-#define mfhi0() ({ long mfhi0; __asm__("mfhi %0, $ac0" : "=r" (mfhi0)); mfhi0;})
-#define mfhi1() ({ long mfhi1; __asm__("mfhi %0, $ac1" : "=r" (mfhi1)); mfhi1;})
-#define mfhi2() ({ long mfhi2; __asm__("mfhi %0, $ac2" : "=r" (mfhi2)); mfhi2;})
-#define mfhi3() ({ long mfhi3; __asm__("mfhi %0, $ac3" : "=r" (mfhi3)); mfhi3;})
-
-#define mtlo0(x) __asm__("mtlo %0, $ac0" ::"r" (x))
-#define mtlo1(x) __asm__("mtlo %0, $ac1" ::"r" (x))
-#define mtlo2(x) __asm__("mtlo %0, $ac2" ::"r" (x))
-#define mtlo3(x) __asm__("mtlo %0, $ac3" ::"r" (x))
-
-#define mthi0(x) __asm__("mthi %0, $ac0" ::"r" (x))
-#define mthi1(x) __asm__("mthi %0, $ac1" ::"r" (x))
-#define mthi2(x) __asm__("mthi %0, $ac2" ::"r" (x))
-#define mthi3(x) __asm__("mthi %0, $ac3" ::"r" (x))
+#define mflo0()								\
+({									\
+	long mflo0;							\
+	__asm__(							\
+	"	.set push					\n"	\
+	"	.set dsp					\n"	\
+	"	mflo %0, $ac0					\n"	\
+	"	.set pop					\n" 	\
+	: "=r" (mflo0)); 						\
+	mflo0;								\
+})
+
+#define mflo1()								\
+({									\
+	long mflo1;							\
+	__asm__(							\
+	"	.set push					\n"	\
+	"	.set dsp					\n"	\
+	"	mflo %0, $ac1					\n"	\
+	"	.set pop					\n" 	\
+	: "=r" (mflo1)); 						\
+	mflo1;								\
+})
+
+#define mflo2()								\
+({									\
+	long mflo2;							\
+	__asm__(							\
+	"	.set push					\n"	\
+	"	.set dsp					\n"	\
+	"	mflo %0, $ac2					\n"	\
+	"	.set pop					\n" 	\
+	: "=r" (mflo2)); 						\
+	mflo2;								\
+})
+
+#define mflo3()								\
+({									\
+	long mflo3;							\
+	__asm__(							\
+	"	.set push					\n"	\
+	"	.set dsp					\n"	\
+	"	mflo %0, $ac3					\n"	\
+	"	.set pop					\n" 	\
+	: "=r" (mflo3)); 						\
+	mflo3;								\
+})
+
+#define mfhi0()								\
+({									\
+	long mfhi0;							\
+	__asm__(							\
+	"	.set push					\n"	\
+	"	.set dsp					\n"	\
+	"	mfhi %0, $ac0					\n"	\
+	"	.set pop					\n" 	\
+	: "=r" (mfhi0)); 						\
+	mfhi0;								\
+})
+
+#define mfhi1()								\
+({									\
+	long mfhi1;							\
+	__asm__(							\
+	"	.set push					\n"	\
+	"	.set dsp					\n"	\
+	"	mfhi %0, $ac1					\n"	\
+	"	.set pop					\n" 	\
+	: "=r" (mfhi1)); 						\
+	mfhi1;								\
+})
+
+#define mfhi2()								\
+({									\
+	long mfhi2;							\
+	__asm__(							\
+	"	.set push					\n"	\
+	"	.set dsp					\n"	\
+	"	mfhi %0, $ac2					\n"	\
+	"	.set pop					\n" 	\
+	: "=r" (mfhi2)); 						\
+	mfhi2;								\
+})
+
+#define mfhi3()								\
+({									\
+	long mfhi3;							\
+	__asm__(							\
+	"	.set push					\n"	\
+	"	.set dsp					\n"	\
+	"	mfhi %0, $ac3					\n"	\
+	"	.set pop					\n" 	\
+	: "=r" (mfhi3)); 						\
+	mfhi3;								\
+})
+
+
+#define mtlo0(x)							\
+({									\
+	__asm__(							\
+	"	.set push					\n"	\
+	"	.set dsp					\n"	\
+	"	mtlo %0, $ac0					\n"	\
+	"	.set pop					\n"	\
+	:								\
+	: "r" (x));							\
+})
+
+#define mtlo1(x)							\
+({									\
+	__asm__(							\
+	"	.set push					\n"	\
+	"	.set dsp					\n"	\
+	"	mtlo %0, $ac1					\n"	\
+	"	.set pop					\n"	\
+	:								\
+	: "r" (x));							\
+})
+
+#define mtlo2(x)							\
+({									\
+	__asm__(							\
+	"	.set push					\n"	\
+	"	.set dsp					\n"	\
+	"	mtlo %0, $ac2					\n"	\
+	"	.set pop					\n"	\
+	:								\
+	: "r" (x));							\
+})
+
+#define mtlo3(x)							\
+({									\
+	__asm__(							\
+	"	.set push					\n"	\
+	"	.set dsp					\n"	\
+	"	mtlo %0, $ac3					\n"	\
+	"	.set pop					\n"	\
+	:								\
+	: "r" (x));							\
+})
+
+#define mthi0(x)							\
+({									\
+	__asm__(							\
+	"	.set push					\n"	\
+	"	.set dsp					\n"	\
+	"	mthi %0, $ac0					\n"	\
+	"	.set pop					\n"	\
+	:								\
+	: "r" (x));							\
+})
+
+#define mthi1(x)							\
+({									\
+	__asm__(							\
+	"	.set push					\n"	\
+	"	.set dsp					\n"	\
+	"	mthi %0, $ac1					\n"	\
+	"	.set pop					\n"	\
+	:								\
+	: "r" (x));							\
+})
+
+#define mthi2(x)							\
+({									\
+	__asm__(							\
+	"	.set push					\n"	\
+	"	.set dsp					\n"	\
+	"	mthi %0, $ac2					\n"	\
+	"	.set pop					\n"	\
+	:								\
+	: "r" (x));							\
+})
+
+#define mthi3(x)							\
+({									\
+	__asm__(							\
+	"	.set push					\n"	\
+	"	.set dsp					\n"	\
+	"	mthi %0, $ac3					\n"	\
+	"	.set pop					\n"	\
+	:								\
+	: "r" (x));							\
+})
 
 
 #else
 #else
 
 

+ 1 - 1
arch/mips/include/asm/signal.h

@@ -21,6 +21,6 @@
 #include <asm/sigcontext.h>
 #include <asm/sigcontext.h>
 #include <asm/siginfo.h>
 #include <asm/siginfo.h>
 
 
-#define __ARCH_HAS_ODD_SIGACTION
+#define __ARCH_HAS_IRIX_SIGACTION
 
 
 #endif /* _ASM_SIGNAL_H */
 #endif /* _ASM_SIGNAL_H */

+ 6 - 2
arch/mips/include/uapi/asm/signal.h

@@ -72,6 +72,12 @@ typedef unsigned long old_sigset_t;		/* at least 32 bits */
  *
  *
  * SA_ONESHOT and SA_NOMASK are the historical Linux names for the Single
  * SA_ONESHOT and SA_NOMASK are the historical Linux names for the Single
  * Unix names RESETHAND and NODEFER respectively.
  * Unix names RESETHAND and NODEFER respectively.
+ *
+ * SA_RESTORER used to be defined as 0x04000000 but only the O32 ABI ever
+ * supported its use and no libc was using it, so the entire sa-restorer
+ * functionality was removed with lmo commit 39bffc12c3580ab for 2.5.48
+ * retaining only the SA_RESTORER definition as a reminder to avoid
+ * accidental reuse of the mask bit.
  */
  */
 #define SA_ONSTACK	0x08000000
 #define SA_ONSTACK	0x08000000
 #define SA_RESETHAND	0x80000000
 #define SA_RESETHAND	0x80000000
@@ -84,8 +90,6 @@ typedef unsigned long old_sigset_t;		/* at least 32 bits */
 #define SA_NOMASK	SA_NODEFER
 #define SA_NOMASK	SA_NODEFER
 #define SA_ONESHOT	SA_RESETHAND
 #define SA_ONESHOT	SA_RESETHAND
 
 
-#define SA_RESTORER	0x04000000	/* Only for o32 */
-
 #define MINSIGSTKSZ    2048
 #define MINSIGSTKSZ    2048
 #define SIGSTKSZ       8192
 #define SIGSTKSZ       8192
 
 

+ 6 - 19
arch/mips/kernel/Makefile

@@ -100,29 +100,16 @@ obj-$(CONFIG_HW_PERF_EVENTS)	+= perf_event_mipsxx.o
 obj-$(CONFIG_JUMP_LABEL)	+= jump_label.o
 obj-$(CONFIG_JUMP_LABEL)	+= jump_label.o
 
 
 #
 #
-# DSP ASE supported for MIPS32 or MIPS64 Release 2 cores only. It is safe
-# to enable DSP assembler support here even if the MIPS Release 2 CPU we
-# are targetting does not support DSP because all code-paths making use of
-# it properly check that the running CPU *actually does* support these
-# instructions.
+# DSP ASE supported for MIPS32 or MIPS64 Release 2 cores only. It is not
+# safe to unconditionnaly use the assembler -mdsp / -mdspr2 switches
+# here because the compiler may use DSP ASE instructions (such as lwx) in
+# code paths where we cannot check that the CPU we are running on supports it.
+# Proper abstraction using HAVE_AS_DSP and macros is done in
+# arch/mips/include/asm/mipsregs.h.
 #
 #
 ifeq ($(CONFIG_CPU_MIPSR2), y)
 ifeq ($(CONFIG_CPU_MIPSR2), y)
 CFLAGS_DSP 			= -DHAVE_AS_DSP
 CFLAGS_DSP 			= -DHAVE_AS_DSP
 
 
-#
-# Check if assembler supports DSP ASE
-#
-ifeq ($(call cc-option-yn,-mdsp), y)
-CFLAGS_DSP			+= -mdsp
-endif
-
-#
-# Check if assembler supports DSP ASE Rev2
-#
-ifeq ($(call cc-option-yn,-mdspr2), y)
-CFLAGS_DSP			+= -mdspr2
-endif
-
 CFLAGS_signal.o			= $(CFLAGS_DSP)
 CFLAGS_signal.o			= $(CFLAGS_DSP)
 CFLAGS_signal32.o		= $(CFLAGS_DSP)
 CFLAGS_signal32.o		= $(CFLAGS_DSP)
 CFLAGS_process.o		= $(CFLAGS_DSP)
 CFLAGS_process.o		= $(CFLAGS_DSP)

+ 6 - 7
arch/mips/kernel/cpu-probe.c

@@ -580,6 +580,9 @@ static inline void cpu_probe_legacy(struct cpuinfo_mips *c, unsigned int cpu)
 		c->tlbsize = 48;
 		c->tlbsize = 48;
 		break;
 		break;
 	case PRID_IMP_VR41XX:
 	case PRID_IMP_VR41XX:
+		set_isa(c, MIPS_CPU_ISA_III);
+		c->options = R4K_OPTS;
+		c->tlbsize = 32;
 		switch (c->processor_id & 0xf0) {
 		switch (c->processor_id & 0xf0) {
 		case PRID_REV_VR4111:
 		case PRID_REV_VR4111:
 			c->cputype = CPU_VR4111;
 			c->cputype = CPU_VR4111;
@@ -604,6 +607,7 @@ static inline void cpu_probe_legacy(struct cpuinfo_mips *c, unsigned int cpu)
 				__cpu_name[cpu] = "NEC VR4131";
 				__cpu_name[cpu] = "NEC VR4131";
 			} else {
 			} else {
 				c->cputype = CPU_VR4133;
 				c->cputype = CPU_VR4133;
+				c->options |= MIPS_CPU_LLSC;
 				__cpu_name[cpu] = "NEC VR4133";
 				__cpu_name[cpu] = "NEC VR4133";
 			}
 			}
 			break;
 			break;
@@ -613,9 +617,6 @@ static inline void cpu_probe_legacy(struct cpuinfo_mips *c, unsigned int cpu)
 			__cpu_name[cpu] = "NEC Vr41xx";
 			__cpu_name[cpu] = "NEC Vr41xx";
 			break;
 			break;
 		}
 		}
-		set_isa(c, MIPS_CPU_ISA_III);
-		c->options = R4K_OPTS;
-		c->tlbsize = 32;
 		break;
 		break;
 	case PRID_IMP_R4300:
 	case PRID_IMP_R4300:
 		c->cputype = CPU_R4300;
 		c->cputype = CPU_R4300;
@@ -1226,10 +1227,8 @@ __cpuinit void cpu_probe(void)
 	if (c->options & MIPS_CPU_FPU) {
 	if (c->options & MIPS_CPU_FPU) {
 		c->fpu_id = cpu_get_fpu_id();
 		c->fpu_id = cpu_get_fpu_id();
 
 
-		if (c->isa_level == MIPS_CPU_ISA_M32R1 ||
-		    c->isa_level == MIPS_CPU_ISA_M32R2 ||
-		    c->isa_level == MIPS_CPU_ISA_M64R1 ||
-		    c->isa_level == MIPS_CPU_ISA_M64R2) {
+		if (c->isa_level & (MIPS_CPU_ISA_M32R1 | MIPS_CPU_ISA_M32R2 |
+				    MIPS_CPU_ISA_M64R1 | MIPS_CPU_ISA_M64R2)) {
 			if (c->fpu_id & MIPS_FPIR_3D)
 			if (c->fpu_id & MIPS_FPIR_3D)
 				c->ases |= MIPS_ASE_MIPS3D;
 				c->ases |= MIPS_ASE_MIPS3D;
 		}
 		}

+ 1 - 1
arch/mips/kernel/linux32.c

@@ -171,7 +171,7 @@ SYSCALL_DEFINE6(32_ipc, u32, call, long, first, long, second, long, third,
 		err = compat_sys_shmctl(first, second, compat_ptr(ptr));
 		err = compat_sys_shmctl(first, second, compat_ptr(ptr));
 		break;
 		break;
 	default:
 	default:
-		err = -EINVAL;
+		err = -ENOSYS;
 		break;
 		break;
 	}
 	}
 
 

+ 7 - 4
arch/mips/kernel/mcount.S

@@ -46,10 +46,9 @@
 	PTR_L	a5, PT_R9(sp)
 	PTR_L	a5, PT_R9(sp)
 	PTR_L	a6, PT_R10(sp)
 	PTR_L	a6, PT_R10(sp)
 	PTR_L	a7, PT_R11(sp)
 	PTR_L	a7, PT_R11(sp)
-#else
-	PTR_ADDIU	sp, PT_SIZE
 #endif
 #endif
-.endm
+	PTR_ADDIU	sp, PT_SIZE
+	.endm
 
 
 	.macro RETURN_BACK
 	.macro RETURN_BACK
 	jr ra
 	jr ra
@@ -68,7 +67,11 @@ NESTED(ftrace_caller, PT_SIZE, ra)
 	.globl _mcount
 	.globl _mcount
 _mcount:
 _mcount:
 	b	ftrace_stub
 	b	ftrace_stub
-	addiu sp,sp,8
+#ifdef CONFIG_32BIT
+	 addiu sp,sp,8
+#else
+	 nop
+#endif
 
 
 	/* When tracing is activated, it calls ftrace_caller+8 (aka here) */
 	/* When tracing is activated, it calls ftrace_caller+8 (aka here) */
 	lw	t1, function_trace_stop
 	lw	t1, function_trace_stop

+ 1 - 1
arch/mips/kernel/proc.c

@@ -67,7 +67,7 @@ static int show_cpuinfo(struct seq_file *m, void *v)
 	if (cpu_has_mips_r) {
 	if (cpu_has_mips_r) {
 		seq_printf(m, "isa\t\t\t:");
 		seq_printf(m, "isa\t\t\t:");
 		if (cpu_has_mips_1)
 		if (cpu_has_mips_1)
-			seq_printf(m, "%s", "mips1");
+			seq_printf(m, "%s", " mips1");
 		if (cpu_has_mips_2)
 		if (cpu_has_mips_2)
 			seq_printf(m, "%s", " mips2");
 			seq_printf(m, "%s", " mips2");
 		if (cpu_has_mips_3)
 		if (cpu_has_mips_3)

+ 1 - 1
arch/mips/kernel/traps.c

@@ -1571,7 +1571,7 @@ void __cpuinit per_cpu_trap_init(bool is_boot_cpu)
 #ifdef CONFIG_64BIT
 #ifdef CONFIG_64BIT
 	status_set |= ST0_FR|ST0_KX|ST0_SX|ST0_UX;
 	status_set |= ST0_FR|ST0_KX|ST0_SX|ST0_UX;
 #endif
 #endif
-	if (current_cpu_data.isa_level == MIPS_CPU_ISA_IV)
+	if (current_cpu_data.isa_level & MIPS_CPU_ISA_IV)
 		status_set |= ST0_XX;
 		status_set |= ST0_XX;
 	if (cpu_has_dsp)
 	if (cpu_has_dsp)
 		status_set |= ST0_MX;
 		status_set |= ST0_MX;

+ 8 - 8
arch/mips/lib/bitops.c

@@ -90,12 +90,12 @@ int __mips_test_and_set_bit(unsigned long nr,
 	unsigned bit = nr & SZLONG_MASK;
 	unsigned bit = nr & SZLONG_MASK;
 	unsigned long mask;
 	unsigned long mask;
 	unsigned long flags;
 	unsigned long flags;
-	unsigned long res;
+	int res;
 
 
 	a += nr >> SZLONG_LOG;
 	a += nr >> SZLONG_LOG;
 	mask = 1UL << bit;
 	mask = 1UL << bit;
 	raw_local_irq_save(flags);
 	raw_local_irq_save(flags);
-	res = (mask & *a);
+	res = (mask & *a) != 0;
 	*a |= mask;
 	*a |= mask;
 	raw_local_irq_restore(flags);
 	raw_local_irq_restore(flags);
 	return res;
 	return res;
@@ -116,12 +116,12 @@ int __mips_test_and_set_bit_lock(unsigned long nr,
 	unsigned bit = nr & SZLONG_MASK;
 	unsigned bit = nr & SZLONG_MASK;
 	unsigned long mask;
 	unsigned long mask;
 	unsigned long flags;
 	unsigned long flags;
-	unsigned long res;
+	int res;
 
 
 	a += nr >> SZLONG_LOG;
 	a += nr >> SZLONG_LOG;
 	mask = 1UL << bit;
 	mask = 1UL << bit;
 	raw_local_irq_save(flags);
 	raw_local_irq_save(flags);
-	res = (mask & *a);
+	res = (mask & *a) != 0;
 	*a |= mask;
 	*a |= mask;
 	raw_local_irq_restore(flags);
 	raw_local_irq_restore(flags);
 	return res;
 	return res;
@@ -141,12 +141,12 @@ int __mips_test_and_clear_bit(unsigned long nr, volatile unsigned long *addr)
 	unsigned bit = nr & SZLONG_MASK;
 	unsigned bit = nr & SZLONG_MASK;
 	unsigned long mask;
 	unsigned long mask;
 	unsigned long flags;
 	unsigned long flags;
-	unsigned long res;
+	int res;
 
 
 	a += nr >> SZLONG_LOG;
 	a += nr >> SZLONG_LOG;
 	mask = 1UL << bit;
 	mask = 1UL << bit;
 	raw_local_irq_save(flags);
 	raw_local_irq_save(flags);
-	res = (mask & *a);
+	res = (mask & *a) != 0;
 	*a &= ~mask;
 	*a &= ~mask;
 	raw_local_irq_restore(flags);
 	raw_local_irq_restore(flags);
 	return res;
 	return res;
@@ -166,12 +166,12 @@ int __mips_test_and_change_bit(unsigned long nr, volatile unsigned long *addr)
 	unsigned bit = nr & SZLONG_MASK;
 	unsigned bit = nr & SZLONG_MASK;
 	unsigned long mask;
 	unsigned long mask;
 	unsigned long flags;
 	unsigned long flags;
-	unsigned long res;
+	int res;
 
 
 	a += nr >> SZLONG_LOG;
 	a += nr >> SZLONG_LOG;
 	mask = 1UL << bit;
 	mask = 1UL << bit;
 	raw_local_irq_save(flags);
 	raw_local_irq_save(flags);
-	res = (mask & *a);
+	res = (mask & *a) != 0;
 	*a ^= mask;
 	*a ^= mask;
 	raw_local_irq_restore(flags);
 	raw_local_irq_restore(flags);
 	return res;
 	return res;

+ 2 - 2
arch/mips/lib/csum_partial.S

@@ -270,7 +270,7 @@ LEAF(csum_partial)
 #endif
 #endif
 
 
 	/* odd buffer alignment? */
 	/* odd buffer alignment? */
-#ifdef CPU_MIPSR2
+#ifdef CONFIG_CPU_MIPSR2
 	wsbh	v1, sum
 	wsbh	v1, sum
 	movn	sum, v1, t7
 	movn	sum, v1, t7
 #else
 #else
@@ -670,7 +670,7 @@ EXC(	sb	t0, NBYTES-2(dst), .Ls_exc)
 	addu	sum, v1
 	addu	sum, v1
 #endif
 #endif
 
 
-#ifdef CPU_MIPSR2
+#ifdef CONFIG_CPU_MIPSR2
 	wsbh	v1, sum
 	wsbh	v1, sum
 	movn	sum, v1, odd
 	movn	sum, v1, odd
 #else
 #else

+ 2 - 4
arch/mips/mm/c-r4k.c

@@ -1247,10 +1247,8 @@ static void __cpuinit setup_scache(void)
 		return;
 		return;
 
 
 	default:
 	default:
-		if (c->isa_level == MIPS_CPU_ISA_M32R1 ||
-		    c->isa_level == MIPS_CPU_ISA_M32R2 ||
-		    c->isa_level == MIPS_CPU_ISA_M64R1 ||
-		    c->isa_level == MIPS_CPU_ISA_M64R2) {
+		if (c->isa_level & (MIPS_CPU_ISA_M32R1 | MIPS_CPU_ISA_M32R2 |
+				    MIPS_CPU_ISA_M64R1 | MIPS_CPU_ISA_M64R2)) {
 #ifdef CONFIG_MIPS_CPU_SCACHE
 #ifdef CONFIG_MIPS_CPU_SCACHE
 			if (mips_sc_init ()) {
 			if (mips_sc_init ()) {
 				scache_size = c->scache.ways * c->scache.sets * c->scache.linesz;
 				scache_size = c->scache.ways * c->scache.sets * c->scache.linesz;

+ 2 - 4
arch/mips/mm/sc-mips.c

@@ -98,10 +98,8 @@ static inline int __init mips_sc_probe(void)
 	c->scache.flags |= MIPS_CACHE_NOT_PRESENT;
 	c->scache.flags |= MIPS_CACHE_NOT_PRESENT;
 
 
 	/* Ignore anything but MIPSxx processors */
 	/* Ignore anything but MIPSxx processors */
-	if (c->isa_level != MIPS_CPU_ISA_M32R1 &&
-	    c->isa_level != MIPS_CPU_ISA_M32R2 &&
-	    c->isa_level != MIPS_CPU_ISA_M64R1 &&
-	    c->isa_level != MIPS_CPU_ISA_M64R2)
+	if (!(c->isa_level & (MIPS_CPU_ISA_M32R1 | MIPS_CPU_ISA_M32R2 |
+			      MIPS_CPU_ISA_M64R1 | MIPS_CPU_ISA_M64R2)))
 		return 0;
 		return 0;
 
 
 	/* Does this MIPS32/MIPS64 CPU have a config2 register? */
 	/* Does this MIPS32/MIPS64 CPU have a config2 register? */

+ 2 - 2
arch/mips/pci/pci-alchemy.c

@@ -19,7 +19,7 @@
 #include <asm/mach-au1x00/au1000.h>
 #include <asm/mach-au1x00/au1000.h>
 #include <asm/tlbmisc.h>
 #include <asm/tlbmisc.h>
 
 
-#ifdef CONFIG_DEBUG_PCI
+#ifdef CONFIG_PCI_DEBUG
 #define DBG(x...) printk(KERN_DEBUG x)
 #define DBG(x...) printk(KERN_DEBUG x)
 #else
 #else
 #define DBG(x...) do {} while (0)
 #define DBG(x...) do {} while (0)
@@ -162,7 +162,7 @@ static int config_access(unsigned char access_type, struct pci_bus *bus,
 	if (status & (1 << 29)) {
 	if (status & (1 << 29)) {
 		*data = 0xffffffff;
 		*data = 0xffffffff;
 		error = -1;
 		error = -1;
-		DBG("alchemy-pci: master abort on cfg access %d bus %d dev %d",
+		DBG("alchemy-pci: master abort on cfg access %d bus %d dev %d\n",
 		    access_type, bus->number, device);
 		    access_type, bus->number, device);
 	} else if ((status >> 28) & 0xf) {
 	} else if ((status >> 28) & 0xf) {
 		DBG("alchemy-pci: PCI ERR detected: dev %d, status %lx\n",
 		DBG("alchemy-pci: PCI ERR detected: dev %d, status %lx\n",

+ 3 - 1
arch/s390/include/asm/pgtable.h

@@ -344,6 +344,7 @@ extern unsigned long MODULES_END;
 #define _REGION3_ENTRY_CO	0x100	/* change-recording override	    */
 #define _REGION3_ENTRY_CO	0x100	/* change-recording override	    */
 
 
 /* Bits in the segment table entry */
 /* Bits in the segment table entry */
+#define _SEGMENT_ENTRY_ORIGIN_LARGE ~0xfffffUL /* large page address	    */
 #define _SEGMENT_ENTRY_ORIGIN	~0x7ffUL/* segment table origin		    */
 #define _SEGMENT_ENTRY_ORIGIN	~0x7ffUL/* segment table origin		    */
 #define _SEGMENT_ENTRY_RO	0x200	/* page protection bit		    */
 #define _SEGMENT_ENTRY_RO	0x200	/* page protection bit		    */
 #define _SEGMENT_ENTRY_INV	0x20	/* invalid segment table entry	    */
 #define _SEGMENT_ENTRY_INV	0x20	/* invalid segment table entry	    */
@@ -1531,7 +1532,8 @@ extern int s390_enable_sie(void);
 /*
 /*
  * No page table caches to initialise
  * No page table caches to initialise
  */
  */
-#define pgtable_cache_init()	do { } while (0)
+static inline void pgtable_cache_init(void) { }
+static inline void check_pgt_cache(void) { }
 
 
 #include <asm-generic/pgtable.h>
 #include <asm-generic/pgtable.h>
 
 

+ 55 - 28
arch/s390/lib/uaccess_pt.c

@@ -77,42 +77,69 @@ static size_t copy_in_kernel(size_t count, void __user *to,
  * >= -4095 (IS_ERR_VALUE(x) returns true), a fault has occured and the address
  * >= -4095 (IS_ERR_VALUE(x) returns true), a fault has occured and the address
  * contains the (negative) exception code.
  * contains the (negative) exception code.
  */
  */
-static __always_inline unsigned long follow_table(struct mm_struct *mm,
-						  unsigned long addr, int write)
+#ifdef CONFIG_64BIT
+static unsigned long follow_table(struct mm_struct *mm,
+				  unsigned long address, int write)
 {
 {
-	pgd_t *pgd;
-	pud_t *pud;
-	pmd_t *pmd;
-	pte_t *ptep;
+	unsigned long *table = (unsigned long *)__pa(mm->pgd);
+
+	switch (mm->context.asce_bits & _ASCE_TYPE_MASK) {
+	case _ASCE_TYPE_REGION1:
+		table = table + ((address >> 53) & 0x7ff);
+		if (unlikely(*table & _REGION_ENTRY_INV))
+			return -0x39UL;
+		table = (unsigned long *)(*table & _REGION_ENTRY_ORIGIN);
+	case _ASCE_TYPE_REGION2:
+		table = table + ((address >> 42) & 0x7ff);
+		if (unlikely(*table & _REGION_ENTRY_INV))
+			return -0x3aUL;
+		table = (unsigned long *)(*table & _REGION_ENTRY_ORIGIN);
+	case _ASCE_TYPE_REGION3:
+		table = table + ((address >> 31) & 0x7ff);
+		if (unlikely(*table & _REGION_ENTRY_INV))
+			return -0x3bUL;
+		table = (unsigned long *)(*table & _REGION_ENTRY_ORIGIN);
+	case _ASCE_TYPE_SEGMENT:
+		table = table + ((address >> 20) & 0x7ff);
+		if (unlikely(*table & _SEGMENT_ENTRY_INV))
+			return -0x10UL;
+		if (unlikely(*table & _SEGMENT_ENTRY_LARGE)) {
+			if (write && (*table & _SEGMENT_ENTRY_RO))
+				return -0x04UL;
+			return (*table & _SEGMENT_ENTRY_ORIGIN_LARGE) +
+				(address & ~_SEGMENT_ENTRY_ORIGIN_LARGE);
+		}
+		table = (unsigned long *)(*table & _SEGMENT_ENTRY_ORIGIN);
+	}
+	table = table + ((address >> 12) & 0xff);
+	if (unlikely(*table & _PAGE_INVALID))
+		return -0x11UL;
+	if (write && (*table & _PAGE_RO))
+		return -0x04UL;
+	return (*table & PAGE_MASK) + (address & ~PAGE_MASK);
+}
 
 
-	pgd = pgd_offset(mm, addr);
-	if (pgd_none(*pgd) || unlikely(pgd_bad(*pgd)))
-		return -0x3aUL;
+#else /* CONFIG_64BIT */
 
 
-	pud = pud_offset(pgd, addr);
-	if (pud_none(*pud) || unlikely(pud_bad(*pud)))
-		return -0x3bUL;
+static unsigned long follow_table(struct mm_struct *mm,
+				  unsigned long address, int write)
+{
+	unsigned long *table = (unsigned long *)__pa(mm->pgd);
 
 
-	pmd = pmd_offset(pud, addr);
-	if (pmd_none(*pmd))
+	table = table + ((address >> 20) & 0x7ff);
+	if (unlikely(*table & _SEGMENT_ENTRY_INV))
 		return -0x10UL;
 		return -0x10UL;
-	if (pmd_large(*pmd)) {
-		if (write && (pmd_val(*pmd) & _SEGMENT_ENTRY_RO))
-			return -0x04UL;
-		return (pmd_val(*pmd) & HPAGE_MASK) + (addr & ~HPAGE_MASK);
-	}
-	if (unlikely(pmd_bad(*pmd)))
-		return -0x10UL;
-
-	ptep = pte_offset_map(pmd, addr);
-	if (!pte_present(*ptep))
+	table = (unsigned long *)(*table & _SEGMENT_ENTRY_ORIGIN);
+	table = table + ((address >> 12) & 0xff);
+	if (unlikely(*table & _PAGE_INVALID))
 		return -0x11UL;
 		return -0x11UL;
-	if (write && (!pte_write(*ptep) || !pte_dirty(*ptep)))
+	if (write && (*table & _PAGE_RO))
 		return -0x04UL;
 		return -0x04UL;
-
-	return (pte_val(*ptep) & PAGE_MASK) + (addr & ~PAGE_MASK);
+	return (*table & PAGE_MASK) + (address & ~PAGE_MASK);
 }
 }
 
 
+#endif /* CONFIG_64BIT */
+
 static __always_inline size_t __user_copy_pt(unsigned long uaddr, void *kptr,
 static __always_inline size_t __user_copy_pt(unsigned long uaddr, void *kptr,
 					     size_t n, int write_user)
 					     size_t n, int write_user)
 {
 {
@@ -197,7 +224,7 @@ size_t copy_to_user_pt(size_t n, void __user *to, const void *from)
 
 
 static size_t clear_user_pt(size_t n, void __user *to)
 static size_t clear_user_pt(size_t n, void __user *to)
 {
 {
-	void *zpage = &empty_zero_page;
+	void *zpage = (void *) empty_zero_page;
 	long done, size, ret;
 	long done, size, ret;
 
 
 	done = 0;
 	done = 0;

+ 12 - 13
arch/tile/kernel/setup.c

@@ -1004,15 +1004,8 @@ void __cpuinit setup_cpu(int boot)
 
 
 #ifdef CONFIG_BLK_DEV_INITRD
 #ifdef CONFIG_BLK_DEV_INITRD
 
 
-/*
- * Note that the kernel can potentially support other compression
- * techniques than gz, though we don't do so by default.  If we ever
- * decide to do so we can either look for other filename extensions,
- * or just allow a file with this name to be compressed with an
- * arbitrary compressor (somewhat counterintuitively).
- */
 static int __initdata set_initramfs_file;
 static int __initdata set_initramfs_file;
-static char __initdata initramfs_file[128] = "initramfs.cpio.gz";
+static char __initdata initramfs_file[128] = "initramfs";
 
 
 static int __init setup_initramfs_file(char *str)
 static int __init setup_initramfs_file(char *str)
 {
 {
@@ -1026,9 +1019,9 @@ static int __init setup_initramfs_file(char *str)
 early_param("initramfs_file", setup_initramfs_file);
 early_param("initramfs_file", setup_initramfs_file);
 
 
 /*
 /*
- * We look for an "initramfs.cpio.gz" file in the hvfs.
- * If there is one, we allocate some memory for it and it will be
- * unpacked to the initramfs.
+ * We look for a file called "initramfs" in the hvfs.  If there is one, we
+ * allocate some memory for it and it will be unpacked to the initramfs.
+ * If it's compressed, the initd code will uncompress it first.
  */
  */
 static void __init load_hv_initrd(void)
 static void __init load_hv_initrd(void)
 {
 {
@@ -1038,10 +1031,16 @@ static void __init load_hv_initrd(void)
 
 
 	fd = hv_fs_findfile((HV_VirtAddr) initramfs_file);
 	fd = hv_fs_findfile((HV_VirtAddr) initramfs_file);
 	if (fd == HV_ENOENT) {
 	if (fd == HV_ENOENT) {
-		if (set_initramfs_file)
+		if (set_initramfs_file) {
 			pr_warning("No such hvfs initramfs file '%s'\n",
 			pr_warning("No such hvfs initramfs file '%s'\n",
 				   initramfs_file);
 				   initramfs_file);
-		return;
+			return;
+		} else {
+			/* Try old backwards-compatible name. */
+			fd = hv_fs_findfile((HV_VirtAddr)"initramfs.cpio.gz");
+			if (fd == HV_ENOENT)
+				return;
+		}
 	}
 	}
 	BUG_ON(fd < 0);
 	BUG_ON(fd < 0);
 	stat = hv_fs_fstat(fd);
 	stat = hv_fs_fstat(fd);

+ 2 - 3
arch/x86/boot/compressed/Makefile

@@ -4,7 +4,7 @@
 # create a compressed vmlinux image from the original vmlinux
 # create a compressed vmlinux image from the original vmlinux
 #
 #
 
 
-targets := vmlinux.lds vmlinux vmlinux.bin vmlinux.bin.gz vmlinux.bin.bz2 vmlinux.bin.lzma vmlinux.bin.xz vmlinux.bin.lzo head_$(BITS).o misc.o string.o cmdline.o early_serial_console.o piggy.o
+targets := vmlinux vmlinux.bin vmlinux.bin.gz vmlinux.bin.bz2 vmlinux.bin.lzma vmlinux.bin.xz vmlinux.bin.lzo
 
 
 KBUILD_CFLAGS := -m$(BITS) -D__KERNEL__ $(LINUX_INCLUDE) -O2
 KBUILD_CFLAGS := -m$(BITS) -D__KERNEL__ $(LINUX_INCLUDE) -O2
 KBUILD_CFLAGS += -fno-strict-aliasing -fPIC
 KBUILD_CFLAGS += -fno-strict-aliasing -fPIC
@@ -29,7 +29,6 @@ VMLINUX_OBJS = $(obj)/vmlinux.lds $(obj)/head_$(BITS).o $(obj)/misc.o \
 	$(obj)/piggy.o
 	$(obj)/piggy.o
 
 
 $(obj)/eboot.o: KBUILD_CFLAGS += -fshort-wchar -mno-red-zone
 $(obj)/eboot.o: KBUILD_CFLAGS += -fshort-wchar -mno-red-zone
-$(obj)/efi_stub_$(BITS).o: KBUILD_CLFAGS += -fshort-wchar -mno-red-zone
 
 
 ifeq ($(CONFIG_EFI_STUB), y)
 ifeq ($(CONFIG_EFI_STUB), y)
 	VMLINUX_OBJS += $(obj)/eboot.o $(obj)/efi_stub_$(BITS).o
 	VMLINUX_OBJS += $(obj)/eboot.o $(obj)/efi_stub_$(BITS).o
@@ -43,7 +42,7 @@ OBJCOPYFLAGS_vmlinux.bin :=  -R .comment -S
 $(obj)/vmlinux.bin: vmlinux FORCE
 $(obj)/vmlinux.bin: vmlinux FORCE
 	$(call if_changed,objcopy)
 	$(call if_changed,objcopy)
 
 
-targets += vmlinux.bin.all vmlinux.relocs
+targets += $(patsubst $(obj)/%,%,$(VMLINUX_OBJS)) vmlinux.bin.all vmlinux.relocs
 
 
 CMD_RELOCS = arch/x86/tools/relocs
 CMD_RELOCS = arch/x86/tools/relocs
 quiet_cmd_relocs = RELOCS  $@
 quiet_cmd_relocs = RELOCS  $@

+ 2 - 2
arch/x86/include/asm/syscall.h

@@ -29,13 +29,13 @@ extern const unsigned long sys_call_table[];
  */
  */
 static inline int syscall_get_nr(struct task_struct *task, struct pt_regs *regs)
 static inline int syscall_get_nr(struct task_struct *task, struct pt_regs *regs)
 {
 {
-	return regs->orig_ax & __SYSCALL_MASK;
+	return regs->orig_ax;
 }
 }
 
 
 static inline void syscall_rollback(struct task_struct *task,
 static inline void syscall_rollback(struct task_struct *task,
 				    struct pt_regs *regs)
 				    struct pt_regs *regs)
 {
 {
-	regs->ax = regs->orig_ax & __SYSCALL_MASK;
+	regs->ax = regs->orig_ax;
 }
 }
 
 
 static inline long syscall_get_error(struct task_struct *task,
 static inline long syscall_get_error(struct task_struct *task,

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

@@ -1857,7 +1857,7 @@ int kvm_lapic_enable_pv_eoi(struct kvm_vcpu *vcpu, u64 data)
 	if (!pv_eoi_enabled(vcpu))
 	if (!pv_eoi_enabled(vcpu))
 		return 0;
 		return 0;
 	return kvm_gfn_to_hva_cache_init(vcpu->kvm, &vcpu->arch.pv_eoi.data,
 	return kvm_gfn_to_hva_cache_init(vcpu->kvm, &vcpu->arch.pv_eoi.data,
-					 addr);
+					 addr, sizeof(u8));
 }
 }
 
 
 void kvm_lapic_init(void)
 void kvm_lapic_init(void)

+ 6 - 7
arch/x86/kvm/x86.c

@@ -1823,7 +1823,8 @@ static int kvm_pv_enable_async_pf(struct kvm_vcpu *vcpu, u64 data)
 		return 0;
 		return 0;
 	}
 	}
 
 
-	if (kvm_gfn_to_hva_cache_init(vcpu->kvm, &vcpu->arch.apf.data, gpa))
+	if (kvm_gfn_to_hva_cache_init(vcpu->kvm, &vcpu->arch.apf.data, gpa,
+					sizeof(u32)))
 		return 1;
 		return 1;
 
 
 	vcpu->arch.apf.send_user_only = !(data & KVM_ASYNC_PF_SEND_ALWAYS);
 	vcpu->arch.apf.send_user_only = !(data & KVM_ASYNC_PF_SEND_ALWAYS);
@@ -1952,12 +1953,9 @@ int kvm_set_msr_common(struct kvm_vcpu *vcpu, struct msr_data *msr_info)
 
 
 		gpa_offset = data & ~(PAGE_MASK | 1);
 		gpa_offset = data & ~(PAGE_MASK | 1);
 
 
-		/* Check that the address is 32-byte aligned. */
-		if (gpa_offset & (sizeof(struct pvclock_vcpu_time_info) - 1))
-			break;
-
 		if (kvm_gfn_to_hva_cache_init(vcpu->kvm,
 		if (kvm_gfn_to_hva_cache_init(vcpu->kvm,
-		     &vcpu->arch.pv_time, data & ~1ULL))
+		     &vcpu->arch.pv_time, data & ~1ULL,
+		     sizeof(struct pvclock_vcpu_time_info)))
 			vcpu->arch.pv_time_enabled = false;
 			vcpu->arch.pv_time_enabled = false;
 		else
 		else
 			vcpu->arch.pv_time_enabled = true;
 			vcpu->arch.pv_time_enabled = true;
@@ -1977,7 +1975,8 @@ int kvm_set_msr_common(struct kvm_vcpu *vcpu, struct msr_data *msr_info)
 			return 1;
 			return 1;
 
 
 		if (kvm_gfn_to_hva_cache_init(vcpu->kvm, &vcpu->arch.st.stime,
 		if (kvm_gfn_to_hva_cache_init(vcpu->kvm, &vcpu->arch.st.stime,
-							data & KVM_STEAL_VALID_BITS))
+						data & KVM_STEAL_VALID_BITS,
+						sizeof(struct kvm_steal_time)))
 			return 1;
 			return 1;
 
 
 		vcpu->arch.st.msr_val = data;
 		vcpu->arch.st.msr_val = data;

+ 1 - 1
drivers/acpi/Kconfig

@@ -396,7 +396,7 @@ config ACPI_CUSTOM_METHOD
 
 
 config ACPI_BGRT
 config ACPI_BGRT
 	bool "Boottime Graphics Resource Table support"
 	bool "Boottime Graphics Resource Table support"
-	depends on EFI
+	depends on EFI && X86
         help
         help
 	  This driver adds support for exposing the ACPI Boottime Graphics
 	  This driver adds support for exposing the ACPI Boottime Graphics
 	  Resource Table, which allows the operating system to obtain
 	  Resource Table, which allows the operating system to obtain

+ 1 - 1
drivers/acpi/acpi_i2c.c

@@ -90,7 +90,7 @@ void acpi_i2c_register_devices(struct i2c_adapter *adapter)
 	acpi_handle handle;
 	acpi_handle handle;
 	acpi_status status;
 	acpi_status status;
 
 
-	handle = ACPI_HANDLE(&adapter->dev);
+	handle = ACPI_HANDLE(adapter->dev.parent);
 	if (!handle)
 	if (!handle)
 		return;
 		return;
 
 

+ 37 - 39
drivers/acpi/pci_root.c

@@ -415,7 +415,6 @@ static int acpi_pci_root_add(struct acpi_device *device,
 	struct acpi_pci_root *root;
 	struct acpi_pci_root *root;
 	struct acpi_pci_driver *driver;
 	struct acpi_pci_driver *driver;
 	u32 flags, base_flags;
 	u32 flags, base_flags;
-	bool is_osc_granted = false;
 
 
 	root = kzalloc(sizeof(struct acpi_pci_root), GFP_KERNEL);
 	root = kzalloc(sizeof(struct acpi_pci_root), GFP_KERNEL);
 	if (!root)
 	if (!root)
@@ -476,6 +475,30 @@ static int acpi_pci_root_add(struct acpi_device *device,
 	flags = base_flags = OSC_PCI_SEGMENT_GROUPS_SUPPORT;
 	flags = base_flags = OSC_PCI_SEGMENT_GROUPS_SUPPORT;
 	acpi_pci_osc_support(root, flags);
 	acpi_pci_osc_support(root, flags);
 
 
+	/*
+	 * TBD: Need PCI interface for enumeration/configuration of roots.
+	 */
+
+	mutex_lock(&acpi_pci_root_lock);
+	list_add_tail(&root->node, &acpi_pci_roots);
+	mutex_unlock(&acpi_pci_root_lock);
+
+	/*
+	 * Scan the Root Bridge
+	 * --------------------
+	 * Must do this prior to any attempt to bind the root device, as the
+	 * PCI namespace does not get created until this call is made (and
+	 * thus the root bridge's pci_dev does not exist).
+	 */
+	root->bus = pci_acpi_scan_root(root);
+	if (!root->bus) {
+		printk(KERN_ERR PREFIX
+			    "Bus %04x:%02x not present in PCI namespace\n",
+			    root->segment, (unsigned int)root->secondary.start);
+		result = -ENODEV;
+		goto out_del_root;
+	}
+
 	/* Indicate support for various _OSC capabilities. */
 	/* Indicate support for various _OSC capabilities. */
 	if (pci_ext_cfg_avail())
 	if (pci_ext_cfg_avail())
 		flags |= OSC_EXT_PCI_CONFIG_SUPPORT;
 		flags |= OSC_EXT_PCI_CONFIG_SUPPORT;
@@ -494,6 +517,7 @@ static int acpi_pci_root_add(struct acpi_device *device,
 			flags = base_flags;
 			flags = base_flags;
 		}
 		}
 	}
 	}
+
 	if (!pcie_ports_disabled
 	if (!pcie_ports_disabled
 	    && (flags & ACPI_PCIE_REQ_SUPPORT) == ACPI_PCIE_REQ_SUPPORT) {
 	    && (flags & ACPI_PCIE_REQ_SUPPORT) == ACPI_PCIE_REQ_SUPPORT) {
 		flags = OSC_PCI_EXPRESS_CAP_STRUCTURE_CONTROL
 		flags = OSC_PCI_EXPRESS_CAP_STRUCTURE_CONTROL
@@ -514,54 +538,28 @@ static int acpi_pci_root_add(struct acpi_device *device,
 		status = acpi_pci_osc_control_set(device->handle, &flags,
 		status = acpi_pci_osc_control_set(device->handle, &flags,
 				       OSC_PCI_EXPRESS_CAP_STRUCTURE_CONTROL);
 				       OSC_PCI_EXPRESS_CAP_STRUCTURE_CONTROL);
 		if (ACPI_SUCCESS(status)) {
 		if (ACPI_SUCCESS(status)) {
-			is_osc_granted = true;
 			dev_info(&device->dev,
 			dev_info(&device->dev,
 				"ACPI _OSC control (0x%02x) granted\n", flags);
 				"ACPI _OSC control (0x%02x) granted\n", flags);
+			if (acpi_gbl_FADT.boot_flags & ACPI_FADT_NO_ASPM) {
+				/*
+				 * We have ASPM control, but the FADT indicates
+				 * that it's unsupported. Clear it.
+				 */
+				pcie_clear_aspm(root->bus);
+			}
 		} else {
 		} else {
-			is_osc_granted = false;
 			dev_info(&device->dev,
 			dev_info(&device->dev,
 				"ACPI _OSC request failed (%s), "
 				"ACPI _OSC request failed (%s), "
 				"returned control mask: 0x%02x\n",
 				"returned control mask: 0x%02x\n",
 				acpi_format_exception(status), flags);
 				acpi_format_exception(status), flags);
+			pr_info("ACPI _OSC control for PCIe not granted, "
+				"disabling ASPM\n");
+			pcie_no_aspm();
 		}
 		}
 	} else {
 	} else {
 		dev_info(&device->dev,
 		dev_info(&device->dev,
-			"Unable to request _OSC control "
-			"(_OSC support mask: 0x%02x)\n", flags);
-	}
-
-	/*
-	 * TBD: Need PCI interface for enumeration/configuration of roots.
-	 */
-
-	mutex_lock(&acpi_pci_root_lock);
-	list_add_tail(&root->node, &acpi_pci_roots);
-	mutex_unlock(&acpi_pci_root_lock);
-
-	/*
-	 * Scan the Root Bridge
-	 * --------------------
-	 * Must do this prior to any attempt to bind the root device, as the
-	 * PCI namespace does not get created until this call is made (and 
-	 * thus the root bridge's pci_dev does not exist).
-	 */
-	root->bus = pci_acpi_scan_root(root);
-	if (!root->bus) {
-		printk(KERN_ERR PREFIX
-			    "Bus %04x:%02x not present in PCI namespace\n",
-			    root->segment, (unsigned int)root->secondary.start);
-		result = -ENODEV;
-		goto out_del_root;
-	}
-
-	/* ASPM setting */
-	if (is_osc_granted) {
-		if (acpi_gbl_FADT.boot_flags & ACPI_FADT_NO_ASPM)
-			pcie_clear_aspm(root->bus);
-	} else {
-		pr_info("ACPI _OSC control for PCIe not granted, "
-			"disabling ASPM\n");
-		pcie_no_aspm();
+			 "Unable to request _OSC control "
+			 "(_OSC support mask: 0x%02x)\n", flags);
 	}
 	}
 
 
 	pci_acpi_add_bus_pm_notifier(device, root->bus);
 	pci_acpi_add_bus_pm_notifier(device, root->bus);

+ 7 - 6
drivers/acpi/processor_idle.c

@@ -66,7 +66,8 @@ module_param(latency_factor, uint, 0644);
 
 
 static DEFINE_PER_CPU(struct cpuidle_device *, acpi_cpuidle_device);
 static DEFINE_PER_CPU(struct cpuidle_device *, acpi_cpuidle_device);
 
 
-static struct acpi_processor_cx *acpi_cstate[CPUIDLE_STATE_MAX];
+static DEFINE_PER_CPU(struct acpi_processor_cx * [CPUIDLE_STATE_MAX],
+								acpi_cstate);
 
 
 static int disabled_by_idle_boot_param(void)
 static int disabled_by_idle_boot_param(void)
 {
 {
@@ -722,7 +723,7 @@ static int acpi_idle_enter_c1(struct cpuidle_device *dev,
 		struct cpuidle_driver *drv, int index)
 		struct cpuidle_driver *drv, int index)
 {
 {
 	struct acpi_processor *pr;
 	struct acpi_processor *pr;
-	struct acpi_processor_cx *cx = acpi_cstate[index];
+	struct acpi_processor_cx *cx = per_cpu(acpi_cstate[index], dev->cpu);
 
 
 	pr = __this_cpu_read(processors);
 	pr = __this_cpu_read(processors);
 
 
@@ -745,7 +746,7 @@ static int acpi_idle_enter_c1(struct cpuidle_device *dev,
  */
  */
 static int acpi_idle_play_dead(struct cpuidle_device *dev, int index)
 static int acpi_idle_play_dead(struct cpuidle_device *dev, int index)
 {
 {
-	struct acpi_processor_cx *cx = acpi_cstate[index];
+	struct acpi_processor_cx *cx = per_cpu(acpi_cstate[index], dev->cpu);
 
 
 	ACPI_FLUSH_CPU_CACHE();
 	ACPI_FLUSH_CPU_CACHE();
 
 
@@ -775,7 +776,7 @@ static int acpi_idle_enter_simple(struct cpuidle_device *dev,
 		struct cpuidle_driver *drv, int index)
 		struct cpuidle_driver *drv, int index)
 {
 {
 	struct acpi_processor *pr;
 	struct acpi_processor *pr;
-	struct acpi_processor_cx *cx = acpi_cstate[index];
+	struct acpi_processor_cx *cx = per_cpu(acpi_cstate[index], dev->cpu);
 
 
 	pr = __this_cpu_read(processors);
 	pr = __this_cpu_read(processors);
 
 
@@ -833,7 +834,7 @@ static int acpi_idle_enter_bm(struct cpuidle_device *dev,
 		struct cpuidle_driver *drv, int index)
 		struct cpuidle_driver *drv, int index)
 {
 {
 	struct acpi_processor *pr;
 	struct acpi_processor *pr;
-	struct acpi_processor_cx *cx = acpi_cstate[index];
+	struct acpi_processor_cx *cx = per_cpu(acpi_cstate[index], dev->cpu);
 
 
 	pr = __this_cpu_read(processors);
 	pr = __this_cpu_read(processors);
 
 
@@ -960,7 +961,7 @@ static int acpi_processor_setup_cpuidle_cx(struct acpi_processor *pr,
 		    !(acpi_gbl_FADT.flags & ACPI_FADT_C2_MP_SUPPORTED))
 		    !(acpi_gbl_FADT.flags & ACPI_FADT_C2_MP_SUPPORTED))
 			continue;
 			continue;
 #endif
 #endif
-		acpi_cstate[count] = cx;
+		per_cpu(acpi_cstate[count], dev->cpu) = cx;
 
 
 		count++;
 		count++;
 		if (count == CPUIDLE_STATE_MAX)
 		if (count == CPUIDLE_STATE_MAX)

+ 47 - 13
drivers/base/power/qos.c

@@ -46,6 +46,7 @@
 #include "power.h"
 #include "power.h"
 
 
 static DEFINE_MUTEX(dev_pm_qos_mtx);
 static DEFINE_MUTEX(dev_pm_qos_mtx);
+static DEFINE_MUTEX(dev_pm_qos_sysfs_mtx);
 
 
 static BLOCKING_NOTIFIER_HEAD(dev_pm_notifiers);
 static BLOCKING_NOTIFIER_HEAD(dev_pm_notifiers);
 
 
@@ -216,12 +217,17 @@ void dev_pm_qos_constraints_destroy(struct device *dev)
 	struct pm_qos_constraints *c;
 	struct pm_qos_constraints *c;
 	struct pm_qos_flags *f;
 	struct pm_qos_flags *f;
 
 
-	mutex_lock(&dev_pm_qos_mtx);
+	mutex_lock(&dev_pm_qos_sysfs_mtx);
 
 
 	/*
 	/*
 	 * If the device's PM QoS resume latency limit or PM QoS flags have been
 	 * If the device's PM QoS resume latency limit or PM QoS flags have been
 	 * exposed to user space, they have to be hidden at this point.
 	 * exposed to user space, they have to be hidden at this point.
 	 */
 	 */
+	pm_qos_sysfs_remove_latency(dev);
+	pm_qos_sysfs_remove_flags(dev);
+
+	mutex_lock(&dev_pm_qos_mtx);
+
 	__dev_pm_qos_hide_latency_limit(dev);
 	__dev_pm_qos_hide_latency_limit(dev);
 	__dev_pm_qos_hide_flags(dev);
 	__dev_pm_qos_hide_flags(dev);
 
 
@@ -254,6 +260,8 @@ void dev_pm_qos_constraints_destroy(struct device *dev)
 
 
  out:
  out:
 	mutex_unlock(&dev_pm_qos_mtx);
 	mutex_unlock(&dev_pm_qos_mtx);
+
+	mutex_unlock(&dev_pm_qos_sysfs_mtx);
 }
 }
 
 
 /**
 /**
@@ -558,6 +566,14 @@ static void __dev_pm_qos_drop_user_request(struct device *dev,
 	kfree(req);
 	kfree(req);
 }
 }
 
 
+static void dev_pm_qos_drop_user_request(struct device *dev,
+					 enum dev_pm_qos_req_type type)
+{
+	mutex_lock(&dev_pm_qos_mtx);
+	__dev_pm_qos_drop_user_request(dev, type);
+	mutex_unlock(&dev_pm_qos_mtx);
+}
+
 /**
 /**
  * dev_pm_qos_expose_latency_limit - Expose PM QoS latency limit to user space.
  * dev_pm_qos_expose_latency_limit - Expose PM QoS latency limit to user space.
  * @dev: Device whose PM QoS latency limit is to be exposed to user space.
  * @dev: Device whose PM QoS latency limit is to be exposed to user space.
@@ -581,6 +597,8 @@ int dev_pm_qos_expose_latency_limit(struct device *dev, s32 value)
 		return ret;
 		return ret;
 	}
 	}
 
 
+	mutex_lock(&dev_pm_qos_sysfs_mtx);
+
 	mutex_lock(&dev_pm_qos_mtx);
 	mutex_lock(&dev_pm_qos_mtx);
 
 
 	if (IS_ERR_OR_NULL(dev->power.qos))
 	if (IS_ERR_OR_NULL(dev->power.qos))
@@ -591,26 +609,27 @@ int dev_pm_qos_expose_latency_limit(struct device *dev, s32 value)
 	if (ret < 0) {
 	if (ret < 0) {
 		__dev_pm_qos_remove_request(req);
 		__dev_pm_qos_remove_request(req);
 		kfree(req);
 		kfree(req);
+		mutex_unlock(&dev_pm_qos_mtx);
 		goto out;
 		goto out;
 	}
 	}
-
 	dev->power.qos->latency_req = req;
 	dev->power.qos->latency_req = req;
+
+	mutex_unlock(&dev_pm_qos_mtx);
+
 	ret = pm_qos_sysfs_add_latency(dev);
 	ret = pm_qos_sysfs_add_latency(dev);
 	if (ret)
 	if (ret)
-		__dev_pm_qos_drop_user_request(dev, DEV_PM_QOS_LATENCY);
+		dev_pm_qos_drop_user_request(dev, DEV_PM_QOS_LATENCY);
 
 
  out:
  out:
-	mutex_unlock(&dev_pm_qos_mtx);
+	mutex_unlock(&dev_pm_qos_sysfs_mtx);
 	return ret;
 	return ret;
 }
 }
 EXPORT_SYMBOL_GPL(dev_pm_qos_expose_latency_limit);
 EXPORT_SYMBOL_GPL(dev_pm_qos_expose_latency_limit);
 
 
 static void __dev_pm_qos_hide_latency_limit(struct device *dev)
 static void __dev_pm_qos_hide_latency_limit(struct device *dev)
 {
 {
-	if (!IS_ERR_OR_NULL(dev->power.qos) && dev->power.qos->latency_req) {
-		pm_qos_sysfs_remove_latency(dev);
+	if (!IS_ERR_OR_NULL(dev->power.qos) && dev->power.qos->latency_req)
 		__dev_pm_qos_drop_user_request(dev, DEV_PM_QOS_LATENCY);
 		__dev_pm_qos_drop_user_request(dev, DEV_PM_QOS_LATENCY);
-	}
 }
 }
 
 
 /**
 /**
@@ -619,9 +638,15 @@ static void __dev_pm_qos_hide_latency_limit(struct device *dev)
  */
  */
 void dev_pm_qos_hide_latency_limit(struct device *dev)
 void dev_pm_qos_hide_latency_limit(struct device *dev)
 {
 {
+	mutex_lock(&dev_pm_qos_sysfs_mtx);
+
+	pm_qos_sysfs_remove_latency(dev);
+
 	mutex_lock(&dev_pm_qos_mtx);
 	mutex_lock(&dev_pm_qos_mtx);
 	__dev_pm_qos_hide_latency_limit(dev);
 	__dev_pm_qos_hide_latency_limit(dev);
 	mutex_unlock(&dev_pm_qos_mtx);
 	mutex_unlock(&dev_pm_qos_mtx);
+
+	mutex_unlock(&dev_pm_qos_sysfs_mtx);
 }
 }
 EXPORT_SYMBOL_GPL(dev_pm_qos_hide_latency_limit);
 EXPORT_SYMBOL_GPL(dev_pm_qos_hide_latency_limit);
 
 
@@ -649,6 +674,8 @@ int dev_pm_qos_expose_flags(struct device *dev, s32 val)
 	}
 	}
 
 
 	pm_runtime_get_sync(dev);
 	pm_runtime_get_sync(dev);
+	mutex_lock(&dev_pm_qos_sysfs_mtx);
+
 	mutex_lock(&dev_pm_qos_mtx);
 	mutex_lock(&dev_pm_qos_mtx);
 
 
 	if (IS_ERR_OR_NULL(dev->power.qos))
 	if (IS_ERR_OR_NULL(dev->power.qos))
@@ -659,16 +686,19 @@ int dev_pm_qos_expose_flags(struct device *dev, s32 val)
 	if (ret < 0) {
 	if (ret < 0) {
 		__dev_pm_qos_remove_request(req);
 		__dev_pm_qos_remove_request(req);
 		kfree(req);
 		kfree(req);
+		mutex_unlock(&dev_pm_qos_mtx);
 		goto out;
 		goto out;
 	}
 	}
-
 	dev->power.qos->flags_req = req;
 	dev->power.qos->flags_req = req;
+
+	mutex_unlock(&dev_pm_qos_mtx);
+
 	ret = pm_qos_sysfs_add_flags(dev);
 	ret = pm_qos_sysfs_add_flags(dev);
 	if (ret)
 	if (ret)
-		__dev_pm_qos_drop_user_request(dev, DEV_PM_QOS_FLAGS);
+		dev_pm_qos_drop_user_request(dev, DEV_PM_QOS_FLAGS);
 
 
  out:
  out:
-	mutex_unlock(&dev_pm_qos_mtx);
+	mutex_unlock(&dev_pm_qos_sysfs_mtx);
 	pm_runtime_put(dev);
 	pm_runtime_put(dev);
 	return ret;
 	return ret;
 }
 }
@@ -676,10 +706,8 @@ EXPORT_SYMBOL_GPL(dev_pm_qos_expose_flags);
 
 
 static void __dev_pm_qos_hide_flags(struct device *dev)
 static void __dev_pm_qos_hide_flags(struct device *dev)
 {
 {
-	if (!IS_ERR_OR_NULL(dev->power.qos) && dev->power.qos->flags_req) {
-		pm_qos_sysfs_remove_flags(dev);
+	if (!IS_ERR_OR_NULL(dev->power.qos) && dev->power.qos->flags_req)
 		__dev_pm_qos_drop_user_request(dev, DEV_PM_QOS_FLAGS);
 		__dev_pm_qos_drop_user_request(dev, DEV_PM_QOS_FLAGS);
-	}
 }
 }
 
 
 /**
 /**
@@ -689,9 +717,15 @@ static void __dev_pm_qos_hide_flags(struct device *dev)
 void dev_pm_qos_hide_flags(struct device *dev)
 void dev_pm_qos_hide_flags(struct device *dev)
 {
 {
 	pm_runtime_get_sync(dev);
 	pm_runtime_get_sync(dev);
+	mutex_lock(&dev_pm_qos_sysfs_mtx);
+
+	pm_qos_sysfs_remove_flags(dev);
+
 	mutex_lock(&dev_pm_qos_mtx);
 	mutex_lock(&dev_pm_qos_mtx);
 	__dev_pm_qos_hide_flags(dev);
 	__dev_pm_qos_hide_flags(dev);
 	mutex_unlock(&dev_pm_qos_mtx);
 	mutex_unlock(&dev_pm_qos_mtx);
+
+	mutex_unlock(&dev_pm_qos_sysfs_mtx);
 	pm_runtime_put(dev);
 	pm_runtime_put(dev);
 }
 }
 EXPORT_SYMBOL_GPL(dev_pm_qos_hide_flags);
 EXPORT_SYMBOL_GPL(dev_pm_qos_hide_flags);

+ 1 - 1
drivers/base/regmap/regcache-rbtree.c

@@ -398,7 +398,7 @@ static int regcache_rbtree_sync(struct regmap *map, unsigned int min,
 			base = 0;
 			base = 0;
 
 
 		if (max < rbnode->base_reg + rbnode->blklen)
 		if (max < rbnode->base_reg + rbnode->blklen)
-			end = rbnode->base_reg + rbnode->blklen - max;
+			end = max - rbnode->base_reg + 1;
 		else
 		else
 			end = rbnode->blklen;
 			end = rbnode->blklen;
 
 

+ 5 - 4
drivers/base/regmap/regmap.c

@@ -710,12 +710,12 @@ skip_format_initialization:
 		}
 		}
 	}
 	}
 
 
+	regmap_debugfs_init(map, config->name);
+
 	ret = regcache_init(map, config);
 	ret = regcache_init(map, config);
 	if (ret != 0)
 	if (ret != 0)
 		goto err_range;
 		goto err_range;
 
 
-	regmap_debugfs_init(map, config->name);
-
 	/* Add a devres resource for dev_get_regmap() */
 	/* Add a devres resource for dev_get_regmap() */
 	m = devres_alloc(dev_get_regmap_release, sizeof(*m), GFP_KERNEL);
 	m = devres_alloc(dev_get_regmap_release, sizeof(*m), GFP_KERNEL);
 	if (!m) {
 	if (!m) {
@@ -943,8 +943,7 @@ static int _regmap_raw_write(struct regmap *map, unsigned int reg,
 		unsigned int ival;
 		unsigned int ival;
 		int val_bytes = map->format.val_bytes;
 		int val_bytes = map->format.val_bytes;
 		for (i = 0; i < val_len / val_bytes; i++) {
 		for (i = 0; i < val_len / val_bytes; i++) {
-			memcpy(map->work_buf, val + (i * val_bytes), val_bytes);
-			ival = map->format.parse_val(map->work_buf);
+			ival = map->format.parse_val(val + (i * val_bytes));
 			ret = regcache_write(map, reg + (i * map->reg_stride),
 			ret = regcache_write(map, reg + (i * map->reg_stride),
 					     ival);
 					     ival);
 			if (ret) {
 			if (ret) {
@@ -1036,6 +1035,8 @@ static int _regmap_raw_write(struct regmap *map, unsigned int reg,
 			kfree(async->work_buf);
 			kfree(async->work_buf);
 			kfree(async);
 			kfree(async);
 		}
 		}
+
+		return ret;
 	}
 	}
 
 
 	trace_regmap_hw_write_start(map->dev, reg,
 	trace_regmap_hw_write_start(map->dev, reg,

+ 2 - 1
drivers/block/aoe/aoecmd.c

@@ -51,8 +51,9 @@ new_skb(ulong len)
 {
 {
 	struct sk_buff *skb;
 	struct sk_buff *skb;
 
 
-	skb = alloc_skb(len, GFP_ATOMIC);
+	skb = alloc_skb(len + MAX_HEADER, GFP_ATOMIC);
 	if (skb) {
 	if (skb) {
+		skb_reserve(skb, MAX_HEADER);
 		skb_reset_mac_header(skb);
 		skb_reset_mac_header(skb);
 		skb_reset_network_header(skb);
 		skb_reset_network_header(skb);
 		skb->protocol = __constant_htons(ETH_P_AOE);
 		skb->protocol = __constant_htons(ETH_P_AOE);

+ 8 - 1
drivers/block/loop.c

@@ -922,6 +922,11 @@ static int loop_set_fd(struct loop_device *lo, fmode_t mode,
 		lo->lo_flags |= LO_FLAGS_PARTSCAN;
 		lo->lo_flags |= LO_FLAGS_PARTSCAN;
 	if (lo->lo_flags & LO_FLAGS_PARTSCAN)
 	if (lo->lo_flags & LO_FLAGS_PARTSCAN)
 		ioctl_by_bdev(bdev, BLKRRPART, 0);
 		ioctl_by_bdev(bdev, BLKRRPART, 0);
+
+	/* Grab the block_device to prevent its destruction after we
+	 * put /dev/loopXX inode. Later in loop_clr_fd() we bdput(bdev).
+	 */
+	bdgrab(bdev);
 	return 0;
 	return 0;
 
 
 out_clr:
 out_clr:
@@ -1031,8 +1036,10 @@ static int loop_clr_fd(struct loop_device *lo)
 	memset(lo->lo_encrypt_key, 0, LO_KEY_SIZE);
 	memset(lo->lo_encrypt_key, 0, LO_KEY_SIZE);
 	memset(lo->lo_crypt_name, 0, LO_NAME_SIZE);
 	memset(lo->lo_crypt_name, 0, LO_NAME_SIZE);
 	memset(lo->lo_file_name, 0, LO_NAME_SIZE);
 	memset(lo->lo_file_name, 0, LO_NAME_SIZE);
-	if (bdev)
+	if (bdev) {
+		bdput(bdev);
 		invalidate_bdev(bdev);
 		invalidate_bdev(bdev);
+	}
 	set_capacity(lo->lo_disk, 0);
 	set_capacity(lo->lo_disk, 0);
 	loop_sysfs_exit(lo);
 	loop_sysfs_exit(lo);
 	if (bdev) {
 	if (bdev) {

+ 9 - 0
drivers/char/hw_random/core.c

@@ -380,6 +380,15 @@ void hwrng_unregister(struct hwrng *rng)
 }
 }
 EXPORT_SYMBOL_GPL(hwrng_unregister);
 EXPORT_SYMBOL_GPL(hwrng_unregister);
 
 
+static void __exit hwrng_exit(void)
+{
+	mutex_lock(&rng_mutex);
+	BUG_ON(current_rng);
+	kfree(rng_buffer);
+	mutex_unlock(&rng_mutex);
+}
+
+module_exit(hwrng_exit);
 
 
 MODULE_DESCRIPTION("H/W Random Number Generator (RNG) driver");
 MODULE_DESCRIPTION("H/W Random Number Generator (RNG) driver");
 MODULE_LICENSE("GPL");
 MODULE_LICENSE("GPL");

+ 30 - 14
drivers/char/virtio_console.c

@@ -149,7 +149,8 @@ struct ports_device {
 	spinlock_t ports_lock;
 	spinlock_t ports_lock;
 
 
 	/* To protect the vq operations for the control channel */
 	/* To protect the vq operations for the control channel */
-	spinlock_t cvq_lock;
+	spinlock_t c_ivq_lock;
+	spinlock_t c_ovq_lock;
 
 
 	/* The current config space is stored here */
 	/* The current config space is stored here */
 	struct virtio_console_config config;
 	struct virtio_console_config config;
@@ -569,11 +570,14 @@ static ssize_t __send_control_msg(struct ports_device *portdev, u32 port_id,
 	vq = portdev->c_ovq;
 	vq = portdev->c_ovq;
 
 
 	sg_init_one(sg, &cpkt, sizeof(cpkt));
 	sg_init_one(sg, &cpkt, sizeof(cpkt));
+
+	spin_lock(&portdev->c_ovq_lock);
 	if (virtqueue_add_buf(vq, sg, 1, 0, &cpkt, GFP_ATOMIC) == 0) {
 	if (virtqueue_add_buf(vq, sg, 1, 0, &cpkt, GFP_ATOMIC) == 0) {
 		virtqueue_kick(vq);
 		virtqueue_kick(vq);
 		while (!virtqueue_get_buf(vq, &len))
 		while (!virtqueue_get_buf(vq, &len))
 			cpu_relax();
 			cpu_relax();
 	}
 	}
+	spin_unlock(&portdev->c_ovq_lock);
 	return 0;
 	return 0;
 }
 }
 
 
@@ -1436,7 +1440,7 @@ static int add_port(struct ports_device *portdev, u32 id)
 		 * rproc_serial does not want the console port, only
 		 * rproc_serial does not want the console port, only
 		 * the generic port implementation.
 		 * the generic port implementation.
 		 */
 		 */
-		port->host_connected = port->guest_connected = true;
+		port->host_connected = true;
 	else if (!use_multiport(port->portdev)) {
 	else if (!use_multiport(port->portdev)) {
 		/*
 		/*
 		 * If we're not using multiport support,
 		 * If we're not using multiport support,
@@ -1709,23 +1713,23 @@ static void control_work_handler(struct work_struct *work)
 	portdev = container_of(work, struct ports_device, control_work);
 	portdev = container_of(work, struct ports_device, control_work);
 	vq = portdev->c_ivq;
 	vq = portdev->c_ivq;
 
 
-	spin_lock(&portdev->cvq_lock);
+	spin_lock(&portdev->c_ivq_lock);
 	while ((buf = virtqueue_get_buf(vq, &len))) {
 	while ((buf = virtqueue_get_buf(vq, &len))) {
-		spin_unlock(&portdev->cvq_lock);
+		spin_unlock(&portdev->c_ivq_lock);
 
 
 		buf->len = len;
 		buf->len = len;
 		buf->offset = 0;
 		buf->offset = 0;
 
 
 		handle_control_message(portdev, buf);
 		handle_control_message(portdev, buf);
 
 
-		spin_lock(&portdev->cvq_lock);
+		spin_lock(&portdev->c_ivq_lock);
 		if (add_inbuf(portdev->c_ivq, buf) < 0) {
 		if (add_inbuf(portdev->c_ivq, buf) < 0) {
 			dev_warn(&portdev->vdev->dev,
 			dev_warn(&portdev->vdev->dev,
 				 "Error adding buffer to queue\n");
 				 "Error adding buffer to queue\n");
 			free_buf(buf, false);
 			free_buf(buf, false);
 		}
 		}
 	}
 	}
-	spin_unlock(&portdev->cvq_lock);
+	spin_unlock(&portdev->c_ivq_lock);
 }
 }
 
 
 static void out_intr(struct virtqueue *vq)
 static void out_intr(struct virtqueue *vq)
@@ -1752,13 +1756,23 @@ static void in_intr(struct virtqueue *vq)
 	port->inbuf = get_inbuf(port);
 	port->inbuf = get_inbuf(port);
 
 
 	/*
 	/*
-	 * Don't queue up data when port is closed.  This condition
+	 * Normally the port should not accept data when the port is
+	 * closed. For generic serial ports, the host won't (shouldn't)
+	 * send data till the guest is connected. But this condition
 	 * can be reached when a console port is not yet connected (no
 	 * can be reached when a console port is not yet connected (no
-	 * tty is spawned) and the host sends out data to console
-	 * ports.  For generic serial ports, the host won't
-	 * (shouldn't) send data till the guest is connected.
+	 * tty is spawned) and the other side sends out data over the
+	 * vring, or when a remote devices start sending data before
+	 * the ports are opened.
+	 *
+	 * A generic serial port will discard data if not connected,
+	 * while console ports and rproc-serial ports accepts data at
+	 * any time. rproc-serial is initiated with guest_connected to
+	 * false because port_fops_open expects this. Console ports are
+	 * hooked up with an HVC console and is initialized with
+	 * guest_connected to true.
 	 */
 	 */
-	if (!port->guest_connected)
+
+	if (!port->guest_connected && !is_rproc_serial(port->portdev->vdev))
 		discard_port_data(port);
 		discard_port_data(port);
 
 
 	spin_unlock_irqrestore(&port->inbuf_lock, flags);
 	spin_unlock_irqrestore(&port->inbuf_lock, flags);
@@ -1986,10 +2000,12 @@ static int virtcons_probe(struct virtio_device *vdev)
 	if (multiport) {
 	if (multiport) {
 		unsigned int nr_added_bufs;
 		unsigned int nr_added_bufs;
 
 
-		spin_lock_init(&portdev->cvq_lock);
+		spin_lock_init(&portdev->c_ivq_lock);
+		spin_lock_init(&portdev->c_ovq_lock);
 		INIT_WORK(&portdev->control_work, &control_work_handler);
 		INIT_WORK(&portdev->control_work, &control_work_handler);
 
 
-		nr_added_bufs = fill_queue(portdev->c_ivq, &portdev->cvq_lock);
+		nr_added_bufs = fill_queue(portdev->c_ivq,
+					   &portdev->c_ivq_lock);
 		if (!nr_added_bufs) {
 		if (!nr_added_bufs) {
 			dev_err(&vdev->dev,
 			dev_err(&vdev->dev,
 				"Error allocating buffers for control queue\n");
 				"Error allocating buffers for control queue\n");
@@ -2140,7 +2156,7 @@ static int virtcons_restore(struct virtio_device *vdev)
 		return ret;
 		return ret;
 
 
 	if (use_multiport(portdev))
 	if (use_multiport(portdev))
-		fill_queue(portdev->c_ivq, &portdev->cvq_lock);
+		fill_queue(portdev->c_ivq, &portdev->c_ivq_lock);
 
 
 	list_for_each_entry(port, &portdev->ports, list) {
 	list_for_each_entry(port, &portdev->ports, list) {
 		port->in_vq = portdev->in_vqs[port->id];
 		port->in_vq = portdev->in_vqs[port->id];

+ 1 - 1
drivers/clk/tegra/clk-tegra20.c

@@ -703,7 +703,7 @@ static void tegra20_pll_init(void)
 	clks[pll_a_out0] = clk;
 	clks[pll_a_out0] = clk;
 
 
 	/* PLLE */
 	/* PLLE */
-	clk = tegra_clk_register_plle("pll_e", "pll_ref", clk_base, NULL,
+	clk = tegra_clk_register_plle("pll_e", "pll_ref", clk_base, pmc_base,
 			     0, 100000000, &pll_e_params,
 			     0, 100000000, &pll_e_params,
 			     0, pll_e_freq_table, NULL);
 			     0, pll_e_freq_table, NULL);
 	clk_register_clkdev(clk, "pll_e", NULL);
 	clk_register_clkdev(clk, "pll_e", NULL);

+ 8 - 2
drivers/cpufreq/cpufreq-cpu0.c

@@ -178,10 +178,16 @@ static struct cpufreq_driver cpu0_cpufreq_driver = {
 
 
 static int cpu0_cpufreq_probe(struct platform_device *pdev)
 static int cpu0_cpufreq_probe(struct platform_device *pdev)
 {
 {
-	struct device_node *np;
+	struct device_node *np, *parent;
 	int ret;
 	int ret;
 
 
-	for_each_child_of_node(of_find_node_by_path("/cpus"), np) {
+	parent = of_find_node_by_path("/cpus");
+	if (!parent) {
+		pr_err("failed to find OF /cpus\n");
+		return -ENOENT;
+	}
+
+	for_each_child_of_node(parent, np) {
 		if (of_get_property(np, "operating-points", NULL))
 		if (of_get_property(np, "operating-points", NULL))
 			break;
 			break;
 	}
 	}

+ 3 - 3
drivers/cpufreq/cpufreq_governor.h

@@ -14,8 +14,8 @@
  * published by the Free Software Foundation.
  * published by the Free Software Foundation.
  */
  */
 
 
-#ifndef _CPUFREQ_GOVERNER_H
-#define _CPUFREQ_GOVERNER_H
+#ifndef _CPUFREQ_GOVERNOR_H
+#define _CPUFREQ_GOVERNOR_H
 
 
 #include <linux/cpufreq.h>
 #include <linux/cpufreq.h>
 #include <linux/kobject.h>
 #include <linux/kobject.h>
@@ -175,4 +175,4 @@ bool need_load_eval(struct cpu_dbs_common_info *cdbs,
 		unsigned int sampling_rate);
 		unsigned int sampling_rate);
 int cpufreq_governor_dbs(struct dbs_data *dbs_data,
 int cpufreq_governor_dbs(struct dbs_data *dbs_data,
 		struct cpufreq_policy *policy, unsigned int event);
 		struct cpufreq_policy *policy, unsigned int event);
-#endif /* _CPUFREQ_GOVERNER_H */
+#endif /* _CPUFREQ_GOVERNOR_H */

+ 1 - 0
drivers/dma/Kconfig

@@ -83,6 +83,7 @@ config INTEL_IOP_ADMA
 
 
 config DW_DMAC
 config DW_DMAC
 	tristate "Synopsys DesignWare AHB DMA support"
 	tristate "Synopsys DesignWare AHB DMA support"
+	depends on GENERIC_HARDIRQS
 	select DMA_ENGINE
 	select DMA_ENGINE
 	default y if CPU_AT32AP7000
 	default y if CPU_AT32AP7000
 	help
 	help

+ 46 - 21
drivers/eisa/pci_eisa.c

@@ -19,10 +19,10 @@
 /* There is only *one* pci_eisa device per machine, right ? */
 /* There is only *one* pci_eisa device per machine, right ? */
 static struct eisa_root_device pci_eisa_root;
 static struct eisa_root_device pci_eisa_root;
 
 
-static int __init pci_eisa_init(struct pci_dev *pdev,
-				const struct pci_device_id *ent)
+static int __init pci_eisa_init(struct pci_dev *pdev)
 {
 {
-	int rc;
+	int rc, i;
+	struct resource *res, *bus_res = NULL;
 
 
 	if ((rc = pci_enable_device (pdev))) {
 	if ((rc = pci_enable_device (pdev))) {
 		printk (KERN_ERR "pci_eisa : Could not enable device %s\n",
 		printk (KERN_ERR "pci_eisa : Could not enable device %s\n",
@@ -30,9 +30,30 @@ static int __init pci_eisa_init(struct pci_dev *pdev,
 		return rc;
 		return rc;
 	}
 	}
 
 
+	/*
+	 * The Intel 82375 PCI-EISA bridge is a subtractive-decode PCI
+	 * device, so the resources available on EISA are the same as those
+	 * available on the 82375 bus.  This works the same as a PCI-PCI
+	 * bridge in subtractive-decode mode (see pci_read_bridge_bases()).
+	 * We assume other PCI-EISA bridges are similar.
+	 *
+	 * eisa_root_register() can only deal with a single io port resource,
+	*  so we use the first valid io port resource.
+	 */
+	pci_bus_for_each_resource(pdev->bus, res, i)
+		if (res && (res->flags & IORESOURCE_IO)) {
+			bus_res = res;
+			break;
+		}
+
+	if (!bus_res) {
+		dev_err(&pdev->dev, "No resources available\n");
+		return -1;
+	}
+
 	pci_eisa_root.dev              = &pdev->dev;
 	pci_eisa_root.dev              = &pdev->dev;
-	pci_eisa_root.res	       = pdev->bus->resource[0];
-	pci_eisa_root.bus_base_addr    = pdev->bus->resource[0]->start;
+	pci_eisa_root.res	       = bus_res;
+	pci_eisa_root.bus_base_addr    = bus_res->start;
 	pci_eisa_root.slots	       = EISA_MAX_SLOTS;
 	pci_eisa_root.slots	       = EISA_MAX_SLOTS;
 	pci_eisa_root.dma_mask         = pdev->dma_mask;
 	pci_eisa_root.dma_mask         = pdev->dma_mask;
 	dev_set_drvdata(pci_eisa_root.dev, &pci_eisa_root);
 	dev_set_drvdata(pci_eisa_root.dev, &pci_eisa_root);
@@ -45,22 +66,26 @@ static int __init pci_eisa_init(struct pci_dev *pdev,
 	return 0;
 	return 0;
 }
 }
 
 
-static struct pci_device_id pci_eisa_pci_tbl[] = {
-	{ PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID,
-	  PCI_CLASS_BRIDGE_EISA << 8, 0xffff00, 0 },
-	{ 0, }
-};
+/*
+ * We have to call pci_eisa_init_early() before pnpacpi_init()/isapnp_init().
+ *   Otherwise pnp resource will get enabled early and could prevent eisa
+ *   to be initialized.
+ * Also need to make sure pci_eisa_init_early() is called after
+ * x86/pci_subsys_init().
+ * So need to use subsys_initcall_sync with it.
+ */
+static int __init pci_eisa_init_early(void)
+{
+	struct pci_dev *dev = NULL;
+	int ret;
 
 
-static struct pci_driver __refdata pci_eisa_driver = {
-	.name		= "pci_eisa",
-	.id_table	= pci_eisa_pci_tbl,
-	.probe		= pci_eisa_init,
-};
+	for_each_pci_dev(dev)
+		if ((dev->class >> 8) == PCI_CLASS_BRIDGE_EISA) {
+			ret = pci_eisa_init(dev);
+			if (ret)
+				return ret;
+		}
 
 
-static int __init pci_eisa_init_module (void)
-{
-	return pci_register_driver (&pci_eisa_driver);
+	return 0;
 }
 }
-
-device_initcall(pci_eisa_init_module);
-MODULE_DEVICE_TABLE(pci, pci_eisa_pci_tbl);
+subsys_initcall_sync(pci_eisa_init_early);

+ 1 - 1
drivers/gpio/gpio-ich.c

@@ -214,7 +214,7 @@ static int ichx_gpio_request(struct gpio_chip *chip, unsigned nr)
 	 * If it can't be trusted, assume that the pin can be used as a GPIO.
 	 * If it can't be trusted, assume that the pin can be used as a GPIO.
 	 */
 	 */
 	if (ichx_priv.desc->use_sel_ignore[nr / 32] & (1 << (nr & 0x1f)))
 	if (ichx_priv.desc->use_sel_ignore[nr / 32] & (1 << (nr & 0x1f)))
-		return 1;
+		return 0;
 
 
 	return ichx_read_bit(GPIO_USE_SEL, nr) ? 0 : -ENODEV;
 	return ichx_read_bit(GPIO_USE_SEL, nr) ? 0 : -ENODEV;
 }
 }

Some files were not shown because too many files changed in this diff