Browse Source

Merge branch '3.15-fixes' into mips-for-linux-next

Ralf Baechle 11 years ago
parent
commit
f8647b506d
100 changed files with 810 additions and 233 deletions
  1. 1 1
      Documentation/ABI/testing/sysfs-bus-pci
  2. 6 6
      Documentation/DocBook/drm.tmpl
  3. 1 1
      Documentation/DocBook/media/Makefile
  4. 8 5
      Documentation/debugging-via-ohci1394.txt
  5. 4 1
      Documentation/device-mapper/thin-provisioning.txt
  6. 1 1
      Documentation/devicetree/bindings/clock/renesas,cpg-mstp-clocks.txt
  7. 1 1
      Documentation/devicetree/bindings/net/mdio-gpio.txt
  8. 5 10
      Documentation/email-clients.txt
  9. 3 2
      Documentation/filesystems/proc.txt
  10. 14 0
      Documentation/hwmon/sysfs-interface
  11. 8 0
      Documentation/java.txt
  12. 1 1
      Documentation/networking/filter.txt
  13. 1 1
      Documentation/networking/packet_mmap.txt
  14. 1 1
      Documentation/virtual/kvm/api.txt
  15. 11 3
      MAINTAINERS
  16. 1 1
      Makefile
  17. 1 1
      arch/arm/boot/dts/armada-380.dtsi
  18. 2 2
      arch/arm/boot/dts/armada-385.dtsi
  19. 1 1
      arch/arm/boot/dts/at91sam9260.dtsi
  20. 1 1
      arch/arm/boot/dts/exynos4412-trats2.dts
  21. 1 0
      arch/arm/boot/dts/exynos5250-arndale.dts
  22. 0 12
      arch/arm/boot/dts/exynos5420-arndale-octa.dts
  23. 10 14
      arch/arm/boot/dts/exynos5420.dtsi
  24. 1 1
      arch/arm/boot/dts/imx53-mba53.dts
  25. 1 0
      arch/arm/boot/dts/ste-ccu8540.dts
  26. 7 3
      arch/arm/common/bL_switcher.c
  27. 1 0
      arch/arm/configs/exynos_defconfig
  28. 2 0
      arch/arm/include/asm/trusted_foundations.h
  29. 2 1
      arch/arm/include/asm/uaccess.h
  30. 4 0
      arch/arm/kernel/entry-header.S
  31. 1 1
      arch/arm/kernel/unwind.c
  32. 4 4
      arch/arm/mach-at91/at91sam9260_devices.c
  33. 14 1
      arch/arm/mach-exynos/firmware.c
  34. 1 1
      arch/arm/mach-imx/devices/platform-ipu-core.c
  35. 12 1
      arch/arm/mach-mvebu/mvebu-soc-id.c
  36. 1 1
      arch/arm/mach-omap2/board-flash.c
  37. 2 1
      arch/arm/mach-omap2/cclock3xxx_data.c
  38. 21 4
      arch/arm/mach-omap2/cpuidle44xx.c
  39. 1 1
      arch/arm/mach-omap2/omap_hwmod_54xx_data.c
  40. 5 3
      arch/arm/mm/proc-v7m.S
  41. 10 0
      arch/arm/plat-omap/dma.c
  42. 1 1
      arch/arm64/include/asm/pgtable.h
  43. 1 1
      arch/ia64/include/asm/unistd.h
  44. 1 0
      arch/ia64/include/uapi/asm/unistd.h
  45. 1 0
      arch/ia64/kernel/entry.S
  46. 1 1
      arch/m68k/include/asm/unistd.h
  47. 1 0
      arch/m68k/include/uapi/asm/unistd.h
  48. 1 0
      arch/m68k/kernel/syscalltable.S
  49. 2 2
      arch/mips/Makefile
  50. 2 2
      arch/mips/include/asm/cpu-info.h
  51. 1 1
      arch/mips/include/asm/msa.h
  52. 3 3
      arch/mips/include/uapi/asm/unistd.h
  53. 4 4
      arch/mips/kernel/branch.c
  54. 7 7
      arch/mips/kernel/ptrace.c
  55. 4 2
      arch/mips/kernel/traps.c
  56. 5 6
      arch/mips/loongson/common/cs5536/cs5536_mfgpt.c
  57. 2 0
      arch/mips/mm/c-octeon.c
  58. 2 2
      arch/mips/mm/page.c
  59. 1 1
      arch/mips/mti-malta/malta-memory.c
  60. 0 1
      arch/mips/pci/pci-rc32434.c
  61. 2 1
      arch/parisc/include/uapi/asm/unistd.h
  62. 1 0
      arch/parisc/kernel/syscall_table.S
  63. 3 1
      arch/powerpc/Makefile
  64. 6 1
      arch/powerpc/include/asm/ppc_asm.h
  65. 11 0
      arch/powerpc/include/asm/sections.h
  66. 1 0
      arch/powerpc/include/asm/systbl.h
  67. 1 1
      arch/powerpc/include/asm/unistd.h
  68. 1 0
      arch/powerpc/include/uapi/asm/unistd.h
  69. 1 1
      arch/powerpc/kernel/kvm.c
  70. 1 1
      arch/powerpc/kernel/machine_kexec_64.c
  71. 0 3
      arch/powerpc/kernel/time.c
  72. 3 3
      arch/powerpc/kvm/book3s.c
  73. 1 1
      arch/powerpc/kvm/book3s_hv_rm_mmu.c
  74. 104 0
      arch/powerpc/kvm/book3s_hv_rmhandlers.S
  75. 3 3
      arch/powerpc/kvm/book3s_pr.c
  76. 4 0
      arch/powerpc/mm/hash_utils_64.c
  77. 2 1
      arch/powerpc/platforms/powernv/eeh-ioda.c
  78. 3 0
      arch/s390/crypto/aes_s390.c
  79. 3 0
      arch/s390/crypto/des_s390.c
  80. 1 0
      arch/s390/kvm/kvm-s390.c
  81. 1 1
      arch/s390/net/bpf_jit_comp.c
  82. 4 2
      arch/sparc/include/asm/pgtable_64.h
  83. 1 1
      arch/sparc/kernel/sysfs.c
  84. 1 0
      arch/sparc/lib/NG2memcpy.S
  85. 1 15
      arch/sparc/mm/fault_64.c
  86. 13 1
      arch/sparc/mm/tsb.c
  87. 1 1
      arch/x86/include/asm/page_64_types.h
  88. 0 1
      arch/x86/kernel/cpu/perf_event_intel.c
  89. 5 2
      arch/x86/kvm/vmx.c
  90. 5 1
      arch/x86/kvm/x86.c
  91. 1 1
      arch/x86/net/bpf_jit_comp.c
  92. 1 1
      drivers/Makefile
  93. 17 0
      drivers/acpi/Kconfig
  94. 1 0
      drivers/acpi/Makefile
  95. 58 59
      drivers/acpi/ac.c
  96. 0 1
      drivers/acpi/acpi_platform.c
  97. 0 1
      drivers/acpi/acpi_processor.c
  98. 2 2
      drivers/acpi/acpica/acglobal.h
  99. 5 2
      drivers/acpi/acpica/tbutils.c
  100. 328 1
      drivers/acpi/battery.c

+ 1 - 1
Documentation/ABI/testing/sysfs-bus-pci

@@ -117,7 +117,7 @@ Description:
 
 
 What:		/sys/bus/pci/devices/.../vpd
 What:		/sys/bus/pci/devices/.../vpd
 Date:		February 2008
 Date:		February 2008
-Contact:	Ben Hutchings <bhutchings@solarflare.com>
+Contact:	Ben Hutchings <bwh@kernel.org>
 Description:
 Description:
 		A file named vpd in a device directory will be a
 		A file named vpd in a device directory will be a
 		binary file containing the Vital Product Data for the
 		binary file containing the Vital Product Data for the

+ 6 - 6
Documentation/DocBook/drm.tmpl

@@ -79,7 +79,7 @@
   <partintro>
   <partintro>
     <para>
     <para>
       This first part of the DRM Developer's Guide documents core DRM code,
       This first part of the DRM Developer's Guide documents core DRM code,
-      helper libraries for writting drivers and generic userspace interfaces
+      helper libraries for writing drivers and generic userspace interfaces
       exposed by DRM drivers.
       exposed by DRM drivers.
     </para>
     </para>
   </partintro>
   </partintro>
@@ -459,7 +459,7 @@ char *date;</synopsis>
       providing a solution to every graphics memory-related problems, GEM
       providing a solution to every graphics memory-related problems, GEM
       identified common code between drivers and created a support library to
       identified common code between drivers and created a support library to
       share it. GEM has simpler initialization and execution requirements than
       share it. GEM has simpler initialization and execution requirements than
-      TTM, but has no video RAM management capabitilies and is thus limited to
+      TTM, but has no video RAM management capabilities and is thus limited to
       UMA devices.
       UMA devices.
     </para>
     </para>
     <sect2>
     <sect2>
@@ -889,7 +889,7 @@ int (*prime_fd_to_handle)(struct drm_device *dev,
 	    vice versa. Drivers must use the kernel dma-buf buffer sharing framework
 	    vice versa. Drivers must use the kernel dma-buf buffer sharing framework
 	    to manage the PRIME file descriptors. Similar to the mode setting
 	    to manage the PRIME file descriptors. Similar to the mode setting
 	    API PRIME is agnostic to the underlying buffer object manager, as
 	    API PRIME is agnostic to the underlying buffer object manager, as
-	    long as handles are 32bit unsinged integers.
+	    long as handles are 32bit unsigned integers.
 	  </para>
 	  </para>
 	  <para>
 	  <para>
 	    While non-GEM drivers must implement the operations themselves, GEM
 	    While non-GEM drivers must implement the operations themselves, GEM
@@ -2356,7 +2356,7 @@ void intel_crt_init(struct drm_device *dev)
       first create properties and then create and associate individual instances
       first create properties and then create and associate individual instances
       of those properties to objects. A property can be instantiated multiple
       of those properties to objects. A property can be instantiated multiple
       times and associated with different objects. Values are stored in property
       times and associated with different objects. Values are stored in property
-      instances, and all other property information are stored in the propery
+      instances, and all other property information are stored in the property
       and shared between all instances of the property.
       and shared between all instances of the property.
     </para>
     </para>
     <para>
     <para>
@@ -2697,10 +2697,10 @@ int num_ioctls;</synopsis>
   <sect1>
   <sect1>
     <title>Legacy Support Code</title>
     <title>Legacy Support Code</title>
     <para>
     <para>
-      The section very brievely covers some of the old legacy support code which
+      The section very briefly covers some of the old legacy support code which
       is only used by old DRM drivers which have done a so-called shadow-attach
       is only used by old DRM drivers which have done a so-called shadow-attach
       to the underlying device instead of registering as a real driver. This
       to the underlying device instead of registering as a real driver. This
-      also includes some of the old generic buffer mangement and command
+      also includes some of the old generic buffer management and command
       submission code. Do not use any of this in new and modern drivers.
       submission code. Do not use any of this in new and modern drivers.
     </para>
     </para>
 
 

+ 1 - 1
Documentation/DocBook/media/Makefile

@@ -195,7 +195,7 @@ DVB_DOCUMENTED = \
 #
 #
 
 
 install_media_images = \
 install_media_images = \
-	$(Q)cp $(OBJIMGFILES) $(MEDIA_SRC_DIR)/v4l/*.svg $(MEDIA_OBJ_DIR)/media_api
+	$(Q)-cp $(OBJIMGFILES) $(MEDIA_SRC_DIR)/v4l/*.svg $(MEDIA_OBJ_DIR)/media_api
 
 
 $(MEDIA_OBJ_DIR)/%: $(MEDIA_SRC_DIR)/%.b64
 $(MEDIA_OBJ_DIR)/%: $(MEDIA_SRC_DIR)/%.b64
 	$(Q)base64 -d $< >$@
 	$(Q)base64 -d $< >$@

+ 8 - 5
Documentation/debugging-via-ohci1394.txt

@@ -25,9 +25,11 @@ using data transfer rates in the order of 10MB/s or more.
 With most FireWire controllers, memory access is limited to the low 4 GB
 With most FireWire controllers, memory access is limited to the low 4 GB
 of physical address space.  This can be a problem on IA64 machines where
 of physical address space.  This can be a problem on IA64 machines where
 memory is located mostly above that limit, but it is rarely a problem on
 memory is located mostly above that limit, but it is rarely a problem on
-more common hardware such as x86, x86-64 and PowerPC.  However, at least
-Agere/LSI FW643e and FW643e2 controllers are known to support access to
-physical addresses above 4 GB.
+more common hardware such as x86, x86-64 and PowerPC.
+
+At least LSI FW643e and FW643e2 controllers are known to support access to
+physical addresses above 4 GB, but this feature is currently not enabled by
+Linux.
 
 
 Together with a early initialization of the OHCI-1394 controller for debugging,
 Together with a early initialization of the OHCI-1394 controller for debugging,
 this facility proved most useful for examining long debugs logs in the printk
 this facility proved most useful for examining long debugs logs in the printk
@@ -101,8 +103,9 @@ Step-by-step instructions for using firescope with early OHCI initialization:
    compliant, they are based on TI PCILynx chips and require drivers for Win-
    compliant, they are based on TI PCILynx chips and require drivers for Win-
    dows operating systems.
    dows operating systems.
 
 
-   The mentioned kernel log message contains ">4 GB phys DMA" in case of
-   OHCI-1394 controllers which support accesses above this limit.
+   The mentioned kernel log message contains the string "physUB" if the
+   controller implements a writable Physical Upper Bound register.  This is
+   required for physical DMA above 4 GB (but not utilized by Linux yet).
 
 
 2) Establish a working FireWire cable connection:
 2) Establish a working FireWire cable connection:
 
 

+ 4 - 1
Documentation/device-mapper/thin-provisioning.txt

@@ -309,7 +309,10 @@ ii) Status
     error_if_no_space|queue_if_no_space
     error_if_no_space|queue_if_no_space
 	If the pool runs out of data or metadata space, the pool will
 	If the pool runs out of data or metadata space, the pool will
 	either queue or error the IO destined to the data device.  The
 	either queue or error the IO destined to the data device.  The
-	default is to queue the IO until more space is added.
+	default is to queue the IO until more space is added or the
+	'no_space_timeout' expires.  The 'no_space_timeout' dm-thin-pool
+	module parameter can be used to change this timeout -- it
+	defaults to 60 seconds but may be disabled using a value of 0.
 
 
 iii) Messages
 iii) Messages
 
 

+ 1 - 1
Documentation/devicetree/bindings/clock/renesas,cpg-mstp-clocks.txt

@@ -43,7 +43,7 @@ Example
 		clock-output-names =
 		clock-output-names =
 			"tpu0", "mmcif1", "sdhi3", "sdhi2",
 			"tpu0", "mmcif1", "sdhi3", "sdhi2",
 			 "sdhi1", "sdhi0", "mmcif0";
 			 "sdhi1", "sdhi0", "mmcif0";
-		renesas,clock-indices = <
+		clock-indices = <
 			R8A7790_CLK_TPU0 R8A7790_CLK_MMCIF1 R8A7790_CLK_SDHI3
 			R8A7790_CLK_TPU0 R8A7790_CLK_MMCIF1 R8A7790_CLK_SDHI3
 			R8A7790_CLK_SDHI2 R8A7790_CLK_SDHI1 R8A7790_CLK_SDHI0
 			R8A7790_CLK_SDHI2 R8A7790_CLK_SDHI1 R8A7790_CLK_SDHI0
 			R8A7790_CLK_MMCIF0
 			R8A7790_CLK_MMCIF0

+ 1 - 1
Documentation/devicetree/bindings/net/mdio-gpio.txt

@@ -14,7 +14,7 @@ node.
 Example:
 Example:
 
 
 aliases {
 aliases {
-	mdio-gpio0 = <&mdio0>;
+	mdio-gpio0 = &mdio0;
 };
 };
 
 
 mdio0: mdio {
 mdio0: mdio {

+ 5 - 10
Documentation/email-clients.txt

@@ -201,20 +201,15 @@ To beat some sense out of the internal editor, do this:
 
 
 - Edit your Thunderbird config settings so that it won't use format=flowed.
 - Edit your Thunderbird config settings so that it won't use format=flowed.
   Go to "edit->preferences->advanced->config editor" to bring up the
   Go to "edit->preferences->advanced->config editor" to bring up the
-  thunderbird's registry editor, and set "mailnews.send_plaintext_flowed" to
-  "false".
+  thunderbird's registry editor.
 
 
-- Disable HTML Format: Set "mail.identity.id1.compose_html" to "false".
+- Set "mailnews.send_plaintext_flowed" to "false"
 
 
-- Enable "preformat" mode: Set "editor.quotesPreformatted" to "true".
+- Set "mailnews.wraplength" from "72" to "0"
 
 
-- Enable UTF8: Set "prefs.converted-to-utf8" to "true".
+- "View" > "Message Body As" > "Plain Text"
 
 
-- Install the "toggle wordwrap" extension.  Download the file from:
-    https://addons.mozilla.org/thunderbird/addon/2351/
-  Then go to "tools->add ons", select "install" at the bottom of the screen,
-  and browse to where you saved the .xul file.  This adds an "Enable
-  Wordwrap" entry under the Options menu of the message composer.
+- "View" > "Character Encoding" > "Unicode (UTF-8)"
 
 
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 TkRat (GUI)
 TkRat (GUI)

+ 3 - 2
Documentation/filesystems/proc.txt

@@ -1245,8 +1245,9 @@ second).  The meanings of the columns are as follows, from left to right:
 
 
 The "intr" line gives counts of interrupts  serviced since boot time, for each
 The "intr" line gives counts of interrupts  serviced since boot time, for each
 of the  possible system interrupts.   The first  column  is the  total of  all
 of the  possible system interrupts.   The first  column  is the  total of  all
-interrupts serviced; each  subsequent column is the  total for that particular
-interrupt.
+interrupts serviced  including  unnumbered  architecture specific  interrupts;
+each  subsequent column is the  total for that particular numbered interrupt.
+Unnumbered interrupts are not shown, only summed into the total.
 
 
 The "ctxt" line gives the total number of context switches across all CPUs.
 The "ctxt" line gives the total number of context switches across all CPUs.
 
 

+ 14 - 0
Documentation/hwmon/sysfs-interface

@@ -327,6 +327,13 @@ temp[1-*]_max_hyst
 		from the max value.
 		from the max value.
 		RW
 		RW
 
 
+temp[1-*]_min_hyst
+		Temperature hysteresis value for min limit.
+		Unit: millidegree Celsius
+		Must be reported as an absolute temperature, NOT a delta
+		from the min value.
+		RW
+
 temp[1-*]_input Temperature input value.
 temp[1-*]_input Temperature input value.
 		Unit: millidegree Celsius
 		Unit: millidegree Celsius
 		RO
 		RO
@@ -362,6 +369,13 @@ temp[1-*]_lcrit	Temperature critical min value, typically lower than
 		Unit: millidegree Celsius
 		Unit: millidegree Celsius
 		RW
 		RW
 
 
+temp[1-*]_lcrit_hyst
+		Temperature hysteresis value for critical min limit.
+		Unit: millidegree Celsius
+		Must be reported as an absolute temperature, NOT a delta
+		from the critical min value.
+		RW
+
 temp[1-*]_offset
 temp[1-*]_offset
 		Temperature offset which is added to the temperature reading
 		Temperature offset which is added to the temperature reading
 		by the chip.
 		by the chip.

+ 8 - 0
Documentation/java.txt

@@ -188,6 +188,9 @@ shift
 #define CP_METHODREF 10
 #define CP_METHODREF 10
 #define CP_INTERFACEMETHODREF 11
 #define CP_INTERFACEMETHODREF 11
 #define CP_NAMEANDTYPE 12
 #define CP_NAMEANDTYPE 12
+#define CP_METHODHANDLE 15
+#define CP_METHODTYPE 16
+#define CP_INVOKEDYNAMIC 18
 
 
 /* Define some commonly used error messages */
 /* Define some commonly used error messages */
 
 
@@ -242,14 +245,19 @@ void skip_constant(FILE *classfile, u_int16_t *cur)
 		break;
 		break;
 	case CP_CLASS:
 	case CP_CLASS:
 	case CP_STRING:
 	case CP_STRING:
+	case CP_METHODTYPE:
 		seekerr = fseek(classfile, 2, SEEK_CUR);
 		seekerr = fseek(classfile, 2, SEEK_CUR);
 		break;
 		break;
+	case CP_METHODHANDLE:
+		seekerr = fseek(classfile, 3, SEEK_CUR);
+		break;
 	case CP_INTEGER:
 	case CP_INTEGER:
 	case CP_FLOAT:
 	case CP_FLOAT:
 	case CP_FIELDREF:
 	case CP_FIELDREF:
 	case CP_METHODREF:
 	case CP_METHODREF:
 	case CP_INTERFACEMETHODREF:
 	case CP_INTERFACEMETHODREF:
 	case CP_NAMEANDTYPE:
 	case CP_NAMEANDTYPE:
+	case CP_INVOKEDYNAMIC:
 		seekerr = fseek(classfile, 4, SEEK_CUR);
 		seekerr = fseek(classfile, 4, SEEK_CUR);
 		break;
 		break;
 	case CP_LONG:
 	case CP_LONG:

+ 1 - 1
Documentation/networking/filter.txt

@@ -277,7 +277,7 @@ Possible BPF extensions are shown in the following table:
   mark                                  skb->mark
   mark                                  skb->mark
   queue                                 skb->queue_mapping
   queue                                 skb->queue_mapping
   hatype                                skb->dev->type
   hatype                                skb->dev->type
-  rxhash                                skb->rxhash
+  rxhash                                skb->hash
   cpu                                   raw_smp_processor_id()
   cpu                                   raw_smp_processor_id()
   vlan_tci                              vlan_tx_tag_get(skb)
   vlan_tci                              vlan_tx_tag_get(skb)
   vlan_pr                               vlan_tx_tag_present(skb)
   vlan_pr                               vlan_tx_tag_present(skb)

+ 1 - 1
Documentation/networking/packet_mmap.txt

@@ -578,7 +578,7 @@ processes. This also works in combination with mmap(2) on packet sockets.
 
 
 Currently implemented fanout policies are:
 Currently implemented fanout policies are:
 
 
-  - PACKET_FANOUT_HASH: schedule to socket by skb's rxhash
+  - PACKET_FANOUT_HASH: schedule to socket by skb's packet hash
   - PACKET_FANOUT_LB: schedule to socket by round-robin
   - PACKET_FANOUT_LB: schedule to socket by round-robin
   - PACKET_FANOUT_CPU: schedule to socket by CPU packet arrives on
   - PACKET_FANOUT_CPU: schedule to socket by CPU packet arrives on
   - PACKET_FANOUT_RND: schedule to socket by random selection
   - PACKET_FANOUT_RND: schedule to socket by random selection

+ 1 - 1
Documentation/virtual/kvm/api.txt

@@ -2126,7 +2126,7 @@ into the hash PTE second double word).
 4.75 KVM_IRQFD
 4.75 KVM_IRQFD
 
 
 Capability: KVM_CAP_IRQFD
 Capability: KVM_CAP_IRQFD
