History

Merge tag 'omap-for-v3.13/intc-ldp-fix' of git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap into fixes

From Tony Lindgren: Fix a regression for wrong interrupt numbers for some devices after the sparse IRQ conversion, fix DRA7 console output for earlyprintk, and fix the LDP LCD backlight when DSS is built into the kernel and not as a loadable module. * tag 'omap-for-v3.13/intc-ldp-fix' of git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap: ARM: OMAP2+: Fix LCD panel backlight regression for LDP legacy booting ARM: OMAP2+: hwmod_data: fix missing OMAP_INTC_START in irq data ARM: DRA7: hwmod: Fix boot crash with DEBUG_LL + v3.13-rc5

Olof Johansson committed 12 years ago

Commit 9b17c162 parents 4cff612 82f4fe7217 files · +2035 −1092Browse files

Unified · Split

217 files
  1. Documentation/module-signing.txt +240 −0
  2. Documentation/networking/ip-sysctl.txt +6 −2
  3. MAINTAINERS +21 −4
  4. Makefile +10 −14
  5. arch/arc/include/uapi/asm/unistd.h +7 −1
  6. arch/arm/mach-omap2/board-ldp.c +6 −1
  7. arch/arm/mach-omap2/omap_hwmod_2xxx_ipblock_data.c +2 −2
  8. arch/arm/mach-omap2/omap_hwmod_3xxx_data.c +3 −3
  9. arch/arm/mach-omap2/omap_hwmod_7xx_data.c +1 −1
  10. arch/arm/xen/enlighten.c +3 −3
  11. arch/arm64/include/asm/xen/page-coherent.h +0 −4
  12. arch/arm64/kernel/ptrace.c +18 −20
  13. arch/powerpc/include/asm/kvm_book3s.h +4 −0
  14. arch/powerpc/include/asm/kvm_book3s_asm.h +2 −0
  15. arch/powerpc/include/asm/opal.h +2 −2
  16. arch/powerpc/include/asm/switch_to.h +1 −1
  17. arch/powerpc/kernel/asm-offsets.c +1 −0
  18. arch/powerpc/kernel/crash_dump.c +3 −3
  19. arch/powerpc/kernel/process.c +16 −16
  20. arch/powerpc/kernel/ptrace.c +2 −2
  21. arch/powerpc/kernel/setup-common.c +2 −2
  22. arch/powerpc/kernel/smp.c +2 −2
  23. arch/powerpc/kvm/book3s_64_mmu_hv.c +14 −4
  24. arch/powerpc/kvm/book3s_hv.c +14 −10
  25. arch/powerpc/kvm/book3s_hv_rm_mmu.c +7 −2
  26. arch/powerpc/kvm/book3s_hv_rmhandlers.S +13 −10
  27. arch/powerpc/kvm/book3s_interrupts.S +11 −8
  28. arch/powerpc/kvm/book3s_pr.c +22 −0
  29. arch/powerpc/kvm/book3s_rmhandlers.S +1 −5
  30. arch/powerpc/kvm/booke.c +6 −6
  31. arch/powerpc/platforms/powernv/opal-lpc.c +6 −6
  32. arch/powerpc/platforms/powernv/opal-xscom.c +3 −1
  33. arch/powerpc/platforms/pseries/lparcfg.c +6 −6
  34. arch/powerpc/platforms/pseries/msi.c +15 −13
  35. arch/powerpc/platforms/pseries/nvram.c +23 −23
  36. arch/powerpc/platforms/pseries/pci.c +4 −4
  37. arch/sh/lib/Makefile +1 −1
  38. arch/sparc/include/asm/pgtable_64.h +2 −2
  39. arch/x86/Kconfig +1 −0
  40. arch/x86/include/asm/pgtable.h +9 −2
  41. arch/x86/include/asm/preempt.h +11 −0
  42. arch/x86/kernel/cpu/perf_event.h +12 −3
  43. arch/x86/mm/gup.c +13 −0
  44. drivers/acpi/apei/erst.c +1 −0
  45. drivers/clk/clk-s2mps11.c +3 −3
  46. drivers/clocksource/Kconfig +1 −0
  47. drivers/clocksource/clksrc-of.c +0 −1
  48. drivers/clocksource/dw_apb_timer_of.c +4 −3
  49. drivers/clocksource/sun4i_timer.c +3 −0
  50. drivers/clocksource/time-armada-370-xp.c +5 −5
  51. drivers/dma/Kconfig +7 −0
  52. drivers/dma/at_hdmac_regs.h +0 −4
  53. drivers/dma/dmaengine.c +2 −2
  54. drivers/dma/dmatest.c +4 −4
  55. drivers/dma/fsldma.c +1 −30
  56. drivers/dma/mv_xor.c +63 −38
  57. drivers/dma/pl330.c +1 −4
  58. drivers/dma/ppc4xx/adma.c +1 −26
  59. drivers/dma/txx9dmac.c +0 −1
  60. drivers/firewire/sbp2.c +0 −1
  61. drivers/firmware/efi/efi-pstore.c +1 −0
  62. drivers/gpio/gpio-msm-v2.c +2 −2
  63. drivers/gpio/gpio-rcar.c +2 −1
  64. drivers/gpio/gpio-twl4030.c +12 −3
  65. drivers/gpu/drm/armada/armada_drm.h +1 −0
  66. drivers/gpu/drm/armada/armada_drv.c +6 −1
  67. drivers/gpu/drm/armada/armada_fbdev.c +15 −5
  68. drivers/gpu/drm/armada/armada_gem.c +4 −3
  69. drivers/gpu/drm/drm_edid.c +8 −0
  70. drivers/gpu/drm/drm_stub.c +3 −3
  71. drivers/gpu/drm/i915/i915_dma.c +11 −9
  72. drivers/gpu/drm/i915/i915_drv.c +1 −0
  73. drivers/gpu/drm/i915/i915_drv.h +6 −3
  74. drivers/gpu/drm/i915/i915_gem_context.c +12 −4
  75. drivers/gpu/drm/i915/i915_gem_evict.c +11 −3
  76. drivers/gpu/drm/i915/i915_gem_gtt.c +7 −2
  77. drivers/gpu/drm/i915/intel_display.c +4 −3
  78. drivers/gpu/drm/i915/intel_drv.h +1 −0
  79. drivers/gpu/drm/i915/intel_panel.c +23 −3
  80. drivers/gpu/drm/i915/intel_pm.c +27 −2
  81. drivers/gpu/drm/i915/intel_ringbuffer.c +1 −0
  82. drivers/gpu/drm/i915/intel_uncore.c +1 −0
  83. drivers/gpu/drm/nouveau/nouveau_drm.c +6 −0
  84. drivers/gpu/drm/radeon/atombios_crtc.c +3 −1
  85. drivers/gpu/drm/radeon/cik_sdma.c +1 −1
  86. drivers/gpu/drm/radeon/radeon_asic.c +2 −2
  87. drivers/gpu/drm/radeon/radeon_drv.c +0 −10
  88. drivers/gpu/drm/radeon/rs690.c +10 −0
  89. drivers/gpu/drm/ttm/ttm_bo_vm.c +3 −3
  90. drivers/gpu/drm/vmwgfx/vmwgfx_ioctl.c +3 −0
  91. drivers/iio/adc/ad7887.c +14 −2
  92. drivers/iio/imu/adis16400_core.c +6 −1
  93. drivers/iio/light/cm36651.c +1 −1
  94. drivers/infiniband/ulp/isert/ib_isert.c +16 −6
  95. drivers/net/can/usb/ems_usb.c +2 −1
  96. drivers/net/can/usb/peak_usb/pcan_usb_pro.c +3 −0
  97. drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c +21 −26
  98. drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.h +1 −0
  99. drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_init.c +40 −25
  100. drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c +8 −11
  101. drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c +2 −8
  102. drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c +1 −1
  103. drivers/net/hyperv/netvsc_drv.c +0 −1
  104. drivers/net/xen-netback/netback.c +3 −0
  105. drivers/phy/Kconfig +2 −2
  106. drivers/phy/phy-core.c +10 −16
  107. drivers/pinctrl/sh-pfc/sh_pfc.h +1 −1
  108. drivers/regulator/s2mps11.c +1 −1
  109. drivers/scsi/qla2xxx/qla_target.c +6 −4
  110. drivers/staging/comedi/drivers.c +1 −1
  111. drivers/staging/comedi/drivers/8255_pci.c +12 −3
  112. drivers/staging/iio/magnetometer/hmc5843.c +6 −1
  113. drivers/staging/imx-drm/imx-drm-core.c +29 −10
  114. drivers/staging/imx-drm/imx-tve.c +0 −9
  115. drivers/staging/imx-drm/ipu-v3/ipu-common.c +16 −16
  116. drivers/target/iscsi/iscsi_target.c +13 −14
  117. drivers/target/iscsi/iscsi_target_configfs.c +2 −1
  118. drivers/target/iscsi/iscsi_target_login.c +0 −6
  119. drivers/target/target_core_device.c +5 −0
  120. drivers/target/target_core_file.c +4 −4
  121. drivers/target/target_core_file.h +4 −1
  122. drivers/target/target_core_tpg.c +1 −9
  123. drivers/tty/n_tty.c +6 −1
  124. drivers/tty/serial/8250/8250_dw.c +6 −2
  125. drivers/tty/serial/xilinx_uartps.c +2 −0
  126. drivers/tty/tty_ldsem.c +13 −3
  127. drivers/usb/chipidea/core.c +4 −0
  128. drivers/usb/chipidea/host.c +2 −1
  129. drivers/usb/chipidea/udc.c +0 −3
  130. drivers/usb/class/cdc-wdm.c +3 −5
  131. drivers/usb/dwc3/core.c +5 −3
  132. drivers/usb/host/ohci-at91.c +15 −11
  133. drivers/usb/host/xhci-pci.c +6 −1
  134. drivers/usb/phy/Kconfig +3 −1
  135. drivers/usb/phy/phy-tegra-usb.c +1 −1
  136. drivers/usb/phy/phy-twl6030-usb.c +2 −1
  137. drivers/usb/serial/option.c +2 −0
  138. drivers/usb/serial/zte_ev.c +1 −2
  139. drivers/xen/balloon.c +34 −29
  140. drivers/xen/grant-table.c +2 −1
  141. drivers/xen/privcmd.c +7 −2
  142. fs/aio.c +69 −44
  143. fs/ceph/addr.c +6 −2
  144. fs/ceph/inode.c +58 −78
  145. fs/pstore/platform.c +5 −2
  146. fs/sysfs/file.c +3 −5
  147. fs/xfs/xfs_bmap.c +24 −8
  148. fs/xfs/xfs_bmap_util.c +12 −2
  149. fs/xfs/xfs_buf.c +14 −23
  150. fs/xfs/xfs_buf.h +7 −4
  151. fs/xfs/xfs_buf_item.c +19 −2
  152. fs/xfs/xfs_dir2_node.c +13 −13
  153. fs/xfs/xfs_iops.c +2 −1
  154. fs/xfs/xfs_log_recover.c +11 −2
  155. fs/xfs/xfs_qm.c +53 −27
  156. fs/xfs/xfs_trans_buf.c +12 −1
  157. include/asm-generic/pgtable.h +3 −4
  158. include/asm-generic/preempt.h +11 −24
  159. include/linux/lockref.h +1 −1
  160. include/linux/math64.h +30 −0
  161. include/linux/migrate.h +11 −1
  162. include/linux/mm.h +3 −3
  163. include/linux/mm_types.h +51 −1
  164. include/linux/pstore.h +3 −0
  165. include/linux/reboot.h +1 −0
  166. include/linux/sched.h +2 −3
  167. include/target/target_core_base.h +1 −4
  168. include/uapi/drm/vmwgfx_drm.h +1 −0
  169. include/uapi/linux/perf_event.h +1 −0
  170. include/xen/interface/io/blkif.h +5 −5
  171. init/Kconfig +6 −0
  172. kernel/Makefile +4 −3
  173. kernel/bounds.c +1 −1
  174. kernel/events/core.c +18 −3
  175. kernel/fork.c +1 −0
  176. kernel/kexec.c +1 −0
  177. kernel/reboot.c +1 −1
  178. kernel/sched/core.c +4 −2
  179. kernel/sched/fair.c +71 −80
  180. kernel/sched/rt.c +14 −0
  181. kernel/trace/ftrace.c +1 −1
  182. kernel/user.c +3 −3
  183. mm/Kconfig +1 −1
  184. mm/compaction.c +4 −0
  185. mm/huge_memory.c +36 −9
  186. mm/memory-failure.c +10 −4
  187. mm/memory.c +1 −1
  188. mm/mempolicy.c +9 −7
  189. mm/migrate.c +65 −17
  190. mm/mprotect.c +11 −2
  191. mm/page_alloc.c +9 −10
  192. mm/pgtable-generic.c +6 −2
  193. mm/rmap.c +4 −0
  194. net/core/neighbour.c +1 −0
  195. net/ipv4/netfilter/ipt_SYNPROXY.c +1 −0
  196. net/ipv4/netfilter/nft_reject_ipv4.c +1 −1
  197. net/ipv4/udp.c +4 −9
  198. net/ipv6/netfilter/ip6t_SYNPROXY.c +1 −0
  199. net/sctp/probe.c +16 −1
  200. net/unix/af_unix.c +6 −2
  201. sound/core/pcm_lib.c +2 −0
  202. sound/pci/hda/hda_intel.c +4 −0
  203. sound/pci/hda/patch_realtek.c +4 −0
  204. sound/soc/atmel/atmel_ssc_dai.c +29 −1
  205. sound/soc/atmel/sam9x5_wm8731.c +1 −1
  206. sound/soc/codecs/wm5110.c +1 −1
  207. sound/soc/codecs/wm8904.c +1 −1
  208. sound/soc/codecs/wm8962.c +13 −0
  209. sound/soc/codecs/wm_adsp.c +7 −3
  210. sound/soc/fsl/imx-wm8962.c +0 −2
  211. sound/soc/kirkwood/kirkwood-i2s.c +12 −12
  212. sound/soc/soc-generic-dmaengine-pcm.c +27 −11
  213. sound/soc/soc-pcm.c +3 −2
  214. sound/soc/tegra/tegra20_i2s.c +3 −3
  215. sound/soc/tegra/tegra20_spdif.c +5 −5
  216. sound/soc/tegra/tegra30_i2s.c +3 −3
  217. tools/power/cpupower/utils/cpupower-set.c +3 −3
Documentation/module-signing.txt+240−0
@@ -0,0 +1,240 @@
1+ ==============================
2+ KERNEL MODULE SIGNING FACILITY
3+ ==============================
4+
5+CONTENTS
6+
7+ - Overview.
8+ - Configuring module signing.
9+ - Generating signing keys.
10+ - Public keys in the kernel.
11+ - Manually signing modules.
12+ - Signed modules and stripping.
13+ - Loading signed modules.
14+ - Non-valid signatures and unsigned modules.
15+ - Administering/protecting the private key.
16+
17+
18+========
19+OVERVIEW
20+========
21+
22+The kernel module signing facility cryptographically signs modules during
23+installation and then checks the signature upon loading the module. This
24+allows increased kernel security by disallowing the loading of unsigned modules
25+or modules signed with an invalid key. Module signing increases security by
26+making it harder to load a malicious module into the kernel. The module
27+signature checking is done by the kernel so that it is not necessary to have
28+trusted userspace bits.
29+
30+This facility uses X.509 ITU-T standard certificates to encode the public keys
31+involved. The signatures are not themselves encoded in any industrial standard
32+type. The facility currently only supports the RSA public key encryption
33+standard (though it is pluggable and permits others to be used). The possible
34+hash algorithms that can be used are SHA-1, SHA-224, SHA-256, SHA-384, and
35+SHA-512 (the algorithm is selected by data in the signature).
36+
37+
38+==========================
39+CONFIGURING MODULE SIGNING
40+==========================
41+
42+The module signing facility is enabled by going to the "Enable Loadable Module
43+Support" section of the kernel configuration and turning on
44+
45+ CONFIG_MODULE_SIG "Module signature verification"
46+
47+This has a number of options available:
48+
49+ (1) "Require modules to be validly signed" (CONFIG_MODULE_SIG_FORCE)
50+
51+ This specifies how the kernel should deal with a module that has a
52+ signature for which the key is not known or a module that is unsigned.
53+
54+ If this is off (ie. "permissive"), then modules for which the key is not
55+ available and modules that are unsigned are permitted, but the kernel will
56+ be marked as being tainted.
57+
58+ If this is on (ie. "restrictive"), only modules that have a valid
59+ signature that can be verified by a public key in the kernel's possession
60+ will be loaded. All other modules will generate an error.
61+
62+ Irrespective of the setting here, if the module has a signature block that
63+ cannot be parsed, it will be rejected out of hand.
64+
65+
66+ (2) "Automatically sign all modules" (CONFIG_MODULE_SIG_ALL)
67+
68+ If this is on then modules will be automatically signed during the
69+ modules_install phase of a build. If this is off, then the modules must
70+ be signed manually using:
71+
72+ scripts/sign-file
73+
74+
75+ (3) "Which hash algorithm should modules be signed with?"
76+
77+ This presents a choice of which hash algorithm the installation phase will
78+ sign the modules with:
79+
80+ CONFIG_SIG_SHA1 "Sign modules with SHA-1"
81+ CONFIG_SIG_SHA224 "Sign modules with SHA-224"
82+ CONFIG_SIG_SHA256 "Sign modules with SHA-256"
83+ CONFIG_SIG_SHA384 "Sign modules with SHA-384"
84+ CONFIG_SIG_SHA512 "Sign modules with SHA-512"
85+
86+ The algorithm selected here will also be built into the kernel (rather
87+ than being a module) so that modules signed with that algorithm can have
88+ their signatures checked without causing a dependency loop.
89+
90+
91+=======================
92+GENERATING SIGNING KEYS
93+=======================
94+
95+Cryptographic keypairs are required to generate and check signatures. A
96+private key is used to generate a signature and the corresponding public key is
97+used to check it. The private key is only needed during the build, after which
98+it can be deleted or stored securely. The public key gets built into the
99+kernel so that it can be used to check the signatures as the modules are
100+loaded.
101+
102+Under normal conditions, the kernel build will automatically generate a new
103+keypair using openssl if one does not exist in the files:
104+
105+ signing_key.priv
106+ signing_key.x509
107+
108+during the building of vmlinux (the public part of the key needs to be built
109+into vmlinux) using parameters in the:
110+
111+ x509.genkey
112+
113+file (which is also generated if it does not already exist).
114+
115+It is strongly recommended that you provide your own x509.genkey file.
116+
117+Most notably, in the x509.genkey file, the req_distinguished_name section
118+should be altered from the default:
119+
120+ [ req_distinguished_name ]
121+ O = Magrathea
122+ CN = Glacier signing key
123+ emailAddress = slartibartfast@magrathea.h2g2
124+
125+The generated RSA key size can also be set with:
126+
127+ [ req ]
128+ default_bits = 4096
129+
130+
131+It is also possible to manually generate the key private/public files using the
132+x509.genkey key generation configuration file in the root node of the Linux
133+kernel sources tree and the openssl command. The following is an example to
134+generate the public/private key files:
135+
136+ openssl req -new -nodes -utf8 -sha256 -days 36500 -batch -x509 \
137+ -config x509.genkey -outform DER -out signing_key.x509 \
138+ -keyout signing_key.priv
139+
140+
141+=========================
142+PUBLIC KEYS IN THE KERNEL
143+=========================
144+
145+The kernel contains a ring of public keys that can be viewed by root. They're
146+in a keyring called ".system_keyring" that can be seen by:
147+
148+ [root@deneb ~]# cat /proc/keys
149+ ...
150+ 223c7853 I------ 1 perm 1f030000 0 0 keyring .system_keyring: 1
151+ 302d2d52 I------ 1 perm 1f010000 0 0 asymmetri Fedora kernel signing key: d69a84e6bce3d216b979e9505b3e3ef9a7118079: X509.RSA a7118079 []
152+ ...
153+
154+Beyond the public key generated specifically for module signing, any file
155+placed in the kernel source root directory or the kernel build root directory
156+whose name is suffixed with ".x509" will be assumed to be an X.509 public key
157+and will be added to the keyring.
158+
159+Further, the architecture code may take public keys from a hardware store and
160+add those in also (e.g. from the UEFI key database).
161+
162+Finally, it is possible to add additional public keys by doing:
163+
164+ keyctl padd asymmetric "" [.system_keyring-ID] <[key-file]
165+
166+e.g.:
167+
168+ keyctl padd asymmetric "" 0x223c7853 <my_public_key.x509
169+
170+Note, however, that the kernel will only permit keys to be added to
171+.system_keyring _if_ the new key's X.509 wrapper is validly signed by a key
172+that is already resident in the .system_keyring at the time the key was added.
173+
174+
175+=========================
176+MANUALLY SIGNING MODULES
177+=========================
178+
179+To manually sign a module, use the scripts/sign-file tool available in
180+the Linux kernel source tree. The script requires 4 arguments:
181+
182+ 1. The hash algorithm (e.g., sha256)
183+ 2. The private key filename
184+ 3. The public key filename
185+ 4. The kernel module to be signed
186+
187+The following is an example to sign a kernel module:
188+
189+ scripts/sign-file sha512 kernel-signkey.priv \
190+ kernel-signkey.x509 module.ko
191+
192+The hash algorithm used does not have to match the one configured, but if it
193+doesn't, you should make sure that hash algorithm is either built into the
194+kernel or can be loaded without requiring itself.
195+
196+
197+============================
198+SIGNED MODULES AND STRIPPING
199+============================
200+
201+A signed module has a digital signature simply appended at the end. The string
202+"~Module signature appended~." at the end of the module's file confirms that a
203+signature is present but it does not confirm that the signature is valid!
204+
205+Signed modules are BRITTLE as the signature is outside of the defined ELF
206+container. Thus they MAY NOT be stripped once the signature is computed and
207+attached. Note the entire module is the signed payload, including any and all
208+debug information present at the time of signing.
209+
210+
211+======================
212+LOADING SIGNED MODULES
213+======================
214+
215+Modules are loaded with insmod, modprobe, init_module() or finit_module(),
216+exactly as for unsigned modules as no processing is done in userspace. The
217+signature checking is all done within the kernel.
218+
219+
220+=========================================
221+NON-VALID SIGNATURES AND UNSIGNED MODULES
222+=========================================
223+
224+If CONFIG_MODULE_SIG_FORCE is enabled or enforcemodulesig=1 is supplied on
225+the kernel command line, the kernel will only load validly signed modules
226+for which it has a public key. Otherwise, it will also load modules that are
227+unsigned. Any module for which the kernel has a key, but which proves to have
228+a signature mismatch will not be permitted to load.
229+
230+Any module that has an unparseable signature will be rejected.
231+
232+
233+=========================================
234+ADMINISTERING/PROTECTING THE PRIVATE KEY
235+=========================================
236+
237+Since the private key is used to sign modules, viruses and malware could use
238+the private key to sign modules and compromise the operating system. The
239+private key must be either destroyed or moved to a secure location and not kept
240+in the root node of the kernel source tree.
Documentation/networking/ip-sysctl.txt+6−2
@@ -16,8 +16,12 @@ ip_default_ttl - INTEGER · 15 unmodified lines
1616 Default: 64 (as recommended by RFC1700)
1717
1818 ip_no_pmtu_disc - BOOLEAN
19− Disable Path MTU Discovery.
20− default FALSE
19+ Disable Path MTU Discovery. If enabled and a
20+ fragmentation-required ICMP is received, the PMTU to this
21+ destination will be set to min_pmtu (see below). You will need
22+ to raise min_pmtu to the smallest interface MTU on your system
23+ manually if you want to avoid locally generated fragments.
24+ Default: FALSE
2125
2226 min_pmtu - INTEGER
2327 default 552 - minimum discovered Path MTU
MAINTAINERS+21−4
@@ -3763,9 +3763,11 @@ F: include/uapi/linux/gigaset_dev.h · 3762 unmodified lines
37633763
37643764 GPIO SUBSYSTEM
37653765 M: Linus Walleij <linus.walleij@linaro.org>
3766−S: Maintained
3766+M: Alexandre Courbot <gnurou@gmail.com>
37673767 L: linux-gpio@vger.kernel.org
3768−F: Documentation/gpio.txt
3768+T: git git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio.git
3769+S: Maintained
3770+F: Documentation/gpio/
37693771 F: drivers/gpio/
37703772 F: include/linux/gpio*
37713773 F: include/asm-generic/gpio.h
@@ -3833,6 +3835,12 @@ T: git git://linuxtv.org/media_tree.git · 61 unmodified lines
38333835 S: Maintained
38343836 F: drivers/media/usb/gspca/
38353837
3838+GUID PARTITION TABLE (GPT)
3839+M: Davidlohr Bueso <davidlohr@hp.com>
3840+L: linux-efi@vger.kernel.org
3841+S: Maintained
3842+F: block/partitions/efi.*
3843+
38363844 STK1160 USB VIDEO CAPTURE DRIVER
38373845 M: Ezequiel Garcia <elezegarcia@gmail.com>
38383846 L: linux-media@vger.kernel.org
@@ -5913,12 +5921,21 @@ M: Steffen Klassert <steffen.klassert@secunet.com> · 2074 unmodified lines
59135921 M: Herbert Xu <herbert@gondor.apana.org.au>
59145922 M: "David S. Miller" <davem@davemloft.net>
59155923 L: netdev@vger.kernel.org
5916−T: git git://git.kernel.org/pub/scm/linux/kernel/git/davem/net.git
5924+T: git git://git.kernel.org/pub/scm/linux/kernel/git/klassert/ipsec.git
5925+T: git git://git.kernel.org/pub/scm/linux/kernel/git/klassert/ipsec-next.git
59175926 S: Maintained
59185927 F: net/xfrm/
59195928 F: net/key/
59205929 F: net/ipv4/xfrm*
5930+F: net/ipv4/esp4.c
5931+F: net/ipv4/ah4.c
5932+F: net/ipv4/ipcomp.c
5933+F: net/ipv4/ip_vti.c
59215934 F: net/ipv6/xfrm*
5935+F: net/ipv6/esp6.c
5936+F: net/ipv6/ah6.c
5937+F: net/ipv6/ipcomp6.c
5938+F: net/ipv6/ip6_vti.c
59225939 F: include/uapi/linux/xfrm.h
59235940 F: include/net/xfrm.h
59245941
@@ -9573,7 +9590,7 @@ F: drivers/xen/*swiotlb* · 3648 unmodified lines
95739590
95749591 XFS FILESYSTEM
95759592 P: Silicon Graphics Inc
9576−M: Dave Chinner <dchinner@fromorbit.com>
9593+M: Dave Chinner <david@fromorbit.com>
95779594 M: Ben Myers <bpm@sgi.com>
95789595 M: xfs@oss.sgi.com
95799596 L: xfs@oss.sgi.com
Makefile+10−14
@@ -1,7 +1,7 @@
11 VERSION = 3
22 PATCHLEVEL = 13
33 SUBLEVEL = 0
4−EXTRAVERSION = -rc4
4+EXTRAVERSION = -rc5
55 NAME = One Giant Leap for Frogkind
66
77 # *DOCUMENTATION*
@@ -732,19 +732,15 @@ export mod_strip_cmd · 724 unmodified lines
732732 # Select initial ramdisk compression format, default is gzip(1).
733733 # This shall be used by the dracut(8) tool while creating an initramfs image.
734734 #
735−INITRD_COMPRESS=gzip
736−ifeq ($(CONFIG_RD_BZIP2), y)
737− INITRD_COMPRESS=bzip2
738−else ifeq ($(CONFIG_RD_LZMA), y)
739− INITRD_COMPRESS=lzma
740−else ifeq ($(CONFIG_RD_XZ), y)
741− INITRD_COMPRESS=xz
742−else ifeq ($(CONFIG_RD_LZO), y)
743− INITRD_COMPRESS=lzo
744−else ifeq ($(CONFIG_RD_LZ4), y)
745− INITRD_COMPRESS=lz4
746−endif
747−export INITRD_COMPRESS
735+INITRD_COMPRESS-y := gzip
736+INITRD_COMPRESS-$(CONFIG_RD_BZIP2) := bzip2
737+INITRD_COMPRESS-$(CONFIG_RD_LZMA) := lzma
738+INITRD_COMPRESS-$(CONFIG_RD_XZ) := xz
739+INITRD_COMPRESS-$(CONFIG_RD_LZO) := lzo
740+INITRD_COMPRESS-$(CONFIG_RD_LZ4) := lz4
741+# do not export INITRD_COMPRESS, since we didn't actually
742+# choose a sane default compression above.
743+# export INITRD_COMPRESS := $(INITRD_COMPRESS-y)
748744
749745 ifdef CONFIG_MODULE_SIG_ALL
750746 MODSECKEY = ./signing_key.priv
arch/arc/include/uapi/asm/unistd.h+7−1
@@ -8,7 +8,11 @@ · 7 unmodified lines
88
99 /******** no-legacy-syscalls-ABI *******/
1010
11−#ifndef _UAPI_ASM_ARC_UNISTD_H
11+/*
12+ * Non-typical guard macro to enable inclusion twice in ARCH sys.c
13+ * That is how the Generic syscall wrapper generator works
14+ */
15+#if !defined(_UAPI_ASM_ARC_UNISTD_H) || defined(__SYSCALL)
1216 #define _UAPI_ASM_ARC_UNISTD_H
1317
1418 #define __ARCH_WANT_SYS_EXECVE
@@ -36,4 +40,6 @@ __SYSCALL(__NR_arc_gettls, sys_arc_gettls) · 21 unmodified lines
3640 #define __NR_sysfs (__NR_arch_specific_syscall + 3)
3741 __SYSCALL(__NR_sysfs, sys_sysfs)
3842
43+#undef __SYSCALL
44+
3945 #endif
arch/arm/mach-omap2/board-ldp.c+6−1
@@ -242,12 +242,18 @@ static void __init ldp_display_init(void) · 241 unmodified lines
242242
243243 static int ldp_twl_gpio_setup(struct device *dev, unsigned gpio, unsigned ngpio)
244244 {
245+ int res;
246+
245247 /* LCD enable GPIO */
246248 ldp_lcd_pdata.enable_gpio = gpio + 7;
247249
248250 /* Backlight enable GPIO */
249251 ldp_lcd_pdata.backlight_gpio = gpio + 15;
250252
253+ res = platform_device_register(&ldp_lcd_device);
254+ if (res)
255+ pr_err("Unable to register LCD: %d\n", res);
256+
251257 return 0;
252258 }
253259
@@ -346,7 +352,6 @@ static struct omap2_hsmmc_info mmc[] __initdata = { · 92 unmodified lines
346352
347353 static struct platform_device *ldp_devices[] __initdata = {
348354 &ldp_gpio_keys_device,
349− &ldp_lcd_device,
350355 };
351356
352357 #ifdef CONFIG_OMAP_MUX
arch/arm/mach-omap2/omap_hwmod_2xxx_ipblock_data.c+2−2
@@ -796,7 +796,7 @@ struct omap_hwmod omap2xxx_counter_32k_hwmod = { · 795 unmodified lines
796796
797797 /* gpmc */
798798 static struct omap_hwmod_irq_info omap2xxx_gpmc_irqs[] = {
799− { .irq = 20 },
799+ { .irq = 20 + OMAP_INTC_START, },
800800 { .irq = -1 }
801801 };
802802
@@ -841,7 +841,7 @@ static struct omap_hwmod_class omap2_rng_hwmod_class = { · 38 unmodified lines
841841 };
842842
843843 static struct omap_hwmod_irq_info omap2_rng_mpu_irqs[] = {
844− { .irq = 52 },
844+ { .irq = 52 + OMAP_INTC_START, },
845845 { .irq = -1 }
846846 };
847847
arch/arm/mach-omap2/omap_hwmod_3xxx_data.c+3−3
@@ -2165,7 +2165,7 @@ static struct omap_hwmod_class omap3xxx_gpmc_hwmod_class = { · 2164 unmodified lines
21652165 };
21662166
21672167 static struct omap_hwmod_irq_info omap3xxx_gpmc_irqs[] = {
2168− { .irq = 20 },
2168+ { .irq = 20 + OMAP_INTC_START, },
21692169 { .irq = -1 }
21702170 };
21712171
@@ -2999,7 +2999,7 @@ static struct omap_mmu_dev_attr mmu_isp_dev_attr = { · 827 unmodified lines
29992999
30003000 static struct omap_hwmod omap3xxx_mmu_isp_hwmod;
30013001 static struct omap_hwmod_irq_info omap3xxx_mmu_isp_irqs[] = {
3002− { .irq = 24 },
3002+ { .irq = 24 + OMAP_INTC_START, },
30033003 { .irq = -1 }
30043004 };
30053005
@@ -3041,7 +3041,7 @@ static struct omap_mmu_dev_attr mmu_iva_dev_attr = { · 35 unmodified lines
30413041
30423042 static struct omap_hwmod omap3xxx_mmu_iva_hwmod;
30433043 static struct omap_hwmod_irq_info omap3xxx_mmu_iva_irqs[] = {
3044− { .irq = 28 },
3044+ { .irq = 28 + OMAP_INTC_START, },
30453045 { .irq = -1 }
30463046 };
30473047
arch/arm/mach-omap2/omap_hwmod_7xx_data.c+1−1
@@ -1637,7 +1637,7 @@ static struct omap_hwmod dra7xx_uart1_hwmod = { · 1636 unmodified lines
16371637 .class = &dra7xx_uart_hwmod_class,
16381638 .clkdm_name = "l4per_clkdm",
16391639 .main_clk = "uart1_gfclk_mux",
1640− .flags = HWMOD_SWSUP_SIDLE_ACT,
1640+ .flags = HWMOD_SWSUP_SIDLE_ACT | DEBUG_OMAP2UART1_FLAGS,
16411641 .prcm = {
16421642 .omap4 = {
16431643 .clkctrl_offs = DRA7XX_CM_L4PER_UART1_CLKCTRL_OFFSET,
arch/arm/xen/enlighten.c+3−3
@@ -96,7 +96,7 @@ static int remap_pte_fn(pte_t *ptep, pgtable_t token, unsigned long addr, · 95 unmodified lines
9696 struct remap_data *info = data;
9797 struct page *page = info->pages[info->index++];
9898 unsigned long pfn = page_to_pfn(page);
99− pte_t pte = pfn_pte(pfn, info->prot);
99+ pte_t pte = pte_mkspecial(pfn_pte(pfn, info->prot));
100100
101101 if (map_foreign_page(pfn, info->fgmfn, info->domid))
102102 return -EFAULT;
@@ -224,10 +224,10 @@ static int __init xen_guest_init(void) · 121 unmodified lines
224224 }
225225 if (of_address_to_resource(node, GRANT_TABLE_PHYSADDR, &res))
226226 return 0;
227− xen_hvm_resume_frames = res.start >> PAGE_SHIFT;
227+ xen_hvm_resume_frames = res.start;
228228 xen_events_irq = irq_of_parse_and_map(node, 0);
229229 pr_info("Xen %s support found, events_irq=%d gnttab_frame_pfn=%lx\n",
230− version, xen_events_irq, xen_hvm_resume_frames);
230+ version, xen_events_irq, (xen_hvm_resume_frames >> PAGE_SHIFT));
231231 xen_domain_type = XEN_HVM_DOMAIN;
232232
233233 xen_setup_features();
arch/arm64/include/asm/xen/page-coherent.h+0−4
@@ -23,25 +23,21 @@ static inline void xen_dma_map_page(struct device *hwdev, struct page *page, · 22 unmodified lines
2323 unsigned long offset, size_t size, enum dma_data_direction dir,
2424 struct dma_attrs *attrs)
2525 {
26− __generic_dma_ops(hwdev)->map_page(hwdev, page, offset, size, dir, attrs);
2726 }
2827
2928 static inline void xen_dma_unmap_page(struct device *hwdev, dma_addr_t handle,
3029 size_t size, enum dma_data_direction dir,
3130 struct dma_attrs *attrs)
3231 {
33− __generic_dma_ops(hwdev)->unmap_page(hwdev, handle, size, dir, attrs);
3432 }
3533
3634 static inline void xen_dma_sync_single_for_cpu(struct device *hwdev,
3735 dma_addr_t handle, size_t size, enum dma_data_direction dir)
3836 {
39− __generic_dma_ops(hwdev)->sync_single_for_cpu(hwdev, handle, size, dir);
4037 }
4138
4239 static inline void xen_dma_sync_single_for_device(struct device *hwdev,
4340 dma_addr_t handle, size_t size, enum dma_data_direction dir)
4441 {
45− __generic_dma_ops(hwdev)->sync_single_for_device(hwdev, handle, size, dir);
4642 }
4743 #endif /* _ASM_ARM64_XEN_PAGE_COHERENT_H */
arch/arm64/kernel/ptrace.c+18−20
@@ -214,31 +214,29 @@ static int ptrace_hbp_fill_attr_ctrl(unsigned int note_type, · 213 unmodified lines
214214 {
215215 int err, len, type, disabled = !ctrl.enabled;
216216
217− if (disabled) {
218− len = 0;
219− type = HW_BREAKPOINT_EMPTY;
220− } else {
221− err = arch_bp_generic_fields(ctrl, &len, &type);
222− if (err)
223− return err;
224−
225− switch (note_type) {
226− case NT_ARM_HW_BREAK:
227− if ((type & HW_BREAKPOINT_X) != type)
228− return -EINVAL;
229− break;
230− case NT_ARM_HW_WATCH:
231− if ((type & HW_BREAKPOINT_RW) != type)
232− return -EINVAL;
233− break;
234− default:
217+ attr->disabled = disabled;
218+ if (disabled)
219+ return 0;
220+
221+ err = arch_bp_generic_fields(ctrl, &len, &type);
222+ if (err)
223+ return err;
224+
225+ switch (note_type) {
226+ case NT_ARM_HW_BREAK:
227+ if ((type & HW_BREAKPOINT_X) != type)
235228 return -EINVAL;
236− }
229+ break;
230+ case NT_ARM_HW_WATCH:
231+ if ((type & HW_BREAKPOINT_RW) != type)
232+ return -EINVAL;
233+ break;
234+ default:
235+ return -EINVAL;
237236 }
238237
239238 attr->bp_len = len;
240239 attr->bp_type = type;
241− attr->disabled = disabled;
242240
243241 return 0;
244242 }
arch/powerpc/include/asm/kvm_book3s.h+4−0
@@ -192,6 +192,10 @@ extern void kvmppc_load_up_vsx(void); · 191 unmodified lines
192192 extern u32 kvmppc_alignment_dsisr(struct kvm_vcpu *vcpu, unsigned int inst);
193193 extern ulong kvmppc_alignment_dar(struct kvm_vcpu *vcpu, unsigned int inst);
194194 extern int kvmppc_h_pr(struct kvm_vcpu *vcpu, unsigned long cmd);
195+extern void kvmppc_copy_to_svcpu(struct kvmppc_book3s_shadow_vcpu *svcpu,
196+ struct kvm_vcpu *vcpu);
197+extern void kvmppc_copy_from_svcpu(struct kvm_vcpu *vcpu,
198+ struct kvmppc_book3s_shadow_vcpu *svcpu);
195199
196200 static inline struct kvmppc_vcpu_book3s *to_book3s(struct kvm_vcpu *vcpu)
197201 {
arch/powerpc/include/asm/kvm_book3s_asm.h+2−0
@@ -79,6 +79,7 @@ struct kvmppc_host_state { · 78 unmodified lines
7979 ulong vmhandler;
8080 ulong scratch0;
8181 ulong scratch1;
82+ ulong scratch2;
8283 u8 in_guest;
8384 u8 restore_hid5;
8485 u8 napping;
@@ -106,6 +107,7 @@ struct kvmppc_host_state { · 21 unmodified lines
106107 };
107108
108109 struct kvmppc_book3s_shadow_vcpu {
110+ bool in_use;
109111 ulong gpr[14];
110112 u32 cr;
111113 u32 xer;
arch/powerpc/include/asm/opal.h+2−2
@@ -720,13 +720,13 @@ int64_t opal_pci_next_error(uint64_t phb_id, uint64_t *first_frozen_pe, · 719 unmodified lines
720720 int64_t opal_pci_poll(uint64_t phb_id);
721721 int64_t opal_return_cpu(void);
722722
723−int64_t opal_xscom_read(uint32_t gcid, uint32_t pcb_addr, uint64_t *val);
723+int64_t opal_xscom_read(uint32_t gcid, uint32_t pcb_addr, __be64 *val);
724724 int64_t opal_xscom_write(uint32_t gcid, uint32_t pcb_addr, uint64_t val);
725725
726726 int64_t opal_lpc_write(uint32_t chip_id, enum OpalLPCAddressType addr_type,
727727 uint32_t addr, uint32_t data, uint32_t sz);
728728 int64_t opal_lpc_read(uint32_t chip_id, enum OpalLPCAddressType addr_type,
729− uint32_t addr, uint32_t *data, uint32_t sz);
729+ uint32_t addr, __be32 *data, uint32_t sz);
730730 int64_t opal_validate_flash(uint64_t buffer, uint32_t *size, uint32_t *result);
731731 int64_t opal_manage_flash(uint8_t op);
732732 int64_t opal_update_flash(uint64_t blk_list);
arch/powerpc/include/asm/switch_to.h+1−1
@@ -35,7 +35,7 @@ extern void giveup_vsx(struct task_struct *); · 34 unmodified lines
3535 extern void enable_kernel_spe(void);
3636 extern void giveup_spe(struct task_struct *);
3737 extern void load_up_spe(struct task_struct *);
38−extern void switch_booke_debug_regs(struct thread_struct *new_thread);
38+extern void switch_booke_debug_regs(struct debug_reg *new_debug);
3939
4040 #ifndef CONFIG_SMP
4141 extern void discard_lazy_cpu_state(void);
arch/powerpc/kernel/asm-offsets.c+1−0
@@ -576,6 +576,7 @@ int main(void) · 575 unmodified lines
576576 HSTATE_FIELD(HSTATE_VMHANDLER, vmhandler);
577577 HSTATE_FIELD(HSTATE_SCRATCH0, scratch0);
578578 HSTATE_FIELD(HSTATE_SCRATCH1, scratch1);
579+ HSTATE_FIELD(HSTATE_SCRATCH2, scratch2);
579580 HSTATE_FIELD(HSTATE_IN_GUEST, in_guest);
580581 HSTATE_FIELD(HSTATE_RESTORE_HID5, restore_hid5);
581582 HSTATE_FIELD(HSTATE_NAPPING, napping);
arch/powerpc/kernel/crash_dump.c+3−3
@@ -124,15 +124,15 @@ ssize_t copy_oldmem_page(unsigned long pfn, char *buf, · 123 unmodified lines
124124 void crash_free_reserved_phys_range(unsigned long begin, unsigned long end)
125125 {
126126 unsigned long addr;
127− const u32 *basep, *sizep;
127+ const __be32 *basep, *sizep;
128128 unsigned int rtas_start = 0, rtas_end = 0;
129129
130130 basep = of_get_property(rtas.dev, "linux,rtas-base", NULL);
131131 sizep = of_get_property(rtas.dev, "rtas-size", NULL);
132132
133133 if (basep && sizep) {
134− rtas_start = *basep;
135− rtas_end = *basep + *sizep;
134+ rtas_start = be32_to_cpup(basep);
135+ rtas_end = rtas_start + be32_to_cpup(sizep);
136136 }
137137
138138 for (addr = begin; addr < end; addr += PAGE_SIZE) {
arch/powerpc/kernel/process.c+16−16
@@ -339,7 +339,7 @@ static void set_debug_reg_defaults(struct thread_struct *thread) · 338 unmodified lines
339339 #endif
340340 }
341341
342−static void prime_debug_regs(struct thread_struct *thread)
342+static void prime_debug_regs(struct debug_reg *debug)
343343 {
344344 /*
345345 * We could have inherited MSR_DE from userspace, since
@@ -348,22 +348,22 @@ static void prime_debug_regs(struct thread_struct *thread) · 2 unmodified lines
348348 */
349349 mtmsr(mfmsr() & ~MSR_DE);
350350
351− mtspr(SPRN_IAC1, thread->debug.iac1);
352− mtspr(SPRN_IAC2, thread->debug.iac2);
351+ mtspr(SPRN_IAC1, debug->iac1);
352+ mtspr(SPRN_IAC2, debug->iac2);
353353 #if CONFIG_PPC_ADV_DEBUG_IACS > 2
354− mtspr(SPRN_IAC3, thread->debug.iac3);
355− mtspr(SPRN_IAC4, thread->debug.iac4);
354+ mtspr(SPRN_IAC3, debug->iac3);
355+ mtspr(SPRN_IAC4, debug->iac4);
356356 #endif
357− mtspr(SPRN_DAC1, thread->debug.dac1);
358− mtspr(SPRN_DAC2, thread->debug.dac2);
357+ mtspr(SPRN_DAC1, debug->dac1);
358+ mtspr(SPRN_DAC2, debug->dac2);
359359 #if CONFIG_PPC_ADV_DEBUG_DVCS > 0
360− mtspr(SPRN_DVC1, thread->debug.dvc1);
361− mtspr(SPRN_DVC2, thread->debug.dvc2);
360+ mtspr(SPRN_DVC1, debug->dvc1);
361+ mtspr(SPRN_DVC2, debug->dvc2);
362362 #endif
363− mtspr(SPRN_DBCR0, thread->debug.dbcr0);
364− mtspr(SPRN_DBCR1, thread->debug.dbcr1);
363+ mtspr(SPRN_DBCR0, debug->dbcr0);
364+ mtspr(SPRN_DBCR1, debug->dbcr1);
365365 #ifdef CONFIG_BOOKE
366− mtspr(SPRN_DBCR2, thread->debug.dbcr2);
366+ mtspr(SPRN_DBCR2, debug->dbcr2);
367367 #endif
368368 }
369369 /*
@@ -371,11 +371,11 @@ static void prime_debug_regs(struct thread_struct *thread) · 1 unmodified line
371371 * debug registers, set the debug registers from the values
372372 * stored in the new thread.
373373 */
374−void switch_booke_debug_regs(struct thread_struct *new_thread)
374+void switch_booke_debug_regs(struct debug_reg *new_debug)
375375 {
376376 if ((current->thread.debug.dbcr0 & DBCR0_IDM)
377− || (new_thread->debug.dbcr0 & DBCR0_IDM))
378− prime_debug_regs(new_thread);
377+ || (new_debug->dbcr0 & DBCR0_IDM))
378+ prime_debug_regs(new_debug);
379379 }
380380 EXPORT_SYMBOL_GPL(switch_booke_debug_regs);
381381 #else /* !CONFIG_PPC_ADV_DEBUG_REGS */
@@ -683,7 +683,7 @@ struct task_struct *__switch_to(struct task_struct *prev, · 301 unmodified lines
683683 #endif /* CONFIG_SMP */
684684
685685 #ifdef CONFIG_PPC_ADV_DEBUG_REGS
686− switch_booke_debug_regs(&new->thread);
686+ switch_booke_debug_regs(&new->thread.debug);
687687 #else
688688 /*
689689 * For PPC_BOOK3S_64, we use the hw-breakpoint interfaces that would
arch/powerpc/kernel/ptrace.c+2−2
@@ -1555,7 +1555,7 @@ long arch_ptrace(struct task_struct *child, long request, · 1554 unmodified lines
15551555
15561556 flush_fp_to_thread(child);
15571557 if (fpidx < (PT_FPSCR - PT_FPR0))
1558− memcpy(&tmp, &child->thread.fp_state.fpr,
1558+ memcpy(&tmp, &child->thread.TS_FPR(fpidx),
15591559 sizeof(long));
15601560 else
15611561 tmp = child->thread.fp_state.fpscr;
@@ -1588,7 +1588,7 @@ long arch_ptrace(struct task_struct *child, long request, · 26 unmodified lines
15881588
15891589 flush_fp_to_thread(child);
15901590 if (fpidx < (PT_FPSCR - PT_FPR0))
1591− memcpy(&child->thread.fp_state.fpr, &data,
1591+ memcpy(&child->thread.TS_FPR(fpidx), &data,
15921592 sizeof(long));
15931593 else
15941594 child->thread.fp_state.fpscr = data;
arch/powerpc/kernel/setup-common.c+2−2
@@ -479,7 +479,7 @@ void __init smp_setup_cpu_maps(void) · 478 unmodified lines
479479 if (machine_is(pseries) && firmware_has_feature(FW_FEATURE_LPAR) &&
480480 (dn = of_find_node_by_path("/rtas"))) {
481481 int num_addr_cell, num_size_cell, maxcpus;
482− const unsigned int *ireg;
482+ const __be32 *ireg;
483483
484484 num_addr_cell = of_n_addr_cells(dn);
485485 num_size_cell = of_n_size_cells(dn);
@@ -489,7 +489,7 @@ void __init smp_setup_cpu_maps(void) · 3 unmodified lines
489489 if (!ireg)
490490 goto out;
491491
492− maxcpus = ireg[num_addr_cell + num_size_cell];
492+ maxcpus = be32_to_cpup(ireg + num_addr_cell + num_size_cell);
493493
494494 /* Double maxcpus for processors which have SMT capability */
495495 if (cpu_has_feature(CPU_FTR_SMT))
arch/powerpc/kernel/smp.c+2−2
@@ -580,7 +580,7 @@ int __cpu_up(unsigned int cpu, struct task_struct *tidle) · 579 unmodified lines
580580 int cpu_to_core_id(int cpu)
581581 {
582582 struct device_node *np;
583− const int *reg;
583+ const __be32 *reg;
584584 int id = -1;
585585
586586 np = of_get_cpu_node(cpu, NULL);
@@ -591,7 +591,7 @@ int cpu_to_core_id(int cpu) · 4 unmodified lines
591591 if (!reg)
592592 goto out;
593593
594− id = *reg;
594+ id = be32_to_cpup(reg);
595595 out:
596596 of_node_put(np);
597597 return id;
arch/powerpc/kvm/book3s_64_mmu_hv.c+14−4
@@ -469,11 +469,14 @@ static int kvmppc_mmu_book3s_64_hv_xlate(struct kvm_vcpu *vcpu, gva_t eaddr, · 468 unmodified lines
469469 slb_v = vcpu->kvm->arch.vrma_slb_v;
470470 }
471471
472+ preempt_disable();
472473 /* Find the HPTE in the hash table */
473474 index = kvmppc_hv_find_lock_hpte(kvm, eaddr, slb_v,
474475 HPTE_V_VALID | HPTE_V_ABSENT);
475− if (index < 0)
476+ if (index < 0) {
477+ preempt_enable();
476478 return -ENOENT;
479+ }
477480 hptep = (unsigned long *)(kvm->arch.hpt_virt + (index << 4));
478481 v = hptep[0] & ~HPTE_V_HVLOCK;
479482 gr = kvm->arch.revmap[index].guest_rpte;
@@ -481,6 +484,7 @@ static int kvmppc_mmu_book3s_64_hv_xlate(struct kvm_vcpu *vcpu, gva_t eaddr, · 1 unmodified line
481484 /* Unlock the HPTE */
482485 asm volatile("lwsync" : : : "memory");
483486 hptep[0] = v;
487+ preempt_enable();
484488
485489 gpte->eaddr = eaddr;
486490 gpte->vpage = ((v & HPTE_V_AVPN) << 4) | ((eaddr >> 12) & 0xfff);
@@ -665,6 +669,7 @@ int kvmppc_book3s_hv_page_fault(struct kvm_run *run, struct kvm_vcpu *vcpu, · 178 unmodified lines
665669 return -EFAULT;
666670 } else {
667671 page = pages[0];
672+ pfn = page_to_pfn(page);
668673 if (PageHuge(page)) {
669674 page = compound_head(page);
670675 pte_size <<= compound_order(page);
@@ -689,7 +694,6 @@ int kvmppc_book3s_hv_page_fault(struct kvm_run *run, struct kvm_vcpu *vcpu, · 18 unmodified lines
689694 }
690695 rcu_read_unlock_sched();
691696 }
692− pfn = page_to_pfn(page);
693697 }
694698
695699 ret = -EFAULT;
@@ -707,8 +711,14 @@ int kvmppc_book3s_hv_page_fault(struct kvm_run *run, struct kvm_vcpu *vcpu, · 11 unmodified lines
707711 r = (r & ~(HPTE_R_W|HPTE_R_I|HPTE_R_G)) | HPTE_R_M;
708712 }
709713
710− /* Set the HPTE to point to pfn */
711− r = (r & ~(HPTE_R_PP0 - pte_size)) | (pfn << PAGE_SHIFT);
714+ /*
715+ * Set the HPTE to point to pfn.
716+ * Since the pfn is at PAGE_SIZE granularity, make sure we
717+ * don't mask out lower-order bits if psize < PAGE_SIZE.
718+ */
719+ if (psize < PAGE_SIZE)
720+ psize = PAGE_SIZE;
721+ r = (r & ~(HPTE_R_PP0 - psize)) | ((pfn << PAGE_SHIFT) & ~(psize - 1));
712722 if (hpte_is_writable(r) && !write_ok)
713723 r = hpte_make_readonly(r);
714724 ret = RESUME_GUEST;
arch/powerpc/kvm/book3s_hv.c+14−10
@@ -131,8 +131,9 @@ static void kvmppc_fast_vcpu_kick_hv(struct kvm_vcpu *vcpu) · 130 unmodified lines
131131 static void kvmppc_core_vcpu_load_hv(struct kvm_vcpu *vcpu, int cpu)
132132 {
133133 struct kvmppc_vcore *vc = vcpu->arch.vcore;
134+ unsigned long flags;
134135
135− spin_lock(&vcpu->arch.tbacct_lock);
136+ spin_lock_irqsave(&vcpu->arch.tbacct_lock, flags);
136137 if (vc->runner == vcpu && vc->vcore_state != VCORE_INACTIVE &&
137138 vc->preempt_tb != TB_NIL) {
138139 vc->stolen_tb += mftb() - vc->preempt_tb;
@@ -143,19 +144,20 @@ static void kvmppc_core_vcpu_load_hv(struct kvm_vcpu *vcpu, int cpu) · 4 unmodified lines
143144 vcpu->arch.busy_stolen += mftb() - vcpu->arch.busy_preempt;
144145 vcpu->arch.busy_preempt = TB_NIL;
145146 }
146− spin_unlock(&vcpu->arch.tbacct_lock);
147+ spin_unlock_irqrestore(&vcpu->arch.tbacct_lock, flags);
147148 }
148149
149150 static void kvmppc_core_vcpu_put_hv(struct kvm_vcpu *vcpu)
150151 {
151152 struct kvmppc_vcore *vc = vcpu->arch.vcore;
153+ unsigned long flags;
152154
153− spin_lock(&vcpu->arch.tbacct_lock);
155+ spin_lock_irqsave(&vcpu->arch.tbacct_lock, flags);
154156 if (vc->runner == vcpu && vc->vcore_state != VCORE_INACTIVE)
155157 vc->preempt_tb = mftb();
156158 if (vcpu->arch.state == KVMPPC_VCPU_BUSY_IN_HOST)
157159 vcpu->arch.busy_preempt = mftb();
158− spin_unlock(&vcpu->arch.tbacct_lock);
160+ spin_unlock_irqrestore(&vcpu->arch.tbacct_lock, flags);
159161 }
160162
161163 static void kvmppc_set_msr_hv(struct kvm_vcpu *vcpu, u64 msr)
@@ -486,11 +488,11 @@ static u64 vcore_stolen_time(struct kvmppc_vcore *vc, u64 now) · 324 unmodified lines
486488 */
487489 if (vc->vcore_state != VCORE_INACTIVE &&
488490 vc->runner->arch.run_task != current) {
489− spin_lock(&vc->runner->arch.tbacct_lock);
491+ spin_lock_irq(&vc->runner->arch.tbacct_lock);
490492 p = vc->stolen_tb;
491493 if (vc->preempt_tb != TB_NIL)
492494 p += now - vc->preempt_tb;
493− spin_unlock(&vc->runner->arch.tbacct_lock);
495+ spin_unlock_irq(&vc->runner->arch.tbacct_lock);
494496 } else {
495497 p = vc->stolen_tb;
496498 }
@@ -512,10 +514,10 @@ static void kvmppc_create_dtl_entry(struct kvm_vcpu *vcpu, · 15 unmodified lines
512514 core_stolen = vcore_stolen_time(vc, now);
513515 stolen = core_stolen - vcpu->arch.stolen_logged;
514516 vcpu->arch.stolen_logged = core_stolen;
515− spin_lock(&vcpu->arch.tbacct_lock);
517+ spin_lock_irq(&vcpu->arch.tbacct_lock);
516518 stolen += vcpu->arch.busy_stolen;
517519 vcpu->arch.busy_stolen = 0;
518− spin_unlock(&vcpu->arch.tbacct_lock);
520+ spin_unlock_irq(&vcpu->arch.tbacct_lock);
519521 if (!dt || !vpa)
520522 return;
521523 memset(dt, 0, sizeof(struct dtl_entry));
@@ -589,7 +591,9 @@ int kvmppc_pseries_do_hcall(struct kvm_vcpu *vcpu) · 67 unmodified lines
589591 if (list_empty(&vcpu->kvm->arch.rtas_tokens))
590592 return RESUME_HOST;
591593
594+ idx = srcu_read_lock(&vcpu->kvm->srcu);
592595 rc = kvmppc_rtas_hcall(vcpu);
596+ srcu_read_unlock(&vcpu->kvm->srcu, idx);
593597
594598 if (rc == -ENOENT)
595599 return RESUME_HOST;
@@ -1115,13 +1119,13 @@ static void kvmppc_remove_runnable(struct kvmppc_vcore *vc, · 519 unmodified lines
11151119
11161120 if (vcpu->arch.state != KVMPPC_VCPU_RUNNABLE)
11171121 return;
1118− spin_lock(&vcpu->arch.tbacct_lock);
1122+ spin_lock_irq(&vcpu->arch.tbacct_lock);
11191123 now = mftb();
11201124 vcpu->arch.busy_stolen += vcore_stolen_time(vc, now) -
11211125 vcpu->arch.stolen_logged;
11221126 vcpu->arch.busy_preempt = now;
11231127 vcpu->arch.state = KVMPPC_VCPU_BUSY_IN_HOST;
1124− spin_unlock(&vcpu->arch.tbacct_lock);
1128+ spin_unlock_irq(&vcpu->arch.tbacct_lock);
11251129 --vc->n_runnable;
11261130 list_del(&vcpu->arch.run_list);
11271131 }
arch/powerpc/kvm/book3s_hv_rm_mmu.c+7−2
@@ -225,6 +225,7 @@ long kvmppc_do_h_enter(struct kvm *kvm, unsigned long flags, · 224 unmodified lines
225225 is_io = pa & (HPTE_R_I | HPTE_R_W);
226226 pte_size = PAGE_SIZE << (pa & KVMPPC_PAGE_ORDER_MASK);
227227 pa &= PAGE_MASK;
228+ pa |= gpa & ~PAGE_MASK;
228229 } else {
229230 /* Translate to host virtual address */
230231 hva = __gfn_to_hva_memslot(memslot, gfn);
@@ -238,13 +239,13 @@ long kvmppc_do_h_enter(struct kvm *kvm, unsigned long flags, · 7 unmodified lines
238239 ptel = hpte_make_readonly(ptel);
239240 is_io = hpte_cache_bits(pte_val(pte));
240241 pa = pte_pfn(pte) << PAGE_SHIFT;
242+ pa |= hva & (pte_size - 1);
243+ pa |= gpa & ~PAGE_MASK;
241244 }
242245 }
243246
244247 if (pte_size < psize)
245248 return H_PARAMETER;
246− if (pa && pte_size > psize)
247− pa |= gpa & (pte_size - 1);
248249
249250 ptel &= ~(HPTE_R_PP0 - psize);
250251 ptel |= pa;
@@ -749,6 +750,10 @@ static int slb_base_page_shift[4] = { · 498 unmodified lines
749750 20, /* 1M, unsupported */
750751 };
751752
753+/* When called from virtmode, this func should be protected by
754+ * preempt_disable(), otherwise, the holding of HPTE_V_HVLOCK
755+ * can trigger deadlock issue.
756+ */
752757 long kvmppc_hv_find_lock_hpte(struct kvm *kvm, gva_t eaddr, unsigned long slb_v,
753758 unsigned long valid)
754759 {
arch/powerpc/kvm/book3s_hv_rmhandlers.S+13−10
@@ -153,7 +153,6 @@ END_FTR_SECTION_IFSET(CPU_FTR_ARCH_206) · 152 unmodified lines
153153
154154 13: b machine_check_fwnmi
155155
156−
157156 /*
158157 * We come in here when wakened from nap mode on a secondary hw thread.
159158 * Relocation is off and most register values are lost.
@@ -224,6 +223,11 @@ kvm_start_guest: · 64 unmodified lines
224223 /* Clear our vcpu pointer so we don't come back in early */
225224 li r0, 0
226225 std r0, HSTATE_KVM_VCPU(r13)
226+ /*
227+ * Make sure we clear HSTATE_KVM_VCPU(r13) before incrementing
228+ * the nap_count, because once the increment to nap_count is
229+ * visible we could be given another vcpu.
230+ */
227231 lwsync
228232 /* Clear any pending IPI - we're an offline thread */
229233 ld r5, HSTATE_XICS_PHYS(r13)
@@ -241,7 +245,6 @@ kvm_start_guest: · 11 unmodified lines
241245 /* increment the nap count and then go to nap mode */
242246 ld r4, HSTATE_KVM_VCORE(r13)
243247 addi r4, r4, VCORE_NAP_COUNT
244− lwsync /* make previous updates visible */
245248 51: lwarx r3, 0, r4
246249 addi r3, r3, 1
247250 stwcx. r3, 0, r4
@@ -751,15 +754,14 @@ kvmppc_interrupt_hv: · 503 unmodified lines
751754 * guest CR, R12 saved in shadow VCPU SCRATCH1/0
752755 * guest R13 saved in SPRN_SCRATCH0
753756 */
754− /* abuse host_r2 as third scratch area; we get r2 from PACATOC(r13) */
755− std r9, HSTATE_HOST_R2(r13)
757+ std r9, HSTATE_SCRATCH2(r13)
756758
757759 lbz r9, HSTATE_IN_GUEST(r13)
758760 cmpwi r9, KVM_GUEST_MODE_HOST_HV
759761 beq kvmppc_bad_host_intr
760762 #ifdef CONFIG_KVM_BOOK3S_PR_POSSIBLE
761763 cmpwi r9, KVM_GUEST_MODE_GUEST
762− ld r9, HSTATE_HOST_R2(r13)
764+ ld r9, HSTATE_SCRATCH2(r13)
763765 beq kvmppc_interrupt_pr
764766 #endif
765767 /* We're now back in the host but in guest MMU context */
@@ -779,7 +781,7 @@ kvmppc_interrupt_hv: · 13 unmodified lines
779781 std r6, VCPU_GPR(R6)(r9)
780782 std r7, VCPU_GPR(R7)(r9)
781783 std r8, VCPU_GPR(R8)(r9)
782− ld r0, HSTATE_HOST_R2(r13)
784+ ld r0, HSTATE_SCRATCH2(r13)
783785 std r0, VCPU_GPR(R9)(r9)
784786 std r10, VCPU_GPR(R10)(r9)
785787 std r11, VCPU_GPR(R11)(r9)
@@ -990,14 +992,13 @@ END_FTR_SECTION_IFSET(CPU_FTR_ARCH_201) · 204 unmodified lines
990992 */
991993 /* Increment the threads-exiting-guest count in the 0xff00
992994 bits of vcore->entry_exit_count */
993− lwsync
994995 ld r5,HSTATE_KVM_VCORE(r13)
995996 addi r6,r5,VCORE_ENTRY_EXIT
996997 41: lwarx r3,0,r6
997998 addi r0,r3,0x100
998999 stwcx. r0,0,r6
9991000 bne 41b
1000− lwsync
1001+ isync /* order stwcx. vs. reading napping_threads */
10011002
10021003 /*
10031004 * At this point we have an interrupt that we have to pass
@@ -1030,6 +1031,8 @@ END_FTR_SECTION_IFSET(CPU_FTR_ARCH_201) · 26 unmodified lines
10301031 sld r0,r0,r4
10311032 andc. r3,r3,r0 /* no sense IPI'ing ourselves */
10321033 beq 43f
1034+ /* Order entry/exit update vs. IPIs */
1035+ sync
10331036 mulli r4,r4,PACA_SIZE /* get paca for thread 0 */
10341037 subf r6,r4,r13
10351038 42: andi. r0,r3,1
@@ -1638,10 +1641,10 @@ END_FTR_SECTION_IFCLR(CPU_FTR_ARCH_206) · 602 unmodified lines
16381641 bge kvm_cede_exit
16391642 stwcx. r4,0,r6
16401643 bne 31b
1644+ /* order napping_threads update vs testing entry_exit_count */
1645+ isync
16411646 li r0,1
16421647 stb r0,HSTATE_NAPPING(r13)
1643− /* order napping_threads update vs testing entry_exit_count */
1644− lwsync
16451648 mr r4,r3
16461649 lwz r7,VCORE_ENTRY_EXIT(r5)
16471650 cmpwi r7,0x100
arch/powerpc/kvm/book3s_interrupts.S+11−8
@@ -129,29 +129,32 @@ kvm_start_lightweight: · 128 unmodified lines
129129 * R12 = exit handler id
130130 * R13 = PACA
131131 * SVCPU.* = guest *
132+ * MSR.EE = 1
132133 *
133134 */
134135
136+ PPC_LL r3, GPR4(r1) /* vcpu pointer */
137+
138+ /*
139+ * kvmppc_copy_from_svcpu can clobber volatile registers, save
140+ * the exit handler id to the vcpu and restore it from there later.
141+ */
142+ stw r12, VCPU_TRAP(r3)
143+
135144 /* Transfer reg values from shadow vcpu back to vcpu struct */
136145 /* On 64-bit, interrupts are still off at this point */
137− PPC_LL r3, GPR4(r1) /* vcpu pointer */
146+
138147 GET_SHADOW_VCPU(r4)
139148 bl FUNC(kvmppc_copy_from_svcpu)
140149 nop
141150
142151 #ifdef CONFIG_PPC_BOOK3S_64
143− /* Re-enable interrupts */
144− ld r3, HSTATE_HOST_MSR(r13)
145− ori r3, r3, MSR_EE
146− MTMSR_EERI(r3)
147−
148152 /*
149153 * Reload kernel SPRG3 value.
150154 * No need to save guest value as usermode can't modify SPRG3.
151155 */
152156 ld r3, PACA_SPRG3(r13)
153157 mtspr SPRN_SPRG3, r3
154−
155158 #endif /* CONFIG_PPC_BOOK3S_64 */
156159
157160 /* R7 = vcpu */
@@ -177,7 +180,7 @@ kvm_start_lightweight: · 19 unmodified lines
177180 PPC_STL r31, VCPU_GPR(R31)(r7)
178181
179182 /* Pass the exit number as 3rd argument to kvmppc_handle_exit */
180− mr r5, r12
183+ lwz r5, VCPU_TRAP(r7)
181184
182185 /* Restore r3 (kvm_run) and r4 (vcpu) */
183186 REST_2GPRS(3, r1)
arch/powerpc/kvm/book3s_pr.c+22−0
@@ -66,6 +66,7 @@ static void kvmppc_core_vcpu_load_pr(struct kvm_vcpu *vcpu, int cpu) · 65 unmodified lines
6666 struct kvmppc_book3s_shadow_vcpu *svcpu = svcpu_get(vcpu);
6767 memcpy(svcpu->slb, to_book3s(vcpu)->slb_shadow, sizeof(svcpu->slb));
6868 svcpu->slb_max = to_book3s(vcpu)->slb_shadow_max;
69+ svcpu->in_use = 0;
6970 svcpu_put(svcpu);
7071 #endif
7172 vcpu->cpu = smp_processor_id();
@@ -78,6 +79,9 @@ static void kvmppc_core_vcpu_put_pr(struct kvm_vcpu *vcpu) · 6 unmodified lines
7879 {
7980 #ifdef CONFIG_PPC_BOOK3S_64
8081 struct kvmppc_book3s_shadow_vcpu *svcpu = svcpu_get(vcpu);
82+ if (svcpu->in_use) {
83+ kvmppc_copy_from_svcpu(vcpu, svcpu);
84+ }
8185 memcpy(to_book3s(vcpu)->slb_shadow, svcpu->slb, sizeof(svcpu->slb));
8286 to_book3s(vcpu)->slb_shadow_max = svcpu->slb_max;
8387 svcpu_put(svcpu);
@@ -110,12 +114,26 @@ void kvmppc_copy_to_svcpu(struct kvmppc_book3s_shadow_vcpu *svcpu, · 26 unmodified lines
110114 svcpu->ctr = vcpu->arch.ctr;
111115 svcpu->lr = vcpu->arch.lr;
112116 svcpu->pc = vcpu->arch.pc;
117+ svcpu->in_use = true;
113118 }
114119
115120 /* Copy data touched by real-mode code from shadow vcpu back to vcpu */
116121 void kvmppc_copy_from_svcpu(struct kvm_vcpu *vcpu,
117122 struct kvmppc_book3s_shadow_vcpu *svcpu)
118123 {
124+ /*
125+ * vcpu_put would just call us again because in_use hasn't
126+ * been updated yet.
127+ */
128+ preempt_disable();
129+
130+ /*
131+ * Maybe we were already preempted and synced the svcpu from
132+ * our preempt notifiers. Don't bother touching this svcpu then.
133+ */
134+ if (!svcpu->in_use)
135+ goto out;
136+
119137 vcpu->arch.gpr[0] = svcpu->gpr[0];
120138 vcpu->arch.gpr[1] = svcpu->gpr[1];
121139 vcpu->arch.gpr[2] = svcpu->gpr[2];
@@ -139,6 +157,10 @@ void kvmppc_copy_from_svcpu(struct kvm_vcpu *vcpu, · 17 unmodified lines
139157 vcpu->arch.fault_dar = svcpu->fault_dar;
140158 vcpu->arch.fault_dsisr = svcpu->fault_dsisr;
141159 vcpu->arch.last_inst = svcpu->last_inst;
160+ svcpu->in_use = false;
161+
162+out:
163+ preempt_enable();
142164 }
143165
144166 static int kvmppc_core_check_requests_pr(struct kvm_vcpu *vcpu)
arch/powerpc/kvm/book3s_rmhandlers.S+1−5
@@ -153,15 +153,11 @@ _GLOBAL(kvmppc_entry_trampoline) · 152 unmodified lines
153153
154154 li r6, MSR_IR | MSR_DR
155155 andc r6, r5, r6 /* Clear DR and IR in MSR value */
156−#ifdef CONFIG_PPC_BOOK3S_32
157156 /*
158157 * Set EE in HOST_MSR so that it's enabled when we get into our
159− * C exit handler function. On 64-bit we delay enabling
160− * interrupts until we have finished transferring stuff
161− * to or from the PACA.
158+ * C exit handler function.
162159 */
163160 ori r5, r5, MSR_EE
164−#endif
165161 mtsrr0 r7
166162 mtsrr1 r6
167163 RFI
arch/powerpc/kvm/booke.c+6−6
@@ -681,7 +681,7 @@ int kvmppc_core_check_requests(struct kvm_vcpu *vcpu) · 680 unmodified lines
681681 int kvmppc_vcpu_run(struct kvm_run *kvm_run, struct kvm_vcpu *vcpu)
682682 {
683683 int ret, s;
684− struct thread_struct thread;
684+ struct debug_reg debug;
685685 #ifdef CONFIG_PPC_FPU
686686 struct thread_fp_state fp;
687687 int fpexc_mode;
@@ -723,9 +723,9 @@ int kvmppc_vcpu_run(struct kvm_run *kvm_run, struct kvm_vcpu *vcpu) · 35 unmodified lines
723723 #endif
724724
725725 /* Switch to guest debug context */
726− thread.debug = vcpu->arch.shadow_dbg_reg;
727− switch_booke_debug_regs(&thread);
728− thread.debug = current->thread.debug;
726+ debug = vcpu->arch.shadow_dbg_reg;
727+ switch_booke_debug_regs(&debug);
728+ debug = current->thread.debug;
729729 current->thread.debug = vcpu->arch.shadow_dbg_reg;
730730
731731 kvmppc_fix_ee_before_entry();
@@ -736,8 +736,8 @@ int kvmppc_vcpu_run(struct kvm_run *kvm_run, struct kvm_vcpu *vcpu) · 4 unmodified lines
736736 We also get here with interrupts enabled. */
737737
738738 /* Switch back to user space debug context */
739− switch_booke_debug_regs(&thread);
740− current->thread.debug = thread.debug;
739+ switch_booke_debug_regs(&debug);
740+ current->thread.debug = debug;
741741
742742 #ifdef CONFIG_PPC_FPU
743743 kvmppc_save_guest_fp(vcpu);
arch/powerpc/platforms/powernv/opal-lpc.c+6−6
@@ -24,25 +24,25 @@ static int opal_lpc_chip_id = -1; · 23 unmodified lines
2424 static u8 opal_lpc_inb(unsigned long port)
2525 {
2626 int64_t rc;
27− uint32_t data;
27+ __be32 data;
2828
2929 if (opal_lpc_chip_id < 0 || port > 0xffff)
3030 return 0xff;
3131 rc = opal_lpc_read(opal_lpc_chip_id, OPAL_LPC_IO, port, &data, 1);
32− return rc ? 0xff : data;
32+ return rc ? 0xff : be32_to_cpu(data);
3333 }
3434
3535 static __le16 __opal_lpc_inw(unsigned long port)
3636 {
3737 int64_t rc;
38− uint32_t data;
38+ __be32 data;
3939
4040 if (opal_lpc_chip_id < 0 || port > 0xfffe)
4141 return 0xffff;
4242 if (port & 1)
4343 return (__le16)opal_lpc_inb(port) << 8 | opal_lpc_inb(port + 1);
4444 rc = opal_lpc_read(opal_lpc_chip_id, OPAL_LPC_IO, port, &data, 2);
45− return rc ? 0xffff : data;
45+ return rc ? 0xffff : be32_to_cpu(data);
4646 }
4747 static u16 opal_lpc_inw(unsigned long port)
4848 {
@@ -52,7 +52,7 @@ static u16 opal_lpc_inw(unsigned long port) · 3 unmodified lines
5252 static __le32 __opal_lpc_inl(unsigned long port)
5353 {
5454 int64_t rc;
55− uint32_t data;
55+ __be32 data;
5656
5757 if (opal_lpc_chip_id < 0 || port > 0xfffc)
5858 return 0xffffffff;
@@ -62,7 +62,7 @@ static __le32 __opal_lpc_inl(unsigned long port) · 3 unmodified lines
6262 (__le32)opal_lpc_inb(port + 2) << 8 |
6363 opal_lpc_inb(port + 3);
6464 rc = opal_lpc_read(opal_lpc_chip_id, OPAL_LPC_IO, port, &data, 4);
65− return rc ? 0xffffffff : data;
65+ return rc ? 0xffffffff : be32_to_cpu(data);
6666 }
6767
6868 static u32 opal_lpc_inl(unsigned long port)
arch/powerpc/platforms/powernv/opal-xscom.c+3−1
@@ -96,9 +96,11 @@ static int opal_scom_read(scom_map_t map, u64 reg, u64 *value) · 95 unmodified lines
9696 {
9797 struct opal_scom_map *m = map;
9898 int64_t rc;
99+ __be64 v;
99100
100101 reg = opal_scom_unmangle(reg);
101− rc = opal_xscom_read(m->chip, m->addr + reg, (uint64_t *)__pa(value));
102+ rc = opal_xscom_read(m->chip, m->addr + reg, (__be64 *)__pa(&v));
103+ *value = be64_to_cpu(v);
102104 return opal_xscom_err_xlate(rc);
103105 }
104106
arch/powerpc/platforms/pseries/lparcfg.c+6−6
@@ -157,7 +157,7 @@ static void parse_ppp_data(struct seq_file *m) · 156 unmodified lines
157157 {
158158 struct hvcall_ppp_data ppp_data;
159159 struct device_node *root;
160− const int *perf_level;
160+ const __be32 *perf_level;
161161 int rc;
162162
163163 rc = h_get_ppp(&ppp_data);
@@ -201,7 +201,7 @@ static void parse_ppp_data(struct seq_file *m) · 37 unmodified lines
201201 perf_level = of_get_property(root,
202202 "ibm,partition-performance-parameters-level",
203203 NULL);
204− if (perf_level && (*perf_level >= 1)) {
204+ if (perf_level && (be32_to_cpup(perf_level) >= 1)) {
205205 seq_printf(m,
206206 "physical_procs_allocated_to_virtualization=%d\n",
207207 ppp_data.phys_platform_procs);
@@ -435,7 +435,7 @@ static int pseries_lparcfg_data(struct seq_file *m, void *v) · 227 unmodified lines
435435 int partition_potential_processors;
436436 int partition_active_processors;
437437 struct device_node *rtas_node;
438− const int *lrdrp = NULL;
438+ const __be32 *lrdrp = NULL;
439439
440440 rtas_node = of_find_node_by_path("/rtas");
441441 if (rtas_node)
@@ -444,7 +444,7 @@ static int pseries_lparcfg_data(struct seq_file *m, void *v) · 2 unmodified lines
444444 if (lrdrp == NULL) {
445445 partition_potential_processors = vdso_data->processorCount;
446446 } else {
447− partition_potential_processors = *(lrdrp + 4);
447+ partition_potential_processors = be32_to_cpup(lrdrp + 4);
448448 }
449449 of_node_put(rtas_node);
450450
@@ -654,7 +654,7 @@ static int lparcfg_data(struct seq_file *m, void *v) · 203 unmodified lines
654654 const char *model = "";
655655 const char *system_id = "";
656656 const char *tmp;
657− const unsigned int *lp_index_ptr;
657+ const __be32 *lp_index_ptr;
658658 unsigned int lp_index = 0;
659659
660660 seq_printf(m, "%s %s\n", MODULE_NAME, MODULE_VERS);
@@ -670,7 +670,7 @@ static int lparcfg_data(struct seq_file *m, void *v) · 9 unmodified lines
670670 lp_index_ptr = of_get_property(rootdn, "ibm,partition-no",
671671 NULL);
672672 if (lp_index_ptr)
673− lp_index = *lp_index_ptr;
673+ lp_index = be32_to_cpup(lp_index_ptr);
674674 of_node_put(rootdn);
675675 }
676676 seq_printf(m, "serial_number=%s\n", system_id);
arch/powerpc/platforms/pseries/msi.c+15−13
@@ -130,7 +130,8 @@ static int check_req(struct pci_dev *pdev, int nvec, char *prop_name) · 129 unmodified lines
130130 {
131131 struct device_node *dn;
132132 struct pci_dn *pdn;
133− const u32 *req_msi;
133+ const __be32 *p;
134+ u32 req_msi;
134135
135136 pdn = pci_get_pdn(pdev);
136137 if (!pdn)
@@ -138,19 +139,20 @@ static int check_req(struct pci_dev *pdev, int nvec, char *prop_name) · 1 unmodified line
138139
139140 dn = pdn->node;
140141
141− req_msi = of_get_property(dn, prop_name, NULL);
142− if (!req_msi) {
142+ p = of_get_property(dn, prop_name, NULL);
143+ if (!p) {
143144 pr_debug("rtas_msi: No %s on %s\n", prop_name, dn->full_name);
144145 return -ENOENT;
145146 }
146147
147− if (*req_msi < nvec) {
148+ req_msi = be32_to_cpup(p);
149+ if (req_msi < nvec) {
148150 pr_debug("rtas_msi: %s requests < %d MSIs\n", prop_name, nvec);
149151
150− if (*req_msi == 0) /* Be paranoid */
152+ if (req_msi == 0) /* Be paranoid */
151153 return -ENOSPC;
152154
153− return *req_msi;
155+ return req_msi;
154156 }
155157
156158 return 0;
@@ -171,7 +173,7 @@ static int check_req_msix(struct pci_dev *pdev, int nvec) · 14 unmodified lines
171173 static struct device_node *find_pe_total_msi(struct pci_dev *dev, int *total)
172174 {
173175 struct device_node *dn;
174− const u32 *p;
176+ const __be32 *p;
175177
176178 dn = of_node_get(pci_device_to_OF_node(dev));
177179 while (dn) {
@@ -179,7 +181,7 @@ static struct device_node *find_pe_total_msi(struct pci_dev *dev, int *total) · 1 unmodified line
179181 if (p) {
180182 pr_debug("rtas_msi: found prop on dn %s\n",
181183 dn->full_name);
182− *total = *p;
184+ *total = be32_to_cpup(p);
183185 return dn;
184186 }
185187
@@ -232,13 +234,13 @@ struct msi_counts { · 46 unmodified lines
232234 static void *count_non_bridge_devices(struct device_node *dn, void *data)
233235 {
234236 struct msi_counts *counts = data;
235− const u32 *p;
237+ const __be32 *p;
236238 u32 class;
237239
238240 pr_debug("rtas_msi: counting %s\n", dn->full_name);
239241
240242 p = of_get_property(dn, "class-code", NULL);
241− class = p ? *p : 0;
243+ class = p ? be32_to_cpup(p) : 0;
242244
243245 if ((class >> 8) != PCI_CLASS_BRIDGE_PCI)
244246 counts->num_devices++;
@@ -249,7 +251,7 @@ static void *count_non_bridge_devices(struct device_node *dn, void *data) · 4 unmodified lines
249251 static void *count_spare_msis(struct device_node *dn, void *data)
250252 {
251253 struct msi_counts *counts = data;
252− const u32 *p;
254+ const __be32 *p;
253255 int req;
254256
255257 if (dn == counts->requestor)
@@ -260,11 +262,11 @@ static void *count_spare_msis(struct device_node *dn, void *data) · 4 unmodified lines
260262 req = 0;
261263 p = of_get_property(dn, "ibm,req#msi", NULL);
262264 if (p)
263− req = *p;
265+ req = be32_to_cpup(p);
264266
265267 p = of_get_property(dn, "ibm,req#msi-x", NULL);
266268 if (p)
267− req = max(req, (int)*p);
269+ req = max(req, (int)be32_to_cpup(p));
268270 }
269271
270272 if (req < counts->quota)
arch/powerpc/platforms/pseries/nvram.c+23−23
@@ -43,8 +43,8 @@ static char nvram_buf[NVRW_CNT]; /* assume this is in the first 4GB */ · 42 unmodified lines
4343 static DEFINE_SPINLOCK(nvram_lock);
4444
4545 struct err_log_info {
46− int error_type;
47− unsigned int seq_num;
46+ __be32 error_type;
47+ __be32 seq_num;
4848 };
4949
5050 struct nvram_os_partition {
@@ -79,9 +79,9 @@ static const char *pseries_nvram_os_partitions[] = { · 28 unmodified lines
7979 };
8080
8181 struct oops_log_info {
82− u16 version;
83− u16 report_length;
84− u64 timestamp;
82+ __be16 version;
83+ __be16 report_length;
84+ __be64 timestamp;
8585 } __attribute__((packed));
8686
8787 static void oops_to_nvram(struct kmsg_dumper *dumper,
@@ -291,8 +291,8 @@ int nvram_write_os_partition(struct nvram_os_partition *part, char * buff, · 203 unmodified lines
291291 length = part->size;
292292 }
293293
294− info.error_type = err_type;
295− info.seq_num = error_log_cnt;
294+ info.error_type = cpu_to_be32(err_type);
295+ info.seq_num = cpu_to_be32(error_log_cnt);
296296
297297 tmp_index = part->index;
298298
@@ -364,8 +364,8 @@ int nvram_read_partition(struct nvram_os_partition *part, char *buff, · 65 unmodified lines
364364 }
365365
366366 if (part->os_partition) {
367− *error_log_cnt = info.seq_num;
368− *err_type = info.error_type;
367+ *error_log_cnt = be32_to_cpu(info.seq_num);
368+ *err_type = be32_to_cpu(info.error_type);
369369 }
370370
371371 return 0;
@@ -529,9 +529,9 @@ static int zip_oops(size_t text_len) · 157 unmodified lines
529529 pr_err("nvram: logging uncompressed oops/panic report\n");
530530 return -1;
531531 }
532− oops_hdr->version = OOPS_HDR_VERSION;
533− oops_hdr->report_length = (u16) zipped_len;
534− oops_hdr->timestamp = get_seconds();
532+ oops_hdr->version = cpu_to_be16(OOPS_HDR_VERSION);
533+ oops_hdr->report_length = cpu_to_be16(zipped_len);
534+ oops_hdr->timestamp = cpu_to_be64(get_seconds());
535535 return 0;
536536 }
537537
@@ -574,9 +574,9 @@ static int nvram_pstore_write(enum pstore_type_id type, · 36 unmodified lines
574574 clobbering_unread_rtas_event())
575575 return -1;
576576
577− oops_hdr->version = OOPS_HDR_VERSION;
578− oops_hdr->report_length = (u16) size;
579− oops_hdr->timestamp = get_seconds();
577+ oops_hdr->version = cpu_to_be16(OOPS_HDR_VERSION);
578+ oops_hdr->report_length = cpu_to_be16(size);
579+ oops_hdr->timestamp = cpu_to_be64(get_seconds());
580580
581581 if (compressed)
582582 err_type = ERR_TYPE_KERNEL_PANIC_GZ;
@@ -670,16 +670,16 @@ static ssize_t nvram_pstore_read(u64 *id, enum pstore_type_id *type, · 87 unmodified lines
670670 size_t length, hdr_size;
671671
672672 oops_hdr = (struct oops_log_info *)buff;
673− if (oops_hdr->version < OOPS_HDR_VERSION) {
673+ if (be16_to_cpu(oops_hdr->version) < OOPS_HDR_VERSION) {
674674 /* Old format oops header had 2-byte record size */
675675 hdr_size = sizeof(u16);
676− length = oops_hdr->version;
676+ length = be16_to_cpu(oops_hdr->version);
677677 time->tv_sec = 0;
678678 time->tv_nsec = 0;
679679 } else {
680680 hdr_size = sizeof(*oops_hdr);
681− length = oops_hdr->report_length;
682− time->tv_sec = oops_hdr->timestamp;
681+ length = be16_to_cpu(oops_hdr->report_length);
682+ time->tv_sec = be64_to_cpu(oops_hdr->timestamp);
683683 time->tv_nsec = 0;
684684 }
685685 *buf = kmalloc(length, GFP_KERNEL);
@@ -889,13 +889,13 @@ static void oops_to_nvram(struct kmsg_dumper *dumper, · 203 unmodified lines
889889 kmsg_dump_get_buffer(dumper, false,
890890 oops_data, oops_data_sz, &text_len);
891891 err_type = ERR_TYPE_KERNEL_PANIC;
892− oops_hdr->version = OOPS_HDR_VERSION;
893− oops_hdr->report_length = (u16) text_len;
894− oops_hdr->timestamp = get_seconds();
892+ oops_hdr->version = cpu_to_be16(OOPS_HDR_VERSION);
893+ oops_hdr->report_length = cpu_to_be16(text_len);
894+ oops_hdr->timestamp = cpu_to_be64(get_seconds());
895895 }
896896
897897 (void) nvram_write_os_partition(&oops_log_partition, oops_buf,
898− (int) (sizeof(*oops_hdr) + oops_hdr->report_length), err_type,
898+ (int) (sizeof(*oops_hdr) + text_len), err_type,
899899 ++oops_count);
900900
901901 spin_unlock_irqrestore(&lock, flags);
arch/powerpc/platforms/pseries/pci.c+4−4
@@ -113,7 +113,7 @@ int pseries_root_bridge_prepare(struct pci_host_bridge *bridge) · 112 unmodified lines
113113 {
114114 struct device_node *dn, *pdn;
115115 struct pci_bus *bus;
116− const uint32_t *pcie_link_speed_stats;
116+ const __be32 *pcie_link_speed_stats;
117117
118118 bus = bridge->bus;
119119
@@ -122,7 +122,7 @@ int pseries_root_bridge_prepare(struct pci_host_bridge *bridge) · 2 unmodified lines
122122 return 0;
123123
124124 for (pdn = dn; pdn != NULL; pdn = of_get_next_parent(pdn)) {
125− pcie_link_speed_stats = (const uint32_t *) of_get_property(pdn,
125+ pcie_link_speed_stats = of_get_property(pdn,
126126 "ibm,pcie-link-speed-stats", NULL);
127127 if (pcie_link_speed_stats)
128128 break;
@@ -135,7 +135,7 @@ int pseries_root_bridge_prepare(struct pci_host_bridge *bridge) · 6 unmodified lines
135135 return 0;
136136 }
137137
138− switch (pcie_link_speed_stats[0]) {
138+ switch (be32_to_cpup(pcie_link_speed_stats)) {
139139 case 0x01:
140140 bus->max_bus_speed = PCIE_SPEED_2_5GT;
141141 break;
@@ -147,7 +147,7 @@ int pseries_root_bridge_prepare(struct pci_host_bridge *bridge) · 5 unmodified lines
147147 break;
148148 }
149149
150− switch (pcie_link_speed_stats[1]) {
150+ switch (be32_to_cpup(pcie_link_speed_stats)) {
151151 case 0x01:
152152 bus->cur_bus_speed = PCIE_SPEED_2_5GT;
153153 break;
arch/sh/lib/Makefile+1−1
@@ -6,7 +6,7 @@ lib-y = delay.o memmove.o memchr.o \ · 5 unmodified lines
66 checksum.o strlen.o div64.o div64-generic.o
77
88 # Extracted from libgcc
9−lib-y += movmem.o ashldi3.o ashrdi3.o lshrdi3.o \
9+obj-y += movmem.o ashldi3.o ashrdi3.o lshrdi3.o \
1010 ashlsi3.o ashrsi3.o ashiftrt.o lshrsi3.o \
1111 udiv_qrnnd.o
1212
arch/sparc/include/asm/pgtable_64.h+2−2
@@ -619,7 +619,7 @@ static inline unsigned long pte_present(pte_t pte) · 618 unmodified lines
619619 }
620620
621621 #define pte_accessible pte_accessible
622−static inline unsigned long pte_accessible(pte_t a)
622+static inline unsigned long pte_accessible(struct mm_struct *mm, pte_t a)
623623 {
624624 return pte_val(a) & _PAGE_VALID;
625625 }
@@ -847,7 +847,7 @@ static inline void __set_pte_at(struct mm_struct *mm, unsigned long addr, · 221 unmodified lines
847847 * SUN4V NOTE: _PAGE_VALID is the same value in both the SUN4U
848848 * and SUN4V pte layout, so this inline test is fine.
849849 */
850− if (likely(mm != &init_mm) && pte_accessible(orig))
850+ if (likely(mm != &init_mm) && pte_accessible(mm, orig))
851851 tlb_batch_add(mm, addr, ptep, orig, fullmm);
852852 }
853853
arch/x86/Kconfig+1−0
@@ -26,6 +26,7 @@ config X86 · 25 unmodified lines
2626 select HAVE_AOUT if X86_32
2727 select HAVE_UNSTABLE_SCHED_CLOCK
2828 select ARCH_SUPPORTS_NUMA_BALANCING
29+ select ARCH_SUPPORTS_INT128 if X86_64
2930 select ARCH_WANTS_PROT_NUMA_PROT_NONE
3031 select HAVE_IDE
3132 select HAVE_OPROFILE
arch/x86/include/asm/pgtable.h+9−2
@@ -452,9 +452,16 @@ static inline int pte_present(pte_t a) · 451 unmodified lines
452452 }
453453
454454 #define pte_accessible pte_accessible
455−static inline int pte_accessible(pte_t a)
455+static inline bool pte_accessible(struct mm_struct *mm, pte_t a)
456456 {
457− return pte_flags(a) & _PAGE_PRESENT;
457+ if (pte_flags(a) & _PAGE_PRESENT)
458+ return true;
459+
460+ if ((pte_flags(a) & (_PAGE_PROTNONE | _PAGE_NUMA)) &&
461+ mm_tlb_flush_pending(mm))
462+ return true;
463+
464+ return false;
458465 }
459466
460467 static inline int pte_hidden(pte_t pte)
arch/x86/include/asm/preempt.h+11−0
@@ -7,6 +7,12 @@ · 6 unmodified lines
77
88 DECLARE_PER_CPU(int, __preempt_count);
99
10+/*
11+ * We use the PREEMPT_NEED_RESCHED bit as an inverted NEED_RESCHED such
12+ * that a decrement hitting 0 means we can and should reschedule.
13+ */
14+#define PREEMPT_ENABLED (0 + PREEMPT_NEED_RESCHED)
15+
1016 /*
1117 * We mask the PREEMPT_NEED_RESCHED bit so as not to confuse all current users
1218 * that think a non-zero value indicates we cannot preempt.
@@ -74,6 +80,11 @@ static __always_inline void __preempt_count_sub(int val) · 61 unmodified lines
7480 __this_cpu_add_4(__preempt_count, -val);
7581 }
7682
83+/*
84+ * Because we keep PREEMPT_NEED_RESCHED set when we do _not_ need to reschedule
85+ * a decrement which hits zero means we have no preempt_count and should
86+ * reschedule.
87+ */
7788 static __always_inline bool __preempt_count_dec_and_test(void)
7889 {
7990 GEN_UNARY_RMWcc("decl", __preempt_count, __percpu_arg(0), "e");
arch/x86/kernel/cpu/perf_event.h+12−3
@@ -262,11 +262,20 @@ struct cpu_hw_events { · 261 unmodified lines
262262 __EVENT_CONSTRAINT(c, n, INTEL_ARCH_EVENT_MASK, \
263263 HWEIGHT(n), 0, PERF_X86_EVENT_PEBS_ST_HSW)
264264
265−#define EVENT_CONSTRAINT_END \
266− EVENT_CONSTRAINT(0, 0, 0)
265+/*
266+ * We define the end marker as having a weight of -1
267+ * to enable blacklisting of events using a counter bitmask
268+ * of zero and thus a weight of zero.
269+ * The end marker has a weight that cannot possibly be
270+ * obtained from counting the bits in the bitmask.
271+ */
272+#define EVENT_CONSTRAINT_END { .weight = -1 }
267273
274+/*
275+ * Check for end marker with weight == -1
276+ */
268277 #define for_each_event_constraint(e, c) \
269− for ((e) = (c); (e)->weight; (e)++)
278+ for ((e) = (c); (e)->weight != -1; (e)++)
270279
271280 /*
272281 * Extra registers for specific events.
arch/x86/mm/gup.c+13−0
@@ -83,6 +83,12 @@ static noinline int gup_pte_range(pmd_t pmd, unsigned long addr, · 82 unmodified lines
8383 pte_t pte = gup_get_pte(ptep);
8484 struct page *page;
8585
86+ /* Similar to the PMD case, NUMA hinting must take slow path */
87+ if (pte_numa(pte)) {
88+ pte_unmap(ptep);
89+ return 0;
90+ }
91+
8692 if ((pte_flags(pte) & (mask | _PAGE_SPECIAL)) != mask) {
8793 pte_unmap(ptep);
8894 return 0;
@@ -167,6 +173,13 @@ static int gup_pmd_range(pud_t pud, unsigned long addr, unsigned long end, · 78 unmodified lines
167173 if (pmd_none(pmd) || pmd_trans_splitting(pmd))
168174 return 0;
169175 if (unlikely(pmd_large(pmd))) {
176+ /*
177+ * NUMA hinting faults need to be handled in the GUP
178+ * slowpath for accounting purposes and so that they
179+ * can be serialised against THP migration.
180+ */
181+ if (pmd_numa(pmd))
182+ return 0;
170183 if (!gup_huge_pmd(pmd, addr, next, write, pages, nr))
171184 return 0;
172185 } else {
drivers/acpi/apei/erst.c+1−0
@@ -942,6 +942,7 @@ static int erst_clearer(enum pstore_type_id type, u64 id, int count, · 941 unmodified lines
942942 static struct pstore_info erst_info = {
943943 .owner = THIS_MODULE,
944944 .name = "erst",
945+ .flags = PSTORE_FLAGS_FRAGILE,
945946 .open = erst_open_pstore,
946947 .close = erst_close_pstore,
947948 .read = erst_reader,
drivers/clk/clk-s2mps11.c+3−3
@@ -60,7 +60,7 @@ static int s2mps11_clk_prepare(struct clk_hw *hw) · 59 unmodified lines
6060 struct s2mps11_clk *s2mps11 = to_s2mps11_clk(hw);
6161 int ret;
6262
63− ret = regmap_update_bits(s2mps11->iodev->regmap,
63+ ret = regmap_update_bits(s2mps11->iodev->regmap_pmic,
6464 S2MPS11_REG_RTC_CTRL,
6565 s2mps11->mask, s2mps11->mask);
6666 if (!ret)
@@ -74,7 +74,7 @@ static void s2mps11_clk_unprepare(struct clk_hw *hw) · 7 unmodified lines
7474 struct s2mps11_clk *s2mps11 = to_s2mps11_clk(hw);
7575 int ret;
7676
77− ret = regmap_update_bits(s2mps11->iodev->regmap, S2MPS11_REG_RTC_CTRL,
77+ ret = regmap_update_bits(s2mps11->iodev->regmap_pmic, S2MPS11_REG_RTC_CTRL,
7878 s2mps11->mask, ~s2mps11->mask);
7979
8080 if (!ret)
@@ -174,7 +174,7 @@ static int s2mps11_clk_probe(struct platform_device *pdev) · 93 unmodified lines
174174 s2mps11_clk->hw.init = &s2mps11_clks_init[i];
175175 s2mps11_clk->mask = 1 << i;
176176
177− ret = regmap_read(s2mps11_clk->iodev->regmap,
177+ ret = regmap_read(s2mps11_clk->iodev->regmap_pmic,
178178 S2MPS11_REG_RTC_CTRL, &val);
179179 if (ret < 0)
180180 goto err_reg;
drivers/clocksource/Kconfig+1−0
@@ -75,6 +75,7 @@ config CLKSRC_DBX500_PRCMU_SCHED_CLOCK · 74 unmodified lines
7575 config CLKSRC_EFM32
7676 bool "Clocksource for Energy Micro's EFM32 SoCs" if !ARCH_EFM32
7777 depends on OF && ARM && (ARCH_EFM32 || COMPILE_TEST)
78+ select CLKSRC_MMIO
7879 default ARCH_EFM32
7980 help
8081 Support to use the timers of EFM32 SoCs as clock source and clock
drivers/clocksource/clksrc-of.c+0−1
@@ -35,6 +35,5 @@ void __init clocksource_of_init(void) · 34 unmodified lines
3535
3636 init_func = match->data;
3737 init_func(np);
38− of_node_put(np);
3938 }
4039 }
drivers/clocksource/dw_apb_timer_of.c+4−3
@@ -108,12 +108,11 @@ static void __init add_clocksource(struct device_node *source_timer) · 107 unmodified lines
108108
109109 static u64 read_sched_clock(void)
110110 {
111− return __raw_readl(sched_io_base);
111+ return ~__raw_readl(sched_io_base);
112112 }
113113
114114 static const struct of_device_id sptimer_ids[] __initconst = {
115115 { .compatible = "picochip,pc3x2-rtc" },
116− { .compatible = "snps,dw-apb-timer-sp" },
117116 { /* Sentinel */ },
118117 };
119118
@@ -151,4 +150,6 @@ static void __init dw_apb_timer_init(struct device_node *timer) · 31 unmodified lines
151150 num_called++;
152151 }
153152 CLOCKSOURCE_OF_DECLARE(pc3x2_timer, "picochip,pc3x2-timer", dw_apb_timer_init);
154−CLOCKSOURCE_OF_DECLARE(apb_timer, "snps,dw-apb-timer-osc", dw_apb_timer_init);
153+CLOCKSOURCE_OF_DECLARE(apb_timer_osc, "snps,dw-apb-timer-osc", dw_apb_timer_init);
154+CLOCKSOURCE_OF_DECLARE(apb_timer_sp, "snps,dw-apb-timer-sp", dw_apb_timer_init);
155+CLOCKSOURCE_OF_DECLARE(apb_timer, "snps,dw-apb-timer", dw_apb_timer_init);
drivers/clocksource/sun4i_timer.c+3−0
@@ -179,6 +179,9 @@ static void __init sun4i_timer_init(struct device_node *node) · 178 unmodified lines
179179 writel(TIMER_CTL_CLK_SRC(TIMER_CTL_CLK_SRC_OSC24M),
180180 timer_base + TIMER_CTL_REG(0));
181181
182+ /* Make sure timer is stopped before playing with interrupts */
183+ sun4i_clkevt_time_stop(0);
184+
182185 ret = setup_irq(irq, &sun4i_timer_irq);
183186 if (ret)
184187 pr_warn("failed to setup irq %d\n", irq);
drivers/clocksource/time-armada-370-xp.c+5−5
@@ -255,11 +255,6 @@ static void __init armada_370_xp_timer_common_init(struct device_node *np) · 254 unmodified lines
255255
256256 ticks_per_jiffy = (timer_clk + HZ / 2) / HZ;
257257
258− /*
259− * Set scale and timer for sched_clock.
260− */
261− sched_clock_register(armada_370_xp_read_sched_clock, 32, timer_clk);
262−
263258 /*
264259 * Setup free-running clocksource timer (interrupts
265260 * disabled).
@@ -270,6 +265,11 @@ static void __init armada_370_xp_timer_common_init(struct device_node *np) · 4 unmodified lines
270265 timer_ctrl_clrset(0, TIMER0_EN | TIMER0_RELOAD_EN |
271266 TIMER0_DIV(TIMER_DIVIDER_SHIFT));
272267
268+ /*
269+ * Set scale and timer for sched_clock.
270+ */
271+ sched_clock_register(armada_370_xp_read_sched_clock, 32, timer_clk);
272+
273273 clocksource_mmio_init(timer_base + TIMER0_VAL_OFF,
274274 "armada_370_xp_clocksource",
275275 timer_clk, 300, 32, clocksource_mmio_readl_down);
drivers/dma/Kconfig+7−0
@@ -62,6 +62,7 @@ config INTEL_IOATDMA · 61 unmodified lines
6262 tristate "Intel I/OAT DMA support"
6363 depends on PCI && X86
6464 select DMA_ENGINE
65+ select DMA_ENGINE_RAID
6566 select DCA
6667 help
6768 Enable support for the Intel(R) I/OAT DMA engine present
@@ -112,6 +113,7 @@ config MV_XOR · 44 unmodified lines
112113 bool "Marvell XOR engine support"
113114 depends on PLAT_ORION
114115 select DMA_ENGINE
116+ select DMA_ENGINE_RAID
115117 select ASYNC_TX_ENABLE_CHANNEL_SWITCH
116118 ---help---
117119 Enable support for the Marvell XOR engine.
@@ -187,6 +189,7 @@ config AMCC_PPC440SPE_ADMA · 69 unmodified lines
187189 tristate "AMCC PPC440SPe ADMA support"
188190 depends on 440SPe || 440SP
189191 select DMA_ENGINE
192+ select DMA_ENGINE_RAID
190193 select ARCH_HAS_ASYNC_TX_FIND_CHANNEL
191194 select ASYNC_TX_ENABLE_CHANNEL_SWITCH
192195 help
@@ -352,6 +355,7 @@ config NET_DMA · 159 unmodified lines
352355 bool "Network: TCP receive copy offload"
353356 depends on DMA_ENGINE && NET
354357 default (INTEL_IOATDMA || FSL_DMA)
358+ depends on BROKEN
355359 help
356360 This enables the use of DMA engines in the network stack to
357361 offload receive copy-to-user operations, freeing CPU cycles.
@@ -377,4 +381,7 @@ config DMATEST · 19 unmodified lines
377381 Simple DMA test client. Say N unless you're debugging a
378382 DMA Device driver.
379383
384+config DMA_ENGINE_RAID
385+ bool
386+
380387 endif
drivers/dma/at_hdmac_regs.h+0−4
@@ -347,10 +347,6 @@ static struct device *chan2dev(struct dma_chan *chan) · 346 unmodified lines
347347 {
348348 return &chan->dev->device;
349349 }
350−static struct device *chan2parent(struct dma_chan *chan)
351−{
352− return chan->dev->device.parent;
353−}
354350
355351 #if defined(VERBOSE_DEBUG)
356352 static void vdbg_dump_regs(struct at_dma_chan *atchan)
drivers/dma/dmaengine.c+2−2
@@ -912,7 +912,7 @@ struct dmaengine_unmap_pool { · 911 unmodified lines
912912 #define __UNMAP_POOL(x) { .size = x, .name = "dmaengine-unmap-" __stringify(x) }
913913 static struct dmaengine_unmap_pool unmap_pool[] = {
914914 __UNMAP_POOL(2),
915− #if IS_ENABLED(CONFIG_ASYNC_TX_DMA)
915+ #if IS_ENABLED(CONFIG_DMA_ENGINE_RAID)
916916 __UNMAP_POOL(16),
917917 __UNMAP_POOL(128),
918918 __UNMAP_POOL(256),
@@ -1054,7 +1054,7 @@ dma_async_memcpy_pg_to_pg(struct dma_chan *chan, struct page *dest_pg, · 135 unmodified lines
10541054 dma_cookie_t cookie;
10551055 unsigned long flags;
10561056
1057− unmap = dmaengine_get_unmap_data(dev->dev, 2, GFP_NOIO);
1057+ unmap = dmaengine_get_unmap_data(dev->dev, 2, GFP_NOWAIT);
10581058 if (!unmap)
10591059 return -ENOMEM;
10601060
drivers/dma/dmatest.c+4−4
@@ -539,9 +539,9 @@ static int dmatest_func(void *data) · 538 unmodified lines
539539
540540 um->len = params->buf_size;
541541 for (i = 0; i < src_cnt; i++) {
542− unsigned long buf = (unsigned long) thread->srcs[i];
542+ void *buf = thread->srcs[i];
543543 struct page *pg = virt_to_page(buf);
544− unsigned pg_off = buf & ~PAGE_MASK;
544+ unsigned pg_off = (unsigned long) buf & ~PAGE_MASK;
545545
546546 um->addr[i] = dma_map_page(dev->dev, pg, pg_off,
547547 um->len, DMA_TO_DEVICE);
@@ -559,9 +559,9 @@ static int dmatest_func(void *data) · 11 unmodified lines
559559 /* map with DMA_BIDIRECTIONAL to force writeback/invalidate */
560560 dsts = &um->addr[src_cnt];
561561 for (i = 0; i < dst_cnt; i++) {
562− unsigned long buf = (unsigned long) thread->dsts[i];
562+ void *buf = thread->dsts[i];
563563 struct page *pg = virt_to_page(buf);
564− unsigned pg_off = buf & ~PAGE_MASK;
564+ unsigned pg_off = (unsigned long) buf & ~PAGE_MASK;
565565
566566 dsts[i] = dma_map_page(dev->dev, pg, pg_off, um->len,
567567 DMA_BIDIRECTIONAL);
drivers/dma/fsldma.c+1−30
@@ -86,11 +86,6 @@ static void set_desc_cnt(struct fsldma_chan *chan, · 85 unmodified lines
8686 hw->count = CPU_TO_DMA(chan, count, 32);
8787 }
8888
89−static u32 get_desc_cnt(struct fsldma_chan *chan, struct fsl_desc_sw *desc)
90−{
91− return DMA_TO_CPU(chan, desc->hw.count, 32);
92−}
93−
9489 static void set_desc_src(struct fsldma_chan *chan,
9590 struct fsl_dma_ld_hw *hw, dma_addr_t src)
9691 {
@@ -101,16 +96,6 @@ static void set_desc_src(struct fsldma_chan *chan, · 4 unmodified lines
10196 hw->src_addr = CPU_TO_DMA(chan, snoop_bits | src, 64);
10297 }
10398
104−static dma_addr_t get_desc_src(struct fsldma_chan *chan,
105− struct fsl_desc_sw *desc)
106−{
107− u64 snoop_bits;
108−
109− snoop_bits = ((chan->feature & FSL_DMA_IP_MASK) == FSL_DMA_IP_85XX)
110− ? ((u64)FSL_DMA_SATR_SREADTYPE_SNOOP_READ << 32) : 0;
111− return DMA_TO_CPU(chan, desc->hw.src_addr, 64) & ~snoop_bits;
112−}
113−
11499 static void set_desc_dst(struct fsldma_chan *chan,
115100 struct fsl_dma_ld_hw *hw, dma_addr_t dst)
116101 {
@@ -121,16 +106,6 @@ static void set_desc_dst(struct fsldma_chan *chan, · 4 unmodified lines
121106 hw->dst_addr = CPU_TO_DMA(chan, snoop_bits | dst, 64);
122107 }
123108
124−static dma_addr_t get_desc_dst(struct fsldma_chan *chan,
125− struct fsl_desc_sw *desc)
126−{
127− u64 snoop_bits;
128−
129− snoop_bits = ((chan->feature & FSL_DMA_IP_MASK) == FSL_DMA_IP_85XX)
130− ? ((u64)FSL_DMA_DATR_DWRITETYPE_SNOOP_WRITE << 32) : 0;
131− return DMA_TO_CPU(chan, desc->hw.dst_addr, 64) & ~snoop_bits;
132−}
133−
134109 static void set_desc_next(struct fsldma_chan *chan,
135110 struct fsl_dma_ld_hw *hw, dma_addr_t next)
136111 {
@@ -408,7 +383,7 @@ static dma_cookie_t fsl_dma_tx_submit(struct dma_async_tx_descriptor *tx) · 271 unmodified lines
408383 struct fsl_desc_sw *desc = tx_to_fsl_desc(tx);
409384 struct fsl_desc_sw *child;
410385 unsigned long flags;
411− dma_cookie_t cookie;
386+ dma_cookie_t cookie = -EINVAL;
412387
413388 spin_lock_irqsave(&chan->desc_lock, flags);
414389
@@ -854,10 +829,6 @@ static void fsldma_cleanup_descriptor(struct fsldma_chan *chan, · 439 unmodified lines
854829 struct fsl_desc_sw *desc)
855830 {
856831 struct dma_async_tx_descriptor *txd = &desc->async_tx;
857− struct device *dev = chan->common.device->dev;
858− dma_addr_t src = get_desc_src(chan, desc);
859− dma_addr_t dst = get_desc_dst(chan, desc);
860− u32 len = get_desc_cnt(chan, desc);
861832
862833 /* Run the link descriptor callback function */
863834 if (txd->callback) {
drivers/dma/mv_xor.c+63−38
@@ -54,12 +54,6 @@ static void mv_desc_init(struct mv_xor_desc_slot *desc, unsigned long flags) · 53 unmodified lines
5454 hw_desc->desc_command = (1 << 31);
5555 }
5656
57−static u32 mv_desc_get_dest_addr(struct mv_xor_desc_slot *desc)
58−{
59− struct mv_xor_desc *hw_desc = desc->hw_desc;
60− return hw_desc->phy_dest_addr;
61−}
62−
6357 static void mv_desc_set_byte_count(struct mv_xor_desc_slot *desc,
6458 u32 byte_count)
6559 {
@@ -787,7 +781,6 @@ static void mv_xor_issue_pending(struct dma_chan *chan) · 721 unmodified lines
787781 /*
788782 * Perform a transaction to verify the HW works.
789783 */
790−#define MV_XOR_TEST_SIZE 2000
791784
792785 static int mv_xor_memcpy_self_test(struct mv_xor_chan *mv_chan)
793786 {
@@ -797,20 +790,21 @@ static int mv_xor_memcpy_self_test(struct mv_xor_chan *mv_chan) · 3 unmodified lines
797790 struct dma_chan *dma_chan;
798791 dma_cookie_t cookie;
799792 struct dma_async_tx_descriptor *tx;
793+ struct dmaengine_unmap_data *unmap;
800794 int err = 0;
801795
802− src = kmalloc(sizeof(u8) * MV_XOR_TEST_SIZE, GFP_KERNEL);
796+ src = kmalloc(sizeof(u8) * PAGE_SIZE, GFP_KERNEL);
803797 if (!src)
804798 return -ENOMEM;
805799
806− dest = kzalloc(sizeof(u8) * MV_XOR_TEST_SIZE, GFP_KERNEL);
800+ dest = kzalloc(sizeof(u8) * PAGE_SIZE, GFP_KERNEL);
807801 if (!dest) {
808802 kfree(src);
809803 return -ENOMEM;
810804 }
811805
812806 /* Fill in src buffer */
813− for (i = 0; i < MV_XOR_TEST_SIZE; i++)
807+ for (i = 0; i < PAGE_SIZE; i++)
814808 ((u8 *) src)[i] = (u8)i;
815809
816810 dma_chan = &mv_chan->dmachan;
@@ -819,14 +813,26 @@ static int mv_xor_memcpy_self_test(struct mv_xor_chan *mv_chan) · 2 unmodified lines
819813 goto out;
820814 }
821815
822− dest_dma = dma_map_single(dma_chan->device->dev, dest,
823− MV_XOR_TEST_SIZE, DMA_FROM_DEVICE);
816+ unmap = dmaengine_get_unmap_data(dma_chan->device->dev, 2, GFP_KERNEL);
817+ if (!unmap) {
818+ err = -ENOMEM;
819+ goto free_resources;
820+ }
821+
822+ src_dma = dma_map_page(dma_chan->device->dev, virt_to_page(src), 0,
823+ PAGE_SIZE, DMA_TO_DEVICE);
824+ unmap->to_cnt = 1;
825+ unmap->addr[0] = src_dma;
824826
825− src_dma = dma_map_single(dma_chan->device->dev, src,
826− MV_XOR_TEST_SIZE, DMA_TO_DEVICE);
827+ dest_dma = dma_map_page(dma_chan->device->dev, virt_to_page(dest), 0,
828+ PAGE_SIZE, DMA_FROM_DEVICE);
829+ unmap->from_cnt = 1;
830+ unmap->addr[1] = dest_dma;
831+
832+ unmap->len = PAGE_SIZE;
827833
828834 tx = mv_xor_prep_dma_memcpy(dma_chan, dest_dma, src_dma,
829− MV_XOR_TEST_SIZE, 0);
835+ PAGE_SIZE, 0);
830836 cookie = mv_xor_tx_submit(tx);
831837 mv_xor_issue_pending(dma_chan);
832838 async_tx_ack(tx);
@@ -841,8 +847,8 @@ static int mv_xor_memcpy_self_test(struct mv_xor_chan *mv_chan) · 8 unmodified lines
841847 }
842848
843849 dma_sync_single_for_cpu(dma_chan->device->dev, dest_dma,
844− MV_XOR_TEST_SIZE, DMA_FROM_DEVICE);
845− if (memcmp(src, dest, MV_XOR_TEST_SIZE)) {
850+ PAGE_SIZE, DMA_FROM_DEVICE);
851+ if (memcmp(src, dest, PAGE_SIZE)) {
846852 dev_err(dma_chan->device->dev,
847853 "Self-test copy failed compare, disabling\n");
848854 err = -ENODEV;
@@ -850,6 +856,7 @@ static int mv_xor_memcpy_self_test(struct mv_xor_chan *mv_chan) · 1 unmodified line
850856 }
851857
852858 free_resources:
859+ dmaengine_unmap_put(unmap);
853860 mv_xor_free_chan_resources(dma_chan);
854861 out:
855862 kfree(src);
@@ -867,13 +874,15 @@ mv_xor_xor_self_test(struct mv_xor_chan *mv_chan) · 11 unmodified lines
867874 dma_addr_t dma_srcs[MV_XOR_NUM_SRC_TEST];
868875 dma_addr_t dest_dma;
869876 struct dma_async_tx_descriptor *tx;
877+ struct dmaengine_unmap_data *unmap;
870878 struct dma_chan *dma_chan;
871879 dma_cookie_t cookie;
872880 u8 cmp_byte = 0;
873881 u32 cmp_word;
874882 int err = 0;
883+ int src_count = MV_XOR_NUM_SRC_TEST;
875884
876− for (src_idx = 0; src_idx < MV_XOR_NUM_SRC_TEST; src_idx++) {
885+ for (src_idx = 0; src_idx < src_count; src_idx++) {
877886 xor_srcs[src_idx] = alloc_page(GFP_KERNEL);
878887 if (!xor_srcs[src_idx]) {
879888 while (src_idx--)
@@ -890,13 +899,13 @@ mv_xor_xor_self_test(struct mv_xor_chan *mv_chan) · 10 unmodified lines
890899 }
891900
892901 /* Fill in src buffers */
893− for (src_idx = 0; src_idx < MV_XOR_NUM_SRC_TEST; src_idx++) {
902+ for (src_idx = 0; src_idx < src_count; src_idx++) {
894903 u8 *ptr = page_address(xor_srcs[src_idx]);
895904 for (i = 0; i < PAGE_SIZE; i++)
896905 ptr[i] = (1 << src_idx);
897906 }
898907
899− for (src_idx = 0; src_idx < MV_XOR_NUM_SRC_TEST; src_idx++)
908+ for (src_idx = 0; src_idx < src_count; src_idx++)
900909 cmp_byte ^= (u8) (1 << src_idx);
901910
902911 cmp_word = (cmp_byte << 24) | (cmp_byte << 16) |
@@ -910,16 +919,29 @@ mv_xor_xor_self_test(struct mv_xor_chan *mv_chan) · 7 unmodified lines
910919 goto out;
911920 }
912921
922+ unmap = dmaengine_get_unmap_data(dma_chan->device->dev, src_count + 1,
923+ GFP_KERNEL);
924+ if (!unmap) {
925+ err = -ENOMEM;
926+ goto free_resources;
927+ }
928+
913929 /* test xor */
914− dest_dma = dma_map_page(dma_chan->device->dev, dest, 0, PAGE_SIZE,
915− DMA_FROM_DEVICE);
930+ for (i = 0; i < src_count; i++) {
931+ unmap->addr[i] = dma_map_page(dma_chan->device->dev, xor_srcs[i],
932+ 0, PAGE_SIZE, DMA_TO_DEVICE);
933+ dma_srcs[i] = unmap->addr[i];
934+ unmap->to_cnt++;
935+ }
916936
917− for (i = 0; i < MV_XOR_NUM_SRC_TEST; i++)
918− dma_srcs[i] = dma_map_page(dma_chan->device->dev, xor_srcs[i],
919− 0, PAGE_SIZE, DMA_TO_DEVICE);
937+ unmap->addr[src_count] = dma_map_page(dma_chan->device->dev, dest, 0, PAGE_SIZE,
938+ DMA_FROM_DEVICE);
939+ dest_dma = unmap->addr[src_count];
940+ unmap->from_cnt = 1;
941+ unmap->len = PAGE_SIZE;
920942
921943 tx = mv_xor_prep_dma_xor(dma_chan, dest_dma, dma_srcs,
922− MV_XOR_NUM_SRC_TEST, PAGE_SIZE, 0);
944+ src_count, PAGE_SIZE, 0);
923945
924946 cookie = mv_xor_tx_submit(tx);
925947 mv_xor_issue_pending(dma_chan);
@@ -948,9 +970,10 @@ mv_xor_xor_self_test(struct mv_xor_chan *mv_chan) · 22 unmodified lines
948970 }
949971
950972 free_resources:
973+ dmaengine_unmap_put(unmap);
951974 mv_xor_free_chan_resources(dma_chan);
952975 out:
953− src_idx = MV_XOR_NUM_SRC_TEST;
976+ src_idx = src_count;
954977 while (src_idx--)
955978 __free_page(xor_srcs[src_idx]);
956979 __free_page(dest);
@@ -1176,6 +1199,7 @@ static int mv_xor_probe(struct platform_device *pdev) · 219 unmodified lines
11761199 int i = 0;
11771200
11781201 for_each_child_of_node(pdev->dev.of_node, np) {
1202+ struct mv_xor_chan *chan;
11791203 dma_cap_mask_t cap_mask;
11801204 int irq;
11811205
@@ -1193,21 +1217,21 @@ static int mv_xor_probe(struct platform_device *pdev) · 11 unmodified lines
11931217 goto err_channel_add;
11941218 }
11951219
1196− xordev->channels[i] =
1197− mv_xor_channel_add(xordev, pdev, i,
1198− cap_mask, irq);
1199− if (IS_ERR(xordev->channels[i])) {
1200− ret = PTR_ERR(xordev->channels[i]);
1201− xordev->channels[i] = NULL;
1220+ chan = mv_xor_channel_add(xordev, pdev, i,
1221+ cap_mask, irq);
1222+ if (IS_ERR(chan)) {
1223+ ret = PTR_ERR(chan);
12021224 irq_dispose_mapping(irq);
12031225 goto err_channel_add;
12041226 }
12051227
1228+ xordev->channels[i] = chan;
12061229 i++;
12071230 }
12081231 } else if (pdata && pdata->channels) {
12091232 for (i = 0; i < MV_XOR_MAX_CHANNELS; i++) {
12101233 struct mv_xor_channel_data *cd;
1234+ struct mv_xor_chan *chan;
12111235 int irq;
12121236
12131237 cd = &pdata->channels[i];
@@ -1222,13 +1246,14 @@ static int mv_xor_probe(struct platform_device *pdev) · 8 unmodified lines
12221246 goto err_channel_add;
12231247 }
12241248
1225− xordev->channels[i] =
1226− mv_xor_channel_add(xordev, pdev, i,
1227− cd->cap_mask, irq);
1228− if (IS_ERR(xordev->channels[i])) {
1229− ret = PTR_ERR(xordev->channels[i]);
1249+ chan = mv_xor_channel_add(xordev, pdev, i,
1250+ cd->cap_mask, irq);
1251+ if (IS_ERR(chan)) {
1252+ ret = PTR_ERR(chan);
12301253 goto err_channel_add;
12311254 }
1255+
1256+ xordev->channels[i] = chan;
12321257 }
12331258 }
12341259
drivers/dma/pl330.c+1−4
@@ -2492,12 +2492,9 @@ static dma_cookie_t pl330_tx_submit(struct dma_async_tx_descriptor *tx) · 2491 unmodified lines
24922492
24932493 static inline void _init_desc(struct dma_pl330_desc *desc)
24942494 {
2495− desc->pchan = NULL;
24962495 desc->req.x = &desc->px;
24972496 desc->req.token = desc;
24982497 desc->rqcfg.swap = SWAP_NO;
2499− desc->rqcfg.privileged = 0;
2500− desc->rqcfg.insnaccess = 0;
25012498 desc->rqcfg.scctl = SCCTRL0;
25022499 desc->rqcfg.dcctl = DCCTRL0;
25032500 desc->req.cfg = &desc->rqcfg;
@@ -2517,7 +2514,7 @@ static int add_desc(struct dma_pl330_dmac *pdmac, gfp_t flg, int count) · 13 unmodified lines
25172514 if (!pdmac)
25182515 return 0;
25192516
2520− desc = kmalloc(count * sizeof(*desc), flg);
2517+ desc = kcalloc(count, sizeof(*desc), flg);
25212518 if (!desc)
25222519 return 0;
25232520
drivers/dma/ppc4xx/adma.c+1−26
@@ -532,29 +532,6 @@ static void ppc440spe_desc_init_memcpy(struct ppc440spe_adma_desc_slot *desc, · 531 unmodified lines
532532 hw_desc->opc = DMA_CDB_OPC_MV_SG1_SG2;
533533 }
534534
535−/**
536− * ppc440spe_desc_init_memset - initialize the descriptor for MEMSET operation
537− */
538−static void ppc440spe_desc_init_memset(struct ppc440spe_adma_desc_slot *desc,
539− int value, unsigned long flags)
540−{
541− struct dma_cdb *hw_desc = desc->hw_desc;
542−
543− memset(desc->hw_desc, 0, sizeof(struct dma_cdb));
544− desc->hw_next = NULL;
545− desc->src_cnt = 1;
546− desc->dst_cnt = 1;
547−
548− if (flags & DMA_PREP_INTERRUPT)
549− set_bit(PPC440SPE_DESC_INT, &desc->flags);
550− else
551− clear_bit(PPC440SPE_DESC_INT, &desc->flags);
552−
553− hw_desc->sg1u = hw_desc->sg1l = cpu_to_le32((u32)value);
554− hw_desc->sg3u = hw_desc->sg3l = cpu_to_le32((u32)value);
555− hw_desc->opc = DMA_CDB_OPC_DFILL128;
556−}
557−
558535 /**
559536 * ppc440spe_desc_set_src_addr - set source address into the descriptor
560537 */
@@ -1504,8 +1481,6 @@ static dma_cookie_t ppc440spe_adma_run_tx_complete_actions( · 943 unmodified lines
15041481 struct ppc440spe_adma_chan *chan,
15051482 dma_cookie_t cookie)
15061483 {
1507− int i;
1508−
15091484 BUG_ON(desc->async_tx.cookie < 0);
15101485 if (desc->async_tx.cookie > 0) {
15111486 cookie = desc->async_tx.cookie;
@@ -3898,7 +3873,7 @@ static void ppc440spe_adma_init_capabilities(struct ppc440spe_adma_device *adev) · 2386 unmodified lines
38983873 ppc440spe_adma_prep_dma_interrupt;
38993874 }
39003875 pr_info("%s: AMCC(R) PPC440SP(E) ADMA Engine: "
3901− "( %s%s%s%s%s%s%s)\n",
3876+ "( %s%s%s%s%s%s)\n",
39023877 dev_name(adev->dev),
39033878 dma_has_cap(DMA_PQ, adev->common.cap_mask) ? "pq " : "",
39043879 dma_has_cap(DMA_PQ_VAL, adev->common.cap_mask) ? "pq_val " : "",
drivers/dma/txx9dmac.c+0−1
@@ -406,7 +406,6 @@ txx9dmac_descriptor_complete(struct txx9dmac_chan *dc, · 405 unmodified lines
406406 dma_async_tx_callback callback;
407407 void *param;
408408 struct dma_async_tx_descriptor *txd = &desc->txd;
409− struct txx9dmac_slave *ds = dc->chan.private;
410409
411410 dev_vdbg(chan2dev(&dc->chan), "descriptor %u %p complete\n",
412411 txd->cookie, desc);
drivers/firewire/sbp2.c+0−1
@@ -1623,7 +1623,6 @@ static struct scsi_host_template scsi_driver_template = { · 1622 unmodified lines
16231623 .cmd_per_lun = 1,
16241624 .can_queue = 1,
16251625 .sdev_attrs = sbp2_scsi_sysfs_attrs,
1626− .no_write_same = 1,
16271626 };
16281627
16291628 MODULE_AUTHOR("Kristian Hoegsberg <krh@bitplanet.net>");
drivers/firmware/efi/efi-pstore.c+1−0
@@ -356,6 +356,7 @@ static int efi_pstore_erase(enum pstore_type_id type, u64 id, int count, · 355 unmodified lines
356356 static struct pstore_info efi_pstore_info = {
357357 .owner = THIS_MODULE,
358358 .name = "efi",
359+ .flags = PSTORE_FLAGS_FRAGILE,
359360 .open = efi_pstore_open,
360361 .close = efi_pstore_close,
361362 .read = efi_pstore_read,
drivers/gpio/gpio-msm-v2.c+2−2
@@ -252,7 +252,7 @@ static void msm_gpio_irq_mask(struct irq_data *d) · 251 unmodified lines
252252
253253 spin_lock_irqsave(&tlmm_lock, irq_flags);
254254 writel(TARGET_PROC_NONE, GPIO_INTR_CFG_SU(gpio));
255− clear_gpio_bits(INTR_RAW_STATUS_EN | INTR_ENABLE, GPIO_INTR_CFG(gpio));
255+ clear_gpio_bits(BIT(INTR_RAW_STATUS_EN) | BIT(INTR_ENABLE), GPIO_INTR_CFG(gpio));
256256 __clear_bit(gpio, msm_gpio.enabled_irqs);
257257 spin_unlock_irqrestore(&tlmm_lock, irq_flags);
258258 }
@@ -264,7 +264,7 @@ static void msm_gpio_irq_unmask(struct irq_data *d) · 5 unmodified lines
264264
265265 spin_lock_irqsave(&tlmm_lock, irq_flags);
266266 __set_bit(gpio, msm_gpio.enabled_irqs);
267− set_gpio_bits(INTR_RAW_STATUS_EN | INTR_ENABLE, GPIO_INTR_CFG(gpio));
267+ set_gpio_bits(BIT(INTR_RAW_STATUS_EN) | BIT(INTR_ENABLE), GPIO_INTR_CFG(gpio));
268268 writel(TARGET_PROC_SCORPION, GPIO_INTR_CFG_SU(gpio));
269269 spin_unlock_irqrestore(&tlmm_lock, irq_flags);
270270 }
drivers/gpio/gpio-rcar.c+2−1
@@ -169,7 +169,8 @@ static irqreturn_t gpio_rcar_irq_handler(int irq, void *dev_id) · 168 unmodified lines
169169 u32 pending;
170170 unsigned int offset, irqs_handled = 0;
171171
172− while ((pending = gpio_rcar_read(p, INTDT))) {
172+ while ((pending = gpio_rcar_read(p, INTDT) &
173+ gpio_rcar_read(p, INTMSK))) {
173174 offset = __ffs(pending);
174175 gpio_rcar_write(p, INTCLR, BIT(offset));
175176 generic_handle_irq(irq_find_mapping(p->irq_domain, offset));
drivers/gpio/gpio-twl4030.c+12−3
@@ -300,7 +300,7 @@ static int twl_direction_in(struct gpio_chip *chip, unsigned offset) · 299 unmodified lines
300300 if (offset < TWL4030_GPIO_MAX)
301301 ret = twl4030_set_gpio_direction(offset, 1);
302302 else
303− ret = -EINVAL;
303+ ret = -EINVAL; /* LED outputs can't be set as input */
304304
305305 if (!ret)
306306 priv->direction &= ~BIT(offset);
@@ -354,11 +354,20 @@ static void twl_set(struct gpio_chip *chip, unsigned offset, int value) · 47 unmodified lines
354354 static int twl_direction_out(struct gpio_chip *chip, unsigned offset, int value)
355355 {
356356 struct gpio_twl4030_priv *priv = to_gpio_twl4030(chip);
357− int ret = -EINVAL;
357+ int ret = 0;
358358
359359 mutex_lock(&priv->mutex);
360− if (offset < TWL4030_GPIO_MAX)
360+ if (offset < TWL4030_GPIO_MAX) {
361361 ret = twl4030_set_gpio_direction(offset, 0);
362+ if (ret) {
363+ mutex_unlock(&priv->mutex);
364+ return ret;
365+ }
366+ }
367+
368+ /*
369+ * LED gpios i.e. offset >= TWL4030_GPIO_MAX are always output
370+ */
362371
363372 priv->direction |= BIT(offset);
364373 mutex_unlock(&priv->mutex);
drivers/gpu/drm/armada/armada_drm.h+1−0
@@ -103,6 +103,7 @@ void armada_drm_queue_unref_work(struct drm_device *, · 102 unmodified lines
103103 extern const struct drm_mode_config_funcs armada_drm_mode_config_funcs;
104104
105105 int armada_fbdev_init(struct drm_device *);
106+void armada_fbdev_lastclose(struct drm_device *);
106107 void armada_fbdev_fini(struct drm_device *);
107108
108109 int armada_overlay_plane_create(struct drm_device *, unsigned long);
drivers/gpu/drm/armada/armada_drv.c+6−1
@@ -321,6 +321,11 @@ static struct drm_ioctl_desc armada_ioctls[] = { · 320 unmodified lines
321321 DRM_UNLOCKED),
322322 };
323323
324+static void armada_drm_lastclose(struct drm_device *dev)
325+{
326+ armada_fbdev_lastclose(dev);
327+}
328+
324329 static const struct file_operations armada_drm_fops = {
325330 .owner = THIS_MODULE,
326331 .llseek = no_llseek,
@@ -337,7 +342,7 @@ static struct drm_driver armada_drm_driver = { · 10 unmodified lines
337342 .open = NULL,
338343 .preclose = NULL,
339344 .postclose = NULL,
340− .lastclose = NULL,
345+ .lastclose = armada_drm_lastclose,
341346 .unload = armada_drm_unload,
342347 .get_vblank_counter = drm_vblank_count,
343348 .enable_vblank = armada_drm_enable_vblank,
drivers/gpu/drm/armada/armada_fbdev.c+15−5
@@ -105,9 +105,9 @@ static int armada_fb_create(struct drm_fb_helper *fbh, · 104 unmodified lines
105105 drm_fb_helper_fill_fix(info, dfb->fb.pitches[0], dfb->fb.depth);
106106 drm_fb_helper_fill_var(info, fbh, sizes->fb_width, sizes->fb_height);
107107
108− DRM_DEBUG_KMS("allocated %dx%d %dbpp fb: 0x%08x\n",
109− dfb->fb.width, dfb->fb.height,
110− dfb->fb.bits_per_pixel, obj->phys_addr);
108+ DRM_DEBUG_KMS("allocated %dx%d %dbpp fb: 0x%08llx\n",
109+ dfb->fb.width, dfb->fb.height, dfb->fb.bits_per_pixel,
110+ (unsigned long long)obj->phys_addr);
111111
112112 return 0;
113113
@@ -177,6 +177,16 @@ int armada_fbdev_init(struct drm_device *dev) · 63 unmodified lines
177177 return ret;
178178 }
179179
180+void armada_fbdev_lastclose(struct drm_device *dev)
181+{
182+ struct armada_private *priv = dev->dev_private;
183+
184+ drm_modeset_lock_all(dev);
185+ if (priv->fbdev)
186+ drm_fb_helper_restore_fbdev_mode(priv->fbdev);
187+ drm_modeset_unlock_all(dev);
188+}
189+
180190 void armada_fbdev_fini(struct drm_device *dev)
181191 {
182192 struct armada_private *priv = dev->dev_private;
@@ -192,11 +202,11 @@ void armada_fbdev_fini(struct drm_device *dev) · 9 unmodified lines
192202 framebuffer_release(info);
193203 }
194204
205+ drm_fb_helper_fini(fbh);
206+
195207 if (fbh->fb)
196208 fbh->fb->funcs->destroy(fbh->fb);
197209
198− drm_fb_helper_fini(fbh);
199−
200210 priv->fbdev = NULL;
201211 }
202212 }
drivers/gpu/drm/armada/armada_gem.c+4−3
@@ -172,8 +172,9 @@ armada_gem_linear_back(struct drm_device *dev, struct armada_gem_object *obj) · 171 unmodified lines
172172 obj->dev_addr = obj->linear->start;
173173 }
174174
175− DRM_DEBUG_DRIVER("obj %p phys %#x dev %#x\n",
176− obj, obj->phys_addr, obj->dev_addr);
175+ DRM_DEBUG_DRIVER("obj %p phys %#llx dev %#llx\n", obj,
176+ (unsigned long long)obj->phys_addr,
177+ (unsigned long long)obj->dev_addr);
177178
178179 return 0;
179180 }
@@ -557,7 +558,6 @@ armada_gem_prime_import(struct drm_device *dev, struct dma_buf *buf) · 377 unmodified lines
557558 * refcount on the gem object itself.
558559 */
559560 drm_gem_object_reference(obj);
560− dma_buf_put(buf);
561561 return obj;
562562 }
563563 }
@@ -573,6 +573,7 @@ armada_gem_prime_import(struct drm_device *dev, struct dma_buf *buf) · 9 unmodified lines
573573 }
574574
575575 dobj->obj.import_attach = attach;
576+ get_dma_buf(buf);
576577
577578 /*
578579 * Don't call dma_buf_map_attachment() here - it maps the
drivers/gpu/drm/drm_edid.c+8−0
@@ -68,6 +68,8 @@ · 67 unmodified lines
6868 #define EDID_QUIRK_DETAILED_SYNC_PP (1 << 6)
6969 /* Force reduced-blanking timings for detailed modes */
7070 #define EDID_QUIRK_FORCE_REDUCED_BLANKING (1 << 7)
71+/* Force 8bpc */
72+#define EDID_QUIRK_FORCE_8BPC (1 << 8)
7173
7274 struct detailed_mode_closure {
7375 struct drm_connector *connector;
@@ -128,6 +130,9 @@ static struct edid_quirk { · 54 unmodified lines
128130
129131 /* Medion MD 30217 PG */
130132 { "MED", 0x7b8, EDID_QUIRK_PREFER_LARGE_75 },
133+
134+ /* Panel in Samsung NP700G7A-S01PL notebook reports 6bpc */
135+ { "SEC", 0xd033, EDID_QUIRK_FORCE_8BPC },
131136 };
132137
133138 /*
@@ -3435,6 +3440,9 @@ int drm_add_edid_modes(struct drm_connector *connector, struct edid *edid) · 3301 unmodified lines
34353440
34363441 drm_add_display_info(edid, &connector->display_info);
34373442
3443+ if (quirks & EDID_QUIRK_FORCE_8BPC)
3444+ connector->display_info.bpc = 8;
3445+
34383446 return num_modes;
34393447 }
34403448 EXPORT_SYMBOL(drm_add_edid_modes);
drivers/gpu/drm/drm_stub.c+3−3
@@ -566,11 +566,11 @@ err_unload: · 565 unmodified lines
566566 if (dev->driver->unload)
567567 dev->driver->unload(dev);
568568 err_primary_node:
569− drm_put_minor(dev->primary);
569+ drm_unplug_minor(dev->primary);
570570 err_render_node:
571− drm_put_minor(dev->render);
571+ drm_unplug_minor(dev->render);
572572 err_control_node:
573− drm_put_minor(dev->control);
573+ drm_unplug_minor(dev->control);
574574 err_agp:
575575 if (dev->driver->bus->agp_destroy)
576576 dev->driver->bus->agp_destroy(dev);
drivers/gpu/drm/i915/i915_dma.c+11−9
@@ -83,6 +83,14 @@ void i915_update_dri1_breadcrumb(struct drm_device *dev) · 82 unmodified lines
8383 drm_i915_private_t *dev_priv = dev->dev_private;
8484 struct drm_i915_master_private *master_priv;
8585
86+ /*
87+ * The dri breadcrumb update races against the drm master disappearing.
88+ * Instead of trying to fix this (this is by far not the only ums issue)
89+ * just don't do the update in kms mode.
90+ */
91+ if (drm_core_check_feature(dev, DRIVER_MODESET))
92+ return;
93+
8694 if (dev->primary->master) {
8795 master_priv = dev->primary->master->driver_priv;
8896 if (master_priv->sarea_priv)
@@ -1490,16 +1498,9 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags) · 1401 unmodified lines
14901498 spin_lock_init(&dev_priv->uncore.lock);
14911499 spin_lock_init(&dev_priv->mm.object_stat_lock);
14921500 mutex_init(&dev_priv->dpio_lock);
1493− mutex_init(&dev_priv->rps.hw_lock);
14941501 mutex_init(&dev_priv->modeset_restore_lock);
14951502
1496− mutex_init(&dev_priv->pc8.lock);
1497− dev_priv->pc8.requirements_met = false;
1498− dev_priv->pc8.gpu_idle = false;
1499− dev_priv->pc8.irqs_disabled = false;
1500− dev_priv->pc8.enabled = false;
1501− dev_priv->pc8.disable_count = 2; /* requirements_met + gpu_idle */
1502− INIT_DELAYED_WORK(&dev_priv->pc8.enable_work, hsw_enable_pc8_work);
1503+ intel_pm_setup(dev);
15031504
15041505 intel_display_crc_init(dev);
15051506
@@ -1603,7 +1604,6 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags) · 97 unmodified lines
16031604 }
16041605
16051606 intel_irq_init(dev);
1606− intel_pm_init(dev);
16071607 intel_uncore_sanitize(dev);
16081608
16091609 /* Try to make sure MCHBAR is enabled before poking at it */
@@ -1848,8 +1848,10 @@ void i915_driver_lastclose(struct drm_device * dev) · 238 unmodified lines
18481848
18491849 void i915_driver_preclose(struct drm_device * dev, struct drm_file *file_priv)
18501850 {
1851+ mutex_lock(&dev->struct_mutex);
18511852 i915_gem_context_close(dev, file_priv);
18521853 i915_gem_release(dev, file_priv);
1854+ mutex_unlock(&dev->struct_mutex);
18531855 }
18541856
18551857 void i915_driver_postclose(struct drm_device *dev, struct drm_file *file)
drivers/gpu/drm/i915/i915_drv.c+1−0
@@ -651,6 +651,7 @@ static int __i915_drm_thaw(struct drm_device *dev, bool restore_gtt_mappings) · 650 unmodified lines
651651 intel_modeset_init_hw(dev);
652652
653653 drm_modeset_lock_all(dev);
654+ drm_mode_config_reset(dev);
654655 intel_modeset_setup_hw_state(dev, true);
655656 drm_modeset_unlock_all(dev);
656657
drivers/gpu/drm/i915/i915_drv.h+6−3
@@ -1755,8 +1755,13 @@ struct drm_i915_file_private { · 1754 unmodified lines
17551755 #define IS_MOBILE(dev) (INTEL_INFO(dev)->is_mobile)
17561756 #define IS_HSW_EARLY_SDV(dev) (IS_HASWELL(dev) && \
17571757 ((dev)->pdev->device & 0xFF00) == 0x0C00)
1758−#define IS_ULT(dev) (IS_HASWELL(dev) && \
1758+#define IS_BDW_ULT(dev) (IS_BROADWELL(dev) && \
1759+ (((dev)->pdev->device & 0xf) == 0x2 || \
1760+ ((dev)->pdev->device & 0xf) == 0x6 || \
1761+ ((dev)->pdev->device & 0xf) == 0xe))
1762+#define IS_HSW_ULT(dev) (IS_HASWELL(dev) && \
17591763 ((dev)->pdev->device & 0xFF00) == 0x0A00)
1764+#define IS_ULT(dev) (IS_HSW_ULT(dev) || IS_BDW_ULT(dev))
17601765 #define IS_HSW_GT3(dev) (IS_HASWELL(dev) && \
17611766 ((dev)->pdev->device & 0x00F0) == 0x0020)
17621767 #define IS_PRELIMINARY_HW(intel_info) ((intel_info)->is_preliminary)
@@ -1901,9 +1906,7 @@ void i915_queue_hangcheck(struct drm_device *dev); · 138 unmodified lines
19011906 void i915_handle_error(struct drm_device *dev, bool wedged);
19021907
19031908 extern void intel_irq_init(struct drm_device *dev);
1904−extern void intel_pm_init(struct drm_device *dev);
19051909 extern void intel_hpd_init(struct drm_device *dev);
1906−extern void intel_pm_init(struct drm_device *dev);
19071910
19081911 extern void intel_uncore_sanitize(struct drm_device *dev);
19091912 extern void intel_uncore_early_sanitize(struct drm_device *dev);
drivers/gpu/drm/i915/i915_gem_context.c+12−4
@@ -347,10 +347,8 @@ void i915_gem_context_close(struct drm_device *dev, struct drm_file *file) · 346 unmodified lines
347347 {
348348 struct drm_i915_file_private *file_priv = file->driver_priv;
349349
350− mutex_lock(&dev->struct_mutex);
351350 idr_for_each(&file_priv->context_idr, context_idr_cleanup, NULL);
352351 idr_destroy(&file_priv->context_idr);
353− mutex_unlock(&dev->struct_mutex);
354352 }
355353
356354 static struct i915_hw_context *
@@ -423,11 +421,21 @@ static int do_switch(struct i915_hw_context *to) · 66 unmodified lines
423421 if (ret)
424422 return ret;
425423
426− /* Clear this page out of any CPU caches for coherent swap-in/out. Note
424+ /*
425+ * Pin can switch back to the default context if we end up calling into
426+ * evict_everything - as a last ditch gtt defrag effort that also
427+ * switches to the default context. Hence we need to reload from here.
428+ */
429+ from = ring->last_context;
430+
431+ /*
432+ * Clear this page out of any CPU caches for coherent swap-in/out. Note
427433 * that thanks to write = false in this call and us not setting any gpu
428434 * write domains when putting a context object onto the active list
429435 * (when switching away from it), this won't block.
430− * XXX: We need a real interface to do this instead of trickery. */
436+ *
437+ * XXX: We need a real interface to do this instead of trickery.
438+ */
431439 ret = i915_gem_object_set_to_gtt_domain(to->obj, false);
432440 if (ret) {
433441 i915_gem_object_unpin(to->obj);
drivers/gpu/drm/i915/i915_gem_evict.c+11−3
@@ -88,6 +88,7 @@ i915_gem_evict_something(struct drm_device *dev, struct i915_address_space *vm, · 87 unmodified lines
8888 } else
8989 drm_mm_init_scan(&vm->mm, min_size, alignment, cache_level);
9090
91+search_again:
9192 /* First see if there is a large enough contiguous idle region... */
9293 list_for_each_entry(vma, &vm->inactive_list, mm_list) {
9394 if (mark_free(vma, &unwind_list))
@@ -115,10 +116,17 @@ none: · 21 unmodified lines
115116 list_del_init(&vma->exec_list);
116117 }
117118
118− /* We expect the caller to unpin, evict all and try again, or give up.
119− * So calling i915_gem_evict_vm() is unnecessary.
119+ /* Can we unpin some objects such as idle hw contents,
120+ * or pending flips?
120121 */
121− return -ENOSPC;
122+ ret = nonblocking ? -ENOSPC : i915_gpu_idle(dev);
123+ if (ret)
124+ return ret;
125+
126+ /* Only idle the GPU and repeat the search once */
127+ i915_gem_retire_requests(dev);
128+ nonblocking = true;
129+ goto search_again;
122130
123131 found:
124132 /* drm_mm doesn't allow any other other operations while
drivers/gpu/drm/i915/i915_gem_gtt.c+7−2
@@ -337,8 +337,8 @@ static void gen8_ppgtt_cleanup(struct i915_address_space *vm) · 336 unmodified lines
337337 kfree(ppgtt->gen8_pt_dma_addr[i]);
338338 }
339339
340− __free_pages(ppgtt->gen8_pt_pages, ppgtt->num_pt_pages << PAGE_SHIFT);
341− __free_pages(ppgtt->pd_pages, ppgtt->num_pd_pages << PAGE_SHIFT);
340+ __free_pages(ppgtt->gen8_pt_pages, get_order(ppgtt->num_pt_pages << PAGE_SHIFT));
341+ __free_pages(ppgtt->pd_pages, get_order(ppgtt->num_pd_pages << PAGE_SHIFT));
342342 }
343343
344344 /**
@@ -1241,6 +1241,11 @@ static inline unsigned int gen8_get_total_gtt_size(u16 bdw_gmch_ctl) · 896 unmodified lines
12411241 bdw_gmch_ctl &= BDW_GMCH_GGMS_MASK;
12421242 if (bdw_gmch_ctl)
12431243 bdw_gmch_ctl = 1 << bdw_gmch_ctl;
1244+ if (bdw_gmch_ctl > 4) {
1245+ WARN_ON(!i915_preliminary_hw_support);
1246+ return 4<<20;
1247+ }
1248+
12441249 return bdw_gmch_ctl << 20;
12451250 }
12461251
drivers/gpu/drm/i915/intel_display.c+4−3
@@ -9135,7 +9135,7 @@ intel_pipe_config_compare(struct drm_device *dev, · 9134 unmodified lines
91359135 if (IS_G4X(dev) || INTEL_INFO(dev)->gen >= 5)
91369136 PIPE_CONF_CHECK_I(pipe_bpp);
91379137
9138− if (!IS_HASWELL(dev)) {
9138+ if (!HAS_DDI(dev)) {
91399139 PIPE_CONF_CHECK_CLOCK_FUZZY(adjusted_mode.crtc_clock);
91409140 PIPE_CONF_CHECK_CLOCK_FUZZY(port_clock);
91419141 }
@@ -11036,8 +11036,6 @@ void intel_modeset_setup_hw_state(struct drm_device *dev, · 1894 unmodified lines
1103611036 }
1103711037
1103811038 intel_modeset_check_state(dev);
11039−
11040− drm_mode_config_reset(dev);
1104111039 }
1104211040
1104311041 void intel_modeset_gem_init(struct drm_device *dev)
@@ -11046,7 +11044,10 @@ void intel_modeset_gem_init(struct drm_device *dev) · 2 unmodified lines
1104611044
1104711045 intel_setup_overlay(dev);
1104811046
11047+ drm_modeset_lock_all(dev);
11048+ drm_mode_config_reset(dev);
1104911049 intel_modeset_setup_hw_state(dev, false);
11050+ drm_modeset_unlock_all(dev);
1105011051 }
1105111052
1105211053 void intel_modeset_cleanup(struct drm_device *dev)
drivers/gpu/drm/i915/intel_drv.h+1−0
@@ -821,6 +821,7 @@ void intel_update_sprite_watermarks(struct drm_plane *plane, · 820 unmodified lines
821821 uint32_t sprite_width, int pixel_size,
822822 bool enabled, bool scaled);
823823 void intel_init_pm(struct drm_device *dev);
824+void intel_pm_setup(struct drm_device *dev);
824825 bool intel_fbc_enabled(struct drm_device *dev);
825826 void intel_update_fbc(struct drm_device *dev);
826827 void intel_gpu_ips_init(struct drm_i915_private *dev_priv);
drivers/gpu/drm/i915/intel_panel.c+23−3
@@ -451,7 +451,9 @@ static u32 intel_panel_get_backlight(struct drm_device *dev, · 450 unmodified lines
451451
452452 spin_lock_irqsave(&dev_priv->backlight.lock, flags);
453453
454− if (HAS_PCH_SPLIT(dev)) {
454+ if (IS_BROADWELL(dev)) {
455+ val = I915_READ(BLC_PWM_PCH_CTL2) & BACKLIGHT_DUTY_CYCLE_MASK;
456+ } else if (HAS_PCH_SPLIT(dev)) {
455457 val = I915_READ(BLC_PWM_CPU_CTL) & BACKLIGHT_DUTY_CYCLE_MASK;
456458 } else {
457459 if (IS_VALLEYVIEW(dev))
@@ -479,6 +481,13 @@ static u32 intel_panel_get_backlight(struct drm_device *dev, · 21 unmodified lines
479481 return val;
480482 }
481483
484+static void intel_bdw_panel_set_backlight(struct drm_device *dev, u32 level)
485+{
486+ struct drm_i915_private *dev_priv = dev->dev_private;
487+ u32 val = I915_READ(BLC_PWM_PCH_CTL2) & ~BACKLIGHT_DUTY_CYCLE_MASK;
488+ I915_WRITE(BLC_PWM_PCH_CTL2, val | level);
489+}
490+
482491 static void intel_pch_panel_set_backlight(struct drm_device *dev, u32 level)
483492 {
484493 struct drm_i915_private *dev_priv = dev->dev_private;
@@ -496,7 +505,9 @@ static void intel_panel_actually_set_backlight(struct drm_device *dev, · 11 unmodified lines
496505 DRM_DEBUG_DRIVER("set backlight PWM = %d\n", level);
497506 level = intel_panel_compute_brightness(dev, pipe, level);
498507
499− if (HAS_PCH_SPLIT(dev))
508+ if (IS_BROADWELL(dev))
509+ return intel_bdw_panel_set_backlight(dev, level);
510+ else if (HAS_PCH_SPLIT(dev))
500511 return intel_pch_panel_set_backlight(dev, level);
501512
502513 if (is_backlight_combination_mode(dev)) {
@@ -666,7 +677,16 @@ void intel_panel_enable_backlight(struct intel_connector *connector) · 163 unmodified lines
666677 POSTING_READ(reg);
667678 I915_WRITE(reg, tmp | BLM_PWM_ENABLE);
668679
669− if (HAS_PCH_SPLIT(dev) &&
680+ if (IS_BROADWELL(dev)) {
681+ /*
682+ * Broadwell requires PCH override to drive the PCH
683+ * backlight pin. The above will configure the CPU
684+ * backlight pin, which we don't plan to use.
685+ */
686+ tmp = I915_READ(BLC_PWM_PCH_CTL1);
687+ tmp |= BLM_PCH_OVERRIDE_ENABLE | BLM_PCH_PWM_ENABLE;
688+ I915_WRITE(BLC_PWM_PCH_CTL1, tmp);
689+ } else if (HAS_PCH_SPLIT(dev) &&
670690 !(dev_priv->quirks & QUIRK_NO_PCH_PWM_ENABLE)) {
671691 tmp = I915_READ(BLC_PWM_PCH_CTL1);
672692 tmp |= BLM_PCH_PWM_ENABLE;
drivers/gpu/drm/i915/intel_pm.c+27−2
@@ -5685,6 +5685,7 @@ static void __intel_set_power_well(struct drm_device *dev, bool enable) · 5684 unmodified lines
56855685 {
56865686 struct drm_i915_private *dev_priv = dev->dev_private;
56875687 bool is_enabled, enable_requested;
5688+ unsigned long irqflags;
56885689 uint32_t tmp;
56895690
56905691 tmp = I915_READ(HSW_PWR_WELL_DRIVER);
@@ -5702,9 +5703,24 @@ static void __intel_set_power_well(struct drm_device *dev, bool enable) · 11 unmodified lines
57025703 HSW_PWR_WELL_STATE_ENABLED), 20))
57035704 DRM_ERROR("Timeout enabling power well\n");
57045705 }
5706+
5707+ if (IS_BROADWELL(dev)) {
5708+ spin_lock_irqsave(&dev_priv->irq_lock, irqflags);
5709+ I915_WRITE(GEN8_DE_PIPE_IMR(PIPE_B),
5710+ dev_priv->de_irq_mask[PIPE_B]);
5711+ I915_WRITE(GEN8_DE_PIPE_IER(PIPE_B),
5712+ ~dev_priv->de_irq_mask[PIPE_B] |
5713+ GEN8_PIPE_VBLANK);
5714+ I915_WRITE(GEN8_DE_PIPE_IMR(PIPE_C),
5715+ dev_priv->de_irq_mask[PIPE_C]);
5716+ I915_WRITE(GEN8_DE_PIPE_IER(PIPE_C),
5717+ ~dev_priv->de_irq_mask[PIPE_C] |
5718+ GEN8_PIPE_VBLANK);
5719+ POSTING_READ(GEN8_DE_PIPE_IER(PIPE_C));
5720+ spin_unlock_irqrestore(&dev_priv->irq_lock, irqflags);
5721+ }
57055722 } else {
57065723 if (enable_requested) {
5707− unsigned long irqflags;
57085724 enum pipe p;
57095725
57105726 I915_WRITE(HSW_PWR_WELL_DRIVER, 0);
@@ -6130,10 +6146,19 @@ int vlv_freq_opcode(int ddr_freq, int val) · 419 unmodified lines
61306146 return val;
61316147 }
61326148
6133−void intel_pm_init(struct drm_device *dev)
6149+void intel_pm_setup(struct drm_device *dev)
61346150 {
61356151 struct drm_i915_private *dev_priv = dev->dev_private;
61366152
6153+ mutex_init(&dev_priv->rps.hw_lock);
6154+
6155+ mutex_init(&dev_priv->pc8.lock);
6156+ dev_priv->pc8.requirements_met = false;
6157+ dev_priv->pc8.gpu_idle = false;
6158+ dev_priv->pc8.irqs_disabled = false;
6159+ dev_priv->pc8.enabled = false;
6160+ dev_priv->pc8.disable_count = 2; /* requirements_met + gpu_idle */
6161+ INIT_DELAYED_WORK(&dev_priv->pc8.enable_work, hsw_enable_pc8_work);
61376162 INIT_DELAYED_WORK(&dev_priv->rps.delayed_resume_work,
61386163 intel_gen6_powersave_work);
61396164 }
drivers/gpu/drm/i915/intel_ringbuffer.c+1−0
@@ -965,6 +965,7 @@ void intel_ring_setup_status_page(struct intel_ring_buffer *ring) · 964 unmodified lines
965965 } else if (IS_GEN6(ring->dev)) {
966966 mmio = RING_HWS_PGA_GEN6(ring->mmio_base);
967967 } else {
968+ /* XXX: gen8 returns to sanity */
968969 mmio = RING_HWS_PGA(ring->mmio_base);
969970 }
970971
drivers/gpu/drm/i915/intel_uncore.c+1−0
@@ -784,6 +784,7 @@ static int gen6_do_reset(struct drm_device *dev) · 783 unmodified lines
784784 int intel_gpu_reset(struct drm_device *dev)
785785 {
786786 switch (INTEL_INFO(dev)->gen) {
787+ case 8:
787788 case 7:
788789 case 6: return gen6_do_reset(dev);
789790 case 5: return ironlake_do_reset(dev);
drivers/gpu/drm/nouveau/nouveau_drm.c+6−0
@@ -858,6 +858,12 @@ static int nouveau_pmops_runtime_suspend(struct device *dev) · 857 unmodified lines
858858 if (nouveau_runtime_pm == 0)
859859 return -EINVAL;
860860
861+ /* are we optimus enabled? */
862+ if (nouveau_runtime_pm == -1 && !nouveau_is_optimus() && !nouveau_is_v1_dsm()) {
863+ DRM_DEBUG_DRIVER("failing to power off - not optimus\n");
864+ return -EINVAL;
865+ }
866+
861867 nv_debug_level(SILENT);
862868 drm_kms_helper_poll_disable(drm_dev);
863869 vga_switcheroo_set_dynamic_switch(pdev, VGA_SWITCHEROO_OFF);
drivers/gpu/drm/radeon/atombios_crtc.c+3−1
@@ -1196,7 +1196,9 @@ static int dce4_crtc_do_set_base(struct drm_crtc *crtc, · 1195 unmodified lines
11961196 } else if ((rdev->family == CHIP_TAHITI) ||
11971197 (rdev->family == CHIP_PITCAIRN))
11981198 fb_format |= SI_GRPH_PIPE_CONFIG(SI_ADDR_SURF_P8_32x32_8x16);
1199− else if (rdev->family == CHIP_VERDE)
1199+ else if ((rdev->family == CHIP_VERDE) ||
1200+ (rdev->family == CHIP_OLAND) ||
1201+ (rdev->family == CHIP_HAINAN)) /* for completeness. HAINAN has no display hw */
12001202 fb_format |= SI_GRPH_PIPE_CONFIG(SI_ADDR_SURF_P4_8x16);
12011203
12021204 switch (radeon_crtc->crtc_id) {
drivers/gpu/drm/radeon/cik_sdma.c+1−1
@@ -458,7 +458,7 @@ int cik_copy_dma(struct radeon_device *rdev, · 457 unmodified lines
458458 radeon_ring_write(ring, 0); /* src/dst endian swap */
459459 radeon_ring_write(ring, src_offset & 0xffffffff);
460460 radeon_ring_write(ring, upper_32_bits(src_offset) & 0xffffffff);
461− radeon_ring_write(ring, dst_offset & 0xfffffffc);
461+ radeon_ring_write(ring, dst_offset & 0xffffffff);
462462 radeon_ring_write(ring, upper_32_bits(dst_offset) & 0xffffffff);
463463 src_offset += cur_size_in_bytes;
464464 dst_offset += cur_size_in_bytes;
drivers/gpu/drm/radeon/radeon_asic.c+2−2
@@ -2021,7 +2021,7 @@ static struct radeon_asic ci_asic = { · 2020 unmodified lines
20212021 .hdmi_setmode = &evergreen_hdmi_setmode,
20222022 },
20232023 .copy = {
2024− .blit = NULL,
2024+ .blit = &cik_copy_cpdma,
20252025 .blit_ring_index = RADEON_RING_TYPE_GFX_INDEX,
20262026 .dma = &cik_copy_dma,
20272027 .dma_ring_index = R600_RING_TYPE_DMA_INDEX,
@@ -2122,7 +2122,7 @@ static struct radeon_asic kv_asic = { · 94 unmodified lines
21222122 .hdmi_setmode = &evergreen_hdmi_setmode,
21232123 },
21242124 .copy = {
2125− .blit = NULL,
2125+ .blit = &cik_copy_cpdma,
21262126 .blit_ring_index = RADEON_RING_TYPE_GFX_INDEX,
21272127 .dma = &cik_copy_dma,
21282128 .dma_ring_index = R600_RING_TYPE_DMA_INDEX,
drivers/gpu/drm/radeon/radeon_drv.c+0−10
@@ -508,15 +508,6 @@ static const struct file_operations radeon_driver_kms_fops = { · 507 unmodified lines
508508 #endif
509509 };
510510
511−
512−static void
513−radeon_pci_shutdown(struct pci_dev *pdev)
514−{
515− struct drm_device *dev = pci_get_drvdata(pdev);
516−
517− radeon_driver_unload_kms(dev);
518−}
519−
520511 static struct drm_driver kms_driver = {
521512 .driver_features =
522513 DRIVER_USE_AGP |
@@ -586,7 +577,6 @@ static struct pci_driver radeon_kms_pci_driver = { · 63 unmodified lines
586577 .probe = radeon_pci_probe,
587578 .remove = radeon_pci_remove,
588579 .driver.pm = &radeon_pm_ops,
589− .shutdown = radeon_pci_shutdown,
590580 };
591581
592582 static int __init radeon_init(void)
drivers/gpu/drm/radeon/rs690.c+10−0
@@ -162,6 +162,16 @@ static void rs690_mc_init(struct radeon_device *rdev) · 161 unmodified lines
162162 base = RREG32_MC(R_000100_MCCFG_FB_LOCATION);
163163 base = G_000100_MC_FB_START(base) << 16;
164164 rdev->mc.igp_sideport_enabled = radeon_atombios_sideport_present(rdev);
165+ /* Some boards seem to be configured for 128MB of sideport memory,
166+ * but really only have 64MB. Just skip the sideport and use
167+ * UMA memory.
168+ */
169+ if (rdev->mc.igp_sideport_enabled &&
170+ (rdev->mc.real_vram_size == (384 * 1024 * 1024))) {
171+ base += 128 * 1024 * 1024;
172+ rdev->mc.real_vram_size -= 128 * 1024 * 1024;
173+ rdev->mc.mc_vram_size = rdev->mc.real_vram_size;
174+ }
165175
166176 /* Use K8 direct mapping for fast fb access. */
167177 rdev->fastfb_working = false;
drivers/gpu/drm/ttm/ttm_bo_vm.c+3−3
@@ -169,9 +169,9 @@ static int ttm_bo_vm_fault(struct vm_area_struct *vma, struct vm_fault *vmf) · 168 unmodified lines
169169 }
170170
171171 page_offset = ((address - vma->vm_start) >> PAGE_SHIFT) +
172− drm_vma_node_start(&bo->vma_node) - vma->vm_pgoff;
173− page_last = vma_pages(vma) +
174− drm_vma_node_start(&bo->vma_node) - vma->vm_pgoff;
172+ vma->vm_pgoff - drm_vma_node_start(&bo->vma_node);
173+ page_last = vma_pages(vma) + vma->vm_pgoff -
174+ drm_vma_node_start(&bo->vma_node);
175175
176176 if (unlikely(page_offset >= bo->num_pages)) {
177177 retval = VM_FAULT_SIGBUS;
drivers/gpu/drm/vmwgfx/vmwgfx_ioctl.c+3−0
@@ -68,6 +68,9 @@ int vmw_getparam_ioctl(struct drm_device *dev, void *data, · 67 unmodified lines
6868 SVGA_FIFO_3D_HWVERSION));
6969 break;
7070 }
71+ case DRM_VMW_PARAM_MAX_SURF_MEMORY:
72+ param->value = dev_priv->memory_size;
73+ break;
7174 default:
7275 DRM_ERROR("Illegal vmwgfx get param request: %d\n",
7376 param->param);
drivers/iio/adc/ad7887.c+14−2
@@ -200,7 +200,13 @@ static const struct ad7887_chip_info ad7887_chip_info_tbl[] = { · 199 unmodified lines
200200 .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE),
201201 .address = 1,
202202 .scan_index = 1,
203− .scan_type = IIO_ST('u', 12, 16, 0),
203+ .scan_type = {
204+ .sign = 'u',
205+ .realbits = 12,
206+ .storagebits = 16,
207+ .shift = 0,
208+ .endianness = IIO_BE,
209+ },
204210 },
205211 .channel[1] = {
206212 .type = IIO_VOLTAGE,
@@ -210,7 +216,13 @@ static const struct ad7887_chip_info ad7887_chip_info_tbl[] = { · 3 unmodified lines
210216 .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE),
211217 .address = 0,
212218 .scan_index = 0,
213− .scan_type = IIO_ST('u', 12, 16, 0),
219+ .scan_type = {
220+ .sign = 'u',
221+ .realbits = 12,
222+ .storagebits = 16,
223+ .shift = 0,
224+ .endianness = IIO_BE,
225+ },
214226 },
215227 .channel[2] = IIO_CHAN_SOFT_TIMESTAMP(2),
216228 .int_vref_mv = 2500,
drivers/iio/imu/adis16400_core.c+6−1
@@ -651,7 +651,12 @@ static const struct iio_chan_spec adis16448_channels[] = { · 650 unmodified lines
651651 .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE),
652652 .address = ADIS16448_BARO_OUT,
653653 .scan_index = ADIS16400_SCAN_BARO,
654− .scan_type = IIO_ST('s', 16, 16, 0),
654+ .scan_type = {
655+ .sign = 's',
656+ .realbits = 16,
657+ .storagebits = 16,
658+ .endianness = IIO_BE,
659+ },
655660 },
656661 ADIS16400_TEMP_CHAN(ADIS16448_TEMP_OUT, 12),
657662 IIO_CHAN_SOFT_TIMESTAMP(11)
drivers/iio/light/cm36651.c+1−1
@@ -387,7 +387,7 @@ static int cm36651_read_int_time(struct cm36651_data *cm36651, · 386 unmodified lines
387387 return -EINVAL;
388388 }
389389
390− return IIO_VAL_INT_PLUS_MICRO;
390+ return IIO_VAL_INT;
391391 }
392392
393393 static int cm36651_write_int_time(struct cm36651_data *cm36651,
drivers/infiniband/ulp/isert/ib_isert.c+16−6
@@ -207,7 +207,9 @@ isert_free_rx_descriptors(struct isert_conn *isert_conn) · 206 unmodified lines
207207 isert_conn->conn_rx_descs = NULL;
208208 }
209209
210+static void isert_cq_tx_work(struct work_struct *);
210211 static void isert_cq_tx_callback(struct ib_cq *, void *);
212+static void isert_cq_rx_work(struct work_struct *);
211213 static void isert_cq_rx_callback(struct ib_cq *, void *);
212214
213215 static int
@@ -259,26 +261,36 @@ isert_create_device_ib_res(struct isert_device *device) · 45 unmodified lines
259261 cq_desc[i].device = device;
260262 cq_desc[i].cq_index = i;
261263
264+ INIT_WORK(&cq_desc[i].cq_rx_work, isert_cq_rx_work);
262265 device->dev_rx_cq[i] = ib_create_cq(device->ib_device,
263266 isert_cq_rx_callback,
264267 isert_cq_event_callback,
265268 (void *)&cq_desc[i],
266269 ISER_MAX_RX_CQ_LEN, i);
267− if (IS_ERR(device->dev_rx_cq[i]))
270+ if (IS_ERR(device->dev_rx_cq[i])) {
271+ ret = PTR_ERR(device->dev_rx_cq[i]);
272+ device->dev_rx_cq[i] = NULL;
268273 goto out_cq;
274+ }
269275
276+ INIT_WORK(&cq_desc[i].cq_tx_work, isert_cq_tx_work);
270277 device->dev_tx_cq[i] = ib_create_cq(device->ib_device,
271278 isert_cq_tx_callback,
272279 isert_cq_event_callback,
273280 (void *)&cq_desc[i],
274281 ISER_MAX_TX_CQ_LEN, i);
275− if (IS_ERR(device->dev_tx_cq[i]))
282+ if (IS_ERR(device->dev_tx_cq[i])) {
283+ ret = PTR_ERR(device->dev_tx_cq[i]);
284+ device->dev_tx_cq[i] = NULL;
276285 goto out_cq;
286+ }
277287
278− if (ib_req_notify_cq(device->dev_rx_cq[i], IB_CQ_NEXT_COMP))
288+ ret = ib_req_notify_cq(device->dev_rx_cq[i], IB_CQ_NEXT_COMP);
289+ if (ret)
279290 goto out_cq;
280291
281− if (ib_req_notify_cq(device->dev_tx_cq[i], IB_CQ_NEXT_COMP))
292+ ret = ib_req_notify_cq(device->dev_tx_cq[i], IB_CQ_NEXT_COMP);
293+ if (ret)
282294 goto out_cq;
283295 }
284296
@@ -1724,7 +1736,6 @@ isert_cq_tx_callback(struct ib_cq *cq, void *context) · 1439 unmodified lines
17241736 {
17251737 struct isert_cq_desc *cq_desc = (struct isert_cq_desc *)context;
17261738
1727− INIT_WORK(&cq_desc->cq_tx_work, isert_cq_tx_work);
17281739 queue_work(isert_comp_wq, &cq_desc->cq_tx_work);
17291740 }
17301741
@@ -1768,7 +1779,6 @@ isert_cq_rx_callback(struct ib_cq *cq, void *context) · 37 unmodified lines
17681779 {
17691780 struct isert_cq_desc *cq_desc = (struct isert_cq_desc *)context;
17701781
1771− INIT_WORK(&cq_desc->cq_rx_work, isert_cq_rx_work);
17721782 queue_work(isert_rx_wq, &cq_desc->cq_rx_work);
17731783 }
17741784
drivers/net/can/usb/ems_usb.c+2−1
@@ -625,6 +625,7 @@ static int ems_usb_start(struct ems_usb *dev) · 624 unmodified lines
625625 usb_unanchor_urb(urb);
626626 usb_free_coherent(dev->udev, RX_BUFFER_SIZE, buf,
627627 urb->transfer_dma);
628+ usb_free_urb(urb);
628629 break;
629630 }
630631
@@ -798,8 +799,8 @@ static netdev_tx_t ems_usb_start_xmit(struct sk_buff *skb, struct net_device *ne · 167 unmodified lines
798799 * allowed (MAX_TX_URBS).
799800 */
800801 if (!context) {
801− usb_unanchor_urb(urb);
802802 usb_free_coherent(dev->udev, size, buf, urb->transfer_dma);
803+ usb_free_urb(urb);
803804
804805 netdev_warn(netdev, "couldn't find free context\n");
805806
drivers/net/can/usb/peak_usb/pcan_usb_pro.c+3−0
@@ -927,6 +927,9 @@ static int pcan_usb_pro_init(struct peak_usb_device *dev) · 926 unmodified lines
927927 /* set LED in default state (end of init phase) */
928928 pcan_usb_pro_set_led(dev, 0, 1);
929929
930+ kfree(bi);
931+ kfree(fi);
932+
930933 return 0;
931934
932935 err_out:
drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c+21−26
@@ -447,8 +447,9 @@ irqreturn_t qlcnic_83xx_intr(int irq, void *data) · 446 unmodified lines
447447
448448 qlcnic_83xx_poll_process_aen(adapter);
449449
450− if (ahw->diag_test == QLCNIC_INTERRUPT_TEST) {
451− ahw->diag_cnt++;
450+ if (ahw->diag_test) {
451+ if (ahw->diag_test == QLCNIC_INTERRUPT_TEST)
452+ ahw->diag_cnt++;
452453 qlcnic_83xx_enable_legacy_msix_mbx_intr(adapter);
453454 return IRQ_HANDLED;
454455 }
@@ -1345,11 +1346,6 @@ static int qlcnic_83xx_diag_alloc_res(struct net_device *netdev, int test, · 890 unmodified lines
13451346 }
13461347
13471348 if (adapter->ahw->diag_test == QLCNIC_LOOPBACK_TEST) {
1348− /* disable and free mailbox interrupt */
1349− if (!(adapter->flags & QLCNIC_MSIX_ENABLED)) {
1350− qlcnic_83xx_enable_mbx_poll(adapter);
1351− qlcnic_83xx_free_mbx_intr(adapter);
1352− }
13531349 adapter->ahw->loopback_state = 0;
13541350 adapter->ahw->hw_ops->setup_link_event(adapter, 1);
13551351 }
@@ -1363,33 +1359,20 @@ static void qlcnic_83xx_diag_free_res(struct net_device *netdev, · 7 unmodified lines
13631359 {
13641360 struct qlcnic_adapter *adapter = netdev_priv(netdev);
13651361 struct qlcnic_host_sds_ring *sds_ring;
1366− int ring, err;
1362+ int ring;
13671363
13681364 clear_bit(__QLCNIC_DEV_UP, &adapter->state);
13691365 if (adapter->ahw->diag_test == QLCNIC_INTERRUPT_TEST) {
13701366 for (ring = 0; ring < adapter->drv_sds_rings; ring++) {
13711367 sds_ring = &adapter->recv_ctx->sds_rings[ring];
1372− qlcnic_83xx_disable_intr(adapter, sds_ring);
1373− if (!(adapter->flags & QLCNIC_MSIX_ENABLED))
1374− qlcnic_83xx_enable_mbx_poll(adapter);
1368+ if (adapter->flags & QLCNIC_MSIX_ENABLED)
1369+ qlcnic_83xx_disable_intr(adapter, sds_ring);
13751370 }
13761371 }
13771372
13781373 qlcnic_fw_destroy_ctx(adapter);
13791374 qlcnic_detach(adapter);
13801375
1381− if (adapter->ahw->diag_test == QLCNIC_LOOPBACK_TEST) {
1382− if (!(adapter->flags & QLCNIC_MSIX_ENABLED)) {
1383− err = qlcnic_83xx_setup_mbx_intr(adapter);
1384− qlcnic_83xx_disable_mbx_poll(adapter);
1385− if (err) {
1386− dev_err(&adapter->pdev->dev,
1387− "%s: failed to setup mbx interrupt\n",
1388− __func__);
1389− goto out;
1390− }
1391− }
1392− }
13931376 adapter->ahw->diag_test = 0;
13941377 adapter->drv_sds_rings = drv_sds_rings;
13951378
@@ -1399,9 +1382,6 @@ static void qlcnic_83xx_diag_free_res(struct net_device *netdev, · 3 unmodified lines
13991382 if (netif_running(netdev))
14001383 __qlcnic_up(adapter, netdev);
14011384
1402− if (adapter->ahw->diag_test == QLCNIC_INTERRUPT_TEST &&
1403− !(adapter->flags & QLCNIC_MSIX_ENABLED))
1404− qlcnic_83xx_disable_mbx_poll(adapter);
14051385 out:
14061386 netif_device_attach(netdev);
14071387 }
@@ -3754,6 +3734,19 @@ static void qlcnic_83xx_decode_mbx_rsp(struct qlcnic_adapter *adapter, · 2346 unmodified lines
37543734 return;
37553735 }
37563736
3737+static inline void qlcnic_dump_mailbox_registers(struct qlcnic_adapter *adapter)
3738+{
3739+ struct qlcnic_hardware_context *ahw = adapter->ahw;
3740+ u32 offset;
3741+
3742+ offset = QLCRDX(ahw, QLCNIC_DEF_INT_MASK);
3743+ dev_info(&adapter->pdev->dev, "Mbx interrupt mask=0x%x, Mbx interrupt enable=0x%x, Host mbx control=0x%x, Fw mbx control=0x%x",
3744+ readl(ahw->pci_base0 + offset),
3745+ QLCRDX(ahw, QLCNIC_MBX_INTR_ENBL),
3746+ QLCRDX(ahw, QLCNIC_HOST_MBX_CTRL),
3747+ QLCRDX(ahw, QLCNIC_FW_MBX_CTRL));
3748+}
3749+
37573750 static void qlcnic_83xx_mailbox_worker(struct work_struct *work)
37583751 {
37593752 struct qlcnic_mailbox *mbx = container_of(work, struct qlcnic_mailbox,
@@ -3798,6 +3791,8 @@ static void qlcnic_83xx_mailbox_worker(struct work_struct *work) · 38 unmodified lines
37983791 __func__, cmd->cmd_op, cmd->type, ahw->pci_func,
37993792 ahw->op_mode);
38003793 clear_bit(QLC_83XX_MBX_READY, &mbx->status);
3794+ qlcnic_dump_mailbox_registers(adapter);
3795+ qlcnic_83xx_get_mbx_data(adapter, cmd);
38013796 qlcnic_dump_mbx(adapter, cmd);
38023797 qlcnic_83xx_idc_request_reset(adapter,
38033798 QLCNIC_FORCE_FW_DUMP_KEY);
drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.h+1−0
@@ -662,4 +662,5 @@ pci_ers_result_t qlcnic_83xx_io_error_detected(struct pci_dev *, · 661 unmodified lines
662662 pci_channel_state_t);
663663 pci_ers_result_t qlcnic_83xx_io_slot_reset(struct pci_dev *);
664664 void qlcnic_83xx_io_resume(struct pci_dev *);
665+void qlcnic_83xx_stop_hw(struct qlcnic_adapter *);
665666 #endif
drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_init.c+40−25
@@ -740,6 +740,7 @@ static int qlcnic_83xx_idc_unknown_state(struct qlcnic_adapter *adapter) · 739 unmodified lines
740740 adapter->ahw->idc.err_code = -EIO;
741741 dev_err(&adapter->pdev->dev,
742742 "%s: Device in unknown state\n", __func__);
743+ clear_bit(__QLCNIC_RESETTING, &adapter->state);
743744 return 0;
744745 }
745746
@@ -818,7 +819,6 @@ static int qlcnic_83xx_idc_ready_state(struct qlcnic_adapter *adapter) · 72 unmodified lines
818819 struct qlcnic_hardware_context *ahw = adapter->ahw;
819820 struct qlcnic_mailbox *mbx = ahw->mailbox;
820821 int ret = 0;
821− u32 owner;
822822 u32 val;
823823
824824 /* Perform NIC configuration based ready state entry actions */
@@ -848,9 +848,9 @@ static int qlcnic_83xx_idc_ready_state(struct qlcnic_adapter *adapter) · 23 unmodified lines
848848 set_bit(__QLCNIC_RESETTING, &adapter->state);
849849 qlcnic_83xx_idc_enter_need_reset_state(adapter, 1);
850850 } else {
851− owner = qlcnic_83xx_idc_find_reset_owner_id(adapter);
852− if (ahw->pci_func == owner)
853− qlcnic_dump_fw(adapter);
851+ netdev_info(adapter->netdev, "%s: Auto firmware recovery is disabled\n",
852+ __func__);
853+ qlcnic_83xx_idc_enter_failed_state(adapter, 1);
854854 }
855855 return -EIO;
856856 }
@@ -948,13 +948,26 @@ static int qlcnic_83xx_idc_need_quiesce_state(struct qlcnic_adapter *adapter) · 91 unmodified lines
948948 return 0;
949949 }
950950
951−static int qlcnic_83xx_idc_failed_state(struct qlcnic_adapter *adapter)
951+static void qlcnic_83xx_idc_failed_state(struct qlcnic_adapter *adapter)
952952 {
953− dev_err(&adapter->pdev->dev, "%s: please restart!!\n", __func__);
953+ struct qlcnic_hardware_context *ahw = adapter->ahw;
954+ u32 val, owner;
955+
956+ val = QLCRDX(adapter->ahw, QLC_83XX_IDC_CTRL);
957+ if (val & QLC_83XX_IDC_DISABLE_FW_RESET_RECOVERY) {
958+ owner = qlcnic_83xx_idc_find_reset_owner_id(adapter);
959+ if (ahw->pci_func == owner) {
960+ qlcnic_83xx_stop_hw(adapter);
961+ qlcnic_dump_fw(adapter);
962+ }
963+ }
964+
965+ netdev_warn(adapter->netdev, "%s: Reboot will be required to recover the adapter!!\n",
966+ __func__);
954967 clear_bit(__QLCNIC_RESETTING, &adapter->state);
955− adapter->ahw->idc.err_code = -EIO;
968+ ahw->idc.err_code = -EIO;
956969
957− return 0;
970+ return;
958971 }
959972
960973 static int qlcnic_83xx_idc_quiesce_state(struct qlcnic_adapter *adapter)
@@ -1063,12 +1076,6 @@ void qlcnic_83xx_idc_poll_dev_state(struct work_struct *work) · 102 unmodified lines
10631076 adapter->ahw->idc.prev_state = adapter->ahw->idc.curr_state;
10641077 qlcnic_83xx_periodic_tasks(adapter);
10651078
1066− /* Do not reschedule if firmaware is in hanged state and auto
1067− * recovery is disabled
1068− */
1069− if ((adapter->flags & QLCNIC_FW_HANG) && !qlcnic_auto_fw_reset)
1070− return;
1071−
10721079 /* Re-schedule the function */
10731080 if (test_bit(QLC_83XX_MODULE_LOADED, &adapter->ahw->idc.status))
10741081 qlcnic_schedule_work(adapter, qlcnic_83xx_idc_poll_dev_state,
@@ -1219,10 +1226,10 @@ void qlcnic_83xx_idc_request_reset(struct qlcnic_adapter *adapter, u32 key) · 144 unmodified lines
12191226 }
12201227
12211228 val = QLCRDX(adapter->ahw, QLC_83XX_IDC_CTRL);
1222− if ((val & QLC_83XX_IDC_DISABLE_FW_RESET_RECOVERY) ||
1223− !qlcnic_auto_fw_reset) {
1224− dev_err(&adapter->pdev->dev,
1225− "%s:failed, device in non reset mode\n", __func__);
1229+ if (val & QLC_83XX_IDC_DISABLE_FW_RESET_RECOVERY) {
1230+ netdev_info(adapter->netdev, "%s: Auto firmware recovery is disabled\n",
1231+ __func__);
1232+ qlcnic_83xx_idc_enter_failed_state(adapter, 0);
12261233 qlcnic_83xx_unlock_driver(adapter);
12271234 return;
12281235 }
@@ -1254,24 +1261,24 @@ static int qlcnic_83xx_copy_bootloader(struct qlcnic_adapter *adapter) · 25 unmodified lines
12541261 if (size & 0xF)
12551262 size = (size + 16) & ~0xF;
12561263
1257− p_cache = kzalloc(size, GFP_KERNEL);
1264+ p_cache = vzalloc(size);
12581265 if (p_cache == NULL)
12591266 return -ENOMEM;
12601267
12611268 ret = qlcnic_83xx_lockless_flash_read32(adapter, src, p_cache,
12621269 size / sizeof(u32));
12631270 if (ret) {
1264− kfree(p_cache);
1271+ vfree(p_cache);
12651272 return ret;
12661273 }
12671274 /* 16 byte write to MS memory */
12681275 ret = qlcnic_83xx_ms_mem_write128(adapter, dest, (u32 *)p_cache,
12691276 size / 16);
12701277 if (ret) {
1271− kfree(p_cache);
1278+ vfree(p_cache);
12721279 return ret;
12731280 }
1274− kfree(p_cache);
1281+ vfree(p_cache);
12751282
12761283 return ret;
12771284 }
@@ -1939,7 +1946,7 @@ static void qlcnic_83xx_exec_template_cmd(struct qlcnic_adapter *p_dev, · 661 unmodified lines
19391946 p_dev->ahw->reset.seq_index = index;
19401947 }
19411948
1942−static void qlcnic_83xx_stop_hw(struct qlcnic_adapter *p_dev)
1949+void qlcnic_83xx_stop_hw(struct qlcnic_adapter *p_dev)
19431950 {
19441951 p_dev->ahw->reset.seq_index = 0;
19451952
@@ -1994,6 +2001,14 @@ static int qlcnic_83xx_restart_hw(struct qlcnic_adapter *adapter) · 48 unmodified lines
19942001 val = QLCRDX(adapter->ahw, QLC_83XX_IDC_CTRL);
19952002 if (!(val & QLC_83XX_IDC_GRACEFULL_RESET))
19962003 qlcnic_dump_fw(adapter);
2004+
2005+ if (val & QLC_83XX_IDC_DISABLE_FW_RESET_RECOVERY) {
2006+ netdev_info(adapter->netdev, "%s: Auto firmware recovery is disabled\n",
2007+ __func__);
2008+ qlcnic_83xx_idc_enter_failed_state(adapter, 1);
2009+ return err;
2010+ }
2011+
19972012 qlcnic_83xx_init_hw(adapter);
19982013
19992014 if (qlcnic_83xx_copy_bootloader(adapter))
@@ -2073,8 +2088,8 @@ int qlcnic_83xx_configure_opmode(struct qlcnic_adapter *adapter) · 73 unmodified lines
20732088 ahw->nic_mode = QLCNIC_DEFAULT_MODE;
20742089 adapter->nic_ops->init_driver = qlcnic_83xx_init_default_driver;
20752090 ahw->idc.state_entry = qlcnic_83xx_idc_ready_state_entry;
2076− adapter->max_sds_rings = ahw->max_rx_ques;
2077− adapter->max_tx_rings = ahw->max_tx_ques;
2091+ adapter->max_sds_rings = QLCNIC_MAX_SDS_RINGS;
2092+ adapter->max_tx_rings = QLCNIC_MAX_TX_RINGS;
20782093 } else {
20792094 return -EIO;
20802095 }
drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c+8−11
@@ -667,30 +667,25 @@ qlcnic_set_ringparam(struct net_device *dev, · 666 unmodified lines
667667 static int qlcnic_validate_ring_count(struct qlcnic_adapter *adapter,
668668 u8 rx_ring, u8 tx_ring)
669669 {
670+ if (rx_ring == 0 || tx_ring == 0)
671+ return -EINVAL;
672+
670673 if (rx_ring != 0) {
671674 if (rx_ring > adapter->max_sds_rings) {
672− netdev_err(adapter->netdev, "Invalid ring count, SDS ring count %d should not be greater than max %d driver sds rings.\n",
675+ netdev_err(adapter->netdev,
676+ "Invalid ring count, SDS ring count %d should not be greater than max %d driver sds rings.\n",
673677 rx_ring, adapter->max_sds_rings);
674678 return -EINVAL;
675679 }
676680 }
677681
678682 if (tx_ring != 0) {
679− if (qlcnic_82xx_check(adapter) &&
680− (tx_ring > adapter->max_tx_rings)) {
683+ if (tx_ring > adapter->max_tx_rings) {
681684 netdev_err(adapter->netdev,
682685 "Invalid ring count, Tx ring count %d should not be greater than max %d driver Tx rings.\n",
683686 tx_ring, adapter->max_tx_rings);
684687 return -EINVAL;
685688 }
686−
687− if (qlcnic_83xx_check(adapter) &&
688− (tx_ring > QLCNIC_SINGLE_RING)) {
689− netdev_err(adapter->netdev,
690− "Invalid ring count, Tx ring count %d should not be greater than %d driver Tx rings.\n",
691− tx_ring, QLCNIC_SINGLE_RING);
692− return -EINVAL;
693− }
694689 }
695690
696691 return 0;
@@ -948,6 +943,7 @@ static int qlcnic_irq_test(struct net_device *netdev) · 251 unmodified lines
948943 struct qlcnic_hardware_context *ahw = adapter->ahw;
949944 struct qlcnic_cmd_args cmd;
950945 int ret, drv_sds_rings = adapter->drv_sds_rings;
946+ int drv_tx_rings = adapter->drv_tx_rings;
951947
952948 if (qlcnic_83xx_check(adapter))
953949 return qlcnic_83xx_interrupt_test(netdev);
@@ -980,6 +976,7 @@ free_diag_res: · 26 unmodified lines
980976
981977 clear_diag_irq:
982978 adapter->drv_sds_rings = drv_sds_rings;
979+ adapter->drv_tx_rings = drv_tx_rings;
983980 clear_bit(__QLCNIC_RESETTING, &adapter->state);
984981
985982 return ret;
drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c+2−8
@@ -687,17 +687,11 @@ void qlcnic_advert_link_change(struct qlcnic_adapter *adapter, int linkup) · 686 unmodified lines
687687 if (adapter->ahw->linkup && !linkup) {
688688 netdev_info(netdev, "NIC Link is down\n");
689689 adapter->ahw->linkup = 0;
690− if (netif_running(netdev)) {
691− netif_carrier_off(netdev);
692− netif_tx_stop_all_queues(netdev);
693− }
690+ netif_carrier_off(netdev);
694691 } else if (!adapter->ahw->linkup && linkup) {
695692 netdev_info(netdev, "NIC Link is up\n");
696693 adapter->ahw->linkup = 1;
697− if (netif_running(netdev)) {
698− netif_carrier_on(netdev);
699− netif_wake_queue(netdev);
700− }
694+ netif_carrier_on(netdev);
701695 }
702696 }
703697
drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c+1−1
@@ -1178,6 +1178,7 @@ qlcnic_initialize_nic(struct qlcnic_adapter *adapter) · 1177 unmodified lines
11781178 } else {
11791179 adapter->ahw->nic_mode = QLCNIC_DEFAULT_MODE;
11801180 adapter->max_tx_rings = QLCNIC_MAX_HW_TX_RINGS;
1181+ adapter->max_sds_rings = QLCNIC_MAX_SDS_RINGS;
11811182 adapter->flags &= ~QLCNIC_ESWITCH_ENABLED;
11821183 }
11831184
@@ -1940,7 +1941,6 @@ int qlcnic_diag_alloc_res(struct net_device *netdev, int test) · 756 unmodified lines
19401941 qlcnic_detach(adapter);
19411942
19421943 adapter->drv_sds_rings = QLCNIC_SINGLE_RING;
1943− adapter->drv_tx_rings = QLCNIC_SINGLE_RING;
19441944 adapter->ahw->diag_test = test;
19451945 adapter->ahw->linkup = 0;
19461946
drivers/net/hyperv/netvsc_drv.c+0−1
@@ -327,7 +327,6 @@ static int netvsc_change_mtu(struct net_device *ndev, int mtu) · 326 unmodified lines
327327 return -EINVAL;
328328
329329 nvdev->start_remove = true;
330− cancel_delayed_work_sync(&ndevctx->dwork);
331330 cancel_work_sync(&ndevctx->work);
332331 netif_tx_disable(ndev);
333332 rndis_filter_device_remove(hdev);
drivers/net/xen-netback/netback.c+3−0
@@ -1197,6 +1197,9 @@ static int checksum_setup_ip(struct xenvif *vif, struct sk_buff *skb, · 1196 unmodified lines
11971197
11981198 err = -EPROTO;
11991199
1200+ if (fragment)
1201+ goto out;
1202+
12001203 switch (ip_hdr(skb)->protocol) {
12011204 case IPPROTO_TCP:
12021205 err = maybe_pull_tail(skb,
drivers/phy/Kconfig+2−2
@@ -24,8 +24,8 @@ config PHY_EXYNOS_MIPI_VIDEO · 23 unmodified lines
2424 config OMAP_USB2
2525 tristate "OMAP USB2 PHY Driver"
2626 depends on ARCH_OMAP2PLUS
27+ depends on USB_PHY
2728 select GENERIC_PHY
28− select USB_PHY
2929 select OMAP_CONTROL_USB
3030 help
3131 Enable this to support the transceiver that is part of SOC. This
@@ -36,8 +36,8 @@ config OMAP_USB2 · 4 unmodified lines
3636 config TWL4030_USB
3737 tristate "TWL4030 USB Transceiver Driver"
3838 depends on TWL4030_CORE && REGULATOR_TWL4030 && USB_MUSB_OMAP2PLUS
39+ depends on USB_PHY
3940 select GENERIC_PHY
40− select USB_PHY
4141 help
4242 Enable this to support the USB OTG transceiver on TWL4030
4343 family chips (including the TWL5030 and TPS659x0 devices).
drivers/phy/phy-core.c+10−16
@@ -437,23 +437,18 @@ struct phy *phy_create(struct device *dev, const struct phy_ops *ops, · 436 unmodified lines
437437 int id;
438438 struct phy *phy;
439439
440− if (!dev) {
441− dev_WARN(dev, "no device provided for PHY\n");
442− ret = -EINVAL;
443− goto err0;
444− }
440+ if (WARN_ON(!dev))
441+ return ERR_PTR(-EINVAL);
445442
446443 phy = kzalloc(sizeof(*phy), GFP_KERNEL);
447− if (!phy) {
448− ret = -ENOMEM;
449− goto err0;
450− }
444+ if (!phy)
445+ return ERR_PTR(-ENOMEM);
451446
452447 id = ida_simple_get(&phy_ida, 0, 0, GFP_KERNEL);
453448 if (id < 0) {
454449 dev_err(dev, "unable to get id\n");
455450 ret = id;
456− goto err0;
451+ goto free_phy;
457452 }
458453
459454 device_initialize(&phy->dev);
@@ -468,11 +463,11 @@ struct phy *phy_create(struct device *dev, const struct phy_ops *ops, · 8 unmodified lines
468463
469464 ret = dev_set_name(&phy->dev, "phy-%s.%d", dev_name(dev), id);
470465 if (ret)
471− goto err1;
466+ goto put_dev;
472467
473468 ret = device_add(&phy->dev);
474469 if (ret)
475− goto err1;
470+ goto put_dev;
476471
477472 if (pm_runtime_enabled(dev)) {
478473 pm_runtime_enable(&phy->dev);
@@ -481,12 +476,11 @@ struct phy *phy_create(struct device *dev, const struct phy_ops *ops, · 2 unmodified lines
481476
482477 return phy;
483478
484−err1:
485− ida_remove(&phy_ida, phy->id);
479+put_dev:
486480 put_device(&phy->dev);
481+ ida_remove(&phy_ida, phy->id);
482+free_phy:
487483 kfree(phy);
488−
489−err0:
490484 return ERR_PTR(ret);
491485 }
492486 EXPORT_SYMBOL_GPL(phy_create);
drivers/pinctrl/sh-pfc/sh_pfc.h+1−1
@@ -254,7 +254,7 @@ struct sh_pfc_soc_info { · 253 unmodified lines
254254 #define PINMUX_GPIO(_pin) \
255255 [GPIO_##_pin] = { \
256256 .pin = (u16)-1, \
257− .name = __stringify(name), \
257+ .name = __stringify(GPIO_##_pin), \
258258 .enum_id = _pin##_DATA, \
259259 }
260260
drivers/regulator/s2mps11.c+1−1
@@ -438,7 +438,7 @@ common_reg: · 437 unmodified lines
438438 platform_set_drvdata(pdev, s2mps11);
439439
440440 config.dev = &pdev->dev;
441− config.regmap = iodev->regmap;
441+ config.regmap = iodev->regmap_pmic;
442442 config.driver_data = s2mps11;
443443 for (i = 0; i < S2MPS11_REGULATOR_MAX; i++) {
444444 if (!reg_np) {
drivers/scsi/qla2xxx/qla_target.c+6−4
@@ -471,7 +471,7 @@ static void qlt_schedule_sess_for_deletion(struct qla_tgt_sess *sess, · 470 unmodified lines
471471 schedule_delayed_work(&tgt->sess_del_work, 0);
472472 else
473473 schedule_delayed_work(&tgt->sess_del_work,
474− jiffies - sess->expires);
474+ sess->expires - jiffies);
475475 }
476476
477477 /* ha->hardware_lock supposed to be held on entry */
@@ -550,13 +550,14 @@ static void qlt_del_sess_work_fn(struct delayed_work *work) · 72 unmodified lines
550550 struct scsi_qla_host *vha = tgt->vha;
551551 struct qla_hw_data *ha = vha->hw;
552552 struct qla_tgt_sess *sess;
553− unsigned long flags;
553+ unsigned long flags, elapsed;
554554
555555 spin_lock_irqsave(&ha->hardware_lock, flags);
556556 while (!list_empty(&tgt->del_sess_list)) {
557557 sess = list_entry(tgt->del_sess_list.next, typeof(*sess),
558558 del_list_entry);
559− if (time_after_eq(jiffies, sess->expires)) {
559+ elapsed = jiffies;
560+ if (time_after_eq(elapsed, sess->expires)) {
560561 qlt_undelete_sess(sess);
561562
562563 ql_dbg(ql_dbg_tgt_mgt, vha, 0xf004,
@@ -566,7 +567,7 @@ static void qlt_del_sess_work_fn(struct delayed_work *work) · 3 unmodified lines
566567 ha->tgt.tgt_ops->put_sess(sess);
567568 } else {
568569 schedule_delayed_work(&tgt->sess_del_work,
569− jiffies - sess->expires);
570+ sess->expires - elapsed);
570571 break;
571572 }
572573 }
@@ -4290,6 +4291,7 @@ int qlt_lport_register(struct qla_tgt_func_tmpl *qla_tgt_ops, u64 wwpn, · 3717 unmodified lines
42904291 if (rc != 0) {
42914292 ha->tgt.tgt_ops = NULL;
42924293 ha->tgt.target_lport_ptr = NULL;
4294+ scsi_host_put(host);
42934295 }
42944296 mutex_unlock(&qla_tgt_mutex);
42954297 return rc;
drivers/staging/comedi/drivers.c+1−1
@@ -446,7 +446,7 @@ int comedi_load_firmware(struct comedi_device *dev, · 445 unmodified lines
446446 release_firmware(fw);
447447 }
448448
449− return ret;
449+ return ret < 0 ? ret : 0;
450450 }
451451 EXPORT_SYMBOL_GPL(comedi_load_firmware);
452452
drivers/staging/comedi/drivers/8255_pci.c+12−3
@@ -63,7 +63,8 @@ enum pci_8255_boardid { · 62 unmodified lines
6363 BOARD_ADLINK_PCI7296,
6464 BOARD_CB_PCIDIO24,
6565 BOARD_CB_PCIDIO24H,
66− BOARD_CB_PCIDIO48H,
66+ BOARD_CB_PCIDIO48H_OLD,
67+ BOARD_CB_PCIDIO48H_NEW,
6768 BOARD_CB_PCIDIO96H,
6869 BOARD_NI_PCIDIO96,
6970 BOARD_NI_PCIDIO96B,
@@ -106,11 +107,16 @@ static const struct pci_8255_boardinfo pci_8255_boards[] = { · 36 unmodified lines
106107 .dio_badr = 2,
107108 .n_8255 = 1,
108109 },
109− [BOARD_CB_PCIDIO48H] = {
110+ [BOARD_CB_PCIDIO48H_OLD] = {
110111 .name = "cb_pci-dio48h",
111112 .dio_badr = 1,
112113 .n_8255 = 2,
113114 },
115+ [BOARD_CB_PCIDIO48H_NEW] = {
116+ .name = "cb_pci-dio48h",
117+ .dio_badr = 2,
118+ .n_8255 = 2,
119+ },
114120 [BOARD_CB_PCIDIO96H] = {
115121 .name = "cb_pci-dio96h",
116122 .dio_badr = 2,
@@ -263,7 +269,10 @@ static DEFINE_PCI_DEVICE_TABLE(pci_8255_pci_table) = { · 146 unmodified lines
263269 { PCI_VDEVICE(ADLINK, 0x7296), BOARD_ADLINK_PCI7296 },
264270 { PCI_VDEVICE(CB, 0x0028), BOARD_CB_PCIDIO24 },
265271 { PCI_VDEVICE(CB, 0x0014), BOARD_CB_PCIDIO24H },
266− { PCI_VDEVICE(CB, 0x000b), BOARD_CB_PCIDIO48H },
272+ { PCI_DEVICE_SUB(PCI_VENDOR_ID_CB, 0x000b, 0x0000, 0x0000),
273+ .driver_data = BOARD_CB_PCIDIO48H_OLD },
274+ { PCI_DEVICE_SUB(PCI_VENDOR_ID_CB, 0x000b, PCI_VENDOR_ID_CB, 0x000b),
275+ .driver_data = BOARD_CB_PCIDIO48H_NEW },
267276 { PCI_VDEVICE(CB, 0x0017), BOARD_CB_PCIDIO96H },
268277 { PCI_VDEVICE(NI, 0x0160), BOARD_NI_PCIDIO96 },
269278 { PCI_VDEVICE(NI, 0x1630), BOARD_NI_PCIDIO96B },
drivers/staging/iio/magnetometer/hmc5843.c+6−1
@@ -451,7 +451,12 @@ done: · 450 unmodified lines
451451 .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE) | \
452452 BIT(IIO_CHAN_INFO_SAMP_FREQ), \
453453 .scan_index = idx, \
454− .scan_type = IIO_ST('s', 16, 16, IIO_BE), \
454+ .scan_type = { \
455+ .sign = 's', \
456+ .realbits = 16, \
457+ .storagebits = 16, \
458+ .endianness = IIO_BE, \
459+ }, \
455460 }
456461
457462 static const struct iio_chan_spec hmc5843_channels[] = {
drivers/staging/imx-drm/imx-drm-core.c+29−10
@@ -88,8 +88,9 @@ static int imx_drm_driver_unload(struct drm_device *drm) · 87 unmodified lines
8888
8989 imx_drm_device_put();
9090
91− drm_mode_config_cleanup(imxdrm->drm);
91+ drm_vblank_cleanup(imxdrm->drm);
9292 drm_kms_helper_poll_fini(imxdrm->drm);
93+ drm_mode_config_cleanup(imxdrm->drm);
9394
9495 return 0;
9596 }
@@ -199,8 +200,8 @@ static void imx_drm_driver_preclose(struct drm_device *drm, · 103 unmodified lines
199200 if (!file->is_master)
200201 return;
201202
202− for (i = 0; i < 4; i++)
203− imx_drm_disable_vblank(drm , i);
203+ for (i = 0; i < MAX_CRTC; i++)
204+ imx_drm_disable_vblank(drm, i);
204205 }
205206
206207 static const struct file_operations imx_drm_driver_fops = {
@@ -376,8 +377,6 @@ static int imx_drm_crtc_register(struct imx_drm_crtc *imx_drm_crtc) · 169 unmodified lines
376377 struct imx_drm_device *imxdrm = __imx_drm_device();
377378 int ret;
378379
379− drm_crtc_init(imxdrm->drm, imx_drm_crtc->crtc,
380− imx_drm_crtc->imx_drm_helper_funcs.crtc_funcs);
381380 ret = drm_mode_crtc_set_gamma_size(imx_drm_crtc->crtc, 256);
382381 if (ret)
383382 return ret;
@@ -385,6 +384,9 @@ static int imx_drm_crtc_register(struct imx_drm_crtc *imx_drm_crtc) · 1 unmodified line
385384 drm_crtc_helper_add(imx_drm_crtc->crtc,
386385 imx_drm_crtc->imx_drm_helper_funcs.crtc_helper_funcs);
387386
387+ drm_crtc_init(imxdrm->drm, imx_drm_crtc->crtc,
388+ imx_drm_crtc->imx_drm_helper_funcs.crtc_funcs);
389+
388390 drm_mode_group_reinit(imxdrm->drm);
389391
390392 return 0;
@@ -428,11 +430,11 @@ static int imx_drm_driver_load(struct drm_device *drm, unsigned long flags) · 37 unmodified lines
428430 ret = drm_mode_group_init_legacy_group(imxdrm->drm,
429431 &imxdrm->drm->primary->mode_group);
430432 if (ret)
431− goto err_init;
433+ goto err_kms;
432434
433435 ret = drm_vblank_init(imxdrm->drm, MAX_CRTC);
434436 if (ret)
435− goto err_init;
437+ goto err_kms;
436438
437439 /*
438440 * with vblank_disable_allowed = true, vblank interrupt will be disabled
@@ -441,12 +443,19 @@ static int imx_drm_driver_load(struct drm_device *drm, unsigned long flags) · 2 unmodified lines
441443 */
442444 imxdrm->drm->vblank_disable_allowed = true;
443445
444− if (!imx_drm_device_get())
446+ if (!imx_drm_device_get()) {
445447 ret = -EINVAL;
448+ goto err_vblank;
449+ }
446450
447− ret = 0;
451+ mutex_unlock(&imxdrm->mutex);
452+ return 0;
448453
449−err_init:
454+err_vblank:
455+ drm_vblank_cleanup(drm);
456+err_kms:
457+ drm_kms_helper_poll_fini(drm);
458+ drm_mode_config_cleanup(drm);
450459 mutex_unlock(&imxdrm->mutex);
451460
452461 return ret;
@@ -492,6 +501,15 @@ int imx_drm_add_crtc(struct drm_crtc *crtc, · 39 unmodified lines
492501
493502 mutex_lock(&imxdrm->mutex);
494503
504+ /*
505+ * The vblank arrays are dimensioned by MAX_CRTC - we can't
506+ * pass IDs greater than this to those functions.
507+ */
508+ if (imxdrm->pipes >= MAX_CRTC) {
509+ ret = -EINVAL;
510+ goto err_busy;
511+ }
512+
495513 if (imxdrm->drm->open_count) {
496514 ret = -EBUSY;
497515 goto err_busy;
@@ -528,6 +546,7 @@ int imx_drm_add_crtc(struct drm_crtc *crtc, · 30 unmodified lines
528546 return 0;
529547
530548 err_register:
549+ list_del(&imx_drm_crtc->list);
531550 kfree(imx_drm_crtc);
532551 err_alloc:
533552 err_busy:
drivers/staging/imx-drm/imx-tve.c+0−9
@@ -114,7 +114,6 @@ struct imx_tve { · 113 unmodified lines
114114 struct drm_encoder encoder;
115115 struct imx_drm_encoder *imx_drm_encoder;
116116 struct device *dev;
117− spinlock_t enable_lock; /* serializes tve_enable/disable */
118117 spinlock_t lock; /* register lock */
119118 bool enabled;
120119 int mode;
@@ -146,10 +145,8 @@ __releases(&tve->lock) · 25 unmodified lines
146145
147146 static void tve_enable(struct imx_tve *tve)
148147 {
149− unsigned long flags;
150148 int ret;
151149
152− spin_lock_irqsave(&tve->enable_lock, flags);
153150 if (!tve->enabled) {
154151 tve->enabled = true;
155152 clk_prepare_enable(tve->clk);
@@ -169,23 +166,18 @@ static void tve_enable(struct imx_tve *tve) · 13 unmodified lines
169166 TVE_CD_SM_IEN |
170167 TVE_CD_LM_IEN |
171168 TVE_CD_MON_END_IEN);
172−
173− spin_unlock_irqrestore(&tve->enable_lock, flags);
174169 }
175170
176171 static void tve_disable(struct imx_tve *tve)
177172 {
178− unsigned long flags;
179173 int ret;
180174
181− spin_lock_irqsave(&tve->enable_lock, flags);
182175 if (tve->enabled) {
183176 tve->enabled = false;
184177 ret = regmap_update_bits(tve->regmap, TVE_COM_CONF_REG,
185178 TVE_IPU_CLK_EN | TVE_EN, 0);
186179 clk_disable_unprepare(tve->clk);
187180 }
188− spin_unlock_irqrestore(&tve->enable_lock, flags);
189181 }
190182
191183 static int tve_setup_tvout(struct imx_tve *tve)
@@ -601,7 +593,6 @@ static int imx_tve_probe(struct platform_device *pdev) · 409 unmodified lines
601593
602594 tve->dev = &pdev->dev;
603595 spin_lock_init(&tve->lock);
604− spin_lock_init(&tve->enable_lock);
605596
606597 ddc_node = of_parse_phandle(np, "ddc", 0);
607598 if (ddc_node) {
drivers/staging/imx-drm/ipu-v3/ipu-common.c+16−16
@@ -996,35 +996,35 @@ static const struct ipu_platform_reg client_reg[] = { · 995 unmodified lines
996996 },
997997 };
998998
999+static DEFINE_MUTEX(ipu_client_id_mutex);
9991000 static int ipu_client_id;
10001001
1001−static int ipu_add_subdevice_pdata(struct device *dev,
1002− const struct ipu_platform_reg *reg)
1003−{
1004− struct platform_device *pdev;
1005−
1006− pdev = platform_device_register_data(dev, reg->name, ipu_client_id++,
1007− &reg->pdata, sizeof(struct ipu_platform_reg));
1008−
1009− return PTR_ERR_OR_ZERO(pdev);
1010−}
1011−
10121002 static int ipu_add_client_devices(struct ipu_soc *ipu)
10131003 {
1014− int ret;
1015− int i;
1004+ struct device *dev = ipu->dev;
1005+ unsigned i;
1006+ int id, ret;
1007+
1008+ mutex_lock(&ipu_client_id_mutex);
1009+ id = ipu_client_id;
1010+ ipu_client_id += ARRAY_SIZE(client_reg);
1011+ mutex_unlock(&ipu_client_id_mutex);
10161012
10171013 for (i = 0; i < ARRAY_SIZE(client_reg); i++) {
10181014 const struct ipu_platform_reg *reg = &client_reg[i];
1019− ret = ipu_add_subdevice_pdata(ipu->dev, reg);
1020− if (ret)
1015+ struct platform_device *pdev;
1016+
1017+ pdev = platform_device_register_data(dev, reg->name,
1018+ id++, &reg->pdata, sizeof(reg->pdata));
1019+
1020+ if (IS_ERR(pdev))
10211021 goto err_register;
10221022 }
10231023
10241024 return 0;
10251025
10261026 err_register:
1027− platform_device_unregister_children(to_platform_device(ipu->dev));
1027+ platform_device_unregister_children(to_platform_device(dev));
10281028
10291029 return ret;
10301030 }
drivers/target/iscsi/iscsi_target.c+13−14
@@ -465,6 +465,7 @@ int iscsit_del_np(struct iscsi_np *np) · 464 unmodified lines
465465 */
466466 send_sig(SIGINT, np->np_thread, 1);
467467 kthread_stop(np->np_thread);
468+ np->np_thread = NULL;
468469 }
469470
470471 np->np_transport->iscsit_free_np(np);
@@ -823,24 +824,22 @@ int iscsit_setup_scsi_cmd(struct iscsi_conn *conn, struct iscsi_cmd *cmd, · 352 unmodified lines
823824 if (((hdr->flags & ISCSI_FLAG_CMD_READ) ||
824825 (hdr->flags & ISCSI_FLAG_CMD_WRITE)) && !hdr->data_length) {
825826 /*
826− * Vmware ESX v3.0 uses a modified Cisco Initiator (v3.4.2)
827− * that adds support for RESERVE/RELEASE. There is a bug
828− * add with this new functionality that sets R/W bits when
829− * neither CDB carries any READ or WRITE datapayloads.
827+ * From RFC-3720 Section 10.3.1:
828+ *
829+ * "Either or both of R and W MAY be 1 when either the
830+ * Expected Data Transfer Length and/or Bidirectional Read
831+ * Expected Data Transfer Length are 0"
832+ *
833+ * For this case, go ahead and clear the unnecssary bits
834+ * to avoid any confusion with ->data_direction.
830835 */
831− if ((hdr->cdb[0] == 0x16) || (hdr->cdb[0] == 0x17)) {
832− hdr->flags &= ~ISCSI_FLAG_CMD_READ;
833− hdr->flags &= ~ISCSI_FLAG_CMD_WRITE;
834− goto done;
835− }
836+ hdr->flags &= ~ISCSI_FLAG_CMD_READ;
837+ hdr->flags &= ~ISCSI_FLAG_CMD_WRITE;
836838
837− pr_err("ISCSI_FLAG_CMD_READ or ISCSI_FLAG_CMD_WRITE"
839+ pr_warn("ISCSI_FLAG_CMD_READ or ISCSI_FLAG_CMD_WRITE"
838840 " set when Expected Data Transfer Length is 0 for"
839− " CDB: 0x%02x. Bad iSCSI Initiator.\n", hdr->cdb[0]);
840− return iscsit_add_reject_cmd(cmd,
841− ISCSI_REASON_BOOKMARK_INVALID, buf);
841+ " CDB: 0x%02x, Fixing up flags\n", hdr->cdb[0]);
842842 }
843−done:
844843
845844 if (!(hdr->flags & ISCSI_FLAG_CMD_READ) &&
846845 !(hdr->flags & ISCSI_FLAG_CMD_WRITE) && (hdr->data_length != 0)) {
drivers/target/iscsi/iscsi_target_configfs.c+2−1
@@ -474,7 +474,8 @@ static ssize_t __iscsi_##prefix##_store_##name( \ · 473 unmodified lines
474474 \
475475 if (!capable(CAP_SYS_ADMIN)) \
476476 return -EPERM; \
477− \
477+ if (count >= sizeof(auth->name)) \
478+ return -EINVAL; \
478479 snprintf(auth->name, sizeof(auth->name), "%s", page); \
479480 if (!strncmp("NULL", auth->name, 4)) \
480481 auth->naf_flags &= ~flags; \
drivers/target/iscsi/iscsi_target_login.c+0−6
@@ -1403,11 +1403,6 @@ old_sess_out: · 1402 unmodified lines
14031403
14041404 out:
14051405 stop = kthread_should_stop();
1406− if (!stop && signal_pending(current)) {
1407− spin_lock_bh(&np->np_thread_lock);
1408− stop = (np->np_thread_state == ISCSI_NP_THREAD_SHUTDOWN);
1409− spin_unlock_bh(&np->np_thread_lock);
1410− }
14111406 /* Wait for another socket.. */
14121407 if (!stop)
14131408 return 1;
@@ -1415,7 +1410,6 @@ exit: · 1 unmodified line
14151410 iscsi_stop_login_thread_timer(np);
14161411 spin_lock_bh(&np->np_thread_lock);
14171412 np->np_thread_state = ISCSI_NP_THREAD_EXIT;
1418− np->np_thread = NULL;
14191413 spin_unlock_bh(&np->np_thread_lock);
14201414
14211415 return 0;
drivers/target/target_core_device.c+5−0
@@ -1106,6 +1106,11 @@ int se_dev_set_block_size(struct se_device *dev, u32 block_size) · 1105 unmodified lines
11061106 dev->dev_attrib.block_size = block_size;
11071107 pr_debug("dev[%p]: SE Device block_size changed to %u\n",
11081108 dev, block_size);
1109+
1110+ if (dev->dev_attrib.max_bytes_per_io)
1111+ dev->dev_attrib.hw_max_sectors =
1112+ dev->dev_attrib.max_bytes_per_io / block_size;
1113+
11091114 return 0;
11101115 }
11111116
drivers/target/target_core_file.c+4−4
@@ -66,9 +66,8 @@ static int fd_attach_hba(struct se_hba *hba, u32 host_id) · 65 unmodified lines
6666 pr_debug("CORE_HBA[%d] - TCM FILEIO HBA Driver %s on Generic"
6767 " Target Core Stack %s\n", hba->hba_id, FD_VERSION,
6868 TARGET_CORE_MOD_VERSION);
69− pr_debug("CORE_HBA[%d] - Attached FILEIO HBA: %u to Generic"
70− " MaxSectors: %u\n",
71− hba->hba_id, fd_host->fd_host_id, FD_MAX_SECTORS);
69+ pr_debug("CORE_HBA[%d] - Attached FILEIO HBA: %u to Generic\n",
70+ hba->hba_id, fd_host->fd_host_id);
7271
7372 return 0;
7473 }
@@ -220,7 +219,8 @@ static int fd_configure_device(struct se_device *dev) · 145 unmodified lines
220219 }
221220
222221 dev->dev_attrib.hw_block_size = fd_dev->fd_block_size;
223− dev->dev_attrib.hw_max_sectors = FD_MAX_SECTORS;
222+ dev->dev_attrib.max_bytes_per_io = FD_MAX_BYTES;
223+ dev->dev_attrib.hw_max_sectors = FD_MAX_BYTES / fd_dev->fd_block_size;
224224 dev->dev_attrib.hw_queue_depth = FD_MAX_DEVICE_QUEUE_DEPTH;
225225
226226 if (fd_dev->fbd_flags & FDBD_HAS_BUFFERED_IO_WCE) {
drivers/target/target_core_file.h+4−1
@@ -7,7 +7,10 @@ · 6 unmodified lines
77 #define FD_DEVICE_QUEUE_DEPTH 32
88 #define FD_MAX_DEVICE_QUEUE_DEPTH 128
99 #define FD_BLOCKSIZE 512
10−#define FD_MAX_SECTORS 2048
10+/*
11+ * Limited by the number of iovecs (2048) per vfs_[writev,readv] call
12+ */
13+#define FD_MAX_BYTES 8388608
1114
1215 #define RRF_EMULATE_CDB 0x01
1316 #define RRF_GOT_LBA 0x02
drivers/target/target_core_tpg.c+1−9
@@ -278,7 +278,6 @@ struct se_node_acl *core_tpg_check_initiator_node_acl( · 277 unmodified lines
278278 snprintf(acl->initiatorname, TRANSPORT_IQN_LEN, "%s", initiatorname);
279279 acl->se_tpg = tpg;
280280 acl->acl_index = scsi_get_new_index(SCSI_AUTH_INTR_INDEX);
281− spin_lock_init(&acl->stats_lock);
282281 acl->dynamic_node_acl = 1;
283282
284283 tpg->se_tpg_tfo->set_default_node_attributes(acl);
@@ -406,7 +405,6 @@ struct se_node_acl *core_tpg_add_initiator_node_acl( · 121 unmodified lines
406405 snprintf(acl->initiatorname, TRANSPORT_IQN_LEN, "%s", initiatorname);
407406 acl->se_tpg = tpg;
408407 acl->acl_index = scsi_get_new_index(SCSI_AUTH_INTR_INDEX);
409− spin_lock_init(&acl->stats_lock);
410408
411409 tpg->se_tpg_tfo->set_default_node_attributes(acl);
412410
@@ -658,15 +656,9 @@ static int core_tpg_setup_virtual_lun0(struct se_portal_group *se_tpg) · 245 unmodified lines
658656 spin_lock_init(&lun->lun_sep_lock);
659657 init_completion(&lun->lun_ref_comp);
660658
661− ret = percpu_ref_init(&lun->lun_ref, core_tpg_lun_ref_release);
662− if (ret < 0)
663− return ret;
664−
665659 ret = core_tpg_post_addlun(se_tpg, lun, lun_access, dev);
666− if (ret < 0) {
667− percpu_ref_cancel_init(&lun->lun_ref);
660+ if (ret < 0)
668661 return ret;
669− }
670662
671663 return 0;
672664 }
drivers/tty/n_tty.c+6−1
@@ -93,6 +93,7 @@ struct n_tty_data { · 92 unmodified lines
9393 size_t canon_head;
9494 size_t echo_head;
9595 size_t echo_commit;
96+ size_t echo_mark;
9697 DECLARE_BITMAP(char_map, 256);
9798
9899 /* private to n_tty_receive_overrun (single-threaded) */
@@ -336,6 +337,7 @@ static void reset_buffer_flags(struct n_tty_data *ldata) · 237 unmodified lines
336337 {
337338 ldata->read_head = ldata->canon_head = ldata->read_tail = 0;
338339 ldata->echo_head = ldata->echo_tail = ldata->echo_commit = 0;
340+ ldata->echo_mark = 0;
339341 ldata->line_start = 0;
340342
341343 ldata->erasing = 0;
@@ -787,6 +789,7 @@ static void commit_echoes(struct tty_struct *tty) · 445 unmodified lines
787789 size_t head;
788790
789791 head = ldata->echo_head;
792+ ldata->echo_mark = head;
790793 old = ldata->echo_commit - ldata->echo_tail;
791794
792795 /* Process committed echoes if the accumulated # of bytes
@@ -811,10 +814,11 @@ static void process_echoes(struct tty_struct *tty) · 18 unmodified lines
811814 size_t echoed;
812815
813816 if ((!L_ECHO(tty) && !L_ECHONL(tty)) ||
814− ldata->echo_commit == ldata->echo_tail)
817+ ldata->echo_mark == ldata->echo_tail)
815818 return;
816819
817820 mutex_lock(&ldata->output_lock);
821+ ldata->echo_commit = ldata->echo_mark;
818822 echoed = __process_echoes(tty);
819823 mutex_unlock(&ldata->output_lock);
820824
@@ -822,6 +826,7 @@ static void process_echoes(struct tty_struct *tty) · 1 unmodified line
822826 tty->ops->flush_chars(tty);
823827 }
824828
829+/* NB: echo_mark and echo_head should be equivalent here */
825830 static void flush_echoes(struct tty_struct *tty)
826831 {
827832 struct n_tty_data *ldata = tty->disc_data;
drivers/tty/serial/8250/8250_dw.c+6−2
@@ -96,7 +96,8 @@ static void dw8250_serial_out(struct uart_port *p, int offset, int value) · 95 unmodified lines
9696 if (offset == UART_LCR) {
9797 int tries = 1000;
9898 while (tries--) {
99− if (value == p->serial_in(p, UART_LCR))
99+ unsigned int lcr = p->serial_in(p, UART_LCR);
100+ if ((value & ~UART_LCR_SPAR) == (lcr & ~UART_LCR_SPAR))
100101 return;
101102 dw8250_force_idle(p);
102103 writeb(value, p->membase + (UART_LCR << p->regshift));
@@ -132,7 +133,8 @@ static void dw8250_serial_out32(struct uart_port *p, int offset, int value) · 29 unmodified lines
132133 if (offset == UART_LCR) {
133134 int tries = 1000;
134135 while (tries--) {
135− if (value == p->serial_in(p, UART_LCR))
136+ unsigned int lcr = p->serial_in(p, UART_LCR);
137+ if ((value & ~UART_LCR_SPAR) == (lcr & ~UART_LCR_SPAR))
136138 return;
137139 dw8250_force_idle(p);
138140 writel(value, p->membase + (UART_LCR << p->regshift));
@@ -455,6 +457,8 @@ MODULE_DEVICE_TABLE(of, dw8250_of_match); · 316 unmodified lines
455457 static const struct acpi_device_id dw8250_acpi_match[] = {
456458 { "INT33C4", 0 },
457459 { "INT33C5", 0 },
460+ { "INT3434", 0 },
461+ { "INT3435", 0 },
458462 { "80860F0A", 0 },
459463 { },
460464 };
drivers/tty/serial/xilinx_uartps.c+2−0
@@ -240,6 +240,7 @@ static irqreturn_t xuartps_isr(int irq, void *dev_id) · 239 unmodified lines
240240 continue;
241241 }
242242
243+#ifdef SUPPORT_SYSRQ
243244 /*
244245 * uart_handle_sysrq_char() doesn't work if
245246 * spinlocked, for some reason
@@ -253,6 +254,7 @@ static irqreturn_t xuartps_isr(int irq, void *dev_id) · 7 unmodified lines
253254 }
254255 spin_lock(&port->lock);
255256 }
257+#endif
256258
257259 port->icount.rx++;
258260
drivers/tty/tty_ldsem.c+13−3
@@ -86,11 +86,21 @@ static inline long ldsem_atomic_update(long delta, struct ld_semaphore *sem) · 85 unmodified lines
8686 return atomic_long_add_return(delta, (atomic_long_t *)&sem->count);
8787 }
8888
89+/*
90+ * ldsem_cmpxchg() updates @*old with the last-known sem->count value.
91+ * Returns 1 if count was successfully changed; @*old will have @new value.
92+ * Returns 0 if count was not changed; @*old will have most recent sem->count
93+ */
8994 static inline int ldsem_cmpxchg(long *old, long new, struct ld_semaphore *sem)
9095 {
91− long tmp = *old;
92− *old = atomic_long_cmpxchg(&sem->count, *old, new);
93− return *old == tmp;
96+ long tmp = atomic_long_cmpxchg(&sem->count, *old, new);
97+ if (tmp == *old) {
98+ *old = new;
99+ return 1;
100+ } else {
101+ *old = tmp;
102+ return 0;
103+ }
94104 }
95105
96106 /*
drivers/usb/chipidea/core.c+4−0
@@ -642,6 +642,10 @@ static int ci_hdrc_probe(struct platform_device *pdev) · 641 unmodified lines
642642 : CI_ROLE_GADGET;
643643 }
644644
645+ /* only update vbus status for peripheral */
646+ if (ci->role == CI_ROLE_GADGET)
647+ ci_handle_vbus_change(ci);
648+
645649 ret = ci_role_start(ci, ci->role);
646650 if (ret) {
647651 dev_err(dev, "can't start %s role\n", ci_role(ci)->name);
drivers/usb/chipidea/host.c+2−1
@@ -88,7 +88,8 @@ static int host_start(struct ci_hdrc *ci) · 87 unmodified lines
8888 return ret;
8989
9090 disable_reg:
91− regulator_disable(ci->platdata->reg_vbus);
91+ if (ci->platdata->reg_vbus)
92+ regulator_disable(ci->platdata->reg_vbus);
9293
9394 put_hcd:
9495 usb_put_hcd(hcd);
drivers/usb/chipidea/udc.c+0−3
@@ -1795,9 +1795,6 @@ static int udc_start(struct ci_hdrc *ci) · 1794 unmodified lines
17951795 pm_runtime_no_callbacks(&ci->gadget.dev);
17961796 pm_runtime_enable(&ci->gadget.dev);
17971797
1798− /* Update ci->vbus_active */
1799− ci_handle_vbus_change(ci);
1800−
18011798 return retval;
18021799
18031800 destroy_eps:
drivers/usb/class/cdc-wdm.c+3−5
@@ -854,13 +854,11 @@ static int wdm_manage_power(struct usb_interface *intf, int on) · 853 unmodified lines
854854 {
855855 /* need autopm_get/put here to ensure the usbcore sees the new value */
856856 int rv = usb_autopm_get_interface(intf);
857− if (rv < 0)
858− goto err;
859857
860858 intf->needs_remote_wakeup = on;
861− usb_autopm_put_interface(intf);
862−err:
863− return rv;
859+ if (!rv)
860+ usb_autopm_put_interface(intf);
861+ return 0;
864862 }
865863
866864 static int wdm_probe(struct usb_interface *intf, const struct usb_device_id *id)
drivers/usb/dwc3/core.c+5−3
@@ -455,9 +455,6 @@ static int dwc3_probe(struct platform_device *pdev) · 454 unmodified lines
455455 if (IS_ERR(regs))
456456 return PTR_ERR(regs);
457457
458− usb_phy_set_suspend(dwc->usb2_phy, 0);
459− usb_phy_set_suspend(dwc->usb3_phy, 0);
460−
461458 spin_lock_init(&dwc->lock);
462459 platform_set_drvdata(pdev, dwc);
463460
@@ -488,6 +485,9 @@ static int dwc3_probe(struct platform_device *pdev) · 24 unmodified lines
488485 goto err0;
489486 }
490487
488+ usb_phy_set_suspend(dwc->usb2_phy, 0);
489+ usb_phy_set_suspend(dwc->usb3_phy, 0);
490+
491491 ret = dwc3_event_buffers_setup(dwc);
492492 if (ret) {
493493 dev_err(dwc->dev, "failed to setup event buffers\n");
@@ -569,6 +569,8 @@ err2: · 75 unmodified lines
569569 dwc3_event_buffers_cleanup(dwc);
570570
571571 err1:
572+ usb_phy_set_suspend(dwc->usb2_phy, 1);
573+ usb_phy_set_suspend(dwc->usb3_phy, 1);
572574 dwc3_core_exit(dwc);
573575
574576 err0:
drivers/usb/host/ohci-at91.c+15−11
@@ -136,23 +136,27 @@ static int usb_hcd_at91_probe(const struct hc_driver *driver, · 135 unmodified lines
136136 struct ohci_hcd *ohci;
137137 int retval;
138138 struct usb_hcd *hcd = NULL;
139−
140− if (pdev->num_resources != 2) {
141− pr_debug("hcd probe: invalid num_resources");
142− return -ENODEV;
139+ struct device *dev = &pdev->dev;
140+ struct resource *res;
141+ int irq;
142+
143+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
144+ if (!res) {
145+ dev_dbg(dev, "hcd probe: missing memory resource\n");
146+ return -ENXIO;
143147 }
144148
145− if ((pdev->resource[0].flags != IORESOURCE_MEM)
146− || (pdev->resource[1].flags != IORESOURCE_IRQ)) {
147− pr_debug("hcd probe: invalid resource type\n");
148− return -ENODEV;
149+ irq = platform_get_irq(pdev, 0);
150+ if (irq < 0) {
151+ dev_dbg(dev, "hcd probe: missing irq resource\n");
152+ return irq;
149153 }
150154
151155 hcd = usb_create_hcd(driver, &pdev->dev, "at91");
152156 if (!hcd)
153157 return -ENOMEM;
154− hcd->rsrc_start = pdev->resource[0].start;
155− hcd->rsrc_len = resource_size(&pdev->resource[0]);
158+ hcd->rsrc_start = res->start;
159+ hcd->rsrc_len = resource_size(res);
156160
157161 if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, hcd_name)) {
158162 pr_debug("request_mem_region failed\n");
@@ -199,7 +203,7 @@ static int usb_hcd_at91_probe(const struct hc_driver *driver, · 40 unmodified lines
199203 ohci->num_ports = board->ports;
200204 at91_start_hc(pdev);
201205
202− retval = usb_add_hcd(hcd, pdev->resource[1].start, IRQF_SHARED);
206+ retval = usb_add_hcd(hcd, irq, IRQF_SHARED);
203207 if (retval == 0)
204208 return retval;
205209
drivers/usb/host/xhci-pci.c+6−1
@@ -128,7 +128,12 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci) · 127 unmodified lines
128128 * any other sleep) on Haswell machines with LPT and LPT-LP
129129 * with the new Intel BIOS
130130 */
131− xhci->quirks |= XHCI_SPURIOUS_WAKEUP;
131+ /* Limit the quirk to only known vendors, as this triggers
132+ * yet another BIOS bug on some other machines
133+ * https://bugzilla.kernel.org/show_bug.cgi?id=66171
134+ */
135+ if (pdev->subsystem_vendor == PCI_VENDOR_ID_HP)
136+ xhci->quirks |= XHCI_SPURIOUS_WAKEUP;
132137 }
133138 if (pdev->vendor == PCI_VENDOR_ID_ETRON &&
134139 pdev->device == PCI_DEVICE_ID_ASROCK_P67) {
drivers/usb/phy/Kconfig+3−1
@@ -19,8 +19,9 @@ config AB8500_USB · 18 unmodified lines
1919 in host mode, low speed.
2020
2121 config FSL_USB2_OTG
22− bool "Freescale USB OTG Transceiver Driver"
22+ tristate "Freescale USB OTG Transceiver Driver"
2323 depends on USB_EHCI_FSL && USB_FSL_USB2 && PM_RUNTIME
24+ depends on USB
2425 select USB_OTG
2526 select USB_PHY
2627 help
@@ -29,6 +30,7 @@ config FSL_USB2_OTG · 2 unmodified lines
2930 config ISP1301_OMAP
3031 tristate "Philips ISP1301 with OMAP OTG"
3132 depends on I2C && ARCH_OMAP_OTG
33+ depends on USB
3234 select USB_PHY
3335 help
3436 If you say yes here you get support for the Philips ISP1301
drivers/usb/phy/phy-tegra-usb.c+1−1
@@ -876,7 +876,7 @@ static int utmi_phy_probe(struct tegra_usb_phy *tegra_phy, · 875 unmodified lines
876876
877877 tegra_phy->pad_regs = devm_ioremap(&pdev->dev, res->start,
878878 resource_size(res));
879− if (!tegra_phy->regs) {
879+ if (!tegra_phy->pad_regs) {
880880 dev_err(&pdev->dev, "Failed to remap UTMI Pad regs\n");
881881 return -ENOMEM;
882882 }
drivers/usb/phy/phy-twl6030-usb.c+2−1
@@ -127,7 +127,8 @@ static inline int twl6030_writeb(struct twl6030_usb *twl, u8 module, · 126 unmodified lines
127127
128128 static inline u8 twl6030_readb(struct twl6030_usb *twl, u8 module, u8 address)
129129 {
130− u8 data, ret = 0;
130+ u8 data;
131+ int ret;
131132
132133 ret = twl_i2c_read_u8(module, &data, address);
133134 if (ret >= 0)
drivers/usb/serial/option.c+2−0
@@ -251,6 +251,7 @@ static void option_instat_callback(struct urb *urb); · 250 unmodified lines
251251 #define ZTE_PRODUCT_MF628 0x0015
252252 #define ZTE_PRODUCT_MF626 0x0031
253253 #define ZTE_PRODUCT_MC2718 0xffe8
254+#define ZTE_PRODUCT_AC2726 0xfff1
254255
255256 #define BENQ_VENDOR_ID 0x04a5
256257 #define BENQ_PRODUCT_H10 0x4068
@@ -1453,6 +1454,7 @@ static const struct usb_device_id option_ids[] = { · 1196 unmodified lines
14531454 { USB_VENDOR_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff, 0x02, 0x01) },
14541455 { USB_VENDOR_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff, 0x02, 0x05) },
14551456 { USB_VENDOR_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff, 0x86, 0x10) },
1457+ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_AC2726, 0xff, 0xff, 0xff) },
14561458
14571459 { USB_DEVICE(BENQ_VENDOR_ID, BENQ_PRODUCT_H10) },
14581460 { USB_DEVICE(DLINK_VENDOR_ID, DLINK_PRODUCT_DWM_652) },
drivers/usb/serial/zte_ev.c+1−2
@@ -281,8 +281,7 @@ static const struct usb_device_id id_table[] = { · 280 unmodified lines
281281 { USB_DEVICE(0x19d2, 0xfffd) },
282282 { USB_DEVICE(0x19d2, 0xfffc) },
283283 { USB_DEVICE(0x19d2, 0xfffb) },
284− /* AC2726, AC8710_V3 */
285− { USB_DEVICE_AND_INTERFACE_INFO(0x19d2, 0xfff1, 0xff, 0xff, 0xff) },
284+ /* AC8710_V3 */
286285 { USB_DEVICE(0x19d2, 0xfff6) },
287286 { USB_DEVICE(0x19d2, 0xfff7) },
288287 { USB_DEVICE(0x19d2, 0xfff8) },
drivers/xen/balloon.c+34−29
@@ -350,17 +350,19 @@ static enum bp_state increase_reservation(unsigned long nr_pages) · 349 unmodified lines
350350
351351 pfn = page_to_pfn(page);
352352
353− set_phys_to_machine(pfn, frame_list[i]);
354−
355353 #ifdef CONFIG_XEN_HAVE_PVMMU
356− /* Link back into the page tables if not highmem. */
357− if (xen_pv_domain() && !PageHighMem(page)) {
358− int ret;
359− ret = HYPERVISOR_update_va_mapping(
360− (unsigned long)__va(pfn << PAGE_SHIFT),
361− mfn_pte(frame_list[i], PAGE_KERNEL),
362− 0);
363− BUG_ON(ret);
354+ if (!xen_feature(XENFEAT_auto_translated_physmap)) {
355+ set_phys_to_machine(pfn, frame_list[i]);
356+
357+ /* Link back into the page tables if not highmem. */
358+ if (!PageHighMem(page)) {
359+ int ret;
360+ ret = HYPERVISOR_update_va_mapping(
361+ (unsigned long)__va(pfn << PAGE_SHIFT),
362+ mfn_pte(frame_list[i], PAGE_KERNEL),
363+ 0);
364+ BUG_ON(ret);
365+ }
364366 }
365367 #endif
366368
@@ -378,7 +380,6 @@ static enum bp_state decrease_reservation(unsigned long nr_pages, gfp_t gfp) · 11 unmodified lines
378380 enum bp_state state = BP_DONE;
379381 unsigned long pfn, i;
380382 struct page *page;
381− struct page *scratch_page;
382383 int ret;
383384 struct xen_memory_reservation reservation = {
384385 .address_bits = 0,
@@ -411,27 +412,29 @@ static enum bp_state decrease_reservation(unsigned long nr_pages, gfp_t gfp) · 26 unmodified lines
411412
412413 scrub_page(page);
413414
415+#ifdef CONFIG_XEN_HAVE_PVMMU
414416 /*
415417 * Ballooned out frames are effectively replaced with
416418 * a scratch frame. Ensure direct mappings and the
417419 * p2m are consistent.
418420 */
419− scratch_page = get_balloon_scratch_page();
420−#ifdef CONFIG_XEN_HAVE_PVMMU
421− if (xen_pv_domain() && !PageHighMem(page)) {
422− ret = HYPERVISOR_update_va_mapping(
423− (unsigned long)__va(pfn << PAGE_SHIFT),
424− pfn_pte(page_to_pfn(scratch_page),
425− PAGE_KERNEL_RO), 0);
426− BUG_ON(ret);
427− }
428−#endif
429421 if (!xen_feature(XENFEAT_auto_translated_physmap)) {
430422 unsigned long p;
423+ struct page *scratch_page = get_balloon_scratch_page();
424+
425+ if (!PageHighMem(page)) {
426+ ret = HYPERVISOR_update_va_mapping(
427+ (unsigned long)__va(pfn << PAGE_SHIFT),
428+ pfn_pte(page_to_pfn(scratch_page),
429+ PAGE_KERNEL_RO), 0);
430+ BUG_ON(ret);
431+ }
431432 p = page_to_pfn(scratch_page);
432433 __set_phys_to_machine(pfn, pfn_to_mfn(p));
434+
435+ put_balloon_scratch_page();
433436 }
434− put_balloon_scratch_page();
437+#endif
435438
436439 balloon_append(pfn_to_page(pfn));
437440 }
@@ -627,15 +630,17 @@ static int __init balloon_init(void) · 189 unmodified lines
627630 if (!xen_domain())
628631 return -ENODEV;
629632
630− for_each_online_cpu(cpu)
631− {
632− per_cpu(balloon_scratch_page, cpu) = alloc_page(GFP_KERNEL);
633− if (per_cpu(balloon_scratch_page, cpu) == NULL) {
634− pr_warn("Failed to allocate balloon_scratch_page for cpu %d\n", cpu);
635− return -ENOMEM;
633+ if (!xen_feature(XENFEAT_auto_translated_physmap)) {
634+ for_each_online_cpu(cpu)
635+ {
636+ per_cpu(balloon_scratch_page, cpu) = alloc_page(GFP_KERNEL);
637+ if (per_cpu(balloon_scratch_page, cpu) == NULL) {
638+ pr_warn("Failed to allocate balloon_scratch_page for cpu %d\n", cpu);
639+ return -ENOMEM;
640+ }
636641 }
642+ register_cpu_notifier(&balloon_cpu_notifier);
637643 }
638− register_cpu_notifier(&balloon_cpu_notifier);
639644
640645 pr_info("Initialising balloon driver\n");
641646
drivers/xen/grant-table.c+2−1
@@ -1176,7 +1176,8 @@ static int gnttab_setup(void) · 1175 unmodified lines
11761176 gnttab_shared.addr = xen_remap(xen_hvm_resume_frames,
11771177 PAGE_SIZE * max_nr_gframes);
11781178 if (gnttab_shared.addr == NULL) {
1179− pr_warn("Failed to ioremap gnttab share frames!\n");
1179+ pr_warn("Failed to ioremap gnttab share frames (addr=0x%08lx)!\n",
1180+ xen_hvm_resume_frames);
11801181 return -ENOMEM;
11811182 }
11821183 }
drivers/xen/privcmd.c+7−2
@@ -533,12 +533,17 @@ static void privcmd_close(struct vm_area_struct *vma) · 532 unmodified lines
533533 {
534534 struct page **pages = vma->vm_private_data;
535535 int numpgs = (vma->vm_end - vma->vm_start) >> PAGE_SHIFT;
536+ int rc;
536537
537538 if (!xen_feature(XENFEAT_auto_translated_physmap) || !numpgs || !pages)
538539 return;
539540
540− xen_unmap_domain_mfn_range(vma, numpgs, pages);
541− free_xenballooned_pages(numpgs, pages);
541+ rc = xen_unmap_domain_mfn_range(vma, numpgs, pages);
542+ if (rc == 0)
543+ free_xenballooned_pages(numpgs, pages);
544+ else
545+ pr_crit("unable to unmap MFN range: leaking %d pages. rc=%d\n",
546+ numpgs, rc);
542547 kfree(pages);
543548 }
544549
fs/aio.c+69−44
@@ -244,9 +244,14 @@ static void aio_free_ring(struct kioctx *ctx) · 243 unmodified lines
244244 int i;
245245
246246 for (i = 0; i < ctx->nr_pages; i++) {
247+ struct page *page;
247248 pr_debug("pid(%d) [%d] page->count=%d\n", current->pid, i,
248249 page_count(ctx->ring_pages[i]));
249− put_page(ctx->ring_pages[i]);
250+ page = ctx->ring_pages[i];
251+ if (!page)
252+ continue;
253+ ctx->ring_pages[i] = NULL;
254+ put_page(page);
250255 }
251256
252257 put_aio_ring_file(ctx);
@@ -280,18 +285,38 @@ static int aio_migratepage(struct address_space *mapping, struct page *new, · 27 unmodified lines
280285 unsigned long flags;
281286 int rc;
282287
288+ rc = 0;
289+
290+ /* Make sure the old page hasn't already been changed */
291+ spin_lock(&mapping->private_lock);
292+ ctx = mapping->private_data;
293+ if (ctx) {
294+ pgoff_t idx;
295+ spin_lock_irqsave(&ctx->completion_lock, flags);
296+ idx = old->index;
297+ if (idx < (pgoff_t)ctx->nr_pages) {
298+ if (ctx->ring_pages[idx] != old)
299+ rc = -EAGAIN;
300+ } else
301+ rc = -EINVAL;
302+ spin_unlock_irqrestore(&ctx->completion_lock, flags);
303+ } else
304+ rc = -EINVAL;
305+ spin_unlock(&mapping->private_lock);
306+
307+ if (rc != 0)
308+ return rc;
309+
283310 /* Writeback must be complete */
284311 BUG_ON(PageWriteback(old));
285− put_page(old);
312+ get_page(new);
286313
287− rc = migrate_page_move_mapping(mapping, new, old, NULL, mode);
314+ rc = migrate_page_move_mapping(mapping, new, old, NULL, mode, 1);
288315 if (rc != MIGRATEPAGE_SUCCESS) {
289− get_page(old);
316+ put_page(new);
290317 return rc;
291318 }
292319
293− get_page(new);
294−
295320 /* We can potentially race against kioctx teardown here. Use the
296321 * address_space's private data lock to protect the mapping's
297322 * private_data.
@@ -303,13 +328,24 @@ static int aio_migratepage(struct address_space *mapping, struct page *new, · 5 unmodified lines
303328 spin_lock_irqsave(&ctx->completion_lock, flags);
304329 migrate_page_copy(new, old);
305330 idx = old->index;
306− if (idx < (pgoff_t)ctx->nr_pages)
307− ctx->ring_pages[idx] = new;
331+ if (idx < (pgoff_t)ctx->nr_pages) {
332+ /* And only do the move if things haven't changed */
333+ if (ctx->ring_pages[idx] == old)
334+ ctx->ring_pages[idx] = new;
335+ else
336+ rc = -EAGAIN;
337+ } else
338+ rc = -EINVAL;
308339 spin_unlock_irqrestore(&ctx->completion_lock, flags);
309340 } else
310341 rc = -EBUSY;
311342 spin_unlock(&mapping->private_lock);
312343
344+ if (rc == MIGRATEPAGE_SUCCESS)
345+ put_page(old);
346+ else
347+ put_page(new);
348+
313349 return rc;
314350 }
315351 #endif
@@ -326,7 +362,7 @@ static int aio_setup_ring(struct kioctx *ctx) · 10 unmodified lines
326362 struct aio_ring *ring;
327363 unsigned nr_events = ctx->max_reqs;
328364 struct mm_struct *mm = current->mm;
329− unsigned long size, populate;
365+ unsigned long size, unused;
330366 int nr_pages;
331367 int i;
332368 struct file *file;
@@ -347,6 +383,20 @@ static int aio_setup_ring(struct kioctx *ctx) · 14 unmodified lines
347383 return -EAGAIN;
348384 }
349385
386+ ctx->aio_ring_file = file;
387+ nr_events = (PAGE_SIZE * nr_pages - sizeof(struct aio_ring))
388+ / sizeof(struct io_event);
389+
390+ ctx->ring_pages = ctx->internal_pages;
391+ if (nr_pages > AIO_RING_PAGES) {
392+ ctx->ring_pages = kcalloc(nr_pages, sizeof(struct page *),
393+ GFP_KERNEL);
394+ if (!ctx->ring_pages) {
395+ put_aio_ring_file(ctx);
396+ return -ENOMEM;
397+ }
398+ }
399+
350400 for (i = 0; i < nr_pages; i++) {
351401 struct page *page;
352402 page = find_or_create_page(file->f_inode->i_mapping,
@@ -358,19 +408,14 @@ static int aio_setup_ring(struct kioctx *ctx) · 5 unmodified lines
358408 SetPageUptodate(page);
359409 SetPageDirty(page);
360410 unlock_page(page);
411+
412+ ctx->ring_pages[i] = page;
361413 }
362− ctx->aio_ring_file = file;
363− nr_events = (PAGE_SIZE * nr_pages - sizeof(struct aio_ring))
364− / sizeof(struct io_event);
414+ ctx->nr_pages = i;
365415
366− ctx->ring_pages = ctx->internal_pages;
367− if (nr_pages > AIO_RING_PAGES) {
368− ctx->ring_pages = kcalloc(nr_pages, sizeof(struct page *),
369− GFP_KERNEL);
370− if (!ctx->ring_pages) {
371− put_aio_ring_file(ctx);
372− return -ENOMEM;
373− }
416+ if (unlikely(i != nr_pages)) {
417+ aio_free_ring(ctx);
418+ return -EAGAIN;
374419 }
375420
376421 ctx->mmap_size = nr_pages * PAGE_SIZE;
@@ -379,9 +424,9 @@ static int aio_setup_ring(struct kioctx *ctx) · 2 unmodified lines
379424 down_write(&mm->mmap_sem);
380425 ctx->mmap_base = do_mmap_pgoff(ctx->aio_ring_file, 0, ctx->mmap_size,
381426 PROT_READ | PROT_WRITE,
382− MAP_SHARED | MAP_POPULATE, 0, &populate);
427+ MAP_SHARED, 0, &unused);
428+ up_write(&mm->mmap_sem);
383429 if (IS_ERR((void *)ctx->mmap_base)) {
384− up_write(&mm->mmap_sem);
385430 ctx->mmap_size = 0;
386431 aio_free_ring(ctx);
387432 return -EAGAIN;
@@ -389,27 +434,6 @@ static int aio_setup_ring(struct kioctx *ctx) · 1 unmodified line
389434
390435 pr_debug("mmap address: 0x%08lx\n", ctx->mmap_base);
391436
392− /* We must do this while still holding mmap_sem for write, as we
393− * need to be protected against userspace attempting to mremap()
394− * or munmap() the ring buffer.
395− */
396− ctx->nr_pages = get_user_pages(current, mm, ctx->mmap_base, nr_pages,
397− 1, 0, ctx->ring_pages, NULL);
398−
399− /* Dropping the reference here is safe as the page cache will hold
400− * onto the pages for us. It is also required so that page migration
401− * can unmap the pages and get the right reference count.
402− */
403− for (i = 0; i < ctx->nr_pages; i++)
404− put_page(ctx->ring_pages[i]);
405−
406− up_write(&mm->mmap_sem);
407−
408− if (unlikely(ctx->nr_pages != nr_pages)) {
409− aio_free_ring(ctx);
410− return -EAGAIN;
411− }
412−
413437 ctx->user_id = ctx->mmap_base;
414438 ctx->nr_events = nr_events; /* trusted copy */
415439
@@ -652,7 +676,8 @@ static struct kioctx *ioctx_alloc(unsigned nr_events) · 236 unmodified lines
652676 aio_nr += ctx->max_reqs;
653677 spin_unlock(&aio_nr_lock);
654678
655− percpu_ref_get(&ctx->users); /* io_setup() will drop this ref */
679+ percpu_ref_get(&ctx->users); /* io_setup() will drop this ref */
680+ percpu_ref_get(&ctx->reqs); /* free_ioctx_users() will drop this */
656681
657682 err = ioctx_add_table(ctx, mm);
658683 if (err)
fs/ceph/addr.c+6−2
@@ -210,9 +210,13 @@ static int readpage_nounlock(struct file *filp, struct page *page) · 209 unmodified lines
210210 if (err < 0) {
211211 SetPageError(page);
212212 goto out;
213− } else if (err < PAGE_CACHE_SIZE) {
213+ } else {
214+ if (err < PAGE_CACHE_SIZE) {
214215 /* zero fill remainder of page */
215− zero_user_segment(page, err, PAGE_CACHE_SIZE);
216+ zero_user_segment(page, err, PAGE_CACHE_SIZE);
217+ } else {
218+ flush_dcache_page(page);
219+ }
216220 }
217221 SetPageUptodate(page);
218222
fs/ceph/inode.c+58−78
@@ -978,7 +978,6 @@ int ceph_fill_trace(struct super_block *sb, struct ceph_mds_request *req, · 977 unmodified lines
978978 struct ceph_mds_reply_inode *ininfo;
979979 struct ceph_vino vino;
980980 struct ceph_fs_client *fsc = ceph_sb_to_client(sb);
981− int i = 0;
982981 int err = 0;
983982
984983 dout("fill_trace %p is_dentry %d is_target %d\n", req,
@@ -1039,6 +1038,29 @@ int ceph_fill_trace(struct super_block *sb, struct ceph_mds_request *req, · 54 unmodified lines
10391038 }
10401039 }
10411040
1041+ if (rinfo->head->is_target) {
1042+ vino.ino = le64_to_cpu(rinfo->targeti.in->ino);
1043+ vino.snap = le64_to_cpu(rinfo->targeti.in->snapid);
1044+
1045+ in = ceph_get_inode(sb, vino);
1046+ if (IS_ERR(in)) {
1047+ err = PTR_ERR(in);
1048+ goto done;
1049+ }
1050+ req->r_target_inode = in;
1051+
1052+ err = fill_inode(in, &rinfo->targeti, NULL,
1053+ session, req->r_request_started,
1054+ (le32_to_cpu(rinfo->head->result) == 0) ?
1055+ req->r_fmode : -1,
1056+ &req->r_caps_reservation);
1057+ if (err < 0) {
1058+ pr_err("fill_inode badness %p %llx.%llx\n",
1059+ in, ceph_vinop(in));
1060+ goto done;
1061+ }
1062+ }
1063+
10421064 /*
10431065 * ignore null lease/binding on snapdir ENOENT, or else we
10441066 * will have trouble splicing in the virtual snapdir later
@@ -1108,7 +1130,6 @@ int ceph_fill_trace(struct super_block *sb, struct ceph_mds_request *req, · 63 unmodified lines
11081130 ceph_dentry(req->r_old_dentry)->offset);
11091131
11101132 dn = req->r_old_dentry; /* use old_dentry */
1111− in = dn->d_inode;
11121133 }
11131134
11141135 /* null dentry? */
@@ -1130,44 +1151,28 @@ int ceph_fill_trace(struct super_block *sb, struct ceph_mds_request *req, · 15 unmodified lines
11301151 }
11311152
11321153 /* attach proper inode */
1133− ininfo = rinfo->targeti.in;
1134− vino.ino = le64_to_cpu(ininfo->ino);
1135− vino.snap = le64_to_cpu(ininfo->snapid);
1136− in = dn->d_inode;
1137− if (!in) {
1138− in = ceph_get_inode(sb, vino);
1139− if (IS_ERR(in)) {
1140− pr_err("fill_trace bad get_inode "
1141− "%llx.%llx\n", vino.ino, vino.snap);
1142− err = PTR_ERR(in);
1143− d_drop(dn);
1144− goto done;
1145− }
1154+ if (!dn->d_inode) {
1155+ ihold(in);
11461156 dn = splice_dentry(dn, in, &have_lease, true);
11471157 if (IS_ERR(dn)) {
11481158 err = PTR_ERR(dn);
11491159 goto done;
11501160 }
11511161 req->r_dentry = dn; /* may have spliced */
1152− ihold(in);
1153− } else if (ceph_ino(in) == vino.ino &&
1154− ceph_snap(in) == vino.snap) {
1155− ihold(in);
1156− } else {
1162+ } else if (dn->d_inode && dn->d_inode != in) {
11571163 dout(" %p links to %p %llx.%llx, not %llx.%llx\n",
1158− dn, in, ceph_ino(in), ceph_snap(in),
1159− vino.ino, vino.snap);
1164+ dn, dn->d_inode, ceph_vinop(dn->d_inode),
1165+ ceph_vinop(in));
11601166 have_lease = false;
1161− in = NULL;
11621167 }
11631168
11641169 if (have_lease)
11651170 update_dentry_lease(dn, rinfo->dlease, session,
11661171 req->r_request_started);
11671172 dout(" final dn %p\n", dn);
1168− i++;
1169− } else if ((req->r_op == CEPH_MDS_OP_LOOKUPSNAP ||
1170− req->r_op == CEPH_MDS_OP_MKSNAP) && !req->r_aborted) {
1173+ } else if (!req->r_aborted &&
1174+ (req->r_op == CEPH_MDS_OP_LOOKUPSNAP ||
1175+ req->r_op == CEPH_MDS_OP_MKSNAP)) {
11711176 struct dentry *dn = req->r_dentry;
11721177
11731178 /* fill out a snapdir LOOKUPSNAP dentry */
@@ -1177,52 +1182,15 @@ int ceph_fill_trace(struct super_block *sb, struct ceph_mds_request *req, · 3 unmodified lines
11771182 ininfo = rinfo->targeti.in;
11781183 vino.ino = le64_to_cpu(ininfo->ino);
11791184 vino.snap = le64_to_cpu(ininfo->snapid);
1180− in = ceph_get_inode(sb, vino);
1181− if (IS_ERR(in)) {
1182− pr_err("fill_inode get_inode badness %llx.%llx\n",
1183− vino.ino, vino.snap);
1184− err = PTR_ERR(in);
1185− d_delete(dn);
1186− goto done;
1187− }
11881185 dout(" linking snapped dir %p to dn %p\n", in, dn);
1186+ ihold(in);
11891187 dn = splice_dentry(dn, in, NULL, true);
11901188 if (IS_ERR(dn)) {
11911189 err = PTR_ERR(dn);
11921190 goto done;
11931191 }
11941192 req->r_dentry = dn; /* may have spliced */
1195− ihold(in);
1196− rinfo->head->is_dentry = 1; /* fool notrace handlers */
1197− }
1198−
1199− if (rinfo->head->is_target) {
1200− vino.ino = le64_to_cpu(rinfo->targeti.in->ino);
1201− vino.snap = le64_to_cpu(rinfo->targeti.in->snapid);
1202−
1203− if (in == NULL || ceph_ino(in) != vino.ino ||
1204− ceph_snap(in) != vino.snap) {
1205− in = ceph_get_inode(sb, vino);
1206− if (IS_ERR(in)) {
1207− err = PTR_ERR(in);
1208− goto done;
1209− }
1210− }
1211− req->r_target_inode = in;
1212−
1213− err = fill_inode(in,
1214− &rinfo->targeti, NULL,
1215− session, req->r_request_started,
1216− (le32_to_cpu(rinfo->head->result) == 0) ?
1217− req->r_fmode : -1,
1218− &req->r_caps_reservation);
1219− if (err < 0) {
1220− pr_err("fill_inode badness %p %llx.%llx\n",
1221− in, ceph_vinop(in));
1222− goto done;
1223− }
12241193 }
1225−
12261194 done:
12271195 dout("fill_trace done err=%d\n", err);
12281196 return err;
@@ -1272,7 +1240,7 @@ int ceph_readdir_prepopulate(struct ceph_mds_request *req, · 43 unmodified lines
12721240 struct qstr dname;
12731241 struct dentry *dn;
12741242 struct inode *in;
1275− int err = 0, i;
1243+ int err = 0, ret, i;
12761244 struct inode *snapdir = NULL;
12771245 struct ceph_mds_request_head *rhead = req->r_request->front.iov_base;
12781246 struct ceph_dentry_info *di;
@@ -1305,6 +1273,7 @@ int ceph_readdir_prepopulate(struct ceph_mds_request *req, · 26 unmodified lines
13051273 ceph_fill_dirfrag(parent->d_inode, rinfo->dir_dir);
13061274 }
13071275
1276+ /* FIXME: release caps/leases if error occurs */
13081277 for (i = 0; i < rinfo->dir_nr; i++) {
13091278 struct ceph_vino vino;
13101279
@@ -1329,9 +1298,10 @@ retry_lookup: · 18 unmodified lines
13291298 err = -ENOMEM;
13301299 goto out;
13311300 }
1332− err = ceph_init_dentry(dn);
1333− if (err < 0) {
1301+ ret = ceph_init_dentry(dn);
1302+ if (ret < 0) {
13341303 dput(dn);
1304+ err = ret;
13351305 goto out;
13361306 }
13371307 } else if (dn->d_inode &&
@@ -1351,9 +1321,6 @@ retry_lookup: · 13 unmodified lines
13511321 spin_unlock(&parent->d_lock);
13521322 }
13531323
1354− di = dn->d_fsdata;
1355− di->offset = ceph_make_fpos(frag, i + r_readdir_offset);
1356−
13571324 /* inode */
13581325 if (dn->d_inode) {
13591326 in = dn->d_inode;
@@ -1366,26 +1333,39 @@ retry_lookup: · 6 unmodified lines
13661333 err = PTR_ERR(in);
13671334 goto out;
13681335 }
1369− dn = splice_dentry(dn, in, NULL, false);
1370− if (IS_ERR(dn))
1371− dn = NULL;
13721336 }
13731337
13741338 if (fill_inode(in, &rinfo->dir_in[i], NULL, session,
13751339 req->r_request_started, -1,
13761340 &req->r_caps_reservation) < 0) {
13771341 pr_err("fill_inode badness on %p\n", in);
1342+ if (!dn->d_inode)
1343+ iput(in);
1344+ d_drop(dn);
13781345 goto next_item;
13791346 }
1380− if (dn)
1381− update_dentry_lease(dn, rinfo->dir_dlease[i],
1382− req->r_session,
1383− req->r_request_started);
1347+
1348+ if (!dn->d_inode) {
1349+ dn = splice_dentry(dn, in, NULL, false);
1350+ if (IS_ERR(dn)) {
1351+ err = PTR_ERR(dn);
1352+ dn = NULL;
1353+ goto next_item;
1354+ }
1355+ }
1356+
1357+ di = dn->d_fsdata;
1358+ di->offset = ceph_make_fpos(frag, i + r_readdir_offset);
1359+
1360+ update_dentry_lease(dn, rinfo->dir_dlease[i],
1361+ req->r_session,
1362+ req->r_request_started);
13841363 next_item:
13851364 if (dn)
13861365 dput(dn);
13871366 }
1388− req->r_did_prepopulate = true;
1367+ if (err == 0)
1368+ req->r_did_prepopulate = true;
13891369
13901370 out:
13911371 if (snapdir) {
fs/pstore/platform.c+5−2
@@ -443,8 +443,11 @@ int pstore_register(struct pstore_info *psi) · 442 unmodified lines
443443 pstore_get_records(0);
444444
445445 kmsg_dump_register(&pstore_dumper);
446− pstore_register_console();
447− pstore_register_ftrace();
446+
447+ if ((psi->flags & PSTORE_FLAGS_FRAGILE) == 0) {
448+ pstore_register_console();
449+ pstore_register_ftrace();
450+ }
448451
449452 if (pstore_update_ms >= 0) {
450453 pstore_timer.expires = jiffies +
fs/sysfs/file.c+3−5
@@ -609,7 +609,7 @@ static int sysfs_open_file(struct inode *inode, struct file *file) · 608 unmodified lines
609609 struct sysfs_dirent *attr_sd = file->f_path.dentry->d_fsdata;
610610 struct kobject *kobj = attr_sd->s_parent->s_dir.kobj;
611611 struct sysfs_open_file *of;
612− bool has_read, has_write, has_mmap;
612+ bool has_read, has_write;
613613 int error = -EACCES;
614614
615615 /* need attr_sd for attr and ops, its parent for kobj */
@@ -621,7 +621,6 @@ static int sysfs_open_file(struct inode *inode, struct file *file) · 5 unmodified lines
621621
622622 has_read = battr->read || battr->mmap;
623623 has_write = battr->write || battr->mmap;
624− has_mmap = battr->mmap;
625624 } else {
626625 const struct sysfs_ops *ops = sysfs_file_ops(attr_sd);
627626
@@ -633,7 +632,6 @@ static int sysfs_open_file(struct inode *inode, struct file *file) · 5 unmodified lines
633632
634633 has_read = ops->show;
635634 has_write = ops->store;
636− has_mmap = false;
637635 }
638636
639637 /* check perms and supported operations */
@@ -661,9 +659,9 @@ static int sysfs_open_file(struct inode *inode, struct file *file) · 21 unmodified lines
661659 * open file has a separate mutex, it's okay as long as those don't
662660 * happen on the same file. At this point, we can't easily give
663661 * each file a separate locking class. Let's differentiate on
664− * whether the file has mmap or not for now.
662+ * whether the file is bin or not for now.
665663 */
666− if (has_mmap)
664+ if (sysfs_is_bin(attr_sd))
667665 mutex_init(&of->mutex);
668666 else
669667 mutex_init(&of->mutex);
fs/xfs/xfs_bmap.c+24−8
@@ -1635,7 +1635,7 @@ xfs_bmap_last_extent( · 1634 unmodified lines
16351635 * blocks at the end of the file which do not start at the previous data block,
16361636 * we will try to align the new blocks at stripe unit boundaries.
16371637 *
1638− * Returns 0 in bma->aeof if the file (fork) is empty as any new write will be
1638+ * Returns 1 in bma->aeof if the file (fork) is empty as any new write will be
16391639 * at, or past the EOF.
16401640 */
16411641 STATIC int
@@ -1650,9 +1650,14 @@ xfs_bmap_isaeof( · 8 unmodified lines
16501650 bma->aeof = 0;
16511651 error = xfs_bmap_last_extent(NULL, bma->ip, whichfork, &rec,
16521652 &is_empty);
1653− if (error || is_empty)
1653+ if (error)
16541654 return error;
16551655
1656+ if (is_empty) {
1657+ bma->aeof = 1;
1658+ return 0;
1659+ }
1660+
16561661 /*
16571662 * Check if we are allocation or past the last extent, or at least into
16581663 * the last delayed allocated extent.
@@ -3643,10 +3648,19 @@ xfs_bmap_btalloc( · 1984 unmodified lines
36433648 int isaligned;
36443649 int tryagain;
36453650 int error;
3651+ int stripe_align;
36463652
36473653 ASSERT(ap->length);
36483654
36493655 mp = ap->ip->i_mount;
3656+
3657+ /* stripe alignment for allocation is determined by mount parameters */
3658+ stripe_align = 0;
3659+ if (mp->m_swidth && (mp->m_flags & XFS_MOUNT_SWALLOC))
3660+ stripe_align = mp->m_swidth;
3661+ else if (mp->m_dalign)
3662+ stripe_align = mp->m_dalign;
3663+
36503664 align = ap->userdata ? xfs_get_extsz_hint(ap->ip) : 0;
36513665 if (unlikely(align)) {
36523666 error = xfs_bmap_extsize_align(mp, &ap->got, &ap->prev,
@@ -3655,6 +3669,8 @@ xfs_bmap_btalloc( · 2 unmodified lines
36553669 ASSERT(!error);
36563670 ASSERT(ap->length);
36573671 }
3672+
3673+
36583674 nullfb = *ap->firstblock == NULLFSBLOCK;
36593675 fb_agno = nullfb ? NULLAGNUMBER : XFS_FSB_TO_AGNO(mp, *ap->firstblock);
36603676 if (nullfb) {
@@ -3730,7 +3746,7 @@ xfs_bmap_btalloc( · 69 unmodified lines
37303746 */
37313747 if (!ap->flist->xbf_low && ap->aeof) {
37323748 if (!ap->offset) {
3733− args.alignment = mp->m_dalign;
3749+ args.alignment = stripe_align;
37343750 atype = args.type;
37353751 isaligned = 1;
37363752 /*
@@ -3755,13 +3771,13 @@ xfs_bmap_btalloc( · 18 unmodified lines
37553771 * of minlen+alignment+slop doesn't go up
37563772 * between the calls.
37573773 */
3758− if (blen > mp->m_dalign && blen <= args.maxlen)
3759− nextminlen = blen - mp->m_dalign;
3774+ if (blen > stripe_align && blen <= args.maxlen)
3775+ nextminlen = blen - stripe_align;
37603776 else
37613777 nextminlen = args.minlen;
3762− if (nextminlen + mp->m_dalign > args.minlen + 1)
3778+ if (nextminlen + stripe_align > args.minlen + 1)
37633779 args.minalignslop =
3764− nextminlen + mp->m_dalign -
3780+ nextminlen + stripe_align -
37653781 args.minlen - 1;
37663782 else
37673783 args.minalignslop = 0;
@@ -3783,7 +3799,7 @@ xfs_bmap_btalloc( · 15 unmodified lines
37833799 */
37843800 args.type = atype;
37853801 args.fsbno = ap->blkno;
3786− args.alignment = mp->m_dalign;
3802+ args.alignment = stripe_align;
37873803 args.minlen = nextminlen;
37883804 args.minalignslop = 0;
37893805 isaligned = 1;
fs/xfs/xfs_bmap_util.c+12−2
@@ -1187,7 +1187,12 @@ xfs_zero_remaining_bytes( · 1186 unmodified lines
11871187 XFS_BUF_UNWRITE(bp);
11881188 XFS_BUF_READ(bp);
11891189 XFS_BUF_SET_ADDR(bp, xfs_fsb_to_db(ip, imap.br_startblock));
1190− xfsbdstrat(mp, bp);
1190+
1191+ if (XFS_FORCED_SHUTDOWN(mp)) {
1192+ error = XFS_ERROR(EIO);
1193+ break;
1194+ }
1195+ xfs_buf_iorequest(bp);
11911196 error = xfs_buf_iowait(bp);
11921197 if (error) {
11931198 xfs_buf_ioerror_alert(bp,
@@ -1200,7 +1205,12 @@ xfs_zero_remaining_bytes( · 6 unmodified lines
12001205 XFS_BUF_UNDONE(bp);
12011206 XFS_BUF_UNREAD(bp);
12021207 XFS_BUF_WRITE(bp);
1203− xfsbdstrat(mp, bp);
1208+
1209+ if (XFS_FORCED_SHUTDOWN(mp)) {
1210+ error = XFS_ERROR(EIO);
1211+ break;
1212+ }
1213+ xfs_buf_iorequest(bp);
12041214 error = xfs_buf_iowait(bp);
12051215 if (error) {
12061216 xfs_buf_ioerror_alert(bp,
fs/xfs/xfs_buf.c+14−23
@@ -698,7 +698,11 @@ xfs_buf_read_uncached( · 697 unmodified lines
698698 bp->b_flags |= XBF_READ;
699699 bp->b_ops = ops;
700700
701− xfsbdstrat(target->bt_mount, bp);
701+ if (XFS_FORCED_SHUTDOWN(target->bt_mount)) {
702+ xfs_buf_relse(bp);
703+ return NULL;
704+ }
705+ xfs_buf_iorequest(bp);
702706 xfs_buf_iowait(bp);
703707 return bp;
704708 }
@@ -1089,7 +1093,7 @@ xfs_bioerror( · 384 unmodified lines
10891093 * This is meant for userdata errors; metadata bufs come with
10901094 * iodone functions attached, so that we can track down errors.
10911095 */
1092−STATIC int
1096+int
10931097 xfs_bioerror_relse(
10941098 struct xfs_buf *bp)
10951099 {
@@ -1152,7 +1156,7 @@ xfs_bwrite( · 56 unmodified lines
11521156 ASSERT(xfs_buf_islocked(bp));
11531157
11541158 bp->b_flags |= XBF_WRITE;
1155− bp->b_flags &= ~(XBF_ASYNC | XBF_READ | _XBF_DELWRI_Q);
1159+ bp->b_flags &= ~(XBF_ASYNC | XBF_READ | _XBF_DELWRI_Q | XBF_WRITE_FAIL);
11561160
11571161 xfs_bdstrat_cb(bp);
11581162
@@ -1164,25 +1168,6 @@ xfs_bwrite( · 5 unmodified lines
11641168 return error;
11651169 }
11661170
1167−/*
1168− * Wrapper around bdstrat so that we can stop data from going to disk in case
1169− * we are shutting down the filesystem. Typically user data goes thru this
1170− * path; one of the exceptions is the superblock.
1171− */
1172−void
1173−xfsbdstrat(
1174− struct xfs_mount *mp,
1175− struct xfs_buf *bp)
1176−{
1177− if (XFS_FORCED_SHUTDOWN(mp)) {
1178− trace_xfs_bdstrat_shut(bp, _RET_IP_);
1179− xfs_bioerror_relse(bp);
1180− return;
1181− }
1182−
1183− xfs_buf_iorequest(bp);
1184−}
1185−
11861171 STATIC void
11871172 _xfs_buf_ioend(
11881173 xfs_buf_t *bp,
@@ -1516,6 +1501,12 @@ xfs_wait_buftarg( · 327 unmodified lines
15161501 struct xfs_buf *bp;
15171502 bp = list_first_entry(&dispose, struct xfs_buf, b_lru);
15181503 list_del_init(&bp->b_lru);
1504+ if (bp->b_flags & XBF_WRITE_FAIL) {
1505+ xfs_alert(btp->bt_mount,
1506+"Corruption Alert: Buffer at block 0x%llx had permanent write failures!\n"
1507+"Please run xfs_repair to determine the extent of the problem.",
1508+ (long long)bp->b_bn);
1509+ }
15191510 xfs_buf_rele(bp);
15201511 }
15211512 if (loop++ != 0)
@@ -1799,7 +1790,7 @@ __xfs_buf_delwri_submit( · 277 unmodified lines
17991790
18001791 blk_start_plug(&plug);
18011792 list_for_each_entry_safe(bp, n, io_list, b_list) {
1802− bp->b_flags &= ~(_XBF_DELWRI_Q | XBF_ASYNC);
1793+ bp->b_flags &= ~(_XBF_DELWRI_Q | XBF_ASYNC | XBF_WRITE_FAIL);
18031794 bp->b_flags |= XBF_WRITE;
18041795
18051796 if (!wait) {
fs/xfs/xfs_buf.h+7−4
@@ -45,6 +45,7 @@ typedef enum { · 44 unmodified lines
4545 #define XBF_ASYNC (1 << 4) /* initiator will not wait for completion */
4646 #define XBF_DONE (1 << 5) /* all pages in the buffer uptodate */
4747 #define XBF_STALE (1 << 6) /* buffer has been staled, do not find it */
48+#define XBF_WRITE_FAIL (1 << 24)/* async writes have failed on this buffer */
4849
4950 /* I/O hints for the BIO layer */
5051 #define XBF_SYNCIO (1 << 10)/* treat this buffer as synchronous I/O */
@@ -70,6 +71,7 @@ typedef unsigned int xfs_buf_flags_t; · 19 unmodified lines
7071 { XBF_ASYNC, "ASYNC" }, \
7172 { XBF_DONE, "DONE" }, \
7273 { XBF_STALE, "STALE" }, \
74+ { XBF_WRITE_FAIL, "WRITE_FAIL" }, \
7375 { XBF_SYNCIO, "SYNCIO" }, \
7476 { XBF_FUA, "FUA" }, \
7577 { XBF_FLUSH, "FLUSH" }, \
@@ -80,6 +82,7 @@ typedef unsigned int xfs_buf_flags_t; · 4 unmodified lines
8082 { _XBF_DELWRI_Q, "DELWRI_Q" }, \
8183 { _XBF_COMPOUND, "COMPOUND" }
8284
85+
8386 /*
8487 * Internal state flags.
8588 */
@@ -269,9 +272,6 @@ extern void xfs_buf_unlock(xfs_buf_t *); · 183 unmodified lines
269272
270273 /* Buffer Read and Write Routines */
271274 extern int xfs_bwrite(struct xfs_buf *bp);
272−
273−extern void xfsbdstrat(struct xfs_mount *, struct xfs_buf *);
274−
275275 extern void xfs_buf_ioend(xfs_buf_t *, int);
276276 extern void xfs_buf_ioerror(xfs_buf_t *, int);
277277 extern void xfs_buf_ioerror_alert(struct xfs_buf *, const char *func);
@@ -282,6 +282,8 @@ extern void xfs_buf_iomove(xfs_buf_t *, size_t, size_t, void *, · 4 unmodified lines
282282 #define xfs_buf_zero(bp, off, len) \
283283 xfs_buf_iomove((bp), (off), (len), NULL, XBRW_ZERO)
284284
285+extern int xfs_bioerror_relse(struct xfs_buf *);
286+
285287 static inline int xfs_buf_geterror(xfs_buf_t *bp)
286288 {
287289 return bp ? bp->b_error : ENOMEM;
@@ -301,7 +303,8 @@ extern void xfs_buf_terminate(void); · 13 unmodified lines
301303
302304 #define XFS_BUF_ZEROFLAGS(bp) \
303305 ((bp)->b_flags &= ~(XBF_READ|XBF_WRITE|XBF_ASYNC| \
304− XBF_SYNCIO|XBF_FUA|XBF_FLUSH))
306+ XBF_SYNCIO|XBF_FUA|XBF_FLUSH| \
307+ XBF_WRITE_FAIL))
305308
306309 void xfs_buf_stale(struct xfs_buf *bp);
307310 #define XFS_BUF_UNSTALE(bp) ((bp)->b_flags &= ~XBF_STALE)
fs/xfs/xfs_buf_item.c+19−2
@@ -496,6 +496,14 @@ xfs_buf_item_unpin( · 495 unmodified lines
496496 }
497497 }
498498
499+/*
500+ * Buffer IO error rate limiting. Limit it to no more than 10 messages per 30
501+ * seconds so as to not spam logs too much on repeated detection of the same
502+ * buffer being bad..
503+ */
504+
505+DEFINE_RATELIMIT_STATE(xfs_buf_write_fail_rl_state, 30 * HZ, 10);
506+
499507 STATIC uint
500508 xfs_buf_item_push(
501509 struct xfs_log_item *lip,
@@ -524,6 +532,14 @@ xfs_buf_item_push( · 22 unmodified lines
524532
525533 trace_xfs_buf_item_push(bip);
526534
535+ /* has a previous flush failed due to IO errors? */
536+ if ((bp->b_flags & XBF_WRITE_FAIL) &&
537+ ___ratelimit(&xfs_buf_write_fail_rl_state, "XFS:")) {
538+ xfs_warn(bp->b_target->bt_mount,
539+"Detected failing async write on buffer block 0x%llx. Retrying async write.\n",
540+ (long long)bp->b_bn);
541+ }
542+
527543 if (!xfs_buf_delwri_queue(bp, buffer_list))
528544 rval = XFS_ITEM_FLUSHING;
529545 xfs_buf_unlock(bp);
@@ -1096,8 +1112,9 @@ xfs_buf_iodone_callbacks( · 566 unmodified lines
10961112
10971113 xfs_buf_ioerror(bp, 0); /* errno of 0 unsets the flag */
10981114
1099− if (!XFS_BUF_ISSTALE(bp)) {
1100− bp->b_flags |= XBF_WRITE | XBF_ASYNC | XBF_DONE;
1115+ if (!(bp->b_flags & (XBF_STALE|XBF_WRITE_FAIL))) {
1116+ bp->b_flags |= XBF_WRITE | XBF_ASYNC |
1117+ XBF_DONE | XBF_WRITE_FAIL;
11011118 xfs_buf_iorequest(bp);
11021119 } else {
11031120 xfs_buf_relse(bp);
fs/xfs/xfs_dir2_node.c+13−13
@@ -2067,12 +2067,12 @@ xfs_dir2_node_lookup( · 2066 unmodified lines
20672067 */
20682068 int /* error */
20692069 xfs_dir2_node_removename(
2070− xfs_da_args_t *args) /* operation arguments */
2070+ struct xfs_da_args *args) /* operation arguments */
20712071 {
2072− xfs_da_state_blk_t *blk; /* leaf block */
2072+ struct xfs_da_state_blk *blk; /* leaf block */
20732073 int error; /* error return value */
20742074 int rval; /* operation return value */
2075− xfs_da_state_t *state; /* btree cursor */
2075+ struct xfs_da_state *state; /* btree cursor */
20762076
20772077 trace_xfs_dir2_node_removename(args);
20782078
@@ -2084,19 +2084,18 @@ xfs_dir2_node_removename( · 5 unmodified lines
20842084 state->mp = args->dp->i_mount;
20852085 state->blocksize = state->mp->m_dirblksize;
20862086 state->node_ents = state->mp->m_dir_node_ents;
2087− /*
2088− * Look up the entry we're deleting, set up the cursor.
2089− */
2087+
2088+ /* Look up the entry we're deleting, set up the cursor. */
20902089 error = xfs_da3_node_lookup_int(state, &rval);
20912090 if (error)
2092− rval = error;
2093− /*
2094− * Didn't find it, upper layer screwed up.
2095− */
2091+ goto out_free;
2092+
2093+ /* Didn't find it, upper layer screwed up. */
20962094 if (rval != EEXIST) {
2097− xfs_da_state_free(state);
2098− return rval;
2095+ error = rval;
2096+ goto out_free;
20992097 }
2098+
21002099 blk = &state->path.blk[state->path.active - 1];
21012100 ASSERT(blk->magic == XFS_DIR2_LEAFN_MAGIC);
21022101 ASSERT(state->extravalid);
@@ -2107,7 +2106,7 @@ xfs_dir2_node_removename( · 4 unmodified lines
21072106 error = xfs_dir2_leafn_remove(args, blk->bp, blk->index,
21082107 &state->extrablk, &rval);
21092108 if (error)
2110− return error;
2109+ goto out_free;
21112110 /*
21122111 * Fix the hash values up the btree.
21132112 */
@@ -2122,6 +2121,7 @@ xfs_dir2_node_removename( · 8 unmodified lines
21222121 */
21232122 if (!error)
21242123 error = xfs_dir2_node_to_leaf(state);
2124+out_free:
21252125 xfs_da_state_free(state);
21262126 return error;
21272127 }
fs/xfs/xfs_iops.c+2−1
@@ -618,7 +618,8 @@ xfs_setattr_nonsize( · 617 unmodified lines
618618 }
619619 if (!gid_eq(igid, gid)) {
620620 if (XFS_IS_QUOTA_RUNNING(mp) && XFS_IS_GQUOTA_ON(mp)) {
621− ASSERT(!XFS_IS_PQUOTA_ON(mp));
621+ ASSERT(xfs_sb_version_has_pquotino(&mp->m_sb) ||
622+ !XFS_IS_PQUOTA_ON(mp));
622623 ASSERT(mask & ATTR_GID);
623624 ASSERT(gdqp);
624625 olddquot2 = xfs_qm_vop_chown(tp, ip,
fs/xfs/xfs_log_recover.c+11−2
@@ -193,7 +193,10 @@ xlog_bread_noalign( · 192 unmodified lines
193193 bp->b_io_length = nbblks;
194194 bp->b_error = 0;
195195
196− xfsbdstrat(log->l_mp, bp);
196+ if (XFS_FORCED_SHUTDOWN(log->l_mp))
197+ return XFS_ERROR(EIO);
198+
199+ xfs_buf_iorequest(bp);
197200 error = xfs_buf_iowait(bp);
198201 if (error)
199202 xfs_buf_ioerror_alert(bp, __func__);
@@ -4397,7 +4400,13 @@ xlog_do_recover( · 4197 unmodified lines
43974400 XFS_BUF_READ(bp);
43984401 XFS_BUF_UNASYNC(bp);
43994402 bp->b_ops = &xfs_sb_buf_ops;
4400− xfsbdstrat(log->l_mp, bp);
4403+
4404+ if (XFS_FORCED_SHUTDOWN(log->l_mp)) {
4405+ xfs_buf_relse(bp);
4406+ return XFS_ERROR(EIO);
4407+ }
4408+
4409+ xfs_buf_iorequest(bp);
44014410 error = xfs_buf_iowait(bp);
44024411 if (error) {
44034412 xfs_buf_ioerror_alert(bp, __func__);
fs/xfs/xfs_qm.c+53−27
@@ -134,8 +134,6 @@ xfs_qm_dqpurge( · 133 unmodified lines
134134 {
135135 struct xfs_mount *mp = dqp->q_mount;
136136 struct xfs_quotainfo *qi = mp->m_quotainfo;
137− struct xfs_dquot *gdqp = NULL;
138− struct xfs_dquot *pdqp = NULL;
139137
140138 xfs_dqlock(dqp);
141139 if ((dqp->dq_flags & XFS_DQ_FREEING) || dqp->q_nrefs != 0) {
@@ -143,21 +141,6 @@ xfs_qm_dqpurge( · 1 unmodified line
143141 return EAGAIN;
144142 }
145143
146− /*
147− * If this quota has a hint attached, prepare for releasing it now.
148− */
149− gdqp = dqp->q_gdquot;
150− if (gdqp) {
151− xfs_dqlock(gdqp);
152− dqp->q_gdquot = NULL;
153− }
154−
155− pdqp = dqp->q_pdquot;
156− if (pdqp) {
157− xfs_dqlock(pdqp);
158− dqp->q_pdquot = NULL;
159− }
160−
161144 dqp->dq_flags |= XFS_DQ_FREEING;
162145
163146 xfs_dqflock(dqp);
@@ -206,11 +189,47 @@ xfs_qm_dqpurge( · 42 unmodified lines
206189 XFS_STATS_DEC(xs_qm_dquot_unused);
207190
208191 xfs_qm_dqdestroy(dqp);
192+ return 0;
193+}
194+
195+/*
196+ * Release the group or project dquot pointers the user dquots maybe carrying
197+ * around as a hint, and proceed to purge the user dquot cache if requested.
198+*/
199+STATIC int
200+xfs_qm_dqpurge_hints(
201+ struct xfs_dquot *dqp,
202+ void *data)
203+{
204+ struct xfs_dquot *gdqp = NULL;
205+ struct xfs_dquot *pdqp = NULL;
206+ uint flags = *((uint *)data);
207+
208+ xfs_dqlock(dqp);
209+ if (dqp->dq_flags & XFS_DQ_FREEING) {
210+ xfs_dqunlock(dqp);
211+ return EAGAIN;
212+ }
213+
214+ /* If this quota has a hint attached, prepare for releasing it now */
215+ gdqp = dqp->q_gdquot;
216+ if (gdqp)
217+ dqp->q_gdquot = NULL;
218+
219+ pdqp = dqp->q_pdquot;
220+ if (pdqp)
221+ dqp->q_pdquot = NULL;
222+
223+ xfs_dqunlock(dqp);
209224
210225 if (gdqp)
211− xfs_qm_dqput(gdqp);
226+ xfs_qm_dqrele(gdqp);
212227 if (pdqp)
213− xfs_qm_dqput(pdqp);
228+ xfs_qm_dqrele(pdqp);
229+
230+ if (flags & XFS_QMOPT_UQUOTA)
231+ return xfs_qm_dqpurge(dqp, NULL);
232+
214233 return 0;
215234 }
216235
@@ -222,8 +241,18 @@ xfs_qm_dqpurge_all( · 5 unmodified lines
222241 struct xfs_mount *mp,
223242 uint flags)
224243 {
225− if (flags & XFS_QMOPT_UQUOTA)
226− xfs_qm_dquot_walk(mp, XFS_DQ_USER, xfs_qm_dqpurge, NULL);
244+ /*
245+ * We have to release group/project dquot hint(s) from the user dquot
246+ * at first if they are there, otherwise we would run into an infinite
247+ * loop while walking through radix tree to purge other type of dquots
248+ * since their refcount is not zero if the user dquot refers to them
249+ * as hint.
250+ *
251+ * Call the special xfs_qm_dqpurge_hints() will end up go through the
252+ * general xfs_qm_dqpurge() against user dquot cache if requested.
253+ */
254+ xfs_qm_dquot_walk(mp, XFS_DQ_USER, xfs_qm_dqpurge_hints, &flags);
255+
227256 if (flags & XFS_QMOPT_GQUOTA)
228257 xfs_qm_dquot_walk(mp, XFS_DQ_GROUP, xfs_qm_dqpurge, NULL);
229258 if (flags & XFS_QMOPT_PQUOTA)
@@ -2082,24 +2111,21 @@ xfs_qm_vop_create_dqattach( · 1852 unmodified lines
20822111 ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL));
20832112 ASSERT(XFS_IS_QUOTA_RUNNING(mp));
20842113
2085− if (udqp) {
2114+ if (udqp && XFS_IS_UQUOTA_ON(mp)) {
20862115 ASSERT(ip->i_udquot == NULL);
2087− ASSERT(XFS_IS_UQUOTA_ON(mp));
20882116 ASSERT(ip->i_d.di_uid == be32_to_cpu(udqp->q_core.d_id));
20892117
20902118 ip->i_udquot = xfs_qm_dqhold(udqp);
20912119 xfs_trans_mod_dquot(tp, udqp, XFS_TRANS_DQ_ICOUNT, 1);
20922120 }
2093− if (gdqp) {
2121+ if (gdqp && XFS_IS_GQUOTA_ON(mp)) {
20942122 ASSERT(ip->i_gdquot == NULL);
2095− ASSERT(XFS_IS_GQUOTA_ON(mp));
20962123 ASSERT(ip->i_d.di_gid == be32_to_cpu(gdqp->q_core.d_id));
20972124 ip->i_gdquot = xfs_qm_dqhold(gdqp);
20982125 xfs_trans_mod_dquot(tp, gdqp, XFS_TRANS_DQ_ICOUNT, 1);
20992126 }
2100− if (pdqp) {
2127+ if (pdqp && XFS_IS_PQUOTA_ON(mp)) {
21012128 ASSERT(ip->i_pdquot == NULL);
2102− ASSERT(XFS_IS_PQUOTA_ON(mp));
21032129 ASSERT(xfs_get_projid(ip) == be32_to_cpu(pdqp->q_core.d_id));
21042130
21052131 ip->i_pdquot = xfs_qm_dqhold(pdqp);
fs/xfs/xfs_trans_buf.c+12−1
@@ -314,7 +314,18 @@ xfs_trans_read_buf_map( · 313 unmodified lines
314314 ASSERT(bp->b_iodone == NULL);
315315 XFS_BUF_READ(bp);
316316 bp->b_ops = ops;
317− xfsbdstrat(tp->t_mountp, bp);
317+
318+ /*
319+ * XXX(hch): clean up the error handling here to be less
320+ * of a mess..
321+ */
322+ if (XFS_FORCED_SHUTDOWN(mp)) {
323+ trace_xfs_bdstrat_shut(bp, _RET_IP_);
324+ xfs_bioerror_relse(bp);
325+ } else {
326+ xfs_buf_iorequest(bp);
327+ }
328+
318329 error = xfs_buf_iowait(bp);
319330 if (error) {
320331 xfs_buf_ioerror_alert(bp, __func__);
include/asm-generic/pgtable.h+3−4
@@ -217,7 +217,7 @@ static inline int pmd_same(pmd_t pmd_a, pmd_t pmd_b) · 216 unmodified lines
217217 #endif
218218
219219 #ifndef pte_accessible
220−# define pte_accessible(pte) ((void)(pte),1)
220+# define pte_accessible(mm, pte) ((void)(pte), 1)
221221 #endif
222222
223223 #ifndef flush_tlb_fix_spurious_fault
@@ -599,11 +599,10 @@ static inline int pmd_none_or_trans_huge_or_clear_bad(pmd_t *pmd) · 375 unmodified lines
599599 #ifdef CONFIG_TRANSPARENT_HUGEPAGE
600600 barrier();
601601 #endif
602− if (pmd_none(pmdval))
602+ if (pmd_none(pmdval) || pmd_trans_huge(pmdval))
603603 return 1;
604604 if (unlikely(pmd_bad(pmdval))) {
605− if (!pmd_trans_huge(pmdval))
606− pmd_clear_bad(pmd);
605+ pmd_clear_bad(pmd);
607606 return 1;
608607 }
609608 return 0;
include/asm-generic/preempt.h+11−24
@@ -3,13 +3,11 @@ · 2 unmodified lines
33
44 #include <linux/thread_info.h>
55
6−/*
7− * We mask the PREEMPT_NEED_RESCHED bit so as not to confuse all current users
8− * that think a non-zero value indicates we cannot preempt.
9− */
6+#define PREEMPT_ENABLED (0)
7+
108 static __always_inline int preempt_count(void)
119 {
12− return current_thread_info()->preempt_count & ~PREEMPT_NEED_RESCHED;
10+ return current_thread_info()->preempt_count;
1311 }
1412
1513 static __always_inline int *preempt_count_ptr(void)
@@ -17,11 +15,6 @@ static __always_inline int *preempt_count_ptr(void) · 1 unmodified line
1715 return &current_thread_info()->preempt_count;
1816 }
1917
20−/*
21− * We now loose PREEMPT_NEED_RESCHED and cause an extra reschedule; however the
22− * alternative is loosing a reschedule. Better schedule too often -- also this
23− * should be a very rare operation.
24− */
2518 static __always_inline void preempt_count_set(int pc)
2619 {
2720 *preempt_count_ptr() = pc;
@@ -41,28 +34,17 @@ static __always_inline void preempt_count_set(int pc) · 13 unmodified lines
4134 task_thread_info(p)->preempt_count = PREEMPT_ENABLED; \
4235 } while (0)
4336
44−/*
45− * We fold the NEED_RESCHED bit into the preempt count such that
46− * preempt_enable() can decrement and test for needing to reschedule with a
47− * single instruction.
48− *
49− * We invert the actual bit, so that when the decrement hits 0 we know we both
50− * need to resched (the bit is cleared) and can resched (no preempt count).
51− */
52−
5337 static __always_inline void set_preempt_need_resched(void)
5438 {
55− *preempt_count_ptr() &= ~PREEMPT_NEED_RESCHED;
5639 }
5740
5841 static __always_inline void clear_preempt_need_resched(void)
5942 {
60− *preempt_count_ptr() |= PREEMPT_NEED_RESCHED;
6143 }
6244
6345 static __always_inline bool test_preempt_need_resched(void)
6446 {
65− return !(*preempt_count_ptr() & PREEMPT_NEED_RESCHED);
47+ return false;
6648 }
6749
6850 /*
@@ -81,7 +63,12 @@ static __always_inline void __preempt_count_sub(int val) · 12 unmodified lines
8163
8264 static __always_inline bool __preempt_count_dec_and_test(void)
8365 {
84− return !--*preempt_count_ptr();
66+ /*
67+ * Because of load-store architectures cannot do per-cpu atomic
68+ * operations; we cannot use PREEMPT_NEED_RESCHED because it might get
69+ * lost.
70+ */
71+ return !--*preempt_count_ptr() && tif_need_resched();
8572 }
8673
8774 /*
@@ -89,7 +76,7 @@ static __always_inline bool __preempt_count_dec_and_test(void) · 1 unmodified line
8976 */
9077 static __always_inline bool should_resched(void)
9178 {
92− return unlikely(!*preempt_count_ptr());
79+ return unlikely(!preempt_count() && tif_need_resched());
9380 }
9481
9582 #ifdef CONFIG_PREEMPT
include/linux/lockref.h+1−1
@@ -19,7 +19,7 @@ · 18 unmodified lines
1919
2020 #define USE_CMPXCHG_LOCKREF \
2121 (IS_ENABLED(CONFIG_ARCH_USE_CMPXCHG_LOCKREF) && \
22− IS_ENABLED(CONFIG_SMP) && !BLOATED_SPINLOCKS)
22+ IS_ENABLED(CONFIG_SMP) && SPINLOCK_SIZE <= 4)
2323
2424 struct lockref {
2525 union {
include/linux/math64.h+30−0
@@ -133,4 +133,34 @@ __iter_div_u64_rem(u64 dividend, u32 divisor, u64 *remainder) · 132 unmodified lines
133133 return ret;
134134 }
135135
136+#if defined(CONFIG_ARCH_SUPPORTS_INT128) && defined(__SIZEOF_INT128__)
137+
138+#ifndef mul_u64_u32_shr
139+static inline u64 mul_u64_u32_shr(u64 a, u32 mul, unsigned int shift)
140+{
141+ return (u64)(((unsigned __int128)a * mul) >> shift);
142+}
143+#endif /* mul_u64_u32_shr */
144+
145+#else
146+
147+#ifndef mul_u64_u32_shr
148+static inline u64 mul_u64_u32_shr(u64 a, u32 mul, unsigned int shift)
149+{
150+ u32 ah, al;
151+ u64 ret;
152+
153+ al = a;
154+ ah = a >> 32;
155+
156+ ret = ((u64)al * mul) >> shift;
157+ if (ah)
158+ ret += ((u64)ah * mul) << (32 - shift);
159+
160+ return ret;
161+}
162+#endif /* mul_u64_u32_shr */
163+
164+#endif
165+
136166 #endif /* _LINUX_MATH64_H */
include/linux/migrate.h+11−1
@@ -55,7 +55,8 @@ extern int migrate_huge_page_move_mapping(struct address_space *mapping, · 54 unmodified lines
5555 struct page *newpage, struct page *page);
5656 extern int migrate_page_move_mapping(struct address_space *mapping,
5757 struct page *newpage, struct page *page,
58− struct buffer_head *head, enum migrate_mode mode);
58+ struct buffer_head *head, enum migrate_mode mode,
59+ int extra_count);
5960 #else
6061
6162 static inline void putback_lru_pages(struct list_head *l) {}
@@ -90,10 +91,19 @@ static inline int migrate_huge_page_move_mapping(struct address_space *mapping, · 28 unmodified lines
9091 #endif /* CONFIG_MIGRATION */
9192
9293 #ifdef CONFIG_NUMA_BALANCING
94+extern bool pmd_trans_migrating(pmd_t pmd);
95+extern void wait_migrate_huge_page(struct anon_vma *anon_vma, pmd_t *pmd);
9396 extern int migrate_misplaced_page(struct page *page,
9497 struct vm_area_struct *vma, int node);
9598 extern bool migrate_ratelimited(int node);
9699 #else
100+static inline bool pmd_trans_migrating(pmd_t pmd)
101+{
102+ return false;
103+}
104+static inline void wait_migrate_huge_page(struct anon_vma *anon_vma, pmd_t *pmd)
105+{
106+}
97107 static inline int migrate_misplaced_page(struct page *page,
98108 struct vm_area_struct *vma, int node)
99109 {
include/linux/mm.h+3−3
@@ -1317,7 +1317,7 @@ static inline pmd_t *pmd_alloc(struct mm_struct *mm, pud_t *pud, unsigned long a · 1316 unmodified lines
13171317 #endif /* CONFIG_MMU && !__ARCH_HAS_4LEVEL_HACK */
13181318
13191319 #if USE_SPLIT_PTE_PTLOCKS
1320−#if BLOATED_SPINLOCKS
1320+#if ALLOC_SPLIT_PTLOCKS
13211321 extern bool ptlock_alloc(struct page *page);
13221322 extern void ptlock_free(struct page *page);
13231323
@@ -1325,7 +1325,7 @@ static inline spinlock_t *ptlock_ptr(struct page *page) · 1 unmodified line
13251325 {
13261326 return page->ptl;
13271327 }
1328−#else /* BLOATED_SPINLOCKS */
1328+#else /* ALLOC_SPLIT_PTLOCKS */
13291329 static inline bool ptlock_alloc(struct page *page)
13301330 {
13311331 return true;
@@ -1339,7 +1339,7 @@ static inline spinlock_t *ptlock_ptr(struct page *page) · 7 unmodified lines
13391339 {
13401340 return &page->ptl;
13411341 }
1342−#endif /* BLOATED_SPINLOCKS */
1342+#endif /* ALLOC_SPLIT_PTLOCKS */
13431343
13441344 static inline spinlock_t *pte_lockptr(struct mm_struct *mm, pmd_t *pmd)
13451345 {
include/linux/mm_types.h+51−1
@@ -26,6 +26,7 @@ struct address_space; · 25 unmodified lines
2626 #define USE_SPLIT_PTE_PTLOCKS (NR_CPUS >= CONFIG_SPLIT_PTLOCK_CPUS)
2727 #define USE_SPLIT_PMD_PTLOCKS (USE_SPLIT_PTE_PTLOCKS && \
2828 IS_ENABLED(CONFIG_ARCH_ENABLE_SPLIT_PMD_PTLOCK))
29+#define ALLOC_SPLIT_PTLOCKS (SPINLOCK_SIZE > BITS_PER_LONG/8)
2930
3031 /*
3132 * Each physical page in the system has a struct page associated with
@@ -155,7 +156,7 @@ struct page { · 123 unmodified lines
155156 * system if PG_buddy is set.
156157 */
157158 #if USE_SPLIT_PTE_PTLOCKS
158−#if BLOATED_SPINLOCKS
159+#if ALLOC_SPLIT_PTLOCKS
159160 spinlock_t *ptl;
160161 #else
161162 spinlock_t ptl;
@@ -442,6 +443,14 @@ struct mm_struct { · 280 unmodified lines
442443
443444 /* numa_scan_seq prevents two threads setting pte_numa */
444445 int numa_scan_seq;
446+#endif
447+#if defined(CONFIG_NUMA_BALANCING) || defined(CONFIG_COMPACTION)
448+ /*
449+ * An operation with batched TLB flushing is going on. Anything that
450+ * can move process memory needs to flush the TLB when moving a
451+ * PROT_NONE or PROT_NUMA mapped page.
452+ */
453+ bool tlb_flush_pending;
445454 #endif
446455 struct uprobes_state uprobes_state;
447456 };
@@ -459,4 +468,45 @@ static inline cpumask_t *mm_cpumask(struct mm_struct *mm) · 11 unmodified lines
459468 return mm->cpu_vm_mask_var;
460469 }
461470
471+#if defined(CONFIG_NUMA_BALANCING) || defined(CONFIG_COMPACTION)
472+/*
473+ * Memory barriers to keep this state in sync are graciously provided by
474+ * the page table locks, outside of which no page table modifications happen.
475+ * The barriers below prevent the compiler from re-ordering the instructions
476+ * around the memory barriers that are already present in the code.
477+ */
478+static inline bool mm_tlb_flush_pending(struct mm_struct *mm)
479+{
480+ barrier();
481+ return mm->tlb_flush_pending;
482+}
483+static inline void set_tlb_flush_pending(struct mm_struct *mm)
484+{
485+ mm->tlb_flush_pending = true;
486+
487+ /*
488+ * Guarantee that the tlb_flush_pending store does not leak into the
489+ * critical section updating the page tables
490+ */
491+ smp_mb__before_spinlock();
492+}
493+/* Clearing is done after a TLB flush, which also provides a barrier. */
494+static inline void clear_tlb_flush_pending(struct mm_struct *mm)
495+{
496+ barrier();
497+ mm->tlb_flush_pending = false;
498+}
499+#else
500+static inline bool mm_tlb_flush_pending(struct mm_struct *mm)
501+{
502+ return false;
503+}
504+static inline void set_tlb_flush_pending(struct mm_struct *mm)
505+{
506+}
507+static inline void clear_tlb_flush_pending(struct mm_struct *mm)
508+{
509+}
510+#endif
511+
462512 #endif /* _LINUX_MM_TYPES_H */
include/linux/pstore.h+3−0
@@ -51,6 +51,7 @@ struct pstore_info { · 50 unmodified lines
5151 char *buf;
5252 size_t bufsize;
5353 struct mutex read_mutex; /* serialize open/read/close */
54+ int flags;
5455 int (*open)(struct pstore_info *psi);
5556 int (*close)(struct pstore_info *psi);
5657 ssize_t (*read)(u64 *id, enum pstore_type_id *type,
@@ -70,6 +71,8 @@ struct pstore_info { · 13 unmodified lines
7071 void *data;
7172 };
7273
74+#define PSTORE_FLAGS_FRAGILE 1
75+
7376 #ifdef CONFIG_PSTORE
7477 extern int pstore_register(struct pstore_info *);
7578 extern bool pstore_cannot_block_path(enum kmsg_dump_reason reason);
include/linux/reboot.h+1−0
@@ -43,6 +43,7 @@ extern int unregister_reboot_notifier(struct notifier_block *); · 42 unmodified lines
4343 * Architecture-specific implementations of sys_reboot commands.
4444 */
4545
46+extern void migrate_to_reboot_cpu(void);
4647 extern void machine_restart(char *cmd);
4748 extern void machine_halt(void);
4849 extern void machine_power_off(void);
include/linux/sched.h+2−3
@@ -440,8 +440,6 @@ struct task_cputime { · 439 unmodified lines
440440 .sum_exec_runtime = 0, \
441441 }
442442
443−#define PREEMPT_ENABLED (PREEMPT_NEED_RESCHED)
444−
445443 #ifdef CONFIG_PREEMPT_COUNT
446444 #define PREEMPT_DISABLED (1 + PREEMPT_ENABLED)
447445 #else
@@ -932,7 +930,8 @@ struct pipe_inode_info; · 484 unmodified lines
932930 struct uts_namespace;
933931
934932 struct load_weight {
935− unsigned long weight, inv_weight;
933+ unsigned long weight;
934+ u32 inv_weight;
936935 };
937936
938937 struct sched_avg {
include/target/target_core_base.h+1−4
@@ -517,10 +517,6 @@ struct se_node_acl { · 516 unmodified lines
517517 u32 acl_index;
518518 #define MAX_ACL_TAG_SIZE 64
519519 char acl_tag[MAX_ACL_TAG_SIZE];
520− u64 num_cmds;
521− u64 read_bytes;
522− u64 write_bytes;
523− spinlock_t stats_lock;
524520 /* Used for PR SPEC_I_PT=1 and REGISTER_AND_MOVE */
525521 atomic_t acl_pr_ref_count;
526522 struct se_dev_entry **device_list;
@@ -624,6 +620,7 @@ struct se_dev_attrib { · 97 unmodified lines
624620 u32 unmap_granularity;
625621 u32 unmap_granularity_alignment;
626622 u32 max_write_same_len;
623+ u32 max_bytes_per_io;
627624 struct se_device *da_dev;
628625 struct config_group da_group;
629626 };
include/uapi/drm/vmwgfx_drm.h+1−0
@@ -75,6 +75,7 @@ · 74 unmodified lines
7575 #define DRM_VMW_PARAM_FIFO_CAPS 4
7676 #define DRM_VMW_PARAM_MAX_FB_SIZE 5
7777 #define DRM_VMW_PARAM_FIFO_HW_VERSION 6
78+#define DRM_VMW_PARAM_MAX_SURF_MEMORY 7
7879
7980 /**
8081 * struct drm_vmw_getparam_arg
include/uapi/linux/perf_event.h+1−0
@@ -679,6 +679,7 @@ enum perf_event_type { · 678 unmodified lines
679679 *
680680 * { u64 weight; } && PERF_SAMPLE_WEIGHT
681681 * { u64 data_src; } && PERF_SAMPLE_DATA_SRC
682+ * { u64 transaction; } && PERF_SAMPLE_TRANSACTION
682683 * };
683684 */
684685 PERF_RECORD_SAMPLE = 9,
include/xen/interface/io/blkif.h+5−5
@@ -146,7 +146,7 @@ struct blkif_request_segment_aligned { · 145 unmodified lines
146146 struct blkif_request_rw {
147147 uint8_t nr_segments; /* number of segments */
148148 blkif_vdev_t handle; /* only for read/write requests */
149−#ifdef CONFIG_X86_64
149+#ifndef CONFIG_X86_32
150150 uint32_t _pad1; /* offsetof(blkif_request,u.rw.id) == 8 */
151151 #endif
152152 uint64_t id; /* private guest value, echoed in resp */
@@ -163,7 +163,7 @@ struct blkif_request_discard { · 10 unmodified lines
163163 uint8_t flag; /* BLKIF_DISCARD_SECURE or zero. */
164164 #define BLKIF_DISCARD_SECURE (1<<0) /* ignored if discard-secure=0 */
165165 blkif_vdev_t _pad1; /* only for read/write requests */
166−#ifdef CONFIG_X86_64
166+#ifndef CONFIG_X86_32
167167 uint32_t _pad2; /* offsetof(blkif_req..,u.discard.id)==8*/
168168 #endif
169169 uint64_t id; /* private guest value, echoed in resp */
@@ -175,7 +175,7 @@ struct blkif_request_discard { · 5 unmodified lines
175175 struct blkif_request_other {
176176 uint8_t _pad1;
177177 blkif_vdev_t _pad2; /* only for read/write requests */
178−#ifdef CONFIG_X86_64
178+#ifndef CONFIG_X86_32
179179 uint32_t _pad3; /* offsetof(blkif_req..,u.other.id)==8*/
180180 #endif
181181 uint64_t id; /* private guest value, echoed in resp */
@@ -184,7 +184,7 @@ struct blkif_request_other { · 2 unmodified lines
184184 struct blkif_request_indirect {
185185 uint8_t indirect_op;
186186 uint16_t nr_segments;
187−#ifdef CONFIG_X86_64
187+#ifndef CONFIG_X86_32
188188 uint32_t _pad1; /* offsetof(blkif_...,u.indirect.id) == 8 */
189189 #endif
190190 uint64_t id;
@@ -192,7 +192,7 @@ struct blkif_request_indirect { · 1 unmodified line
192192 blkif_vdev_t handle;
193193 uint16_t _pad2;
194194 grant_ref_t indirect_grefs[BLKIF_MAX_INDIRECT_PAGES_PER_REQUEST];
195−#ifdef CONFIG_X86_64
195+#ifndef CONFIG_X86_32
196196 uint32_t _pad3; /* make it 64 byte aligned */
197197 #else
198198 uint64_t _pad3; /* make it 64 byte aligned */
init/Kconfig+6−0
@@ -809,6 +809,12 @@ config GENERIC_SCHED_CLOCK · 808 unmodified lines
809809 config ARCH_SUPPORTS_NUMA_BALANCING
810810 bool
811811
812+#
813+# For architectures that know their GCC __int128 support is sound
814+#
815+config ARCH_SUPPORTS_INT128
816+ bool
817+
812818 # For architectures that (ab)use NUMA to represent different memory regions
813819 # all cpu-local but of different latencies, such as SuperH.
814820 #
kernel/Makefile+4−3
@@ -137,9 +137,10 @@ $(obj)/timeconst.h: $(obj)/hz.bc $(src)/timeconst.bc FORCE · 136 unmodified lines
137137 ###############################################################################
138138 ifeq ($(CONFIG_SYSTEM_TRUSTED_KEYRING),y)
139139 X509_CERTIFICATES-y := $(wildcard *.x509) $(wildcard $(srctree)/*.x509)
140−X509_CERTIFICATES-$(CONFIG_MODULE_SIG) += signing_key.x509
141−X509_CERTIFICATES := $(sort $(foreach CERT,$(X509_CERTIFICATES-y), \
140+X509_CERTIFICATES-$(CONFIG_MODULE_SIG) += $(objtree)/signing_key.x509
141+X509_CERTIFICATES-raw := $(sort $(foreach CERT,$(X509_CERTIFICATES-y), \
142142 $(or $(realpath $(CERT)),$(CERT))))
143+X509_CERTIFICATES := $(subst $(realpath $(objtree))/,,$(X509_CERTIFICATES-raw))
143144
144145 ifeq ($(X509_CERTIFICATES),)
145146 $(warning *** No X.509 certificates found ***)
@@ -164,9 +165,9 @@ $(obj)/x509_certificate_list: $(X509_CERTIFICATES) $(obj)/.x509.list · 18 unmodified lines
164165 targets += $(obj)/.x509.list
165166 $(obj)/.x509.list:
166167 @echo $(X509_CERTIFICATES) >$@
168+endif
167169
168170 clean-files := x509_certificate_list .x509.list
169−endif
170171
171172 ifeq ($(CONFIG_MODULE_SIG),y)
172173 ###############################################################################
kernel/bounds.c+1−1
@@ -22,6 +22,6 @@ void foo(void) · 21 unmodified lines
2222 #ifdef CONFIG_SMP
2323 DEFINE(NR_CPUS_BITS, ilog2(CONFIG_NR_CPUS));
2424 #endif
25− DEFINE(BLOATED_SPINLOCKS, sizeof(spinlock_t) > sizeof(int));
25+ DEFINE(SPINLOCK_SIZE, sizeof(spinlock_t));
2626 /* End of constants */
2727 }
kernel/events/core.c+18−3
@@ -1396,6 +1396,8 @@ event_sched_out(struct perf_event *event, · 1395 unmodified lines
13961396 if (event->state != PERF_EVENT_STATE_ACTIVE)
13971397 return;
13981398
1399+ perf_pmu_disable(event->pmu);
1400+
13991401 event->state = PERF_EVENT_STATE_INACTIVE;
14001402 if (event->pending_disable) {
14011403 event->pending_disable = 0;
@@ -1412,6 +1414,8 @@ event_sched_out(struct perf_event *event, · 10 unmodified lines
14121414 ctx->nr_freq--;
14131415 if (event->attr.exclusive || !cpuctx->active_oncpu)
14141416 cpuctx->exclusive = 0;
1417+
1418+ perf_pmu_enable(event->pmu);
14151419 }
14161420
14171421 static void
@@ -1652,6 +1656,7 @@ event_sched_in(struct perf_event *event, · 234 unmodified lines
16521656 struct perf_event_context *ctx)
16531657 {
16541658 u64 tstamp = perf_event_time(event);
1659+ int ret = 0;
16551660
16561661 if (event->state <= PERF_EVENT_STATE_OFF)
16571662 return 0;
@@ -1674,10 +1679,13 @@ event_sched_in(struct perf_event *event, · 16 unmodified lines
16741679 */
16751680 smp_wmb();
16761681
1682+ perf_pmu_disable(event->pmu);
1683+
16771684 if (event->pmu->add(event, PERF_EF_START)) {
16781685 event->state = PERF_EVENT_STATE_INACTIVE;
16791686 event->oncpu = -1;
1680− return -EAGAIN;
1687+ ret = -EAGAIN;
1688+ goto out;
16811689 }
16821690
16831691 event->tstamp_running += tstamp - event->tstamp_stopped;
@@ -1693,7 +1701,10 @@ event_sched_in(struct perf_event *event, · 9 unmodified lines
16931701 if (event->attr.exclusive)
16941702 cpuctx->exclusive = 1;
16951703
1696− return 0;
1704+out:
1705+ perf_pmu_enable(event->pmu);
1706+
1707+ return ret;
16971708 }
16981709
16991710 static int
@@ -2743,6 +2754,8 @@ static void perf_adjust_freq_unthr_context(struct perf_event_context *ctx, · 1043 unmodified lines
27432754 if (!event_filter_match(event))
27442755 continue;
27452756
2757+ perf_pmu_disable(event->pmu);
2758+
27462759 hwc = &event->hw;
27472760
27482761 if (hwc->interrupts == MAX_INTERRUPTS) {
@@ -2752,7 +2765,7 @@ static void perf_adjust_freq_unthr_context(struct perf_event_context *ctx, · 3 unmodified lines
27522765 }
27532766
27542767 if (!event->attr.freq || !event->attr.sample_freq)
2755− continue;
2768+ goto next;
27562769
27572770 /*
27582771 * stop the event and update event->count
@@ -2774,6 +2787,8 @@ static void perf_adjust_freq_unthr_context(struct perf_event_context *ctx, · 15 unmodified lines
27742787 perf_adjust_period(event, period, delta, false);
27752788
27762789 event->pmu->start(event, delta > 0 ? PERF_EF_RELOAD : 0);
2790+ next:
2791+ perf_pmu_enable(event->pmu);
27772792 }
27782793
27792794 perf_pmu_enable(ctx->pmu);
kernel/fork.c+1−0
@@ -537,6 +537,7 @@ static struct mm_struct *mm_init(struct mm_struct *mm, struct task_struct *p) · 536 unmodified lines
537537 spin_lock_init(&mm->page_table_lock);
538538 mm_init_aio(mm);
539539 mm_init_owner(mm, p);
540+ clear_tlb_flush_pending(mm);
540541
541542 if (likely(!mm_alloc_pgd(mm))) {
542543 mm->def_flags = 0;
kernel/kexec.c+1−0
@@ -1680,6 +1680,7 @@ int kernel_kexec(void) · 1679 unmodified lines
16801680 {
16811681 kexec_in_progress = true;
16821682 kernel_restart_prepare(NULL);
1683+ migrate_to_reboot_cpu();
16831684 printk(KERN_EMERG "Starting new kernel\n");
16841685 machine_shutdown();
16851686 }
kernel/reboot.c+1−1
@@ -104,7 +104,7 @@ int unregister_reboot_notifier(struct notifier_block *nb) · 103 unmodified lines
104104 }
105105 EXPORT_SYMBOL(unregister_reboot_notifier);
106106
107−static void migrate_to_reboot_cpu(void)
107+void migrate_to_reboot_cpu(void)
108108 {
109109 /* The boot cpu is always logical cpu 0 */
110110 int cpu = reboot_cpu;
kernel/sched/core.c+4−2
@@ -4902,6 +4902,7 @@ DEFINE_PER_CPU(struct sched_domain *, sd_asym); · 4901 unmodified lines
49024902 static void update_top_cache_domain(int cpu)
49034903 {
49044904 struct sched_domain *sd;
4905+ struct sched_domain *busy_sd = NULL;
49054906 int id = cpu;
49064907 int size = 1;
49074908
@@ -4909,9 +4910,9 @@ static void update_top_cache_domain(int cpu) · 1 unmodified line
49094910 if (sd) {
49104911 id = cpumask_first(sched_domain_span(sd));
49114912 size = cpumask_weight(sched_domain_span(sd));
4912− sd = sd->parent; /* sd_busy */
4913+ busy_sd = sd->parent; /* sd_busy */
49134914 }
4914− rcu_assign_pointer(per_cpu(sd_busy, cpu), sd);
4915+ rcu_assign_pointer(per_cpu(sd_busy, cpu), busy_sd);
49154916
49164917 rcu_assign_pointer(per_cpu(sd_llc, cpu), sd);
49174918 per_cpu(sd_llc_size, cpu) = size;
@@ -5112,6 +5113,7 @@ build_overlap_sched_groups(struct sched_domain *sd, int cpu) · 194 unmodified lines
51125113 * die on a /0 trap.
51135114 */
51145115 sg->sgp->power = SCHED_POWER_SCALE * cpumask_weight(sg_span);
5116+ sg->sgp->power_orig = sg->sgp->power;
51155117
51165118 /*
51175119 * Make sure the first group of this domain contains the
kernel/sched/fair.c+71−80
@@ -178,59 +178,61 @@ void sched_init_granularity(void) · 177 unmodified lines
178178 update_sysctl();
179179 }
180180
181−#if BITS_PER_LONG == 32
182−# define WMULT_CONST (~0UL)
183−#else
184−# define WMULT_CONST (1UL << 32)
185−#endif
186−
181+#define WMULT_CONST (~0U)
187182 #define WMULT_SHIFT 32
188183
189−/*
190− * Shift right and round:
191− */
192−#define SRR(x, y) (((x) + (1UL << ((y) - 1))) >> (y))
184+static void __update_inv_weight(struct load_weight *lw)
185+{
186+ unsigned long w;
187+
188+ if (likely(lw->inv_weight))
189+ return;
190+
191+ w = scale_load_down(lw->weight);
192+
193+ if (BITS_PER_LONG > 32 && unlikely(w >= WMULT_CONST))
194+ lw->inv_weight = 1;
195+ else if (unlikely(!w))
196+ lw->inv_weight = WMULT_CONST;
197+ else
198+ lw->inv_weight = WMULT_CONST / w;
199+}
193200
194201 /*
195− * delta *= weight / lw
202+ * delta_exec * weight / lw.weight
203+ * OR
204+ * (delta_exec * (weight * lw->inv_weight)) >> WMULT_SHIFT
205+ *
206+ * Either weight := NICE_0_LOAD and lw \e prio_to_wmult[], in which case
207+ * we're guaranteed shift stays positive because inv_weight is guaranteed to
208+ * fit 32 bits, and NICE_0_LOAD gives another 10 bits; therefore shift >= 22.
209+ *
210+ * Or, weight =< lw.weight (because lw.weight is the runqueue weight), thus
211+ * weight/lw.weight <= 1, and therefore our shift will also be positive.
196212 */
197−static unsigned long
198−calc_delta_mine(unsigned long delta_exec, unsigned long weight,
199− struct load_weight *lw)
213+static u64 __calc_delta(u64 delta_exec, unsigned long weight, struct load_weight *lw)
200214 {
201− u64 tmp;
202−
203− /*
204− * weight can be less than 2^SCHED_LOAD_RESOLUTION for task group sched
205− * entities since MIN_SHARES = 2. Treat weight as 1 if less than
206− * 2^SCHED_LOAD_RESOLUTION.
207− */
208− if (likely(weight > (1UL << SCHED_LOAD_RESOLUTION)))
209− tmp = (u64)delta_exec * scale_load_down(weight);
210− else
211− tmp = (u64)delta_exec;
215+ u64 fact = scale_load_down(weight);
216+ int shift = WMULT_SHIFT;
212217
213− if (!lw->inv_weight) {
214− unsigned long w = scale_load_down(lw->weight);
218+ __update_inv_weight(lw);
215219
216− if (BITS_PER_LONG > 32 && unlikely(w >= WMULT_CONST))
217− lw->inv_weight = 1;
218− else if (unlikely(!w))
219− lw->inv_weight = WMULT_CONST;
220− else
221− lw->inv_weight = WMULT_CONST / w;
220+ if (unlikely(fact >> 32)) {
221+ while (fact >> 32) {
222+ fact >>= 1;
223+ shift--;
224+ }
222225 }
223226
224− /*
225− * Check whether we'd overflow the 64-bit multiplication:
226− */
227− if (unlikely(tmp > WMULT_CONST))
228− tmp = SRR(SRR(tmp, WMULT_SHIFT/2) * lw->inv_weight,
229− WMULT_SHIFT/2);
230− else
231− tmp = SRR(tmp * lw->inv_weight, WMULT_SHIFT);
227+ /* hint to use a 32x32->64 mul */
228+ fact = (u64)(u32)fact * lw->inv_weight;
229+
230+ while (fact >> 32) {
231+ fact >>= 1;
232+ shift--;
233+ }
232234
233− return (unsigned long)min(tmp, (u64)(unsigned long)LONG_MAX);
235+ return mul_u64_u32_shr(delta_exec, fact, shift);
234236 }
235237
236238
@@ -443,7 +445,7 @@ find_matching_se(struct sched_entity **se, struct sched_entity **pse) · 206 unmodified lines
443445 #endif /* CONFIG_FAIR_GROUP_SCHED */
444446
445447 static __always_inline
446−void account_cfs_rq_runtime(struct cfs_rq *cfs_rq, unsigned long delta_exec);
448+void account_cfs_rq_runtime(struct cfs_rq *cfs_rq, u64 delta_exec);
447449
448450 /**************************************************************
449451 * Scheduling class tree data structure manipulation methods:
@@ -612,11 +614,10 @@ int sched_proc_update_handler(struct ctl_table *table, int write, · 162 unmodified lines
612614 /*
613615 * delta /= w
614616 */
615−static inline unsigned long
616−calc_delta_fair(unsigned long delta, struct sched_entity *se)
617+static inline u64 calc_delta_fair(u64 delta, struct sched_entity *se)
617618 {
618619 if (unlikely(se->load.weight != NICE_0_LOAD))
619− delta = calc_delta_mine(delta, NICE_0_LOAD, &se->load);
620+ delta = __calc_delta(delta, NICE_0_LOAD, &se->load);
620621
621622 return delta;
622623 }
@@ -665,7 +666,7 @@ static u64 sched_slice(struct cfs_rq *cfs_rq, struct sched_entity *se) · 42 unmodified lines
665666 update_load_add(&lw, se->load.weight);
666667 load = &lw;
667668 }
668− slice = calc_delta_mine(slice, se->load.weight, load);
669+ slice = __calc_delta(slice, se->load.weight, load);
669670 }
670671 return slice;
671672 }
@@ -703,47 +704,32 @@ void init_task_runnable_average(struct task_struct *p) · 31 unmodified lines
703704 #endif
704705
705706 /*
706− * Update the current task's runtime statistics. Skip current tasks that
707− * are not in our scheduling class.
707+ * Update the current task's runtime statistics.
708708 */
709−static inline void
710−__update_curr(struct cfs_rq *cfs_rq, struct sched_entity *curr,
711− unsigned long delta_exec)
712−{
713− unsigned long delta_exec_weighted;
714−
715− schedstat_set(curr->statistics.exec_max,
716− max((u64)delta_exec, curr->statistics.exec_max));
717−
718− curr->sum_exec_runtime += delta_exec;
719− schedstat_add(cfs_rq, exec_clock, delta_exec);
720− delta_exec_weighted = calc_delta_fair(delta_exec, curr);
721−
722− curr->vruntime += delta_exec_weighted;
723− update_min_vruntime(cfs_rq);
724−}
725−
726709 static void update_curr(struct cfs_rq *cfs_rq)
727710 {
728711 struct sched_entity *curr = cfs_rq->curr;
729712 u64 now = rq_clock_task(rq_of(cfs_rq));
730− unsigned long delta_exec;
713+ u64 delta_exec;
731714
732715 if (unlikely(!curr))
733716 return;
734717
735− /*
736− * Get the amount of time the current task was running
737− * since the last time we changed load (this cannot
738− * overflow on 32 bits):
739− */
740− delta_exec = (unsigned long)(now - curr->exec_start);
741− if (!delta_exec)
718+ delta_exec = now - curr->exec_start;
719+ if (unlikely((s64)delta_exec <= 0))
742720 return;
743721
744− __update_curr(cfs_rq, curr, delta_exec);
745722 curr->exec_start = now;
746723
724+ schedstat_set(curr->statistics.exec_max,
725+ max(delta_exec, curr->statistics.exec_max));
726+
727+ curr->sum_exec_runtime += delta_exec;
728+ schedstat_add(cfs_rq, exec_clock, delta_exec);
729+
730+ curr->vruntime += calc_delta_fair(delta_exec, curr);
731+ update_min_vruntime(cfs_rq);
732+
747733 if (entity_is_task(curr)) {
748734 struct task_struct *curtask = task_of(curr);
749735
@@ -1752,6 +1738,13 @@ void task_numa_work(struct callback_head *work) · 1002 unmodified lines
17521738 (vma->vm_file && (vma->vm_flags & (VM_READ|VM_WRITE)) == (VM_READ)))
17531739 continue;
17541740
1741+ /*
1742+ * Skip inaccessible VMAs to avoid any confusion between
1743+ * PROT_NONE and NUMA hinting ptes
1744+ */
1745+ if (!(vma->vm_flags & (VM_READ | VM_EXEC | VM_WRITE)))
1746+ continue;
1747+
17551748 do {
17561749 start = max(start, vma->vm_start);
17571750 end = ALIGN(start + (pages << PAGE_SHIFT), HPAGE_SIZE);
@@ -3015,8 +3008,7 @@ static void expire_cfs_rq_runtime(struct cfs_rq *cfs_rq) · 1257 unmodified lines
30153008 }
30163009 }
30173010
3018−static void __account_cfs_rq_runtime(struct cfs_rq *cfs_rq,
3019− unsigned long delta_exec)
3011+static void __account_cfs_rq_runtime(struct cfs_rq *cfs_rq, u64 delta_exec)
30203012 {
30213013 /* dock delta_exec before expiring quota (as it could span periods) */
30223014 cfs_rq->runtime_remaining -= delta_exec;
@@ -3034,7 +3026,7 @@ static void __account_cfs_rq_runtime(struct cfs_rq *cfs_rq, · 11 unmodified lines
30343026 }
30353027
30363028 static __always_inline
3037−void account_cfs_rq_runtime(struct cfs_rq *cfs_rq, unsigned long delta_exec)
3029+void account_cfs_rq_runtime(struct cfs_rq *cfs_rq, u64 delta_exec)
30383030 {
30393031 if (!cfs_bandwidth_used() || !cfs_rq->runtime_enabled)
30403032 return;
@@ -3574,8 +3566,7 @@ static inline u64 cfs_rq_clock_task(struct cfs_rq *cfs_rq) · 533 unmodified lines
35743566 return rq_clock_task(rq_of(cfs_rq));
35753567 }
35763568
3577−static void account_cfs_rq_runtime(struct cfs_rq *cfs_rq,
3578− unsigned long delta_exec) {}
3569+static void account_cfs_rq_runtime(struct cfs_rq *cfs_rq, u64 delta_exec) {}
35793570 static void check_cfs_rq_runtime(struct cfs_rq *cfs_rq) {}
35803571 static void check_enqueue_throttle(struct cfs_rq *cfs_rq) {}
35813572 static __always_inline void return_cfs_rq_runtime(struct cfs_rq *cfs_rq) {}
kernel/sched/rt.c+14−0
@@ -901,6 +901,13 @@ inc_rt_prio_smp(struct rt_rq *rt_rq, int prio, int prev_prio) · 900 unmodified lines
901901 {
902902 struct rq *rq = rq_of_rt_rq(rt_rq);
903903
904+#ifdef CONFIG_RT_GROUP_SCHED
905+ /*
906+ * Change rq's cpupri only if rt_rq is the top queue.
907+ */
908+ if (&rq->rt != rt_rq)
909+ return;
910+#endif
904911 if (rq->online && prio < prev_prio)
905912 cpupri_set(&rq->rd->cpupri, rq->cpu, prio);
906913 }
@@ -910,6 +917,13 @@ dec_rt_prio_smp(struct rt_rq *rt_rq, int prio, int prev_prio) · 3 unmodified lines
910917 {
911918 struct rq *rq = rq_of_rt_rq(rt_rq);
912919
920+#ifdef CONFIG_RT_GROUP_SCHED
921+ /*
922+ * Change rq's cpupri only if rt_rq is the top queue.
923+ */
924+ if (&rq->rt != rt_rq)
925+ return;
926+#endif
913927 if (rq->online && rt_rq->highest_prio.curr != prev_prio)
914928 cpupri_set(&rq->rd->cpupri, rq->cpu, rt_rq->highest_prio.curr);
915929 }
kernel/trace/ftrace.c+1−1
@@ -775,7 +775,7 @@ static int ftrace_profile_init(void) · 774 unmodified lines
775775 int cpu;
776776 int ret = 0;
777777
778− for_each_online_cpu(cpu) {
778+ for_each_possible_cpu(cpu) {
779779 ret = ftrace_profile_init_cpu(cpu);
780780 if (ret)
781781 break;
kernel/user.c+3−3
@@ -51,9 +51,9 @@ struct user_namespace init_user_ns = { · 50 unmodified lines
5151 .owner = GLOBAL_ROOT_UID,
5252 .group = GLOBAL_ROOT_GID,
5353 .proc_inum = PROC_USER_INIT_INO,
54−#ifdef CONFIG_KEYS_KERBEROS_CACHE
55− .krb_cache_register_sem =
56− __RWSEM_INITIALIZER(init_user_ns.krb_cache_register_sem),
54+#ifdef CONFIG_PERSISTENT_KEYRINGS
55+ .persistent_keyring_register_sem =
56+ __RWSEM_INITIALIZER(init_user_ns.persistent_keyring_register_sem),
5757 #endif
5858 };
5959 EXPORT_SYMBOL_GPL(init_user_ns);
mm/Kconfig+1−1
@@ -543,7 +543,7 @@ config ZSWAP · 542 unmodified lines
543543
544544 config MEM_SOFT_DIRTY
545545 bool "Track memory changes"
546− depends on CHECKPOINT_RESTORE && HAVE_ARCH_SOFT_DIRTY
546+ depends on CHECKPOINT_RESTORE && HAVE_ARCH_SOFT_DIRTY && PROC_FS
547547 select PROC_PAGE_MONITOR
548548 help
549549 This option enables memory changes tracking by introducing a
mm/compaction.c+4−0
@@ -134,6 +134,10 @@ static void update_pageblock_skip(struct compact_control *cc, · 133 unmodified lines
134134 bool migrate_scanner)
135135 {
136136 struct zone *zone = cc->zone;
137+
138+ if (cc->ignore_skip_hint)
139+ return;
140+
137141 if (!page)
138142 return;
139143
mm/huge_memory.c+36−9
@@ -882,6 +882,10 @@ int copy_huge_pmd(struct mm_struct *dst_mm, struct mm_struct *src_mm, · 881 unmodified lines
882882 ret = 0;
883883 goto out_unlock;
884884 }
885+
886+ /* mmap_sem prevents this happening but warn if that changes */
887+ WARN_ON(pmd_trans_migrating(pmd));
888+
885889 if (unlikely(pmd_trans_splitting(pmd))) {
886890 /* split huge page running from under us */
887891 spin_unlock(src_ptl);
@@ -1243,6 +1247,10 @@ struct page *follow_trans_huge_pmd(struct vm_area_struct *vma, · 355 unmodified lines
12431247 if ((flags & FOLL_DUMP) && is_huge_zero_pmd(*pmd))
12441248 return ERR_PTR(-EFAULT);
12451249
1250+ /* Full NUMA hinting faults to serialise migration in fault paths */
1251+ if ((flags & FOLL_NUMA) && pmd_numa(*pmd))
1252+ goto out;
1253+
12461254 page = pmd_page(*pmd);
12471255 VM_BUG_ON(!PageHead(page));
12481256 if (flags & FOLL_TOUCH) {
@@ -1295,6 +1303,17 @@ int do_huge_pmd_numa_page(struct mm_struct *mm, struct vm_area_struct *vma, · 46 unmodified lines
12951303 if (unlikely(!pmd_same(pmd, *pmdp)))
12961304 goto out_unlock;
12971305
1306+ /*
1307+ * If there are potential migrations, wait for completion and retry
1308+ * without disrupting NUMA hinting information. Do not relock and
1309+ * check_same as the page may no longer be mapped.
1310+ */
1311+ if (unlikely(pmd_trans_migrating(*pmdp))) {
1312+ spin_unlock(ptl);
1313+ wait_migrate_huge_page(vma->anon_vma, pmdp);
1314+ goto out;
1315+ }
1316+
12981317 page = pmd_page(pmd);
12991318 BUG_ON(is_huge_zero_page(page));
13001319 page_nid = page_to_nid(page);
@@ -1323,23 +1342,22 @@ int do_huge_pmd_numa_page(struct mm_struct *mm, struct vm_area_struct *vma, · 22 unmodified lines
13231342 /* If the page was locked, there are no parallel migrations */
13241343 if (page_locked)
13251344 goto clear_pmdnuma;
1345+ }
13261346
1327− /*
1328− * Otherwise wait for potential migrations and retry. We do
1329− * relock and check_same as the page may no longer be mapped.
1330− * As the fault is being retried, do not account for it.
1331− */
1347+ /* Migration could have started since the pmd_trans_migrating check */
1348+ if (!page_locked) {
13321349 spin_unlock(ptl);
13331350 wait_on_page_locked(page);
13341351 page_nid = -1;
13351352 goto out;
13361353 }
13371354
1338− /* Page is misplaced, serialise migrations and parallel THP splits */
1355+ /*
1356+ * Page is misplaced. Page lock serialises migrations. Acquire anon_vma
1357+ * to serialises splits
1358+ */
13391359 get_page(page);
13401360 spin_unlock(ptl);
1341− if (!page_locked)
1342− lock_page(page);
13431361 anon_vma = page_lock_anon_vma_read(page);
13441362
13451363 /* Confirm the PMD did not change while page_table_lock was released */
@@ -1351,6 +1369,13 @@ int do_huge_pmd_numa_page(struct mm_struct *mm, struct vm_area_struct *vma, · 5 unmodified lines
13511369 goto out_unlock;
13521370 }
13531371
1372+ /* Bail if we fail to protect against THP splits for any reason */
1373+ if (unlikely(!anon_vma)) {
1374+ put_page(page);
1375+ page_nid = -1;
1376+ goto clear_pmdnuma;
1377+ }
1378+
13541379 /*
13551380 * Migrate the THP to the requested node, returns with page unlocked
13561381 * and pmd_numa cleared.
@@ -1517,6 +1542,8 @@ int change_huge_pmd(struct vm_area_struct *vma, pmd_t *pmd, · 160 unmodified lines
15171542 ret = 1;
15181543 if (!prot_numa) {
15191544 entry = pmdp_get_and_clear(mm, addr, pmd);
1545+ if (pmd_numa(entry))
1546+ entry = pmd_mknonnuma(entry);
15201547 entry = pmd_modify(entry, newprot);
15211548 ret = HPAGE_PMD_NR;
15221549 BUG_ON(pmd_write(entry));
@@ -1531,7 +1558,7 @@ int change_huge_pmd(struct vm_area_struct *vma, pmd_t *pmd, · 8 unmodified lines
15311558 */
15321559 if (!is_huge_zero_page(page) &&
15331560 !pmd_numa(*pmd)) {
1534− entry = pmdp_get_and_clear(mm, addr, pmd);
1561+ entry = *pmd;
15351562 entry = pmd_mknuma(entry);
15361563 ret = HPAGE_PMD_NR;
15371564 }
mm/memory-failure.c+10−4
@@ -1505,10 +1505,16 @@ static int soft_offline_huge_page(struct page *page, int flags) · 1504 unmodified lines
15051505 if (ret > 0)
15061506 ret = -EIO;
15071507 } else {
1508− set_page_hwpoison_huge_page(hpage);
1509− dequeue_hwpoisoned_huge_page(hpage);
1510− atomic_long_add(1 << compound_order(hpage),
1511− &num_poisoned_pages);
1508+ /* overcommit hugetlb page will be freed to buddy */
1509+ if (PageHuge(page)) {
1510+ set_page_hwpoison_huge_page(hpage);
1511+ dequeue_hwpoisoned_huge_page(hpage);
1512+ atomic_long_add(1 << compound_order(hpage),
1513+ &num_poisoned_pages);
1514+ } else {
1515+ SetPageHWPoison(page);
1516+ atomic_long_inc(&num_poisoned_pages);
1517+ }
15121518 }
15131519 return ret;
15141520 }
mm/memory.c+1−1
@@ -4271,7 +4271,7 @@ void copy_user_huge_page(struct page *dst, struct page *src, · 4270 unmodified lines
42714271 }
42724272 #endif /* CONFIG_TRANSPARENT_HUGEPAGE || CONFIG_HUGETLBFS */
42734273
4274−#if USE_SPLIT_PTE_PTLOCKS && BLOATED_SPINLOCKS
4274+#if USE_SPLIT_PTE_PTLOCKS && ALLOC_SPLIT_PTLOCKS
42754275 bool ptlock_alloc(struct page *page)
42764276 {
42774277 spinlock_t *ptl;
mm/mempolicy.c+9−7
@@ -1197,14 +1197,16 @@ static struct page *new_vma_page(struct page *page, unsigned long private, int * · 1196 unmodified lines
11971197 break;
11981198 vma = vma->vm_next;
11991199 }
1200+
1201+ if (PageHuge(page)) {
1202+ if (vma)
1203+ return alloc_huge_page_noerr(vma, address, 1);
1204+ else
1205+ return NULL;
1206+ }
12001207 /*
1201− * queue_pages_range() confirms that @page belongs to some vma,
1202− * so vma shouldn't be NULL.
1208+ * if !vma, alloc_page_vma() will use task or system default policy
12031209 */
1204− BUG_ON(!vma);
1205−
1206− if (PageHuge(page))
1207− return alloc_huge_page_noerr(vma, address, 1);
12081210 return alloc_page_vma(GFP_HIGHUSER_MOVABLE, vma, address);
12091211 }
12101212 #else
@@ -1318,7 +1320,7 @@ static long do_mbind(unsigned long start, unsigned long len, · 107 unmodified lines
13181320 if (nr_failed && (flags & MPOL_MF_STRICT))
13191321 err = -EIO;
13201322 } else
1321− putback_lru_pages(&pagelist);
1323+ putback_movable_pages(&pagelist);
13221324
13231325 up_write(&mm->mmap_sem);
13241326 mpol_out:
mm/migrate.c+65−17
@@ -36,6 +36,7 @@ · 35 unmodified lines
3636 #include <linux/hugetlb_cgroup.h>
3737 #include <linux/gfp.h>
3838 #include <linux/balloon_compaction.h>
39+#include <linux/mmu_notifier.h>
3940
4041 #include <asm/tlbflush.h>
4142
@@ -316,14 +317,15 @@ static inline bool buffer_migrate_lock_buffers(struct buffer_head *head, · 274 unmodified lines
316317 */
317318 int migrate_page_move_mapping(struct address_space *mapping,
318319 struct page *newpage, struct page *page,
319− struct buffer_head *head, enum migrate_mode mode)
320+ struct buffer_head *head, enum migrate_mode mode,
321+ int extra_count)
320322 {
321− int expected_count = 0;
323+ int expected_count = 1 + extra_count;
322324 void **pslot;
323325
324326 if (!mapping) {
325327 /* Anonymous page without mapping */
326− if (page_count(page) != 1)
328+ if (page_count(page) != expected_count)
327329 return -EAGAIN;
328330 return MIGRATEPAGE_SUCCESS;
329331 }
@@ -333,7 +335,7 @@ int migrate_page_move_mapping(struct address_space *mapping, · 3 unmodified lines
333335 pslot = radix_tree_lookup_slot(&mapping->page_tree,
334336 page_index(page));
335337
336− expected_count = 2 + page_has_private(page);
338+ expected_count += 1 + page_has_private(page);
337339 if (page_count(page) != expected_count ||
338340 radix_tree_deref_slot_protected(pslot, &mapping->tree_lock) != page) {
339341 spin_unlock_irq(&mapping->tree_lock);
@@ -583,7 +585,7 @@ int migrate_page(struct address_space *mapping, · 243 unmodified lines
583585
584586 BUG_ON(PageWriteback(page)); /* Writeback must be complete */
585587
586− rc = migrate_page_move_mapping(mapping, newpage, page, NULL, mode);
588+ rc = migrate_page_move_mapping(mapping, newpage, page, NULL, mode, 0);
587589
588590 if (rc != MIGRATEPAGE_SUCCESS)
589591 return rc;
@@ -610,7 +612,7 @@ int buffer_migrate_page(struct address_space *mapping, · 20 unmodified lines
610612
611613 head = page_buffers(page);
612614
613− rc = migrate_page_move_mapping(mapping, newpage, page, head, mode);
615+ rc = migrate_page_move_mapping(mapping, newpage, page, head, mode, 0);
614616
615617 if (rc != MIGRATEPAGE_SUCCESS)
616618 return rc;
@@ -1654,6 +1656,18 @@ int numamigrate_isolate_page(pg_data_t *pgdat, struct page *page) · 1037 unmodified lines
16541656 return 1;
16551657 }
16561658
1659+bool pmd_trans_migrating(pmd_t pmd)
1660+{
1661+ struct page *page = pmd_page(pmd);
1662+ return PageLocked(page);
1663+}
1664+
1665+void wait_migrate_huge_page(struct anon_vma *anon_vma, pmd_t *pmd)
1666+{
1667+ struct page *page = pmd_page(*pmd);
1668+ wait_on_page_locked(page);
1669+}
1670+
16571671 /*
16581672 * Attempt to migrate a misplaced page to the specified destination
16591673 * node. Caller is expected to have an elevated reference count on
@@ -1716,12 +1730,14 @@ int migrate_misplaced_transhuge_page(struct mm_struct *mm, · 56 unmodified lines
17161730 struct page *page, int node)
17171731 {
17181732 spinlock_t *ptl;
1719− unsigned long haddr = address & HPAGE_PMD_MASK;
17201733 pg_data_t *pgdat = NODE_DATA(node);
17211734 int isolated = 0;
17221735 struct page *new_page = NULL;
17231736 struct mem_cgroup *memcg = NULL;
17241737 int page_lru = page_is_file_cache(page);
1738+ unsigned long mmun_start = address & HPAGE_PMD_MASK;
1739+ unsigned long mmun_end = mmun_start + HPAGE_PMD_SIZE;
1740+ pmd_t orig_entry;
17251741
17261742 /*
17271743 * Rate-limit the amount of data that is being migrated to a node.
@@ -1744,6 +1760,9 @@ int migrate_misplaced_transhuge_page(struct mm_struct *mm, · 16 unmodified lines
17441760 goto out_fail;
17451761 }
17461762
1763+ if (mm_tlb_flush_pending(mm))
1764+ flush_tlb_range(vma, mmun_start, mmun_end);
1765+
17471766 /* Prepare a page as a migration target */
17481767 __set_page_locked(new_page);
17491768 SetPageSwapBacked(new_page);
@@ -1755,9 +1774,12 @@ int migrate_misplaced_transhuge_page(struct mm_struct *mm, · 5 unmodified lines
17551774 WARN_ON(PageLRU(new_page));
17561775
17571776 /* Recheck the target PMD */
1777+ mmu_notifier_invalidate_range_start(mm, mmun_start, mmun_end);
17581778 ptl = pmd_lock(mm, pmd);
1759− if (unlikely(!pmd_same(*pmd, entry))) {
1779+ if (unlikely(!pmd_same(*pmd, entry) || page_count(page) != 2)) {
1780+fail_putback:
17601781 spin_unlock(ptl);
1782+ mmu_notifier_invalidate_range_end(mm, mmun_start, mmun_end);
17611783
17621784 /* Reverse changes made by migrate_page_copy() */
17631785 if (TestClearPageActive(new_page))
@@ -1774,7 +1796,8 @@ int migrate_misplaced_transhuge_page(struct mm_struct *mm, · 10 unmodified lines
17741796 putback_lru_page(page);
17751797 mod_zone_page_state(page_zone(page),
17761798 NR_ISOLATED_ANON + page_lru, -HPAGE_PMD_NR);
1777− goto out_fail;
1799+
1800+ goto out_unlock;
17781801 }
17791802
17801803 /*
@@ -1786,16 +1809,35 @@ int migrate_misplaced_transhuge_page(struct mm_struct *mm, · 5 unmodified lines
17861809 */
17871810 mem_cgroup_prepare_migration(page, new_page, &memcg);
17881811
1812+ orig_entry = *pmd;
17891813 entry = mk_pmd(new_page, vma->vm_page_prot);
1790− entry = pmd_mknonnuma(entry);
1791− entry = maybe_pmd_mkwrite(pmd_mkdirty(entry), vma);
17921814 entry = pmd_mkhuge(entry);
1815+ entry = maybe_pmd_mkwrite(pmd_mkdirty(entry), vma);
17931816
1794− pmdp_clear_flush(vma, haddr, pmd);
1795− set_pmd_at(mm, haddr, pmd, entry);
1796− page_add_new_anon_rmap(new_page, vma, haddr);
1817+ /*
1818+ * Clear the old entry under pagetable lock and establish the new PTE.
1819+ * Any parallel GUP will either observe the old page blocking on the
1820+ * page lock, block on the page table lock or observe the new page.
1821+ * The SetPageUptodate on the new page and page_add_new_anon_rmap
1822+ * guarantee the copy is visible before the pagetable update.
1823+ */
1824+ flush_cache_range(vma, mmun_start, mmun_end);
1825+ page_add_new_anon_rmap(new_page, vma, mmun_start);
1826+ pmdp_clear_flush(vma, mmun_start, pmd);
1827+ set_pmd_at(mm, mmun_start, pmd, entry);
1828+ flush_tlb_range(vma, mmun_start, mmun_end);
17971829 update_mmu_cache_pmd(vma, address, &entry);
1830+
1831+ if (page_count(page) != 2) {
1832+ set_pmd_at(mm, mmun_start, pmd, orig_entry);
1833+ flush_tlb_range(vma, mmun_start, mmun_end);
1834+ update_mmu_cache_pmd(vma, address, &entry);
1835+ page_remove_rmap(new_page);
1836+ goto fail_putback;
1837+ }
1838+
17981839 page_remove_rmap(page);
1840+
17991841 /*
18001842 * Finish the charge transaction under the page table lock to
18011843 * prevent split_huge_page() from dividing up the charge
@@ -1803,6 +1845,7 @@ int migrate_misplaced_transhuge_page(struct mm_struct *mm, · 1 unmodified line
18031845 */
18041846 mem_cgroup_end_migration(memcg, page, new_page, true);
18051847 spin_unlock(ptl);
1848+ mmu_notifier_invalidate_range_end(mm, mmun_start, mmun_end);
18061849
18071850 unlock_page(new_page);
18081851 unlock_page(page);
@@ -1820,10 +1863,15 @@ int migrate_misplaced_transhuge_page(struct mm_struct *mm, · 11 unmodified lines
18201863 out_fail:
18211864 count_vm_events(PGMIGRATE_FAIL, HPAGE_PMD_NR);
18221865 out_dropref:
1823− entry = pmd_mknonnuma(entry);
1824− set_pmd_at(mm, haddr, pmd, entry);
1825− update_mmu_cache_pmd(vma, address, &entry);
1866+ ptl = pmd_lock(mm, pmd);
1867+ if (pmd_same(*pmd, entry)) {
1868+ entry = pmd_mknonnuma(entry);
1869+ set_pmd_at(mm, mmun_start, pmd, entry);
1870+ update_mmu_cache_pmd(vma, address, &entry);
1871+ }
1872+ spin_unlock(ptl);
18261873
1874+out_unlock:
18271875 unlock_page(page);
18281876 put_page(page);
18291877 return 0;
mm/mprotect.c+11−2
@@ -52,17 +52,21 @@ static unsigned long change_pte_range(struct vm_area_struct *vma, pmd_t *pmd, · 51 unmodified lines
5252 pte_t ptent;
5353 bool updated = false;
5454
55− ptent = ptep_modify_prot_start(mm, addr, pte);
5655 if (!prot_numa) {
56+ ptent = ptep_modify_prot_start(mm, addr, pte);
57+ if (pte_numa(ptent))
58+ ptent = pte_mknonnuma(ptent);
5759 ptent = pte_modify(ptent, newprot);
5860 updated = true;
5961 } else {
6062 struct page *page;
6163
64+ ptent = *pte;
6265 page = vm_normal_page(vma, addr, oldpte);
6366 if (page) {
6467 if (!pte_numa(oldpte)) {
6568 ptent = pte_mknuma(ptent);
69+ set_pte_at(mm, addr, pte, ptent);
6670 updated = true;
6771 }
6872 }
@@ -79,7 +83,10 @@ static unsigned long change_pte_range(struct vm_area_struct *vma, pmd_t *pmd, · 10 unmodified lines
7983
8084 if (updated)
8185 pages++;
82− ptep_modify_prot_commit(mm, addr, pte, ptent);
86+
87+ /* Only !prot_numa always clears the pte */
88+ if (!prot_numa)
89+ ptep_modify_prot_commit(mm, addr, pte, ptent);
8390 } else if (IS_ENABLED(CONFIG_MIGRATION) && !pte_file(oldpte)) {
8491 swp_entry_t entry = pte_to_swp_entry(oldpte);
8592
@@ -181,6 +188,7 @@ static unsigned long change_protection_range(struct vm_area_struct *vma, · 95 unmodified lines
181188 BUG_ON(addr >= end);
182189 pgd = pgd_offset(mm, addr);
183190 flush_cache_range(vma, addr, end);
191+ set_tlb_flush_pending(mm);
184192 do {
185193 next = pgd_addr_end(addr, end);
186194 if (pgd_none_or_clear_bad(pgd))
@@ -192,6 +200,7 @@ static unsigned long change_protection_range(struct vm_area_struct *vma, · 5 unmodified lines
192200 /* Only flush the TLB if we actually modified any entries: */
193201 if (pages)
194202 flush_tlb_range(vma, start, end);
203+ clear_tlb_flush_pending(mm);
195204
196205 return pages;
197206 }
mm/page_alloc.c+9−10
@@ -1816,7 +1816,7 @@ static void zlc_clear_zones_full(struct zonelist *zonelist) · 1815 unmodified lines
18161816
18171817 static bool zone_local(struct zone *local_zone, struct zone *zone)
18181818 {
1819− return node_distance(local_zone->node, zone->node) == LOCAL_DISTANCE;
1819+ return local_zone->node == zone->node;
18201820 }
18211821
18221822 static bool zone_allows_reclaim(struct zone *local_zone, struct zone *zone)
@@ -1913,18 +1913,17 @@ zonelist_scan: · 90 unmodified lines
19131913 * page was allocated in should have no effect on the
19141914 * time the page has in memory before being reclaimed.
19151915 *
1916− * When zone_reclaim_mode is enabled, try to stay in
1917− * local zones in the fastpath. If that fails, the
1918− * slowpath is entered, which will do another pass
1919− * starting with the local zones, but ultimately fall
1920− * back to remote zones that do not partake in the
1921− * fairness round-robin cycle of this zonelist.
1916+ * Try to stay in local zones in the fastpath. If
1917+ * that fails, the slowpath is entered, which will do
1918+ * another pass starting with the local zones, but
1919+ * ultimately fall back to remote zones that do not
1920+ * partake in the fairness round-robin cycle of this
1921+ * zonelist.
19221922 */
19231923 if (alloc_flags & ALLOC_WMARK_LOW) {
19241924 if (zone_page_state(zone, NR_ALLOC_BATCH) <= 0)
19251925 continue;
1926− if (zone_reclaim_mode &&
1927− !zone_local(preferred_zone, zone))
1926+ if (!zone_local(preferred_zone, zone))
19281927 continue;
19291928 }
19301929 /*
@@ -2390,7 +2389,7 @@ static void prepare_slowpath(gfp_t gfp_mask, unsigned int order, · 459 unmodified lines
23902389 * thrash fairness information for zones that are not
23912390 * actually part of this zonelist's round-robin cycle.
23922391 */
2393− if (zone_reclaim_mode && !zone_local(preferred_zone, zone))
2392+ if (!zone_local(preferred_zone, zone))
23942393 continue;
23952394 mod_zone_page_state(zone, NR_ALLOC_BATCH,
23962395 high_wmark_pages(zone) -
mm/pgtable-generic.c+6−2
@@ -110,9 +110,10 @@ int pmdp_clear_flush_young(struct vm_area_struct *vma, · 109 unmodified lines
110110 pte_t ptep_clear_flush(struct vm_area_struct *vma, unsigned long address,
111111 pte_t *ptep)
112112 {
113+ struct mm_struct *mm = (vma)->vm_mm;
113114 pte_t pte;
114− pte = ptep_get_and_clear((vma)->vm_mm, address, ptep);
115− if (pte_accessible(pte))
115+ pte = ptep_get_and_clear(mm, address, ptep);
116+ if (pte_accessible(mm, pte))
116117 flush_tlb_page(vma, address);
117118 return pte;
118119 }
@@ -191,6 +192,9 @@ pgtable_t pgtable_trans_huge_withdraw(struct mm_struct *mm, pmd_t *pmdp) · 72 unmodified lines
191192 void pmdp_invalidate(struct vm_area_struct *vma, unsigned long address,
192193 pmd_t *pmdp)
193194 {
195+ pmd_t entry = *pmdp;
196+ if (pmd_numa(entry))
197+ entry = pmd_mknonnuma(entry);
194198 set_pmd_at(vma->vm_mm, address, pmdp, pmd_mknotpresent(*pmdp));
195199 flush_tlb_range(vma, address, address + HPAGE_PMD_SIZE);
196200 }
mm/rmap.c+4−0
@@ -600,7 +600,11 @@ pte_t *__page_check_address(struct page *page, struct mm_struct *mm, · 599 unmodified lines
600600 spinlock_t *ptl;
601601
602602 if (unlikely(PageHuge(page))) {
603+ /* when pud is not present, pte will be NULL */
603604 pte = huge_pte_offset(mm, address);
605+ if (!pte)
606+ return NULL;
607+
604608 ptl = huge_pte_lockptr(page_hstate(page), mm, pte);
605609 goto check;
606610 }
net/core/neighbour.c+1−0
@@ -1161,6 +1161,7 @@ int neigh_update(struct neighbour *neigh, const u8 *lladdr, u8 new, · 1160 unmodified lines
11611161 neigh->parms->reachable_time :
11621162 0)));
11631163 neigh->nud_state = new;
1164+ notify = 1;
11641165 }
11651166
11661167 if (lladdr != neigh->ha) {
net/ipv4/netfilter/ipt_SYNPROXY.c+1−0
@@ -423,6 +423,7 @@ static void synproxy_tg4_destroy(const struct xt_tgdtor_param *par) · 422 unmodified lines
423423 static struct xt_target synproxy_tg4_reg __read_mostly = {
424424 .name = "SYNPROXY",
425425 .family = NFPROTO_IPV4,
426+ .hooks = (1 << NF_INET_LOCAL_IN) | (1 << NF_INET_FORWARD),
426427 .target = synproxy_tg4,
427428 .targetsize = sizeof(struct xt_synproxy_info),
428429 .checkentry = synproxy_tg4_check,
net/ipv4/netfilter/nft_reject_ipv4.c+1−1
@@ -72,7 +72,7 @@ static int nft_reject_dump(struct sk_buff *skb, const struct nft_expr *expr) · 71 unmodified lines
7272 {
7373 const struct nft_reject *priv = nft_expr_priv(expr);
7474
75− if (nla_put_be32(skb, NFTA_REJECT_TYPE, priv->type))
75+ if (nla_put_be32(skb, NFTA_REJECT_TYPE, htonl(priv->type)))
7676 goto nla_put_failure;
7777
7878 switch (priv->type) {
net/ipv4/udp.c+4−9
@@ -1600,20 +1600,15 @@ static void flush_stack(struct sock **stack, unsigned int count, · 1599 unmodified lines
16001600 }
16011601
16021602 /* For TCP sockets, sk_rx_dst is protected by socket lock
1603− * For UDP, we use sk_dst_lock to guard against concurrent changes.
1603+ * For UDP, we use xchg() to guard against concurrent changes.
16041604 */
16051605 static void udp_sk_rx_dst_set(struct sock *sk, struct dst_entry *dst)
16061606 {
16071607 struct dst_entry *old;
16081608
1609− spin_lock(&sk->sk_dst_lock);
1610− old = sk->sk_rx_dst;
1611− if (likely(old != dst)) {
1612− dst_hold(dst);
1613− sk->sk_rx_dst = dst;
1614− dst_release(old);
1615− }
1616− spin_unlock(&sk->sk_dst_lock);
1609+ dst_hold(dst);
1610+ old = xchg(&sk->sk_rx_dst, dst);
1611+ dst_release(old);
16171612 }
16181613
16191614 /*
net/ipv6/netfilter/ip6t_SYNPROXY.c+1−0
@@ -446,6 +446,7 @@ static void synproxy_tg6_destroy(const struct xt_tgdtor_param *par) · 445 unmodified lines
446446 static struct xt_target synproxy_tg6_reg __read_mostly = {
447447 .name = "SYNPROXY",
448448 .family = NFPROTO_IPV6,
449+ .hooks = (1 << NF_INET_LOCAL_IN) | (1 << NF_INET_FORWARD),
449450 .target = synproxy_tg6,
450451 .targetsize = sizeof(struct xt_synproxy_info),
451452 .checkentry = synproxy_tg6_check,
net/sctp/probe.c+16−1
@@ -38,6 +38,7 @@ · 37 unmodified lines
3838 #include <net/sctp/sctp.h>
3939 #include <net/sctp/sm.h>
4040
41+MODULE_SOFTDEP("pre: sctp");
4142 MODULE_AUTHOR("Wei Yongjun <yjwei@cn.fujitsu.com>");
4243 MODULE_DESCRIPTION("SCTP snooper");
4344 MODULE_LICENSE("GPL");
@@ -182,6 +183,20 @@ static struct jprobe sctp_recv_probe = { · 138 unmodified lines
182183 .entry = jsctp_sf_eat_sack,
183184 };
184185
186+static __init int sctp_setup_jprobe(void)
187+{
188+ int ret = register_jprobe(&sctp_recv_probe);
189+
190+ if (ret) {
191+ if (request_module("sctp"))
192+ goto out;
193+ ret = register_jprobe(&sctp_recv_probe);
194+ }
195+
196+out:
197+ return ret;
198+}
199+
185200 static __init int sctpprobe_init(void)
186201 {
187202 int ret = -ENOMEM;
@@ -202,7 +217,7 @@ static __init int sctpprobe_init(void) · 14 unmodified lines
202217 &sctpprobe_fops))
203218 goto free_kfifo;
204219
205− ret = register_jprobe(&sctp_recv_probe);
220+ ret = sctp_setup_jprobe();
206221 if (ret)
207222 goto remove_proc;
208223
net/unix/af_unix.c+6−2
@@ -718,7 +718,9 @@ static int unix_autobind(struct socket *sock) · 717 unmodified lines
718718 int err;
719719 unsigned int retries = 0;
720720
721− mutex_lock(&u->readlock);
721+ err = mutex_lock_interruptible(&u->readlock);
722+ if (err)
723+ return err;
722724
723725 err = 0;
724726 if (u->addr)
@@ -877,7 +879,9 @@ static int unix_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) · 152 unmodified lines
877879 goto out;
878880 addr_len = err;
879881
880− mutex_lock(&u->readlock);
882+ err = mutex_lock_interruptible(&u->readlock);
883+ if (err)
884+ goto out;
881885
882886 err = -EINVAL;
883887 if (u->addr)
sound/core/pcm_lib.c+2−0
@@ -1937,6 +1937,8 @@ static int wait_for_avail(struct snd_pcm_substream *substream, · 1936 unmodified lines
19371937 case SNDRV_PCM_STATE_DISCONNECTED:
19381938 err = -EBADFD;
19391939 goto _endloop;
1940+ case SNDRV_PCM_STATE_PAUSED:
1941+ continue;
19401942 }
19411943 if (!tout) {
19421944 snd_printd("%s write error (DMA or IRQ trouble?)\n",
sound/pci/hda/hda_intel.c+4−0
@@ -3433,6 +3433,10 @@ static void check_probe_mask(struct azx *chip, int dev) · 3432 unmodified lines
34333433 * white/black-list for enable_msi
34343434 */
34353435 static struct snd_pci_quirk msi_black_list[] = {
3436+ SND_PCI_QUIRK(0x103c, 0x2191, "HP", 0), /* AMD Hudson */
3437+ SND_PCI_QUIRK(0x103c, 0x2192, "HP", 0), /* AMD Hudson */
3438+ SND_PCI_QUIRK(0x103c, 0x21f7, "HP", 0), /* AMD Hudson */
3439+ SND_PCI_QUIRK(0x103c, 0x21fa, "HP", 0), /* AMD Hudson */
34363440 SND_PCI_QUIRK(0x1043, 0x81f2, "ASUS", 0), /* Athlon64 X2 + nvidia */
34373441 SND_PCI_QUIRK(0x1043, 0x81f6, "ASUS", 0), /* nvidia */
34383442 SND_PCI_QUIRK(0x1043, 0x822d, "ASUS", 0), /* Athlon64 X2 + nvidia MCP55 */
sound/pci/hda/patch_realtek.c+4−0
@@ -4247,12 +4247,16 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { · 4246 unmodified lines
42474247 SND_PCI_QUIRK(0x1028, 0x0606, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
42484248 SND_PCI_QUIRK(0x1028, 0x0608, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
42494249 SND_PCI_QUIRK(0x1028, 0x0609, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
4250+ SND_PCI_QUIRK(0x1028, 0x0610, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
42504251 SND_PCI_QUIRK(0x1028, 0x0613, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
42514252 SND_PCI_QUIRK(0x1028, 0x0614, "Dell Inspiron 3135", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
42524253 SND_PCI_QUIRK(0x1028, 0x0616, "Dell Vostro 5470", ALC290_FIXUP_MONO_SPEAKERS),
42534254 SND_PCI_QUIRK(0x1028, 0x061f, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
4255+ SND_PCI_QUIRK(0x1028, 0x0629, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
42544256 SND_PCI_QUIRK(0x1028, 0x0638, "Dell Inspiron 5439", ALC290_FIXUP_MONO_SPEAKERS),
4257+ SND_PCI_QUIRK(0x1028, 0x063e, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
42554258 SND_PCI_QUIRK(0x1028, 0x063f, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
4259+ SND_PCI_QUIRK(0x1028, 0x0640, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
42564260 SND_PCI_QUIRK(0x1028, 0x15cc, "Dell X5 Precision", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE),
42574261 SND_PCI_QUIRK(0x1028, 0x15cd, "Dell X5 Precision", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE),
42584262 SND_PCI_QUIRK(0x103c, 0x1586, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC2),
sound/soc/atmel/atmel_ssc_dai.c+29−1
@@ -648,7 +648,7 @@ static int atmel_ssc_prepare(struct snd_pcm_substream *substream, · 647 unmodified lines
648648
649649 dma_params = ssc_p->dma_params[dir];
650650
651− ssc_writel(ssc_p->ssc->regs, CR, dma_params->mask->ssc_enable);
651+ ssc_writel(ssc_p->ssc->regs, CR, dma_params->mask->ssc_disable);
652652 ssc_writel(ssc_p->ssc->regs, IDR, dma_params->mask->ssc_error);
653653
654654 pr_debug("%s enabled SSC_SR=0x%08x\n",
@@ -657,6 +657,33 @@ static int atmel_ssc_prepare(struct snd_pcm_substream *substream, · 2 unmodified lines
657657 return 0;
658658 }
659659
660+static int atmel_ssc_trigger(struct snd_pcm_substream *substream,
661+ int cmd, struct snd_soc_dai *dai)
662+{
663+ struct atmel_ssc_info *ssc_p = &ssc_info[dai->id];
664+ struct atmel_pcm_dma_params *dma_params;
665+ int dir;
666+
667+ if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
668+ dir = 0;
669+ else
670+ dir = 1;
671+
672+ dma_params = ssc_p->dma_params[dir];
673+
674+ switch (cmd) {
675+ case SNDRV_PCM_TRIGGER_START:
676+ case SNDRV_PCM_TRIGGER_RESUME:
677+ case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
678+ ssc_writel(ssc_p->ssc->regs, CR, dma_params->mask->ssc_enable);
679+ break;
680+ default:
681+ ssc_writel(ssc_p->ssc->regs, CR, dma_params->mask->ssc_disable);
682+ break;
683+ }
684+
685+ return 0;
686+}
660687
661688 #ifdef CONFIG_PM
662689 static int atmel_ssc_suspend(struct snd_soc_dai *cpu_dai)
@@ -731,6 +758,7 @@ static const struct snd_soc_dai_ops atmel_ssc_dai_ops = { · 68 unmodified lines
731758 .startup = atmel_ssc_startup,
732759 .shutdown = atmel_ssc_shutdown,
733760 .prepare = atmel_ssc_prepare,
761+ .trigger = atmel_ssc_trigger,
734762 .hw_params = atmel_ssc_hw_params,
735763 .set_fmt = atmel_ssc_set_dai_fmt,
736764 .set_clkdiv = atmel_ssc_set_dai_clkdiv,
sound/soc/atmel/sam9x5_wm8731.c+1−1
@@ -109,7 +109,7 @@ static int sam9x5_wm8731_driver_probe(struct platform_device *pdev) · 108 unmodified lines
109109 dai->stream_name = "WM8731 PCM";
110110 dai->codec_dai_name = "wm8731-hifi";
111111 dai->init = sam9x5_wm8731_init;
112− dai->dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF
112+ dai->dai_fmt = SND_SOC_DAIFMT_DSP_A | SND_SOC_DAIFMT_NB_NF
113113 | SND_SOC_DAIFMT_CBM_CFM;
114114
115115 ret = snd_soc_of_parse_card_name(card, "atmel,model");
sound/soc/codecs/wm5110.c+1−1
@@ -1012,7 +1012,7 @@ static const struct snd_soc_dapm_route wm5110_dapm_routes[] = { · 1011 unmodified lines
10121012 { "AEC Loopback", "HPOUT3L", "OUT3L" },
10131013 { "AEC Loopback", "HPOUT3R", "OUT3R" },
10141014 { "HPOUT3L", NULL, "OUT3L" },
1015− { "HPOUT3R", NULL, "OUT3L" },
1015+ { "HPOUT3R", NULL, "OUT3R" },
10161016
10171017 { "AEC Loopback", "SPKOUTL", "OUT4L" },
10181018 { "SPKOUTLN", NULL, "OUT4L" },
sound/soc/codecs/wm8904.c+1−1
@@ -1444,7 +1444,7 @@ static int wm8904_set_fmt(struct snd_soc_dai *dai, unsigned int fmt) · 1443 unmodified lines
14441444
14451445 switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) {
14461446 case SND_SOC_DAIFMT_DSP_B:
1447− aif1 |= WM8904_AIF_LRCLK_INV;
1447+ aif1 |= 0x3 | WM8904_AIF_LRCLK_INV;
14481448 case SND_SOC_DAIFMT_DSP_A:
14491449 aif1 |= 0x3;
14501450 break;
sound/soc/codecs/wm8962.c+13−0
@@ -2439,7 +2439,20 @@ static void wm8962_configure_bclk(struct snd_soc_codec *codec) · 2438 unmodified lines
24392439 snd_soc_update_bits(codec, WM8962_CLOCKING_4,
24402440 WM8962_SYSCLK_RATE_MASK, clocking4);
24412441
2442+ /* DSPCLK_DIV can be only generated correctly after enabling SYSCLK.
2443+ * So we here provisionally enable it and then disable it afterward
2444+ * if current bias_level hasn't reached SND_SOC_BIAS_ON.
2445+ */
2446+ if (codec->dapm.bias_level != SND_SOC_BIAS_ON)
2447+ snd_soc_update_bits(codec, WM8962_CLOCKING2,
2448+ WM8962_SYSCLK_ENA_MASK, WM8962_SYSCLK_ENA);
2449+
24422450 dspclk = snd_soc_read(codec, WM8962_CLOCKING1);
2451+
2452+ if (codec->dapm.bias_level != SND_SOC_BIAS_ON)
2453+ snd_soc_update_bits(codec, WM8962_CLOCKING2,
2454+ WM8962_SYSCLK_ENA_MASK, 0);
2455+
24432456 if (dspclk < 0) {
24442457 dev_err(codec->dev, "Failed to read DSPCLK: %d\n", dspclk);
24452458 return;
sound/soc/codecs/wm_adsp.c+7−3
@@ -1474,13 +1474,17 @@ static int wm_adsp2_ena(struct wm_adsp *dsp) · 1473 unmodified lines
14741474 return ret;
14751475
14761476 /* Wait for the RAM to start, should be near instantaneous */
1477− count = 0;
1478− do {
1477+ for (count = 0; count < 10; ++count) {
14791478 ret = regmap_read(dsp->regmap, dsp->base + ADSP2_STATUS1,
14801479 &val);
14811480 if (ret != 0)
14821481 return ret;
1483− } while (!(val & ADSP2_RAM_RDY) && ++count < 10);
1482+
1483+ if (val & ADSP2_RAM_RDY)
1484+ break;
1485+
1486+ msleep(1);
1487+ }
14841488
14851489 if (!(val & ADSP2_RAM_RDY)) {
14861490 adsp_err(dsp, "Failed to start DSP RAM\n");
sound/soc/fsl/imx-wm8962.c+0−2
@@ -130,8 +130,6 @@ static int imx_wm8962_set_bias_level(struct snd_soc_card *card, · 129 unmodified lines
130130 break;
131131 }
132132
133− dapm->bias_level = level;
134−
135133 return 0;
136134 }
137135
sound/soc/kirkwood/kirkwood-i2s.c+12−12
@@ -473,17 +473,17 @@ static struct snd_soc_dai_driver kirkwood_i2s_dai_extclk[2] = { · 472 unmodified lines
473473 .playback = {
474474 .channels_min = 1,
475475 .channels_max = 2,
476− .rates = SNDRV_PCM_RATE_8000_192000 |
477− SNDRV_PCM_RATE_CONTINUOUS |
478− SNDRV_PCM_RATE_KNOT,
476+ .rates = SNDRV_PCM_RATE_CONTINUOUS,
477+ .rate_min = 5512,
478+ .rate_max = 192000,
479479 .formats = KIRKWOOD_I2S_FORMATS,
480480 },
481481 .capture = {
482482 .channels_min = 1,
483483 .channels_max = 2,
484− .rates = SNDRV_PCM_RATE_8000_192000 |
485− SNDRV_PCM_RATE_CONTINUOUS |
486− SNDRV_PCM_RATE_KNOT,
484+ .rates = SNDRV_PCM_RATE_CONTINUOUS,
485+ .rate_min = 5512,
486+ .rate_max = 192000,
487487 .formats = KIRKWOOD_I2S_FORMATS,
488488 },
489489 .ops = &kirkwood_i2s_dai_ops,
@@ -494,17 +494,17 @@ static struct snd_soc_dai_driver kirkwood_i2s_dai_extclk[2] = { · 4 unmodified lines
494494 .playback = {
495495 .channels_min = 1,
496496 .channels_max = 2,
497− .rates = SNDRV_PCM_RATE_8000_192000 |
498− SNDRV_PCM_RATE_CONTINUOUS |
499− SNDRV_PCM_RATE_KNOT,
497+ .rates = SNDRV_PCM_RATE_CONTINUOUS,
498+ .rate_min = 5512,
499+ .rate_max = 192000,
500500 .formats = KIRKWOOD_SPDIF_FORMATS,
501501 },
502502 .capture = {
503503 .channels_min = 1,
504504 .channels_max = 2,
505− .rates = SNDRV_PCM_RATE_8000_192000 |
506− SNDRV_PCM_RATE_CONTINUOUS |
507− SNDRV_PCM_RATE_KNOT,
505+ .rates = SNDRV_PCM_RATE_CONTINUOUS,
506+ .rate_min = 5512,
507+ .rate_max = 192000,
508508 .formats = KIRKWOOD_SPDIF_FORMATS,
509509 },
510510 .ops = &kirkwood_i2s_dai_ops,
sound/soc/soc-generic-dmaengine-pcm.c+27−11
@@ -305,6 +305,20 @@ static void dmaengine_pcm_request_chan_of(struct dmaengine_pcm *pcm, · 304 unmodified lines
305305 }
306306 }
307307
308+static void dmaengine_pcm_release_chan(struct dmaengine_pcm *pcm)
309+{
310+ unsigned int i;
311+
312+ for (i = SNDRV_PCM_STREAM_PLAYBACK; i <= SNDRV_PCM_STREAM_CAPTURE;
313+ i++) {
314+ if (!pcm->chan[i])
315+ continue;
316+ dma_release_channel(pcm->chan[i]);
317+ if (pcm->flags & SND_DMAENGINE_PCM_FLAG_HALF_DUPLEX)
318+ break;
319+ }
320+}
321+
308322 /**
309323 * snd_dmaengine_pcm_register - Register a dmaengine based PCM device
310324 * @dev: The parent device for the PCM device
@@ -315,6 +329,7 @@ int snd_dmaengine_pcm_register(struct device *dev, · 4 unmodified lines
315329 const struct snd_dmaengine_pcm_config *config, unsigned int flags)
316330 {
317331 struct dmaengine_pcm *pcm;
332+ int ret;
318333
319334 pcm = kzalloc(sizeof(*pcm), GFP_KERNEL);
320335 if (!pcm)
@@ -326,11 +341,20 @@ int snd_dmaengine_pcm_register(struct device *dev, · 5 unmodified lines
326341 dmaengine_pcm_request_chan_of(pcm, dev);
327342
328343 if (flags & SND_DMAENGINE_PCM_FLAG_NO_RESIDUE)
329− return snd_soc_add_platform(dev, &pcm->platform,
344+ ret = snd_soc_add_platform(dev, &pcm->platform,
330345 &dmaengine_no_residue_pcm_platform);
331346 else
332− return snd_soc_add_platform(dev, &pcm->platform,
347+ ret = snd_soc_add_platform(dev, &pcm->platform,
333348 &dmaengine_pcm_platform);
349+ if (ret)
350+ goto err_free_dma;
351+
352+ return 0;
353+
354+err_free_dma:
355+ dmaengine_pcm_release_chan(pcm);
356+ kfree(pcm);
357+ return ret;
334358 }
335359 EXPORT_SYMBOL_GPL(snd_dmaengine_pcm_register);
336360
@@ -345,7 +369,6 @@ void snd_dmaengine_pcm_unregister(struct device *dev) · 8 unmodified lines
345369 {
346370 struct snd_soc_platform *platform;
347371 struct dmaengine_pcm *pcm;
348− unsigned int i;
349372
350373 platform = snd_soc_lookup_platform(dev);
351374 if (!platform)
@@ -353,15 +376,8 @@ void snd_dmaengine_pcm_unregister(struct device *dev) · 1 unmodified line
353376
354377 pcm = soc_platform_to_pcm(platform);
355378
356− for (i = SNDRV_PCM_STREAM_PLAYBACK; i <= SNDRV_PCM_STREAM_CAPTURE; i++) {
357− if (pcm->chan[i]) {
358− dma_release_channel(pcm->chan[i]);
359− if (pcm->flags & SND_DMAENGINE_PCM_FLAG_HALF_DUPLEX)
360− break;
361− }
362− }
363−
364379 snd_soc_remove_platform(platform);
380+ dmaengine_pcm_release_chan(pcm);
365381 kfree(pcm);
366382 }
367383 EXPORT_SYMBOL_GPL(snd_dmaengine_pcm_unregister);
sound/soc/soc-pcm.c+3−2
@@ -600,12 +600,13 @@ static int soc_pcm_hw_free(struct snd_pcm_substream *substream) · 599 unmodified lines
600600 struct snd_soc_platform *platform = rtd->platform;
601601 struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
602602 struct snd_soc_dai *codec_dai = rtd->codec_dai;
603− struct snd_soc_codec *codec = rtd->codec;
603+ bool playback = substream->stream == SNDRV_PCM_STREAM_PLAYBACK;
604604
605605 mutex_lock_nested(&rtd->pcm_mutex, rtd->pcm_subclass);
606606
607607 /* apply codec digital mute */
608− if (!codec->active)
608+ if ((playback && codec_dai->playback_active == 1) ||
609+ (!playback && codec_dai->capture_active == 1))
609610 snd_soc_dai_digital_mute(codec_dai, 1, substream->stream);
610611
611612 /* free any machine hw params */
sound/soc/tegra/tegra20_i2s.c+3−3
@@ -74,7 +74,7 @@ static int tegra20_i2s_set_fmt(struct snd_soc_dai *dai, · 73 unmodified lines
7474 unsigned int fmt)
7575 {
7676 struct tegra20_i2s *i2s = snd_soc_dai_get_drvdata(dai);
77− unsigned int mask, val;
77+ unsigned int mask = 0, val = 0;
7878
7979 switch (fmt & SND_SOC_DAIFMT_INV_MASK) {
8080 case SND_SOC_DAIFMT_NB_NF:
@@ -83,10 +83,10 @@ static int tegra20_i2s_set_fmt(struct snd_soc_dai *dai, · 2 unmodified lines
8383 return -EINVAL;
8484 }
8585
86− mask = TEGRA20_I2S_CTRL_MASTER_ENABLE;
86+ mask |= TEGRA20_I2S_CTRL_MASTER_ENABLE;
8787 switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) {
8888 case SND_SOC_DAIFMT_CBS_CFS:
89− val = TEGRA20_I2S_CTRL_MASTER_ENABLE;
89+ val |= TEGRA20_I2S_CTRL_MASTER_ENABLE;
9090 break;
9191 case SND_SOC_DAIFMT_CBM_CFM:
9292 break;
sound/soc/tegra/tegra20_spdif.c+5−5
@@ -67,15 +67,15 @@ static int tegra20_spdif_hw_params(struct snd_pcm_substream *substream, · 66 unmodified lines
6767 {
6868 struct device *dev = dai->dev;
6969 struct tegra20_spdif *spdif = snd_soc_dai_get_drvdata(dai);
70− unsigned int mask, val;
70+ unsigned int mask = 0, val = 0;
7171 int ret, spdifclock;
7272
73− mask = TEGRA20_SPDIF_CTRL_PACK |
74− TEGRA20_SPDIF_CTRL_BIT_MODE_MASK;
73+ mask |= TEGRA20_SPDIF_CTRL_PACK |
74+ TEGRA20_SPDIF_CTRL_BIT_MODE_MASK;
7575 switch (params_format(params)) {
7676 case SNDRV_PCM_FORMAT_S16_LE:
77− val = TEGRA20_SPDIF_CTRL_PACK |
78− TEGRA20_SPDIF_CTRL_BIT_MODE_16BIT;
77+ val |= TEGRA20_SPDIF_CTRL_PACK |
78+ TEGRA20_SPDIF_CTRL_BIT_MODE_16BIT;
7979 break;
8080 default:
8181 return -EINVAL;
sound/soc/tegra/tegra30_i2s.c+3−3
@@ -118,7 +118,7 @@ static int tegra30_i2s_set_fmt(struct snd_soc_dai *dai, · 117 unmodified lines
118118 unsigned int fmt)
119119 {
120120 struct tegra30_i2s *i2s = snd_soc_dai_get_drvdata(dai);
121− unsigned int mask, val;
121+ unsigned int mask = 0, val = 0;
122122
123123 switch (fmt & SND_SOC_DAIFMT_INV_MASK) {
124124 case SND_SOC_DAIFMT_NB_NF:
@@ -127,10 +127,10 @@ static int tegra30_i2s_set_fmt(struct snd_soc_dai *dai, · 2 unmodified lines
127127 return -EINVAL;
128128 }
129129
130− mask = TEGRA30_I2S_CTRL_MASTER_ENABLE;
130+ mask |= TEGRA30_I2S_CTRL_MASTER_ENABLE;
131131 switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) {
132132 case SND_SOC_DAIFMT_CBS_CFS:
133− val = TEGRA30_I2S_CTRL_MASTER_ENABLE;
133+ val |= TEGRA30_I2S_CTRL_MASTER_ENABLE;
134134 break;
135135 case SND_SOC_DAIFMT_CBM_CFM:
136136 break;
tools/power/cpupower/utils/cpupower-set.c+3−3
@@ -18,9 +18,9 @@ · 17 unmodified lines
1818 #include "helpers/bitmask.h"
1919
2020 static struct option set_opts[] = {
21− { .name = "perf-bias", .has_arg = optional_argument, .flag = NULL, .val = 'b'},
22− { .name = "sched-mc", .has_arg = optional_argument, .flag = NULL, .val = 'm'},
23− { .name = "sched-smt", .has_arg = optional_argument, .flag = NULL, .val = 's'},
21+ { .name = "perf-bias", .has_arg = required_argument, .flag = NULL, .val = 'b'},
22+ { .name = "sched-mc", .has_arg = required_argument, .flag = NULL, .val = 'm'},
23+ { .name = "sched-smt", .has_arg = required_argument, .flag = NULL, .val = 's'},
2424 { },
2525 };
2626

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t