-Architectures: x86
+Architectures: x86 s390
 Type: vm ioctl
 Type: vm ioctl
 Parameters: struct kvm_irqfd (in)
 Parameters: struct kvm_irqfd (in)
 Returns: 0 on success, -1 on error
 Returns: 0 on success, -1 on error

+ 11 - 3
MAINTAINERS

@@ -537,7 +537,7 @@ L:	linux-alpha@vger.kernel.org
 F:	arch/alpha/
 F:	arch/alpha/
 
 
 ALTERA TRIPLE SPEED ETHERNET DRIVER
 ALTERA TRIPLE SPEED ETHERNET DRIVER
-M:	Vince Bridgers <vbridgers2013@gmail.com
+M:	Vince Bridgers <vbridgers2013@gmail.com>
 L:	netdev@vger.kernel.org
 L:	netdev@vger.kernel.org
 L:	nios2-dev@lists.rocketboards.org (moderated for non-subscribers)
 L:	nios2-dev@lists.rocketboards.org (moderated for non-subscribers)
 S:	Maintained
 S:	Maintained
@@ -6523,10 +6523,10 @@ T:	git git://openrisc.net/~jonas/linux
 F:	arch/openrisc/
 F:	arch/openrisc/
 
 
 OPENVSWITCH
 OPENVSWITCH
-M:	Jesse Gross <jesse@nicira.com>
+M:	Pravin Shelar <pshelar@nicira.com>
 L:	dev@openvswitch.org
 L:	dev@openvswitch.org
 W:	http://openvswitch.org
 W:	http://openvswitch.org
-T:	git git://git.kernel.org/pub/scm/linux/kernel/git/jesse/openvswitch.git
+T:	git git://git.kernel.org/pub/scm/linux/kernel/git/pshelar/openvswitch.git
 S:	Maintained
 S:	Maintained
 F:	net/openvswitch/
 F:	net/openvswitch/
 
 
@@ -7414,6 +7414,14 @@ F:	drivers/rpmsg/
 F:	Documentation/rpmsg.txt
 F:	Documentation/rpmsg.txt
 F:	include/linux/rpmsg.h
 F:	include/linux/rpmsg.h
 
 
+RESET CONTROLLER FRAMEWORK
+M:	Philipp Zabel <p.zabel@pengutronix.de>
+S:	Maintained
+F:	drivers/reset/
+F:	Documentation/devicetree/bindings/reset/
+F:	include/linux/reset.h
+F:	include/linux/reset-controller.h
+
 RFKILL
 RFKILL
 M:	Johannes Berg <johannes@sipsolutions.net>
 M:	Johannes Berg <johannes@sipsolutions.net>
 L:	linux-wireless@vger.kernel.org
 L:	linux-wireless@vger.kernel.org

+ 1 - 1
Makefile

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

+ 1 - 1
arch/arm/boot/dts/armada-380.dtsi

@@ -99,7 +99,7 @@
 			pcie@3,0 {
 			pcie@3,0 {
 				device_type = "pci";
 				device_type = "pci";
 				assigned-addresses = <0x82000800 0 0x44000 0 0x2000>;
 				assigned-addresses = <0x82000800 0 0x44000 0 0x2000>;
-				reg = <0x1000 0 0 0 0>;
+				reg = <0x1800 0 0 0 0>;
 				#address-cells = <3>;
 				#address-cells = <3>;
 				#size-cells = <2>;
 				#size-cells = <2>;
 				#interrupt-cells = <1>;
 				#interrupt-cells = <1>;

+ 2 - 2
arch/arm/boot/dts/armada-385.dtsi

@@ -110,7 +110,7 @@
 			pcie@3,0 {
 			pcie@3,0 {
 				device_type = "pci";
 				device_type = "pci";
 				assigned-addresses = <0x82000800 0 0x44000 0 0x2000>;
 				assigned-addresses = <0x82000800 0 0x44000 0 0x2000>;
-				reg = <0x1000 0 0 0 0>;
+				reg = <0x1800 0 0 0 0>;
 				#address-cells = <3>;
 				#address-cells = <3>;
 				#size-cells = <2>;
 				#size-cells = <2>;
 				#interrupt-cells = <1>;
 				#interrupt-cells = <1>;
@@ -131,7 +131,7 @@
 			pcie@4,0 {
 			pcie@4,0 {
 				device_type = "pci";
 				device_type = "pci";
 				assigned-addresses = <0x82000800 0 0x48000 0 0x2000>;
 				assigned-addresses = <0x82000800 0 0x48000 0 0x2000>;
-				reg = <0x1000 0 0 0 0>;
+				reg = <0x2000 0 0 0 0>;
 				#address-cells = <3>;
 				#address-cells = <3>;
 				#size-cells = <2>;
 				#size-cells = <2>;
 				#interrupt-cells = <1>;
 				#interrupt-cells = <1>;

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

@@ -641,7 +641,7 @@
 				trigger@3 {
 				trigger@3 {
 					reg = <3>;
 					reg = <3>;
 					trigger-name = "external";
 					trigger-name = "external";
-					trigger-value = <0x13>;
+					trigger-value = <0xd>;
 					trigger-external;
 					trigger-external;
 				};
 				};
 			};
 			};

+ 1 - 1
arch/arm/boot/dts/exynos4412-trats2.dts

@@ -503,7 +503,7 @@
 		status = "okay";
 		status = "okay";
 
 
 		ak8975@0c {
 		ak8975@0c {
-			compatible = "ak,ak8975";
+			compatible = "asahi-kasei,ak8975";
 			reg = <0x0c>;
 			reg = <0x0c>;
 			gpios = <&gpj0 7 0>;
 			gpios = <&gpj0 7 0>;
 		};
 		};

+ 1 - 0
arch/arm/boot/dts/exynos5250-arndale.dts

@@ -107,6 +107,7 @@
 					regulator-name = "VDD_IOPERI_1.8V";
 					regulator-name = "VDD_IOPERI_1.8V";
 					regulator-min-microvolt = <1800000>;
 					regulator-min-microvolt = <1800000>;
 					regulator-max-microvolt = <1800000>;
 					regulator-max-microvolt = <1800000>;
+					regulator-always-on;
 					op_mode = <1>;
 					op_mode = <1>;
 				};
 				};
 
 

+ 0 - 12
arch/arm/boot/dts/exynos5420-arndale-octa.dts

@@ -364,16 +364,4 @@
 			gpio-key,wakeup;
 			gpio-key,wakeup;
 		};
 		};
 	};
 	};
-
-	amba {
-		mdma1: mdma@11C10000 {
-			/*
-			 * MDMA1 can support both secure and non-secure
-			 * AXI transactions. When this is enabled in the kernel
-			 * for boards that run in secure mode, we are getting
-			 * imprecise external aborts causing the kernel to oops.
-			 */
-			status = "disabled";
-		};
-	};
 };
 };

+ 10 - 14
arch/arm/boot/dts/exynos5420.dtsi

@@ -219,16 +219,6 @@
 		reg = <0x100440C0 0x20>;
 		reg = <0x100440C0 0x20>;
 	};
 	};
 
 
-	mau_pd: power-domain@100440E0 {
-		compatible = "samsung,exynos4210-pd";
-		reg = <0x100440E0 0x20>;
-	};
-
-	g2d_pd: power-domain@10044100 {
-		compatible = "samsung,exynos4210-pd";
-		reg = <0x10044100 0x20>;
-	};
-
 	msc_pd: power-domain@10044120 {
 	msc_pd: power-domain@10044120 {
 		compatible = "samsung,exynos4210-pd";
 		compatible = "samsung,exynos4210-pd";
 		reg = <0x10044120 0x20>;
 		reg = <0x10044120 0x20>;
@@ -336,6 +326,13 @@
 			#dma-cells = <1>;
 			#dma-cells = <1>;
 			#dma-channels = <8>;
 			#dma-channels = <8>;
 			#dma-requests = <1>;
 			#dma-requests = <1>;
+			/*
+			 * MDMA1 can support both secure and non-secure
+			 * AXI transactions. When this is enabled in the kernel
+			 * for boards that run in secure mode, we are getting
+			 * imprecise external aborts causing the kernel to oops.
+			 */
+			status = "disabled";
 		};
 		};
 	};
 	};
 
 
@@ -385,7 +382,7 @@
 	spi_0: spi@12d20000 {
 	spi_0: spi@12d20000 {
 		compatible = "samsung,exynos4210-spi";
 		compatible = "samsung,exynos4210-spi";
 		reg = <0x12d20000 0x100>;
 		reg = <0x12d20000 0x100>;
-		interrupts = <0 66 0>;
+		interrupts = <0 68 0>;
 		dmas = <&pdma0 5
 		dmas = <&pdma0 5
 			&pdma0 4>;
 			&pdma0 4>;
 		dma-names = "tx", "rx";
 		dma-names = "tx", "rx";
@@ -401,7 +398,7 @@
 	spi_1: spi@12d30000 {
 	spi_1: spi@12d30000 {
 		compatible = "samsung,exynos4210-spi";
 		compatible = "samsung,exynos4210-spi";
 		reg = <0x12d30000 0x100>;
 		reg = <0x12d30000 0x100>;
-		interrupts = <0 67 0>;
+		interrupts = <0 69 0>;
 		dmas = <&pdma1 5
 		dmas = <&pdma1 5
 			&pdma1 4>;
 			&pdma1 4>;
 		dma-names = "tx", "rx";
 		dma-names = "tx", "rx";
@@ -417,7 +414,7 @@
 	spi_2: spi@12d40000 {
 	spi_2: spi@12d40000 {
 		compatible = "samsung,exynos4210-spi";
 		compatible = "samsung,exynos4210-spi";
 		reg = <0x12d40000 0x100>;
 		reg = <0x12d40000 0x100>;
-		interrupts = <0 68 0>;
+		interrupts = <0 70 0>;
 		dmas = <&pdma0 7
 		dmas = <&pdma0 7
 			&pdma0 6>;
 			&pdma0 6>;
 		dma-names = "tx", "rx";
 		dma-names = "tx", "rx";
@@ -730,6 +727,5 @@
 		interrupts = <0 112 0>;
 		interrupts = <0 112 0>;
 		clocks = <&clock 471>;
 		clocks = <&clock 471>;
 		clock-names = "secss";
 		clock-names = "secss";
-		samsung,power-domain = <&g2d_pd>;
 	};
 	};
 };
 };

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

@@ -244,7 +244,7 @@
 &tve {
 &tve {
 	pinctrl-names = "default";
 	pinctrl-names = "default";
 	pinctrl-0 = <&pinctrl_vga_sync_1>;
 	pinctrl-0 = <&pinctrl_vga_sync_1>;
-	i2c-ddc-bus = <&i2c3>;
+	ddc-i2c-bus = <&i2c3>;
 	fsl,tve-mode = "vga";
 	fsl,tve-mode = "vga";
 	fsl,hsync-pin = <4>;
 	fsl,hsync-pin = <4>;
 	fsl,vsync-pin = <6>;
 	fsl,vsync-pin = <6>;

+ 1 - 0
arch/arm/boot/dts/ste-ccu8540.dts

@@ -18,6 +18,7 @@
 	compatible = "st-ericsson,ccu8540", "st-ericsson,u8540";
 	compatible = "st-ericsson,ccu8540", "st-ericsson,u8540";
 
 
 	memory@0 {
 	memory@0 {
+		device_type = "memory";
 		reg = <0x20000000 0x1f000000>, <0xc0000000 0x3f000000>;
 		reg = <0x20000000 0x1f000000>, <0xc0000000 0x3f000000>;
 	};
 	};
 
 

+ 7 - 3
arch/arm/common/bL_switcher.c

@@ -433,8 +433,12 @@ static void bL_switcher_restore_cpus(void)
 {
 {
 	int i;
 	int i;
 
 
-	for_each_cpu(i, &bL_switcher_removed_logical_cpus)
-		cpu_up(i);
+	for_each_cpu(i, &bL_switcher_removed_logical_cpus) {
+		struct device *cpu_dev = get_cpu_device(i);
+		int ret = device_online(cpu_dev);
+		if (ret)
+			dev_err(cpu_dev, "switcher: unable to restore CPU\n");
+	}
 }
 }
 
 
 static int bL_switcher_halve_cpus(void)
 static int bL_switcher_halve_cpus(void)
@@ -521,7 +525,7 @@ static int bL_switcher_halve_cpus(void)
 			continue;
 			continue;
 		}
 		}
 
 
-		ret = cpu_down(i);
+		ret = device_offline(get_cpu_device(i));
 		if (ret) {
 		if (ret) {
 			bL_switcher_restore_cpus();
 			bL_switcher_restore_cpus();
 			return ret;
 			return ret;

+ 1 - 0
arch/arm/configs/exynos_defconfig

@@ -65,6 +65,7 @@ CONFIG_TCG_TIS_I2C_INFINEON=y
 CONFIG_I2C=y
 CONFIG_I2C=y
 CONFIG_I2C_MUX=y
 CONFIG_I2C_MUX=y
 CONFIG_I2C_ARB_GPIO_CHALLENGE=y
 CONFIG_I2C_ARB_GPIO_CHALLENGE=y
+CONFIG_I2C_EXYNOS5=y
 CONFIG_I2C_S3C2410=y
 CONFIG_I2C_S3C2410=y
 CONFIG_DEBUG_GPIO=y
 CONFIG_DEBUG_GPIO=y
 # CONFIG_HWMON is not set
 # CONFIG_HWMON is not set

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

@@ -54,7 +54,9 @@ static inline void register_trusted_foundations(
 	 */
 	 */
 	pr_err("No support for Trusted Foundations, continuing in degraded mode.\n");
 	pr_err("No support for Trusted Foundations, continuing in degraded mode.\n");
 	pr_err("Secondary processors as well as CPU PM will be disabled.\n");
 	pr_err("Secondary processors as well as CPU PM will be disabled.\n");
+#if IS_ENABLED(CONFIG_SMP)
 	setup_max_cpus = 0;
 	setup_max_cpus = 0;
+#endif
 	cpu_idle_poll_ctrl(true);
 	cpu_idle_poll_ctrl(true);
 }
 }
 
 

+ 2 - 1
arch/arm/include/asm/uaccess.h

@@ -171,8 +171,9 @@ extern int __put_user_8(void *, unsigned long long);
 #define __put_user_check(x,p)							\
 #define __put_user_check(x,p)							\
 	({								\
 	({								\
 		unsigned long __limit = current_thread_info()->addr_limit - 1; \
 		unsigned long __limit = current_thread_info()->addr_limit - 1; \
+		const typeof(*(p)) __user *__tmp_p = (p);		\
 		register const typeof(*(p)) __r2 asm("r2") = (x);	\
 		register const typeof(*(p)) __r2 asm("r2") = (x);	\
-		register const typeof(*(p)) __user *__p asm("r0") = (p);\
+		register const typeof(*(p)) __user *__p asm("r0") = __tmp_p; \
 		register unsigned long __l asm("r1") = __limit;		\
 		register unsigned long __l asm("r1") = __limit;		\
 		register int __e asm("r0");				\
 		register int __e asm("r0");				\
 		switch (sizeof(*(__p))) {				\
 		switch (sizeof(*(__p))) {				\

+ 4 - 0
arch/arm/kernel/entry-header.S

@@ -132,6 +132,10 @@
 	orrne	r5, V7M_xPSR_FRAMEPTRALIGN
 	orrne	r5, V7M_xPSR_FRAMEPTRALIGN
 	biceq	r5, V7M_xPSR_FRAMEPTRALIGN
 	biceq	r5, V7M_xPSR_FRAMEPTRALIGN
 
 
+	@ ensure bit 0 is cleared in the PC, otherwise behaviour is
+	@ unpredictable
+	bic	r4, #1
+
 	@ write basic exception frame
 	@ write basic exception frame
 	stmdb	r2!, {r1, r3-r5}
 	stmdb	r2!, {r1, r3-r5}
 	ldmia	sp, {r1, r3-r5}
 	ldmia	sp, {r1, r3-r5}

+ 1 - 1
arch/arm/kernel/unwind.c

@@ -285,7 +285,7 @@ static int unwind_exec_pop_r4_to_rN(struct unwind_ctrl_block *ctrl,
 		if (unwind_pop_register(ctrl, &vsp, reg))
 		if (unwind_pop_register(ctrl, &vsp, reg))
 				return -URC_FAILURE;
 				return -URC_FAILURE;
 
 
-	if (insn & 0x80)
+	if (insn & 0x8)
 		if (unwind_pop_register(ctrl, &vsp, 14))
 		if (unwind_pop_register(ctrl, &vsp, 14))
 				return -URC_FAILURE;
 				return -URC_FAILURE;
 
 

+ 4 - 4
arch/arm/mach-at91/at91sam9260_devices.c

@@ -1308,19 +1308,19 @@ static struct platform_device at91_adc_device = {
 static struct at91_adc_trigger at91_adc_triggers[] = {
 static struct at91_adc_trigger at91_adc_triggers[] = {
 	[0] = {
 	[0] = {
 		.name = "timer-counter-0",
 		.name = "timer-counter-0",
-		.value = AT91_ADC_TRGSEL_TC0 | AT91_ADC_TRGEN,
+		.value = 0x1,
 	},
 	},
 	[1] = {
 	[1] = {
 		.name = "timer-counter-1",
 		.name = "timer-counter-1",
-		.value = AT91_ADC_TRGSEL_TC1 | AT91_ADC_TRGEN,
+		.value = 0x3,
 	},
 	},
 	[2] = {
 	[2] = {
 		.name = "timer-counter-2",
 		.name = "timer-counter-2",
-		.value = AT91_ADC_TRGSEL_TC2 | AT91_ADC_TRGEN,
+		.value = 0x5,
 	},
 	},
 	[3] = {
 	[3] = {
 		.name = "external",
 		.name = "external",
-		.value = AT91_ADC_TRGSEL_EXTERNAL | AT91_ADC_TRGEN,
+		.value = 0xd,
 		.is_external = true,
 		.is_external = true,
 	},
 	},
 };
 };

+ 14 - 1
arch/arm/mach-exynos/firmware.c

@@ -18,6 +18,8 @@
 
 
 #include <mach/map.h>
 #include <mach/map.h>
 
 
+#include <plat/cpu.h>
+
 #include "smc.h"
 #include "smc.h"
 
 
 static int exynos_do_idle(void)
 static int exynos_do_idle(void)
@@ -28,13 +30,24 @@ static int exynos_do_idle(void)
 
 
 static int exynos_cpu_boot(int cpu)
 static int exynos_cpu_boot(int cpu)
 {
 {
+	/*
+	 * The second parameter of SMC_CMD_CPU1BOOT command means CPU id.
+	 * But, Exynos4212 has only one secondary CPU so second parameter
+	 * isn't used for informing secure firmware about CPU id.
+	 */
+	if (soc_is_exynos4212())
+		cpu = 0;
+
 	exynos_smc(SMC_CMD_CPU1BOOT, cpu, 0, 0);
 	exynos_smc(SMC_CMD_CPU1BOOT, cpu, 0, 0);
 	return 0;
 	return 0;
 }
 }
 
 
 static int exynos_set_cpu_boot_addr(int cpu, unsigned long boot_addr)
 static int exynos_set_cpu_boot_addr(int cpu, unsigned long boot_addr)
 {
 {
-	void __iomem *boot_reg = S5P_VA_SYSRAM_NS + 0x1c + 4*cpu;
+	void __iomem *boot_reg = S5P_VA_SYSRAM_NS + 0x1c;
+
+	if (!soc_is_exynos4212())
+		boot_reg += 4*cpu;
 
 
 	__raw_writel(boot_addr, boot_reg);
 	__raw_writel(boot_addr, boot_reg);
 	return 0;
 	return 0;

+ 1 - 1
arch/arm/mach-imx/devices/platform-ipu-core.c

@@ -77,7 +77,7 @@ struct platform_device *__init imx_alloc_mx3_camera(
 
 
 	pdev = platform_device_alloc("mx3-camera", 0);
 	pdev = platform_device_alloc("mx3-camera", 0);
 	if (!pdev)
 	if (!pdev)
-		goto err;
+		return ERR_PTR(-ENOMEM);
 
 
 	pdev->dev.dma_mask = kmalloc(sizeof(*pdev->dev.dma_mask), GFP_KERNEL);
 	pdev->dev.dma_mask = kmalloc(sizeof(*pdev->dev.dma_mask), GFP_KERNEL);
 	if (!pdev->dev.dma_mask)
 	if (!pdev->dev.dma_mask)

+ 12 - 1
arch/arm/mach-mvebu/mvebu-soc-id.c

@@ -108,7 +108,18 @@ static int __init mvebu_soc_id_init(void)
 	iounmap(pci_base);
 	iounmap(pci_base);
 
 
 res_ioremap:
 res_ioremap:
-	clk_disable_unprepare(clk);
+	/*
+	 * If the PCIe unit is actually enabled and we have PCI
+	 * support in the kernel, we intentionally do not release the
+	 * reference to the clock. We want to keep it running since
+	 * the bootloader does some PCIe link configuration that the
+	 * kernel is for now unable to do, and gating the clock would
+	 * make us loose this precious configuration.
+	 */
+	if (!of_device_is_available(child) || !IS_ENABLED(CONFIG_PCI_MVEBU)) {
+		clk_disable_unprepare(clk);
+		clk_put(clk);
+	}
 
 
 clk_err:
 clk_err:
 	of_node_put(child);
 	of_node_put(child);

+ 1 - 1
arch/arm/mach-omap2/board-flash.c

@@ -142,7 +142,7 @@ __init board_nand_init(struct mtd_partition *nand_parts, u8 nr_parts, u8 cs,
 	board_nand_data.nr_parts	= nr_parts;
 	board_nand_data.nr_parts	= nr_parts;
 	board_nand_data.devsize		= nand_type;
 	board_nand_data.devsize		= nand_type;
 
 
-	board_nand_data.ecc_opt = OMAP_ECC_BCH8_CODE_HW;
+	board_nand_data.ecc_opt = OMAP_ECC_HAM1_CODE_HW;
 	gpmc_nand_init(&board_nand_data, gpmc_t);
 	gpmc_nand_init(&board_nand_data, gpmc_t);
 }
 }
 #endif /* CONFIG_MTD_NAND_OMAP2 || CONFIG_MTD_NAND_OMAP2_MODULE */
 #endif /* CONFIG_MTD_NAND_OMAP2 || CONFIG_MTD_NAND_OMAP2_MODULE */

+ 2 - 1
arch/arm/mach-omap2/cclock3xxx_data.c

@@ -456,7 +456,8 @@ static struct clk_hw_omap dpll4_m5x2_ck_hw = {
 	.clkdm_name	= "dpll4_clkdm",
 	.clkdm_name	= "dpll4_clkdm",
 };
 };
 
 
-DEFINE_STRUCT_CLK(dpll4_m5x2_ck, dpll4_m5x2_ck_parent_names, dpll4_m5x2_ck_ops);
+DEFINE_STRUCT_CLK_FLAGS(dpll4_m5x2_ck, dpll4_m5x2_ck_parent_names,
+			dpll4_m5x2_ck_ops, CLK_SET_RATE_PARENT);
 
 
 static struct clk dpll4_m5x2_ck_3630 = {
 static struct clk dpll4_m5x2_ck_3630 = {
 	.name		= "dpll4_m5x2_ck",
 	.name		= "dpll4_m5x2_ck",

+ 21 - 4
arch/arm/mach-omap2/cpuidle44xx.c

@@ -14,6 +14,7 @@
 #include <linux/cpuidle.h>
 #include <linux/cpuidle.h>
 #include <linux/cpu_pm.h>
 #include <linux/cpu_pm.h>
 #include <linux/export.h>
 #include <linux/export.h>
+#include <linux/clockchips.h>
 
 
 #include <asm/cpuidle.h>
 #include <asm/cpuidle.h>
 #include <asm/proc-fns.h>
 #include <asm/proc-fns.h>
@@ -83,6 +84,7 @@ static int omap_enter_idle_coupled(struct cpuidle_device *dev,
 {
 {
 	struct idle_statedata *cx = state_ptr + index;
 	struct idle_statedata *cx = state_ptr + index;
 	u32 mpuss_can_lose_context = 0;
 	u32 mpuss_can_lose_context = 0;
+	int cpu_id = smp_processor_id();
 
 
 	/*
 	/*
 	 * CPU0 has to wait and stay ON until CPU1 is OFF state.
 	 * CPU0 has to wait and stay ON until CPU1 is OFF state.
@@ -110,6 +112,8 @@ static int omap_enter_idle_coupled(struct cpuidle_device *dev,
 	mpuss_can_lose_context = (cx->mpu_state == PWRDM_POWER_RET) &&
 	mpuss_can_lose_context = (cx->mpu_state == PWRDM_POWER_RET) &&
 				 (cx->mpu_logic_state == PWRDM_POWER_OFF);
 				 (cx->mpu_logic_state == PWRDM_POWER_OFF);
 
 
+	clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_ENTER, &cpu_id);
+
 	/*
 	/*
 	 * Call idle CPU PM enter notifier chain so that
 	 * Call idle CPU PM enter notifier chain so that
 	 * VFP and per CPU interrupt context is saved.
 	 * VFP and per CPU interrupt context is saved.
@@ -165,6 +169,8 @@ static int omap_enter_idle_coupled(struct cpuidle_device *dev,
 	if (dev->cpu == 0 && mpuss_can_lose_context)
 	if (dev->cpu == 0 && mpuss_can_lose_context)
 		cpu_cluster_pm_exit();
 		cpu_cluster_pm_exit();
 
 
+	clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_EXIT, &cpu_id);
+
 fail:
 fail:
 	cpuidle_coupled_parallel_barrier(dev, &abort_barrier);
 	cpuidle_coupled_parallel_barrier(dev, &abort_barrier);
 	cpu_done[dev->cpu] = false;
 	cpu_done[dev->cpu] = false;
@@ -172,6 +178,16 @@ fail:
 	return index;
 	return index;
 }
 }
 
 
+/*
+ * For each cpu, setup the broadcast timer because local timers
+ * stops for the states above C1.
+ */
+static void omap_setup_broadcast_timer(void *arg)
+{
+	int cpu = smp_processor_id();
+	clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_ON, &cpu);
+}
+
 static struct cpuidle_driver omap4_idle_driver = {
 static struct cpuidle_driver omap4_idle_driver = {
 	.name				= "omap4_idle",
 	.name				= "omap4_idle",
 	.owner				= THIS_MODULE,
 	.owner				= THIS_MODULE,
@@ -189,8 +205,7 @@ static struct cpuidle_driver omap4_idle_driver = {
 			/* C2 - CPU0 OFF + CPU1 OFF + MPU CSWR */
 			/* C2 - CPU0 OFF + CPU1 OFF + MPU CSWR */
 			.exit_latency = 328 + 440,
 			.exit_latency = 328 + 440,
 			.target_residency = 960,
 			.target_residency = 960,
-			.flags = CPUIDLE_FLAG_TIME_VALID | CPUIDLE_FLAG_COUPLED |
-			         CPUIDLE_FLAG_TIMER_STOP,
+			.flags = CPUIDLE_FLAG_TIME_VALID | CPUIDLE_FLAG_COUPLED,
 			.enter = omap_enter_idle_coupled,
 			.enter = omap_enter_idle_coupled,
 			.name = "C2",
 			.name = "C2",
 			.desc = "CPUx OFF, MPUSS CSWR",
 			.desc = "CPUx OFF, MPUSS CSWR",
@@ -199,8 +214,7 @@ static struct cpuidle_driver omap4_idle_driver = {
 			/* C3 - CPU0 OFF + CPU1 OFF + MPU OSWR */
 			/* C3 - CPU0 OFF + CPU1 OFF + MPU OSWR */
 			.exit_latency = 460 + 518,
 			.exit_latency = 460 + 518,
 			.target_residency = 1100,
 			.target_residency = 1100,
-			.flags = CPUIDLE_FLAG_TIME_VALID | CPUIDLE_FLAG_COUPLED |
-			         CPUIDLE_FLAG_TIMER_STOP,
+			.flags = CPUIDLE_FLAG_TIME_VALID | CPUIDLE_FLAG_COUPLED,
 			.enter = omap_enter_idle_coupled,
 			.enter = omap_enter_idle_coupled,
 			.name = "C3",
 			.name = "C3",
 			.desc = "CPUx OFF, MPUSS OSWR",
 			.desc = "CPUx OFF, MPUSS OSWR",
@@ -231,5 +245,8 @@ int __init omap4_idle_init(void)
 	if (!cpu_clkdm[0] || !cpu_clkdm[1])
 	if (!cpu_clkdm[0] || !cpu_clkdm[1])
 		return -ENODEV;
 		return -ENODEV;
 
 
+	/* Configure the broadcast timer on each cpu */
+	on_each_cpu(omap_setup_broadcast_timer, NULL, 1);
+
 	return cpuidle_register(&omap4_idle_driver, cpu_online_mask);
 	return cpuidle_register(&omap4_idle_driver, cpu_online_mask);
 }
 }

+ 1 - 1
arch/arm/mach-omap2/omap_hwmod_54xx_data.c

@@ -895,7 +895,7 @@ static struct omap_hwmod omap54xx_mcpdm_hwmod = {
 	 * current exception.
 	 * current exception.
 	 */
 	 */
 
 
-	.flags		= HWMOD_EXT_OPT_MAIN_CLK,
+	.flags		= HWMOD_EXT_OPT_MAIN_CLK | HWMOD_SWSUP_SIDLE,
 	.main_clk	= "pad_clks_ck",
 	.main_clk	= "pad_clks_ck",
 	.prcm = {
 	.prcm = {
 		.omap4 = {
 		.omap4 = {

+ 5 - 3
arch/arm/mm/proc-v7m.S

@@ -123,6 +123,11 @@ __v7m_setup:
 	mov	pc, lr
 	mov	pc, lr
 ENDPROC(__v7m_setup)
 ENDPROC(__v7m_setup)
 
 
+	.align 2
+__v7m_setup_stack:
+	.space	4 * 8				@ 8 registers
+__v7m_setup_stack_top:
+
 	define_processor_functions v7m, dabort=nommu_early_abort, pabort=legacy_pabort, nommu=1
 	define_processor_functions v7m, dabort=nommu_early_abort, pabort=legacy_pabort, nommu=1
 
 
 	.section ".rodata"
 	.section ".rodata"
@@ -152,6 +157,3 @@ __v7m_proc_info:
 	.long	nop_cache_fns		@ proc_info_list.cache
 	.long	nop_cache_fns		@ proc_info_list.cache
 	.size	__v7m_proc_info, . - __v7m_proc_info
 	.size	__v7m_proc_info, . - __v7m_proc_info
 
 
-__v7m_setup_stack:
-	.space	4 * 8				@ 8 registers
-__v7m_setup_stack_top:

+ 10 - 0
arch/arm/plat-omap/dma.c

@@ -70,6 +70,7 @@ static u32 errata;
 
 
 static struct omap_dma_global_context_registers {
 static struct omap_dma_global_context_registers {
 	u32 dma_irqenable_l0;
 	u32 dma_irqenable_l0;
+	u32 dma_irqenable_l1;
 	u32 dma_ocp_sysconfig;
 	u32 dma_ocp_sysconfig;
 	u32 dma_gcr;
 	u32 dma_gcr;
 } omap_dma_global_context;
 } omap_dma_global_context;
@@ -1973,10 +1974,17 @@ static struct irqaction omap24xx_dma_irq;
 
 
 /*----------------------------------------------------------------------------*/
 /*----------------------------------------------------------------------------*/
 
 
+/*
+ * Note that we are currently using only IRQENABLE_L0 and L1.
+ * As the DSP may be using IRQENABLE_L2 and L3, let's not
+ * touch those for now.
+ */
 void omap_dma_global_context_save(void)
 void omap_dma_global_context_save(void)
 {
 {
 	omap_dma_global_context.dma_irqenable_l0 =
 	omap_dma_global_context.dma_irqenable_l0 =
 		p->dma_read(IRQENABLE_L0, 0);
 		p->dma_read(IRQENABLE_L0, 0);
+	omap_dma_global_context.dma_irqenable_l1 =
+		p->dma_read(IRQENABLE_L1, 0);
 	omap_dma_global_context.dma_ocp_sysconfig =
 	omap_dma_global_context.dma_ocp_sysconfig =
 		p->dma_read(OCP_SYSCONFIG, 0);
 		p->dma_read(OCP_SYSCONFIG, 0);
 	omap_dma_global_context.dma_gcr = p->dma_read(GCR, 0);
 	omap_dma_global_context.dma_gcr = p->dma_read(GCR, 0);
@@ -1991,6 +1999,8 @@ void omap_dma_global_context_restore(void)
 		OCP_SYSCONFIG, 0);
 		OCP_SYSCONFIG, 0);
 	p->dma_write(omap_dma_global_context.dma_irqenable_l0,
 	p->dma_write(omap_dma_global_context.dma_irqenable_l0,
 		IRQENABLE_L0, 0);
 		IRQENABLE_L0, 0);
+	p->dma_write(omap_dma_global_context.dma_irqenable_l1,
+		IRQENABLE_L1, 0);
 
 
 	if (IS_DMA_ERRATA(DMA_ROMCODE_BUG))
 	if (IS_DMA_ERRATA(DMA_ROMCODE_BUG))
 		p->dma_write(0x3 , IRQSTATUS_L0, 0);
 		p->dma_write(0x3 , IRQSTATUS_L0, 0);

+ 1 - 1
arch/arm64/include/asm/pgtable.h

@@ -266,7 +266,7 @@ static inline pmd_t pte_pmd(pte_t pte)
 
 
 #define pmd_page(pmd)           pfn_to_page(__phys_to_pfn(pmd_val(pmd) & PHYS_MASK))
 #define pmd_page(pmd)           pfn_to_page(__phys_to_pfn(pmd_val(pmd) & PHYS_MASK))
 
 
-#define set_pmd_at(mm, addr, pmdp, pmd)	set_pmd(pmdp, pmd)
+#define set_pmd_at(mm, addr, pmdp, pmd)	set_pte_at(mm, addr, (pte_t *)pmdp, pmd_pte(pmd))
 
 
 static inline int has_transparent_hugepage(void)
 static inline int has_transparent_hugepage(void)
 {
 {

+ 1 - 1
arch/ia64/include/asm/unistd.h

@@ -11,7 +11,7 @@
 
 
 
 
 
 
-#define NR_syscalls			314 /* length of syscall table */
+#define NR_syscalls			315 /* length of syscall table */
 
 
 /*
 /*
  * The following defines stop scripts/checksyscalls.sh from complaining about
  * The following defines stop scripts/checksyscalls.sh from complaining about

+ 1 - 0
arch/ia64/include/uapi/asm/unistd.h

@@ -327,5 +327,6 @@
 #define __NR_finit_module		1335
 #define __NR_finit_module		1335
 #define __NR_sched_setattr		1336
 #define __NR_sched_setattr		1336
 #define __NR_sched_getattr		1337
 #define __NR_sched_getattr		1337
+#define __NR_renameat2			1338
 
 
 #endif /* _UAPI_ASM_IA64_UNISTD_H */
 #endif /* _UAPI_ASM_IA64_UNISTD_H */

+ 1 - 0
arch/ia64/kernel/entry.S

@@ -1775,6 +1775,7 @@ sys_call_table:
 	data8 sys_finit_module			// 1335
 	data8 sys_finit_module			// 1335
 	data8 sys_sched_setattr
 	data8 sys_sched_setattr
 	data8 sys_sched_getattr
 	data8 sys_sched_getattr
+	data8 sys_renameat2
 
 
 	.org sys_call_table + 8*NR_syscalls	// guard against failures to increase NR_syscalls
 	.org sys_call_table + 8*NR_syscalls	// guard against failures to increase NR_syscalls
 #endif /* __IA64_ASM_PARAVIRTUALIZED_NATIVE */
 #endif /* __IA64_ASM_PARAVIRTUALIZED_NATIVE */

+ 1 - 1
arch/m68k/include/asm/unistd.h

@@ -4,7 +4,7 @@
 #include <uapi/asm/unistd.h>
 #include <uapi/asm/unistd.h>
 
 
 
 
-#define NR_syscalls		351
+#define NR_syscalls		352
 
 
 #define __ARCH_WANT_OLD_READDIR
 #define __ARCH_WANT_OLD_READDIR
 #define __ARCH_WANT_OLD_STAT
 #define __ARCH_WANT_OLD_STAT

+ 1 - 0
arch/m68k/include/uapi/asm/unistd.h

@@ -356,5 +356,6 @@
 #define __NR_finit_module	348
 #define __NR_finit_module	348
 #define __NR_sched_setattr	349
 #define __NR_sched_setattr	349
 #define __NR_sched_getattr	350
 #define __NR_sched_getattr	350
+#define __NR_renameat2		351
 
 
 #endif /* _UAPI_ASM_M68K_UNISTD_H_ */
 #endif /* _UAPI_ASM_M68K_UNISTD_H_ */

+ 1 - 0
arch/m68k/kernel/syscalltable.S

@@ -371,4 +371,5 @@ ENTRY(sys_call_table)
 	.long sys_finit_module
 	.long sys_finit_module
 	.long sys_sched_setattr
 	.long sys_sched_setattr
 	.long sys_sched_getattr		/* 350 */
 	.long sys_sched_getattr		/* 350 */
+	.long sys_renameat2
 
 

+ 2 - 2
arch/mips/Makefile

@@ -120,7 +120,7 @@ cflags-$(CONFIG_SB1XXX_CORELIS)	+= $(call cc-option,-mno-sched-prolog) \
 				   -fno-omit-frame-pointer
 				   -fno-omit-frame-pointer
 
 
 ifeq ($(CONFIG_CPU_HAS_MSA),y)
 ifeq ($(CONFIG_CPU_HAS_MSA),y)
-toolchain-msa			:= $(call cc-option-yn,-mhard-float -mfp64 -mmsa)
+toolchain-msa	:= $(call cc-option-yn,-mhard-float -mfp64 -Wa$(comma)-mmsa)
 cflags-$(toolchain-msa)		+= -DTOOLCHAIN_SUPPORTS_MSA
 cflags-$(toolchain-msa)		+= -DTOOLCHAIN_SUPPORTS_MSA
 endif
 endif
 
 
@@ -151,7 +151,7 @@ cflags-$(CONFIG_CPU_NEVADA)	+= $(call cc-option,-march=rm5200,-march=r5000) \
 			-Wa,--trap
 			-Wa,--trap
 cflags-$(CONFIG_CPU_RM7000)	+= $(call cc-option,-march=rm7000,-march=r5000) \
 cflags-$(CONFIG_CPU_RM7000)	+= $(call cc-option,-march=rm7000,-march=r5000) \
 			-Wa,--trap
 			-Wa,--trap
-cflags-$(CONFIG_CPU_SB1)	+= $(call cc-option,-march=sb1,-march=r5000) \
+cflags-$(CONFIG_CPU_SB1)	+= $(call cc-option,-march=sb1 -mno-mdmx -mno-mips3d,-march=r5000) \
 			-Wa,--trap
 			-Wa,--trap
 cflags-$(CONFIG_CPU_R8000)	+= -march=r8000 -Wa,--trap
 cflags-$(CONFIG_CPU_R8000)	+= -march=r8000 -Wa,--trap
 cflags-$(CONFIG_CPU_R10000)	+= $(call cc-option,-march=r10000,-march=r8000) \
 cflags-$(CONFIG_CPU_R10000)	+= $(call cc-option,-march=r10000,-march=r8000) \

+ 2 - 2
arch/mips/include/asm/cpu-info.h

@@ -39,14 +39,14 @@ struct cache_desc {
 #define MIPS_CACHE_PINDEX	0x00000020	/* Physically indexed cache */
 #define MIPS_CACHE_PINDEX	0x00000020	/* Physically indexed cache */
 
 
 struct cpuinfo_mips {
 struct cpuinfo_mips {
-	unsigned int		udelay_val;
-	unsigned int		asid_cache;
+	unsigned long		asid_cache;
 
 
 	/*
 	/*
 	 * Capability and feature descriptor structure for MIPS CPU
 	 * Capability and feature descriptor structure for MIPS CPU
 	 */
 	 */
 	unsigned long		options;
 	unsigned long		options;
 	unsigned long		ases;
 	unsigned long		ases;
+	unsigned int		udelay_val;
 	unsigned int		processor_id;
 	unsigned int		processor_id;
 	unsigned int		fpu_id;
 	unsigned int		fpu_id;
 	unsigned int		msa_id;
 	unsigned int		msa_id;

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

@@ -84,7 +84,7 @@ static inline void write_msa_##name(unsigned int val)		\
 	__asm__ __volatile__(					\
 	__asm__ __volatile__(					\
 	"	.set	push\n"					\
 	"	.set	push\n"					\
 	"	.set	msa\n"					\
 	"	.set	msa\n"					\
-	"	cfcmsa	$" #cs ", %0\n"				\
+	"	ctcmsa	$" #cs ", %0\n"				\
 	"	.set	pop\n"					\
 	"	.set	pop\n"					\
 	: : "r"(val));						\
 	: : "r"(val));						\
 }
 }

+ 3 - 3
arch/mips/include/uapi/asm/unistd.h

@@ -381,7 +381,7 @@
 #endif /* _MIPS_SIM == _MIPS_SIM_ABI32 */
 #endif /* _MIPS_SIM == _MIPS_SIM_ABI32 */
 
 
 #define __NR_O32_Linux			4000
 #define __NR_O32_Linux			4000
-#define __NR_O32_Linux_syscalls		350
+#define __NR_O32_Linux_syscalls		351
 
 
 #if _MIPS_SIM == _MIPS_SIM_ABI64
 #if _MIPS_SIM == _MIPS_SIM_ABI64
 
 
@@ -710,7 +710,7 @@
 #endif /* _MIPS_SIM == _MIPS_SIM_ABI64 */
 #endif /* _MIPS_SIM == _MIPS_SIM_ABI64 */
 
 
 #define __NR_64_Linux			5000
 #define __NR_64_Linux			5000
-#define __NR_64_Linux_syscalls		310
+#define __NR_64_Linux_syscalls		311
 
 
 #if _MIPS_SIM == _MIPS_SIM_NABI32
 #if _MIPS_SIM == _MIPS_SIM_NABI32
 
 
@@ -1043,6 +1043,6 @@
 #endif /* _MIPS_SIM == _MIPS_SIM_NABI32 */
 #endif /* _MIPS_SIM == _MIPS_SIM_NABI32 */
 
 
 #define __NR_N32_Linux			6000
 #define __NR_N32_Linux			6000
-#define __NR_N32_Linux_syscalls		314
+#define __NR_N32_Linux_syscalls		315
 
 
 #endif /* _UAPI_ASM_UNISTD_H */
 #endif /* _UAPI_ASM_UNISTD_H */

+ 4 - 4
arch/mips/kernel/branch.c

@@ -513,7 +513,7 @@ int __compute_return_epc_for_insn(struct pt_regs *regs,
 		if (regs->regs[insn.i_format.rs] ==
 		if (regs->regs[insn.i_format.rs] ==
 		    regs->regs[insn.i_format.rt]) {
 		    regs->regs[insn.i_format.rt]) {
 			epc = epc + 4 + (insn.i_format.simmediate << 2);
 			epc = epc + 4 + (insn.i_format.simmediate << 2);
-			if (insn.i_format.rt == beql_op)
+			if (insn.i_format.opcode == beql_op)
 				ret = BRANCH_LIKELY_TAKEN;
 				ret = BRANCH_LIKELY_TAKEN;
 		} else
 		} else
 			epc += 8;
 			epc += 8;
@@ -525,7 +525,7 @@ int __compute_return_epc_for_insn(struct pt_regs *regs,
 		if (regs->regs[insn.i_format.rs] !=
 		if (regs->regs[insn.i_format.rs] !=
 		    regs->regs[insn.i_format.rt]) {
 		    regs->regs[insn.i_format.rt]) {
 			epc = epc + 4 + (insn.i_format.simmediate << 2);
 			epc = epc + 4 + (insn.i_format.simmediate << 2);
-			if (insn.i_format.rt == bnel_op)
+			if (insn.i_format.opcode == bnel_op)
 				ret = BRANCH_LIKELY_TAKEN;
 				ret = BRANCH_LIKELY_TAKEN;
 		} else
 		} else
 			epc += 8;
 			epc += 8;
@@ -537,7 +537,7 @@ int __compute_return_epc_for_insn(struct pt_regs *regs,
 		/* rt field assumed to be zero */
 		/* rt field assumed to be zero */
 		if ((long)regs->regs[insn.i_format.rs] <= 0) {
 		if ((long)regs->regs[insn.i_format.rs] <= 0) {
 			epc = epc + 4 + (insn.i_format.simmediate << 2);
 			epc = epc + 4 + (insn.i_format.simmediate << 2);
-			if (insn.i_format.rt == bnel_op)
+			if (insn.i_format.opcode == blezl_op)
 				ret = BRANCH_LIKELY_TAKEN;
 				ret = BRANCH_LIKELY_TAKEN;
 		} else
 		} else
 			epc += 8;
 			epc += 8;
@@ -549,7 +549,7 @@ int __compute_return_epc_for_insn(struct pt_regs *regs,
 		/* rt field assumed to be zero */
 		/* rt field assumed to be zero */
 		if ((long)regs->regs[insn.i_format.rs] > 0) {
 		if ((long)regs->regs[insn.i_format.rs] > 0) {
 			epc = epc + 4 + (insn.i_format.simmediate << 2);
 			epc = epc + 4 + (insn.i_format.simmediate << 2);
-			if (insn.i_format.rt == bnel_op)
+			if (insn.i_format.opcode == bgtzl_op)
 				ret = BRANCH_LIKELY_TAKEN;
 				ret = BRANCH_LIKELY_TAKEN;
 		} else
 		} else
 			epc += 8;
 			epc += 8;

+ 7 - 7
arch/mips/kernel/ptrace.c

@@ -163,7 +163,7 @@ int ptrace_get_watch_regs(struct task_struct *child,
 	enum pt_watch_style style;
 	enum pt_watch_style style;
 	int i;
 	int i;
 
 
-	if (!cpu_has_watch || current_cpu_data.watch_reg_use_cnt == 0)
+	if (!cpu_has_watch || boot_cpu_data.watch_reg_use_cnt == 0)
 		return -EIO;
 		return -EIO;
 	if (!access_ok(VERIFY_WRITE, addr, sizeof(struct pt_watch_regs)))
 	if (!access_ok(VERIFY_WRITE, addr, sizeof(struct pt_watch_regs)))
 		return -EIO;
 		return -EIO;
@@ -177,14 +177,14 @@ int ptrace_get_watch_regs(struct task_struct *child,
 #endif
 #endif
 
 
 	__put_user(style, &addr->style);
 	__put_user(style, &addr->style);
-	__put_user(current_cpu_data.watch_reg_use_cnt,
+	__put_user(boot_cpu_data.watch_reg_use_cnt,
 		   &addr->WATCH_STYLE.num_valid);
 		   &addr->WATCH_STYLE.num_valid);
-	for (i = 0; i < current_cpu_data.watch_reg_use_cnt; i++) {
+	for (i = 0; i < boot_cpu_data.watch_reg_use_cnt; i++) {
 		__put_user(child->thread.watch.mips3264.watchlo[i],
 		__put_user(child->thread.watch.mips3264.watchlo[i],
 			   &addr->WATCH_STYLE.watchlo[i]);
 			   &addr->WATCH_STYLE.watchlo[i]);
 		__put_user(child->thread.watch.mips3264.watchhi[i] & 0xfff,
 		__put_user(child->thread.watch.mips3264.watchhi[i] & 0xfff,
 			   &addr->WATCH_STYLE.watchhi[i]);
 			   &addr->WATCH_STYLE.watchhi[i]);
-		__put_user(current_cpu_data.watch_reg_masks[i],
+		__put_user(boot_cpu_data.watch_reg_masks[i],
 			   &addr->WATCH_STYLE.watch_masks[i]);
 			   &addr->WATCH_STYLE.watch_masks[i]);
 	}
 	}
 	for (; i < 8; i++) {
 	for (; i < 8; i++) {
@@ -204,12 +204,12 @@ int ptrace_set_watch_regs(struct task_struct *child,
 	unsigned long lt[NUM_WATCH_REGS];
 	unsigned long lt[NUM_WATCH_REGS];
 	u16 ht[NUM_WATCH_REGS];
 	u16 ht[NUM_WATCH_REGS];
 
 
-	if (!cpu_has_watch || current_cpu_data.watch_reg_use_cnt == 0)
+	if (!cpu_has_watch || boot_cpu_data.watch_reg_use_cnt == 0)
 		return -EIO;
 		return -EIO;
 	if (!access_ok(VERIFY_READ, addr, sizeof(struct pt_watch_regs)))
 	if (!access_ok(VERIFY_READ, addr, sizeof(struct pt_watch_regs)))
 		return -EIO;
 		return -EIO;
 	/* Check the values. */
 	/* Check the values. */
-	for (i = 0; i < current_cpu_data.watch_reg_use_cnt; i++) {
+	for (i = 0; i < boot_cpu_data.watch_reg_use_cnt; i++) {
 		__get_user(lt[i], &addr->WATCH_STYLE.watchlo[i]);
 		__get_user(lt[i], &addr->WATCH_STYLE.watchlo[i]);
 #ifdef CONFIG_32BIT
 #ifdef CONFIG_32BIT
 		if (lt[i] & __UA_LIMIT)
 		if (lt[i] & __UA_LIMIT)
@@ -228,7 +228,7 @@ int ptrace_set_watch_regs(struct task_struct *child,
 			return -EINVAL;
 			return -EINVAL;
 	}
 	}
 	/* Install them. */
 	/* Install them. */
-	for (i = 0; i < current_cpu_data.watch_reg_use_cnt; i++) {
+	for (i = 0; i < boot_cpu_data.watch_reg_use_cnt; i++) {
 		if (lt[i] & 7)
 		if (lt[i] & 7)
 			watch_active = 1;
 			watch_active = 1;
 		child->thread.watch.mips3264.watchlo[i] = lt[i];
 		child->thread.watch.mips3264.watchlo[i] = lt[i];

+ 4 - 2
arch/mips/kernel/traps.c

@@ -704,10 +704,12 @@ int process_fpemu_return(int sig, void __user *fault_addr)
 		si.si_addr = fault_addr;
 		si.si_addr = fault_addr;
 		si.si_signo = sig;
 		si.si_signo = sig;
 		if (sig == SIGSEGV) {
 		if (sig == SIGSEGV) {
+			down_read(&current->mm->mmap_sem);
 			if (find_vma(current->mm, (unsigned long)fault_addr))
 			if (find_vma(current->mm, (unsigned long)fault_addr))
 				si.si_code = SEGV_ACCERR;
 				si.si_code = SEGV_ACCERR;
 			else
 			else
 				si.si_code = SEGV_MAPERR;
 				si.si_code = SEGV_MAPERR;
+			up_read(&current->mm->mmap_sem);
 		} else {
 		} else {
 			si.si_code = BUS_ADRERR;
 			si.si_code = BUS_ADRERR;
 		}
 		}
@@ -1537,7 +1539,7 @@ asmlinkage void cache_parity_error(void)
 	       reg_val & (1<<30) ? "secondary" : "primary",
 	       reg_val & (1<<30) ? "secondary" : "primary",
 	       reg_val & (1<<31) ? "data" : "insn");
 	       reg_val & (1<<31) ? "data" : "insn");
 	if (cpu_has_mips_r2 &&
 	if (cpu_has_mips_r2 &&
-	    ((current_cpu_data.processor_id && 0xff0000) == PRID_COMP_MIPS)) {
+	    ((current_cpu_data.processor_id & 0xff0000) == PRID_COMP_MIPS)) {
 		pr_err("Error bits: %s%s%s%s%s%s%s%s\n",
 		pr_err("Error bits: %s%s%s%s%s%s%s%s\n",
 			reg_val & (1<<29) ? "ED " : "",
 			reg_val & (1<<29) ? "ED " : "",
 			reg_val & (1<<28) ? "ET " : "",
 			reg_val & (1<<28) ? "ET " : "",
@@ -1577,7 +1579,7 @@ asmlinkage void do_ftlb(void)
 
 
 	/* For the moment, report the problem and hang. */
 	/* For the moment, report the problem and hang. */
 	if (cpu_has_mips_r2 &&
 	if (cpu_has_mips_r2 &&
-	    ((current_cpu_data.processor_id && 0xff0000) == PRID_COMP_MIPS)) {
+	    ((current_cpu_data.processor_id & 0xff0000) == PRID_COMP_MIPS)) {
 		pr_err("FTLB error exception, cp0_ecc=0x%08x:\n",
 		pr_err("FTLB error exception, cp0_ecc=0x%08x:\n",
 		       read_c0_ecc());
 		       read_c0_ecc());
 		pr_err("cp0_errorepc == %0*lx\n", field, read_c0_errorepc());
 		pr_err("cp0_errorepc == %0*lx\n", field, read_c0_errorepc());

+ 5 - 6
arch/mips/loongson/common/cs5536/cs5536_mfgpt.c

@@ -27,8 +27,7 @@
 
 
 #include <cs5536/cs5536_mfgpt.h>
 #include <cs5536/cs5536_mfgpt.h>
 
 
-DEFINE_SPINLOCK(mfgpt_lock);
-EXPORT_SYMBOL(mfgpt_lock);
+static DEFINE_RAW_SPINLOCK(mfgpt_lock);
 
 
 static u32 mfgpt_base;
 static u32 mfgpt_base;
 
 
@@ -55,7 +54,7 @@ EXPORT_SYMBOL(enable_mfgpt0_counter);
 static void init_mfgpt_timer(enum clock_event_mode mode,
 static void init_mfgpt_timer(enum clock_event_mode mode,
 			     struct clock_event_device *evt)
 			     struct clock_event_device *evt)
 {
 {
-	spin_lock(&mfgpt_lock);
+	raw_spin_lock(&mfgpt_lock);
 
 
 	switch (mode) {
 	switch (mode) {
 	case CLOCK_EVT_MODE_PERIODIC:
 	case CLOCK_EVT_MODE_PERIODIC:
@@ -79,7 +78,7 @@ static void init_mfgpt_timer(enum clock_event_mode mode,
 		/* Nothing to do here */
 		/* Nothing to do here */
 		break;
 		break;
 	}
 	}
-	spin_unlock(&mfgpt_lock);
+	raw_spin_unlock(&mfgpt_lock);
 }
 }
 
 
 static struct clock_event_device mfgpt_clockevent = {
 static struct clock_event_device mfgpt_clockevent = {
@@ -157,7 +156,7 @@ static cycle_t mfgpt_read(struct clocksource *cs)
 	static int old_count;
 	static int old_count;
 	static u32 old_jifs;
 	static u32 old_jifs;
 
 
-	spin_lock_irqsave(&mfgpt_lock, flags);
+	raw_spin_lock_irqsave(&mfgpt_lock, flags);
 	/*
 	/*
 	 * Although our caller may have the read side of xtime_lock,
 	 * Although our caller may have the read side of xtime_lock,
 	 * this is now a seqlock, and we are cheating in this routine
 	 * this is now a seqlock, and we are cheating in this routine
@@ -191,7 +190,7 @@ static cycle_t mfgpt_read(struct clocksource *cs)
 	old_count = count;
 	old_count = count;
 	old_jifs = jifs;
 	old_jifs = jifs;
 
 
-	spin_unlock_irqrestore(&mfgpt_lock, flags);
+	raw_spin_unlock_irqrestore(&mfgpt_lock, flags);
 
 
 	return (cycle_t) (jifs * COMPARE) + count;
 	return (cycle_t) (jifs * COMPARE) + count;
 }
 }

+ 2 - 0
arch/mips/mm/c-octeon.c

@@ -137,8 +137,10 @@ static void octeon_flush_cache_sigtramp(unsigned long addr)
 {
 {
 	struct vm_area_struct *vma;
 	struct vm_area_struct *vma;
 
 
+	down_read(&current->mm->mmap_sem);
 	vma = find_vma(current->mm, addr);
 	vma = find_vma(current->mm, addr);
 	octeon_flush_icache_all_cores(vma);
 	octeon_flush_icache_all_cores(vma);
+	up_read(&current->mm->mmap_sem);
 }
 }
 
 
 
 

+ 2 - 2
arch/mips/mm/page.c

@@ -273,7 +273,7 @@ void build_clear_page(void)
 		uasm_i_ori(&buf, A2, A0, off);
 		uasm_i_ori(&buf, A2, A0, off);
 
 
 	if (R4600_V2_HIT_CACHEOP_WAR && cpu_is_r4600_v2_x())
 	if (R4600_V2_HIT_CACHEOP_WAR && cpu_is_r4600_v2_x())
-		uasm_i_lui(&buf, AT, 0xa000);
+		uasm_i_lui(&buf, AT, uasm_rel_hi(0xa0000000));
 
 
 	off = cache_line_size ? min(8, pref_bias_clear_store / cache_line_size)
 	off = cache_line_size ? min(8, pref_bias_clear_store / cache_line_size)
 				* cache_line_size : 0;
 				* cache_line_size : 0;
@@ -424,7 +424,7 @@ void build_copy_page(void)
 		uasm_i_ori(&buf, A2, A0, off);
 		uasm_i_ori(&buf, A2, A0, off);
 
 
 	if (R4600_V2_HIT_CACHEOP_WAR && cpu_is_r4600_v2_x())
 	if (R4600_V2_HIT_CACHEOP_WAR && cpu_is_r4600_v2_x())
-		uasm_i_lui(&buf, AT, 0xa000);
+		uasm_i_lui(&buf, AT, uasm_rel_hi(0xa0000000));
 
 
 	off = cache_line_size ? min(8, pref_bias_copy_load / cache_line_size) *
 	off = cache_line_size ? min(8, pref_bias_copy_load / cache_line_size) *
 				cache_line_size : 0;
 				cache_line_size : 0;

+ 1 - 1
arch/mips/mti-malta/malta-memory.c

@@ -27,7 +27,7 @@ unsigned long physical_memsize = 0L;
 fw_memblock_t * __init fw_getmdesc(int eva)
 fw_memblock_t * __init fw_getmdesc(int eva)
 {
 {
 	char *memsize_str, *ememsize_str = NULL, *ptr;
 	char *memsize_str, *ememsize_str = NULL, *ptr;
-	unsigned long memsize, ememsize = 0;
+	unsigned long memsize = 0, ememsize = 0;
 	static char cmdline[COMMAND_LINE_SIZE] __initdata;
 	static char cmdline[COMMAND_LINE_SIZE] __initdata;
 	int tmp;
 	int tmp;
 
 

+ 0 - 1
arch/mips/pci/pci-rc32434.c

@@ -53,7 +53,6 @@ static struct resource rc32434_res_pci_mem1 = {
 	.start = 0x50000000,
 	.start = 0x50000000,
 	.end = 0x5FFFFFFF,
 	.end = 0x5FFFFFFF,
 	.flags = IORESOURCE_MEM,
 	.flags = IORESOURCE_MEM,
-	.parent = &rc32434_res_pci_mem1,
 	.sibling = NULL,
 	.sibling = NULL,
 	.child = &rc32434_res_pci_mem2
 	.child = &rc32434_res_pci_mem2
 };
 };

+ 2 - 1
arch/parisc/include/uapi/asm/unistd.h

@@ -829,8 +829,9 @@
 #define __NR_sched_setattr	(__NR_Linux + 334)
 #define __NR_sched_setattr	(__NR_Linux + 334)
 #define __NR_sched_getattr	(__NR_Linux + 335)
 #define __NR_sched_getattr	(__NR_Linux + 335)
 #define __NR_utimes		(__NR_Linux + 336)
 #define __NR_utimes		(__NR_Linux + 336)
+#define __NR_renameat2		(__NR_Linux + 337)
 
 
-#define __NR_Linux_syscalls	(__NR_utimes + 1)
+#define __NR_Linux_syscalls	(__NR_renameat2 + 1)
 
 
 
 
 #define __IGNORE_select		/* newselect */
 #define __IGNORE_select		/* newselect */

+ 1 - 0
arch/parisc/kernel/syscall_table.S

@@ -432,6 +432,7 @@
 	ENTRY_SAME(sched_setattr)
 	ENTRY_SAME(sched_setattr)
 	ENTRY_SAME(sched_getattr)	/* 335 */
 	ENTRY_SAME(sched_getattr)	/* 335 */
 	ENTRY_COMP(utimes)
 	ENTRY_COMP(utimes)
+	ENTRY_SAME(renameat2)
 
 
 	/* Nothing yet */
 	/* Nothing yet */
 
 

+ 3 - 1
arch/powerpc/Makefile

@@ -150,7 +150,9 @@ endif
 
 
 CFLAGS-$(CONFIG_TUNE_CELL) += $(call cc-option,-mtune=cell)
 CFLAGS-$(CONFIG_TUNE_CELL) += $(call cc-option,-mtune=cell)
 
 
-KBUILD_CPPFLAGS	+= -Iarch/$(ARCH)
+asinstr := $(call as-instr,lis 9$(comma)foo@high,-DHAVE_AS_ATHIGH=1)
+
+KBUILD_CPPFLAGS	+= -Iarch/$(ARCH) $(asinstr)
 KBUILD_AFLAGS	+= -Iarch/$(ARCH)
 KBUILD_AFLAGS	+= -Iarch/$(ARCH)
 KBUILD_CFLAGS	+= -msoft-float -pipe -Iarch/$(ARCH) $(CFLAGS-y)
 KBUILD_CFLAGS	+= -msoft-float -pipe -Iarch/$(ARCH) $(CFLAGS-y)
 CPP		= $(CC) -E $(KBUILD_CFLAGS)
 CPP		= $(CC) -E $(KBUILD_CFLAGS)

+ 6 - 1
arch/powerpc/include/asm/ppc_asm.h

@@ -318,11 +318,16 @@ n:
 	addi	reg,reg,(name - 0b)@l;
 	addi	reg,reg,(name - 0b)@l;
 
 
 #ifdef __powerpc64__
 #ifdef __powerpc64__
+#ifdef HAVE_AS_ATHIGH
+#define __AS_ATHIGH high
+#else
+#define __AS_ATHIGH h
+#endif
 #define LOAD_REG_IMMEDIATE(reg,expr)		\
 #define LOAD_REG_IMMEDIATE(reg,expr)		\
 	lis     reg,(expr)@highest;		\
 	lis     reg,(expr)@highest;		\
 	ori     reg,reg,(expr)@higher;	\
 	ori     reg,reg,(expr)@higher;	\
 	rldicr  reg,reg,32,31;		\
 	rldicr  reg,reg,32,31;		\
-	oris    reg,reg,(expr)@h;		\
+	oris    reg,reg,(expr)@__AS_ATHIGH;	\
 	ori     reg,reg,(expr)@l;
 	ori     reg,reg,(expr)@l;
 
 
 #define LOAD_REG_ADDR(reg,name)			\
 #define LOAD_REG_ADDR(reg,name)			\

+ 11 - 0
arch/powerpc/include/asm/sections.h

@@ -39,6 +39,17 @@ static inline int overlaps_kernel_text(unsigned long start, unsigned long end)
 		(unsigned long)_stext < end;
 		(unsigned long)_stext < end;
 }
 }
 
 
+static inline int overlaps_kvm_tmp(unsigned long start, unsigned long end)
+{
+#ifdef CONFIG_KVM_GUEST
+	extern char kvm_tmp[];
+	return start < (unsigned long)kvm_tmp &&
+		(unsigned long)&kvm_tmp[1024 * 1024] < end;
+#else
+	return 0;
+#endif
+}
+
 #undef dereference_function_descriptor
 #undef dereference_function_descriptor
 static inline void *dereference_function_descriptor(void *ptr)
 static inline void *dereference_function_descriptor(void *ptr)
 {
 {

+ 1 - 0
arch/powerpc/include/asm/systbl.h

@@ -361,3 +361,4 @@ SYSCALL(finit_module)
 SYSCALL(ni_syscall) /* sys_kcmp */
 SYSCALL(ni_syscall) /* sys_kcmp */
 SYSCALL_SPU(sched_setattr)
 SYSCALL_SPU(sched_setattr)
 SYSCALL_SPU(sched_getattr)
 SYSCALL_SPU(sched_getattr)
+SYSCALL_SPU(renameat2)

+ 1 - 1
arch/powerpc/include/asm/unistd.h

@@ -12,7 +12,7 @@
 #include <uapi/asm/unistd.h>
 #include <uapi/asm/unistd.h>
 
 
 
 
-#define __NR_syscalls		357
+#define __NR_syscalls		358
 
 
 #define __NR__exit __NR_exit
 #define __NR__exit __NR_exit
 #define NR_syscalls	__NR_syscalls
 #define NR_syscalls	__NR_syscalls

+ 1 - 0
arch/powerpc/include/uapi/asm/unistd.h

@@ -379,5 +379,6 @@
 #define __NR_kcmp		354
 #define __NR_kcmp		354
 #define __NR_sched_setattr	355
 #define __NR_sched_setattr	355
 #define __NR_sched_getattr	356
 #define __NR_sched_getattr	356
+#define __NR_renameat2		357
 
 
 #endif /* _UAPI_ASM_POWERPC_UNISTD_H_ */
 #endif /* _UAPI_ASM_POWERPC_UNISTD_H_ */

+ 1 - 1
arch/powerpc/kernel/kvm.c

@@ -74,7 +74,7 @@
 #define KVM_INST_MTSRIN		0x7c0001e4
 #define KVM_INST_MTSRIN		0x7c0001e4
 
 
 static bool kvm_patching_worked = true;
 static bool kvm_patching_worked = true;
-static char kvm_tmp[1024 * 1024];
+char kvm_tmp[1024 * 1024];
 static int kvm_tmp_index;
 static int kvm_tmp_index;
 
 
 static inline void kvm_patch_ins(u32 *inst, u32 new_inst)
 static inline void kvm_patch_ins(u32 *inst, u32 new_inst)

+ 1 - 1
arch/powerpc/kernel/machine_kexec_64.c

@@ -237,7 +237,7 @@ static void wake_offline_cpus(void)
 		if (!cpu_online(cpu)) {
 		if (!cpu_online(cpu)) {
 			printk(KERN_INFO "kexec: Waking offline cpu %d.\n",
 			printk(KERN_INFO "kexec: Waking offline cpu %d.\n",
 			       cpu);
 			       cpu);
-			cpu_up(cpu);
+			WARN_ON(cpu_up(cpu));
 		}
 		}
 	}
 	}
 }
 }

+ 0 - 3
arch/powerpc/kernel/time.c

@@ -813,9 +813,6 @@ static void __init clocksource_init(void)
 static int decrementer_set_next_event(unsigned long evt,
 static int decrementer_set_next_event(unsigned long evt,
 				      struct clock_event_device *dev)
 				      struct clock_event_device *dev)
 {
 {
-	/* Don't adjust the decrementer if some irq work is pending */
-	if (test_irq_work_pending())
-		return 0;
 	__get_cpu_var(decrementers_next_tb) = get_tb_or_rtc() + evt;
 	__get_cpu_var(decrementers_next_tb) = get_tb_or_rtc() + evt;
 	set_dec(evt);
 	set_dec(evt);
 
 

+ 3 - 3
arch/powerpc/kvm/book3s.c

@@ -886,7 +886,7 @@ static int kvmppc_book3s_init(void)
 	r = kvm_init(NULL, sizeof(struct kvm_vcpu), 0, THIS_MODULE);
 	r = kvm_init(NULL, sizeof(struct kvm_vcpu), 0, THIS_MODULE);
 	if (r)
 	if (r)
 		return r;
 		return r;
-#ifdef CONFIG_KVM_BOOK3S_32
+#ifdef CONFIG_KVM_BOOK3S_32_HANDLER
 	r = kvmppc_book3s_init_pr();
 	r = kvmppc_book3s_init_pr();
 #endif
 #endif
 	return r;
 	return r;
@@ -895,7 +895,7 @@ static int kvmppc_book3s_init(void)
 
 
 static void kvmppc_book3s_exit(void)
 static void kvmppc_book3s_exit(void)
 {
 {
-#ifdef CONFIG_KVM_BOOK3S_32
+#ifdef CONFIG_KVM_BOOK3S_32_HANDLER
 	kvmppc_book3s_exit_pr();
 	kvmppc_book3s_exit_pr();
 #endif
 #endif
 	kvm_exit();
 	kvm_exit();
@@ -905,7 +905,7 @@ module_init(kvmppc_book3s_init);
 module_exit(kvmppc_book3s_exit);
 module_exit(kvmppc_book3s_exit);
 
 
 /* On 32bit this is our one and only kernel module */
 /* On 32bit this is our one and only kernel module */
-#ifdef CONFIG_KVM_BOOK3S_32
+#ifdef CONFIG_KVM_BOOK3S_32_HANDLER
 MODULE_ALIAS_MISCDEV(KVM_MINOR);
 MODULE_ALIAS_MISCDEV(KVM_MINOR);
 MODULE_ALIAS("devname:kvm");
 MODULE_ALIAS("devname:kvm");
 #endif
 #endif

+ 1 - 1
arch/powerpc/kvm/book3s_hv_rm_mmu.c

@@ -234,7 +234,7 @@ long kvmppc_do_h_enter(struct kvm *kvm, unsigned long flags,
 		pte_size = psize;
 		pte_size = psize;
 		pte = lookup_linux_pte_and_update(pgdir, hva, writing,
 		pte = lookup_linux_pte_and_update(pgdir, hva, writing,
 						  &pte_size);
 						  &pte_size);
-		if (pte_present(pte)) {
+		if (pte_present(pte) && !pte_numa(pte)) {
 			if (writing && !pte_write(pte))
 			if (writing && !pte_write(pte))
 				/* make the actual HPTE be read-only */
 				/* make the actual HPTE be read-only */
 				ptel = hpte_make_readonly(ptel);
 				ptel = hpte_make_readonly(ptel);

+ 104 - 0
arch/powerpc/kvm/book3s_hv_rmhandlers.S

@@ -1323,6 +1323,110 @@ END_FTR_SECTION_IFSET(CPU_FTR_ARCH_206)
 	mr	r3, r9
 	mr	r3, r9
 	bl	kvmppc_save_fp
 	bl	kvmppc_save_fp
 
 
+#ifdef CONFIG_PPC_TRANSACTIONAL_MEM
+BEGIN_FTR_SECTION
+	b	2f
+END_FTR_SECTION_IFCLR(CPU_FTR_TM)
+	/* Turn on TM. */
+	mfmsr	r8
+	li	r0, 1
+	rldimi	r8, r0, MSR_TM_LG, 63-MSR_TM_LG
+	mtmsrd	r8
+
+	ld	r5, VCPU_MSR(r9)
+	rldicl. r5, r5, 64 - MSR_TS_S_LG, 62
+	beq	1f	/* TM not active in guest. */
+
+	li	r3, TM_CAUSE_KVM_RESCHED
+
+	/* Clear the MSR RI since r1, r13 are all going to be foobar. */
+	li	r5, 0
+	mtmsrd	r5, 1
+
+	/* All GPRs are volatile at this point. */
+	TRECLAIM(R3)
+
+	/* Temporarily store r13 and r9 so we have some regs to play with */
+	SET_SCRATCH0(r13)
+	GET_PACA(r13)
+	std	r9, PACATMSCRATCH(r13)
+	ld	r9, HSTATE_KVM_VCPU(r13)
+
+	/* Get a few more GPRs free. */
+	std	r29, VCPU_GPRS_TM(29)(r9)
+	std	r30, VCPU_GPRS_TM(30)(r9)
+	std	r31, VCPU_GPRS_TM(31)(r9)
+
+	/* Save away PPR and DSCR soon so don't run with user values. */
+	mfspr	r31, SPRN_PPR
+	HMT_MEDIUM
+	mfspr	r30, SPRN_DSCR
+	ld	r29, HSTATE_DSCR(r13)
+	mtspr	SPRN_DSCR, r29
+
+	/* Save all but r9, r13 & r29-r31 */
+	reg = 0
+	.rept	29
+	.if (reg != 9) && (reg != 13)
+	std	reg, VCPU_GPRS_TM(reg)(r9)
+	.endif
+	reg = reg + 1
+	.endr
+	/* ... now save r13 */
+	GET_SCRATCH0(r4)
+	std	r4, VCPU_GPRS_TM(13)(r9)
+	/* ... and save r9 */
+	ld	r4, PACATMSCRATCH(r13)
+	std	r4, VCPU_GPRS_TM(9)(r9)
+
+	/* Reload stack pointer and TOC. */
+	ld	r1, HSTATE_HOST_R1(r13)
+	ld	r2, PACATOC(r13)
+
+	/* Set MSR RI now we have r1 and r13 back. */
+	li	r5, MSR_RI
+	mtmsrd	r5, 1
+
+	/* Save away checkpinted SPRs. */
+	std	r31, VCPU_PPR_TM(r9)
+	std	r30, VCPU_DSCR_TM(r9)
+	mflr	r5
+	mfcr	r6
+	mfctr	r7
+	mfspr	r8, SPRN_AMR
+	mfspr	r10, SPRN_TAR
+	std	r5, VCPU_LR_TM(r9)
+	stw	r6, VCPU_CR_TM(r9)
+	std	r7, VCPU_CTR_TM(r9)
+	std	r8, VCPU_AMR_TM(r9)
+	std	r10, VCPU_TAR_TM(r9)
+
+	/* Restore r12 as trap number. */
+	lwz	r12, VCPU_TRAP(r9)
+
+	/* Save FP/VSX. */
+	addi	r3, r9, VCPU_FPRS_TM
+	bl	.store_fp_state
+	addi	r3, r9, VCPU_VRS_TM
+	bl	.store_vr_state
+	mfspr	r6, SPRN_VRSAVE
+	stw	r6, VCPU_VRSAVE_TM(r9)
+1:
+	/*
+	 * We need to save these SPRs after the treclaim so that the software
+	 * error code is recorded correctly in the TEXASR.  Also the user may
+	 * change these outside of a transaction, so they must always be
+	 * context switched.
+	 */
+	mfspr	r5, SPRN_TFHAR
+	mfspr	r6, SPRN_TFIAR
+	mfspr	r7, SPRN_TEXASR
+	std	r5, VCPU_TFHAR(r9)
+	std	r6, VCPU_TFIAR(r9)
+	std	r7, VCPU_TEXASR(r9)
+2:
+#endif
+
 	/* Increment yield count if they have a VPA */
 	/* Increment yield count if they have a VPA */
 	ld	r8, VCPU_VPA(r9)	/* do they have a VPA? */
 	ld	r8, VCPU_VPA(r9)	/* do they have a VPA? */
 	cmpdi	r8, 0
 	cmpdi	r8, 0

+ 3 - 3
arch/powerpc/kvm/book3s_pr.c

@@ -1153,7 +1153,7 @@ static struct kvm_vcpu *kvmppc_core_vcpu_create_pr(struct kvm *kvm,
 		goto free_vcpu;
 		goto free_vcpu;
 	vcpu->arch.book3s = vcpu_book3s;
 	vcpu->arch.book3s = vcpu_book3s;
 
 
-#ifdef CONFIG_KVM_BOOK3S_32
+#ifdef CONFIG_KVM_BOOK3S_32_HANDLER
 	vcpu->arch.shadow_vcpu =
 	vcpu->arch.shadow_vcpu =
 		kzalloc(sizeof(*vcpu->arch.shadow_vcpu), GFP_KERNEL);
 		kzalloc(sizeof(*vcpu->arch.shadow_vcpu), GFP_KERNEL);
 	if (!vcpu->arch.shadow_vcpu)
 	if (!vcpu->arch.shadow_vcpu)
@@ -1198,7 +1198,7 @@ static struct kvm_vcpu *kvmppc_core_vcpu_create_pr(struct kvm *kvm,
 uninit_vcpu:
 uninit_vcpu:
 	kvm_vcpu_uninit(vcpu);
 	kvm_vcpu_uninit(vcpu);
 free_shadow_vcpu:
 free_shadow_vcpu:
-#ifdef CONFIG_KVM_BOOK3S_32
+#ifdef CONFIG_KVM_BOOK3S_32_HANDLER
 	kfree(vcpu->arch.shadow_vcpu);
 	kfree(vcpu->arch.shadow_vcpu);
 free_vcpu3s:
 free_vcpu3s:
 #endif
 #endif
@@ -1215,7 +1215,7 @@ static void kvmppc_core_vcpu_free_pr(struct kvm_vcpu *vcpu)
 
 
 	free_page((unsigned long)vcpu->arch.shared & PAGE_MASK);
 	free_page((unsigned long)vcpu->arch.shared & PAGE_MASK);
 	kvm_vcpu_uninit(vcpu);
 	kvm_vcpu_uninit(vcpu);
-#ifdef CONFIG_KVM_BOOK3S_32
+#ifdef CONFIG_KVM_BOOK3S_32_HANDLER
 	kfree(vcpu->arch.shadow_vcpu);
 	kfree(vcpu->arch.shadow_vcpu);
 #endif
 #endif
 	vfree(vcpu_book3s);
 	vfree(vcpu_book3s);

+ 4 - 0
arch/powerpc/mm/hash_utils_64.c

@@ -207,6 +207,10 @@ int htab_bolt_mapping(unsigned long vstart, unsigned long vend,
 		if (overlaps_kernel_text(vaddr, vaddr + step))
 		if (overlaps_kernel_text(vaddr, vaddr + step))
 			tprot &= ~HPTE_R_N;
 			tprot &= ~HPTE_R_N;
 
 
+		/* Make kvm guest trampolines executable */
+		if (overlaps_kvm_tmp(vaddr, vaddr + step))
+			tprot &= ~HPTE_R_N;
+
 		/*
 		/*
 		 * If relocatable, check if it overlaps interrupt vectors that
 		 * If relocatable, check if it overlaps interrupt vectors that
 		 * are copied down to real 0. For relocatable kernel
 		 * are copied down to real 0. For relocatable kernel

+ 2 - 1
arch/powerpc/platforms/powernv/eeh-ioda.c

@@ -549,7 +549,8 @@ static int ioda_eeh_reset(struct eeh_pe *pe, int option)
 		ret = ioda_eeh_phb_reset(hose, option);
 		ret = ioda_eeh_phb_reset(hose, option);
 	} else {
 	} else {
 		bus = eeh_pe_bus_get(pe);
 		bus = eeh_pe_bus_get(pe);
-		if (pci_is_root_bus(bus))
+		if (pci_is_root_bus(bus) ||
+		    pci_is_root_bus(bus->parent))
 			ret = ioda_eeh_root_reset(hose, option);
 			ret = ioda_eeh_root_reset(hose, option);
 		else
 		else
 			ret = ioda_eeh_bridge_reset(hose, bus->self, option);
 			ret = ioda_eeh_bridge_reset(hose, bus->self, option);

+ 3 - 0
arch/s390/crypto/aes_s390.c

@@ -820,6 +820,9 @@ static int ctr_aes_crypt(struct blkcipher_desc *desc, long func,
 		else
 		else
 			memcpy(walk->iv, ctrptr, AES_BLOCK_SIZE);
 			memcpy(walk->iv, ctrptr, AES_BLOCK_SIZE);
 		spin_unlock(&ctrblk_lock);
 		spin_unlock(&ctrblk_lock);
+	} else {
+		if (!nbytes)
+			memcpy(walk->iv, ctrptr, AES_BLOCK_SIZE);
 	}
 	}
 	/*
 	/*
 	 * final block may be < AES_BLOCK_SIZE, copy only nbytes
 	 * final block may be < AES_BLOCK_SIZE, copy only nbytes

+ 3 - 0
arch/s390/crypto/des_s390.c

@@ -429,6 +429,9 @@ static int ctr_desall_crypt(struct blkcipher_desc *desc, long func,
 		else
 		else
 			memcpy(walk->iv, ctrptr, DES_BLOCK_SIZE);
 			memcpy(walk->iv, ctrptr, DES_BLOCK_SIZE);
 		spin_unlock(&ctrblk_lock);
 		spin_unlock(&ctrblk_lock);
+	} else {
+		if (!nbytes)
+			memcpy(walk->iv, ctrptr, DES_BLOCK_SIZE);
 	}
 	}
 	/* final block may be < DES_BLOCK_SIZE, copy only nbytes */
 	/* final block may be < DES_BLOCK_SIZE, copy only nbytes */
 	if (nbytes) {
 	if (nbytes) {

+ 1 - 0
arch/s390/kvm/kvm-s390.c

@@ -158,6 +158,7 @@ int kvm_dev_ioctl_check_extension(long ext)
 	case KVM_CAP_ONE_REG:
 	case KVM_CAP_ONE_REG:
 	case KVM_CAP_ENABLE_CAP:
 	case KVM_CAP_ENABLE_CAP:
 	case KVM_CAP_S390_CSS_SUPPORT:
 	case KVM_CAP_S390_CSS_SUPPORT:
+	case KVM_CAP_IRQFD:
 	case KVM_CAP_IOEVENTFD:
 	case KVM_CAP_IOEVENTFD:
 	case KVM_CAP_DEVICE_CTRL:
 	case KVM_CAP_DEVICE_CTRL:
 	case KVM_CAP_ENABLE_CAP_VM:
 	case KVM_CAP_ENABLE_CAP_VM:

+ 1 - 1
arch/s390/net/bpf_jit_comp.c

@@ -811,7 +811,7 @@ static struct bpf_binary_header *bpf_alloc_binary(unsigned int bpfsize,
 		return NULL;
 		return NULL;
 	memset(header, 0, sz);
 	memset(header, 0, sz);
 	header->pages = sz / PAGE_SIZE;
 	header->pages = sz / PAGE_SIZE;
-	hole = sz - (bpfsize + sizeof(*header));
+	hole = min(sz - (bpfsize + sizeof(*header)), PAGE_SIZE - sizeof(*header));
 	/* Insert random number of illegal instructions before BPF code
 	/* Insert random number of illegal instructions before BPF code
 	 * and make sure the first instruction starts at an even address.
 	 * and make sure the first instruction starts at an even address.
 	 */
 	 */

+ 4 - 2
arch/sparc/include/asm/pgtable_64.h

@@ -24,7 +24,8 @@
 
 
 /* The kernel image occupies 0x4000000 to 0x6000000 (4MB --> 96MB).
 /* The kernel image occupies 0x4000000 to 0x6000000 (4MB --> 96MB).
  * The page copy blockops can use 0x6000000 to 0x8000000.
  * The page copy blockops can use 0x6000000 to 0x8000000.
- * The TSB is mapped in the 0x8000000 to 0xa000000 range.
+ * The 8K TSB is mapped in the 0x8000000 to 0x8400000 range.
+ * The 4M TSB is mapped in the 0x8400000 to 0x8800000 range.
  * The PROM resides in an area spanning 0xf0000000 to 0x100000000.
  * The PROM resides in an area spanning 0xf0000000 to 0x100000000.
  * The vmalloc area spans 0x100000000 to 0x200000000.
  * The vmalloc area spans 0x100000000 to 0x200000000.
  * Since modules need to be in the lowest 32-bits of the address space,
  * Since modules need to be in the lowest 32-bits of the address space,
@@ -33,7 +34,8 @@
  * 0x400000000.
  * 0x400000000.
  */
  */
 #define	TLBTEMP_BASE		_AC(0x0000000006000000,UL)
 #define	TLBTEMP_BASE		_AC(0x0000000006000000,UL)
-#define	TSBMAP_BASE		_AC(0x0000000008000000,UL)
+#define	TSBMAP_8K_BASE		_AC(0x0000000008000000,UL)
+#define	TSBMAP_4M_BASE		_AC(0x0000000008400000,UL)
 #define MODULES_VADDR		_AC(0x0000000010000000,UL)
 #define MODULES_VADDR		_AC(0x0000000010000000,UL)
 #define MODULES_LEN		_AC(0x00000000e0000000,UL)
 #define MODULES_LEN		_AC(0x00000000e0000000,UL)
 #define MODULES_END		_AC(0x00000000f0000000,UL)
 #define MODULES_END		_AC(0x00000000f0000000,UL)

+ 1 - 1
arch/sparc/kernel/sysfs.c

@@ -151,7 +151,7 @@ static ssize_t store_mmustat_enable(struct device *s,
 			size_t count)
 			size_t count)
 {
 {
 	unsigned long val, err;
 	unsigned long val, err;
-	int ret = sscanf(buf, "%ld", &val);
+	int ret = sscanf(buf, "%lu", &val);
 
 
 	if (ret != 1)
 	if (ret != 1)
 		return -EINVAL;
 		return -EINVAL;

+ 1 - 0
arch/sparc/lib/NG2memcpy.S

@@ -236,6 +236,7 @@ FUNC_NAME:	/* %o0=dst, %o1=src, %o2=len */
 	 */
 	 */
 	VISEntryHalf
 	VISEntryHalf
 
 
+	membar		#Sync
 	alignaddr	%o1, %g0, %g0
 	alignaddr	%o1, %g0, %g0
 
 
 	add		%o1, (64 - 1), %o4
 	add		%o1, (64 - 1), %o4

+ 1 - 15
arch/sparc/mm/fault_64.c

@@ -281,18 +281,6 @@ static void noinline __kprobes bogus_32bit_fault_tpc(struct pt_regs *regs)
 	show_regs(regs);
 	show_regs(regs);
 }
 }
 
 
-static void noinline __kprobes bogus_32bit_fault_address(struct pt_regs *regs,
-							 unsigned long addr)
-{
-	static int times;
-
-	if (times++ < 10)
-		printk(KERN_ERR "FAULT[%s:%d]: 32-bit process "
-		       "reports 64-bit fault address [%lx]\n",
-		       current->comm, current->pid, addr);
-	show_regs(regs);
-}
-
 asmlinkage void __kprobes do_sparc64_fault(struct pt_regs *regs)
 asmlinkage void __kprobes do_sparc64_fault(struct pt_regs *regs)
 {
 {
 	enum ctx_state prev_state = exception_enter();
 	enum ctx_state prev_state = exception_enter();
@@ -322,10 +310,8 @@ asmlinkage void __kprobes do_sparc64_fault(struct pt_regs *regs)
 				goto intr_or_no_mm;
 				goto intr_or_no_mm;
 			}
 			}
 		}
 		}
-		if (unlikely((address >> 32) != 0)) {
-			bogus_32bit_fault_address(regs, address);
+		if (unlikely((address >> 32) != 0))
 			goto intr_or_no_mm;
 			goto intr_or_no_mm;
-		}
 	}
 	}
 
 
 	if (regs->tstate & TSTATE_PRIV) {
 	if (regs->tstate & TSTATE_PRIV) {

+ 13 - 1
arch/sparc/mm/tsb.c

@@ -133,7 +133,19 @@ static void setup_tsb_params(struct mm_struct *mm, unsigned long tsb_idx, unsign
 	mm->context.tsb_block[tsb_idx].tsb_nentries =
 	mm->context.tsb_block[tsb_idx].tsb_nentries =
 		tsb_bytes / sizeof(struct tsb);
 		tsb_bytes / sizeof(struct tsb);
 
 
-	base = TSBMAP_BASE;
+	switch (tsb_idx) {
+	case MM_TSB_BASE:
+		base = TSBMAP_8K_BASE;
+		break;
+#if defined(CONFIG_HUGETLB_PAGE) || defined(CONFIG_TRANSPARENT_HUGEPAGE)
+	case MM_TSB_HUGE:
+		base = TSBMAP_4M_BASE;
+		break;
+#endif
+	default:
+		BUG();
+	}
+
 	tte = pgprot_val(PAGE_KERNEL_LOCKED);
 	tte = pgprot_val(PAGE_KERNEL_LOCKED);
 	tsb_paddr = __pa(mm->context.tsb_block[tsb_idx].tsb);
 	tsb_paddr = __pa(mm->context.tsb_block[tsb_idx].tsb);
 	BUG_ON(tsb_paddr & (tsb_bytes - 1UL));
 	BUG_ON(tsb_paddr & (tsb_bytes - 1UL));

+ 1 - 1
arch/x86/include/asm/page_64_types.h

@@ -1,7 +1,7 @@
 #ifndef _ASM_X86_PAGE_64_DEFS_H
 #ifndef _ASM_X86_PAGE_64_DEFS_H
 #define _ASM_X86_PAGE_64_DEFS_H
 #define _ASM_X86_PAGE_64_DEFS_H
 
 
-#define THREAD_SIZE_ORDER	1
+#define THREAD_SIZE_ORDER	2
 #define THREAD_SIZE  (PAGE_SIZE << THREAD_SIZE_ORDER)
 #define THREAD_SIZE  (PAGE_SIZE << THREAD_SIZE_ORDER)
 #define CURRENT_MASK (~(THREAD_SIZE - 1))
 #define CURRENT_MASK (~(THREAD_SIZE - 1))
 
 

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

@@ -169,7 +169,6 @@ static struct event_constraint intel_slm_event_constraints[] __read_mostly =
 {
 {
 	FIXED_EVENT_CONSTRAINT(0x00c0, 0), /* INST_RETIRED.ANY */
 	FIXED_EVENT_CONSTRAINT(0x00c0, 0), /* INST_RETIRED.ANY */
 	FIXED_EVENT_CONSTRAINT(0x003c, 1), /* CPU_CLK_UNHALTED.CORE */
 	FIXED_EVENT_CONSTRAINT(0x003c, 1), /* CPU_CLK_UNHALTED.CORE */
-	FIXED_EVENT_CONSTRAINT(0x013c, 2), /* CPU_CLK_UNHALTED.REF */
 	FIXED_EVENT_CONSTRAINT(0x0300, 2), /* pseudo CPU_CLK_UNHALTED.REF */
 	FIXED_EVENT_CONSTRAINT(0x0300, 2), /* pseudo CPU_CLK_UNHALTED.REF */
 	EVENT_CONSTRAINT_END
 	EVENT_CONSTRAINT_END
 };
 };

+ 5 - 2
arch/x86/kvm/vmx.c

@@ -7778,7 +7778,8 @@ static void prepare_vmcs02(struct kvm_vcpu *vcpu, struct vmcs12 *vmcs12)
 
 
 	exec_control = vmcs12->pin_based_vm_exec_control;
 	exec_control = vmcs12->pin_based_vm_exec_control;
 	exec_control |= vmcs_config.pin_based_exec_ctrl;
 	exec_control |= vmcs_config.pin_based_exec_ctrl;
-	exec_control &= ~PIN_BASED_VMX_PREEMPTION_TIMER;
+	exec_control &= ~(PIN_BASED_VMX_PREEMPTION_TIMER |
+                          PIN_BASED_POSTED_INTR);
 	vmcs_write32(PIN_BASED_VM_EXEC_CONTROL, exec_control);
 	vmcs_write32(PIN_BASED_VM_EXEC_CONTROL, exec_control);
 
 
 	vmx->nested.preemption_timer_expired = false;
 	vmx->nested.preemption_timer_expired = false;
@@ -7815,7 +7816,9 @@ static void prepare_vmcs02(struct kvm_vcpu *vcpu, struct vmcs12 *vmcs12)
 		if (!vmx->rdtscp_enabled)
 		if (!vmx->rdtscp_enabled)
 			exec_control &= ~SECONDARY_EXEC_RDTSCP;
 			exec_control &= ~SECONDARY_EXEC_RDTSCP;
 		/* Take the following fields only from vmcs12 */
 		/* Take the following fields only from vmcs12 */
-		exec_control &= ~SECONDARY_EXEC_VIRTUALIZE_APIC_ACCESSES;
+		exec_control &= ~(SECONDARY_EXEC_VIRTUALIZE_APIC_ACCESSES |
+				  SECONDARY_EXEC_VIRTUAL_INTR_DELIVERY |
+                                  SECONDARY_EXEC_APIC_REGISTER_VIRT);
 		if (nested_cpu_has(vmcs12,
 		if (nested_cpu_has(vmcs12,
 				CPU_BASED_ACTIVATE_SECONDARY_CONTROLS))
 				CPU_BASED_ACTIVATE_SECONDARY_CONTROLS))
 			exec_control |= vmcs12->secondary_vm_exec_control;
 			exec_control |= vmcs12->secondary_vm_exec_control;

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

@@ -106,6 +106,8 @@ EXPORT_SYMBOL_GPL(kvm_max_guest_tsc_khz);
 static u32 tsc_tolerance_ppm = 250;
 static u32 tsc_tolerance_ppm = 250;
 module_param(tsc_tolerance_ppm, uint, S_IRUGO | S_IWUSR);
 module_param(tsc_tolerance_ppm, uint, S_IRUGO | S_IWUSR);
 
 
+static bool backwards_tsc_observed = false;
+
 #define KVM_NR_SHARED_MSRS 16
 #define KVM_NR_SHARED_MSRS 16
 
 
 struct kvm_shared_msrs_global {
 struct kvm_shared_msrs_global {
@@ -1486,7 +1488,8 @@ static void pvclock_update_vm_gtod_copy(struct kvm *kvm)
 					&ka->master_kernel_ns,
 					&ka->master_kernel_ns,
 					&ka->master_cycle_now);
 					&ka->master_cycle_now);
 
 
-	ka->use_master_clock = host_tsc_clocksource & vcpus_matched;
+	ka->use_master_clock = host_tsc_clocksource && vcpus_matched
+				&& !backwards_tsc_observed;
 
 
 	if (ka->use_master_clock)
 	if (ka->use_master_clock)
 		atomic_set(&kvm_guest_has_master_clock, 1);
 		atomic_set(&kvm_guest_has_master_clock, 1);
@@ -6945,6 +6948,7 @@ int kvm_arch_hardware_enable(void *garbage)
 	 */
 	 */
 	if (backwards_tsc) {
 	if (backwards_tsc) {
 		u64 delta_cyc = max_tsc - local_tsc;
 		u64 delta_cyc = max_tsc - local_tsc;
+		backwards_tsc_observed = true;
 		list_for_each_entry(kvm, &vm_list, vm_list) {
 		list_for_each_entry(kvm, &vm_list, vm_list) {
 			kvm_for_each_vcpu(i, vcpu, kvm) {
 			kvm_for_each_vcpu(i, vcpu, kvm) {
 				vcpu->arch.tsc_offset_adjustment += delta_cyc;
 				vcpu->arch.tsc_offset_adjustment += delta_cyc;

+ 1 - 1
arch/x86/net/bpf_jit_comp.c

@@ -171,7 +171,7 @@ static struct bpf_binary_header *bpf_alloc_binary(unsigned int proglen,
 	memset(header, 0xcc, sz); /* fill whole space with int3 instructions */
 	memset(header, 0xcc, sz); /* fill whole space with int3 instructions */
 
 
 	header->pages = sz / PAGE_SIZE;
 	header->pages = sz / PAGE_SIZE;
-	hole = sz - (proglen + sizeof(*header));
+	hole = min(sz - (proglen + sizeof(*header)), PAGE_SIZE - sizeof(*header));
 
 
 	/* insert a random number of int3 instructions before BPF code */
 	/* insert a random number of int3 instructions before BPF code */
 	*image_ptr = &header->image[prandom_u32() % hole];
 	*image_ptr = &header->image[prandom_u32() % hole];

+ 1 - 1
drivers/Makefile

@@ -119,7 +119,7 @@ obj-$(CONFIG_SGI_SN)		+= sn/
 obj-y				+= firmware/
 obj-y				+= firmware/
 obj-$(CONFIG_CRYPTO)		+= crypto/
 obj-$(CONFIG_CRYPTO)		+= crypto/
 obj-$(CONFIG_SUPERH)		+= sh/
 obj-$(CONFIG_SUPERH)		+= sh/
-obj-$(CONFIG_ARCH_SHMOBILE_LEGACY)	+= sh/
+obj-$(CONFIG_ARCH_SHMOBILE)	+= sh/
 ifndef CONFIG_ARCH_USES_GETTIMEOFFSET
 ifndef CONFIG_ARCH_USES_GETTIMEOFFSET
 obj-y				+= clocksource/
 obj-y				+= clocksource/
 endif
 endif

+ 17 - 0
drivers/acpi/Kconfig

@@ -47,6 +47,23 @@ config ACPI_SLEEP
 	depends on SUSPEND || HIBERNATION
 	depends on SUSPEND || HIBERNATION
 	default y
 	default y
 
 
+config ACPI_PROCFS_POWER
+	bool "Deprecated power /proc/acpi directories"
+	depends on PROC_FS
+	help
+	  For backwards compatibility, this option allows
+          deprecated power /proc/acpi/ directories to exist, even when
+          they have been replaced by functions in /sys.
+          The deprecated directories (and their replacements) include:
+	  /proc/acpi/battery/* (/sys/class/power_supply/*)
+	  /proc/acpi/ac_adapter/* (sys/class/power_supply/*)
+	  This option has no effect on /proc/acpi/ directories
+	  and functions, which do not yet exist in /sys
+	  This option, together with the proc directories, will be
+	  deleted in the future.
+
+	  Say N to delete power /proc/acpi/ directories that have moved to /sys/
+
 config ACPI_EC_DEBUGFS
 config ACPI_EC_DEBUGFS
 	tristate "EC read/write access through /sys/kernel/debug/ec"
 	tristate "EC read/write access through /sys/kernel/debug/ec"
 	default n
 	default n

+ 1 - 0
drivers/acpi/Makefile

@@ -47,6 +47,7 @@ acpi-y				+= sysfs.o
 acpi-$(CONFIG_X86)		+= acpi_cmos_rtc.o
 acpi-$(CONFIG_X86)		+= acpi_cmos_rtc.o
 acpi-$(CONFIG_DEBUG_FS)		+= debugfs.o
 acpi-$(CONFIG_DEBUG_FS)		+= debugfs.o
 acpi-$(CONFIG_ACPI_NUMA)	+= numa.o
 acpi-$(CONFIG_ACPI_NUMA)	+= numa.o
+acpi-$(CONFIG_ACPI_PROCFS_POWER) += cm_sbs.o
 ifdef CONFIG_ACPI_VIDEO
 ifdef CONFIG_ACPI_VIDEO
 acpi-y				+= video_detect.o
 acpi-y				+= video_detect.o
 endif
 endif

+ 58 - 59
drivers/acpi/ac.c

@@ -52,11 +52,39 @@ MODULE_AUTHOR("Paul Diefenbaugh");
 MODULE_DESCRIPTION("ACPI AC Adapter Driver");
 MODULE_DESCRIPTION("ACPI AC Adapter Driver");
 MODULE_LICENSE("GPL");
 MODULE_LICENSE("GPL");
 
 
+static int acpi_ac_add(struct acpi_device *device);
+static int acpi_ac_remove(struct acpi_device *device);
+static void acpi_ac_notify(struct acpi_device *device, u32 event);
+
+static const struct acpi_device_id ac_device_ids[] = {
+	{"ACPI0003", 0},
+	{"", 0},
+};
+MODULE_DEVICE_TABLE(acpi, ac_device_ids);
+
+#ifdef CONFIG_PM_SLEEP
+static int acpi_ac_resume(struct device *dev);
+#endif
+static SIMPLE_DEV_PM_OPS(acpi_ac_pm, NULL, acpi_ac_resume);
+
 static int ac_sleep_before_get_state_ms;
 static int ac_sleep_before_get_state_ms;
 
 
+static struct acpi_driver acpi_ac_driver = {
+	.name = "ac",
+	.class = ACPI_AC_CLASS,
+	.ids = ac_device_ids,
+	.flags = ACPI_DRIVER_ALL_NOTIFY_EVENTS,
+	.ops = {
+		.add = acpi_ac_add,
+		.remove = acpi_ac_remove,
+		.notify = acpi_ac_notify,
+		},
+	.drv.pm = &acpi_ac_pm,
+};
+
 struct acpi_ac {
 struct acpi_ac {
 	struct power_supply charger;
 	struct power_supply charger;
-	struct platform_device *pdev;
+	struct acpi_device * device;
 	unsigned long long state;
 	unsigned long long state;
 	struct notifier_block battery_nb;
 	struct notifier_block battery_nb;
 };
 };
@@ -69,10 +97,12 @@ struct acpi_ac {
 
 
 static int acpi_ac_get_state(struct acpi_ac *ac)
 static int acpi_ac_get_state(struct acpi_ac *ac)
 {
 {
-	acpi_status status;
-	acpi_handle handle = ACPI_HANDLE(&ac->pdev->dev);
+	acpi_status status = AE_OK;
+
+	if (!ac)
+		return -EINVAL;
 
 
-	status = acpi_evaluate_integer(handle, "_PSR", NULL,
+	status = acpi_evaluate_integer(ac->device->handle, "_PSR", NULL,
 				       &ac->state);
 				       &ac->state);
 	if (ACPI_FAILURE(status)) {
 	if (ACPI_FAILURE(status)) {
 		ACPI_EXCEPTION((AE_INFO, status,
 		ACPI_EXCEPTION((AE_INFO, status,
@@ -117,10 +147,9 @@ static enum power_supply_property ac_props[] = {
                                    Driver Model
                                    Driver Model
    -------------------------------------------------------------------------- */
    -------------------------------------------------------------------------- */
 
 
-static void acpi_ac_notify_handler(acpi_handle handle, u32 event, void *data)
+static void acpi_ac_notify(struct acpi_device *device, u32 event)
 {
 {
-	struct acpi_ac *ac = data;
-	struct acpi_device *adev;
+	struct acpi_ac *ac = acpi_driver_data(device);
 
 
 	if (!ac)
 	if (!ac)
 		return;
 		return;
@@ -143,11 +172,10 @@ static void acpi_ac_notify_handler(acpi_handle handle, u32 event, void *data)
 			msleep(ac_sleep_before_get_state_ms);
 			msleep(ac_sleep_before_get_state_ms);
 
 
 		acpi_ac_get_state(ac);
 		acpi_ac_get_state(ac);
-		adev = ACPI_COMPANION(&ac->pdev->dev);
-		acpi_bus_generate_netlink_event(adev->pnp.device_class,
-						dev_name(&ac->pdev->dev),
-						event, (u32) ac->state);
-		acpi_notifier_call_chain(adev, event, (u32) ac->state);
+		acpi_bus_generate_netlink_event(device->pnp.device_class,
+						  dev_name(&device->dev), event,
+						  (u32) ac->state);
+		acpi_notifier_call_chain(device, event, (u32) ac->state);
 		kobject_uevent(&ac->charger.dev->kobj, KOBJ_CHANGE);
 		kobject_uevent(&ac->charger.dev->kobj, KOBJ_CHANGE);
 	}
 	}
 
 
@@ -192,49 +220,39 @@ static struct dmi_system_id ac_dmi_table[] = {
 	{},
 	{},
 };
 };
 
 
-static int acpi_ac_probe(struct platform_device *pdev)
+static int acpi_ac_add(struct acpi_device *device)
 {
 {
 	int result = 0;
 	int result = 0;
 	struct acpi_ac *ac = NULL;
 	struct acpi_ac *ac = NULL;
-	struct acpi_device *adev;
 
 
-	if (!pdev)
-		return -EINVAL;
 
 
-	adev = ACPI_COMPANION(&pdev->dev);
-	if (!adev)
-		return -ENODEV;
+	if (!device)
+		return -EINVAL;
 
 
 	ac = kzalloc(sizeof(struct acpi_ac), GFP_KERNEL);
 	ac = kzalloc(sizeof(struct acpi_ac), GFP_KERNEL);
 	if (!ac)
 	if (!ac)
 		return -ENOMEM;
 		return -ENOMEM;
 
 
-	strcpy(acpi_device_name(adev), ACPI_AC_DEVICE_NAME);
-	strcpy(acpi_device_class(adev), ACPI_AC_CLASS);
-	ac->pdev = pdev;
-	platform_set_drvdata(pdev, ac);
+	ac->device = device;
+	strcpy(acpi_device_name(device), ACPI_AC_DEVICE_NAME);
+	strcpy(acpi_device_class(device), ACPI_AC_CLASS);
+	device->driver_data = ac;
 
 
 	result = acpi_ac_get_state(ac);
 	result = acpi_ac_get_state(ac);
 	if (result)
 	if (result)
 		goto end;
 		goto end;
 
 
-	ac->charger.name = acpi_device_bid(adev);
+	ac->charger.name = acpi_device_bid(device);
 	ac->charger.type = POWER_SUPPLY_TYPE_MAINS;
 	ac->charger.type = POWER_SUPPLY_TYPE_MAINS;
 	ac->charger.properties = ac_props;
 	ac->charger.properties = ac_props;
 	ac->charger.num_properties = ARRAY_SIZE(ac_props);
 	ac->charger.num_properties = ARRAY_SIZE(ac_props);
 	ac->charger.get_property = get_ac_property;
 	ac->charger.get_property = get_ac_property;
-	result = power_supply_register(&pdev->dev, &ac->charger);
+	result = power_supply_register(&ac->device->dev, &ac->charger);
 	if (result)
 	if (result)
 		goto end;
 		goto end;
 
 
-	result = acpi_install_notify_handler(ACPI_HANDLE(&pdev->dev),
-			ACPI_ALL_NOTIFY, acpi_ac_notify_handler, ac);
-	if (result) {
-		power_supply_unregister(&ac->charger);
-		goto end;
-	}
 	printk(KERN_INFO PREFIX "%s [%s] (%s)\n",
 	printk(KERN_INFO PREFIX "%s [%s] (%s)\n",
-	       acpi_device_name(adev), acpi_device_bid(adev),
+	       acpi_device_name(device), acpi_device_bid(device),
 	       ac->state ? "on-line" : "off-line");
 	       ac->state ? "on-line" : "off-line");
 
 
 	ac->battery_nb.notifier_call = acpi_ac_battery_notify;
 	ac->battery_nb.notifier_call = acpi_ac_battery_notify;
@@ -256,7 +274,7 @@ static int acpi_ac_resume(struct device *dev)
 	if (!dev)
 	if (!dev)
 		return -EINVAL;
 		return -EINVAL;
 
 
-	ac = platform_get_drvdata(to_platform_device(dev));
+	ac = acpi_driver_data(to_acpi_device(dev));
 	if (!ac)
 	if (!ac)
 		return -EINVAL;
 		return -EINVAL;
 
 
@@ -270,19 +288,17 @@ static int acpi_ac_resume(struct device *dev)
 #else
 #else
 #define acpi_ac_resume NULL
 #define acpi_ac_resume NULL
 #endif
 #endif
-static SIMPLE_DEV_PM_OPS(acpi_ac_pm_ops, NULL, acpi_ac_resume);
 
 
-static int acpi_ac_remove(struct platform_device *pdev)
+static int acpi_ac_remove(struct acpi_device *device)
 {
 {
-	struct acpi_ac *ac;
+	struct acpi_ac *ac = NULL;
+
 
 
-	if (!pdev)
+	if (!device || !acpi_driver_data(device))
 		return -EINVAL;
 		return -EINVAL;
 
 
-	acpi_remove_notify_handler(ACPI_HANDLE(&pdev->dev),
-			ACPI_ALL_NOTIFY, acpi_ac_notify_handler);
+	ac = acpi_driver_data(device);
 
 
-	ac = platform_get_drvdata(pdev);
 	if (ac->charger.dev)
 	if (ac->charger.dev)
 		power_supply_unregister(&ac->charger);
 		power_supply_unregister(&ac->charger);
 	unregister_acpi_notifier(&ac->battery_nb);
 	unregister_acpi_notifier(&ac->battery_nb);
@@ -292,23 +308,6 @@ static int acpi_ac_remove(struct platform_device *pdev)
 	return 0;
 	return 0;
 }
 }
 
 
-static const struct acpi_device_id acpi_ac_match[] = {
-	{ "ACPI0003", 0 },
-	{ }
-};
-MODULE_DEVICE_TABLE(acpi, acpi_ac_match);
-
-static struct platform_driver acpi_ac_driver = {
-	.probe          = acpi_ac_probe,
-	.remove         = acpi_ac_remove,
-	.driver         = {
-		.name   = "acpi-ac",
-		.owner  = THIS_MODULE,
-		.pm     = &acpi_ac_pm_ops,
-		.acpi_match_table = ACPI_PTR(acpi_ac_match),
-	},
-};
-
 static int __init acpi_ac_init(void)
 static int __init acpi_ac_init(void)
 {
 {
 	int result;
 	int result;
@@ -316,7 +315,7 @@ static int __init acpi_ac_init(void)
 	if (acpi_disabled)
 	if (acpi_disabled)
 		return -ENODEV;
 		return -ENODEV;
 
 
-	result = platform_driver_register(&acpi_ac_driver);
+	result = acpi_bus_register_driver(&acpi_ac_driver);
 	if (result < 0)
 	if (result < 0)
 		return -ENODEV;
 		return -ENODEV;
 
 
@@ -325,7 +324,7 @@ static int __init acpi_ac_init(void)
 
 
 static void __exit acpi_ac_exit(void)
 static void __exit acpi_ac_exit(void)
 {
 {
-	platform_driver_unregister(&acpi_ac_driver);
+	acpi_bus_unregister_driver(&acpi_ac_driver);
 }
 }
 module_init(acpi_ac_init);
 module_init(acpi_ac_init);
 module_exit(acpi_ac_exit);
 module_exit(acpi_ac_exit);

+ 0 - 1
drivers/acpi/acpi_platform.c

@@ -29,7 +29,6 @@ ACPI_MODULE_NAME("platform");
 static const struct acpi_device_id acpi_platform_device_ids[] = {
 static const struct acpi_device_id acpi_platform_device_ids[] = {
 
 
 	{ "PNP0D40" },
 	{ "PNP0D40" },
-	{ "ACPI0003" },
 	{ "VPC2004" },
 	{ "VPC2004" },
 	{ "BCM4752" },
 	{ "BCM4752" },
 
 

+ 0 - 1
drivers/acpi/acpi_processor.c

@@ -405,7 +405,6 @@ static int acpi_processor_add(struct acpi_device *device,
 		goto err;
 		goto err;
 
 
 	pr->dev = dev;
 	pr->dev = dev;
-	dev->offline = pr->flags.need_hotplug_init;
 
 
 	/* Trigger the processor driver's .probe() if present. */
 	/* Trigger the processor driver's .probe() if present. */
 	if (device_attach(dev) >= 0)
 	if (device_attach(dev) >= 0)

+ 2 - 2
drivers/acpi/acpica/acglobal.h

@@ -141,9 +141,9 @@ ACPI_INIT_GLOBAL(u8, acpi_gbl_do_not_use_xsdt, FALSE);
  * address. Although ACPICA adheres to the ACPI specification which
  * address. Although ACPICA adheres to the ACPI specification which
  * requires the use of the corresponding 64-bit address if it is non-zero,
  * requires the use of the corresponding 64-bit address if it is non-zero,
  * some machines have been found to have a corrupted non-zero 64-bit
  * some machines have been found to have a corrupted non-zero 64-bit
- * address. Default is FALSE, do not favor the 32-bit addresses.
+ * address. Default is TRUE, favor the 32-bit addresses.
  */
  */
-ACPI_INIT_GLOBAL(u8, acpi_gbl_use32_bit_fadt_addresses, FALSE);
+ACPI_INIT_GLOBAL(u8, acpi_gbl_use32_bit_fadt_addresses, TRUE);
 
 
 /*
 /*
  * Optionally truncate I/O addresses to 16 bits. Provides compatibility
  * Optionally truncate I/O addresses to 16 bits. Provides compatibility

+ 5 - 2
drivers/acpi/acpica/tbutils.c

@@ -461,6 +461,7 @@ acpi_status __init acpi_tb_parse_root_table(acpi_physical_address rsdp_address)
 	u32 table_count;
 	u32 table_count;
 	struct acpi_table_header *table;
 	struct acpi_table_header *table;
 	acpi_physical_address address;
 	acpi_physical_address address;
+	acpi_physical_address rsdt_address;
 	u32 length;
 	u32 length;
 	u8 *table_entry;
 	u8 *table_entry;
 	acpi_status status;
 	acpi_status status;
@@ -488,11 +489,14 @@ acpi_status __init acpi_tb_parse_root_table(acpi_physical_address rsdp_address)
 		 * as per the ACPI specification.
 		 * as per the ACPI specification.
 		 */
 		 */
 		address = (acpi_physical_address) rsdp->xsdt_physical_address;
 		address = (acpi_physical_address) rsdp->xsdt_physical_address;
+		rsdt_address =
+		    (acpi_physical_address) rsdp->rsdt_physical_address;
 		table_entry_size = ACPI_XSDT_ENTRY_SIZE;
 		table_entry_size = ACPI_XSDT_ENTRY_SIZE;
 	} else {
 	} else {
 		/* Root table is an RSDT (32-bit physical addresses) */
 		/* Root table is an RSDT (32-bit physical addresses) */
 
 
 		address = (acpi_physical_address) rsdp->rsdt_physical_address;
 		address = (acpi_physical_address) rsdp->rsdt_physical_address;
+		rsdt_address = address;
 		table_entry_size = ACPI_RSDT_ENTRY_SIZE;
 		table_entry_size = ACPI_RSDT_ENTRY_SIZE;
 	}
 	}
 
 
@@ -515,8 +519,7 @@ acpi_status __init acpi_tb_parse_root_table(acpi_physical_address rsdp_address)
 
 
 			/* Fall back to the RSDT */
 			/* Fall back to the RSDT */
 
 
-			address =
-			    (acpi_physical_address) rsdp->rsdt_physical_address;
+			address = rsdt_address;
 			table_entry_size = ACPI_RSDT_ENTRY_SIZE;
 			table_entry_size = ACPI_RSDT_ENTRY_SIZE;
 		}
 		}
 	}
 	}

+ 328 - 1
drivers/acpi/battery.c

@@ -36,6 +36,12 @@
 #include <linux/suspend.h>
 #include <linux/suspend.h>
 #include <asm/unaligned.h>
 #include <asm/unaligned.h>
 
 
+#ifdef CONFIG_ACPI_PROCFS_POWER
+#include <linux/proc_fs.h>
+#include <linux/seq_file.h>
+#include <asm/uaccess.h>
+#endif
+
 #include <linux/acpi.h>
 #include <linux/acpi.h>
 #include <linux/power_supply.h>
 #include <linux/power_supply.h>
 
 
@@ -64,6 +70,19 @@ static unsigned int cache_time = 1000;
 module_param(cache_time, uint, 0644);
 module_param(cache_time, uint, 0644);
 MODULE_PARM_DESC(cache_time, "cache time in milliseconds");
 MODULE_PARM_DESC(cache_time, "cache time in milliseconds");
 
 
+#ifdef CONFIG_ACPI_PROCFS_POWER
+extern struct proc_dir_entry *acpi_lock_battery_dir(void);
+extern void *acpi_unlock_battery_dir(struct proc_dir_entry *acpi_battery_dir);
+
+enum acpi_battery_files {
+	info_tag = 0,
+	state_tag,
+	alarm_tag,
+	ACPI_BATTERY_NUMFILES,
+};
+
+#endif
+
 static const struct acpi_device_id battery_device_ids[] = {
 static const struct acpi_device_id battery_device_ids[] = {
 	{"PNP0C0A", 0},
 	{"PNP0C0A", 0},
 	{"", 0},
 	{"", 0},
@@ -299,6 +318,14 @@ static enum power_supply_property energy_battery_props[] = {
 	POWER_SUPPLY_PROP_SERIAL_NUMBER,
 	POWER_SUPPLY_PROP_SERIAL_NUMBER,
 };
 };
 
 
+#ifdef CONFIG_ACPI_PROCFS_POWER
+inline char *acpi_battery_units(struct acpi_battery *battery)
+{
+	return (battery->power_unit == ACPI_BATTERY_POWER_UNIT_MA) ?
+		"mA" : "mW";
+}
+#endif
+
 /* --------------------------------------------------------------------------
 /* --------------------------------------------------------------------------
                                Battery Management
                                Battery Management
    -------------------------------------------------------------------------- */
    -------------------------------------------------------------------------- */
@@ -716,6 +743,279 @@ static void acpi_battery_refresh(struct acpi_battery *battery)
 	sysfs_add_battery(battery);
 	sysfs_add_battery(battery);
 }
 }
 
 
+/* --------------------------------------------------------------------------
+                              FS Interface (/proc)
+   -------------------------------------------------------------------------- */
+
+#ifdef CONFIG_ACPI_PROCFS_POWER
+static struct proc_dir_entry *acpi_battery_dir;
+
+static int acpi_battery_print_info(struct seq_file *seq, int result)
+{
+	struct acpi_battery *battery = seq->private;
+
+	if (result)
+		goto end;
+
+	seq_printf(seq, "present:                 %s\n",
+		   acpi_battery_present(battery) ? "yes" : "no");
+	if (!acpi_battery_present(battery))
+		goto end;
+	if (battery->design_capacity == ACPI_BATTERY_VALUE_UNKNOWN)
+		seq_printf(seq, "design capacity:         unknown\n");
+	else
+		seq_printf(seq, "design capacity:         %d %sh\n",
+			   battery->design_capacity,
+			   acpi_battery_units(battery));
+
+	if (battery->full_charge_capacity == ACPI_BATTERY_VALUE_UNKNOWN)
+		seq_printf(seq, "last full capacity:      unknown\n");
+	else
+		seq_printf(seq, "last full capacity:      %d %sh\n",
+			   battery->full_charge_capacity,
+			   acpi_battery_units(battery));
+
+	seq_printf(seq, "battery technology:      %srechargeable\n",
+		   (!battery->technology)?"non-":"");
+
+	if (battery->design_voltage == ACPI_BATTERY_VALUE_UNKNOWN)
+		seq_printf(seq, "design voltage:          unknown\n");
+	else
+		seq_printf(seq, "design voltage:          %d mV\n",
+			   battery->design_voltage);
+	seq_printf(seq, "design capacity warning: %d %sh\n",
+		   battery->design_capacity_warning,
+		   acpi_battery_units(battery));
+	seq_printf(seq, "design capacity low:     %d %sh\n",
+		   battery->design_capacity_low,
+		   acpi_battery_units(battery));
+	seq_printf(seq, "cycle count:		  %i\n", battery->cycle_count);
+	seq_printf(seq, "capacity granularity 1:  %d %sh\n",
+		   battery->capacity_granularity_1,
+		   acpi_battery_units(battery));
+	seq_printf(seq, "capacity granularity 2:  %d %sh\n",
+		   battery->capacity_granularity_2,
+		   acpi_battery_units(battery));
+	seq_printf(seq, "model number:            %s\n", battery->model_number);
+	seq_printf(seq, "serial number:           %s\n", battery->serial_number);
+	seq_printf(seq, "battery type:            %s\n", battery->type);
+	seq_printf(seq, "OEM info:                %s\n", battery->oem_info);
+      end:
+	if (result)
+		seq_printf(seq, "ERROR: Unable to read battery info\n");
+	return result;
+}
+
+static int acpi_battery_print_state(struct seq_file *seq, int result)
+{
+	struct acpi_battery *battery = seq->private;
+
+	if (result)
+		goto end;
+
+	seq_printf(seq, "present:                 %s\n",
+		   acpi_battery_present(battery) ? "yes" : "no");
+	if (!acpi_battery_present(battery))
+		goto end;
+
+	seq_printf(seq, "capacity state:          %s\n",
+			(battery->state & 0x04) ? "critical" : "ok");
+	if ((battery->state & 0x01) && (battery->state & 0x02))
+		seq_printf(seq,
+			   "charging state:          charging/discharging\n");
+	else if (battery->state & 0x01)
+		seq_printf(seq, "charging state:          discharging\n");
+	else if (battery->state & 0x02)
+		seq_printf(seq, "charging state:          charging\n");
+	else
+		seq_printf(seq, "charging state:          charged\n");
+
+	if (battery->rate_now == ACPI_BATTERY_VALUE_UNKNOWN)
+		seq_printf(seq, "present rate:            unknown\n");
+	else
+		seq_printf(seq, "present rate:            %d %s\n",
+			   battery->rate_now, acpi_battery_units(battery));
+
+	if (battery->capacity_now == ACPI_BATTERY_VALUE_UNKNOWN)
+		seq_printf(seq, "remaining capacity:      unknown\n");
+	else
+		seq_printf(seq, "remaining capacity:      %d %sh\n",
+			   battery->capacity_now, acpi_battery_units(battery));
+	if (battery->voltage_now == ACPI_BATTERY_VALUE_UNKNOWN)
+		seq_printf(seq, "present voltage:         unknown\n");
+	else
+		seq_printf(seq, "present voltage:         %d mV\n",
+			   battery->voltage_now);
+      end:
+	if (result)
+		seq_printf(seq, "ERROR: Unable to read battery state\n");
+
+	return result;
+}
+
+static int acpi_battery_print_alarm(struct seq_file *seq, int result)
+{
+	struct acpi_battery *battery = seq->private;
+
+	if (result)
+		goto end;
+
+	if (!acpi_battery_present(battery)) {
+		seq_printf(seq, "present:                 no\n");
+		goto end;
+	}
+	seq_printf(seq, "alarm:                   ");
+	if (!battery->alarm)
+		seq_printf(seq, "unsupported\n");
+	else
+		seq_printf(seq, "%u %sh\n", battery->alarm,
+				acpi_battery_units(battery));
+      end:
+	if (result)
+		seq_printf(seq, "ERROR: Unable to read battery alarm\n");
+	return result;
+}
+
+static ssize_t acpi_battery_write_alarm(struct file *file,
+					const char __user * buffer,
+					size_t count, loff_t * ppos)
+{
+	int result = 0;
+	char alarm_string[12] = { '\0' };
+	struct seq_file *m = file->private_data;
+	struct acpi_battery *battery = m->private;
+
+	if (!battery || (count > sizeof(alarm_string) - 1))
+		return -EINVAL;
+	if (!acpi_battery_present(battery)) {
+		result = -ENODEV;
+		goto end;
+	}
+	if (copy_from_user(alarm_string, buffer, count)) {
+		result = -EFAULT;
+		goto end;
+	}
+	alarm_string[count] = '\0';
+	battery->alarm = simple_strtol(alarm_string, NULL, 0);
+	result = acpi_battery_set_alarm(battery);
+      end:
+	if (!result)
+		return count;
+	return result;
+}
+
+typedef int(*print_func)(struct seq_file *seq, int result);
+
+static print_func acpi_print_funcs[ACPI_BATTERY_NUMFILES] = {
+	acpi_battery_print_info,
+	acpi_battery_print_state,
+	acpi_battery_print_alarm,
+};
+
+static int acpi_battery_read(int fid, struct seq_file *seq)
+{
+	struct acpi_battery *battery = seq->private;
+	int result = acpi_battery_update(battery);
+	return acpi_print_funcs[fid](seq, result);
+}
+
+#define DECLARE_FILE_FUNCTIONS(_name) \
+static int acpi_battery_read_##_name(struct seq_file *seq, void *offset) \
+{ \
+	return acpi_battery_read(_name##_tag, seq); \
+} \
+static int acpi_battery_##_name##_open_fs(struct inode *inode, struct file *file) \
+{ \
+	return single_open(file, acpi_battery_read_##_name, PDE_DATA(inode)); \
+}
+
+DECLARE_FILE_FUNCTIONS(info);
+DECLARE_FILE_FUNCTIONS(state);
+DECLARE_FILE_FUNCTIONS(alarm);
+
+#undef DECLARE_FILE_FUNCTIONS
+
+#define FILE_DESCRIPTION_RO(_name) \
+	{ \
+	.name = __stringify(_name), \
+	.mode = S_IRUGO, \
+	.ops = { \
+		.open = acpi_battery_##_name##_open_fs, \
+		.read = seq_read, \
+		.llseek = seq_lseek, \
+		.release = single_release, \
+		.owner = THIS_MODULE, \
+		}, \
+	}
+
+#define FILE_DESCRIPTION_RW(_name) \
+	{ \
+	.name = __stringify(_name), \
+	.mode = S_IFREG | S_IRUGO | S_IWUSR, \
+	.ops = { \
+		.open = acpi_battery_##_name##_open_fs, \
+		.read = seq_read, \
+		.llseek = seq_lseek, \
+		.write = acpi_battery_write_##_name, \
+		.release = single_release, \
+		.owner = THIS_MODULE, \
+		}, \
+	}
+
+static const struct battery_file {
+	struct file_operations ops;
+	umode_t mode;
+	const char *name;
+} acpi_battery_file[] = {
+	FILE_DESCRIPTION_RO(info),
+	FILE_DESCRIPTION_RO(state),
+	FILE_DESCRIPTION_RW(alarm),
+};
+
+#undef FILE_DESCRIPTION_RO
+#undef FILE_DESCRIPTION_RW
+
+static int acpi_battery_add_fs(struct acpi_device *device)
+{
+	struct proc_dir_entry *entry = NULL;
+	int i;
+
+	printk(KERN_WARNING PREFIX "Deprecated procfs I/F for battery is loaded,"
+			" please retry with CONFIG_ACPI_PROCFS_POWER cleared\n");
+	if (!acpi_device_dir(device)) {
+		acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device),
+						     acpi_battery_dir);
+		if (!acpi_device_dir(device))
+			return -ENODEV;
+	}
+
+	for (i = 0; i < ACPI_BATTERY_NUMFILES; ++i) {
+		entry = proc_create_data(acpi_battery_file[i].name,
+					 acpi_battery_file[i].mode,
+					 acpi_device_dir(device),
+					 &acpi_battery_file[i].ops,
+					 acpi_driver_data(device));
+		if (!entry)
+			return -ENODEV;
+	}
+	return 0;
+}
+
+static void acpi_battery_remove_fs(struct acpi_device *device)
+{
+	int i;
+	if (!acpi_device_dir(device))
+		return;
+	for (i = 0; i < ACPI_BATTERY_NUMFILES; ++i)
+		remove_proc_entry(acpi_battery_file[i].name,
+				  acpi_device_dir(device));
+
+	remove_proc_entry(acpi_device_bid(device), acpi_battery_dir);
+	acpi_device_dir(device) = NULL;
+}
+
+#endif
+
 /* --------------------------------------------------------------------------
 /* --------------------------------------------------------------------------
                                  Driver Interface
                                  Driver Interface
    -------------------------------------------------------------------------- */
    -------------------------------------------------------------------------- */
@@ -790,6 +1090,15 @@ static int acpi_battery_add(struct acpi_device *device)
 	result = acpi_battery_update(battery);
 	result = acpi_battery_update(battery);
 	if (result)
 	if (result)
 		goto fail;
 		goto fail;
+#ifdef CONFIG_ACPI_PROCFS_POWER
+	result = acpi_battery_add_fs(device);
+#endif
+	if (result) {
+#ifdef CONFIG_ACPI_PROCFS_POWER
+		acpi_battery_remove_fs(device);
+#endif
+		goto fail;
+	}
 
 
 	printk(KERN_INFO PREFIX "%s Slot [%s] (battery %s)\n",
 	printk(KERN_INFO PREFIX "%s Slot [%s] (battery %s)\n",
 		ACPI_BATTERY_DEVICE_NAME, acpi_device_bid(device),
 		ACPI_BATTERY_DEVICE_NAME, acpi_device_bid(device),
@@ -816,6 +1125,9 @@ static int acpi_battery_remove(struct acpi_device *device)
 		return -EINVAL;
 		return -EINVAL;
 	battery = acpi_driver_data(device);
 	battery = acpi_driver_data(device);
 	unregister_pm_notifier(&battery->pm_nb);
 	unregister_pm_notifier(&battery->pm_nb);
+#ifdef CONFIG_ACPI_PROCFS_POWER
+	acpi_battery_remove_fs(device);
+#endif
 	sysfs_remove_battery(battery);
 	sysfs_remove_battery(battery);
 	mutex_destroy(&battery->lock);
 	mutex_destroy(&battery->lock);
 	mutex_destroy(&battery->sysfs_lock);
 	mutex_destroy(&battery->sysfs_lock);
@@ -866,7 +1178,19 @@ static void __init acpi_battery_init_async(void *unused, async_cookie_t cookie)
 
 
 	if (dmi_check_system(bat_dmi_table))
 	if (dmi_check_system(bat_dmi_table))
 		battery_bix_broken_package = 1;
 		battery_bix_broken_package = 1;
-	acpi_bus_register_driver(&acpi_battery_driver);
+	
+#ifdef CONFIG_ACPI_PROCFS_POWER
+	acpi_battery_dir = acpi_lock_battery_dir();
+	if (!acpi_battery_dir)
+		return;
+#endif
+	if (acpi_bus_register_driver(&acpi_battery_driver) < 0) {
+#ifdef CONFIG_ACPI_PROCFS_POWER
+		acpi_unlock_battery_dir(acpi_battery_dir);
+#endif
+		return;
+	}
+	return;
 }
 }
 
 
 static int __init acpi_battery_init(void)
 static int __init acpi_battery_init(void)
@@ -878,6 +1202,9 @@ static int __init acpi_battery_init(void)
 static void __exit acpi_battery_exit(void)
 static void __exit acpi_battery_exit(void)
 {
 {
 	acpi_bus_unregister_driver(&acpi_battery_driver);
 	acpi_bus_unregister_driver(&acpi_battery_driver);
+#ifdef CONFIG_ACPI_PROCFS_POWER
+	acpi_unlock_battery_dir(acpi_battery_dir);
+#endif
 }
 }
 
 
 module_init(acpi_battery_init);
 module_init(acpi_battery_init);

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